LibreOffice Module sc (master)  1
XclImpChangeTrack.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_INC_XCLIMPCHANGETRACK_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XCLIMPCHANGETRACK_HXX
22 
23 #include "xiroot.hxx"
24 #include "xistream.hxx"
25 #include "excform.hxx"
26 
27 struct ScCellValue;
28 class ScChangeAction;
29 class ScChangeTrack;
30 class DateTime;
31 
33 {
34  sal_uInt32 nSize;
35  sal_uInt32 nIndex;
36  sal_uInt16 nOpCode;
37  sal_uInt16 nAccept;
38 };
39 
41 {
42  rRecHeader.nSize = rStrm.ReaduInt32();
43  rRecHeader.nIndex = rStrm.ReaduInt32();
44  rRecHeader.nOpCode = rStrm.ReaduInt16();
45  rRecHeader.nAccept = rStrm.ReaduInt16();
46  return rStrm;
47 }
48 
49 class XclImpChangeTrack : protected XclImpRoot
50 {
51 private:
53  OUString sOldUsername;
54 
55  std::unique_ptr<ScChangeTrack> pChangeTrack;
57  std::unique_ptr<XclImpStream> pStrm; // stream import class
58  sal_uInt16 nTabIdCount;
59  bool bGlobExit; // global exit loop
60 
61  enum { nmBase, nmFound, nmNested }
62  eNestedMode; // action with nested content actions
63 
64  bool FoundNestedMode() { return eNestedMode == nmFound; }
65 
66  void DoAcceptRejectAction( ScChangeAction* pAction );
67  void DoAcceptRejectAction( sal_uInt32 nFirst, sal_uInt32 nLast );
68 
69  void DoInsertRange( const ScRange& rRange, bool bEndOfList );
70  void DoDeleteRange( const ScRange& rRange );
71 
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 );
77 
78  bool CheckRecord( sal_uInt16 nOpCode );
79 
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 );
84 
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
94 
95  void ReadRecords();
96 
97 public:
98  XclImpChangeTrack( const XclImpRoot& rRoot, const XclImpStream& rBookStrm );
99  virtual ~XclImpChangeTrack() override;
100 
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 );
104 
105  void Apply();
106 };
107 
109 {
110  pStrm->PushPosition();
112  nValue = pStrm->ReaduInt8();
113  pStrm->PopPosition();
114  return nValue;
115 }
116 
118 {
119  rAddress.SetRow( static_cast<SCROW>(pStrm->ReaduInt16()) );
120  rAddress.SetCol( static_cast<SCCOL>(pStrm->ReaduInt16()) );
121 }
122 
124 {
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()) );
129 }
130 
131 // derived class for special 3D ref handling
132 
134 {
135 private:
137 
138  virtual bool Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo ) override;
139 
140 public:
142  virtual ~XclImpChTrFmlConverter() override;
143 };
144 
145 #endif
146 
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool Read3DTabReference(sal_uInt16 nIxti, SCTAB &rFirstTab, SCTAB &rLastTab, ExternalTabInfo &rExtInfo) override
ScAddress aStart
Definition: address.hxx:500
virtual ~XclImpChTrFmlConverter() override
ScAddress aEnd
Definition: address.hxx:501
void DoAcceptRejectAction(ScChangeAction *pAction)
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:36
XclImpChangeTrack(const XclImpRoot &rRoot, const XclImpStream &rBookStrm)
void ReadCell(ScCellValue &rCell, sal_uInt32 &rFormat, sal_uInt16 nFlags, const ScAddress &rPosition)
void SetRow(SCROW nRowP)
Definition: address.hxx:275
void SetCol(SCCOL nColP)
Definition: address.hxx:279
virtual ~XclImpChangeTrack() override
XclImpChTrFmlConverter(XclImpRoot &rRoot, XclImpChangeTrack &rXclChTr)
enum XclImpChangeTrack::@3 eNestedMode
void DoDeleteRange(const ScRange &rRange)
void ReadFormula(std::unique_ptr< ScTokenArray > &rpTokenArray, const ScAddress &rPosition)
sal_uInt16 ReaduInt16()
Definition: xistream.cxx:648
XclImpChangeTrack & rChangeTrack
unsigned char sal_uInt8
tools::SvRef< SotStorageStream > xInStrm
void Read2DRange(ScRange &rRange)
XclImpStream & operator>>(XclImpStream &rStrm, XclImpChTrRecHeader &rRecHeader)
bool CheckRecord(sal_uInt16 nOpCode)
This class is used to import record oriented streams.
Definition: xistream.hxx:278
void Read3DTabRefInfo(SCTAB &rFirstTab, SCTAB &rLastTab, ExcelToSc8::ExternalTabInfo &rExtInfo)
void DoInsertRange(const ScRange &rRange, bool bEndOfList)
void Read2DAddress(ScAddress &rAddress)
Access to global data from other classes.
Definition: xiroot.hxx:126
sal_uInt32 ReaduInt32()
Definition: xistream.cxx:684
void ReadDateTime(DateTime &rDateTime)
std::unique_ptr< ScChangeTrack > pChangeTrack
std::unique_ptr< XclImpStream > pStrm
sal_Int16 SCTAB
Definition: types.hxx:23
XclImpChTrRecHeader aRecHeader
sal_Int16 nValue