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 #ifndef INCLUDED_SC_SOURCE_FILTER_XML_XMLCHANGETRACKINGIMPORTHELPER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLCHANGETRACKINGIMPORTHELPER_HXX
22 
23 #include <memory>
24 #include <chgtrack.hxx>
25 #include <com/sun/star/util/DateTime.hpp>
26 
27 class ScDocument;
28 class DateTime;
29 enum class ScMatrixMode : sal_uInt8;
30 
32 {
33  OUString sUser;
34  OUString sComment;
35  css::util::DateTime aDateTime;
36 };
37 
39 {
41  OUString sFormulaAddress;
42  OUString sFormula;
43  OUString sInputString;
44  double fValue;
45  sal_Int32 nMatrixCols;
46  sal_Int32 nMatrixRows;
48  sal_uInt16 nType;
50 
52  const ScCellValue& rCell, const OUString& sFormulaAddress, const OUString& sFormula,
53  const formula::FormulaGrammar::Grammar eGrammar, const OUString& sInputString,
54  const double& fValue, const sal_uInt16 nType, const ScMatrixMode nMatrixFlag,
55  const sal_Int32 nMatrixCols, const sal_Int32 nMatrixRows );
56  ~ScMyCellInfo();
57 
58  const ScCellValue& CreateCell( ScDocument* pDoc );
59 };
60 
62 {
63  sal_uInt32 nID = 0;
64  std::unique_ptr<ScMyCellInfo> pCellInfo;
65 
66  ScMyDeleted(sal_uInt32 id, std::unique_ptr<ScMyCellInfo> p) : nID(id), pCellInfo(std::move(p)) {}
67 };
68 
70 {
72  sal_uInt32 nID = 0;
73  std::unique_ptr<ScMyCellInfo> pCellInfo;
74 
75  ScMyGenerated(ScBigRange range, sal_uInt32 id, std::unique_ptr<ScMyCellInfo> p)
76  : aBigRange(range), nID(id), pCellInfo(std::move(p)) {}
77 };
78 
80 {
81  sal_uInt32 nID;
82  sal_Int32 nPosition;
83 
84  ScMyInsertionCutOff(const sal_uInt32 nTempID, const sal_Int32 nTempPosition) :
85  nID(nTempID), nPosition(nTempPosition) {}
86 };
87 
89 {
90  sal_uInt32 nID;
91  sal_Int32 nStartPosition;
92  sal_Int32 nEndPosition;
93 
94  ScMyMoveCutOff(const sal_uInt32 nTempID, const sal_Int32 nStartPos, const sal_Int32 nEndPos) :
95  nID(nTempID), nStartPosition(nStartPos), nEndPosition(nEndPos) {}
96 };
97 
99 {
102 
103  ScMyMoveRanges(const ScBigRange& rSource, const ScBigRange& rTarget) :
104  aSourceRange(rSource), aTargetRange(rTarget) {}
105 };
106 
108 {
111  std::vector<sal_uInt32> aDependencies;
112  std::vector<ScMyDeleted> aDeletedList;
113  sal_uInt32 nActionNumber;
114  sal_uInt32 nRejectingNumber;
115  sal_uInt32 nPreviousAction;
118 
119  explicit ScMyBaseAction(const ScChangeActionType nActionType);
120  virtual ~ScMyBaseAction();
121 };
122 
124 {
126  virtual ~ScMyInsAction() override;
127 };
128 
130 {
131  std::vector<ScMyGenerated> aGeneratedList;
132  std::unique_ptr<ScMyInsertionCutOff> pInsCutOff;
133  std::vector<ScMyMoveCutOff> aMoveCutOffs;
134  sal_Int32 nD;
135 
137  virtual ~ScMyDelAction() override;
138 };
139 
141 {
142  std::vector<ScMyGenerated> aGeneratedList;
143  std::unique_ptr<ScMyMoveRanges> pMoveRanges;
144 
145  ScMyMoveAction();
146  virtual ~ScMyMoveAction() override;
147 };
148 
150 {
151  std::unique_ptr<ScMyCellInfo> pCellInfo;
152 
154  virtual ~ScMyContentAction() override;
155 };
156 
158 {
159  ScMyRejAction();
160  virtual ~ScMyRejAction() override;
161 };
162 
164 {
165  std::set<OUString> aUsers;
166  std::vector<std::unique_ptr<ScMyBaseAction>> aActions;
167  css::uno::Sequence<sal_Int8> aProtect;
170  std::unique_ptr<ScMyBaseAction> pCurrentAction;
171  sal_Int16 nMultiSpanned;
173 
174 private:
175  void ConvertInfo(const ScMyActionInfo& aInfo, OUString& rUser, DateTime& aDateTime);
176  std::unique_ptr<ScChangeAction> CreateInsertAction(const ScMyInsAction* pAction);
177  std::unique_ptr<ScChangeAction> CreateDeleteAction(const ScMyDelAction* pAction);
178  std::unique_ptr<ScChangeAction> CreateMoveAction(const ScMyMoveAction* pAction);
179  std::unique_ptr<ScChangeAction> CreateRejectionAction(const ScMyRejAction* pAction);
180  std::unique_ptr<ScChangeAction> CreateContentAction(const ScMyContentAction* pAction);
181 
182  void CreateGeneratedActions(std::vector<ScMyGenerated>& rList);
183 
184 public:
187 
188  void SetProtection(const css::uno::Sequence<sal_Int8>& rProtect) { aProtect = rProtect; }
189  void StartChangeAction(const ScChangeActionType nActionType);
190 
191  static sal_uInt32 GetIDFromString(const OUString& sID);
192 
193  void SetActionNumber(const sal_uInt32 nActionNumber) { pCurrentAction->nActionNumber = nActionNumber; }
194  void SetActionState(const ScChangeActionState nActionState) { pCurrentAction->nActionState = nActionState; }
195  void SetRejectingNumber(const sal_uInt32 nRejectingNumber) { pCurrentAction->nRejectingNumber = nRejectingNumber; }
196  void SetActionInfo(const ScMyActionInfo& aInfo);
197  void SetBigRange(const ScBigRange& aBigRange) { pCurrentAction->aBigRange = aBigRange; }
198  void SetPreviousChange(const sal_uInt32 nPreviousAction, ScMyCellInfo* pCellInfo);
199  void SetPosition(const sal_Int32 nPosition, const sal_Int32 nCount, const sal_Int32 nTable);
200  void AddDependence(const sal_uInt32 nID) { pCurrentAction->aDependencies.push_back(nID); }
201  void AddDeleted(const sal_uInt32 nID);
202  void AddDeleted(const sal_uInt32 nID, std::unique_ptr<ScMyCellInfo> pCellInfo);
203  void SetMultiSpanned(const sal_Int16 nMultiSpanned);
204  void SetInsertionCutOff(const sal_uInt32 nID, const sal_Int32 nPosition);
205  void AddMoveCutOff(const sal_uInt32 nID, const sal_Int32 nStartPosition, const sal_Int32 nEndPosition);
206  void SetMoveRanges(const ScBigRange& aSourceRange, const ScBigRange& aTargetRange);
207  void GetMultiSpannedRange();
208  void AddGenerated(std::unique_ptr<ScMyCellInfo> pCellInfo, const ScBigRange& aBigRange);
209 
210  void EndChangeAction();
211 
214  void SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent);
215  void SetDependencies(ScMyBaseAction* pAction);
216 
217  void SetNewCell(const ScMyContentAction* pAction);
218 
219  void CreateChangeTrack(ScDocument* pDoc);
220 };
221 
222 #endif
223 
224 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetContentDependencies(const ScMyContentAction *pAction, ScChangeActionContent *pActContent)
ScChangeActionState
Definition: chgtrack.hxx:77
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)
static sal_uInt32 GetIDFromString(const OUString &sID)
std::vector< ScMyDeleted > aDeletedList
ScChangeActionType
Definition: chgtrack.hxx:63
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)
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:36
ScChangeActionState nActionState
void SetBigRange(const ScBigRange &aBigRange)
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)
void SetNewCell(const ScMyContentAction *pAction)
const ScCellValue & CreateCell(ScDocument *pDoc)
void CreateGeneratedActions(std::vector< ScMyGenerated > &rList)
std::unique_ptr< ScChangeAction > CreateRejectionAction(const ScMyRejAction *pAction)
void ConvertInfo(const ScMyActionInfo &aInfo, OUString &rUser, DateTime &aDateTime)
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)
void SetDependencies(ScMyBaseAction *pAction)
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)
std::unique_ptr< ScChangeAction > CreateContentAction(const ScMyContentAction *pAction)
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