xref: /AOO41X/main/oox/inc/oox/dump/dumperbase.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef OOX_DUMP_DUMPERBASE_HXX
29*cdf0e10cSrcweir #define OOX_DUMP_DUMPERBASE_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <math.h>
32*cdf0e10cSrcweir #include <vector>
33*cdf0e10cSrcweir #include <stack>
34*cdf0e10cSrcweir #include <set>
35*cdf0e10cSrcweir #include <map>
36*cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
37*cdf0e10cSrcweir #include <rtl/strbuf.hxx>
38*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
39*cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
40*cdf0e10cSrcweir #include <com/sun/star/util/DateTime.hpp>
41*cdf0e10cSrcweir #include <comphelper/mediadescriptor.hxx>
42*cdf0e10cSrcweir #include "oox/helper/binaryinputstream.hxx"
43*cdf0e10cSrcweir #include "oox/helper/helper.hxx"
44*cdf0e10cSrcweir #include "oox/helper/storagebase.hxx"
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir #define OOX_INCLUDE_DUMPER (OSL_DEBUG_LEVEL > 0)
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #if OOX_INCLUDE_DUMPER
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir namespace com { namespace sun { namespace star {
51*cdf0e10cSrcweir     namespace io { class XInputStream; }
52*cdf0e10cSrcweir     namespace io { class XOutputStream; }
53*cdf0e10cSrcweir     namespace io { class XTextOutputStream; }
54*cdf0e10cSrcweir     namespace uno { class XComponentContext; }
55*cdf0e10cSrcweir } } }
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir namespace comphelper {
58*cdf0e10cSrcweir     class IDocPasswordVerifier;
59*cdf0e10cSrcweir }
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir namespace oox {
62*cdf0e10cSrcweir     class BinaryOutputStream;
63*cdf0e10cSrcweir     class TextInputStream;
64*cdf0e10cSrcweir }
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir namespace oox { namespace core {
67*cdf0e10cSrcweir     class FilterBase;
68*cdf0e10cSrcweir } }
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir namespace oox {
71*cdf0e10cSrcweir namespace dump {
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir // ============================================================================
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir #define OOX_DUMP_UNUSED                     "unused"
76*cdf0e10cSrcweir #define OOX_DUMP_UNKNOWN                    "?unknown"
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir #define OOX_DUMP_ERRASCII( ascii )          "?err:" ascii
79*cdf0e10cSrcweir #define OOX_DUMP_ERRSTRING( ascii )         CREATE_OUSTRING( OOX_DUMP_ERRASCII( ascii ) )
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir #define OOX_DUMP_ERR_NOMAP                  OOX_DUMP_ERRSTRING( "no-map" )
82*cdf0e10cSrcweir #define OOX_DUMP_ERR_NONAME                 OOX_DUMP_ERRSTRING( "no-name" )
83*cdf0e10cSrcweir #define OOX_DUMP_ERR_STREAM                 OOX_DUMP_ERRSTRING( "stream-error" )
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir #define OOX_DUMP_DUMPEXT                    CREATE_OUSTRING( ".dump" )
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_STRQUOTE         = '\'';
88*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_FMLASTRQUOTE     = '"';
89*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_ADDRABS          = '$';
90*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_R1C1ROW          = 'R';
91*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_R1C1COL          = 'C';
92*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_R1C1OPEN         = '[';
93*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_R1C1CLOSE        = ']';
94*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_RANGESEP         = ':';
95*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_BASECLASS        = 'B';
96*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_FUNCSEP          = ',';
97*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_LISTSEP          = ',';
98*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_TABSEP           = '!';
99*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_ARRAYSEP         = ';';
100*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_EMPTYVALUE       = '~';
101*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_CMDPROMPT        = '?';
102*cdf0e10cSrcweir const sal_Unicode OOX_DUMP_PLACEHOLDER      = '\x01';
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > OUStringPair;
105*cdf0e10cSrcweir typedef ::std::pair< sal_Int64, sal_Int64 >             Int64Pair;
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir typedef ::std::vector< ::rtl::OUString >    OUStringVector;
108*cdf0e10cSrcweir typedef ::std::vector< sal_Int64 >          Int64Vector;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir // ============================================================================
111*cdf0e10cSrcweir // ============================================================================
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir /** Static helper functions for system file and stream access. */
114*cdf0e10cSrcweir class InputOutputHelper
115*cdf0e10cSrcweir {
116*cdf0e10cSrcweir public:
117*cdf0e10cSrcweir     // file names -------------------------------------------------------------
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     static ::rtl::OUString convertFileNameToUrl( const ::rtl::OUString& rFileName );
120*cdf0e10cSrcweir     static sal_Int32    getFileNamePos( const ::rtl::OUString& rFileUrl );
121*cdf0e10cSrcweir     static ::rtl::OUString getFileNameExtension( const ::rtl::OUString& rFileUrl );
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     // input streams ----------------------------------------------------------
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
126*cdf0e10cSrcweir                         openInputStream(
127*cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
128*cdf0e10cSrcweir                             const ::rtl::OUString& rFileName );
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir     // output streams ---------------------------------------------------------
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
133*cdf0e10cSrcweir                         openOutputStream(
134*cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
135*cdf0e10cSrcweir                             const ::rtl::OUString& rFileName );
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >
138*cdf0e10cSrcweir                         openTextOutputStream(
139*cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
140*cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm,
141*cdf0e10cSrcweir                             rtl_TextEncoding eTextEnc );
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >
144*cdf0e10cSrcweir                         openTextOutputStream(
145*cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
146*cdf0e10cSrcweir                             const ::rtl::OUString& rFileName,
147*cdf0e10cSrcweir                             rtl_TextEncoding eTextEnc );
148*cdf0e10cSrcweir };
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir // ============================================================================
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir class BinaryInputStreamRef : public ::oox::BinaryInputStreamRef
153*cdf0e10cSrcweir {
154*cdf0e10cSrcweir public:
155*cdf0e10cSrcweir     inline              BinaryInputStreamRef() {}
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir     inline /*implicit*/ BinaryInputStreamRef( BinaryInputStream* pInStrm ) :
158*cdf0e10cSrcweir                             ::oox::BinaryInputStreamRef( pInStrm ) {}
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     inline /*implicit*/ BinaryInputStreamRef( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm ) :
161*cdf0e10cSrcweir                             ::oox::BinaryInputStreamRef( new BinaryXInputStream( rxInStrm, true ) ) {}
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir     template< typename StreamType >
164*cdf0e10cSrcweir     inline /*implicit*/ BinaryInputStreamRef( const ::boost::shared_ptr< StreamType >& rxInStrm ) :
165*cdf0e10cSrcweir                             ::oox::BinaryInputStreamRef( rxInStrm ) {}
166*cdf0e10cSrcweir };
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir // ============================================================================
169*cdf0e10cSrcweir // ============================================================================
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir /** Specifiers for atomic data types. */
172*cdf0e10cSrcweir enum DataType
173*cdf0e10cSrcweir {
174*cdf0e10cSrcweir     DATATYPE_VOID,              /// No data type.
175*cdf0e10cSrcweir     DATATYPE_INT8,              /// Signed 8-bit integer.
176*cdf0e10cSrcweir     DATATYPE_UINT8,             /// Unsigned 8-bit integer.
177*cdf0e10cSrcweir     DATATYPE_INT16,             /// Signed 16-bit integer.
178*cdf0e10cSrcweir     DATATYPE_UINT16,            /// Unsigned 16-bit integer.
179*cdf0e10cSrcweir     DATATYPE_INT32,             /// Signed 32-bit integer.
180*cdf0e10cSrcweir     DATATYPE_UINT32,            /// Unsigned 32-bit integer.
181*cdf0e10cSrcweir     DATATYPE_INT64,             /// Signed 64-bit integer.
182*cdf0e10cSrcweir     DATATYPE_UINT64,            /// Unsigned 64-bit integer.
183*cdf0e10cSrcweir     DATATYPE_FLOAT,             /// Floating-point, single precision.
184*cdf0e10cSrcweir     DATATYPE_DOUBLE             /// Floating-point, double precision.
185*cdf0e10cSrcweir };
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir // ----------------------------------------------------------------------------
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir /** Specifiers for the output format of values. */
190*cdf0e10cSrcweir enum FormatType
191*cdf0e10cSrcweir {
192*cdf0e10cSrcweir     FORMATTYPE_NONE,            /// No numeric format (e.g. show name only).
193*cdf0e10cSrcweir     FORMATTYPE_DEC,             /// Decimal.
194*cdf0e10cSrcweir     FORMATTYPE_HEX,             /// Hexadecimal.
195*cdf0e10cSrcweir     FORMATTYPE_SHORTHEX,        /// Hexadecimal, as short as possible (no leading zeros).
196*cdf0e10cSrcweir     FORMATTYPE_BIN,             /// Binary.
197*cdf0e10cSrcweir     FORMATTYPE_FIX,             /// Fixed-point.
198*cdf0e10cSrcweir     FORMATTYPE_BOOL             /// Boolean ('true' or 'false').
199*cdf0e10cSrcweir };
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir // ----------------------------------------------------------------------------
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir /** Describes the output format of a data item.
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir     Data items are written in the following format:
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir     <NAME>=<VALUE>=<NAME-FROM-LIST>
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir     NAME is the name of the data item. The name is contained in the member
210*cdf0e10cSrcweir     maItemName. If the name is empty, only the value is written (without a
211*cdf0e10cSrcweir     leading equality sign).
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir     VALUE is the numeric value of the data item. Its format is dependent on the
214*cdf0e10cSrcweir     output format given in the member meFmtType. If the format type is
215*cdf0e10cSrcweir     FORMATTYPE_NONE, no value is written.
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir     NAME-FROM-LIST is a symbolic name for the current value of the data item.
218*cdf0e10cSrcweir     Various types of name lists produce different names for values, which can
219*cdf0e10cSrcweir     be used for enumerations or names for single bits in bitfields (see class
220*cdf0e10cSrcweir     NameListBase and derived classes). The name of the list is given in the
221*cdf0e10cSrcweir     member maListName. If it is empty, no name is written for the value.
222*cdf0e10cSrcweir  */
223*cdf0e10cSrcweir struct ItemFormat
224*cdf0e10cSrcweir {
225*cdf0e10cSrcweir     DataType            meDataType;         /// Data type of the item.
226*cdf0e10cSrcweir     FormatType          meFmtType;          /// Output format for the value.
227*cdf0e10cSrcweir     ::rtl::OUString     maItemName;         /// Name of the item.
228*cdf0e10cSrcweir     ::rtl::OUString     maListName;         /// Name of a name list to be used for this item.
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir     explicit            ItemFormat();
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir     void                set( DataType eDataType, FormatType eFmtType, const ::rtl::OUString& rItemName );
233*cdf0e10cSrcweir     void                set( DataType eDataType, FormatType eFmtType, const ::rtl::OUString& rItemName, const ::rtl::OUString& rListName );
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir     /** Initializes the struct from a vector of strings containing the item format.
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir         The vector must contain at least 2 strings. The struct is filled from
238*cdf0e10cSrcweir         the strings in the vector in the following order:
239*cdf0e10cSrcweir         1) Data type (one of: [u]int8, [u]int16, [u]int32, [u]int64, float, double).
240*cdf0e10cSrcweir         2) Format type (one of: dec, hex, shorthex, bin, fix, bool, unused, unknown).
241*cdf0e10cSrcweir         3) Item name (optional).
242*cdf0e10cSrcweir         4) Name list name (optional).
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir         @return  Iterator pointing to the first unhandled string.
245*cdf0e10cSrcweir      */
246*cdf0e10cSrcweir     OUStringVector::const_iterator parse( const OUStringVector& rFormatVec );
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir     /** Initializes the struct from a string containing the item format.
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir         The string must have the following format:
251*cdf0e10cSrcweir         DATATYPE,FORMATTYPE[,ITEMNAME[,LISTNAME]]
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir         DATATYPE is the data type of the item (see above for possible values).
254*cdf0e10cSrcweir         FORMATTYPE is the format type of the item (see above for possible values).
255*cdf0e10cSrcweir         ITEMNAME is the name of the item (optional).
256*cdf0e10cSrcweir         LISTNAME is the name of a name list (optional).
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir         @return  List containing remaining unhandled format strings.
259*cdf0e10cSrcweir      */
260*cdf0e10cSrcweir     OUStringVector      parse( const ::rtl::OUString& rFormatStr );
261*cdf0e10cSrcweir };
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir // ============================================================================
264*cdf0e10cSrcweir // ============================================================================
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir struct Address
267*cdf0e10cSrcweir {
268*cdf0e10cSrcweir     sal_Int32           mnCol;
269*cdf0e10cSrcweir     sal_Int32           mnRow;
270*cdf0e10cSrcweir     inline explicit     Address() : mnCol( 0 ), mnRow( 0 ) {}
271*cdf0e10cSrcweir     inline explicit     Address( sal_Int32 nCol, sal_Int32 nRow ) : mnCol( nCol ), mnRow( nRow ) {}
272*cdf0e10cSrcweir };
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir // ----------------------------------------------------------------------------
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir struct Range
277*cdf0e10cSrcweir {
278*cdf0e10cSrcweir     Address             maFirst;
279*cdf0e10cSrcweir     Address             maLast;
280*cdf0e10cSrcweir     inline explicit     Range() {}
281*cdf0e10cSrcweir };
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir // ----------------------------------------------------------------------------
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir typedef ::std::vector< Range > RangeList;
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir // ============================================================================
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir struct TokenAddress : public Address
290*cdf0e10cSrcweir {
291*cdf0e10cSrcweir     bool                mbRelCol;
292*cdf0e10cSrcweir     bool                mbRelRow;
293*cdf0e10cSrcweir     inline explicit     TokenAddress() : mbRelCol( false ), mbRelRow( false ) {}
294*cdf0e10cSrcweir };
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir // ----------------------------------------------------------------------------
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir struct TokenRange
299*cdf0e10cSrcweir {
300*cdf0e10cSrcweir     TokenAddress        maFirst;
301*cdf0e10cSrcweir     TokenAddress        maLast;
302*cdf0e10cSrcweir     inline explicit     TokenRange() {}
303*cdf0e10cSrcweir };
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir // ============================================================================
306*cdf0e10cSrcweir // ============================================================================
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir /** Static helper functions for formatted output to strings. */
309*cdf0e10cSrcweir class StringHelper
310*cdf0e10cSrcweir {
311*cdf0e10cSrcweir public:
312*cdf0e10cSrcweir     // append string to string ------------------------------------------------
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir     static void         appendChar( ::rtl::OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount = 1 );
315*cdf0e10cSrcweir     static void         appendString( ::rtl::OUStringBuffer& rStr, const ::rtl::OUString& rData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir     // append decimal ---------------------------------------------------------
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir     static void         appendDec( ::rtl::OUStringBuffer& rStr, sal_uInt8  nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
320*cdf0e10cSrcweir     static void         appendDec( ::rtl::OUStringBuffer& rStr, sal_Int8   nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
321*cdf0e10cSrcweir     static void         appendDec( ::rtl::OUStringBuffer& rStr, sal_uInt16 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
322*cdf0e10cSrcweir     static void         appendDec( ::rtl::OUStringBuffer& rStr, sal_Int16  nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
323*cdf0e10cSrcweir     static void         appendDec( ::rtl::OUStringBuffer& rStr, sal_uInt32 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
324*cdf0e10cSrcweir     static void         appendDec( ::rtl::OUStringBuffer& rStr, sal_Int32  nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
325*cdf0e10cSrcweir     static void         appendDec( ::rtl::OUStringBuffer& rStr, sal_uInt64 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
326*cdf0e10cSrcweir     static void         appendDec( ::rtl::OUStringBuffer& rStr, sal_Int64  nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
327*cdf0e10cSrcweir     static void         appendDec( ::rtl::OUStringBuffer& rStr, double     fData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir     // append hexadecimal -----------------------------------------------------
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir     static void         appendHex( ::rtl::OUStringBuffer& rStr, sal_uInt8  nData, bool bPrefix = true );
332*cdf0e10cSrcweir     static void         appendHex( ::rtl::OUStringBuffer& rStr, sal_Int8   nData, bool bPrefix = true );
333*cdf0e10cSrcweir     static void         appendHex( ::rtl::OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
334*cdf0e10cSrcweir     static void         appendHex( ::rtl::OUStringBuffer& rStr, sal_Int16  nData, bool bPrefix = true );
335*cdf0e10cSrcweir     static void         appendHex( ::rtl::OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
336*cdf0e10cSrcweir     static void         appendHex( ::rtl::OUStringBuffer& rStr, sal_Int32  nData, bool bPrefix = true );
337*cdf0e10cSrcweir     static void         appendHex( ::rtl::OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
338*cdf0e10cSrcweir     static void         appendHex( ::rtl::OUStringBuffer& rStr, sal_Int64  nData, bool bPrefix = true );
339*cdf0e10cSrcweir     static void         appendHex( ::rtl::OUStringBuffer& rStr, double     fData, bool bPrefix = true );
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir     // append shortened hexadecimal -------------------------------------------
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, sal_uInt8  nData, bool bPrefix = true );
344*cdf0e10cSrcweir     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, sal_Int8   nData, bool bPrefix = true );
345*cdf0e10cSrcweir     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
346*cdf0e10cSrcweir     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, sal_Int16  nData, bool bPrefix = true );
347*cdf0e10cSrcweir     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
348*cdf0e10cSrcweir     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, sal_Int32  nData, bool bPrefix = true );
349*cdf0e10cSrcweir     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
350*cdf0e10cSrcweir     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, sal_Int64  nData, bool bPrefix = true );
351*cdf0e10cSrcweir     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, double     fData, bool bPrefix = true );
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir     // append binary ----------------------------------------------------------
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir     static void         appendBin( ::rtl::OUStringBuffer& rStr, sal_uInt8  nData, bool bDots = true );
356*cdf0e10cSrcweir     static void         appendBin( ::rtl::OUStringBuffer& rStr, sal_Int8   nData, bool bDots = true );
357*cdf0e10cSrcweir     static void         appendBin( ::rtl::OUStringBuffer& rStr, sal_uInt16 nData, bool bDots = true );
358*cdf0e10cSrcweir     static void         appendBin( ::rtl::OUStringBuffer& rStr, sal_Int16  nData, bool bDots = true );
359*cdf0e10cSrcweir     static void         appendBin( ::rtl::OUStringBuffer& rStr, sal_uInt32 nData, bool bDots = true );
360*cdf0e10cSrcweir     static void         appendBin( ::rtl::OUStringBuffer& rStr, sal_Int32  nData, bool bDots = true );
361*cdf0e10cSrcweir     static void         appendBin( ::rtl::OUStringBuffer& rStr, sal_uInt64 nData, bool bDots = true );
362*cdf0e10cSrcweir     static void         appendBin( ::rtl::OUStringBuffer& rStr, sal_Int64  nData, bool bDots = true );
363*cdf0e10cSrcweir     static void         appendBin( ::rtl::OUStringBuffer& rStr, double     fData, bool bDots = true );
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir     // append fixed-point decimal ---------------------------------------------
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir     template< typename Type >
368*cdf0e10cSrcweir     static void         appendFix( ::rtl::OUStringBuffer& rStr, Type nData, sal_Int32 nWidth = 0 );
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir     // append formatted value -------------------------------------------------
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir     static void         appendBool( ::rtl::OUStringBuffer& rStr, bool bData );
373*cdf0e10cSrcweir     template< typename Type >
374*cdf0e10cSrcweir     static void         appendValue( ::rtl::OUStringBuffer& rStr, Type nData, FormatType eFmtType );
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir     // append columns, rows, addresses ----------------------------------------
377*cdf0e10cSrcweir 
378*cdf0e10cSrcweir     static void         appendAddrCol( ::rtl::OUStringBuffer& rStr, sal_Int32 nCol, bool bRel );
379*cdf0e10cSrcweir     static void         appendAddrRow( ::rtl::OUStringBuffer& rStr, sal_Int32 nRow, bool bRel );
380*cdf0e10cSrcweir     static void         appendAddrName( ::rtl::OUStringBuffer& rStr, sal_Unicode cPrefix, sal_Int32 nColRow, bool bRel );
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir     static void         appendAddress( ::rtl::OUStringBuffer& rStr, const Address& rPos );
383*cdf0e10cSrcweir     static void         appendRange( ::rtl::OUStringBuffer& rStr, const Range& rRange );
384*cdf0e10cSrcweir     static void         appendRangeList( ::rtl::OUStringBuffer& rStr, const RangeList& rRanges );
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir     static void         appendAddress( ::rtl::OUStringBuffer& rStr, const TokenAddress& rPos, bool bR1C1 );
387*cdf0e10cSrcweir     static void         appendRange( ::rtl::OUStringBuffer& rStr, const TokenRange& rRange, bool bR1C1 );
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir     // encoded text output ----------------------------------------------------
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir     static void         appendCChar( ::rtl::OUStringBuffer& rStr, sal_Unicode cChar, bool bPrefix = true );
392*cdf0e10cSrcweir     static void         appendEncChar( ::rtl::OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount = 1, bool bPrefix = true );
393*cdf0e10cSrcweir     static void         appendEncString( ::rtl::OUStringBuffer& rStr, const ::rtl::OUString& rData, bool bPrefix = true );
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir     // token list -------------------------------------------------------------
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir     static void         appendToken( ::rtl::OUStringBuffer& rStr, const ::rtl::OUString& rToken, sal_Unicode cSep = OOX_DUMP_LISTSEP );
398*cdf0e10cSrcweir     static void         appendToken( ::rtl::OUStringBuffer& rStr, sal_Int64 nToken, sal_Unicode cSep = OOX_DUMP_LISTSEP );
399*cdf0e10cSrcweir     static void         prependToken( ::rtl::OUStringBuffer& rStr, const ::rtl::OUString& rToken, sal_Unicode cSep = OOX_DUMP_LISTSEP );
400*cdf0e10cSrcweir     static void         prependToken( ::rtl::OUStringBuffer& rStr, sal_Int64 nToken, sal_Unicode cSep = OOX_DUMP_LISTSEP );
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir     static void         appendIndex( ::rtl::OUStringBuffer& rStr, const ::rtl::OUString& rIdx );
403*cdf0e10cSrcweir     static void         appendIndex( ::rtl::OUStringBuffer& rStr, sal_Int64 nIdx );
404*cdf0e10cSrcweir     static void         appendIndexedText( ::rtl::OUStringBuffer& rStr, const ::rtl::OUString& rData, const ::rtl::OUString& rIdx );
405*cdf0e10cSrcweir     static void         appendIndexedText( ::rtl::OUStringBuffer& rStr, const ::rtl::OUString& rData, sal_Int64 nIdx );
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir     static ::rtl::OUString getToken( const ::rtl::OUString& rData, sal_Int32& rnPos, sal_Unicode cSep = OOX_DUMP_LISTSEP );
408*cdf0e10cSrcweir 
409*cdf0e10cSrcweir     /** Encloses the passed string with the passed characters. Uses cOpen, if cClose is NUL. */
410*cdf0e10cSrcweir     static void         enclose( ::rtl::OUStringBuffer& rStr, sal_Unicode cOpen, sal_Unicode cClose = '\0' );
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir     // string conversion ------------------------------------------------------
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir     static ::rtl::OUString trimSpaces( const ::rtl::OUString& rStr );
415*cdf0e10cSrcweir     static ::rtl::OUString trimTrailingNul( const ::rtl::OUString& rStr );
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir     static ::rtl::OString convertToUtf8( const ::rtl::OUString& rStr );
418*cdf0e10cSrcweir     static DataType     convertToDataType( const ::rtl::OUString& rStr );
419*cdf0e10cSrcweir     static FormatType   convertToFormatType( const ::rtl::OUString& rStr );
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir     static bool         convertFromDec( sal_Int64& ornData, const ::rtl::OUString& rData );
422*cdf0e10cSrcweir     static bool         convertFromHex( sal_Int64& ornData, const ::rtl::OUString& rData );
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir     static bool         convertStringToInt( sal_Int64& ornData, const ::rtl::OUString& rData );
425*cdf0e10cSrcweir     static bool         convertStringToDouble( double& orfData, const ::rtl::OUString& rData );
426*cdf0e10cSrcweir     static bool         convertStringToBool( const ::rtl::OUString& rData );
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir     static OUStringPair convertStringToPair( const ::rtl::OUString& rString, sal_Unicode cSep = '=' );
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir     // string to list conversion ----------------------------------------------
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir     static void         convertStringToStringList( OUStringVector& orVec, const ::rtl::OUString& rData, bool bIgnoreEmpty );
433*cdf0e10cSrcweir     static void         convertStringToIntList( Int64Vector& orVec, const ::rtl::OUString& rData, bool bIgnoreEmpty );
434*cdf0e10cSrcweir };
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir // ----------------------------------------------------------------------------
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir template< typename Type >
439*cdf0e10cSrcweir void StringHelper::appendFix( ::rtl::OUStringBuffer& rStr, Type nData, sal_Int32 nWidth )
440*cdf0e10cSrcweir {
441*cdf0e10cSrcweir     appendDec( rStr, static_cast< double >( nData ) / pow( 2.0, 4.0 * sizeof( Type ) ), nWidth );
442*cdf0e10cSrcweir }
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir template< typename Type >
445*cdf0e10cSrcweir void StringHelper::appendValue( ::rtl::OUStringBuffer& rStr, Type nData, FormatType eFmtType )
446*cdf0e10cSrcweir {
447*cdf0e10cSrcweir     switch( eFmtType )
448*cdf0e10cSrcweir     {
449*cdf0e10cSrcweir         case FORMATTYPE_DEC:        appendDec( rStr, nData );       break;
450*cdf0e10cSrcweir         case FORMATTYPE_HEX:        appendHex( rStr, nData );       break;
451*cdf0e10cSrcweir         case FORMATTYPE_SHORTHEX:   appendShortHex( rStr, nData );  break;
452*cdf0e10cSrcweir         case FORMATTYPE_BIN:        appendBin( rStr, nData );       break;
453*cdf0e10cSrcweir         case FORMATTYPE_FIX:        appendFix( rStr, nData );       break;
454*cdf0e10cSrcweir         case FORMATTYPE_BOOL:       appendBool( rStr, nData );      break;
455*cdf0e10cSrcweir         default:;
456*cdf0e10cSrcweir     }
457*cdf0e10cSrcweir }
458*cdf0e10cSrcweir 
459*cdf0e10cSrcweir // ============================================================================
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir class String : public ::rtl::OUString
462*cdf0e10cSrcweir {
463*cdf0e10cSrcweir public:
464*cdf0e10cSrcweir     inline              String() {}
465*cdf0e10cSrcweir     inline /*implicit*/ String( const ::rtl::OUString& rStr ) : ::rtl::OUString( rStr ) {}
466*cdf0e10cSrcweir     inline /*implicit*/ String( const sal_Char* pcStr ) : ::rtl::OUString( ::rtl::OUString::createFromAscii( pcStr ? pcStr : "" ) ) {}
467*cdf0e10cSrcweir     inline /*implicit*/ String( sal_Unicode cChar ) : ::rtl::OUString( cChar ) {}
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir     inline bool         has() const { return getLength() > 0; }
470*cdf0e10cSrcweir     inline ::rtl::OUString operator()( const sal_Char* pcDefault ) const { if( has() ) return *this; return String( pcDefault ); }
471*cdf0e10cSrcweir };
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir static const String EMPTY_STRING;
474*cdf0e10cSrcweir 
475*cdf0e10cSrcweir // ============================================================================
476*cdf0e10cSrcweir // ============================================================================
477*cdf0e10cSrcweir 
478*cdf0e10cSrcweir /** Stack to create a human readable formula string from a UPN token array. */
479*cdf0e10cSrcweir class FormulaStack
480*cdf0e10cSrcweir {
481*cdf0e10cSrcweir public:
482*cdf0e10cSrcweir     explicit            FormulaStack();
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir     inline const ::rtl::OUString& getFormulaString() const { return getString( maFmlaStack ); }
485*cdf0e10cSrcweir     inline const ::rtl::OUString& getClassesString() const { return getString( maClassStack ); }
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir     void                pushOperand( const String& rOp, const ::rtl::OUString& rTokClass );
488*cdf0e10cSrcweir     void                pushOperand( const String& rOp );
489*cdf0e10cSrcweir     void                pushUnaryOp( const String& rLOp, const String& rROp );
490*cdf0e10cSrcweir     void                pushBinaryOp( const String& rOp );
491*cdf0e10cSrcweir     void                pushFuncOp( const String& rFunc, const ::rtl::OUString& rTokClass, sal_uInt8 nParamCount );
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir     inline void         setError() { mbError = true; }
494*cdf0e10cSrcweir     void                replaceOnTop( const ::rtl::OUString& rOld, const ::rtl::OUString& rNew );
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir private:
497*cdf0e10cSrcweir     typedef ::std::stack< ::rtl::OUString > StringStack;
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir     inline bool         check( bool bCond ) { return (mbError |= !bCond) == false; }
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir     const ::rtl::OUString& getString( const StringStack& rStack ) const;
502*cdf0e10cSrcweir     void                pushUnaryOp( StringStack& rStack, const ::rtl::OUString& rLOp, const ::rtl::OUString& rROp );
503*cdf0e10cSrcweir     void                pushBinaryOp( StringStack& rStack, const ::rtl::OUString& rOp );
504*cdf0e10cSrcweir     void                pushFuncOp( StringStack& rStack, const ::rtl::OUString& rOp, sal_uInt8 nParamCount );
505*cdf0e10cSrcweir 
506*cdf0e10cSrcweir private:
507*cdf0e10cSrcweir     StringStack         maFmlaStack;
508*cdf0e10cSrcweir     StringStack         maClassStack;
509*cdf0e10cSrcweir     bool                mbError;
510*cdf0e10cSrcweir };
511*cdf0e10cSrcweir 
512*cdf0e10cSrcweir // ============================================================================
513*cdf0e10cSrcweir // ============================================================================
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir class Base;
516*cdf0e10cSrcweir typedef ::boost::shared_ptr< Base > BaseRef;
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir /** Base class for all dumper classes.
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir     Derived classes implement the virtual function implIsValid(). It should
521*cdf0e10cSrcweir     check all members the other functions rely on. If the function
522*cdf0e10cSrcweir     implIsValid() returns true, all references and pointers can be used without
523*cdf0e10cSrcweir     further checking.
524*cdf0e10cSrcweir 
525*cdf0e10cSrcweir     Overview of all classes in this header file based on this Base class:
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir     Base
528*cdf0e10cSrcweir     |
529*cdf0e10cSrcweir     +---->  NameListBase
530*cdf0e10cSrcweir     |       |
531*cdf0e10cSrcweir     |       +---->  ConstList  ------>  MultiList
532*cdf0e10cSrcweir     |       |
533*cdf0e10cSrcweir     |       +---->  FlagsList  ------>  CombiList
534*cdf0e10cSrcweir     |       |
535*cdf0e10cSrcweir     |       +---->  UnitConverter
536*cdf0e10cSrcweir     |
537*cdf0e10cSrcweir     +---->  SharedConfigData
538*cdf0e10cSrcweir     |
539*cdf0e10cSrcweir     +---->  Config
540*cdf0e10cSrcweir     |
541*cdf0e10cSrcweir     +---->  Output
542*cdf0e10cSrcweir     |
543*cdf0e10cSrcweir     +---->  StorageIterator
544*cdf0e10cSrcweir     |
545*cdf0e10cSrcweir     +---->  ObjectBase
546*cdf0e10cSrcweir             |
547*cdf0e10cSrcweir             +---->  StorageObjectBase
548*cdf0e10cSrcweir             |
549*cdf0e10cSrcweir             +---->  OutputObjectBase
550*cdf0e10cSrcweir             |       |
551*cdf0e10cSrcweir             |       +---->  InputObjectBase
552*cdf0e10cSrcweir             |               |
553*cdf0e10cSrcweir             |               +---->  BinaryStreamObject
554*cdf0e10cSrcweir             |               |
555*cdf0e10cSrcweir             |               +---->  TextStreamObjectBase
556*cdf0e10cSrcweir             |               |       |
557*cdf0e10cSrcweir             |               |       +---->  TextStreamObject
558*cdf0e10cSrcweir             |               |       |
559*cdf0e10cSrcweir             |               |       +---->  XmlStreamObject
560*cdf0e10cSrcweir             |               |
561*cdf0e10cSrcweir             |               +---->  RecordObjectBase
562*cdf0e10cSrcweir             |                       |
563*cdf0e10cSrcweir             |                       +---->  SequenceRecordObjectBase
564*cdf0e10cSrcweir             |
565*cdf0e10cSrcweir             +---->  DumperBase
566*cdf0e10cSrcweir  */
567*cdf0e10cSrcweir class Base
568*cdf0e10cSrcweir {
569*cdf0e10cSrcweir public:
570*cdf0e10cSrcweir     virtual             ~Base();
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir     inline bool         isValid() const { return implIsValid(); }
573*cdf0e10cSrcweir     inline static bool  isValid( const BaseRef& rxBase ) { return rxBase.get() && rxBase->isValid(); }
574*cdf0e10cSrcweir 
575*cdf0e10cSrcweir protected:
576*cdf0e10cSrcweir     inline explicit     Base() {}
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir     virtual bool        implIsValid() const = 0;
579*cdf0e10cSrcweir };
580*cdf0e10cSrcweir 
581*cdf0e10cSrcweir // ============================================================================
582*cdf0e10cSrcweir // ============================================================================
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir class ConfigItemBase
585*cdf0e10cSrcweir {
586*cdf0e10cSrcweir public:
587*cdf0e10cSrcweir     virtual             ~ConfigItemBase();
588*cdf0e10cSrcweir     void                readConfigBlock( TextInputStream& rStrm );
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir protected:
591*cdf0e10cSrcweir     inline explicit     ConfigItemBase() {}
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir     virtual void        implProcessConfigItemStr(
594*cdf0e10cSrcweir                             TextInputStream& rStrm,
595*cdf0e10cSrcweir                             const ::rtl::OUString& rKey,
596*cdf0e10cSrcweir                             const ::rtl::OUString& rData );
597*cdf0e10cSrcweir 
598*cdf0e10cSrcweir     virtual void        implProcessConfigItemInt(
599*cdf0e10cSrcweir                             TextInputStream& rStrm,
600*cdf0e10cSrcweir                             sal_Int64 nKey,
601*cdf0e10cSrcweir                             const ::rtl::OUString& rData );
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir     void                readConfigBlockContents(
604*cdf0e10cSrcweir                             TextInputStream& rStrm );
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir private:
607*cdf0e10cSrcweir     enum LineType { LINETYPE_DATA, LINETYPE_END };
608*cdf0e10cSrcweir 
609*cdf0e10cSrcweir     LineType            readConfigLine(
610*cdf0e10cSrcweir                             TextInputStream& rStrm,
611*cdf0e10cSrcweir                             ::rtl::OUString& orKey,
612*cdf0e10cSrcweir                             ::rtl::OUString& orData ) const;
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir     LineType            readConfigLine(
615*cdf0e10cSrcweir                             TextInputStream& rStrm ) const;
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir     void                processConfigItem(
618*cdf0e10cSrcweir                             TextInputStream& rStrm,
619*cdf0e10cSrcweir                             const ::rtl::OUString& rKey,
620*cdf0e10cSrcweir                             const ::rtl::OUString& rData );
621*cdf0e10cSrcweir };
622*cdf0e10cSrcweir 
623*cdf0e10cSrcweir // ============================================================================
624*cdf0e10cSrcweir 
625*cdf0e10cSrcweir class SharedConfigData;
626*cdf0e10cSrcweir class Config;
627*cdf0e10cSrcweir 
628*cdf0e10cSrcweir class NameListBase;
629*cdf0e10cSrcweir typedef ::boost::shared_ptr< NameListBase > NameListRef;
630*cdf0e10cSrcweir 
631*cdf0e10cSrcweir /** Base class of all classes providing names for specific values (name lists).
632*cdf0e10cSrcweir 
633*cdf0e10cSrcweir     The idea is to provide a unique interfase for all different methods to
634*cdf0e10cSrcweir     write specific names for any values. This can be enumerations (dedicated
635*cdf0e10cSrcweir     names for a subset of values), or names for bits in bit fields. Classes
636*cdf0e10cSrcweir     derived from this base class implement the specific behaviour for the
637*cdf0e10cSrcweir     desired purpose.
638*cdf0e10cSrcweir  */
639*cdf0e10cSrcweir class NameListBase : public Base, public ConfigItemBase
640*cdf0e10cSrcweir {
641*cdf0e10cSrcweir public:
642*cdf0e10cSrcweir     typedef ::std::map< sal_Int64, ::rtl::OUString >    OUStringMap;
643*cdf0e10cSrcweir     typedef OUStringMap::const_iterator                 const_iterator;
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir public:
646*cdf0e10cSrcweir     virtual             ~NameListBase();
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir     /** Sets a name for the specified key. */
649*cdf0e10cSrcweir     void                setName( sal_Int64 nKey, const String& rName );
650*cdf0e10cSrcweir 
651*cdf0e10cSrcweir     /** Include all names of the passed list. */
652*cdf0e10cSrcweir     void                includeList( const NameListRef& rxList );
653*cdf0e10cSrcweir 
654*cdf0e10cSrcweir     /** Returns true, if the map contains an entry for the passed key. */
655*cdf0e10cSrcweir     template< typename Type >
656*cdf0e10cSrcweir     inline bool         hasName( Type nKey ) const
657*cdf0e10cSrcweir         { return maMap.count( static_cast< sal_Int64 >( nKey ) ) != 0; }
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir     /** Returns the name for the passed key. */
660*cdf0e10cSrcweir     template< typename Type >
661*cdf0e10cSrcweir     inline ::rtl::OUString getName( const Config& rCfg, Type nKey ) const
662*cdf0e10cSrcweir         { return implGetName( rCfg, static_cast< sal_Int64 >( nKey ) ); }
663*cdf0e10cSrcweir 
664*cdf0e10cSrcweir     /** Returns a display name for the passed double value. */
665*cdf0e10cSrcweir     inline ::rtl::OUString getName( const Config& rCfg, double fValue ) const
666*cdf0e10cSrcweir         { return implGetNameDbl( rCfg, fValue ); }
667*cdf0e10cSrcweir 
668*cdf0e10cSrcweir     /** Returns a map iterator pointing to the first contained name. */
669*cdf0e10cSrcweir     inline const_iterator begin() const { return maMap.begin(); }
670*cdf0e10cSrcweir     /** Returns a map iterator pointing one past the last contained name. */
671*cdf0e10cSrcweir     inline const_iterator end() const { return maMap.end(); }
672*cdf0e10cSrcweir 
673*cdf0e10cSrcweir protected:
674*cdf0e10cSrcweir     inline explicit     NameListBase( const SharedConfigData& rCfgData ) : mrCfgData( rCfgData ) {}
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir     virtual bool        implIsValid() const;
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir     virtual void        implProcessConfigItemStr(
679*cdf0e10cSrcweir                             TextInputStream& rStrm,
680*cdf0e10cSrcweir                             const ::rtl::OUString& rKey,
681*cdf0e10cSrcweir                             const ::rtl::OUString& rData );
682*cdf0e10cSrcweir 
683*cdf0e10cSrcweir     virtual void        implProcessConfigItemInt(
684*cdf0e10cSrcweir                             TextInputStream& rStrm,
685*cdf0e10cSrcweir                             sal_Int64 nKey,
686*cdf0e10cSrcweir                             const ::rtl::OUString& rData );
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir     /** Derived classes set the name for the passed key. */
689*cdf0e10cSrcweir     virtual void        implSetName( sal_Int64 nKey, const ::rtl::OUString& rName ) = 0;
690*cdf0e10cSrcweir     /** Derived classes generate and return the name for the passed key. */
691*cdf0e10cSrcweir     virtual ::rtl::OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const = 0;
692*cdf0e10cSrcweir     /** Derived classes generate and return the name for the passed double value. */
693*cdf0e10cSrcweir     virtual ::rtl::OUString implGetNameDbl( const Config& rCfg, double fValue ) const = 0;
694*cdf0e10cSrcweir     /** Derived classes insert all names and other settings from the passed list. */
695*cdf0e10cSrcweir     virtual void        implIncludeList( const NameListBase& rList ) = 0;
696*cdf0e10cSrcweir 
697*cdf0e10cSrcweir     /** Inserts the passed name into the internal map. */
698*cdf0e10cSrcweir     void                insertRawName( sal_Int64 nKey, const ::rtl::OUString& rName );
699*cdf0e10cSrcweir     /** Returns the name for the passed key, or 0, if nothing found. */
700*cdf0e10cSrcweir     const ::rtl::OUString* findRawName( sal_Int64 nKey ) const;
701*cdf0e10cSrcweir 
702*cdf0e10cSrcweir private:
703*cdf0e10cSrcweir     /** Includes name lists, given in a comma separated list of names of the lists. */
704*cdf0e10cSrcweir     void                include( const ::rtl::OUString& rListKeys );
705*cdf0e10cSrcweir     /** Excludes names from the list, given in a comma separated list of their keys. */
706*cdf0e10cSrcweir     void                exclude( const ::rtl::OUString& rKeys );
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir private:
709*cdf0e10cSrcweir     OUStringMap         maMap;
710*cdf0e10cSrcweir     const SharedConfigData& mrCfgData;
711*cdf0e10cSrcweir };
712*cdf0e10cSrcweir 
713*cdf0e10cSrcweir // ============================================================================
714*cdf0e10cSrcweir 
715*cdf0e10cSrcweir class ConstList : public NameListBase
716*cdf0e10cSrcweir {
717*cdf0e10cSrcweir public:
718*cdf0e10cSrcweir     explicit            ConstList( const SharedConfigData& rCfgData );
719*cdf0e10cSrcweir 
720*cdf0e10cSrcweir     /** Sets a default name for unknown keys. */
721*cdf0e10cSrcweir     inline void         setDefaultName( const String& rDefName ) { maDefName = rDefName; }
722*cdf0e10cSrcweir     /** Enables or disables automatic quotation of returned names. */
723*cdf0e10cSrcweir     inline void         setQuoteNames( bool bQuoteNames ) { mbQuoteNames = bQuoteNames; }
724*cdf0e10cSrcweir 
725*cdf0e10cSrcweir protected:
726*cdf0e10cSrcweir     virtual void        implProcessConfigItemStr(
727*cdf0e10cSrcweir                             TextInputStream& rStrm,
728*cdf0e10cSrcweir                             const ::rtl::OUString& rKey,
729*cdf0e10cSrcweir                             const ::rtl::OUString& rData );
730*cdf0e10cSrcweir 
731*cdf0e10cSrcweir     /** Sets the name for the passed key. */
732*cdf0e10cSrcweir     virtual void        implSetName( sal_Int64 nKey, const ::rtl::OUString& rName );
733*cdf0e10cSrcweir     /** Returns the name for the passed key, or the default name, if key is not contained. */
734*cdf0e10cSrcweir     virtual ::rtl::OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
735*cdf0e10cSrcweir     /** Returns the name for the passed double value. */
736*cdf0e10cSrcweir     virtual ::rtl::OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
737*cdf0e10cSrcweir     /** Inserts all names from the passed list. */
738*cdf0e10cSrcweir     virtual void        implIncludeList( const NameListBase& rList );
739*cdf0e10cSrcweir 
740*cdf0e10cSrcweir private:
741*cdf0e10cSrcweir     ::rtl::OUString     maDefName;
742*cdf0e10cSrcweir     bool                mbQuoteNames;
743*cdf0e10cSrcweir };
744*cdf0e10cSrcweir 
745*cdf0e10cSrcweir // ============================================================================
746*cdf0e10cSrcweir 
747*cdf0e10cSrcweir class MultiList : public ConstList
748*cdf0e10cSrcweir {
749*cdf0e10cSrcweir public:
750*cdf0e10cSrcweir     explicit            MultiList( const SharedConfigData& rCfgData );
751*cdf0e10cSrcweir 
752*cdf0e10cSrcweir     void                setNamesFromVec( sal_Int64 nStartKey, const OUStringVector& rNames );
753*cdf0e10cSrcweir 
754*cdf0e10cSrcweir protected:
755*cdf0e10cSrcweir     virtual void        implProcessConfigItemStr(
756*cdf0e10cSrcweir                             TextInputStream& rStrm,
757*cdf0e10cSrcweir                             const ::rtl::OUString& rKey,
758*cdf0e10cSrcweir                             const ::rtl::OUString& rData );
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir     virtual void        implSetName( sal_Int64 nKey, const ::rtl::OUString& rName );
761*cdf0e10cSrcweir 
762*cdf0e10cSrcweir private:
763*cdf0e10cSrcweir     void                insertNames( sal_Int64 nStartKey, const ::rtl::OUString& rData );
764*cdf0e10cSrcweir 
765*cdf0e10cSrcweir private:
766*cdf0e10cSrcweir     bool                mbIgnoreEmpty;
767*cdf0e10cSrcweir };
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir // ============================================================================
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir class FlagsList : public NameListBase
772*cdf0e10cSrcweir {
773*cdf0e10cSrcweir public:
774*cdf0e10cSrcweir     explicit            FlagsList( const SharedConfigData& rCfgData );
775*cdf0e10cSrcweir 
776*cdf0e10cSrcweir     /** Returns the flags to be ignored on output. */
777*cdf0e10cSrcweir     inline sal_Int64    getIgnoreFlags() const { return mnIgnore; }
778*cdf0e10cSrcweir     /** Sets flags to be ignored on output. */
779*cdf0e10cSrcweir     inline void         setIgnoreFlags( sal_Int64 nIgnore ) { mnIgnore = nIgnore; }
780*cdf0e10cSrcweir 
781*cdf0e10cSrcweir protected:
782*cdf0e10cSrcweir     virtual void        implProcessConfigItemStr(
783*cdf0e10cSrcweir                             TextInputStream& rStrm,
784*cdf0e10cSrcweir                             const ::rtl::OUString& rKey,
785*cdf0e10cSrcweir                             const ::rtl::OUString& rData );
786*cdf0e10cSrcweir 
787*cdf0e10cSrcweir     /** Sets the name for the passed key. */
788*cdf0e10cSrcweir     virtual void        implSetName( sal_Int64 nKey, const ::rtl::OUString& rName );
789*cdf0e10cSrcweir     /** Returns the name for the passed key. */
790*cdf0e10cSrcweir     virtual ::rtl::OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
791*cdf0e10cSrcweir     /** Returns the name for the passed double value. */
792*cdf0e10cSrcweir     virtual ::rtl::OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
793*cdf0e10cSrcweir     /** Inserts all flags from the passed list. */
794*cdf0e10cSrcweir     virtual void        implIncludeList( const NameListBase& rList );
795*cdf0e10cSrcweir 
796*cdf0e10cSrcweir private:
797*cdf0e10cSrcweir     sal_Int64           mnIgnore;
798*cdf0e10cSrcweir };
799*cdf0e10cSrcweir 
800*cdf0e10cSrcweir // ============================================================================
801*cdf0e10cSrcweir 
802*cdf0e10cSrcweir class CombiList : public FlagsList
803*cdf0e10cSrcweir {
804*cdf0e10cSrcweir public:
805*cdf0e10cSrcweir     explicit            CombiList( const SharedConfigData& rCfgData );
806*cdf0e10cSrcweir 
807*cdf0e10cSrcweir protected:
808*cdf0e10cSrcweir     /** Sets the name for the passed key. */
809*cdf0e10cSrcweir     virtual void        implSetName( sal_Int64 nKey, const ::rtl::OUString& rName );
810*cdf0e10cSrcweir     /** Returns the name for the passed key. */
811*cdf0e10cSrcweir     virtual ::rtl::OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
812*cdf0e10cSrcweir     /** Inserts all flags from the passed list. */
813*cdf0e10cSrcweir     virtual void        implIncludeList( const NameListBase& rList );
814*cdf0e10cSrcweir 
815*cdf0e10cSrcweir private:
816*cdf0e10cSrcweir     struct ExtItemFormatKey
817*cdf0e10cSrcweir     {
818*cdf0e10cSrcweir         sal_Int64           mnKey;
819*cdf0e10cSrcweir         Int64Pair           maFilter;
820*cdf0e10cSrcweir         inline explicit     ExtItemFormatKey( sal_Int64 nKey ) : mnKey( nKey ), maFilter( 0, 0 ) {}
821*cdf0e10cSrcweir         bool                operator<( const ExtItemFormatKey& rRight ) const;
822*cdf0e10cSrcweir 
823*cdf0e10cSrcweir     };
824*cdf0e10cSrcweir     struct ExtItemFormat : public ItemFormat
825*cdf0e10cSrcweir     {
826*cdf0e10cSrcweir         bool                mbShiftValue;
827*cdf0e10cSrcweir         inline explicit     ExtItemFormat() : mbShiftValue( true ) {}
828*cdf0e10cSrcweir     };
829*cdf0e10cSrcweir     typedef ::std::map< ExtItemFormatKey, ExtItemFormat > ExtItemFormatMap;
830*cdf0e10cSrcweir     ExtItemFormatMap    maFmtMap;
831*cdf0e10cSrcweir };
832*cdf0e10cSrcweir 
833*cdf0e10cSrcweir // ============================================================================
834*cdf0e10cSrcweir 
835*cdf0e10cSrcweir class UnitConverter : public NameListBase
836*cdf0e10cSrcweir {
837*cdf0e10cSrcweir public:
838*cdf0e10cSrcweir     explicit            UnitConverter( const SharedConfigData& rCfgData );
839*cdf0e10cSrcweir 
840*cdf0e10cSrcweir     inline void         setUnitName( const String& rUnitName ) { maUnitName = rUnitName; }
841*cdf0e10cSrcweir     inline void         setFactor( double fFactor ) { mfFactor = fFactor; }
842*cdf0e10cSrcweir 
843*cdf0e10cSrcweir protected:
844*cdf0e10cSrcweir     /** Sets the name for the passed key. */
845*cdf0e10cSrcweir     virtual void        implSetName( sal_Int64 nKey, const ::rtl::OUString& rName );
846*cdf0e10cSrcweir     /** Returns the converted value with appended unit name. */
847*cdf0e10cSrcweir     virtual ::rtl::OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
848*cdf0e10cSrcweir     /** Returns the converted value with appended unit name. */
849*cdf0e10cSrcweir     virtual ::rtl::OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
850*cdf0e10cSrcweir     /** Empty implementation. */
851*cdf0e10cSrcweir     virtual void        implIncludeList( const NameListBase& rList );
852*cdf0e10cSrcweir 
853*cdf0e10cSrcweir private:
854*cdf0e10cSrcweir     ::rtl::OUString     maUnitName;
855*cdf0e10cSrcweir     double              mfFactor;
856*cdf0e10cSrcweir };
857*cdf0e10cSrcweir 
858*cdf0e10cSrcweir // ============================================================================
859*cdf0e10cSrcweir 
860*cdf0e10cSrcweir class NameListWrapper
861*cdf0e10cSrcweir {
862*cdf0e10cSrcweir public:
863*cdf0e10cSrcweir     inline              NameListWrapper() {}
864*cdf0e10cSrcweir     inline /*implicit*/ NameListWrapper( const ::rtl::OUString& rListName ) : maName( rListName ) {}
865*cdf0e10cSrcweir     inline /*implicit*/ NameListWrapper( const sal_Char* pcListName ) : maName( pcListName ) {}
866*cdf0e10cSrcweir     inline /*implicit*/ NameListWrapper( const NameListRef& rxList ) : mxList( rxList ) {}
867*cdf0e10cSrcweir 
868*cdf0e10cSrcweir     inline bool         isEmpty() const { return !mxList && !maName.has(); }
869*cdf0e10cSrcweir     NameListRef         getNameList( const Config& rCfg ) const;
870*cdf0e10cSrcweir 
871*cdf0e10cSrcweir private:
872*cdf0e10cSrcweir     String              maName;
873*cdf0e10cSrcweir     mutable NameListRef mxList;
874*cdf0e10cSrcweir };
875*cdf0e10cSrcweir 
876*cdf0e10cSrcweir static const NameListWrapper NO_LIST;
877*cdf0e10cSrcweir 
878*cdf0e10cSrcweir // ============================================================================
879*cdf0e10cSrcweir 
880*cdf0e10cSrcweir class ItemFormatMap : public ::std::map< sal_Int64, ItemFormat >
881*cdf0e10cSrcweir {
882*cdf0e10cSrcweir public:
883*cdf0e10cSrcweir     inline explicit     ItemFormatMap() {}
884*cdf0e10cSrcweir     inline explicit     ItemFormatMap( const NameListRef& rxNameList ) { insertFormats( rxNameList ); }
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir     void                insertFormats( const NameListRef& rxNameList );
887*cdf0e10cSrcweir };
888*cdf0e10cSrcweir 
889*cdf0e10cSrcweir // ============================================================================
890*cdf0e10cSrcweir // ============================================================================
891*cdf0e10cSrcweir 
892*cdf0e10cSrcweir class SharedConfigData : public Base, public ConfigItemBase
893*cdf0e10cSrcweir {
894*cdf0e10cSrcweir public:
895*cdf0e10cSrcweir     explicit            SharedConfigData(
896*cdf0e10cSrcweir                             const ::rtl::OUString& rFileName,
897*cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
898*cdf0e10cSrcweir                             const StorageRef& rxRootStrg,
899*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName,
900*cdf0e10cSrcweir                             ::comphelper::MediaDescriptor& rMediaDesc );
901*cdf0e10cSrcweir 
902*cdf0e10cSrcweir     virtual             ~SharedConfigData();
903*cdf0e10cSrcweir 
904*cdf0e10cSrcweir     inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxContext; }
905*cdf0e10cSrcweir     inline const StorageRef& getRootStorage() const { return mxRootStrg; }
906*cdf0e10cSrcweir     inline const ::rtl::OUString& getSysFileName() const { return maSysFileName; }
907*cdf0e10cSrcweir 
908*cdf0e10cSrcweir     void                setOption( const ::rtl::OUString& rKey, const ::rtl::OUString& rData );
909*cdf0e10cSrcweir     const ::rtl::OUString* getOption( const ::rtl::OUString& rKey ) const;
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir     template< typename ListType >
912*cdf0e10cSrcweir     ::boost::shared_ptr< ListType > createNameList( const ::rtl::OUString& rListName );
913*cdf0e10cSrcweir     void                setNameList( const ::rtl::OUString& rListName, const NameListRef& rxList );
914*cdf0e10cSrcweir     void                eraseNameList( const ::rtl::OUString& rListName );
915*cdf0e10cSrcweir     NameListRef         getNameList( const ::rtl::OUString& rListName ) const;
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier );
918*cdf0e10cSrcweir     inline bool         isPasswordCancelled() const { return mbPwCancelled; }
919*cdf0e10cSrcweir 
920*cdf0e10cSrcweir protected:
921*cdf0e10cSrcweir     virtual bool        implIsValid() const;
922*cdf0e10cSrcweir     virtual void        implProcessConfigItemStr(
923*cdf0e10cSrcweir                             TextInputStream& rStrm,
924*cdf0e10cSrcweir                             const ::rtl::OUString& rKey,
925*cdf0e10cSrcweir                             const ::rtl::OUString& rData );
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir private:
928*cdf0e10cSrcweir     bool                readConfigFile( const ::rtl::OUString& rFileUrl );
929*cdf0e10cSrcweir     template< typename ListType >
930*cdf0e10cSrcweir     void                readNameList( TextInputStream& rStrm, const ::rtl::OUString& rListName );
931*cdf0e10cSrcweir     void                createShortList( const ::rtl::OUString& rData );
932*cdf0e10cSrcweir     void                createUnitConverter( const ::rtl::OUString& rData );
933*cdf0e10cSrcweir 
934*cdf0e10cSrcweir private:
935*cdf0e10cSrcweir     typedef ::std::set< ::rtl::OUString >                   ConfigFileSet;
936*cdf0e10cSrcweir     typedef ::std::map< ::rtl::OUString, ::rtl::OUString >  ConfigDataMap;
937*cdf0e10cSrcweir     typedef ::std::map< ::rtl::OUString, NameListRef >      NameListMap;
938*cdf0e10cSrcweir 
939*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
940*cdf0e10cSrcweir     StorageRef          mxRootStrg;
941*cdf0e10cSrcweir     ::rtl::OUString     maSysFileName;
942*cdf0e10cSrcweir     ::comphelper::MediaDescriptor& mrMediaDesc;
943*cdf0e10cSrcweir     ConfigFileSet       maConfigFiles;
944*cdf0e10cSrcweir     ConfigDataMap       maConfigData;
945*cdf0e10cSrcweir     NameListMap         maNameLists;
946*cdf0e10cSrcweir     ::rtl::OUString     maConfigPath;
947*cdf0e10cSrcweir     bool                mbLoaded;
948*cdf0e10cSrcweir     bool                mbPwCancelled;
949*cdf0e10cSrcweir };
950*cdf0e10cSrcweir 
951*cdf0e10cSrcweir // ----------------------------------------------------------------------------
952*cdf0e10cSrcweir 
953*cdf0e10cSrcweir template< typename ListType >
954*cdf0e10cSrcweir ::boost::shared_ptr< ListType > SharedConfigData::createNameList( const ::rtl::OUString& rListName )
955*cdf0e10cSrcweir {
956*cdf0e10cSrcweir     ::boost::shared_ptr< ListType > xList;
957*cdf0e10cSrcweir     if( rListName.getLength() > 0 )
958*cdf0e10cSrcweir     {
959*cdf0e10cSrcweir         xList.reset( new ListType( *this ) );
960*cdf0e10cSrcweir         setNameList( rListName, xList );
961*cdf0e10cSrcweir     }
962*cdf0e10cSrcweir     return xList;
963*cdf0e10cSrcweir }
964*cdf0e10cSrcweir 
965*cdf0e10cSrcweir template< typename ListType >
966*cdf0e10cSrcweir void SharedConfigData::readNameList( TextInputStream& rStrm, const ::rtl::OUString& rListName )
967*cdf0e10cSrcweir {
968*cdf0e10cSrcweir     NameListRef xList = createNameList< ListType >( rListName );
969*cdf0e10cSrcweir     if( xList.get() )
970*cdf0e10cSrcweir         xList->readConfigBlock( rStrm );
971*cdf0e10cSrcweir }
972*cdf0e10cSrcweir 
973*cdf0e10cSrcweir // ============================================================================
974*cdf0e10cSrcweir 
975*cdf0e10cSrcweir class Config : public Base
976*cdf0e10cSrcweir {
977*cdf0e10cSrcweir public:
978*cdf0e10cSrcweir     explicit            Config( const Config& rParent );
979*cdf0e10cSrcweir     explicit            Config(
980*cdf0e10cSrcweir                             const sal_Char* pcEnvVar,
981*cdf0e10cSrcweir                             const ::oox::core::FilterBase& rFilter );
982*cdf0e10cSrcweir     explicit            Config(
983*cdf0e10cSrcweir                             const sal_Char* pcEnvVar,
984*cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
985*cdf0e10cSrcweir                             const StorageRef& rxRootStrg,
986*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName,
987*cdf0e10cSrcweir                             ::comphelper::MediaDescriptor& rMediaDesc );
988*cdf0e10cSrcweir 
989*cdf0e10cSrcweir     virtual             ~Config();
990*cdf0e10cSrcweir 
991*cdf0e10cSrcweir     inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxCfgData->getContext(); }
992*cdf0e10cSrcweir     inline const StorageRef& getRootStorage() const { return mxCfgData->getRootStorage(); }
993*cdf0e10cSrcweir     inline const ::rtl::OUString& getSysFileName() const { return mxCfgData->getSysFileName(); }
994*cdf0e10cSrcweir 
995*cdf0e10cSrcweir     void                setStringOption( const String& rKey, const String& rData );
996*cdf0e10cSrcweir 
997*cdf0e10cSrcweir     const ::rtl::OUString& getStringOption( const String& rKey, const ::rtl::OUString& rDefault ) const;
998*cdf0e10cSrcweir     bool                getBoolOption( const String& rKey, bool bDefault ) const;
999*cdf0e10cSrcweir     template< typename Type >
1000*cdf0e10cSrcweir     Type                getIntOption( const String& rKey, Type nDefault ) const;
1001*cdf0e10cSrcweir 
1002*cdf0e10cSrcweir     bool                isDumperEnabled() const;
1003*cdf0e10cSrcweir     bool                isImportEnabled() const;
1004*cdf0e10cSrcweir 
1005*cdf0e10cSrcweir     template< typename ListType >
1006*cdf0e10cSrcweir     ::boost::shared_ptr< ListType > createNameList( const String& rListName );
1007*cdf0e10cSrcweir     void                setNameList( const String& rListName, const NameListRef& rxList );
1008*cdf0e10cSrcweir     void                eraseNameList( const String& rListName );
1009*cdf0e10cSrcweir     NameListRef         getNameList( const String& rListName ) const;
1010*cdf0e10cSrcweir 
1011*cdf0e10cSrcweir     /** Returns the name for the passed key from the passed name list. */
1012*cdf0e10cSrcweir     template< typename Type >
1013*cdf0e10cSrcweir     ::rtl::OUString     getName( const NameListWrapper& rListWrp, Type nKey ) const;
1014*cdf0e10cSrcweir     /** Returns true, if the passed name list contains an entry for the passed key. */
1015*cdf0e10cSrcweir     template< typename Type >
1016*cdf0e10cSrcweir     bool                hasName( const NameListWrapper& rListWrp, Type nKey ) const;
1017*cdf0e10cSrcweir 
1018*cdf0e10cSrcweir     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier );
1019*cdf0e10cSrcweir     bool                isPasswordCancelled() const;
1020*cdf0e10cSrcweir 
1021*cdf0e10cSrcweir protected:
1022*cdf0e10cSrcweir     inline explicit     Config() {}
1023*cdf0e10cSrcweir     void                construct( const Config& rParent );
1024*cdf0e10cSrcweir     void                construct(
1025*cdf0e10cSrcweir                             const sal_Char* pcEnvVar,
1026*cdf0e10cSrcweir                             const ::oox::core::FilterBase& rFilter );
1027*cdf0e10cSrcweir     void                construct(
1028*cdf0e10cSrcweir                             const sal_Char* pcEnvVar,
1029*cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
1030*cdf0e10cSrcweir                             const StorageRef& rxRootStrg,
1031*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName,
1032*cdf0e10cSrcweir                             ::comphelper::MediaDescriptor& rMediaDesc );
1033*cdf0e10cSrcweir 
1034*cdf0e10cSrcweir     virtual bool        implIsValid() const;
1035*cdf0e10cSrcweir     virtual const ::rtl::OUString* implGetOption( const ::rtl::OUString& rKey ) const;
1036*cdf0e10cSrcweir     virtual NameListRef implGetNameList( const ::rtl::OUString& rListName ) const;
1037*cdf0e10cSrcweir 
1038*cdf0e10cSrcweir private:
1039*cdf0e10cSrcweir     typedef ::boost::shared_ptr< SharedConfigData > SharedConfigDataRef;
1040*cdf0e10cSrcweir     SharedConfigDataRef mxCfgData;
1041*cdf0e10cSrcweir };
1042*cdf0e10cSrcweir 
1043*cdf0e10cSrcweir typedef ::boost::shared_ptr< Config > ConfigRef;
1044*cdf0e10cSrcweir 
1045*cdf0e10cSrcweir // ----------------------------------------------------------------------------
1046*cdf0e10cSrcweir 
1047*cdf0e10cSrcweir template< typename Type >
1048*cdf0e10cSrcweir Type Config::getIntOption( const String& rKey, Type nDefault ) const
1049*cdf0e10cSrcweir {
1050*cdf0e10cSrcweir     sal_Int64 nRawData;
1051*cdf0e10cSrcweir     const ::rtl::OUString* pData = implGetOption( rKey );
1052*cdf0e10cSrcweir     return (pData && StringHelper::convertStringToInt( nRawData, *pData )) ?
1053*cdf0e10cSrcweir         static_cast< Type >( nRawData ) : nDefault;
1054*cdf0e10cSrcweir }
1055*cdf0e10cSrcweir 
1056*cdf0e10cSrcweir template< typename ListType >
1057*cdf0e10cSrcweir ::boost::shared_ptr< ListType > Config::createNameList( const String& rListName )
1058*cdf0e10cSrcweir {
1059*cdf0e10cSrcweir     return mxCfgData->createNameList< ListType >( rListName );
1060*cdf0e10cSrcweir }
1061*cdf0e10cSrcweir 
1062*cdf0e10cSrcweir template< typename Type >
1063*cdf0e10cSrcweir ::rtl::OUString Config::getName( const NameListWrapper& rListWrp, Type nKey ) const
1064*cdf0e10cSrcweir {
1065*cdf0e10cSrcweir     NameListRef xList = rListWrp.getNameList( *this );
1066*cdf0e10cSrcweir     return xList.get() ? xList->getName( *this, nKey ) : OOX_DUMP_ERR_NOMAP;
1067*cdf0e10cSrcweir }
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir template< typename Type >
1070*cdf0e10cSrcweir bool Config::hasName( const NameListWrapper& rListWrp, Type nKey ) const
1071*cdf0e10cSrcweir {
1072*cdf0e10cSrcweir     NameListRef xList = rListWrp.getNameList( *this );
1073*cdf0e10cSrcweir     return xList.get() && xList->hasName( nKey );
1074*cdf0e10cSrcweir }
1075*cdf0e10cSrcweir 
1076*cdf0e10cSrcweir // ============================================================================
1077*cdf0e10cSrcweir // ============================================================================
1078*cdf0e10cSrcweir 
1079*cdf0e10cSrcweir class Output : public Base
1080*cdf0e10cSrcweir {
1081*cdf0e10cSrcweir public:
1082*cdf0e10cSrcweir     explicit            Output(
1083*cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
1084*cdf0e10cSrcweir                             const ::rtl::OUString& rFileName );
1085*cdf0e10cSrcweir 
1086*cdf0e10cSrcweir     // ------------------------------------------------------------------------
1087*cdf0e10cSrcweir 
1088*cdf0e10cSrcweir     void                newLine();
1089*cdf0e10cSrcweir     void                emptyLine( size_t nCount = 1 );
1090*cdf0e10cSrcweir     inline ::rtl::OUStringBuffer& getLine() { return maLine; }
1091*cdf0e10cSrcweir 
1092*cdf0e10cSrcweir     void                incIndent();
1093*cdf0e10cSrcweir     void                decIndent();
1094*cdf0e10cSrcweir     void                resetIndent();
1095*cdf0e10cSrcweir 
1096*cdf0e10cSrcweir     void                startTable( sal_Int32 nW1 );
1097*cdf0e10cSrcweir     void                startTable( sal_Int32 nW1, sal_Int32 nW2 );
1098*cdf0e10cSrcweir     void                startTable( sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3 );
1099*cdf0e10cSrcweir     void                startTable( sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 );
1100*cdf0e10cSrcweir     void                startTable( size_t nColCount, const sal_Int32* pnColWidths );
1101*cdf0e10cSrcweir     void                tab();
1102*cdf0e10cSrcweir     void                tab( size_t nCol );
1103*cdf0e10cSrcweir     void                endTable();
1104*cdf0e10cSrcweir 
1105*cdf0e10cSrcweir     void                resetItemIndex( sal_Int64 nIdx = 0 );
1106*cdf0e10cSrcweir     void                startItem( const String& rItemName );
1107*cdf0e10cSrcweir     void                contItem();
1108*cdf0e10cSrcweir     void                endItem();
1109*cdf0e10cSrcweir     inline const ::rtl::OUString& getLastItemValue() const { return maLastItem; }
1110*cdf0e10cSrcweir 
1111*cdf0e10cSrcweir     void                startMultiItems();
1112*cdf0e10cSrcweir     void                endMultiItems();
1113*cdf0e10cSrcweir 
1114*cdf0e10cSrcweir     // ------------------------------------------------------------------------
1115*cdf0e10cSrcweir 
1116*cdf0e10cSrcweir     void                writeChar( sal_Unicode cChar, sal_Int32 nCount = 1 );
1117*cdf0e10cSrcweir     void                writeAscii( const sal_Char* pcStr );
1118*cdf0e10cSrcweir     void                writeString( const ::rtl::OUString& rStr );
1119*cdf0e10cSrcweir     void                writeArray( const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
1120*cdf0e10cSrcweir     void                writeBool( bool bData );
1121*cdf0e10cSrcweir     void                writeColorABGR( sal_Int32 nColor );
1122*cdf0e10cSrcweir     void                writeDateTime( const ::com::sun::star::util::DateTime& rDateTime );
1123*cdf0e10cSrcweir     void                writeColIndex( sal_Int32 nCol );
1124*cdf0e10cSrcweir     void                writeRowIndex( sal_Int32 nRow );
1125*cdf0e10cSrcweir     void                writeColRowRange( sal_Int32 nColRow1, sal_Int32 nColRow2 );
1126*cdf0e10cSrcweir     void                writeColRange( sal_Int32 nCol1, sal_Int32 nCol2 );
1127*cdf0e10cSrcweir     void                writeRowRange( sal_Int32 nRow1, sal_Int32 nRow2 );
1128*cdf0e10cSrcweir     void                writeAddress( const Address& rPos );
1129*cdf0e10cSrcweir     void                writeRange( const Range& rRange );
1130*cdf0e10cSrcweir     void                writeRangeList( const RangeList& rRanges );
1131*cdf0e10cSrcweir 
1132*cdf0e10cSrcweir     template< typename Type >
1133*cdf0e10cSrcweir     inline void         writeDec( Type nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' )
1134*cdf0e10cSrcweir                             { StringHelper::appendDec( maLine, nData, nWidth, cFill ); }
1135*cdf0e10cSrcweir     template< typename Type >
1136*cdf0e10cSrcweir     inline void         writeHex( Type nData, bool bPrefix = true )
1137*cdf0e10cSrcweir                             { StringHelper::appendHex( maLine, nData, bPrefix ); }
1138*cdf0e10cSrcweir     template< typename Type >
1139*cdf0e10cSrcweir     inline void         writeShortHex( Type nData, bool bPrefix = true )
1140*cdf0e10cSrcweir                             { StringHelper::appendShortHex( maLine, nData, bPrefix ); }
1141*cdf0e10cSrcweir     template< typename Type >
1142*cdf0e10cSrcweir     inline void         writeBin( Type nData, bool bDots = true )
1143*cdf0e10cSrcweir                             { StringHelper::appendBin( maLine, nData, bDots ); }
1144*cdf0e10cSrcweir     template< typename Type >
1145*cdf0e10cSrcweir     inline void         writeFix( Type nData, sal_Int32 nWidth = 0 )
1146*cdf0e10cSrcweir                             { StringHelper::appendFix( maLine, nData, nWidth ); }
1147*cdf0e10cSrcweir     template< typename Type >
1148*cdf0e10cSrcweir     inline void         writeValue( Type nData, FormatType eFmtType )
1149*cdf0e10cSrcweir                             { StringHelper::appendValue( maLine, nData, eFmtType ); }
1150*cdf0e10cSrcweir     template< typename Type >
1151*cdf0e10cSrcweir     inline void         writeName( const Config& rCfg, Type nData, const NameListWrapper& rListWrp )
1152*cdf0e10cSrcweir                             { writeString( rCfg.getName( rListWrp, nData ) ); }
1153*cdf0e10cSrcweir 
1154*cdf0e10cSrcweir     // ------------------------------------------------------------------------
1155*cdf0e10cSrcweir protected:
1156*cdf0e10cSrcweir     virtual bool        implIsValid() const;
1157*cdf0e10cSrcweir 
1158*cdf0e10cSrcweir private:
1159*cdf0e10cSrcweir     void                writeItemName( const String& rItemName );
1160*cdf0e10cSrcweir 
1161*cdf0e10cSrcweir private:
1162*cdf0e10cSrcweir     typedef ::std::vector< sal_Int32 > StringLenVec;
1163*cdf0e10cSrcweir 
1164*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream > mxStrm;
1165*cdf0e10cSrcweir     ::rtl::OUString     maIndent;
1166*cdf0e10cSrcweir     ::rtl::OUStringBuffer maLine;
1167*cdf0e10cSrcweir     ::rtl::OUString     maLastItem;
1168*cdf0e10cSrcweir     StringLenVec        maColPos;
1169*cdf0e10cSrcweir     size_t              mnCol;
1170*cdf0e10cSrcweir     size_t              mnItemLevel;
1171*cdf0e10cSrcweir     size_t              mnMultiLevel;
1172*cdf0e10cSrcweir     sal_Int64           mnItemIdx;
1173*cdf0e10cSrcweir     sal_Int32           mnLastItem;
1174*cdf0e10cSrcweir };
1175*cdf0e10cSrcweir 
1176*cdf0e10cSrcweir typedef ::boost::shared_ptr< Output > OutputRef;
1177*cdf0e10cSrcweir 
1178*cdf0e10cSrcweir // ============================================================================
1179*cdf0e10cSrcweir 
1180*cdf0e10cSrcweir class IndentGuard
1181*cdf0e10cSrcweir {
1182*cdf0e10cSrcweir public:
1183*cdf0e10cSrcweir     inline explicit     IndentGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.incIndent(); }
1184*cdf0e10cSrcweir     inline              ~IndentGuard() { mrOut.decIndent(); }
1185*cdf0e10cSrcweir private:
1186*cdf0e10cSrcweir                         IndentGuard( const IndentGuard& );
1187*cdf0e10cSrcweir     IndentGuard&        operator=( const IndentGuard& );
1188*cdf0e10cSrcweir private:
1189*cdf0e10cSrcweir     Output&             mrOut;
1190*cdf0e10cSrcweir };
1191*cdf0e10cSrcweir 
1192*cdf0e10cSrcweir // ----------------------------------------------------------------------------
1193*cdf0e10cSrcweir 
1194*cdf0e10cSrcweir class TableGuard
1195*cdf0e10cSrcweir {
1196*cdf0e10cSrcweir public:
1197*cdf0e10cSrcweir     inline explicit     TableGuard( const OutputRef& rxOut, sal_Int32 nW1 ) :
1198*cdf0e10cSrcweir                             mrOut( *rxOut ) { mrOut.startTable( nW1 ); }
1199*cdf0e10cSrcweir     inline explicit     TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2 ) :
1200*cdf0e10cSrcweir                             mrOut( *rxOut ) { mrOut.startTable( nW1, nW2 ); }
1201*cdf0e10cSrcweir     inline explicit     TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3 ) :
1202*cdf0e10cSrcweir                             mrOut( *rxOut ) { mrOut.startTable( nW1, nW2, nW3 ); }
1203*cdf0e10cSrcweir     inline explicit     TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 ) :
1204*cdf0e10cSrcweir                             mrOut( *rxOut ) { mrOut.startTable( nW1, nW2, nW3, nW4 ); }
1205*cdf0e10cSrcweir     inline explicit     TableGuard( const OutputRef& rxOut, size_t nColCount,
1206*cdf0e10cSrcweir                                 const sal_Int32* pnColWidths ) :
1207*cdf0e10cSrcweir                             mrOut( *rxOut ) { mrOut.startTable( nColCount, pnColWidths ); }
1208*cdf0e10cSrcweir     inline              ~TableGuard() { mrOut.endTable(); }
1209*cdf0e10cSrcweir     inline void         tab() { mrOut.tab(); }
1210*cdf0e10cSrcweir     inline void         tab( size_t nCol ) { mrOut.tab( nCol ); }
1211*cdf0e10cSrcweir private:
1212*cdf0e10cSrcweir                         TableGuard( const TableGuard& );
1213*cdf0e10cSrcweir     TableGuard&         operator=( const TableGuard& );
1214*cdf0e10cSrcweir private:
1215*cdf0e10cSrcweir     Output&             mrOut;
1216*cdf0e10cSrcweir };
1217*cdf0e10cSrcweir 
1218*cdf0e10cSrcweir // ----------------------------------------------------------------------------
1219*cdf0e10cSrcweir 
1220*cdf0e10cSrcweir class ItemGuard
1221*cdf0e10cSrcweir {
1222*cdf0e10cSrcweir public:
1223*cdf0e10cSrcweir     inline explicit     ItemGuard( const OutputRef& rxOut, const String& rName = EMPTY_STRING ) :
1224*cdf0e10cSrcweir                             mrOut( *rxOut ) { mrOut.startItem( rName ); }
1225*cdf0e10cSrcweir     inline              ~ItemGuard() { mrOut.endItem(); }
1226*cdf0e10cSrcweir     inline void         cont() { mrOut.contItem(); }
1227*cdf0e10cSrcweir private:
1228*cdf0e10cSrcweir                         ItemGuard( const ItemGuard& );
1229*cdf0e10cSrcweir     ItemGuard&          operator=( const ItemGuard& );
1230*cdf0e10cSrcweir private:
1231*cdf0e10cSrcweir     Output&             mrOut;
1232*cdf0e10cSrcweir };
1233*cdf0e10cSrcweir 
1234*cdf0e10cSrcweir // ----------------------------------------------------------------------------
1235*cdf0e10cSrcweir 
1236*cdf0e10cSrcweir class MultiItemsGuard
1237*cdf0e10cSrcweir {
1238*cdf0e10cSrcweir public:
1239*cdf0e10cSrcweir     inline explicit     MultiItemsGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.startMultiItems(); }
1240*cdf0e10cSrcweir     inline              ~MultiItemsGuard() { mrOut.endMultiItems(); }
1241*cdf0e10cSrcweir private:
1242*cdf0e10cSrcweir                         MultiItemsGuard( const MultiItemsGuard& );
1243*cdf0e10cSrcweir     MultiItemsGuard&    operator=( const MultiItemsGuard& );
1244*cdf0e10cSrcweir private:
1245*cdf0e10cSrcweir     Output&             mrOut;
1246*cdf0e10cSrcweir };
1247*cdf0e10cSrcweir 
1248*cdf0e10cSrcweir // ============================================================================
1249*cdf0e10cSrcweir 
1250*cdf0e10cSrcweir class StorageIterator : public Base
1251*cdf0e10cSrcweir {
1252*cdf0e10cSrcweir public:
1253*cdf0e10cSrcweir     explicit            StorageIterator( const StorageRef& rxStrg );
1254*cdf0e10cSrcweir     virtual             ~StorageIterator();
1255*cdf0e10cSrcweir 
1256*cdf0e10cSrcweir     size_t              getElementCount() const;
1257*cdf0e10cSrcweir 
1258*cdf0e10cSrcweir     StorageIterator&    operator++();
1259*cdf0e10cSrcweir 
1260*cdf0e10cSrcweir     ::rtl::OUString     getName() const;
1261*cdf0e10cSrcweir     bool                isStream() const;
1262*cdf0e10cSrcweir     bool                isStorage() const;
1263*cdf0e10cSrcweir 
1264*cdf0e10cSrcweir private:
1265*cdf0e10cSrcweir     virtual bool        implIsValid() const;
1266*cdf0e10cSrcweir 
1267*cdf0e10cSrcweir private:
1268*cdf0e10cSrcweir     StorageRef          mxStrg;
1269*cdf0e10cSrcweir     OUStringVector      maNames;
1270*cdf0e10cSrcweir     OUStringVector::const_iterator maIt;
1271*cdf0e10cSrcweir };
1272*cdf0e10cSrcweir 
1273*cdf0e10cSrcweir // ============================================================================
1274*cdf0e10cSrcweir // ============================================================================
1275*cdf0e10cSrcweir 
1276*cdf0e10cSrcweir class ObjectBase : public Base
1277*cdf0e10cSrcweir {
1278*cdf0e10cSrcweir public:
1279*cdf0e10cSrcweir     virtual             ~ObjectBase();
1280*cdf0e10cSrcweir 
1281*cdf0e10cSrcweir     inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
1282*cdf0e10cSrcweir                         getContext() const { return mxConfig->getContext(); }
1283*cdf0e10cSrcweir 
1284*cdf0e10cSrcweir     void                dump();
1285*cdf0e10cSrcweir 
1286*cdf0e10cSrcweir     // ------------------------------------------------------------------------
1287*cdf0e10cSrcweir protected:
1288*cdf0e10cSrcweir     inline explicit     ObjectBase() {}
1289*cdf0e10cSrcweir 
1290*cdf0e10cSrcweir     void                construct( const ConfigRef& rxConfig );
1291*cdf0e10cSrcweir     void                construct( const ObjectBase& rParent );
1292*cdf0e10cSrcweir 
1293*cdf0e10cSrcweir     virtual bool        implIsValid() const;
1294*cdf0e10cSrcweir     virtual void        implDump();
1295*cdf0e10cSrcweir 
1296*cdf0e10cSrcweir     // ------------------------------------------------------------------------
1297*cdf0e10cSrcweir 
1298*cdf0e10cSrcweir     void                reconstructConfig( const ConfigRef& rxConfig );
1299*cdf0e10cSrcweir 
1300*cdf0e10cSrcweir     inline Config&      cfg() const { return *mxConfig; }
1301*cdf0e10cSrcweir 
1302*cdf0e10cSrcweir private:
1303*cdf0e10cSrcweir     ConfigRef           mxConfig;
1304*cdf0e10cSrcweir };
1305*cdf0e10cSrcweir 
1306*cdf0e10cSrcweir typedef ::boost::shared_ptr< ObjectBase > ObjectRef;
1307*cdf0e10cSrcweir 
1308*cdf0e10cSrcweir // ============================================================================
1309*cdf0e10cSrcweir // ============================================================================
1310*cdf0e10cSrcweir 
1311*cdf0e10cSrcweir class StorageObjectBase : public ObjectBase
1312*cdf0e10cSrcweir {
1313*cdf0e10cSrcweir protected:
1314*cdf0e10cSrcweir     inline explicit     StorageObjectBase() {}
1315*cdf0e10cSrcweir 
1316*cdf0e10cSrcweir protected:
1317*cdf0e10cSrcweir     using               ObjectBase::construct;
1318*cdf0e10cSrcweir     void                construct( const ObjectBase& rParent, const StorageRef& rxStrg, const ::rtl::OUString& rSysPath );
1319*cdf0e10cSrcweir     void                construct( const ObjectBase& rParent );
1320*cdf0e10cSrcweir 
1321*cdf0e10cSrcweir     virtual bool        implIsValid() const;
1322*cdf0e10cSrcweir     virtual void        implDump();
1323*cdf0e10cSrcweir 
1324*cdf0e10cSrcweir     virtual void        implDumpStream(
1325*cdf0e10cSrcweir                             const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
1326*cdf0e10cSrcweir                             const ::rtl::OUString& rStrgPath,
1327*cdf0e10cSrcweir                             const ::rtl::OUString& rStrmName,
1328*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName );
1329*cdf0e10cSrcweir 
1330*cdf0e10cSrcweir     virtual void        implDumpStorage(
1331*cdf0e10cSrcweir                             const StorageRef& rxStrg,
1332*cdf0e10cSrcweir                             const ::rtl::OUString& rStrgPath,
1333*cdf0e10cSrcweir                             const ::rtl::OUString& rSysPath );
1334*cdf0e10cSrcweir 
1335*cdf0e10cSrcweir     virtual void        implDumpBaseStream(
1336*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxStrm,
1337*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName );
1338*cdf0e10cSrcweir 
1339*cdf0e10cSrcweir     void                addPreferredStream( const String& rStrmName );
1340*cdf0e10cSrcweir     void                addPreferredStorage( const String& rStrgPath );
1341*cdf0e10cSrcweir 
1342*cdf0e10cSrcweir private:
1343*cdf0e10cSrcweir     ::rtl::OUString     getSysFileName(
1344*cdf0e10cSrcweir                             const ::rtl::OUString& rStrmName,
1345*cdf0e10cSrcweir                             const ::rtl::OUString& rSysOutPath );
1346*cdf0e10cSrcweir 
1347*cdf0e10cSrcweir     void                extractStream(
1348*cdf0e10cSrcweir                             StorageBase& rStrg,
1349*cdf0e10cSrcweir                             const ::rtl::OUString& rStrgPath,
1350*cdf0e10cSrcweir                             const ::rtl::OUString& rStrmName,
1351*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName );
1352*cdf0e10cSrcweir     void                extractStorage(
1353*cdf0e10cSrcweir                             const StorageRef& rxStrg,
1354*cdf0e10cSrcweir                             const ::rtl::OUString& rStrgPath,
1355*cdf0e10cSrcweir                             const ::rtl::OUString& rSysPath );
1356*cdf0e10cSrcweir 
1357*cdf0e10cSrcweir     void                extractItem(
1358*cdf0e10cSrcweir                             const StorageRef& rxStrg,
1359*cdf0e10cSrcweir                             const ::rtl::OUString& rStrgPath,
1360*cdf0e10cSrcweir                             const ::rtl::OUString& rItemName,
1361*cdf0e10cSrcweir                             const ::rtl::OUString& rSysPath,
1362*cdf0e10cSrcweir                             bool bIsStrg, bool bIsStrm );
1363*cdf0e10cSrcweir 
1364*cdf0e10cSrcweir private:
1365*cdf0e10cSrcweir     struct PreferredItem
1366*cdf0e10cSrcweir     {
1367*cdf0e10cSrcweir         ::rtl::OUString     maName;
1368*cdf0e10cSrcweir         bool                mbStorage;
1369*cdf0e10cSrcweir 
1370*cdf0e10cSrcweir         inline explicit     PreferredItem( const ::rtl::OUString rName, bool bStorage ) :
1371*cdf0e10cSrcweir                                 maName( rName ), mbStorage( bStorage ) {}
1372*cdf0e10cSrcweir     };
1373*cdf0e10cSrcweir     typedef ::std::vector< PreferredItem > PreferredItemVector;
1374*cdf0e10cSrcweir 
1375*cdf0e10cSrcweir     StorageRef          mxStrg;
1376*cdf0e10cSrcweir     ::rtl::OUString     maSysPath;
1377*cdf0e10cSrcweir     PreferredItemVector maPreferred;
1378*cdf0e10cSrcweir };
1379*cdf0e10cSrcweir 
1380*cdf0e10cSrcweir typedef ::boost::shared_ptr< StorageObjectBase > StorageObjectRef;
1381*cdf0e10cSrcweir 
1382*cdf0e10cSrcweir // ============================================================================
1383*cdf0e10cSrcweir // ============================================================================
1384*cdf0e10cSrcweir 
1385*cdf0e10cSrcweir class OutputObjectBase : public ObjectBase
1386*cdf0e10cSrcweir {
1387*cdf0e10cSrcweir public:
1388*cdf0e10cSrcweir     virtual             ~OutputObjectBase();
1389*cdf0e10cSrcweir 
1390*cdf0e10cSrcweir     // ------------------------------------------------------------------------
1391*cdf0e10cSrcweir protected:
1392*cdf0e10cSrcweir     inline explicit     OutputObjectBase() {}
1393*cdf0e10cSrcweir 
1394*cdf0e10cSrcweir     using               ObjectBase::construct;
1395*cdf0e10cSrcweir     void                construct( const ObjectBase& rParent, const ::rtl::OUString& rSysFileName );
1396*cdf0e10cSrcweir     void                construct( const OutputObjectBase& rParent );
1397*cdf0e10cSrcweir 
1398*cdf0e10cSrcweir     virtual bool        implIsValid() const;
1399*cdf0e10cSrcweir 
1400*cdf0e10cSrcweir     // ------------------------------------------------------------------------
1401*cdf0e10cSrcweir 
1402*cdf0e10cSrcweir     void                writeEmptyItem( const String& rName );
1403*cdf0e10cSrcweir     void                writeInfoItem( const String& rName, const String& rData );
1404*cdf0e10cSrcweir     void                writeCharItem( const String& rName, sal_Unicode cData );
1405*cdf0e10cSrcweir     void                writeStringItem( const String& rName, const ::rtl::OUString& rData );
1406*cdf0e10cSrcweir     void                writeArrayItem( const String& rName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
1407*cdf0e10cSrcweir     void                writeBoolItem( const String& rName, bool bData );
1408*cdf0e10cSrcweir     double              writeRkItem( const String& rName, sal_Int32 nRk );
1409*cdf0e10cSrcweir     void                writeColorABGRItem( const String& rName, sal_Int32 nColor );
1410*cdf0e10cSrcweir     void                writeDateTimeItem( const String& rName, const ::com::sun::star::util::DateTime& rDateTime );
1411*cdf0e10cSrcweir     void                writeGuidItem( const String& rName, const ::rtl::OUString& rGuid );
1412*cdf0e10cSrcweir     void                writeColIndexItem( const String& rName, sal_Int32 nCol );
1413*cdf0e10cSrcweir     void                writeRowIndexItem( const String& rName, sal_Int32 nRow );
1414*cdf0e10cSrcweir     void                writeColRangeItem( const String& rName, sal_Int32 nCol1, sal_Int32 nCol2 );
1415*cdf0e10cSrcweir     void                writeRowRangeItem( const String& rName, sal_Int32 nRow1, sal_Int32 nRow2 );
1416*cdf0e10cSrcweir     void                writeAddressItem( const String& rName, const Address& rPos );
1417*cdf0e10cSrcweir     void                writeRangeItem( const String& rName, const Range& rRange );
1418*cdf0e10cSrcweir     void                writeRangeListItem( const String& rName, const RangeList& rRanges );
1419*cdf0e10cSrcweir     void                writeTokenAddressItem( const String& rName, const TokenAddress& rPos, bool bNameMode );
1420*cdf0e10cSrcweir     void                writeTokenAddress3dItem( const String& rName, const ::rtl::OUString& rRef, const TokenAddress& rPos, bool bNameMode );
1421*cdf0e10cSrcweir     void                writeTokenRangeItem( const String& rName, const TokenRange& rRange, bool bNameMode );
1422*cdf0e10cSrcweir     void                writeTokenRange3dItem( const String& rName, const ::rtl::OUString& rRef, const TokenRange& rRange, bool bNameMode );
1423*cdf0e10cSrcweir 
1424*cdf0e10cSrcweir     template< typename Type >
1425*cdf0e10cSrcweir     void                addNameToItem( Type nData, const NameListWrapper& rListWrp );
1426*cdf0e10cSrcweir 
1427*cdf0e10cSrcweir     template< typename Type >
1428*cdf0e10cSrcweir     void                writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp );
1429*cdf0e10cSrcweir     template< typename Type >
1430*cdf0e10cSrcweir     void                writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1431*cdf0e10cSrcweir     template< typename Type >
1432*cdf0e10cSrcweir     void                writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1433*cdf0e10cSrcweir     template< typename Type >
1434*cdf0e10cSrcweir     void                writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1435*cdf0e10cSrcweir     template< typename Type >
1436*cdf0e10cSrcweir     void                writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1437*cdf0e10cSrcweir     template< typename Type >
1438*cdf0e10cSrcweir     void                writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1439*cdf0e10cSrcweir     template< typename Type >
1440*cdf0e10cSrcweir     void                writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
1441*cdf0e10cSrcweir     template< typename Type >
1442*cdf0e10cSrcweir     void                writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp = NO_LIST );
1443*cdf0e10cSrcweir 
1444*cdf0e10cSrcweir     template< typename Type >
1445*cdf0e10cSrcweir     void                writeValueItem( const ItemFormat& rItemFmt, Type nData );
1446*cdf0e10cSrcweir 
1447*cdf0e10cSrcweir     template< typename Type >
1448*cdf0e10cSrcweir     void                writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
1449*cdf0e10cSrcweir     template< typename Type >
1450*cdf0e10cSrcweir     void                writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
1451*cdf0e10cSrcweir 
1452*cdf0e10cSrcweir protected:
1453*cdf0e10cSrcweir     OutputRef           mxOut;
1454*cdf0e10cSrcweir     ::rtl::OUString     maSysFileName;
1455*cdf0e10cSrcweir };
1456*cdf0e10cSrcweir 
1457*cdf0e10cSrcweir typedef ::boost::shared_ptr< OutputObjectBase > OutputObjectRef;
1458*cdf0e10cSrcweir 
1459*cdf0e10cSrcweir // ----------------------------------------------------------------------------
1460*cdf0e10cSrcweir 
1461*cdf0e10cSrcweir template< typename Type >
1462*cdf0e10cSrcweir void OutputObjectBase::addNameToItem( Type nData, const NameListWrapper& rListWrp )
1463*cdf0e10cSrcweir {
1464*cdf0e10cSrcweir     if( !rListWrp.isEmpty() )
1465*cdf0e10cSrcweir     {
1466*cdf0e10cSrcweir         mxOut->contItem();
1467*cdf0e10cSrcweir         mxOut->writeName( cfg(), nData, rListWrp );
1468*cdf0e10cSrcweir     }
1469*cdf0e10cSrcweir }
1470*cdf0e10cSrcweir 
1471*cdf0e10cSrcweir template< typename Type >
1472*cdf0e10cSrcweir void OutputObjectBase::writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1473*cdf0e10cSrcweir {
1474*cdf0e10cSrcweir     ItemGuard aItem( mxOut, rName );
1475*cdf0e10cSrcweir     mxOut->writeName( cfg(), nData, rListWrp );
1476*cdf0e10cSrcweir }
1477*cdf0e10cSrcweir 
1478*cdf0e10cSrcweir template< typename Type >
1479*cdf0e10cSrcweir void OutputObjectBase::writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1480*cdf0e10cSrcweir {
1481*cdf0e10cSrcweir     ItemGuard aItem( mxOut, rName );
1482*cdf0e10cSrcweir     mxOut->writeDec( nData );
1483*cdf0e10cSrcweir     addNameToItem( nData, rListWrp );
1484*cdf0e10cSrcweir }
1485*cdf0e10cSrcweir 
1486*cdf0e10cSrcweir template< typename Type >
1487*cdf0e10cSrcweir void OutputObjectBase::writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1488*cdf0e10cSrcweir {
1489*cdf0e10cSrcweir     ItemGuard aItem( mxOut, rName );
1490*cdf0e10cSrcweir     mxOut->writeHex( nData );
1491*cdf0e10cSrcweir     addNameToItem( nData, rListWrp );
1492*cdf0e10cSrcweir }
1493*cdf0e10cSrcweir 
1494*cdf0e10cSrcweir template< typename Type >
1495*cdf0e10cSrcweir void OutputObjectBase::writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1496*cdf0e10cSrcweir {
1497*cdf0e10cSrcweir     ItemGuard aItem( mxOut, rName );
1498*cdf0e10cSrcweir     mxOut->writeShortHex( nData );
1499*cdf0e10cSrcweir     addNameToItem( nData, rListWrp );
1500*cdf0e10cSrcweir }
1501*cdf0e10cSrcweir 
1502*cdf0e10cSrcweir template< typename Type >
1503*cdf0e10cSrcweir void OutputObjectBase::writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1504*cdf0e10cSrcweir {
1505*cdf0e10cSrcweir     ItemGuard aItem( mxOut, rName );
1506*cdf0e10cSrcweir     mxOut->writeBin( nData );
1507*cdf0e10cSrcweir     addNameToItem( nData, rListWrp );
1508*cdf0e10cSrcweir }
1509*cdf0e10cSrcweir 
1510*cdf0e10cSrcweir template< typename Type >
1511*cdf0e10cSrcweir void OutputObjectBase::writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1512*cdf0e10cSrcweir {
1513*cdf0e10cSrcweir     ItemGuard aItem( mxOut, rName );
1514*cdf0e10cSrcweir     mxOut->writeFix( nData );
1515*cdf0e10cSrcweir     addNameToItem( nData, rListWrp );
1516*cdf0e10cSrcweir }
1517*cdf0e10cSrcweir 
1518*cdf0e10cSrcweir template< typename Type >
1519*cdf0e10cSrcweir void OutputObjectBase::writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
1520*cdf0e10cSrcweir {
1521*cdf0e10cSrcweir     ItemGuard aItem( mxOut, rName );
1522*cdf0e10cSrcweir     mxOut->writeDec( nData );
1523*cdf0e10cSrcweir     aItem.cont();
1524*cdf0e10cSrcweir     mxOut->writeBool( nData != 0 );
1525*cdf0e10cSrcweir     addNameToItem( nData, rListWrp );
1526*cdf0e10cSrcweir }
1527*cdf0e10cSrcweir 
1528*cdf0e10cSrcweir template< typename Type >
1529*cdf0e10cSrcweir void OutputObjectBase::writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp )
1530*cdf0e10cSrcweir {
1531*cdf0e10cSrcweir     if( eFmtType == FORMATTYPE_BOOL )
1532*cdf0e10cSrcweir         writeDecBoolItem( rName, nData, rListWrp );
1533*cdf0e10cSrcweir     else
1534*cdf0e10cSrcweir     {
1535*cdf0e10cSrcweir         ItemGuard aItem( mxOut, rName );
1536*cdf0e10cSrcweir         mxOut->writeValue( nData, eFmtType );
1537*cdf0e10cSrcweir         addNameToItem( nData, rListWrp );
1538*cdf0e10cSrcweir     }
1539*cdf0e10cSrcweir }
1540*cdf0e10cSrcweir 
1541*cdf0e10cSrcweir template< typename Type >
1542*cdf0e10cSrcweir void OutputObjectBase::writeValueItem( const ItemFormat& rItemFmt, Type nData )
1543*cdf0e10cSrcweir {
1544*cdf0e10cSrcweir     ::rtl::OString aNameUtf8 = StringHelper::convertToUtf8( rItemFmt.maItemName );
1545*cdf0e10cSrcweir     writeValueItem( aNameUtf8.getStr(), nData, rItemFmt.meFmtType, rItemFmt.maListName );
1546*cdf0e10cSrcweir }
1547*cdf0e10cSrcweir 
1548*cdf0e10cSrcweir template< typename Type >
1549*cdf0e10cSrcweir void OutputObjectBase::writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
1550*cdf0e10cSrcweir {
1551*cdf0e10cSrcweir     ItemGuard aItem( mxOut, rName );
1552*cdf0e10cSrcweir     mxOut->writeDec( nData1 );
1553*cdf0e10cSrcweir     mxOut->writeChar( cSep );
1554*cdf0e10cSrcweir     mxOut->writeDec( nData2 );
1555*cdf0e10cSrcweir }
1556*cdf0e10cSrcweir 
1557*cdf0e10cSrcweir template< typename Type >
1558*cdf0e10cSrcweir void OutputObjectBase::writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
1559*cdf0e10cSrcweir {
1560*cdf0e10cSrcweir     ItemGuard aItem( mxOut, rName );
1561*cdf0e10cSrcweir     mxOut->writeHex( nData1 );
1562*cdf0e10cSrcweir     mxOut->writeChar( cSep );
1563*cdf0e10cSrcweir     mxOut->writeHex( nData2 );
1564*cdf0e10cSrcweir }
1565*cdf0e10cSrcweir 
1566*cdf0e10cSrcweir // ============================================================================
1567*cdf0e10cSrcweir // ============================================================================
1568*cdf0e10cSrcweir 
1569*cdf0e10cSrcweir class InputObjectBase : public OutputObjectBase
1570*cdf0e10cSrcweir {
1571*cdf0e10cSrcweir public:
1572*cdf0e10cSrcweir     virtual             ~InputObjectBase();
1573*cdf0e10cSrcweir 
1574*cdf0e10cSrcweir     // ------------------------------------------------------------------------
1575*cdf0e10cSrcweir protected:
1576*cdf0e10cSrcweir     inline explicit     InputObjectBase() {}
1577*cdf0e10cSrcweir 
1578*cdf0e10cSrcweir     using               OutputObjectBase::construct;
1579*cdf0e10cSrcweir     void                construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
1580*cdf0e10cSrcweir     void                construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm );
1581*cdf0e10cSrcweir     void                construct( const InputObjectBase& rParent );
1582*cdf0e10cSrcweir 
1583*cdf0e10cSrcweir     virtual bool        implIsValid() const;
1584*cdf0e10cSrcweir 
1585*cdf0e10cSrcweir     // ------------------------------------------------------------------------
1586*cdf0e10cSrcweir 
1587*cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
1588*cdf0e10cSrcweir                         getXInputStream() const;
1589*cdf0e10cSrcweir 
1590*cdf0e10cSrcweir     // ------------------------------------------------------------------------
1591*cdf0e10cSrcweir 
1592*cdf0e10cSrcweir     void                skipBlock( sal_Int64 nBytes, bool bShowSize = true );
1593*cdf0e10cSrcweir     void                dumpRawBinary( sal_Int64 nBytes, bool bShowOffset = true, bool bStream = false );
1594*cdf0e10cSrcweir 
1595*cdf0e10cSrcweir     void                dumpBinary( const String& rName, sal_Int64 nBytes, bool bShowOffset = true );
1596*cdf0e10cSrcweir     void                dumpRemaining( sal_Int64 nBytes );
1597*cdf0e10cSrcweir     void                dumpRemainingTo( sal_Int64 nPos );
1598*cdf0e10cSrcweir     void                dumpRemainingStream();
1599*cdf0e10cSrcweir 
1600*cdf0e10cSrcweir     void                dumpArray( const String& rName, sal_Int32 nBytes, sal_Unicode cSep = OOX_DUMP_LISTSEP );
1601*cdf0e10cSrcweir     inline void         dumpUnused( sal_Int32 nBytes ) { dumpArray( OOX_DUMP_UNUSED, nBytes ); }
1602*cdf0e10cSrcweir     inline void         dumpUnknown( sal_Int32 nBytes ) { dumpArray( OOX_DUMP_UNKNOWN, nBytes ); }
1603*cdf0e10cSrcweir 
1604*cdf0e10cSrcweir     sal_Unicode         dumpChar( const String& rName, rtl_TextEncoding eTextEnc );
1605*cdf0e10cSrcweir     sal_Unicode         dumpUnicode( const String& rName );
1606*cdf0e10cSrcweir 
1607*cdf0e10cSrcweir     ::rtl::OUString     dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul = false );
1608*cdf0e10cSrcweir     ::rtl::OUString     dumpUnicodeArray( const String& rName, sal_Int32 nLen, bool bHideTrailingNul = false );
1609*cdf0e10cSrcweir 
1610*cdf0e10cSrcweir     ::rtl::OUString     dumpNullCharArray( const String& rName, rtl_TextEncoding eTextEnc );
1611*cdf0e10cSrcweir     ::rtl::OUString     dumpNullUnicodeArray( const String& rName );
1612*cdf0e10cSrcweir 
1613*cdf0e10cSrcweir     double              dumpRk( const String& rName = EMPTY_STRING );
1614*cdf0e10cSrcweir     sal_Int32           dumpColorABGR( const String& rName = EMPTY_STRING );
1615*cdf0e10cSrcweir     ::com::sun::star::util::DateTime dumpFileTime( const String& rName = EMPTY_STRING );
1616*cdf0e10cSrcweir     ::rtl::OUString     dumpGuid( const String& rName = EMPTY_STRING );
1617*cdf0e10cSrcweir 
1618*cdf0e10cSrcweir     void                dumpItem( const ItemFormat& rItemFmt );
1619*cdf0e10cSrcweir 
1620*cdf0e10cSrcweir     template< typename Type >
1621*cdf0e10cSrcweir     Type                dumpName( const String& rName, const NameListWrapper& rListWrp );
1622*cdf0e10cSrcweir     template< typename Type >
1623*cdf0e10cSrcweir     Type                dumpDec( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1624*cdf0e10cSrcweir     template< typename Type >
1625*cdf0e10cSrcweir     Type                dumpHex( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1626*cdf0e10cSrcweir     template< typename Type >
1627*cdf0e10cSrcweir     Type                dumpBin( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1628*cdf0e10cSrcweir     template< typename Type >
1629*cdf0e10cSrcweir     Type                dumpFix( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1630*cdf0e10cSrcweir     template< typename Type >
1631*cdf0e10cSrcweir     Type                dumpBool( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1632*cdf0e10cSrcweir     template< typename Type >
1633*cdf0e10cSrcweir     Type                dumpValue( const ItemFormat& rItemFmt );
1634*cdf0e10cSrcweir 
1635*cdf0e10cSrcweir     template< typename Type1, typename Type2 >
1636*cdf0e10cSrcweir     Type1               dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1637*cdf0e10cSrcweir     template< typename Type1, typename Type2 >
1638*cdf0e10cSrcweir     Type1               dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1639*cdf0e10cSrcweir     template< typename Type1, typename Type2 >
1640*cdf0e10cSrcweir     Type1               dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1641*cdf0e10cSrcweir     template< typename Type1, typename Type2 >
1642*cdf0e10cSrcweir     Type1               dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1643*cdf0e10cSrcweir     template< typename Type1, typename Type2 >
1644*cdf0e10cSrcweir     Type1               dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1645*cdf0e10cSrcweir     template< typename Type1, typename Type2 >
1646*cdf0e10cSrcweir     Type1               dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
1647*cdf0e10cSrcweir     template< typename Type1, typename Type2 >
1648*cdf0e10cSrcweir     Type1               dumpValue( bool bType1, const ItemFormat& rItemFmt );
1649*cdf0e10cSrcweir 
1650*cdf0e10cSrcweir     template< typename Type >
1651*cdf0e10cSrcweir     void                dumpDecPair( const String& rName, sal_Unicode cSep = ',' );
1652*cdf0e10cSrcweir     template< typename Type >
1653*cdf0e10cSrcweir     void                dumpHexPair( const String& rName, sal_Unicode cSep = ',' );
1654*cdf0e10cSrcweir 
1655*cdf0e10cSrcweir protected:
1656*cdf0e10cSrcweir     BinaryInputStreamRef mxStrm;
1657*cdf0e10cSrcweir };
1658*cdf0e10cSrcweir 
1659*cdf0e10cSrcweir typedef ::boost::shared_ptr< InputObjectBase > InputObjectRef;
1660*cdf0e10cSrcweir 
1661*cdf0e10cSrcweir // ----------------------------------------------------------------------------
1662*cdf0e10cSrcweir 
1663*cdf0e10cSrcweir template< typename Type >
1664*cdf0e10cSrcweir Type InputObjectBase::dumpName( const String& rName, const NameListWrapper& rListWrp )
1665*cdf0e10cSrcweir {
1666*cdf0e10cSrcweir     Type nData;
1667*cdf0e10cSrcweir     *mxStrm >> nData;
1668*cdf0e10cSrcweir     writeNameItem( rName, nData, rListWrp );
1669*cdf0e10cSrcweir     return nData;
1670*cdf0e10cSrcweir }
1671*cdf0e10cSrcweir 
1672*cdf0e10cSrcweir template< typename Type >
1673*cdf0e10cSrcweir Type InputObjectBase::dumpDec( const String& rName, const NameListWrapper& rListWrp )
1674*cdf0e10cSrcweir {
1675*cdf0e10cSrcweir     Type nData;
1676*cdf0e10cSrcweir     *mxStrm >> nData;
1677*cdf0e10cSrcweir     writeDecItem( rName, nData, rListWrp );
1678*cdf0e10cSrcweir     return nData;
1679*cdf0e10cSrcweir }
1680*cdf0e10cSrcweir 
1681*cdf0e10cSrcweir template< typename Type >
1682*cdf0e10cSrcweir Type InputObjectBase::dumpHex( const String& rName, const NameListWrapper& rListWrp )
1683*cdf0e10cSrcweir {
1684*cdf0e10cSrcweir     Type nData;
1685*cdf0e10cSrcweir     *mxStrm >> nData;
1686*cdf0e10cSrcweir     writeHexItem( rName, nData, rListWrp );
1687*cdf0e10cSrcweir     return nData;
1688*cdf0e10cSrcweir }
1689*cdf0e10cSrcweir 
1690*cdf0e10cSrcweir template< typename Type >
1691*cdf0e10cSrcweir Type InputObjectBase::dumpBin( const String& rName, const NameListWrapper& rListWrp )
1692*cdf0e10cSrcweir {
1693*cdf0e10cSrcweir     Type nData;
1694*cdf0e10cSrcweir     *mxStrm >> nData;
1695*cdf0e10cSrcweir     writeBinItem( rName, nData, rListWrp );
1696*cdf0e10cSrcweir     return nData;
1697*cdf0e10cSrcweir }
1698*cdf0e10cSrcweir 
1699*cdf0e10cSrcweir template< typename Type >
1700*cdf0e10cSrcweir Type InputObjectBase::dumpFix( const String& rName, const NameListWrapper& rListWrp )
1701*cdf0e10cSrcweir {
1702*cdf0e10cSrcweir     Type nData;
1703*cdf0e10cSrcweir     *mxStrm >> nData;
1704*cdf0e10cSrcweir     writeFixItem( rName, nData, rListWrp );
1705*cdf0e10cSrcweir     return nData;
1706*cdf0e10cSrcweir }
1707*cdf0e10cSrcweir 
1708*cdf0e10cSrcweir template< typename Type >
1709*cdf0e10cSrcweir Type InputObjectBase::dumpBool( const String& rName, const NameListWrapper& rListWrp )
1710*cdf0e10cSrcweir {
1711*cdf0e10cSrcweir     Type nData;
1712*cdf0e10cSrcweir     *mxStrm >> nData;
1713*cdf0e10cSrcweir     writeDecBoolItem( rName, nData, rListWrp );
1714*cdf0e10cSrcweir     return nData;
1715*cdf0e10cSrcweir }
1716*cdf0e10cSrcweir 
1717*cdf0e10cSrcweir template< typename Type >
1718*cdf0e10cSrcweir Type InputObjectBase::dumpValue( const ItemFormat& rItemFmt )
1719*cdf0e10cSrcweir {
1720*cdf0e10cSrcweir     Type nData;
1721*cdf0e10cSrcweir     *mxStrm >> nData;
1722*cdf0e10cSrcweir     writeValueItem( rItemFmt, nData );
1723*cdf0e10cSrcweir     return nData;
1724*cdf0e10cSrcweir }
1725*cdf0e10cSrcweir 
1726*cdf0e10cSrcweir template< typename Type1, typename Type2 >
1727*cdf0e10cSrcweir Type1 InputObjectBase::dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1728*cdf0e10cSrcweir {
1729*cdf0e10cSrcweir     return bType1 ? dumpName< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpName< Type2 >( rName, rListWrp ) );
1730*cdf0e10cSrcweir }
1731*cdf0e10cSrcweir 
1732*cdf0e10cSrcweir template< typename Type1, typename Type2 >
1733*cdf0e10cSrcweir Type1 InputObjectBase::dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1734*cdf0e10cSrcweir {
1735*cdf0e10cSrcweir     return bType1 ? dumpDec< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpDec< Type2 >( rName, rListWrp ) );
1736*cdf0e10cSrcweir }
1737*cdf0e10cSrcweir 
1738*cdf0e10cSrcweir template< typename Type1, typename Type2 >
1739*cdf0e10cSrcweir Type1 InputObjectBase::dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1740*cdf0e10cSrcweir {
1741*cdf0e10cSrcweir     return bType1 ? dumpHex< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpHex< Type2 >( rName, rListWrp ) );
1742*cdf0e10cSrcweir }
1743*cdf0e10cSrcweir 
1744*cdf0e10cSrcweir template< typename Type1, typename Type2 >
1745*cdf0e10cSrcweir Type1 InputObjectBase::dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1746*cdf0e10cSrcweir {
1747*cdf0e10cSrcweir     return bType1 ? dumpBin< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBin< Type2 >( rName, rListWrp ) );
1748*cdf0e10cSrcweir }
1749*cdf0e10cSrcweir 
1750*cdf0e10cSrcweir template< typename Type1, typename Type2 >
1751*cdf0e10cSrcweir Type1 InputObjectBase::dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1752*cdf0e10cSrcweir {
1753*cdf0e10cSrcweir     return bType1 ? dumpFix< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpFix< Type2 >( rName, rListWrp ) );
1754*cdf0e10cSrcweir }
1755*cdf0e10cSrcweir 
1756*cdf0e10cSrcweir template< typename Type1, typename Type2 >
1757*cdf0e10cSrcweir Type1 InputObjectBase::dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp )
1758*cdf0e10cSrcweir {
1759*cdf0e10cSrcweir     return bType1 ? dumpBool< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBool< Type2 >( rName, rListWrp ) );
1760*cdf0e10cSrcweir }
1761*cdf0e10cSrcweir 
1762*cdf0e10cSrcweir template< typename Type1, typename Type2 >
1763*cdf0e10cSrcweir Type1 InputObjectBase::dumpValue( bool bType1, const ItemFormat& rItemFmt )
1764*cdf0e10cSrcweir {
1765*cdf0e10cSrcweir     return bType1 ? dumpValue< Type1 >( rItemFmt ) : static_cast< Type1 >( dumpValue< Type2 >( rItemFmt ) );
1766*cdf0e10cSrcweir }
1767*cdf0e10cSrcweir 
1768*cdf0e10cSrcweir template< typename Type >
1769*cdf0e10cSrcweir void InputObjectBase::dumpDecPair( const String& rName, sal_Unicode cSep )
1770*cdf0e10cSrcweir {
1771*cdf0e10cSrcweir     Type nData1, nData2;
1772*cdf0e10cSrcweir     *mxStrm >> nData1 >> nData2;
1773*cdf0e10cSrcweir     writeDecPairItem( rName, nData1, nData2, cSep );
1774*cdf0e10cSrcweir }
1775*cdf0e10cSrcweir 
1776*cdf0e10cSrcweir template< typename Type >
1777*cdf0e10cSrcweir void InputObjectBase::dumpHexPair( const String& rName, sal_Unicode cSep )
1778*cdf0e10cSrcweir {
1779*cdf0e10cSrcweir     Type nData1, nData2;
1780*cdf0e10cSrcweir     *mxStrm >> nData1 >> nData2;
1781*cdf0e10cSrcweir     writeHexPairItem( rName, nData1, nData2, cSep );
1782*cdf0e10cSrcweir }
1783*cdf0e10cSrcweir 
1784*cdf0e10cSrcweir // ============================================================================
1785*cdf0e10cSrcweir // ============================================================================
1786*cdf0e10cSrcweir 
1787*cdf0e10cSrcweir class BinaryStreamObject : public InputObjectBase
1788*cdf0e10cSrcweir {
1789*cdf0e10cSrcweir public:
1790*cdf0e10cSrcweir     explicit            BinaryStreamObject(
1791*cdf0e10cSrcweir                             const ObjectBase& rParent,
1792*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxStrm,
1793*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName );
1794*cdf0e10cSrcweir 
1795*cdf0e10cSrcweir     explicit            BinaryStreamObject(
1796*cdf0e10cSrcweir                             const OutputObjectBase& rParent,
1797*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxStrm );
1798*cdf0e10cSrcweir 
1799*cdf0e10cSrcweir protected:
1800*cdf0e10cSrcweir     void                dumpBinaryStream( bool bShowOffset = true );
1801*cdf0e10cSrcweir 
1802*cdf0e10cSrcweir     virtual void        implDump();
1803*cdf0e10cSrcweir };
1804*cdf0e10cSrcweir 
1805*cdf0e10cSrcweir // ============================================================================
1806*cdf0e10cSrcweir // ============================================================================
1807*cdf0e10cSrcweir 
1808*cdf0e10cSrcweir class TextStreamObjectBase : public InputObjectBase
1809*cdf0e10cSrcweir {
1810*cdf0e10cSrcweir protected:
1811*cdf0e10cSrcweir     inline              TextStreamObjectBase() {}
1812*cdf0e10cSrcweir 
1813*cdf0e10cSrcweir     using               InputObjectBase::construct;
1814*cdf0e10cSrcweir     void                construct(
1815*cdf0e10cSrcweir                             const ObjectBase& rParent,
1816*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxStrm,
1817*cdf0e10cSrcweir                             rtl_TextEncoding eTextEnc,
1818*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName );
1819*cdf0e10cSrcweir     void                construct(
1820*cdf0e10cSrcweir                             const OutputObjectBase& rParent,
1821*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxStrm,
1822*cdf0e10cSrcweir                             rtl_TextEncoding eTextEnc );
1823*cdf0e10cSrcweir     void                construct(
1824*cdf0e10cSrcweir                             const InputObjectBase& rParent,
1825*cdf0e10cSrcweir                             rtl_TextEncoding eTextEnc );
1826*cdf0e10cSrcweir 
1827*cdf0e10cSrcweir     virtual bool        implIsValid() const;
1828*cdf0e10cSrcweir     virtual void        implDump();
1829*cdf0e10cSrcweir 
1830*cdf0e10cSrcweir     virtual void        implDumpText( TextInputStream& rTextStrm ) = 0;
1831*cdf0e10cSrcweir 
1832*cdf0e10cSrcweir private:
1833*cdf0e10cSrcweir     void                constructTextStrmObj( rtl_TextEncoding eTextEnc );
1834*cdf0e10cSrcweir 
1835*cdf0e10cSrcweir protected:
1836*cdf0e10cSrcweir     ::boost::shared_ptr< TextInputStream > mxTextStrm;
1837*cdf0e10cSrcweir };
1838*cdf0e10cSrcweir 
1839*cdf0e10cSrcweir // ============================================================================
1840*cdf0e10cSrcweir 
1841*cdf0e10cSrcweir class TextLineStreamObject : public TextStreamObjectBase
1842*cdf0e10cSrcweir {
1843*cdf0e10cSrcweir public:
1844*cdf0e10cSrcweir     explicit            TextLineStreamObject(
1845*cdf0e10cSrcweir                             const ObjectBase& rParent,
1846*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxStrm,
1847*cdf0e10cSrcweir                             rtl_TextEncoding eTextEnc,
1848*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName );
1849*cdf0e10cSrcweir 
1850*cdf0e10cSrcweir     explicit            TextLineStreamObject(
1851*cdf0e10cSrcweir                             const OutputObjectBase& rParent,
1852*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxStrm,
1853*cdf0e10cSrcweir                             rtl_TextEncoding eTextEnc );
1854*cdf0e10cSrcweir 
1855*cdf0e10cSrcweir protected:
1856*cdf0e10cSrcweir     virtual void        implDumpText( TextInputStream& rTextStrm );
1857*cdf0e10cSrcweir     virtual void        implDumpLine( const ::rtl::OUString& rLine, sal_uInt32 nLine );
1858*cdf0e10cSrcweir };
1859*cdf0e10cSrcweir 
1860*cdf0e10cSrcweir // ============================================================================
1861*cdf0e10cSrcweir 
1862*cdf0e10cSrcweir class XmlStreamObject : public TextStreamObjectBase
1863*cdf0e10cSrcweir {
1864*cdf0e10cSrcweir public:
1865*cdf0e10cSrcweir     explicit            XmlStreamObject(
1866*cdf0e10cSrcweir                             const ObjectBase& rParent,
1867*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxStrm,
1868*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName );
1869*cdf0e10cSrcweir 
1870*cdf0e10cSrcweir     explicit            XmlStreamObject(
1871*cdf0e10cSrcweir                             const OutputObjectBase& rParent,
1872*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxStrm );
1873*cdf0e10cSrcweir 
1874*cdf0e10cSrcweir protected:
1875*cdf0e10cSrcweir     virtual void        implDumpText( TextInputStream& rTextStrm );
1876*cdf0e10cSrcweir };
1877*cdf0e10cSrcweir 
1878*cdf0e10cSrcweir // ============================================================================
1879*cdf0e10cSrcweir // ============================================================================
1880*cdf0e10cSrcweir 
1881*cdf0e10cSrcweir class RecordObjectBase : public InputObjectBase
1882*cdf0e10cSrcweir {
1883*cdf0e10cSrcweir protected:
1884*cdf0e10cSrcweir     inline explicit     RecordObjectBase() {}
1885*cdf0e10cSrcweir 
1886*cdf0e10cSrcweir     using               InputObjectBase::construct;
1887*cdf0e10cSrcweir     void                construct(
1888*cdf0e10cSrcweir                             const ObjectBase& rParent,
1889*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxBaseStrm,
1890*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName,
1891*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxRecStrm,
1892*cdf0e10cSrcweir                             const String& rRecNames,
1893*cdf0e10cSrcweir                             const String& rSimpleRecs = EMPTY_STRING );
1894*cdf0e10cSrcweir     void                construct(
1895*cdf0e10cSrcweir                             const OutputObjectBase& rParent,
1896*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxBaseStrm,
1897*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxRecStrm,
1898*cdf0e10cSrcweir                             const String& rRecNames,
1899*cdf0e10cSrcweir                             const String& rSimpleRecs = EMPTY_STRING );
1900*cdf0e10cSrcweir 
1901*cdf0e10cSrcweir     inline sal_Int64    getRecPos() const { return mnRecPos; }
1902*cdf0e10cSrcweir     inline sal_Int64    getRecId() const { return mnRecId; }
1903*cdf0e10cSrcweir     inline sal_Int64    getRecSize() const { return mnRecSize; }
1904*cdf0e10cSrcweir     inline NameListRef  getRecNames() const { return maRecNames.getNameList( cfg() ); }
1905*cdf0e10cSrcweir 
1906*cdf0e10cSrcweir     inline void         setBinaryOnlyMode( bool bBinaryOnly ) { mbBinaryOnly = bBinaryOnly; }
1907*cdf0e10cSrcweir     inline bool         isBinaryOnlyMode() const { return mbBinaryOnly; }
1908*cdf0e10cSrcweir 
1909*cdf0e10cSrcweir     virtual bool        implIsValid() const;
1910*cdf0e10cSrcweir     virtual void        implDump();
1911*cdf0e10cSrcweir 
1912*cdf0e10cSrcweir     virtual bool        implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
1913*cdf0e10cSrcweir     virtual void        implWriteExtHeader();
1914*cdf0e10cSrcweir     virtual void        implDumpRecordBody();
1915*cdf0e10cSrcweir 
1916*cdf0e10cSrcweir private:
1917*cdf0e10cSrcweir     void                constructRecObjBase(
1918*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxBaseStrm,
1919*cdf0e10cSrcweir                             const String& rRecNames,
1920*cdf0e10cSrcweir                             const String& rSimpleRecs );
1921*cdf0e10cSrcweir 
1922*cdf0e10cSrcweir     void                writeHeader();
1923*cdf0e10cSrcweir 
1924*cdf0e10cSrcweir private:
1925*cdf0e10cSrcweir     BinaryInputStreamRef mxBaseStrm;
1926*cdf0e10cSrcweir     NameListWrapper     maRecNames;
1927*cdf0e10cSrcweir     NameListWrapper     maSimpleRecs;
1928*cdf0e10cSrcweir     sal_Int64           mnRecPos;
1929*cdf0e10cSrcweir     sal_Int64           mnRecId;
1930*cdf0e10cSrcweir     sal_Int64           mnRecSize;
1931*cdf0e10cSrcweir     bool                mbShowRecPos;
1932*cdf0e10cSrcweir     bool                mbBinaryOnly;
1933*cdf0e10cSrcweir };
1934*cdf0e10cSrcweir 
1935*cdf0e10cSrcweir // ============================================================================
1936*cdf0e10cSrcweir 
1937*cdf0e10cSrcweir class SequenceRecordObjectBase : public RecordObjectBase
1938*cdf0e10cSrcweir {
1939*cdf0e10cSrcweir protected:
1940*cdf0e10cSrcweir     inline explicit     SequenceRecordObjectBase() : mxRecData( new StreamDataSequence ) {}
1941*cdf0e10cSrcweir 
1942*cdf0e10cSrcweir     inline StreamDataSequence& getRecordDataSequence() { return *mxRecData; }
1943*cdf0e10cSrcweir 
1944*cdf0e10cSrcweir     using               RecordObjectBase::construct;
1945*cdf0e10cSrcweir     void                construct(
1946*cdf0e10cSrcweir                             const ObjectBase& rParent,
1947*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxBaseStrm,
1948*cdf0e10cSrcweir                             const ::rtl::OUString& rSysFileName,
1949*cdf0e10cSrcweir                             const String& rRecNames,
1950*cdf0e10cSrcweir                             const String& rSimpleRecs = EMPTY_STRING );
1951*cdf0e10cSrcweir     void                construct(
1952*cdf0e10cSrcweir                             const OutputObjectBase& rParent,
1953*cdf0e10cSrcweir                             const BinaryInputStreamRef& rxBaseStrm,
1954*cdf0e10cSrcweir                             const String& rRecNames,
1955*cdf0e10cSrcweir                             const String& rSimpleRecs = EMPTY_STRING );
1956*cdf0e10cSrcweir 
1957*cdf0e10cSrcweir     virtual bool        implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize );
1958*cdf0e10cSrcweir     virtual bool        implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
1959*cdf0e10cSrcweir 
1960*cdf0e10cSrcweir private:
1961*cdf0e10cSrcweir     typedef ::boost::shared_ptr< StreamDataSequence > StreamDataSeqRef;
1962*cdf0e10cSrcweir     StreamDataSeqRef    mxRecData;
1963*cdf0e10cSrcweir };
1964*cdf0e10cSrcweir 
1965*cdf0e10cSrcweir // ============================================================================
1966*cdf0e10cSrcweir // ============================================================================
1967*cdf0e10cSrcweir 
1968*cdf0e10cSrcweir /** Base class for a file dumper. Derived classes implement the implDump()
1969*cdf0e10cSrcweir     function to add functionality.
1970*cdf0e10cSrcweir  */
1971*cdf0e10cSrcweir class DumperBase : public ObjectBase
1972*cdf0e10cSrcweir {
1973*cdf0e10cSrcweir public:
1974*cdf0e10cSrcweir     virtual             ~DumperBase();
1975*cdf0e10cSrcweir 
1976*cdf0e10cSrcweir     bool                isImportEnabled() const;
1977*cdf0e10cSrcweir     bool                isImportCancelled() const;
1978*cdf0e10cSrcweir 
1979*cdf0e10cSrcweir protected:
1980*cdf0e10cSrcweir     inline explicit     DumperBase() {}
1981*cdf0e10cSrcweir 
1982*cdf0e10cSrcweir     using               ObjectBase::construct;
1983*cdf0e10cSrcweir     void                construct( const ConfigRef& rxConfig );
1984*cdf0e10cSrcweir };
1985*cdf0e10cSrcweir 
1986*cdf0e10cSrcweir // ============================================================================
1987*cdf0e10cSrcweir // ============================================================================
1988*cdf0e10cSrcweir 
1989*cdf0e10cSrcweir } // namespace dump
1990*cdf0e10cSrcweir } // namespace oox
1991*cdf0e10cSrcweir 
1992*cdf0e10cSrcweir #define OOX_DUMP_FILE( DumperClassName )            \
1993*cdf0e10cSrcweir do {                                                \
1994*cdf0e10cSrcweir     DumperClassName aDumper( *this );               \
1995*cdf0e10cSrcweir     aDumper.dump();                                 \
1996*cdf0e10cSrcweir     bool bCancelled = aDumper.isImportCancelled();  \
1997*cdf0e10cSrcweir     if( !aDumper.isImportEnabled() || bCancelled )  \
1998*cdf0e10cSrcweir         return aDumper.isValid() && !bCancelled;    \
1999*cdf0e10cSrcweir } while( false )
2000*cdf0e10cSrcweir 
2001*cdf0e10cSrcweir #else   // OOX_INCLUDE_DUMPER
2002*cdf0e10cSrcweir 
2003*cdf0e10cSrcweir #define OOX_DUMP_FILE( DumperClassName ) (void)0
2004*cdf0e10cSrcweir 
2005*cdf0e10cSrcweir #endif  // OOX_INCLUDE_DUMPER
2006*cdf0e10cSrcweir #endif
2007