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#pragma once
21
22#include "xiroot.hxx"
23#include "xistream.hxx"
24#include "excform.hxx"
25
26struct ScCellValue;
27class ScChangeAction;
28class ScChangeTrack;
29class DateTime;
30
32{
33 sal_uInt32 nSize;
34 sal_uInt32 nIndex;
35 sal_uInt16 nOpCode;
36 sal_uInt16 nAccept;
37};
38
40{
41 rRecHeader.nSize = rStrm.ReaduInt32();
42 rRecHeader.nIndex = rStrm.ReaduInt32();
43 rRecHeader.nOpCode = rStrm.ReaduInt16();
44 rRecHeader.nAccept = rStrm.ReaduInt16();
45 return rStrm;
46}
47
49{
50private:
52 OUString sOldUsername;
53
54 std::unique_ptr<ScChangeTrack> pChangeTrack;
56 std::unique_ptr<XclImpStream> pStrm; // stream import class
57 sal_uInt16 nTabIdCount;
58 bool bGlobExit; // global exit loop
59
61 eNestedMode; // action with nested content actions
62
63 bool FoundNestedMode() { return eNestedMode == nmFound; }
64
65 void DoAcceptRejectAction( ScChangeAction* pAction );
66 void DoAcceptRejectAction( sal_uInt32 nFirst, sal_uInt32 nLast );
67
68 void DoInsertRange( const ScRange& rRange, bool bEndOfList );
69 void DoDeleteRange( const ScRange& rRange );
70
71 inline sal_uInt8 LookAtuInt8();
72 inline void Read2DAddress( ScAddress& rAddress );
73 inline void Read2DRange( ScRange& rRange );
75 void ReadDateTime( DateTime& rDateTime );
76
77 bool CheckRecord( sal_uInt16 nOpCode );
78
79 void ReadFormula(
80 std::unique_ptr<ScTokenArray>& rpTokenArray,
81 const ScAddress& rPosition );
82 void ReadCell( ScCellValue& rCell, sal_uInt32& rFormat, sal_uInt16 nFlags, const ScAddress& rPosition );
83
84 void ReadChTrInsert(); // 0x0137
85 void ReadChTrInfo(); // 0x0138
86 void ReadChTrCellContent(); // 0x013B
87 void ReadChTrTabId(); // 0x013D
88 void ReadChTrMoveRange(); // 0x0140
89 void ReadChTrInsertTab(); // 0x014D
90 void InitNestedMode(); // 0x014E, 0x0150
91 void ReadNestedRecords();
92 bool EndNestedMode(); // 0x014F, 0x0151
93
94 void ReadRecords();
95
96public:
97 XclImpChangeTrack( const XclImpRoot& rRoot, const XclImpStream& rBookStrm );
98 virtual ~XclImpChangeTrack() override;
99
100 // reads extended 3D ref info following the formulas, returns sc tab nums
101 // ( called by XclImpChTrFmlConverter::Read3DTabReference() )
102 void Read3DTabRefInfo( SCTAB& rFirstTab, SCTAB& rLastTab, ExcelToSc8::ExternalTabInfo& rExtInfo );
103
104 void Apply();
105};
106
108{
109 pStrm->PushPosition();
111 nValue = pStrm->ReaduInt8();
112 pStrm->PopPosition();
113 return nValue;
114}
115
117{
118 rAddress.SetRow( static_cast<SCROW>(pStrm->ReaduInt16()) );
119 rAddress.SetCol( static_cast<SCCOL>(pStrm->ReaduInt16()) );
120}
121
123{
124 rRange.aStart.SetRow( static_cast<SCROW>(pStrm->ReaduInt16()) );
125 rRange.aEnd.SetRow( static_cast<SCROW>(pStrm->ReaduInt16()) );
126 rRange.aStart.SetCol( static_cast<SCCOL>(pStrm->ReaduInt16()) );
127 rRange.aEnd.SetCol( static_cast<SCCOL>(pStrm->ReaduInt16()) );
128}
129
130// derived class for special 3D ref handling
131
133{
134private:
136
137 virtual bool Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo ) override;
138
139public:
141 virtual ~XclImpChTrFmlConverter() override;
142};
143
144/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XclImpStream & operator>>(XclImpStream &rStrm, XclImpChTrRecHeader &rRecHeader)
void SetCol(SCCOL nColP)
Definition: address.hxx:291
void SetRow(SCROW nRowP)
Definition: address.hxx:287
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
virtual bool Read3DTabReference(sal_uInt16 nIxti, SCTAB &rFirstTab, SCTAB &rLastTab, ExternalTabInfo &rExtInfo) override
XclImpChTrFmlConverter(XclImpRoot &rRoot, XclImpChangeTrack &rXclChTr)
virtual ~XclImpChTrFmlConverter() override
XclImpChangeTrack & rChangeTrack
std::unique_ptr< XclImpStream > pStrm
XclImpChangeTrack(const XclImpRoot &rRoot, const XclImpStream &rBookStrm)
void ReadDateTime(DateTime &rDateTime)
virtual ~XclImpChangeTrack() override
void ReadFormula(std::unique_ptr< ScTokenArray > &rpTokenArray, const ScAddress &rPosition)
void DoInsertRange(const ScRange &rRange, bool bEndOfList)
tools::SvRef< SotStorageStream > xInStrm
XclImpChTrRecHeader aRecHeader
void DoDeleteRange(const ScRange &rRange)
std::unique_ptr< ScChangeTrack > pChangeTrack
void Read3DTabRefInfo(SCTAB &rFirstTab, SCTAB &rLastTab, ExcelToSc8::ExternalTabInfo &rExtInfo)
enum XclImpChangeTrack::@3 eNestedMode
void DoAcceptRejectAction(ScChangeAction *pAction)
void Read2DAddress(ScAddress &rAddress)
bool CheckRecord(sal_uInt16 nOpCode)
void ReadCell(ScCellValue &rCell, sal_uInt32 &rFormat, sal_uInt16 nFlags, const ScAddress &rPosition)
void Read2DRange(ScRange &rRange)
Access to global data from other classes.
Definition: xiroot.hxx:129
This class is used to import record oriented streams.
Definition: xistream.hxx:278
sal_Int16 nValue
void SvStream & rStrm
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:32
unsigned char sal_uInt8
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17