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#include <utility>
26
27class ScDocument;
28class DateTime;
29enum class ScMatrixMode : sal_uInt8;
30
32{
33 OUString sUser;
34 OUString sComment;
35 css::util::DateTime aDateTime;
36};
37
39{
42 OUString sFormula;
43 OUString sInputString;
44 double fValue;
45 sal_Int32 nMatrixCols;
46 sal_Int32 nMatrixRows;
48 sal_uInt16 nType;
50
52 ScCellValue aCell, OUString sFormulaAddress, OUString sFormula,
54 const double& fValue, const sal_uInt16 nType, const ScMatrixMode nMatrixFlag,
55 const sal_Int32 nMatrixCols, const sal_Int32 nMatrixRows );
57
58 const ScCellValue& CreateCell( ScDocument& rDoc );
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(std::move(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
104 aSourceRange(std::move(aSource)), aTargetRange(std::move(aTarget)) {}
105};
106
108{
111 std::vector<sal_uInt32> aDependencies;
112 std::vector<ScMyDeleted> aDeletedList;
113 sal_uInt32 nActionNumber;
115 sal_uInt32 nPreviousAction;
118
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
146 virtual ~ScMyMoveAction() override;
147};
148
150{
151 std::unique_ptr<ScMyCellInfo> pCellInfo;
152
154 virtual ~ScMyContentAction() override;
155};
156
158{
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;
169 std::unique_ptr<ScMyBaseAction> pCurrentAction;
170 sal_Int16 nMultiSpanned;
172
173private:
174 void ConvertInfo(const ScMyActionInfo& aInfo, OUString& rUser, DateTime& aDateTime);
175 std::unique_ptr<ScChangeAction> CreateInsertAction(const ScMyInsAction* pAction);
176 std::unique_ptr<ScChangeAction> CreateDeleteAction(const ScMyDelAction* pAction);
177 std::unique_ptr<ScChangeAction> CreateMoveAction(const ScMyMoveAction* pAction);
178 std::unique_ptr<ScChangeAction> CreateRejectionAction(const ScMyRejAction* pAction);
179 std::unique_ptr<ScChangeAction> CreateContentAction(const ScMyContentAction* pAction, ScDocument& rDoc);
180
181 void CreateGeneratedActions(std::vector<ScMyGenerated>& rList, ScDocument& rDoc);
182
183public:
186
187 void SetProtection(const css::uno::Sequence<sal_Int8>& rProtect) { aProtect = rProtect; }
188 void StartChangeAction(const ScChangeActionType nActionType);
189
190 static sal_uInt32 GetIDFromString(std::string_view sID);
191
192 void SetActionNumber(const sal_uInt32 nActionNumber) { pCurrentAction->nActionNumber = nActionNumber; }
193 void SetActionState(const ScChangeActionState nActionState) { pCurrentAction->nActionState = nActionState; }
194 void SetRejectingNumber(const sal_uInt32 nRejectingNumber) { pCurrentAction->nRejectingNumber = nRejectingNumber; }
195 void SetActionInfo(const ScMyActionInfo& aInfo);
196 void SetBigRange(const ScBigRange& aBigRange) { pCurrentAction->aBigRange = aBigRange; }
197 void SetPreviousChange(const sal_uInt32 nPreviousAction, ScMyCellInfo* pCellInfo);
198 void SetPosition(const sal_Int32 nPosition, const sal_Int32 nCount, const sal_Int32 nTable);
199 void AddDependence(const sal_uInt32 nID) { pCurrentAction->aDependencies.push_back(nID); }
200 void AddDeleted(const sal_uInt32 nID);
201 void AddDeleted(const sal_uInt32 nID, std::unique_ptr<ScMyCellInfo> pCellInfo);
202 void SetMultiSpanned(const sal_Int16 nMultiSpanned);
203 void SetInsertionCutOff(const sal_uInt32 nID, const sal_Int32 nPosition);
204 void AddMoveCutOff(const sal_uInt32 nID, const sal_Int32 nStartPosition, const sal_Int32 nEndPosition);
205 void SetMoveRanges(const ScBigRange& aSourceRange, const ScBigRange& aTargetRange);
207 void AddGenerated(std::unique_ptr<ScMyCellInfo> pCellInfo, const ScBigRange& aBigRange);
208
209 void EndChangeAction();
210
213 void SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent, const ScDocument& rDoc);
214 void SetDependencies(ScMyBaseAction* pAction, ScDocument& rDoc);
215
216 void SetNewCell(const ScMyContentAction* pAction, ScDocument& rDoc);
217
218 void CreateChangeTrack(ScDocument* pDoc);
219};
220
221/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScChangeActionType
Definition: chgtrack.hxx:63
ScChangeActionState
Definition: chgtrack.hxx:77
void SetMovementDependencies(ScMyMoveAction *pAction, ScChangeActionMove *pMoveAct)
std::unique_ptr< ScChangeAction > CreateMoveAction(const ScMyMoveAction *pAction)
void SetMultiSpanned(const sal_Int16 nMultiSpanned)
void SetNewCell(const ScMyContentAction *pAction, ScDocument &rDoc)
std::unique_ptr< ScChangeAction > CreateContentAction(const ScMyContentAction *pAction, ScDocument &rDoc)
static sal_uInt32 GetIDFromString(std::string_view sID)
void SetActionState(const ScChangeActionState nActionState)
void SetProtection(const css::uno::Sequence< sal_Int8 > &rProtect)
std::unique_ptr< ScChangeAction > CreateDeleteAction(const ScMyDelAction *pAction)
void StartChangeAction(const ScChangeActionType nActionType)
std::unique_ptr< ScMyBaseAction > pCurrentAction
void SetActionInfo(const ScMyActionInfo &aInfo)
void SetActionNumber(const sal_uInt32 nActionNumber)
void AddMoveCutOff(const sal_uInt32 nID, const sal_Int32 nStartPosition, const sal_Int32 nEndPosition)
void SetRejectingNumber(const sal_uInt32 nRejectingNumber)
void SetDependencies(ScMyBaseAction *pAction, ScDocument &rDoc)
void SetPreviousChange(const sal_uInt32 nPreviousAction, ScMyCellInfo *pCellInfo)
void CreateGeneratedActions(std::vector< ScMyGenerated > &rList, ScDocument &rDoc)
void SetMoveRanges(const ScBigRange &aSourceRange, const ScBigRange &aTargetRange)
std::vector< std::unique_ptr< ScMyBaseAction > > aActions
std::unique_ptr< ScChangeAction > CreateRejectionAction(const ScMyRejAction *pAction)
void AddGenerated(std::unique_ptr< ScMyCellInfo > pCellInfo, const ScBigRange &aBigRange)
void SetDeletionDependencies(ScMyDelAction *pAction, ScChangeActionDel *pDelAct)
void ConvertInfo(const ScMyActionInfo &aInfo, OUString &rUser, DateTime &aDateTime)
void SetContentDependencies(const ScMyContentAction *pAction, ScChangeActionContent *pActContent, const ScDocument &rDoc)
void SetBigRange(const ScBigRange &aBigRange)
void SetPosition(const sal_Int32 nPosition, const sal_Int32 nCount, const sal_Int32 nTable)
std::unique_ptr< ScChangeAction > CreateInsertAction(const ScMyInsAction *pAction)
void SetInsertionCutOff(const sal_uInt32 nID, const sal_Int32 nPosition)
ScMatrixMode
void * p
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:32
css::util::DateTime aDateTime
std::vector< sal_uInt32 > aDependencies
std::vector< ScMyDeleted > aDeletedList
ScMyBaseAction(const ScChangeActionType nActionType)
ScChangeActionState nActionState
formula::FormulaGrammar::Grammar eGrammar
const ScCellValue & CreateCell(ScDocument &rDoc)
ScMyCellInfo(ScCellValue aCell, OUString sFormulaAddress, OUString sFormula, const formula::FormulaGrammar::Grammar eGrammar, OUString sInputString, const double &fValue, const sal_uInt16 nType, const ScMatrixMode nMatrixFlag, const sal_Int32 nMatrixCols, const sal_Int32 nMatrixRows)
std::unique_ptr< ScMyCellInfo > pCellInfo
virtual ~ScMyDelAction() override
std::unique_ptr< ScMyInsertionCutOff > pInsCutOff
std::vector< ScMyMoveCutOff > aMoveCutOffs
ScMyDelAction(const ScChangeActionType nActionType)
std::vector< ScMyGenerated > aGeneratedList
std::unique_ptr< ScMyCellInfo > pCellInfo
ScMyDeleted(sal_uInt32 id, std::unique_ptr< ScMyCellInfo > p)
ScMyGenerated(ScBigRange range, sal_uInt32 id, std::unique_ptr< ScMyCellInfo > p)
std::unique_ptr< ScMyCellInfo > pCellInfo
ScMyInsAction(const ScChangeActionType nActionType)
virtual ~ScMyInsAction() override
ScMyInsertionCutOff(const sal_uInt32 nTempID, const sal_Int32 nTempPosition)
std::vector< ScMyGenerated > aGeneratedList
std::unique_ptr< ScMyMoveRanges > pMoveRanges
virtual ~ScMyMoveAction() override
ScMyMoveCutOff(const sal_uInt32 nTempID, const sal_Int32 nStartPos, const sal_Int32 nEndPos)
ScMyMoveRanges(ScBigRange aSource, ScBigRange aTarget)
virtual ~ScMyRejAction() override
unsigned char sal_uInt8