Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / filter / inc / XclImpChangeTrack.hxx
blobf89a5f068bef260b3fe07a17aadb8a0d493052d8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XCLIMPCHANGETRACK_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XCLIMPCHANGETRACK_HXX
23 #include "xiroot.hxx"
24 #include "xistream.hxx"
25 #include "excform.hxx"
27 struct ScCellValue;
28 class ScChangeAction;
29 class ScChangeTrack;
30 class DateTime;
32 struct XclImpChTrRecHeader
34 sal_uInt32 nSize;
35 sal_uInt32 nIndex;
36 sal_uInt16 nOpCode;
37 sal_uInt16 nAccept;
40 inline XclImpStream& operator>>( XclImpStream& rStrm, XclImpChTrRecHeader& rRecHeader )
42 rRecHeader.nSize = rStrm.ReaduInt32();
43 rRecHeader.nIndex = rStrm.ReaduInt32();
44 rRecHeader.nOpCode = rStrm.ReaduInt16();
45 rRecHeader.nAccept = rStrm.ReaduInt16();
46 return rStrm;
49 class XclImpChangeTrack : protected XclImpRoot
51 private:
52 XclImpChTrRecHeader aRecHeader;
53 OUString sOldUsername;
55 std::unique_ptr<ScChangeTrack> pChangeTrack;
56 tools::SvRef<SotStorageStream> xInStrm; // input stream
57 std::unique_ptr<XclImpStream> pStrm; // stream import class
58 sal_uInt16 nTabIdCount;
59 bool bGlobExit; // global exit loop
61 enum { nmBase, nmFound, nmNested }
62 eNestedMode; // action with nested content actions
64 bool FoundNestedMode() { return eNestedMode == nmFound; }
66 void DoAcceptRejectAction( ScChangeAction* pAction );
67 void DoAcceptRejectAction( sal_uInt32 nFirst, sal_uInt32 nLast );
69 void DoInsertRange( const ScRange& rRange, bool bEndOfList );
70 void DoDeleteRange( const ScRange& rRange );
72 inline sal_uInt8 LookAtuInt8();
73 inline void Read2DAddress( ScAddress& rAddress );
74 inline void Read2DRange( ScRange& rRange );
75 SCTAB ReadTabNum();
76 void ReadDateTime( DateTime& rDateTime );
78 bool CheckRecord( sal_uInt16 nOpCode );
80 void ReadFormula(
81 std::unique_ptr<ScTokenArray>& rpTokenArray,
82 const ScAddress& rPosition );
83 void ReadCell( ScCellValue& rCell, sal_uInt32& rFormat, sal_uInt16 nFlags, const ScAddress& rPosition );
85 void ReadChTrInsert(); // 0x0137
86 void ReadChTrInfo(); // 0x0138
87 void ReadChTrCellContent(); // 0x013B
88 void ReadChTrTabId(); // 0x013D
89 void ReadChTrMoveRange(); // 0x0140
90 void ReadChTrInsertTab(); // 0x014D
91 void InitNestedMode(); // 0x014E, 0x0150
92 void ReadNestedRecords();
93 bool EndNestedMode(); // 0x014F, 0x0151
95 void ReadRecords();
97 public:
98 XclImpChangeTrack( const XclImpRoot& rRoot, const XclImpStream& rBookStrm );
99 virtual ~XclImpChangeTrack() override;
101 // reads extended 3D ref info following the formulas, returns sc tab nums
102 // ( called by XclImpChTrFmlConverter::Read3DTabReference() )
103 void Read3DTabRefInfo( SCTAB& rFirstTab, SCTAB& rLastTab, ExcelToSc8::ExternalTabInfo& rExtInfo );
105 void Apply();
108 inline sal_uInt8 XclImpChangeTrack::LookAtuInt8()
110 pStrm->PushPosition();
111 sal_uInt8 nValue;
112 nValue = pStrm->ReaduInt8();
113 pStrm->PopPosition();
114 return nValue;
117 inline void XclImpChangeTrack::Read2DAddress( ScAddress& rAddress )
119 rAddress.SetRow( static_cast<SCROW>(pStrm->ReaduInt16()) );
120 rAddress.SetCol( static_cast<SCCOL>(pStrm->ReaduInt16()) );
123 inline void XclImpChangeTrack::Read2DRange( ScRange& rRange )
125 rRange.aStart.SetRow( static_cast<SCROW>(pStrm->ReaduInt16()) );
126 rRange.aEnd.SetRow( static_cast<SCROW>(pStrm->ReaduInt16()) );
127 rRange.aStart.SetCol( static_cast<SCCOL>(pStrm->ReaduInt16()) );
128 rRange.aEnd.SetCol( static_cast<SCCOL>(pStrm->ReaduInt16()) );
131 // derived class for special 3D ref handling
133 class XclImpChTrFmlConverter : public ExcelToSc8
135 private:
136 XclImpChangeTrack& rChangeTrack;
138 virtual bool Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo ) override;
140 public:
141 XclImpChTrFmlConverter( XclImpRoot& rRoot, XclImpChangeTrack& rXclChTr );
142 virtual ~XclImpChTrFmlConverter() override;
145 #endif
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */