1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_XMLCHANGETRACKINGEXPORTHELPER_HXX
25 #define SC_XMLCHANGETRACKINGEXPORTHELPER_HXX
26 
27 #include <xmloff/xmltoken.hxx>
28 #include <list>
29 #include <com/sun/star/text/XText.hpp>
30 #include <rtl/ustrbuf.hxx>
31 
32 class ScChangeAction;
33 class ScChangeTrack;
34 class ScXMLExport;
35 class ScBaseCell;
36 class ScChangeActionDel;
37 class ScBigRange;
38 class ScEditEngineTextObj;
39 class ScChangeActionTable;
40 class String;
41 class DateTime;
42 
43 typedef std::list<ScChangeActionDel*> ScMyDeletionsList;
44 
45 class ScChangeTrackingExportHelper
46 {
47 	ScXMLExport&	rExport;
48 
49 	ScChangeTrack*	pChangeTrack;
50 	ScEditEngineTextObj* pEditTextObj;
51 	ScChangeActionTable* pDependings;
52 	rtl::OUString	sChangeIDPrefix;
53 	com::sun::star::uno::Reference<com::sun::star::text::XText>	xText;
54 
55 	rtl::OUString GetChangeID(const sal_uInt32 nActionNumber);
56 	void GetAcceptanceState(const ScChangeAction* pAction);
57 
58 	void WriteBigRange(const ScBigRange& rBigRange, xmloff::token::XMLTokenEnum aName);
59 	void WriteChangeInfo(const ScChangeAction* pAction);
60 	void WriteGenerated(const ScChangeAction* pDependAction);
61 	void WriteDeleted(const ScChangeAction* pDependAction);
62 	void WriteDepending(const ScChangeAction* pDependAction);
63 	void WriteDependings(ScChangeAction* pAction);
64 
65 	void WriteEmptyCell();
66 	void SetValueAttributes(const double& fValue, const String& sValue);
67 	void WriteValueCell(const ScBaseCell* pCell, const String& sValue);
68 	void WriteStringCell(const ScBaseCell* pCell);
69 	void WriteEditCell(const ScBaseCell* pCell);
70 	void WriteFormulaCell(const ScBaseCell* pCell, const String& sValue);
71 	void WriteCell(const ScBaseCell* pCell, const String& sValue);
72 
73 	void WriteContentChange(ScChangeAction* pAction);
74 	void AddInsertionAttributes(const ScChangeAction* pAction);
75 	void WriteInsertion(ScChangeAction* pAction);
76 	void AddDeletionAttributes(const ScChangeActionDel* pAction, const ScChangeActionDel* pLastAction);
77 	void WriteDeletionCells(ScChangeActionDel* pAction);
78 	void WriteCutOffs(const ScChangeActionDel* pAction);
79 	void WriteDeletion(ScChangeAction* pAction);
80 	void WriteMovement(ScChangeAction* pAction);
81 	void WriteRejection(ScChangeAction* pAction);
82 
83 	void CollectCellAutoStyles(const ScBaseCell* pBaseCell);
84 	void CollectActionAutoStyles(ScChangeAction* pAction);
85 	void WorkWithChangeAction(ScChangeAction* pAction);
86 public:
87 	ScChangeTrackingExportHelper(ScXMLExport& rExport);
88 	~ScChangeTrackingExportHelper();
89 
90 	void CollectAutoStyles();
91 	void CollectAndWriteChanges();
92 };
93 
94 #endif
95