Update ooo320-m1
[ooovba.git] / sc / source / filter / inc / XclImpChangeTrack.hxx
blob7a66bc8e89fe84de26a2912f93ac5684a160670c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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>
35 #include "xiroot.hxx"
36 #include "xistream.hxx"
37 #include "excform.hxx"
38 #include "imp_op.hxx"
41 //___________________________________________________________________
43 class ScBaseCell;
44 class ScChangeAction;
45 class ScChangeTrack;
46 class XclImpChTrFmlConverter;
48 //___________________________________________________________________
50 struct XclImpChTrRecHeader
52 sal_uInt32 nSize;
53 sal_uInt32 nIndex;
54 sal_uInt16 nOpCode;
55 sal_uInt16 nAccept;
58 inline XclImpStream& operator>>( XclImpStream& rStrm, XclImpChTrRecHeader& rRecHeader )
60 rStrm >> rRecHeader.nSize >> rRecHeader.nIndex >> rRecHeader.nOpCode >> rRecHeader.nAccept;
61 return rStrm;
64 //___________________________________________________________________
66 class XclImpChangeTrack : protected XclImpRoot
68 private:
69 XclImpChTrRecHeader aRecHeader;
70 String sOldUsername;
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 );
94 SCTAB ReadTabNum();
95 void ReadDateTime( DateTime& rDateTime );
97 inline void ReadString( String& rString );
98 inline void IgnoreString();
100 sal_Bool CheckRecord( sal_uInt16 nOpCode );
102 void ReadFormula(
103 ScTokenArray*& rpTokenArray,
104 const ScAddress& rPosition );
105 void ReadCell(
106 ScBaseCell*& rpCell,
107 sal_uInt32& rFormat,
108 sal_uInt16 nFlags,
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
121 void ReadRecords();
123 public:
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 );
131 void Apply();
134 inline sal_uInt8 XclImpChangeTrack::LookAtuInt8()
136 pStrm->PushPosition();
137 sal_uInt8 nValue;
138 *pStrm >> nValue;
139 pStrm->PopPosition();
140 return nValue;
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
182 private:
183 XclImpChangeTrack& rChangeTrack;
185 virtual bool Read3DTabReference( UINT16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo );
187 public:
188 inline XclImpChTrFmlConverter(
189 const XclImpRoot& rRoot,
190 XclImpChangeTrack& rXclChTr );
191 virtual ~XclImpChTrFmlConverter();
194 inline XclImpChTrFmlConverter::XclImpChTrFmlConverter(
195 const XclImpRoot& rRoot,
196 XclImpChangeTrack& rXclChTr ) :
197 ExcelToSc8( rRoot ),
198 rChangeTrack( rXclChTr )
202 //___________________________________________________________________
204 #endif