1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: conflictsdlg.hxx,v $
10 * $Revision: 1.4.32.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_CONFLICTSDLG_HXX
32 #define SC_CONFLICTSDLG_HXX
34 #include <vcl/button.hxx>
35 #include <vcl/dialog.hxx>
36 #include <vcl/fixed.hxx>
37 #include <vcl/lstbox.hxx>
38 #include <svx/ctredlin.hxx>
40 #include "chgtrack.hxx"
46 //=============================================================================
50 SC_CONFLICT_ACTION_NONE
,
51 SC_CONFLICT_ACTION_KEEP_MINE
,
52 SC_CONFLICT_ACTION_KEEP_OTHER
55 typedef ::std::vector
< ULONG
> ScChangeActionList
;
58 //=============================================================================
59 // struct ScConflictsListEntry
60 //=============================================================================
62 struct ScConflictsListEntry
64 ScConflictAction meConflictAction
;
65 ScChangeActionList maSharedActions
;
66 ScChangeActionList maOwnActions
;
68 bool HasSharedAction( ULONG nSharedAction
) const;
69 bool HasOwnAction( ULONG nOwnAction
) const;
73 //=============================================================================
75 typedef ::std::vector
< ScConflictsListEntry
> ScConflictsList
;
78 //=============================================================================
79 // class ScConflictsListHelper
80 //=============================================================================
82 class ScConflictsListHelper
85 static void Transform_Impl( ScChangeActionList
& rActionList
, ScChangeActionMergeMap
* pMergeMap
);
88 //UNUSED2008-05 static bool HasSharedAction( ScConflictsList& rConflictsList, ULONG nSharedAction );
89 static bool HasOwnAction( ScConflictsList
& rConflictsList
, ULONG nOwnAction
);
91 static ScConflictsListEntry
* GetSharedActionEntry( ScConflictsList
& rConflictsList
, ULONG nSharedAction
);
92 static ScConflictsListEntry
* GetOwnActionEntry( ScConflictsList
& rConflictsList
, ULONG nOwnAction
);
94 static void TransformConflictsList( ScConflictsList
& rConflictsList
,
95 ScChangeActionMergeMap
* pSharedMap
, ScChangeActionMergeMap
* pOwnMap
);
99 //=============================================================================
100 // class ScConflictsFinder
101 //=============================================================================
103 class ScConflictsFinder
106 ScChangeTrack
* mpTrack
;
111 ScConflictsList
& mrConflictsList
;
113 static bool DoActionsIntersect( const ScChangeAction
* pAction1
, const ScChangeAction
* pAction2
);
114 ScConflictsListEntry
* GetIntersectingEntry( const ScChangeAction
* pAction
) const;
115 ScConflictsListEntry
* GetEntry( ULONG nSharedAction
, const ScChangeActionList
& rOwnActions
);
118 ScConflictsFinder( ScChangeTrack
* pTrack
, ULONG nStartShared
, ULONG nEndShared
,
119 ULONG nStartOwn
, ULONG nEndOwn
, ScConflictsList
& rConflictsList
);
120 virtual ~ScConflictsFinder();
126 //=============================================================================
127 // class ScConflictsResolver
128 //=============================================================================
130 class ScConflictsResolver
133 ScChangeTrack
* mpTrack
;
134 ScConflictsList
& mrConflictsList
;
137 ScConflictsResolver( ScChangeTrack
* pTrack
, ScConflictsList
& rConflictsList
);
138 virtual ~ScConflictsResolver();
140 void HandleAction( ScChangeAction
* pAction
, bool bIsSharedAction
,
141 bool bHandleContentAction
, bool bHandleNonContentAction
);
145 //=============================================================================
146 // class ScConflictsListBox
147 //=============================================================================
149 class ScConflictsListBox
: public SvxRedlinTable
154 //UNUSED2008-05 ScConflictsListBox( Window* pParent, WinBits nBits = WB_BORDER );
155 ScConflictsListBox( Window
* pParent
, const ResId
& rResId
);
156 ~ScConflictsListBox();
158 //UNUSED2008-05 ULONG GetRootEntryPos( const SvLBoxEntry* pRootEntry ) const;
161 //=============================================================================
162 // class ScConflictsDlg
163 //=============================================================================
165 class ScConflictsDlg
: public ModalDialog
168 FixedText maFtConflicts
;
169 ScConflictsListBox maLbConflicts
;
170 PushButton maBtnKeepMine
;
171 PushButton maBtnKeepOther
;
172 FixedLine maFlConflicts
;
173 PushButton maBtnKeepAllMine
;
174 PushButton maBtnKeepAllOthers
;
175 CancelButton maBtnCancel
;
176 HelpButton maBtnHelp
;
178 String maStrTitleConflict
;
179 String maStrTitleAuthor
;
180 String maStrTitleDate
;
181 String maStrUnknownUser
;
183 ScViewData
* mpViewData
;
184 ScDocument
* mpOwnDoc
;
185 ScChangeTrack
* mpOwnTrack
;
186 ScDocument
* mpSharedDoc
;
187 ScChangeTrack
* mpSharedTrack
;
188 ScConflictsList
& mrConflictsList
;
191 Timer maSelectionTimer
;
193 bool mbInDeselectHdl
;
195 String
GetConflictString( const ScConflictsListEntry
& rConflictEntry
);
196 String
GetActionString( const ScChangeAction
* pAction
, ScDocument
* pDoc
);
197 void HandleListBoxSelection( bool bSelectHandle
);
199 void SetConflictAction( SvLBoxEntry
* pRootEntry
, ScConflictAction eConflictAction
);
200 void KeepHandler( bool bMine
);
201 void KeepAllHandler( bool bMine
);
203 DECL_LINK( SelectHandle
, SvxRedlinTable
* );
204 DECL_LINK( DeselectHandle
, SvxRedlinTable
* );
205 DECL_LINK( UpdateSelectionHdl
, Timer
* );
206 DECL_LINK( KeepMineHandle
, void* );
207 DECL_LINK( KeepOtherHandle
, void* );
208 DECL_LINK( KeepAllMineHandle
, void* );
209 DECL_LINK( KeepAllOthersHandle
, void* );
212 ScConflictsDlg( Window
* pParent
, ScViewData
* pViewData
, ScDocument
* pSharedDoc
, ScConflictsList
& rConflictsList
);
215 virtual void Resize();