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