1*e3508121SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*e3508121SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*e3508121SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*e3508121SAndrew Rist * distributed with this work for additional information
6*e3508121SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*e3508121SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*e3508121SAndrew Rist * "License"); you may not use this file except in compliance
9*e3508121SAndrew Rist * with the License. You may obtain a copy of the License at
10*e3508121SAndrew Rist *
11*e3508121SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*e3508121SAndrew Rist *
13*e3508121SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*e3508121SAndrew Rist * software distributed under the License is distributed on an
15*e3508121SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*e3508121SAndrew Rist * KIND, either express or implied. See the License for the
17*e3508121SAndrew Rist * specific language governing permissions and limitations
18*e3508121SAndrew Rist * under the License.
19*e3508121SAndrew Rist *
20*e3508121SAndrew Rist *************************************************************/
21*e3508121SAndrew Rist
22*e3508121SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #ifndef OOX_DUMP_BIFFDUMPER_HXX
25cdf0e10cSrcweir #define OOX_DUMP_BIFFDUMPER_HXX
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "oox/dump/dumperbase.hxx"
28cdf0e10cSrcweir #include "oox/dump/dffdumper.hxx"
29cdf0e10cSrcweir #include "oox/dump/oledumper.hxx"
30cdf0e10cSrcweir #include "oox/xls/richstring.hxx"
31cdf0e10cSrcweir #include "oox/xls/biffinputstream.hxx"
32cdf0e10cSrcweir
33cdf0e10cSrcweir #if OOX_INCLUDE_DUMPER
34cdf0e10cSrcweir
35cdf0e10cSrcweir namespace oox { namespace xls {
36cdf0e10cSrcweir class BiffInputStream;
37cdf0e10cSrcweir class FontPortionModelList;
38cdf0e10cSrcweir struct FunctionInfo;
39cdf0e10cSrcweir class FunctionProvider;
40cdf0e10cSrcweir } }
41cdf0e10cSrcweir
42cdf0e10cSrcweir namespace oox {
43cdf0e10cSrcweir namespace dump {
44cdf0e10cSrcweir namespace biff {
45cdf0e10cSrcweir
46cdf0e10cSrcweir typedef ::boost::shared_ptr< ::oox::xls::BiffInputStream > BiffInputStreamRef;
47cdf0e10cSrcweir
48cdf0e10cSrcweir // ============================================================================
49cdf0e10cSrcweir // ============================================================================
50cdf0e10cSrcweir
51cdf0e10cSrcweir class BiffDffStreamObject : public DffStreamObject
52cdf0e10cSrcweir {
53cdf0e10cSrcweir public:
54cdf0e10cSrcweir explicit BiffDffStreamObject(
55cdf0e10cSrcweir const OutputObjectBase& rParent,
56cdf0e10cSrcweir const BinaryInputStreamRef& rxStrm );
57cdf0e10cSrcweir
58cdf0e10cSrcweir protected:
59cdf0e10cSrcweir virtual void implDumpClientAnchor();
60cdf0e10cSrcweir };
61cdf0e10cSrcweir
62cdf0e10cSrcweir // ============================================================================
63cdf0e10cSrcweir
64cdf0e10cSrcweir class BiffCtlsStreamObject : public InputObjectBase
65cdf0e10cSrcweir {
66cdf0e10cSrcweir public:
67cdf0e10cSrcweir explicit BiffCtlsStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm );
68cdf0e10cSrcweir
69cdf0e10cSrcweir void dumpControl( sal_uInt32 nStartPos, sal_uInt32 nLength );
70cdf0e10cSrcweir
71cdf0e10cSrcweir protected:
72cdf0e10cSrcweir virtual void implDump();
73cdf0e10cSrcweir
74cdf0e10cSrcweir private:
75cdf0e10cSrcweir sal_uInt32 mnStartPos;
76cdf0e10cSrcweir sal_uInt32 mnLength;
77cdf0e10cSrcweir };
78cdf0e10cSrcweir
79cdf0e10cSrcweir // ============================================================================
80cdf0e10cSrcweir // ============================================================================
81cdf0e10cSrcweir
82cdf0e10cSrcweir class BiffConfig : public Config
83cdf0e10cSrcweir {
84cdf0e10cSrcweir public:
85cdf0e10cSrcweir explicit BiffConfig( const Config& rParent, ::oox::xls::BiffType eBiff );
86cdf0e10cSrcweir
87cdf0e10cSrcweir protected:
88cdf0e10cSrcweir virtual bool implIsValid() const;
89cdf0e10cSrcweir virtual NameListRef implGetNameList( const ::rtl::OUString& rKey ) const;
90cdf0e10cSrcweir
91cdf0e10cSrcweir private:
92cdf0e10cSrcweir ::oox::xls::BiffType meBiff;
93cdf0e10cSrcweir };
94cdf0e10cSrcweir
95cdf0e10cSrcweir // ============================================================================
96cdf0e10cSrcweir
97cdf0e10cSrcweir class BiffSharedData : public Base
98cdf0e10cSrcweir {
99cdf0e10cSrcweir public:
100cdf0e10cSrcweir explicit BiffSharedData( ::oox::xls::BiffType eBiff );
101cdf0e10cSrcweir
102cdf0e10cSrcweir void initializePerSheet();
103cdf0e10cSrcweir
getBiff() const104cdf0e10cSrcweir inline ::oox::xls::BiffType getBiff() const { return meBiff; }
105cdf0e10cSrcweir
getTextEncoding() const106cdf0e10cSrcweir inline rtl_TextEncoding getTextEncoding() const { return meTextEnc; }
107cdf0e10cSrcweir void setTextEncoding( rtl_TextEncoding eTextEnc );
108cdf0e10cSrcweir
109cdf0e10cSrcweir sal_uInt16 getFontCount() const;
110cdf0e10cSrcweir rtl_TextEncoding getFontEncoding( sal_uInt16 nFontId ) const;
111cdf0e10cSrcweir void appendFontEncoding( rtl_TextEncoding eFontEnc );
112cdf0e10cSrcweir
113cdf0e10cSrcweir sal_uInt16 getXfCount() const;
114cdf0e10cSrcweir rtl_TextEncoding getXfEncoding( sal_uInt16 nXfId ) const;
115cdf0e10cSrcweir void appendXfFontId( sal_uInt16 nFontId );
116cdf0e10cSrcweir
117cdf0e10cSrcweir protected:
118cdf0e10cSrcweir virtual bool implIsValid() const;
119cdf0e10cSrcweir
120cdf0e10cSrcweir private:
121cdf0e10cSrcweir typedef ::std::vector< rtl_TextEncoding > TextEncVec;
122cdf0e10cSrcweir typedef ::std::vector< sal_uInt16 > FontIdVec;
123cdf0e10cSrcweir
124cdf0e10cSrcweir TextEncVec maFontEncs;
125cdf0e10cSrcweir FontIdVec maXfFontIds;
126cdf0e10cSrcweir ::oox::xls::BiffType meBiff;
127cdf0e10cSrcweir rtl_TextEncoding meTextEnc;
128cdf0e10cSrcweir };
129cdf0e10cSrcweir
130cdf0e10cSrcweir // ============================================================================
131cdf0e10cSrcweir
132cdf0e10cSrcweir class BiffObjectBase : public RecordObjectBase
133cdf0e10cSrcweir {
134cdf0e10cSrcweir public:
getBiffData() const135cdf0e10cSrcweir inline BiffSharedData& getBiffData() const { return *mxBiffData; }
getBiffStream() const136cdf0e10cSrcweir inline ::oox::xls::BiffInputStream& getBiffStream() const { return *mxBiffStrm; }
getBiff() const137cdf0e10cSrcweir inline ::oox::xls::BiffType getBiff() const { return mxBiffData->getBiff(); }
138cdf0e10cSrcweir
139cdf0e10cSrcweir protected:
BiffObjectBase()140cdf0e10cSrcweir inline explicit BiffObjectBase() {}
141cdf0e10cSrcweir virtual ~BiffObjectBase();
142cdf0e10cSrcweir
143cdf0e10cSrcweir using InputObjectBase::construct;
144cdf0e10cSrcweir void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, ::oox::xls::BiffType eBiff, const ::rtl::OUString& rSysFileName );
145cdf0e10cSrcweir void construct( const BiffObjectBase& rParent );
146cdf0e10cSrcweir
147cdf0e10cSrcweir virtual bool implIsValid() const;
148cdf0e10cSrcweir virtual bool implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize );
149cdf0e10cSrcweir
getLastRecId() const150cdf0e10cSrcweir inline sal_uInt16 getLastRecId() const { return mnLastRecId; }
151cdf0e10cSrcweir ::rtl::OUString getErrorName( sal_uInt8 nErrCode ) const;
152cdf0e10cSrcweir
153cdf0e10cSrcweir // ------------------------------------------------------------------------
154cdf0e10cSrcweir
155cdf0e10cSrcweir sal_Int32 readCol( bool bCol16Bit );
156cdf0e10cSrcweir sal_Int32 readRow( bool bRow32Bit );
157cdf0e10cSrcweir void readAddress( Address& orAddress, bool bCol16Bit = true, bool bRow32Bit = false );
158cdf0e10cSrcweir void readRange( Range& orRange, bool bCol16Bit = true, bool bRow32Bit = false );
159cdf0e10cSrcweir void readRangeList( RangeList& orRanges, bool bCol16Bit = true, bool bRow32Bit = false );
160cdf0e10cSrcweir
161cdf0e10cSrcweir // ------------------------------------------------------------------------
162cdf0e10cSrcweir
163cdf0e10cSrcweir void writeBooleanItem( const String& rName, sal_uInt8 nBool );
164cdf0e10cSrcweir void writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode );
165cdf0e10cSrcweir
166cdf0e10cSrcweir void writeFontPortions( const ::oox::xls::FontPortionModelList& rPortions );
167cdf0e10cSrcweir
168cdf0e10cSrcweir template< typename Type >
169cdf0e10cSrcweir void writeRectItem( const String& rName,
170cdf0e10cSrcweir Type nLeft, Type nTop, Type nWidth, Type nHeight,
171cdf0e10cSrcweir const NameListWrapper& rListWrp = NO_LIST,
172cdf0e10cSrcweir FormatType eFmtType = FORMATTYPE_DEC );
173cdf0e10cSrcweir
174cdf0e10cSrcweir // ------------------------------------------------------------------------
175cdf0e10cSrcweir
176cdf0e10cSrcweir ::rtl::OUString dumpByteString(
177cdf0e10cSrcweir const String& rName,
178cdf0e10cSrcweir ::oox::xls::BiffStringFlags nFlags = ::oox::xls::BIFF_STR_DEFAULT,
179cdf0e10cSrcweir rtl_TextEncoding eDefaultTextEnc = RTL_TEXTENCODING_DONTKNOW );
180cdf0e10cSrcweir ::rtl::OUString dumpUniString(
181cdf0e10cSrcweir const String& rName,
182cdf0e10cSrcweir ::oox::xls::BiffStringFlags nFlags = ::oox::xls::BIFF_STR_DEFAULT );
183cdf0e10cSrcweir ::rtl::OUString dumpString(
184cdf0e10cSrcweir const String& rName,
185cdf0e10cSrcweir ::oox::xls::BiffStringFlags nByteFlags = ::oox::xls::BIFF_STR_DEFAULT,
186cdf0e10cSrcweir ::oox::xls::BiffStringFlags nUniFlags = ::oox::xls::BIFF_STR_DEFAULT,
187cdf0e10cSrcweir rtl_TextEncoding eDefaultTextEnc = RTL_TEXTENCODING_DONTKNOW );
188cdf0e10cSrcweir
189cdf0e10cSrcweir ::rtl::OUString dumpSegmentedUniString( const String& rName );
190cdf0e10cSrcweir void dumpSegmentedUniStringArray( const String& rName );
191cdf0e10cSrcweir
192cdf0e10cSrcweir sal_uInt8 dumpBoolean( const String& rName = EMPTY_STRING );
193cdf0e10cSrcweir sal_uInt8 dumpErrorCode( const String& rName = EMPTY_STRING );
194cdf0e10cSrcweir
195cdf0e10cSrcweir rtl_TextEncoding dumpCodePage( const String& rName = EMPTY_STRING );
196cdf0e10cSrcweir void dumpFormulaResult( const String& rName = EMPTY_STRING );
197cdf0e10cSrcweir
198cdf0e10cSrcweir sal_Int32 dumpColIndex( const String& rName = EMPTY_STRING, bool bCol16Bit = true );
199cdf0e10cSrcweir sal_Int32 dumpRowIndex( const String& rName = EMPTY_STRING, bool bRow32Bit = false );
200cdf0e10cSrcweir sal_Int32 dumpColRange( const String& rName = EMPTY_STRING, bool bCol16Bit = true );
201cdf0e10cSrcweir sal_Int32 dumpRowRange( const String& rName = EMPTY_STRING, bool bRow32Bit = false );
202cdf0e10cSrcweir
203cdf0e10cSrcweir Address dumpAddress( const String& rName = EMPTY_STRING, bool bCol16Bit = true, bool bRow32Bit = false );
204cdf0e10cSrcweir Range dumpRange( const String& rName = EMPTY_STRING, bool bCol16Bit = true, bool bRow32Bit = false );
205cdf0e10cSrcweir void dumpRangeList( const String& rName = EMPTY_STRING, bool bCol16Bit = true, bool bRow32Bit = false );
206cdf0e10cSrcweir
207cdf0e10cSrcweir void dumpConstArrayHeader( sal_uInt32& rnCols, sal_uInt32& rnRows );
208cdf0e10cSrcweir ::rtl::OUString dumpConstValue( sal_Unicode cStrQuote = OOX_DUMP_STRQUOTE );
209cdf0e10cSrcweir
210cdf0e10cSrcweir template< typename Type >
211cdf0e10cSrcweir void dumpRect( const String& rName,
212cdf0e10cSrcweir const NameListWrapper& rListWrp = NO_LIST,
213cdf0e10cSrcweir FormatType eFmtType = FORMATTYPE_DEC );
214cdf0e10cSrcweir template< typename Type >
215cdf0e10cSrcweir void dumpRectWithGaps( const String& rName, sal_Int32 nGap,
216cdf0e10cSrcweir const NameListWrapper& rListWrp = NO_LIST,
217cdf0e10cSrcweir FormatType eFmtType = FORMATTYPE_DEC );
218cdf0e10cSrcweir
219cdf0e10cSrcweir sal_uInt16 dumpRepeatedRecId();
220cdf0e10cSrcweir void dumpFrHeader( bool bWithFlags, bool bWithRange );
221cdf0e10cSrcweir
222cdf0e10cSrcweir void dumpDffClientRect();
223cdf0e10cSrcweir void dumpEmbeddedDff();
224cdf0e10cSrcweir void dumpControl();
225cdf0e10cSrcweir
226cdf0e10cSrcweir private:
227cdf0e10cSrcweir typedef ::boost::shared_ptr< BiffSharedData > BiffSharedDataRef;
228cdf0e10cSrcweir typedef ::boost::shared_ptr< BiffDffStreamObject > BiffDffStreamObjRef;
229cdf0e10cSrcweir typedef ::boost::shared_ptr< BiffCtlsStreamObject > BiffCtlsStrmObjRef;
230cdf0e10cSrcweir
231cdf0e10cSrcweir BiffSharedDataRef mxBiffData;
232cdf0e10cSrcweir BiffInputStreamRef mxBiffStrm;
233cdf0e10cSrcweir BiffDffStreamObjRef mxDffObj;
234cdf0e10cSrcweir BiffCtlsStrmObjRef mxCtlsObj;
235cdf0e10cSrcweir NameListRef mxErrCodes;
236cdf0e10cSrcweir NameListRef mxConstType;
237cdf0e10cSrcweir NameListRef mxResultType;
238cdf0e10cSrcweir sal_uInt16 mnLastRecId;
239cdf0e10cSrcweir bool mbMergeContRec;
240cdf0e10cSrcweir };
241cdf0e10cSrcweir
242cdf0e10cSrcweir // ----------------------------------------------------------------------------
243cdf0e10cSrcweir
244cdf0e10cSrcweir template< typename Type >
writeRectItem(const String & rName,Type nLeft,Type nTop,Type nWidth,Type nHeight,const NameListWrapper & rListWrp,FormatType eFmtType)245cdf0e10cSrcweir void BiffObjectBase::writeRectItem( const String& rName,
246cdf0e10cSrcweir Type nLeft, Type nTop, Type nWidth, Type nHeight,
247cdf0e10cSrcweir const NameListWrapper& rListWrp, FormatType eFmtType )
248cdf0e10cSrcweir {
249cdf0e10cSrcweir MultiItemsGuard aMultiGuard( mxOut );
250cdf0e10cSrcweir writeEmptyItem( rName );
251cdf0e10cSrcweir writeValueItem( "x-pos", nLeft, eFmtType, rListWrp );
252cdf0e10cSrcweir writeValueItem( "y-pos", nTop, eFmtType, rListWrp );
253cdf0e10cSrcweir writeValueItem( "x-size", nWidth, eFmtType, rListWrp );
254cdf0e10cSrcweir writeValueItem( "y-size", nHeight, eFmtType, rListWrp );
255cdf0e10cSrcweir }
256cdf0e10cSrcweir
257cdf0e10cSrcweir template< typename Type >
dumpRect(const String & rName,const NameListWrapper & rListWrp,FormatType eFmtType)258cdf0e10cSrcweir void BiffObjectBase::dumpRect( const String& rName,
259cdf0e10cSrcweir const NameListWrapper& rListWrp, FormatType eFmtType )
260cdf0e10cSrcweir {
261cdf0e10cSrcweir Type nLeft, nTop, nWidth, nHeight;
262cdf0e10cSrcweir *mxBiffStrm >> nLeft >> nTop >> nWidth >> nHeight;
263cdf0e10cSrcweir writeRectItem( rName, nLeft, nTop, nWidth, nHeight, rListWrp, eFmtType );
264cdf0e10cSrcweir }
265cdf0e10cSrcweir
266cdf0e10cSrcweir template< typename Type >
dumpRectWithGaps(const String & rName,sal_Int32 nGap,const NameListWrapper & rListWrp,FormatType eFmtType)267cdf0e10cSrcweir void BiffObjectBase::dumpRectWithGaps( const String& rName, sal_Int32 nGap,
268cdf0e10cSrcweir const NameListWrapper& rListWrp, FormatType eFmtType )
269cdf0e10cSrcweir {
270cdf0e10cSrcweir Type nLeft, nTop, nWidth, nHeight;
271cdf0e10cSrcweir *mxBiffStrm >> nLeft;
272cdf0e10cSrcweir mxBiffStrm->skip( nGap );
273cdf0e10cSrcweir *mxBiffStrm >> nTop;
274cdf0e10cSrcweir mxBiffStrm->skip( nGap );
275cdf0e10cSrcweir *mxBiffStrm >> nWidth;
276cdf0e10cSrcweir mxBiffStrm->skip( nGap );
277cdf0e10cSrcweir *mxBiffStrm >> nHeight;
278cdf0e10cSrcweir mxBiffStrm->skip( nGap );
279cdf0e10cSrcweir writeRectItem( rName, nLeft, nTop, nWidth, nHeight, rListWrp, eFmtType );
280cdf0e10cSrcweir }
281cdf0e10cSrcweir
282cdf0e10cSrcweir // ============================================================================
283cdf0e10cSrcweir // ============================================================================
284cdf0e10cSrcweir
285cdf0e10cSrcweir class FormulaObject : public BiffObjectBase
286cdf0e10cSrcweir {
287cdf0e10cSrcweir public:
288cdf0e10cSrcweir explicit FormulaObject( const BiffObjectBase& rParent );
289cdf0e10cSrcweir virtual ~FormulaObject();
290cdf0e10cSrcweir
291cdf0e10cSrcweir sal_uInt16 readFormulaSize();
292cdf0e10cSrcweir sal_uInt16 dumpFormulaSize( const String& rName = EMPTY_STRING );
293cdf0e10cSrcweir
294cdf0e10cSrcweir void dumpCellFormula( const String& rName, sal_uInt16 nSize );
295cdf0e10cSrcweir void dumpCellFormula( const String& rName = EMPTY_STRING );
296cdf0e10cSrcweir void dumpNameFormula( const String& rName, sal_uInt16 nSize );
297cdf0e10cSrcweir void dumpNameFormula( const String& rName = EMPTY_STRING );
298cdf0e10cSrcweir
299cdf0e10cSrcweir protected:
300cdf0e10cSrcweir virtual void implDump();
301cdf0e10cSrcweir
302cdf0e10cSrcweir private:
303cdf0e10cSrcweir void constructFmlaObj();
304cdf0e10cSrcweir
305cdf0e10cSrcweir void dumpFormula( const String& rName, sal_uInt16 nSize, bool bNameMode );
306cdf0e10cSrcweir void dumpFormula( const String& rName, bool bNameMode );
307cdf0e10cSrcweir
308cdf0e10cSrcweir TokenAddress createTokenAddress( sal_uInt16 nCol, sal_uInt16 nRow, bool bRelC, bool bRelR, bool bNameMode ) const;
309cdf0e10cSrcweir ::rtl::OUString createRef( const ::rtl::OUString& rData ) const;
310cdf0e10cSrcweir ::rtl::OUString createName( sal_uInt16 nNameIdx ) const;
311cdf0e10cSrcweir ::rtl::OUString createPlaceHolder( size_t nIdx ) const;
312cdf0e10cSrcweir ::rtl::OUString createPlaceHolder() const;
313cdf0e10cSrcweir
314cdf0e10cSrcweir sal_uInt16 readFuncId();
315cdf0e10cSrcweir ::rtl::OUString writeFuncIdItem( sal_uInt16 nFuncId, const ::oox::xls::FunctionInfo** oppFuncInfo = 0 );
316cdf0e10cSrcweir
317cdf0e10cSrcweir sal_uInt16 dumpTokenCol( const String& rName, bool& rbRelC, bool& rbRelR );
318cdf0e10cSrcweir sal_uInt16 dumpTokenRow( const String& rName, bool& rbRelC, bool& rbRelR );
319cdf0e10cSrcweir TokenAddress dumpTokenAddress( bool bNameMode );
320cdf0e10cSrcweir TokenRange dumpTokenRange( bool bNameMode );
321cdf0e10cSrcweir
322cdf0e10cSrcweir sal_Int16 readTokenRefIdx();
323cdf0e10cSrcweir ::rtl::OUString dumpTokenRefIdx();
324cdf0e10cSrcweir ::rtl::OUString dumpTokenRefTabIdxs();
325cdf0e10cSrcweir
326cdf0e10cSrcweir void dumpIntToken();
327cdf0e10cSrcweir void dumpDoubleToken();
328cdf0e10cSrcweir void dumpStringToken();
329cdf0e10cSrcweir void dumpBoolToken();
330cdf0e10cSrcweir void dumpErrorToken();
331cdf0e10cSrcweir void dumpMissArgToken();
332cdf0e10cSrcweir
333cdf0e10cSrcweir void dumpArrayToken( const ::rtl::OUString& rTokClass );
334cdf0e10cSrcweir void dumpNameToken( const ::rtl::OUString& rTokClass );
335cdf0e10cSrcweir void dumpNameXToken( const ::rtl::OUString& rTokClass );
336cdf0e10cSrcweir void dumpRefToken( const ::rtl::OUString& rTokClass, bool bNameMode );
337cdf0e10cSrcweir void dumpAreaToken( const ::rtl::OUString& rTokClass, bool bNameMode );
338cdf0e10cSrcweir void dumpRefErrToken( const ::rtl::OUString& rTokClass, bool bArea );
339cdf0e10cSrcweir void dumpRef3dToken( const ::rtl::OUString& rTokClass, bool bNameMode );
340cdf0e10cSrcweir void dumpArea3dToken( const ::rtl::OUString& rTokClass, bool bNameMode );
341cdf0e10cSrcweir void dumpRefErr3dToken( const ::rtl::OUString& rTokClass, bool bArea );
342cdf0e10cSrcweir void dumpMemFuncToken( const ::rtl::OUString& rTokClass );
343cdf0e10cSrcweir void dumpMemAreaToken( const ::rtl::OUString& rTokClass, bool bAddData );
344cdf0e10cSrcweir
345cdf0e10cSrcweir void dumpExpToken( const String& rName );
346cdf0e10cSrcweir void dumpUnaryOpToken( const String& rLOp, const String& rROp );
347cdf0e10cSrcweir void dumpBinaryOpToken( const String& rOp );
348cdf0e10cSrcweir void dumpFuncToken( const ::rtl::OUString& rTokClass );
349cdf0e10cSrcweir void dumpFuncVarToken( const ::rtl::OUString& rTokClass );
350cdf0e10cSrcweir void dumpCmdToken( const ::rtl::OUString& rTokClass );
351cdf0e10cSrcweir
352cdf0e10cSrcweir void dumpSheetToken();
353cdf0e10cSrcweir void dumpEndSheetToken();
354cdf0e10cSrcweir bool dumpAttrToken();
355cdf0e10cSrcweir
356cdf0e10cSrcweir bool dumpNlrToken();
357cdf0e10cSrcweir void dumpNlrErrToken();
358cdf0e10cSrcweir void dumpNlrColRowToken( const ::rtl::OUString& rTokClass, bool bAddData );
359cdf0e10cSrcweir void dumpNlrRangeToken( const ::rtl::OUString& rTokClass, bool bAddData );
360cdf0e10cSrcweir void dumpNlrRangeErrToken();
361cdf0e10cSrcweir
362cdf0e10cSrcweir void dumpAddTokenData();
363cdf0e10cSrcweir void dumpAddDataNlr( size_t nIdx );
364cdf0e10cSrcweir void dumpAddDataArray( size_t nIdx );
365cdf0e10cSrcweir void dumpAddDataMemArea( size_t nIdx );
366cdf0e10cSrcweir
367cdf0e10cSrcweir private:
368cdf0e10cSrcweir enum AddDataType { ADDDATA_NLR, ADDDATA_ARRAY, ADDDATA_MEMAREA };
369cdf0e10cSrcweir
370cdf0e10cSrcweir typedef ::boost::shared_ptr< FormulaStack > FormulaStackRef;
371cdf0e10cSrcweir typedef ::boost::shared_ptr< ::oox::xls::FunctionProvider > FuncProvRef;
372cdf0e10cSrcweir typedef ::std::vector< AddDataType > AddDataTypeVec;
373cdf0e10cSrcweir
374cdf0e10cSrcweir NameListRef mxTokens;
375cdf0e10cSrcweir NameListRef mxClasses;
376cdf0e10cSrcweir NameListRef mxRelFlags;
377cdf0e10cSrcweir NameListRef mxNlrTypes;
378cdf0e10cSrcweir NameListRef mxAttrTypes;
379cdf0e10cSrcweir NameListRef mxSpTypes;
380cdf0e10cSrcweir sal_Int32 mnColCount;
381cdf0e10cSrcweir sal_Int32 mnRowCount;
382cdf0e10cSrcweir
383cdf0e10cSrcweir FormulaStackRef mxStack;
384cdf0e10cSrcweir FuncProvRef mxFuncProv;
385cdf0e10cSrcweir AddDataTypeVec maAddData;
386cdf0e10cSrcweir ::rtl::OUString maRefPrefix;
387cdf0e10cSrcweir ::rtl::OUString maName;
388cdf0e10cSrcweir sal_uInt16 mnSize;
389cdf0e10cSrcweir bool mbNameMode;
390cdf0e10cSrcweir };
391cdf0e10cSrcweir
392cdf0e10cSrcweir // ============================================================================
393cdf0e10cSrcweir // ============================================================================
394cdf0e10cSrcweir
395cdf0e10cSrcweir class RecordStreamObject : public BiffObjectBase
396cdf0e10cSrcweir {
397cdf0e10cSrcweir protected:
RecordStreamObject()398cdf0e10cSrcweir inline explicit RecordStreamObject() {}
399cdf0e10cSrcweir virtual ~RecordStreamObject();
400cdf0e10cSrcweir
401cdf0e10cSrcweir using BiffObjectBase::construct;
402cdf0e10cSrcweir void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, ::oox::xls::BiffType eBiff, const ::rtl::OUString& rSysFileName );
403cdf0e10cSrcweir
404cdf0e10cSrcweir virtual bool implIsValid() const;
405cdf0e10cSrcweir
getFormulaDumper() const406cdf0e10cSrcweir inline FormulaObject& getFormulaDumper() const { return *mxFmlaObj; }
407cdf0e10cSrcweir
408cdf0e10cSrcweir private:
409cdf0e10cSrcweir typedef ::boost::shared_ptr< FormulaObject > FormulaObjectRef;
410cdf0e10cSrcweir FormulaObjectRef mxFmlaObj;
411cdf0e10cSrcweir };
412cdf0e10cSrcweir
413cdf0e10cSrcweir // ============================================================================
414cdf0e10cSrcweir
415cdf0e10cSrcweir class WorkbookStreamObject : public RecordStreamObject
416cdf0e10cSrcweir {
417cdf0e10cSrcweir public:
418cdf0e10cSrcweir explicit WorkbookStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
419cdf0e10cSrcweir virtual ~WorkbookStreamObject();
420cdf0e10cSrcweir
421cdf0e10cSrcweir protected:
422cdf0e10cSrcweir virtual void implDumpRecordBody();
423cdf0e10cSrcweir
424cdf0e10cSrcweir private:
425cdf0e10cSrcweir void initializePerSheet();
426cdf0e10cSrcweir
427cdf0e10cSrcweir ::rtl::OUString createFontName( const ::rtl::OUString& rName, sal_uInt16 nHeight, bool bBold, bool bItalic ) const;
428cdf0e10cSrcweir
429cdf0e10cSrcweir sal_uInt16 dumpPatternIdx( const String& rName = EMPTY_STRING, bool b16Bit = true );
430cdf0e10cSrcweir sal_uInt16 dumpColorIdx( const String& rName = EMPTY_STRING, bool b16Bit = true );
431cdf0e10cSrcweir sal_uInt16 dumpFontIdx( const String& rName = EMPTY_STRING, bool b16Bit = true );
432cdf0e10cSrcweir sal_uInt16 dumpFormatIdx( const String& rName = EMPTY_STRING );
433cdf0e10cSrcweir sal_uInt16 dumpXfIdx( const String& rName = EMPTY_STRING, bool bBiff2Style = false );
434cdf0e10cSrcweir
435cdf0e10cSrcweir template< typename Type >
dumpExtColorType()436cdf0e10cSrcweir inline Type dumpExtColorType() { return dumpDec< Type >( "color-type", "EXTCOLOR-TYPE" ); }
437cdf0e10cSrcweir void dumpExtColorValue( sal_uInt32 nColorType );
438cdf0e10cSrcweir void dumpExtColor( const String& rName = EMPTY_STRING );
439cdf0e10cSrcweir void dumpExtCfColor( const String& rName = EMPTY_STRING );
440cdf0e10cSrcweir void dumpExtGradientHead();
441cdf0e10cSrcweir
442cdf0e10cSrcweir sal_uInt8 dumpFilterColumnOperator( const String& rName );
443cdf0e10cSrcweir
444cdf0e10cSrcweir ::rtl::OUString dumpPivotString( const String& rName, sal_uInt16 nStrLen );
445cdf0e10cSrcweir ::rtl::OUString dumpPivotString( const String& rName );
446cdf0e10cSrcweir
447cdf0e10cSrcweir sal_uInt16 dumpCellHeader( bool bBiff2Style = false );
448cdf0e10cSrcweir void dumpBoolErr();
449cdf0e10cSrcweir
450cdf0e10cSrcweir void dumpCfRuleProp();
451cdf0e10cSrcweir void dumpXfExtProp();
452cdf0e10cSrcweir void dumpDxfProp();
453cdf0e10cSrcweir void dumpDxf12Prop();
454cdf0e10cSrcweir void dumpCfRule12Param( sal_uInt16 nSubType );
455cdf0e10cSrcweir
456cdf0e10cSrcweir void dumpFontRec();
457cdf0e10cSrcweir void dumpFormatRec();
458cdf0e10cSrcweir void dumpXfRec();
459cdf0e10cSrcweir
460cdf0e10cSrcweir void dumpObjRec();
461cdf0e10cSrcweir void dumpObjRecBiff3();
462cdf0e10cSrcweir void dumpObjRecBiff4();
463cdf0e10cSrcweir void dumpObjRecBiff5();
464cdf0e10cSrcweir void dumpObjRecBiff8();
465cdf0e10cSrcweir
466cdf0e10cSrcweir void dumpObjRecLineData();
467cdf0e10cSrcweir void dumpObjRecFillData();
468cdf0e10cSrcweir void dumpObjRecRectData();
469cdf0e10cSrcweir void dumpObjRecTextDataBiff3( sal_uInt16& ornTextLen, sal_uInt16& ornFormatSize );
470cdf0e10cSrcweir void dumpObjRecTextDataBiff5( sal_uInt16& ornTextLen, sal_uInt16& ornFormatSize, sal_uInt16& ornLinkSize );
471cdf0e10cSrcweir void dumpObjRecSbsData();
472cdf0e10cSrcweir void dumpObjRecGboData();
473cdf0e10cSrcweir void dumpObjRecEdoData();
474cdf0e10cSrcweir void dumpObjRecRboData();
475cdf0e10cSrcweir void dumpObjRecCblsData();
476cdf0e10cSrcweir void dumpObjRecLbsData();
477cdf0e10cSrcweir
478cdf0e10cSrcweir void dumpObjRecPadding();
479cdf0e10cSrcweir void dumpObjRecString( const String& rName, sal_uInt16 nTextLen, bool bRepeatLen );
480cdf0e10cSrcweir void dumpObjRecTextFmt( sal_uInt16 nFormatSize );
481cdf0e10cSrcweir void dumpObjRecFmlaRaw();
482cdf0e10cSrcweir void dumpObjRecFmla( const String& rName, sal_uInt16 nFmlaSize );
483cdf0e10cSrcweir void dumpObjRecPictFmla( sal_uInt16 nFmlaSize );
484cdf0e10cSrcweir
485cdf0e10cSrcweir typedef ::std::pair< sal_uInt8, ::rtl::OUString > ChFrExtPropInfo;
486cdf0e10cSrcweir
487cdf0e10cSrcweir void dumpChFrExtProps();
488cdf0e10cSrcweir ChFrExtPropInfo dumpChFrExtPropHeader();
489cdf0e10cSrcweir
490cdf0e10cSrcweir private:
491cdf0e10cSrcweir NameListRef mxColors;
492cdf0e10cSrcweir NameListRef mxBorderStyles;
493cdf0e10cSrcweir NameListRef mxFillPatterns;
494cdf0e10cSrcweir NameListRef mxFontNames;
495cdf0e10cSrcweir NameListRef mxFormats;
496cdf0e10cSrcweir sal_uInt16 mnFormatIdx;
497cdf0e10cSrcweir sal_uInt16 mnPTRowFields;
498cdf0e10cSrcweir sal_uInt16 mnPTColFields;
499cdf0e10cSrcweir sal_uInt16 mnPTRowColItemsIdx;
500cdf0e10cSrcweir bool mbHasCodePage;
501cdf0e10cSrcweir bool mbHasDff;
502cdf0e10cSrcweir };
503cdf0e10cSrcweir
504cdf0e10cSrcweir // ============================================================================
505cdf0e10cSrcweir
506cdf0e10cSrcweir class PivotCacheStreamObject : public RecordStreamObject
507cdf0e10cSrcweir {
508cdf0e10cSrcweir public:
509cdf0e10cSrcweir explicit PivotCacheStreamObject(
510cdf0e10cSrcweir const ObjectBase& rParent,
511cdf0e10cSrcweir const BinaryInputStreamRef& rxStrm,
512cdf0e10cSrcweir ::oox::xls::BiffType eBiff,
513cdf0e10cSrcweir const ::rtl::OUString& rSysFileName );
514cdf0e10cSrcweir
515cdf0e10cSrcweir protected:
516cdf0e10cSrcweir virtual void implDumpRecordBody();
517cdf0e10cSrcweir };
518cdf0e10cSrcweir
519cdf0e10cSrcweir // ============================================================================
520cdf0e10cSrcweir // ============================================================================
521cdf0e10cSrcweir
522cdf0e10cSrcweir class RootStorageObject : public OleStorageObject
523cdf0e10cSrcweir {
524cdf0e10cSrcweir public:
525cdf0e10cSrcweir explicit RootStorageObject( const DumperBase& rParent );
526cdf0e10cSrcweir
527cdf0e10cSrcweir protected:
528cdf0e10cSrcweir virtual void implDumpStream(
529cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
530cdf0e10cSrcweir const ::rtl::OUString& rStrgPath,
531cdf0e10cSrcweir const ::rtl::OUString& rStrmName,
532cdf0e10cSrcweir const ::rtl::OUString& rSysFileName );
533cdf0e10cSrcweir
534cdf0e10cSrcweir virtual void implDumpStorage(
535cdf0e10cSrcweir const StorageRef& rxStrg,
536cdf0e10cSrcweir const ::rtl::OUString& rStrgPath,
537cdf0e10cSrcweir const ::rtl::OUString& rSysPath );
538cdf0e10cSrcweir
539cdf0e10cSrcweir virtual void implDumpBaseStream(
540cdf0e10cSrcweir const BinaryInputStreamRef& rxStrm,
541cdf0e10cSrcweir const ::rtl::OUString& rSysFileName );
542cdf0e10cSrcweir };
543cdf0e10cSrcweir
544cdf0e10cSrcweir // ============================================================================
545cdf0e10cSrcweir // ============================================================================
546cdf0e10cSrcweir
547cdf0e10cSrcweir class Dumper : public DumperBase
548cdf0e10cSrcweir {
549cdf0e10cSrcweir public:
550cdf0e10cSrcweir explicit Dumper( const ::oox::core::FilterBase& rFilter );
551cdf0e10cSrcweir
552cdf0e10cSrcweir explicit Dumper(
553cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
554cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
555cdf0e10cSrcweir const ::rtl::OUString& rSysFileName );
556cdf0e10cSrcweir
557cdf0e10cSrcweir protected:
558cdf0e10cSrcweir virtual void implDump();
559cdf0e10cSrcweir };
560cdf0e10cSrcweir
561cdf0e10cSrcweir // ============================================================================
562cdf0e10cSrcweir // ============================================================================
563cdf0e10cSrcweir
564cdf0e10cSrcweir } // namespace biff
565cdf0e10cSrcweir } // namespace dump
566cdf0e10cSrcweir } // namespace oox
567cdf0e10cSrcweir
568cdf0e10cSrcweir #endif
569cdf0e10cSrcweir #endif
570