LibreOffice Module sc (master)  1
conflictsdlg.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_CONFLICTSDLG_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_CONFLICTSDLG_HXX
22 
23 #include <vcl/idle.hxx>
24 #include <svx/ctredlin.hxx>
25 
26 #include "docsh.hxx"
27 
28 class ScViewData;
29 class ScChangeTrack;
30 class ScChangeAction;
31 
33 {
37 };
38 
39 // struct ScConflictsListEntry
40 
42 {
44  std::vector<sal_uLong> maSharedActions;
45  std::vector<sal_uLong> maOwnActions;
46 
47  bool HasSharedAction( sal_uLong nSharedAction ) const;
48  bool HasOwnAction( sal_uLong nOwnAction ) const;
49 };
50 
51 typedef ::std::vector< ScConflictsListEntry > ScConflictsList;
52 
53 
55 {
56 private:
57  static void Transform_Impl( std::vector<sal_uLong>& rActionList, ScChangeActionMergeMap* pMergeMap );
58 
59 public:
60  static bool HasOwnAction( ScConflictsList& rConflictsList, sal_uLong nOwnAction );
61 
62  static ScConflictsListEntry* GetSharedActionEntry( ScConflictsList& rConflictsList, sal_uLong nSharedAction );
63  static ScConflictsListEntry* GetOwnActionEntry( ScConflictsList& rConflictsList, sal_uLong nOwnAction );
64 
65  static void TransformConflictsList( ScConflictsList& rConflictsList,
66  ScChangeActionMergeMap* pSharedMap, ScChangeActionMergeMap* pOwnMap );
67 };
68 
69 
70 class ScConflictsFinder final
71 {
72 private:
79 
80  static bool DoActionsIntersect( const ScChangeAction* pAction1, const ScChangeAction* pAction2 );
82  ScConflictsListEntry& GetEntry(sal_uLong nSharedAction, const std::vector<sal_uLong>& rOwnActions);
83 
84 public:
85  ScConflictsFinder( ScChangeTrack* pTrack, sal_uLong nStartShared, sal_uLong nEndShared,
86  sal_uLong nStartOwn, sal_uLong nEndOwn, ScConflictsList& rConflictsList );
88 
89  bool Find();
90 };
91 
92 
94 {
95 private:
98 
99 public:
100  ScConflictsResolver( ScChangeTrack* pTrack, ScConflictsList& rConflictsList );
102 
103  void HandleAction( ScChangeAction* pAction, bool bIsSharedAction,
104  bool bHandleContentAction, bool bHandleNonContentAction );
105 };
106 
107 
109 {
110 private:
112 
119 
122 
123  std::unique_ptr<weld::Button> m_xBtnKeepMine;
124  std::unique_ptr<weld::Button> m_xBtnKeepOther;
125  std::unique_ptr<weld::Button> m_xBtnKeepAllMine;
126  std::unique_ptr<weld::Button> m_xBtnKeepAllOthers;
127  std::unique_ptr<SvxRedlinTable> m_xLbConflicts;
128 
129  OUString GetConflictString( const ScConflictsListEntry& rConflictEntry );
130  void SetActionString(const ScChangeAction* pAction, ScDocument* pDoc, const weld::TreeIter& rEntry);
131  void HandleListBoxSelection();
132 
133  void SetConflictAction(const weld::TreeIter& rRootEntry, ScConflictAction eConflictAction);
134  void KeepHandler( bool bMine );
135  void KeepAllHandler( bool bMine );
136 
137  DECL_LINK( SelectHandle, weld::TreeView&, void );
138  DECL_LINK( UpdateSelectionHdl, Timer*, void );
139  DECL_LINK( KeepMineHandle, weld::Button&, void );
140  DECL_LINK( KeepOtherHandle, weld::Button&, void );
141  DECL_LINK( KeepAllMineHandle, weld::Button&, void );
142  DECL_LINK( KeepAllOthersHandle, weld::Button&, void );
143 
144 public:
145  ScConflictsDlg(weld::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList);
146  virtual ~ScConflictsDlg() override;
147 
148  void UpdateView();
149 };
150 
151 #endif
152 
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~ScConflictsDlg() override
OUString maStrUnknownUser
std::unordered_map< sal_uLong, sal_uLong > ScChangeActionMergeMap
Definition: docsh.hxx:65
ScChangeTrack * mpSharedTrack
sal_uIntPtr sal_uLong
sal_uLong mnEndShared
::std::vector< ScConflictsListEntry > ScConflictsList
std::unique_ptr< weld::Button > m_xBtnKeepAllOthers
sal_uLong mnStartOwn
void HandleListBoxSelection()
sal_uLong mnStartShared
ScDocument *const mpSharedDoc
ScChangeTrack * mpTrack
void HandleAction(ScChangeAction *pAction, bool bIsSharedAction, bool bHandleContentAction, bool bHandleNonContentAction)
void SetActionString(const ScChangeAction *pAction, ScDocument *pDoc, const weld::TreeIter &rEntry)
std::unique_ptr< weld::Button > m_xBtnKeepAllMine
std::unique_ptr< weld::Button > m_xBtnKeepMine
static void TransformConflictsList(ScConflictsList &rConflictsList, ScChangeActionMergeMap *pSharedMap, ScChangeActionMergeMap *pOwnMap)
ScConflictAction
ScConflictsList & mrConflictsList
ScConflictAction meConflictAction
static ScConflictsListEntry * GetOwnActionEntry(ScConflictsList &rConflictsList, sal_uLong nOwnAction)
bool HasOwnAction(sal_uLong nOwnAction) const
static bool DoActionsIntersect(const ScChangeAction *pAction1, const ScChangeAction *pAction2)
static void Transform_Impl(std::vector< sal_uLong > &rActionList, ScChangeActionMergeMap *pMergeMap)
static bool HasOwnAction(ScConflictsList &rConflictsList, sal_uLong nOwnAction)
ScConflictsList & mrConflictsList
bool HasSharedAction(sal_uLong nSharedAction) const
std::unique_ptr< SvxRedlinTable > m_xLbConflicts
ScChangeTrack * mpOwnTrack
DECL_LINK(SelectHandle, weld::TreeView &, void)
ScConflictsResolver(ScChangeTrack *pTrack, ScConflictsList &rConflictsList)
ScViewData *const mpViewData
std::unique_ptr< weld::Button > m_xBtnKeepOther
static ScConflictsListEntry * GetSharedActionEntry(ScConflictsList &rConflictsList, sal_uLong nSharedAction)
ScConflictsFinder(ScChangeTrack *pTrack, sal_uLong nStartShared, sal_uLong nEndShared, sal_uLong nStartOwn, sal_uLong nEndOwn, ScConflictsList &rConflictsList)
ScChangeTrack * mpTrack
ScConflictsList & mrConflictsList
void KeepAllHandler(bool bMine)
std::vector< sal_uLong > maOwnActions
ScConflictsListEntry * GetIntersectingEntry(const ScChangeAction *pAction) const
std::vector< sal_uLong > maSharedActions
ScConflictsDlg(weld::Window *pParent, ScViewData *pViewData, ScDocument *pSharedDoc, ScConflictsList &rConflictsList)
void SetConflictAction(const weld::TreeIter &rRootEntry, ScConflictAction eConflictAction)
ScConflictsListEntry & GetEntry(sal_uLong nSharedAction, const std::vector< sal_uLong > &rOwnActions)
ScDocument * mpOwnDoc
OUString GetConflictString(const ScConflictsListEntry &rConflictEntry)
void KeepHandler(bool bMine)