LibreOffice Module sc (master)  1
XMLChangeTrackingImportHelper.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 <memory>
23 #include <chgtrack.hxx>
24 #include <com/sun/star/util/DateTime.hpp>
25 
26 class ScDocument;
27 class DateTime;
28 enum class ScMatrixMode : sal_uInt8;
29 
31 {
32  OUString sUser;
33  OUString sComment;
34  css::util::DateTime aDateTime;
35 };
36 
38 {
40  OUString sFormulaAddress;
41  OUString sFormula;
42  OUString sInputString;
43  double fValue;
44  sal_Int32 nMatrixCols;
45  sal_Int32 nMatrixRows;
47  sal_uInt16 nType;
49 
51  const ScCellValue& rCell, const OUString& sFormulaAddress, const OUString& sFormula,
52  const formula::FormulaGrammar::Grammar eGrammar, const OUString& sInputString,
53  const double& fValue, const sal_uInt16 nType, const ScMatrixMode nMatrixFlag,
54  const sal_Int32 nMatrixCols, const sal_Int32 nMatrixRows );
55  ~ScMyCellInfo();
56 
57  const ScCellValue& CreateCell( ScDocument& rDoc );
58 };
59 
61 {
62  sal_uInt32 nID = 0;
63  std::unique_ptr<ScMyCellInfo> pCellInfo;
64 
65  ScMyDeleted(sal_uInt32 id, std::unique_ptr<ScMyCellInfo> p) : nID(id), pCellInfo(std::move(p)) {}
66 };
67 
69 {
71  sal_uInt32 nID = 0;
72  std::unique_ptr<ScMyCellInfo> pCellInfo;
73 
74  ScMyGenerated(ScBigRange range, sal_uInt32 id, std::unique_ptr<ScMyCellInfo> p)
75  : aBigRange(range), nID(id), pCellInfo(std::move(p)) {}
76 };
77 
79 {
80  sal_uInt32 nID;
81  sal_Int32 nPosition;
82 
83  ScMyInsertionCutOff(const sal_uInt32 nTempID, const sal_Int32 nTempPosition) :
84  nID(nTempID), nPosition(nTempPosition) {}
85 };
86 
88 {
89  sal_uInt32 nID;
90  sal_Int32 nStartPosition;
91  sal_Int32 nEndPosition;
92 
93  ScMyMoveCutOff(const sal_uInt32 nTempID, const sal_Int32 nStartPos, const sal_Int32 nEndPos) :
94  nID(nTempID), nStartPosition(nStartPos), nEndPosition(nEndPos) {}
95 };
96 
98 {
101 
102  ScMyMoveRanges(const ScBigRange& rSource, const ScBigRange& rTarget) :
103  aSourceRange(rSource), aTargetRange(rTarget) {}
104 };
105 
107 {
110  std::vector<sal_uInt32> aDependencies;
111  std::vector<ScMyDeleted> aDeletedList;
112  sal_uInt32 nActionNumber;
113  sal_uInt32 nRejectingNumber;
114  sal_uInt32 nPreviousAction;
117 
118  explicit ScMyBaseAction(const ScChangeActionType nActionType);
119  virtual ~ScMyBaseAction();
120 };
121 
123 {
125  virtual ~ScMyInsAction() override;
126 };
127 
129 {
130  std::vector<ScMyGenerated> aGeneratedList;
131  std::unique_ptr<ScMyInsertionCutOff> pInsCutOff;
132  std::vector<ScMyMoveCutOff> aMoveCutOffs;
133  sal_Int32 nD;
134 
136  virtual ~ScMyDelAction() override;
137 };
138 
140 {
141  std::vector<ScMyGenerated> aGeneratedList;
142  std::unique_ptr<ScMyMoveRanges> pMoveRanges;
143 
144  ScMyMoveAction();
145  virtual ~ScMyMoveAction() override;
146 };
147 
149 {
150  std::unique_ptr<ScMyCellInfo> pCellInfo;
151 
153  virtual ~ScMyContentAction() override;
154 };
155 
157 {
158  ScMyRejAction();
159  virtual ~ScMyRejAction() override;
160 };
161 
163 {
164  std::set<OUString> aUsers;
165  std::vector<std::unique_ptr<ScMyBaseAction>> aActions;
166  css::uno::Sequence<sal_Int8> aProtect;
168  std::unique_ptr<ScMyBaseAction> pCurrentAction;
169  sal_Int16 nMultiSpanned;
171 
172 private:
173  void ConvertInfo(const ScMyActionInfo& aInfo, OUString& rUser, DateTime& aDateTime);
174  std::unique_ptr<ScChangeAction> CreateInsertAction(const ScMyInsAction* pAction);
175  std::unique_ptr<ScChangeAction> CreateDeleteAction(const ScMyDelAction* pAction);
176  std::unique_ptr<ScChangeAction> CreateMoveAction(const ScMyMoveAction* pAction);
177  std::unique_ptr<ScChangeAction> CreateRejectionAction(const ScMyRejAction* pAction);
178  std::unique_ptr<ScChangeAction> CreateContentAction(const ScMyContentAction* pAction, ScDocument& rDoc);
179 
180  void CreateGeneratedActions(std::vector<ScMyGenerated>& rList, ScDocument& rDoc);
181 
182 public:
185 
186  void SetProtection(const css::uno::Sequence<sal_Int8>& rProtect) { aProtect = rProtect; }
187  void StartChangeAction(const ScChangeActionType nActionType);
188 
189  static sal_uInt32 GetIDFromString(std::string_view sID);
190 
191  void SetActionNumber(const sal_uInt32 nActionNumber) { pCurrentAction->nActionNumber = nActionNumber; }
192  void SetActionState(const ScChangeActionState nActionState) { pCurrentAction->nActionState = nActionState; }
193  void SetRejectingNumber(const sal_uInt32 nRejectingNumber) { pCurrentAction->nRejectingNumber = nRejectingNumber; }
194  void SetActionInfo(const ScMyActionInfo& aInfo);
195  void SetBigRange(const ScBigRange& aBigRange) { pCurrentAction->aBigRange = aBigRange; }
196  void SetPreviousChange(const sal_uInt32 nPreviousAction, ScMyCellInfo* pCellInfo);
197  void SetPosition(const sal_Int32 nPosition, const sal_Int32 nCount, const sal_Int32 nTable);
198  void AddDependence(const sal_uInt32 nID) { pCurrentAction->aDependencies.push_back(nID); }
199  void AddDeleted(const sal_uInt32 nID);
200  void AddDeleted(const sal_uInt32 nID, std::unique_ptr<ScMyCellInfo> pCellInfo);
201  void SetMultiSpanned(const sal_Int16 nMultiSpanned);
202  void SetInsertionCutOff(const sal_uInt32 nID, const sal_Int32 nPosition);
203  void AddMoveCutOff(const sal_uInt32 nID, const sal_Int32 nStartPosition, const sal_Int32 nEndPosition);
204  void SetMoveRanges(const ScBigRange& aSourceRange, const ScBigRange& aTargetRange);
205  void GetMultiSpannedRange();
206  void AddGenerated(std::unique_ptr<ScMyCellInfo> pCellInfo, const ScBigRange& aBigRange);
207 
208  void EndChangeAction();
209 
212  void SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent, ScDocument& rDoc);
213  void SetDependencies(ScMyBaseAction* pAction, ScDocument& rDoc);
214 
215  void SetNewCell(const ScMyContentAction* pAction, ScDocument& rDoc);
216 
217  void CreateChangeTrack(ScDocument* pDoc);
218 };
219 
220 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScChangeActionState
Definition: chgtrack.hxx:76
std::vector< ScMyMoveCutOff > aMoveCutOffs
void AddGenerated(std::unique_ptr< ScMyCellInfo > pCellInfo, const ScBigRange &aBigRange)
std::unique_ptr< ScMyCellInfo > pCellInfo
ScMyDeleted(sal_uInt32 id, std::unique_ptr< ScMyCellInfo > p)
void StartChangeAction(const ScChangeActionType nActionType)
ScMyMoveCutOff(const sal_uInt32 nTempID, const sal_Int32 nStartPos, const sal_Int32 nEndPos)
void SetRejectingNumber(const sal_uInt32 nRejectingNumber)
std::vector< ScMyDeleted > aDeletedList
ScChangeActionType
Definition: chgtrack.hxx:62
std::unique_ptr< ScChangeAction > CreateInsertAction(const ScMyInsAction *pAction)
std::unique_ptr< ScChangeAction > CreateDeleteAction(const ScMyDelAction *pAction)
void SetProtection(const css::uno::Sequence< sal_Int8 > &rProtect)
virtual ~ScMyDelAction() override
void SetActionInfo(const ScMyActionInfo &aInfo)
std::vector< std::unique_ptr< ScMyBaseAction > > aActions
void SetMovementDependencies(ScMyMoveAction *pAction, ScChangeActionMove *pMoveAct)
void SetPreviousChange(const sal_uInt32 nPreviousAction, ScMyCellInfo *pCellInfo)
ScMyMoveRanges(const ScBigRange &rSource, const ScBigRange &rTarget)
std::unique_ptr< ScChangeAction > CreateContentAction(const ScMyContentAction *pAction, ScDocument &rDoc)
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:35
ScChangeActionState nActionState
void SetNewCell(const ScMyContentAction *pAction, ScDocument &rDoc)
void SetDependencies(ScMyBaseAction *pAction, ScDocument &rDoc)
static sal_uInt32 GetIDFromString(std::string_view sID)
void SetBigRange(const ScBigRange &aBigRange)
void CreateGeneratedActions(std::vector< ScMyGenerated > &rList, ScDocument &rDoc)
virtual ~ScMyMoveAction() override
void AddMoveCutOff(const sal_uInt32 nID, const sal_Int32 nStartPosition, const sal_Int32 nEndPosition)
void SetActionState(const ScChangeActionState nActionState)
void SetPosition(const sal_Int32 nPosition, const sal_Int32 nCount, const sal_Int32 nTable)
void SetDeletionDependencies(ScMyDelAction *pAction, ScChangeActionDel *pDelAct)
std::unique_ptr< ScChangeAction > CreateRejectionAction(const ScMyRejAction *pAction)
void ConvertInfo(const ScMyActionInfo &aInfo, OUString &rUser, DateTime &aDateTime)
void SetContentDependencies(const ScMyContentAction *pAction, ScChangeActionContent *pActContent, ScDocument &rDoc)
std::vector< ScMyGenerated > aGeneratedList
virtual ~ScMyRejAction() override
ScMyInsertionCutOff(const sal_uInt32 nTempID, const sal_Int32 nTempPosition)
std::unique_ptr< ScMyInsertionCutOff > pInsCutOff
void SetMultiSpanned(const sal_Int16 nMultiSpanned)
std::unique_ptr< ScMyCellInfo > pCellInfo
ScMyInsAction(const ScChangeActionType nActionType)
std::vector< ScMyGenerated > aGeneratedList
std::unique_ptr< ScMyCellInfo > pCellInfo
ScMyBaseAction(const ScChangeActionType nActionType)
unsigned char sal_uInt8
std::unique_ptr< ScMyMoveRanges > pMoveRanges
ScMyCellInfo(const ScCellValue &rCell, const OUString &sFormulaAddress, const OUString &sFormula, const formula::FormulaGrammar::Grammar eGrammar, const OUString &sInputString, const double &fValue, const sal_uInt16 nType, const ScMatrixMode nMatrixFlag, const sal_Int32 nMatrixCols, const sal_Int32 nMatrixRows)
const ScCellValue & CreateCell(ScDocument &rDoc)
ScMatrixMode
formula::FormulaGrammar::Grammar eGrammar
virtual ~ScMyInsAction() override
ScMyGenerated(ScBigRange range, sal_uInt32 id, std::unique_ptr< ScMyCellInfo > p)
void SetActionNumber(const sal_uInt32 nActionNumber)
ScMyDelAction(const ScChangeActionType nActionType)
void SetInsertionCutOff(const sal_uInt32 nID, const sal_Int32 nPosition)
std::vector< sal_uInt32 > aDependencies
void SetMoveRanges(const ScBigRange &aSourceRange, const ScBigRange &aTargetRange)
std::unique_ptr< ScChangeAction > CreateMoveAction(const ScMyMoveAction *pAction)
css::util::DateTime aDateTime
std::unique_ptr< ScMyBaseAction > pCurrentAction