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 #pragma once
21 
22 #include <vcl/idle.hxx>
23 #include <svx/ctredlin.hxx>
24 
25 #include "docsh.hxx"
26 
27 class ScViewData;
28 class ScChangeTrack;
29 class ScChangeAction;
30 
32 {
36 };
37 
38 // struct ScConflictsListEntry
39 
41 {
43  std::vector<sal_uLong> maSharedActions;
44  std::vector<sal_uLong> maOwnActions;
45 
46  bool HasSharedAction( sal_uLong nSharedAction ) const;
47  bool HasOwnAction( sal_uLong nOwnAction ) const;
48 };
49 
50 typedef ::std::vector< ScConflictsListEntry > ScConflictsList;
51 
52 
54 {
55 private:
56  static void Transform_Impl( std::vector<sal_uLong>& rActionList, ScChangeActionMergeMap* pMergeMap );
57 
58 public:
59  static bool HasOwnAction( ScConflictsList& rConflictsList, sal_uLong nOwnAction );
60 
61  static ScConflictsListEntry* GetSharedActionEntry( ScConflictsList& rConflictsList, sal_uLong nSharedAction );
62  static ScConflictsListEntry* GetOwnActionEntry( ScConflictsList& rConflictsList, sal_uLong nOwnAction );
63 
64  static void TransformConflictsList( ScConflictsList& rConflictsList,
65  ScChangeActionMergeMap* pSharedMap, ScChangeActionMergeMap* pOwnMap );
66 };
67 
68 
69 class ScConflictsFinder final
70 {
71 private:
78 
79  static bool DoActionsIntersect( const ScChangeAction* pAction1, const ScChangeAction* pAction2 );
81  ScConflictsListEntry& GetEntry(sal_uLong nSharedAction, const std::vector<sal_uLong>& rOwnActions);
82 
83 public:
84  ScConflictsFinder( ScChangeTrack* pTrack, sal_uLong nStartShared, sal_uLong nEndShared,
85  sal_uLong nStartOwn, sal_uLong nEndOwn, ScConflictsList& rConflictsList );
87 
88  bool Find();
89 };
90 
91 
93 {
94 private:
97 
98 public:
99  ScConflictsResolver( ScChangeTrack* pTrack, ScConflictsList& rConflictsList );
101 
102  void HandleAction( ScChangeAction* pAction, bool bIsSharedAction,
103  bool bHandleContentAction, bool bHandleNonContentAction );
104 };
105 
106 
108 {
109 private:
111 
118 
121 
122  std::unique_ptr<weld::Button> m_xBtnKeepMine;
123  std::unique_ptr<weld::Button> m_xBtnKeepOther;
124  std::unique_ptr<weld::Button> m_xBtnKeepAllMine;
125  std::unique_ptr<weld::Button> m_xBtnKeepAllOthers;
126  std::unique_ptr<SvxRedlinTable> m_xLbConflicts;
127 
128  OUString GetConflictString( const ScConflictsListEntry& rConflictEntry );
129  void SetActionString(const ScChangeAction* pAction, ScDocument* pDoc, const weld::TreeIter& rEntry);
130  void HandleListBoxSelection();
131 
132  void SetConflictAction(const weld::TreeIter& rRootEntry, ScConflictAction eConflictAction);
133  void KeepHandler( bool bMine );
134  void KeepAllHandler( bool bMine );
135 
136  DECL_LINK( SelectHandle, weld::TreeView&, void );
137  DECL_LINK( UpdateSelectionHdl, Timer*, void );
138  DECL_LINK( KeepMineHandle, weld::Button&, void );
139  DECL_LINK( KeepOtherHandle, weld::Button&, void );
140  DECL_LINK( KeepAllMineHandle, weld::Button&, void );
141  DECL_LINK( KeepAllOthersHandle, weld::Button&, void );
142 
143 public:
144  ScConflictsDlg(weld::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList);
145  virtual ~ScConflictsDlg() override;
146 
147  void UpdateView();
148 };
149 
150 /* 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)