fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / inc / conflictsdlg.hxx
blob03e6e831b271974ca6ce7821da1976610bd8dcac
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SC_SOURCE_UI_INC_CONFLICTSDLG_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_CONFLICTSDLG_HXX
23 #include <vcl/button.hxx>
24 #include <vcl/dialog.hxx>
25 #include <vcl/fixed.hxx>
26 #include <vcl/lstbox.hxx>
27 #include <vcl/idle.hxx>
28 #include <svx/ctredlin.hxx>
30 #include "chgtrack.hxx"
31 #include "docsh.hxx"
33 class ScViewData;
35 enum ScConflictAction
37 SC_CONFLICT_ACTION_NONE,
38 SC_CONFLICT_ACTION_KEEP_MINE,
39 SC_CONFLICT_ACTION_KEEP_OTHER
42 typedef ::std::vector< sal_uLong > ScChangeActionList;
44 // struct ScConflictsListEntry
46 struct ScConflictsListEntry
48 ScConflictAction meConflictAction;
49 ScChangeActionList maSharedActions;
50 ScChangeActionList maOwnActions;
52 bool HasSharedAction( sal_uLong nSharedAction ) const;
53 bool HasOwnAction( sal_uLong nOwnAction ) const;
56 typedef ::std::vector< ScConflictsListEntry > ScConflictsList;
58 // class ScConflictsListHelper
60 class ScConflictsListHelper
62 private:
63 static void Transform_Impl( ScChangeActionList& rActionList, ScChangeActionMergeMap* pMergeMap );
65 public:
66 static bool HasOwnAction( ScConflictsList& rConflictsList, sal_uLong nOwnAction );
68 static ScConflictsListEntry* GetSharedActionEntry( ScConflictsList& rConflictsList, sal_uLong nSharedAction );
69 static ScConflictsListEntry* GetOwnActionEntry( ScConflictsList& rConflictsList, sal_uLong nOwnAction );
71 static void TransformConflictsList( ScConflictsList& rConflictsList,
72 ScChangeActionMergeMap* pSharedMap, ScChangeActionMergeMap* pOwnMap );
75 // class ScConflictsFinder
77 class ScConflictsFinder
79 private:
80 ScChangeTrack* mpTrack;
81 sal_uLong mnStartShared;
82 sal_uLong mnEndShared;
83 sal_uLong mnStartOwn;
84 sal_uLong mnEndOwn;
85 ScConflictsList& mrConflictsList;
87 static bool DoActionsIntersect( const ScChangeAction* pAction1, const ScChangeAction* pAction2 );
88 ScConflictsListEntry* GetIntersectingEntry( const ScChangeAction* pAction ) const;
89 ScConflictsListEntry* GetEntry( sal_uLong nSharedAction, const ScChangeActionList& rOwnActions );
91 public:
92 ScConflictsFinder( ScChangeTrack* pTrack, sal_uLong nStartShared, sal_uLong nEndShared,
93 sal_uLong nStartOwn, sal_uLong nEndOwn, ScConflictsList& rConflictsList );
94 virtual ~ScConflictsFinder();
96 bool Find();
99 // class ScConflictsResolver
101 class ScConflictsResolver
103 private:
104 ScChangeTrack* mpTrack;
105 ScConflictsList& mrConflictsList;
107 public:
108 ScConflictsResolver( ScChangeTrack* pTrack, ScConflictsList& rConflictsList );
109 virtual ~ScConflictsResolver();
111 void HandleAction( ScChangeAction* pAction, bool bIsSharedAction,
112 bool bHandleContentAction, bool bHandleNonContentAction );
115 // class ScConflictsDlg
117 class ScConflictsDlg : public ModalDialog
119 private:
120 VclPtr<SvSimpleTableContainer> m_pLbConflictsContainer;
121 VclPtr<SvxRedlinTable> m_pLbConflicts;
122 VclPtr<PushButton> m_pBtnKeepMine;
123 VclPtr<PushButton> m_pBtnKeepOther;
124 VclPtr<PushButton> m_pBtnKeepAllMine;
125 VclPtr<PushButton> m_pBtnKeepAllOthers;
127 OUString maStrTitleConflict;
128 OUString maStrTitleAuthor;
129 OUString maStrTitleDate;
130 OUString maStrUnknownUser;
132 ScViewData* mpViewData;
133 ScDocument* mpOwnDoc;
134 ScChangeTrack* mpOwnTrack;
135 ScDocument* mpSharedDoc;
136 ScChangeTrack* mpSharedTrack;
137 ScConflictsList& mrConflictsList;
138 Size maDialogSize;
140 Idle maSelectionIdle;
141 bool mbInSelectHdl;
142 bool mbInDeselectHdl;
144 OUString GetConflictString( const ScConflictsListEntry& rConflictEntry );
145 OUString GetActionString( const ScChangeAction* pAction, ScDocument* pDoc );
146 void HandleListBoxSelection( bool bSelectHandle );
148 static void SetConflictAction( SvTreeListEntry* pRootEntry, ScConflictAction eConflictAction );
149 void KeepHandler( bool bMine );
150 void KeepAllHandler( bool bMine );
152 DECL_LINK( SelectHandle, void* );
153 DECL_LINK( DeselectHandle, void* );
154 DECL_LINK_TYPED( UpdateSelectionHdl, Idle*, void );
155 DECL_LINK( KeepMineHandle, void* );
156 DECL_LINK( KeepOtherHandle, void* );
157 DECL_LINK( KeepAllMineHandle, void* );
158 DECL_LINK( KeepAllOthersHandle, void* );
160 public:
161 ScConflictsDlg( vcl::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList );
162 virtual ~ScConflictsDlg();
163 virtual void dispose() SAL_OVERRIDE;
165 void UpdateView();
168 #endif
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */