1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XclImpChangeTrack.hxx,v $
10 * $Revision: 1.21.134.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_XCLIMPCHANGETRACK_HXX
32 #define SC_XCLIMPCHANGETRACK_HXX
34 #include <tools/datetime.hxx>
36 #include "xistream.hxx"
37 #include "excform.hxx"
41 //___________________________________________________________________
46 class XclImpChTrFmlConverter
;
48 //___________________________________________________________________
50 struct XclImpChTrRecHeader
58 inline XclImpStream
& operator>>( XclImpStream
& rStrm
, XclImpChTrRecHeader
& rRecHeader
)
60 rStrm
>> rRecHeader
.nSize
>> rRecHeader
.nIndex
>> rRecHeader
.nOpCode
>> rRecHeader
.nAccept
;
64 //___________________________________________________________________
66 class XclImpChangeTrack
: protected XclImpRoot
69 XclImpChTrRecHeader aRecHeader
;
72 ScChangeTrack
* pChangeTrack
;
73 SotStorageStreamRef xInStrm
; // input stream
74 XclImpStream
* pStrm
; // stream import class
75 sal_uInt16 nTabIdCount
;
76 sal_Bool bGlobExit
; // global exit loop
78 enum { nmBase
, nmFound
, nmNested
}
79 eNestedMode
; // action with nested content actions
81 inline sal_Bool
FoundNestedMode() { return eNestedMode
== nmFound
; }
83 void DoAcceptRejectAction( ScChangeAction
* pAction
);
84 void DoAcceptRejectAction( sal_uInt32 nFirst
, sal_uInt32 nLast
);
86 void DoInsertRange( const ScRange
& rRange
);
87 void DoDeleteRange( const ScRange
& rRange
);
89 inline sal_uInt8
LookAtuInt8();
90 inline double ReadRK();
91 inline sal_Bool
ReadBool();
92 inline void Read2DAddress( ScAddress
& rAddress
);
93 inline void Read2DRange( ScRange
& rRange
);
95 void ReadDateTime( DateTime
& rDateTime
);
97 inline void ReadString( String
& rString
);
98 inline void IgnoreString();
100 sal_Bool
CheckRecord( sal_uInt16 nOpCode
);
103 ScTokenArray
*& rpTokenArray
,
104 const ScAddress
& rPosition
);
109 const ScAddress
& rPosition
);
111 void ReadChTrInsert(); // 0x0137
112 void ReadChTrInfo(); // 0x0138
113 void ReadChTrCellContent(); // 0x013B
114 void ReadChTrTabId(); // 0x013D
115 void ReadChTrMoveRange(); // 0x0140
116 void ReadChTrInsertTab(); // 0x014D
117 void InitNestedMode(); // 0x014E, 0x0150
118 void ReadNestedRecords();
119 sal_Bool
EndNestedMode(); // 0x014F, 0x0151
124 XclImpChangeTrack( const XclImpRoot
& rRoot
, const XclImpStream
& rBookStrm
);
125 ~XclImpChangeTrack();
127 // reads extended 3D ref info following the formulas, returns sc tab nums
128 // ( called by XclImpChTrFmlConverter::Read3DTabReference() )
129 sal_Bool
Read3DTabRefInfo( SCTAB
& rFirstTab
, SCTAB
& rLastTab
, ExcelToSc8::ExternalTabInfo
& rExtInfo
);
134 inline sal_uInt8
XclImpChangeTrack::LookAtuInt8()
136 pStrm
->PushPosition();
139 pStrm
->PopPosition();
143 inline double XclImpChangeTrack::ReadRK()
145 return XclTools::GetDoubleFromRK( pStrm
->ReadInt32() );
148 inline sal_Bool
XclImpChangeTrack::ReadBool()
150 return (pStrm
->ReaduInt16() != 0);
153 inline void XclImpChangeTrack::Read2DAddress( ScAddress
& rAddress
)
155 rAddress
.SetRow( static_cast<SCROW
>(pStrm
->ReaduInt16()) );
156 rAddress
.SetCol( static_cast<SCCOL
>(pStrm
->ReaduInt16()) );
159 inline void XclImpChangeTrack::Read2DRange( ScRange
& rRange
)
161 rRange
.aStart
.SetRow( static_cast<SCROW
>(pStrm
->ReaduInt16()) );
162 rRange
.aEnd
.SetRow( static_cast<SCROW
>(pStrm
->ReaduInt16()) );
163 rRange
.aStart
.SetCol( static_cast<SCCOL
>(pStrm
->ReaduInt16()) );
164 rRange
.aEnd
.SetCol( static_cast<SCCOL
>(pStrm
->ReaduInt16()) );
167 inline void XclImpChangeTrack::ReadString( String
& rString
)
169 rString
= pStrm
->ReadUniString();
172 inline void XclImpChangeTrack::IgnoreString()
174 pStrm
->IgnoreUniString();
177 //___________________________________________________________________
178 // derived class for special 3D ref handling
180 class XclImpChTrFmlConverter
: public ExcelToSc8
183 XclImpChangeTrack
& rChangeTrack
;
185 virtual bool Read3DTabReference( UINT16 nIxti
, SCTAB
& rFirstTab
, SCTAB
& rLastTab
, ExternalTabInfo
& rExtInfo
);
188 inline XclImpChTrFmlConverter(
189 const XclImpRoot
& rRoot
,
190 XclImpChangeTrack
& rXclChTr
);
191 virtual ~XclImpChTrFmlConverter();
194 inline XclImpChTrFmlConverter::XclImpChTrFmlConverter(
195 const XclImpRoot
& rRoot
,
196 XclImpChangeTrack
& rXclChTr
) :
198 rChangeTrack( rXclChTr
)
202 //___________________________________________________________________