1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 SC_XCLIMPCHANGETRACK_HXX
21 #define SC_XCLIMPCHANGETRACK_HXX
23 #include <tools/datetime.hxx>
25 #include "xistream.hxx"
26 #include "excform.hxx"
30 //___________________________________________________________________
35 class XclImpChTrFmlConverter
;
38 //___________________________________________________________________
40 struct XclImpChTrRecHeader
48 inline XclImpStream
& operator>>( XclImpStream
& rStrm
, XclImpChTrRecHeader
& rRecHeader
)
50 rStrm
>> rRecHeader
.nSize
>> rRecHeader
.nIndex
>> rRecHeader
.nOpCode
>> rRecHeader
.nAccept
;
54 //___________________________________________________________________
56 class XclImpChangeTrack
: protected XclImpRoot
59 XclImpChTrRecHeader aRecHeader
;
62 ScChangeTrack
* pChangeTrack
;
63 SotStorageStreamRef xInStrm
; // input stream
64 XclImpStream
* pStrm
; // stream import class
65 sal_uInt16 nTabIdCount
;
66 sal_Bool bGlobExit
; // global exit loop
68 enum { nmBase
, nmFound
, nmNested
}
69 eNestedMode
; // action with nested content actions
71 inline sal_Bool
FoundNestedMode() { return eNestedMode
== nmFound
; }
73 void DoAcceptRejectAction( ScChangeAction
* pAction
);
74 void DoAcceptRejectAction( sal_uInt32 nFirst
, sal_uInt32 nLast
);
76 void DoInsertRange( const ScRange
& rRange
);
77 void DoDeleteRange( const ScRange
& rRange
);
79 inline sal_uInt8
LookAtuInt8();
80 inline double ReadRK();
81 inline sal_Bool
ReadBool();
82 inline void Read2DAddress( ScAddress
& rAddress
);
83 inline void Read2DRange( ScRange
& rRange
);
85 void ReadDateTime( DateTime
& rDateTime
);
87 inline void ReadString( String
& rString
);
89 sal_Bool
CheckRecord( sal_uInt16 nOpCode
);
92 ScTokenArray
*& rpTokenArray
,
93 const ScAddress
& rPosition
);
94 void ReadCell( ScCellValue
& rCell
, sal_uInt32
& rFormat
, sal_uInt16 nFlags
, const ScAddress
& rPosition
);
96 void ReadChTrInsert(); // 0x0137
97 void ReadChTrInfo(); // 0x0138
98 void ReadChTrCellContent(); // 0x013B
99 void ReadChTrTabId(); // 0x013D
100 void ReadChTrMoveRange(); // 0x0140
101 void ReadChTrInsertTab(); // 0x014D
102 void InitNestedMode(); // 0x014E, 0x0150
103 void ReadNestedRecords();
104 sal_Bool
EndNestedMode(); // 0x014F, 0x0151
109 XclImpChangeTrack( const XclImpRoot
& rRoot
, const XclImpStream
& rBookStrm
);
110 ~XclImpChangeTrack();
112 // reads extended 3D ref info following the formulas, returns sc tab nums
113 // ( called by XclImpChTrFmlConverter::Read3DTabReference() )
114 sal_Bool
Read3DTabRefInfo( SCTAB
& rFirstTab
, SCTAB
& rLastTab
, ExcelToSc8::ExternalTabInfo
& rExtInfo
);
119 inline sal_uInt8
XclImpChangeTrack::LookAtuInt8()
121 pStrm
->PushPosition();
124 pStrm
->PopPosition();
128 inline double XclImpChangeTrack::ReadRK()
130 return XclTools::GetDoubleFromRK( pStrm
->ReadInt32() );
133 inline sal_Bool
XclImpChangeTrack::ReadBool()
135 return (pStrm
->ReaduInt16() != 0);
138 inline void XclImpChangeTrack::Read2DAddress( ScAddress
& rAddress
)
140 rAddress
.SetRow( static_cast<SCROW
>(pStrm
->ReaduInt16()) );
141 rAddress
.SetCol( static_cast<SCCOL
>(pStrm
->ReaduInt16()) );
144 inline void XclImpChangeTrack::Read2DRange( ScRange
& rRange
)
146 rRange
.aStart
.SetRow( static_cast<SCROW
>(pStrm
->ReaduInt16()) );
147 rRange
.aEnd
.SetRow( static_cast<SCROW
>(pStrm
->ReaduInt16()) );
148 rRange
.aStart
.SetCol( static_cast<SCCOL
>(pStrm
->ReaduInt16()) );
149 rRange
.aEnd
.SetCol( static_cast<SCCOL
>(pStrm
->ReaduInt16()) );
152 inline void XclImpChangeTrack::ReadString( String
& rString
)
154 rString
= pStrm
->ReadUniString();
157 //___________________________________________________________________
158 // derived class for special 3D ref handling
160 class XclImpChTrFmlConverter
: public ExcelToSc8
163 XclImpChangeTrack
& rChangeTrack
;
165 virtual bool Read3DTabReference( sal_uInt16 nIxti
, SCTAB
& rFirstTab
, SCTAB
& rLastTab
, ExternalTabInfo
& rExtInfo
);
168 inline XclImpChTrFmlConverter(
169 const XclImpRoot
& rRoot
,
170 XclImpChangeTrack
& rXclChTr
);
171 virtual ~XclImpChTrFmlConverter();
174 inline XclImpChTrFmlConverter::XclImpChTrFmlConverter(
175 const XclImpRoot
& rRoot
,
176 XclImpChangeTrack
& rXclChTr
) :
178 rChangeTrack( rXclChTr
)
182 //___________________________________________________________________
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */