Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_CONFLICTSDLG_HXX
30 : : #define SC_CONFLICTSDLG_HXX
31 : :
32 : : #include <vcl/button.hxx>
33 : : #include <vcl/dialog.hxx>
34 : : #include <vcl/fixed.hxx>
35 : : #include <vcl/lstbox.hxx>
36 : : #include <svx/ctredlin.hxx>
37 : :
38 : : #include "chgtrack.hxx"
39 : : #include "docsh.hxx"
40 : :
41 : : class ScViewData;
42 : :
43 : :
44 : : //=============================================================================
45 : :
46 : : enum ScConflictAction
47 : : {
48 : : SC_CONFLICT_ACTION_NONE,
49 : : SC_CONFLICT_ACTION_KEEP_MINE,
50 : : SC_CONFLICT_ACTION_KEEP_OTHER
51 : : };
52 : :
53 : : typedef ::std::vector< sal_uLong > ScChangeActionList;
54 : :
55 : :
56 : : //=============================================================================
57 : : // struct ScConflictsListEntry
58 : : //=============================================================================
59 : :
60 [ # # ][ # # ]: 0 : struct ScConflictsListEntry
61 : : {
62 : : ScConflictAction meConflictAction;
63 : : ScChangeActionList maSharedActions;
64 : : ScChangeActionList maOwnActions;
65 : :
66 : : bool HasSharedAction( sal_uLong nSharedAction ) const;
67 : : bool HasOwnAction( sal_uLong nOwnAction ) const;
68 : : };
69 : :
70 : :
71 : : //=============================================================================
72 : :
73 : : typedef ::std::vector< ScConflictsListEntry > ScConflictsList;
74 : :
75 : :
76 : : //=============================================================================
77 : : // class ScConflictsListHelper
78 : : //=============================================================================
79 : :
80 : : class ScConflictsListHelper
81 : : {
82 : : private:
83 : : static void Transform_Impl( ScChangeActionList& rActionList, ScChangeActionMergeMap* pMergeMap );
84 : :
85 : : public:
86 : : static bool HasOwnAction( ScConflictsList& rConflictsList, sal_uLong nOwnAction );
87 : :
88 : : static ScConflictsListEntry* GetSharedActionEntry( ScConflictsList& rConflictsList, sal_uLong nSharedAction );
89 : : static ScConflictsListEntry* GetOwnActionEntry( ScConflictsList& rConflictsList, sal_uLong nOwnAction );
90 : :
91 : : static void TransformConflictsList( ScConflictsList& rConflictsList,
92 : : ScChangeActionMergeMap* pSharedMap, ScChangeActionMergeMap* pOwnMap );
93 : : };
94 : :
95 : :
96 : : //=============================================================================
97 : : // class ScConflictsFinder
98 : : //=============================================================================
99 : :
100 : : class ScConflictsFinder
101 : : {
102 : : private:
103 : : ScChangeTrack* mpTrack;
104 : : sal_uLong mnStartShared;
105 : : sal_uLong mnEndShared;
106 : : sal_uLong mnStartOwn;
107 : : sal_uLong mnEndOwn;
108 : : ScConflictsList& mrConflictsList;
109 : :
110 : : static bool DoActionsIntersect( const ScChangeAction* pAction1, const ScChangeAction* pAction2 );
111 : : ScConflictsListEntry* GetIntersectingEntry( const ScChangeAction* pAction ) const;
112 : : ScConflictsListEntry* GetEntry( sal_uLong nSharedAction, const ScChangeActionList& rOwnActions );
113 : :
114 : : public:
115 : : ScConflictsFinder( ScChangeTrack* pTrack, sal_uLong nStartShared, sal_uLong nEndShared,
116 : : sal_uLong nStartOwn, sal_uLong nEndOwn, ScConflictsList& rConflictsList );
117 : : virtual ~ScConflictsFinder();
118 : :
119 : : bool Find();
120 : : };
121 : :
122 : :
123 : : //=============================================================================
124 : : // class ScConflictsResolver
125 : : //=============================================================================
126 : :
127 : : class ScConflictsResolver
128 : : {
129 : : private:
130 : : ScChangeTrack* mpTrack;
131 : : ScConflictsList& mrConflictsList;
132 : :
133 : : public:
134 : : ScConflictsResolver( ScChangeTrack* pTrack, ScConflictsList& rConflictsList );
135 : : virtual ~ScConflictsResolver();
136 : :
137 : : void HandleAction( ScChangeAction* pAction, bool bIsSharedAction,
138 : : bool bHandleContentAction, bool bHandleNonContentAction );
139 : : };
140 : :
141 : :
142 : : //=============================================================================
143 : : // class ScConflictsDlg
144 : : //=============================================================================
145 : :
146 : : class ScConflictsDlg : public ModalDialog
147 : : {
148 : : private:
149 : : FixedText maFtConflicts;
150 : : SvxSimpleTableContainer m_aLbConflictsContainer;
151 : : SvxRedlinTable maLbConflicts;
152 : : PushButton maBtnKeepMine;
153 : : PushButton maBtnKeepOther;
154 : : FixedLine maFlConflicts;
155 : : PushButton maBtnKeepAllMine;
156 : : PushButton maBtnKeepAllOthers;
157 : : CancelButton maBtnCancel;
158 : : HelpButton maBtnHelp;
159 : :
160 : : String maStrTitleConflict;
161 : : String maStrTitleAuthor;
162 : : String maStrTitleDate;
163 : : String maStrUnknownUser;
164 : :
165 : : ScViewData* mpViewData;
166 : : ScDocument* mpOwnDoc;
167 : : ScChangeTrack* mpOwnTrack;
168 : : ScDocument* mpSharedDoc;
169 : : ScChangeTrack* mpSharedTrack;
170 : : ScConflictsList& mrConflictsList;
171 : : Size maDialogSize;
172 : :
173 : : Timer maSelectionTimer;
174 : : bool mbInSelectHdl;
175 : : bool mbInDeselectHdl;
176 : :
177 : : String GetConflictString( const ScConflictsListEntry& rConflictEntry );
178 : : String GetActionString( const ScChangeAction* pAction, ScDocument* pDoc );
179 : : void HandleListBoxSelection( bool bSelectHandle );
180 : :
181 : : void SetConflictAction( SvLBoxEntry* pRootEntry, ScConflictAction eConflictAction );
182 : : void KeepHandler( bool bMine );
183 : : void KeepAllHandler( bool bMine );
184 : :
185 : : DECL_LINK( SelectHandle, void* );
186 : : DECL_LINK( DeselectHandle, void* );
187 : : DECL_LINK( UpdateSelectionHdl, void* );
188 : : DECL_LINK( KeepMineHandle, void* );
189 : : DECL_LINK( KeepOtherHandle, void* );
190 : : DECL_LINK( KeepAllMineHandle, void* );
191 : : DECL_LINK( KeepAllOthersHandle, void* );
192 : :
193 : : public:
194 : : ScConflictsDlg( Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList );
195 : : ~ScConflictsDlg();
196 : :
197 : : virtual void Resize();
198 : : void UpdateView();
199 : : };
200 : :
201 : : #endif
202 : :
203 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|