diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/core/binaryfilterbase.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/binaryfilterbase.hxx
--- oox/inc/oox/core/binaryfilterbase.hxx	2008-04-10 16:12:12.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/binaryfilterbase.hxx	2009-01-06 14:16:56.000000000 +0100
@@ -50,7 +50,7 @@ public:
 private:
     virtual StorageRef  implCreateStorage(
                             ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
-                            ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream ) const;
+                            ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream ) const;
 };
 
 typedef ::rtl::Reference< BinaryFilterBase > BinaryFilterRef;
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/core/fasttokenhandler.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/fasttokenhandler.hxx
--- oox/inc/oox/core/fasttokenhandler.hxx	2008-04-10 16:13:14.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/fasttokenhandler.hxx	2009-01-06 14:16:56.000000000 +0100
@@ -44,6 +44,7 @@ public:
 
     virtual ::sal_Int32 SAL_CALL getToken( const ::rtl::OUString& Identifier ) throw (::com::sun::star::uno::RuntimeException);
     virtual ::rtl::OUString SAL_CALL getIdentifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getUTF8Identifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
     virtual ::sal_Int32 SAL_CALL getTokenFromUTF8( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& Identifier ) throw (::com::sun::star::uno::RuntimeException);
 };
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/core/filterbase.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/filterbase.hxx
--- oox/inc/oox/core/filterbase.hxx	2008-04-18 15:43:24.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/filterbase.hxx	2009-01-06 14:16:56.000000000 +0100
@@ -39,9 +39,11 @@
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XStream.hpp>
 #include <cppuhelper/implbase5.hxx>
 #include "oox/helper/helper.hxx"
 #include "oox/helper/storagebase.hxx"
+#include <oox/dllapi.h>
 
 namespace com { namespace sun { namespace star {
     namespace lang { class XMultiServiceFactory; }
@@ -50,6 +52,7 @@ namespace com { namespace sun { namespac
     namespace task { class XInteractionHandler; }
     namespace io { class XInputStream; }
     namespace io { class XOutputStream; }
+    namespace io { class XStream; }
 } } }
 
 namespace oox {
@@ -59,7 +62,7 @@ namespace core {
 
 struct FilterBaseImpl;
 
-class FilterBase : public ::cppu::WeakImplHelper5<
+class OOX_DLLPUBLIC FilterBase : public ::cppu::WeakImplHelper5<
                             ::com::sun::star::lang::XServiceInfo,
                             ::com::sun::star::lang::XInitialization,
                             ::com::sun::star::document::XImporter,
@@ -85,9 +88,13 @@ public:
 
     // ------------------------------------------------------------------------
 
-    /** Returns the service factory passed in the constructor. */
+    /** Returns the arguments passed through the XInitialisation interface. */
+    const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
+                        getArguments() const;
+
+    /** Returns the global service factory passed in the filter constructor. */
     const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
-                        getServiceFactory() const;
+                        getGlobalFactory() const;
 
     /** Returns the document model. */
     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >&
@@ -144,6 +151,9 @@ public:
     ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
                         openOutputStream( const ::rtl::OUString& rStreamName ) const;
 
+    /** Commits changes to base storage (and substorages) */
+    void commit() { getStorage()->commit(); }
+
     // com.sun.star.lang.XServiceInfo interface -------------------------------
 
     virtual ::rtl::OUString SAL_CALL
@@ -194,7 +204,7 @@ private:
 
     virtual StorageRef  implCreateStorage(
                             ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
-                            ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream ) const = 0;
+                            ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream ) const = 0;
 
 private:
     ::std::auto_ptr< FilterBaseImpl > mxImpl;
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/core/namespaces.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/namespaces.hxx
--- oox/inc/oox/core/namespaces.hxx	2008-07-01 13:31:49.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/namespaces.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -43,23 +43,24 @@ const sal_Int32 NMSP_PACKAGE_RELATIONSHI
 const sal_Int32 NMSP_RELATIONSHIPS          = 3 << 16;
 const sal_Int32 NMSP_CONTENT_TYPES          = 4 << 16;
 // office global
-const sal_Int32 NMSP_OFFICE                 = 11 << 16;
 const sal_Int32 NMSP_ACTIVATION             = 12 << 16;
 // DrawingML
 const sal_Int32 NMSP_DRAWINGML              = 21 << 16;
 const sal_Int32 NMSP_DIAGRAM                = 22 << 16;
 const sal_Int32 NMSP_CHART                  = 23 << 16;
-const sal_Int32 NMSP_VML                    = 24 << 16;
-// WordML
-const sal_Int32 NMSP_WORD                   = 31 << 16; // Word VML
+// VML
+const sal_Int32 NMSP_VML                    = 31 << 16;
+const sal_Int32 NMSP_OFFICE                 = 32 << 16;
+const sal_Int32 NMSP_VML_DOC                = 33 << 16; // Word VML
+const sal_Int32 NMSP_VML_XLS                = 34 << 16; // Excel VML
+const sal_Int32 NMSP_VML_PPT                = 35 << 16; // PowerPoint VML
+const sal_Int32 NMSP_AX                     = 36 << 16; // ActiveX (for OCX form controls)
 // SpreadsheetML
 const sal_Int32 NMSP_XLS                    = 41 << 16;
 const sal_Int32 NMSP_XDR                    = 42 << 16; // SpreadsheetDrawingML
 const sal_Int32 NMSP_XM                     = 43 << 16; // Macro sheet
-const sal_Int32 NMSP_EXCEL                  = 44 << 16; // Excel VML
 // PresentationML
 const sal_Int32 NMSP_PPT                    = 51 << 16;
-const sal_Int32 NMSP_POWERPOINT             = 52 << 16; // PowerPoint VML
 // Document properties
 const sal_Int32 NMSP_COREPR                 = 61 << 16;
 const sal_Int32 NMSP_DC                     = 62 << 16;
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/core/relations.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/relations.hxx
--- oox/inc/oox/core/relations.hxx	2008-04-10 16:15:09.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/relations.hxx	2009-01-06 15:57:48.000000000 +0100
@@ -38,12 +38,16 @@
 namespace oox {
 namespace core {
 
-/** Expands to an OUString containing a relation type created from the passed
-    literal(!) ASCII(!) character array.
- */
+/** Expands to an OUString containing an officeDocument relation type created
+    from the passed literal(!) ASCII(!) character array. */
 #define CREATE_OFFICEDOC_RELATIONSTYPE( ascii ) \
     CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" ascii )
 
+/** Expands to an OUString containing an MS Office specific relation type
+    created from the passed literal(!) ASCII(!) character array. */
+#define CREATE_MSOFFICE_RELATIONSTYPE( ascii ) \
+    CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/relationships/" ascii )
+
 // ============================================================================
 
 struct Relation
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/core/xmlfilterbase.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/xmlfilterbase.hxx
--- oox/inc/oox/core/xmlfilterbase.hxx	2008-07-22 15:05:45.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/core/xmlfilterbase.hxx	2009-01-15 17:26:48.000000000 +0100
@@ -32,10 +32,13 @@
 #define OOX_CORE_XMLFILTERBASE_HXX
 
 #include <rtl/ref.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
 #include "oox/vml/drawing.hxx"
 #include "oox/drawingml/table/tablestylelist.hxx"
 #include "oox/core/filterbase.hxx"
 #include "oox/core/relations.hxx"
+#include <oox/dllapi.h>
 
 namespace com { namespace sun { namespace star {
     namespace container { class XNameContainer; }
@@ -46,6 +49,12 @@ namespace com { namespace sun { namespac
 namespace oox { namespace drawingml { class Theme; } }
 namespace oox { namespace drawingml { namespace chart { class ChartConverter; } } }
 
+namespace sax_fastparser {
+    class FastSerializerHelper;
+
+    typedef boost::shared_ptr< FastSerializerHelper > FSHelperPtr;
+}
+
 namespace oox {
 namespace core {
 
@@ -56,7 +65,7 @@ class ModelObjectContainer;
 
 struct XmlFilterBaseImpl;
 
-class XmlFilterBase : public FilterBase
+class OOX_DLLPUBLIC XmlFilterBase : public FilterBase
 {
 public:
     explicit            XmlFilterBase(
@@ -102,6 +111,33 @@ public:
      */
     RelationsRef        importRelations( const ::rtl::OUString& rFragmentPath );
 
+    /** Adds new relation.
+
+        @param rType
+            Relation type.
+
+        @param rTarget
+            Relation target.
+
+        @return  Added relation Id.
+     */
+    ::rtl::OUString addRelation( const ::rtl::OUString& rType, const ::rtl::OUString& rTarget, const ::rtl::OUString& rTargetMode = ::rtl::OUString() );
+
+    /** Adds new relation to part's relations.
+
+        @param rPartName
+            Part name the relations are related to. The relations will be stored in <rPartName::path>/_rels/<rPartName::name>.rels.
+
+        @param rType
+            Relation type.
+
+        @param rTarget
+            Relation target.
+
+        @return  Added relation Id.
+     */
+    ::rtl::OUString addRelation( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutputStream, const ::rtl::OUString& rType, const ::rtl::OUString& rTarget, const ::rtl::OUString& rTargetMode = ::rtl::OUString() );
+
     /** Copies the picture element specified with rPicturePath from the source
         document to the target models picture substorage.
 
@@ -112,13 +148,59 @@ public:
     /** Returns object containers for various named drawing objects for the imported document. */
     ModelObjectContainer& getModelObjectContainer() const;
 
+    /** Opens and returns the specified output stream from the base storage with specified media type.
+
+        @param rStreamName
+            The name of the embedded storage stream. The name may contain
+            slashes to open streams from embedded substorages. If base stream
+            access has been enabled in the storage, the base stream can be
+            accessed by passing an empty string as stream name.
+
+        @param rMediaType
+            The media type string, used in [Content_Types].xml stream in base storage.
+
+        @return The opened output stream.
+     */
+    ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+                        openOutputStream( const ::rtl::OUString& rStreamName,
+                                          const ::rtl::OUString& rMediaType );
+    using FilterBase::openOutputStream;
+
+    /** Opens specified output stream from the base storage with specified media type and returns new fast serializer for that stream.
+
+        @param rStreamName
+            The name of the embedded storage stream. The name may contain
+            slashes to open streams from embedded substorages. If base stream
+            access has been enabled in the storage, the base stream can be
+            accessed by passing an empty string as stream name.
+
+        @param rMediaType
+            The media type string, used in [Content_Types].xml stream in base storage.
+
+        @return newly created serializer helper.
+     */
+    ::sax_fastparser::FSHelperPtr
+                        openOutputStreamWithSerializer( const ::rtl::OUString& rStreamName,
+                                                        const ::rtl::OUString& rMediaType );
+
+    /** Returns new unique ID for exported document.
+
+        @return newly created ID.
+     */
+    inline sal_Int32 GetUniqueId() { return mnMaxDocId++; }
+    inline ::rtl::OString GetUniqueIdOString() { return ::rtl::OString::valueOf( mnMaxDocId++ ); }
+    inline ::rtl::OUString GetUniqueIdOUString() { return ::rtl::OUString::valueOf( mnMaxDocId++ ); }
+
 private:
     virtual StorageRef  implCreateStorage(
                             ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
-                            ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream ) const;
+                            ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream ) const;
 
 private:
+
     ::std::auto_ptr< XmlFilterBaseImpl > mxImpl;
+    sal_Int32 mnRelId;
+    sal_Int32 mnMaxDocId;
 };
 
 typedef ::rtl::Reference< XmlFilterBase > XmlFilterRef;
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/drawingml/chart/chartconverter.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/drawingml/chart/chartconverter.hxx
--- oox/inc/oox/drawingml/chart/chartconverter.hxx	2008-07-22 15:15:04.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/drawingml/chart/chartconverter.hxx	2009-01-06 14:16:56.000000000 +0100
@@ -33,6 +33,7 @@
 #define OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
 
 #include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
 
 namespace com { namespace sun { namespace star {
     namespace chart2 { class XChartDocument; }
@@ -53,7 +54,7 @@ struct DataSequenceModel;
 
 // ============================================================================
 
-class ChartConverter
+class OOX_DLLPUBLIC ChartConverter
 {
 public:
     explicit            ChartConverter();
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/drawingml/chart/converterbase.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/drawingml/chart/converterbase.hxx
--- oox/inc/oox/drawingml/chart/converterbase.hxx	2008-07-22 15:16:18.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/drawingml/chart/converterbase.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -72,8 +72,8 @@ public:
                             const ::rtl::OUString& rServiceName );
 
     /** Creates an instance for the passed service name, using the process service factory. */
-    static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-                        createInstance( const ::rtl::OUString& rServiceName );
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+                        createInstance( const ::rtl::OUString& rServiceName ) const;
 
 protected:
     /** Returns the filter object of the imported/exported document. */
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/drawingml/shape.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/drawingml/shape.hxx
--- oox/inc/oox/drawingml/shape.hxx	2008-07-22 15:08:44.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/drawingml/shape.hxx	2009-03-19 14:28:41.000000000 +0100
@@ -112,6 +112,7 @@ public:
     void                            setSubType( sal_uInt32 nSubType ) { mnSubType = nSubType; }
     sal_Int32                       getSubType() const { return mnSubType; }
     void                            setIndex( sal_uInt32 nIndex ) { mnIndex = nIndex; }
+    sal_Int32                       getIndex() { return mnIndex; }
 
     // setDefaults has to be called if styles are imported (OfficeXML is not storing properties having the default value)
     void                            setDefaults();
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/drawingml/table/tablestylelist.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/drawingml/table/tablestylelist.hxx
--- oox/inc/oox/drawingml/table/tablestylelist.hxx	2008-06-20 08:48:01.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/drawingml/table/tablestylelist.hxx	2009-01-06 14:16:56.000000000 +0100
@@ -34,11 +34,12 @@
 
 #include <rtl/ustring.hxx>
 #include <boost/shared_ptr.hpp>
-#include "oox/drawingml/table/tablestyle.hxx"
 #include <vector>
 
 namespace oox { namespace drawingml { namespace table {
 
+class TableStyle;
+
 class TableStyleList
 {
 public:
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/drawingml/theme.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/drawingml/theme.hxx
--- oox/inc/oox/drawingml/theme.hxx	2008-07-22 15:13:34.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/drawingml/theme.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -66,28 +66,25 @@ public:
 
     inline FillStyleList&           getFillStyleList() { return maFillStyleList; }
     inline const FillStyleList&     getFillStyleList() const { return maFillStyleList; }
+    inline FillStyleList&           getBgFillStyleList() { return maBgFillStyleList; }
+    inline const FillStyleList&     getBgFillStyleList() const { return maBgFillStyleList; }
     /** Returns the fill properties of the passed one-based themed style index. */
-    inline const FillProperties*    getFillStyle( sal_Int32 nIndex ) const { return maFillStyleList.get( nIndex - 1 ).get(); }
+    const FillProperties*           getFillStyle( sal_Int32 nIndex ) const;
 
     inline LineStyleList&           getLineStyleList() { return maLineStyleList; }
     inline const LineStyleList&     getLineStyleList() const { return maLineStyleList; }
     /** Returns the line properties of the passed one-based themed style index. */
-    inline const LineProperties*    getLineStyle( sal_Int32 nIndex ) const { return maLineStyleList.get( nIndex - 1 ).get(); }
+    const LineProperties*           getLineStyle( sal_Int32 nIndex ) const;
 
     inline EffectStyleList&         getEffectStyleList() { return maEffectStyleList; }
     inline const EffectStyleList&   getEffectStyleList() const { return maEffectStyleList; }
     /** Returns the effect properties of the passed one-based themed style index. */
-    inline const PropertyMap*       getEffectStyle( sal_Int32 nIndex ) const { return maEffectStyleList.get( nIndex - 1 ).get(); }
-
-    inline FillStyleList&           getBgFillStyleList() { return maBgFillStyleList; }
-    inline const FillStyleList&     getBgFillStyleList() const { return maBgFillStyleList; }
-    /** Returns the bg-fill properties of the passed one-based themed style index. */
-    inline const FillProperties*    getBgFillStyle( sal_Int32 nIndex ) const { return maBgFillStyleList.get( nIndex - 1 ).get(); }
+    const PropertyMap*              getEffectStyle( sal_Int32 nIndex ) const;
 
     inline FontScheme&              getFontScheme() { return maFontScheme; }
     inline const FontScheme&        getFontScheme() const { return maFontScheme; }
     /** Returns theme font properties by scheme type (major/minor). */
-    const TextCharacterProperties*  getFontStyle( sal_Int32 nSchemeType ) const { return maFontScheme.get( nSchemeType ).get(); }
+    const TextCharacterProperties*  getFontStyle( sal_Int32 nSchemeType ) const;
     /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */
     const TextFont*                 resolveFont( const ::rtl::OUString& rName ) const;
 
@@ -104,9 +101,9 @@ private:
     ::rtl::OUString     maStyleName;
     ClrScheme           maClrScheme;
     FillStyleList       maFillStyleList;
+    FillStyleList       maBgFillStyleList;
     LineStyleList       maLineStyleList;
     EffectStyleList     maEffectStyleList;
-    FillStyleList       maBgFillStyleList;
     FontScheme          maFontScheme;
     Shape               maSpDef;
     Shape               maLnDef;
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/dump/biffdumper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/biffdumper.hxx
--- oox/inc/oox/dump/biffdumper.hxx	2008-04-10 16:34:54.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/biffdumper.hxx	2008-10-06 16:28:34.000000000 +0200
@@ -33,6 +33,7 @@
 
 #include "oox/dump/dumperbase.hxx"
 #include "oox/dump/dffdumper.hxx"
+#include "oox/dump/oledumper.hxx"
 #include "oox/xls/richstring.hxx"
 
 #if OOX_INCLUDE_DUMPER
@@ -48,6 +49,39 @@ namespace oox {
 namespace dump {
 namespace biff {
 
+typedef ::boost::shared_ptr< ::oox::xls::BiffInputStream > BiffInputStreamRef;
+
+// ============================================================================
+// ============================================================================
+
+class BiffDffStreamObject : public DffStreamObject
+{
+public:
+    explicit            BiffDffStreamObject(
+                            const OutputObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm );
+
+protected:
+    virtual void        implDumpClientAnchor();
+};
+
+// ============================================================================
+
+class BiffCtlsStreamObject : public InputObjectBase
+{
+public:
+    explicit            BiffCtlsStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm );
+
+    void                dumpControl( sal_uInt32 nStartPos, sal_uInt32 nLength );
+
+protected:
+    virtual void        implDump();
+
+private:
+    sal_uInt32          mnStartPos;
+    sal_uInt32          mnLength;
+};
+
 // ============================================================================
 // ============================================================================
 
@@ -64,15 +98,14 @@ private:
     ::oox::xls::BiffType meBiff;
 };
 
-typedef ::boost::shared_ptr< BiffConfig > BiffConfigRef;
-
 // ============================================================================
 
 class BiffSharedData : public Base
 {
 public:
     explicit            BiffSharedData( ::oox::xls::BiffType eBiff );
-    virtual             ~BiffSharedData();
+
+    void                initializePerSheet();
 
     inline ::oox::xls::BiffType getBiff() const { return meBiff; }
 
@@ -100,29 +133,27 @@ private:
     rtl_TextEncoding    meTextEnc;
 };
 
-typedef ::boost::shared_ptr< BiffSharedData > BiffSharedDataRef;
-
 // ============================================================================
 
-class BiffObjectBase : public InputStreamObject
+class BiffObjectBase : public RecordObjectBase
 {
 public:
     inline BiffSharedData& getBiffData() const { return *mxBiffData; }
-    inline ::oox::xls::BiffInputStream& getBiffStream() const { return *mxStrm; }
+    inline ::oox::xls::BiffInputStream& getBiffStream() const { return *mxBiffStrm; }
     inline ::oox::xls::BiffType getBiff() const { return mxBiffData->getBiff(); }
 
 protected:
-    explicit            BiffObjectBase();
+    inline explicit     BiffObjectBase() {}
     virtual             ~BiffObjectBase();
 
-    using               InputStreamObject::construct;
-    void                construct( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, BinaryInputStreamRef xStrm, ::oox::xls::BiffType eBiff );
+    using               InputObjectBase::construct;
+    void                construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, ::oox::xls::BiffType eBiff, const ::rtl::OUString& rSysFileName );
     void                construct( const BiffObjectBase& rParent );
 
     virtual bool        implIsValid() const;
-    virtual ConfigRef   implReconstructConfig();
-    virtual InputRef    implReconstructInput();
+    virtual bool        implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize );
 
+    inline sal_uInt16   getLastRecId() const { return mnLastRecId; }
     ::rtl::OUString     getErrorName( sal_uInt8 nErrCode ) const;
 
     // ------------------------------------------------------------------------
@@ -135,13 +166,13 @@ protected:
 
     // ------------------------------------------------------------------------
 
-    void                writeBooleanItem( const sal_Char* pcName, sal_uInt8 nBool );
-    void                writeErrorCodeItem( const sal_Char* pcName, sal_uInt8 nErrCode );
+    void                writeBooleanItem( const String& rName, sal_uInt8 nBool );
+    void                writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode );
 
     void                writeFontPortions( const ::oox::xls::BinFontPortionList& rPortions );
 
     template< typename Type >
-    void                writeRectItem( const sal_Char* pcName,
+    void                writeRectItem( const String& rName,
                             Type nLeft, Type nTop, Type nWidth, Type nHeight,
                             const NameListWrapper& rListWrp = NO_LIST,
                             FormatType eFmtType = FORMATTYPE_DEC );
@@ -149,66 +180,72 @@ protected:
     // ------------------------------------------------------------------------
 
     ::rtl::OUString     dumpByteString(
-                            const sal_Char* pcName,
+                            const String& rName,
                             ::oox::xls::BiffStringFlags nFlags = ::oox::xls::BIFF_STR_DEFAULT,
                             rtl_TextEncoding eDefaultTextEnc = RTL_TEXTENCODING_DONTKNOW );
     ::rtl::OUString     dumpUniString(
-                            const sal_Char* pcName,
+                            const String& rName,
                             ::oox::xls::BiffStringFlags nFlags = ::oox::xls::BIFF_STR_DEFAULT );
     ::rtl::OUString     dumpString(
-                            const sal_Char* pcName,
+                            const String& rName,
                             ::oox::xls::BiffStringFlags nByteFlags = ::oox::xls::BIFF_STR_DEFAULT,
                             ::oox::xls::BiffStringFlags nUniFlags = ::oox::xls::BIFF_STR_DEFAULT,
                             rtl_TextEncoding eDefaultTextEnc = RTL_TEXTENCODING_DONTKNOW );
 
-    ::rtl::OUString     dumpOleString( const sal_Char* pcName, sal_Int32 nCharCount, bool bUnicode );
-    ::rtl::OUString     dumpOleString( const sal_Char* pcName, bool bUnicode );
-    ::rtl::OUString     dumpNullString( const sal_Char* pcName, bool bUnicode );
-
-    sal_uInt8           dumpBoolean( const sal_Char* pcName = 0 );
-    sal_uInt8           dumpErrorCode( const sal_Char* pcName = 0 );
-
-    sal_Int32           dumpRgbColor( const sal_Char* pcName = 0 );
-    rtl_TextEncoding    dumpCodePage( const sal_Char* pcName = 0 );
-    void                dumpFormulaResult( const sal_Char* pcName = 0 );
-
-    sal_Int32           dumpColIndex( const sal_Char* pcName = 0, bool bCol16Bit = true );
-    sal_Int32           dumpRowIndex( const sal_Char* pcName = 0, bool bRow32Bit = false );
-    sal_Int32           dumpColRange( const sal_Char* pcName = 0, bool bCol16Bit = true );
-    sal_Int32           dumpRowRange( const sal_Char* pcName = 0, bool bRow32Bit = false );
-
-    Address             dumpAddress( const sal_Char* pcName = 0, bool bCol16Bit = true, bool bRow32Bit = false );
-    Range               dumpRange( const sal_Char* pcName = 0, bool bCol16Bit = true, bool bRow32Bit = false );
-    void                dumpRangeList( const sal_Char* pcName = 0, bool bCol16Bit = true, bool bRow32Bit = false );
+    sal_uInt8           dumpBoolean( const String& rName = EMPTY_STRING );
+    sal_uInt8           dumpErrorCode( const String& rName = EMPTY_STRING );
+
+    rtl_TextEncoding    dumpCodePage( const String& rName = EMPTY_STRING );
+    void                dumpFormulaResult( const String& rName = EMPTY_STRING );
+
+    sal_Int32           dumpColIndex( const String& rName = EMPTY_STRING, bool bCol16Bit = true );
+    sal_Int32           dumpRowIndex( const String& rName = EMPTY_STRING, bool bRow32Bit = false );
+    sal_Int32           dumpColRange( const String& rName = EMPTY_STRING, bool bCol16Bit = true );
+    sal_Int32           dumpRowRange( const String& rName = EMPTY_STRING, bool bRow32Bit = false );
+
+    Address             dumpAddress( const String& rName = EMPTY_STRING, bool bCol16Bit = true, bool bRow32Bit = false );
+    Range               dumpRange( const String& rName = EMPTY_STRING, bool bCol16Bit = true, bool bRow32Bit = false );
+    void                dumpRangeList( const String& rName = EMPTY_STRING, bool bCol16Bit = true, bool bRow32Bit = false );
 
     void                dumpConstArrayHeader( sal_uInt32& rnCols, sal_uInt32& rnRows );
     ::rtl::OUString     dumpConstValue( sal_Unicode cStrQuote = OOX_DUMP_STRQUOTE );
 
     template< typename Type >
-    void                dumpRect( const sal_Char* pcName,
+    void                dumpRect( const String& rName,
                             const NameListWrapper& rListWrp = NO_LIST,
                             FormatType eFmtType = FORMATTYPE_DEC );
 
+    sal_uInt16          dumpRepeatedRecId();
+
+    void                dumpDffClientRect();
+    void                dumpEmbeddedDff();
+    void                dumpOcxControl();
+
 private:
-    typedef ::boost::shared_ptr< ::oox::xls::BiffInputStream > BiffInputStreamRef;
+    typedef ::boost::shared_ptr< BiffSharedData >       BiffSharedDataRef;
+    typedef ::boost::shared_ptr< BiffDffStreamObject >  BiffDffStreamObjRef;
+    typedef ::boost::shared_ptr< BiffCtlsStreamObject > BiffCtlsStrmObjRef;
 
-    BiffConfigRef       mxBiffCfg;
     BiffSharedDataRef   mxBiffData;
-    BiffInputStreamRef  mxStrm;
+    BiffInputStreamRef  mxBiffStrm;
+    BiffDffStreamObjRef mxDffObj;
+    BiffCtlsStrmObjRef  mxCtlsObj;
     NameListRef         mxErrCodes;
     NameListRef         mxConstType;
     NameListRef         mxResultType;
+    sal_uInt16          mnLastRecId;
+    bool                mbMergeContRec;
 };
 
 // ----------------------------------------------------------------------------
 
 template< typename Type >
-void BiffObjectBase::writeRectItem( const sal_Char* pcName,
+void BiffObjectBase::writeRectItem( const String& rName,
         Type nLeft, Type nTop, Type nWidth, Type nHeight,
         const NameListWrapper& rListWrp, FormatType eFmtType )
 {
     MultiItemsGuard aMultiGuard( out() );
-    writeEmptyItem( pcName );
+    writeEmptyItem( rName );
     writeValueItem( "x-pos", nLeft, eFmtType, rListWrp );
     writeValueItem( "y-pos", nTop, eFmtType, rListWrp );
     writeValueItem( "x-size", nWidth, eFmtType, rListWrp );
@@ -216,12 +253,12 @@ void BiffObjectBase::writeRectItem( cons
 }
 
 template< typename Type >
-void BiffObjectBase::dumpRect( const sal_Char* pcName,
+void BiffObjectBase::dumpRect( const String& rName,
         const NameListWrapper& rListWrp, FormatType eFmtType )
 {
     Type nLeft, nTop, nWidth, nHeight;
-    *mxStrm >> nLeft >> nTop >> nWidth >> nHeight;
-    writeRectItem( pcName, nLeft, nTop, nWidth, nHeight, rListWrp, eFmtType );
+    *mxBiffStrm >> nLeft >> nTop >> nWidth >> nHeight;
+    writeRectItem( rName, nLeft, nTop, nWidth, nHeight, rListWrp, eFmtType );
 }
 
 // ============================================================================
@@ -234,12 +271,12 @@ public:
     virtual             ~FormulaObject();
 
     sal_uInt16          readFormulaSize();
-    sal_uInt16          dumpFormulaSize( const sal_Char* pcName = 0 );
+    sal_uInt16          dumpFormulaSize( const String& rName = EMPTY_STRING );
 
-    void                dumpCellFormula( const sal_Char* pcName, sal_uInt16 nSize );
-    void                dumpCellFormula( const sal_Char* pcName = 0 );
-    void                dumpNameFormula( const sal_Char* pcName, sal_uInt16 nSize );
-    void                dumpNameFormula( const sal_Char* pcName = 0 );
+    void                dumpCellFormula( const String& rName, sal_uInt16 nSize );
+    void                dumpCellFormula( const String& rName = EMPTY_STRING );
+    void                dumpNameFormula( const String& rName, sal_uInt16 nSize );
+    void                dumpNameFormula( const String& rName = EMPTY_STRING );
 
 protected:
     virtual void        implDump();
@@ -247,8 +284,8 @@ protected:
 private:
     void                constructFmlaObj();
 
-    void                dumpFormula( const sal_Char* pcName, sal_uInt16 nSize, bool bNameMode );
-    void                dumpFormula( const sal_Char* pcName, bool bNameMode );
+    void                dumpFormula( const String& rName, sal_uInt16 nSize, bool bNameMode );
+    void                dumpFormula( const String& rName, bool bNameMode );
 
     TokenAddress        createTokenAddress( sal_uInt16 nCol, sal_uInt16 nRow, bool bRelC, bool bRelR, bool bNameMode ) const;
     ::rtl::OUString     createRef( const ::rtl::OUString& rData ) const;
@@ -259,8 +296,8 @@ private:
     sal_uInt16          readFuncId();
     ::rtl::OUString     writeFuncIdItem( sal_uInt16 nFuncId, const ::oox::xls::FunctionInfo** oppFuncInfo = 0 );
 
-    sal_uInt16          dumpTokenCol( const sal_Char* pcName, bool& rbRelC, bool& rbRelR );
-    sal_uInt16          dumpTokenRow( const sal_Char* pcName, bool& rbRelC, bool& rbRelR );
+    sal_uInt16          dumpTokenCol( const String& rName, bool& rbRelC, bool& rbRelR );
+    sal_uInt16          dumpTokenRow( const String& rName, bool& rbRelC, bool& rbRelR );
     TokenAddress        dumpTokenAddress( bool bNameMode );
     TokenRange          dumpTokenRange( bool bNameMode );
 
@@ -287,9 +324,9 @@ private:
     void                dumpMemFuncToken( const ::rtl::OUString& rTokClass );
     void                dumpMemAreaToken( const ::rtl::OUString& rTokClass, bool bAddData );
 
-    void                dumpExpToken( const StringWrapper& rName );
-    void                dumpUnaryOpToken( const StringWrapper& rLOp, const StringWrapper& rROp );
-    void                dumpBinaryOpToken( const StringWrapper& rOp );
+    void                dumpExpToken( const String& rName );
+    void                dumpUnaryOpToken( const String& rLOp, const String& rROp );
+    void                dumpBinaryOpToken( const String& rOp );
     void                dumpFuncToken( const ::rtl::OUString& rTokClass );
     void                dumpFuncVarToken( const ::rtl::OUString& rTokClass );
     void                dumpCmdToken( const ::rtl::OUString& rTokClass );
@@ -329,35 +366,14 @@ private:
     FuncProvRef         mxFuncProv;
     AddDataTypeVec      maAddData;
     ::rtl::OUString     maRefPrefix;
-    const sal_Char*     mpcName;
+    ::rtl::OUString     maName;
     sal_uInt16          mnSize;
     bool                mbNameMode;
 };
 
-typedef ::boost::shared_ptr< FormulaObject > FormulaObjectRef;
-
 // ============================================================================
 // ============================================================================
 
-class RecordHeaderObject : public RecordHeaderBase< sal_uInt16, sal_uInt32 >
-{
-public:
-    explicit            RecordHeaderObject( const InputObjectBase& rParent, ::oox::xls::BiffInputStream& rStrm );
-
-    inline bool         isMergeContRec() const { return mbMergeContRec; }
-
-protected:
-    virtual bool        implReadHeader( sal_Int64& ornRecPos, sal_uInt16& ornRecId, sal_uInt32& ornRecSize );
-
-private:
-    ::oox::xls::BiffInputStream& mrStrm;
-    bool                mbMergeContRec;
-};
-
-typedef ::boost::shared_ptr< RecordHeaderObject > RecHeaderObjectRef;
-
-// ============================================================================
-
 class RecordStreamObject : public BiffObjectBase
 {
 protected:
@@ -365,27 +381,15 @@ protected:
     virtual             ~RecordStreamObject();
 
     using               BiffObjectBase::construct;
-    void                construct( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, BinaryInputStreamRef xStrm, ::oox::xls::BiffType eBiff );
+    void                construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, ::oox::xls::BiffType eBiff, const ::rtl::OUString& rSysFileName );
 
     virtual bool        implIsValid() const;
-    virtual void        implDump();
-    virtual void        implDumpRecord();
 
-    inline RecordHeaderObject& getRecordHeader() const { return *mxHdrObj; }
     inline FormulaObject& getFormulaDumper() const { return *mxFmlaObj; }
-    inline DffDumpObject& getDffDumper() const { return *mxDffObj; }
-
-    sal_uInt16          dumpRepeatedRecId();
-
-private:
-    void                dumpRecordBody();
-    void                dumpSimpleRecord( const ::rtl::OUString& rRecData );
 
 private:
-    RecHeaderObjectRef  mxHdrObj;
+    typedef ::boost::shared_ptr< FormulaObject > FormulaObjectRef;
     FormulaObjectRef    mxFmlaObj;
-    DffDumpObjectRef    mxDffObj;
-    NameListRef         mxSimpleRecs;
 };
 
 // ============================================================================
@@ -393,23 +397,22 @@ private:
 class WorkbookStreamObject : public RecordStreamObject
 {
 public:
-    explicit            WorkbookStreamObject( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, BinaryInputStreamRef xStrm );
+    explicit            WorkbookStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
     virtual             ~WorkbookStreamObject();
 
 protected:
-    using               RecordStreamObject::construct;
-    void                construct( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, BinaryInputStreamRef xStrm );
-
-    virtual void        implDumpRecord();
+    virtual void        implDumpRecordBody();
 
 private:
+    void                initializePerSheet();
+
     ::rtl::OUString     createFontName( const ::rtl::OUString& rName, sal_uInt16 nHeight, bool bBold, bool bItalic ) const;
 
-    sal_uInt16          dumpPatternIdx( const sal_Char* pcName = 0, bool b16Bit = true );
-    sal_uInt16          dumpColorIdx( const sal_Char* pcName = 0, bool b16Bit = true );
-    sal_uInt16          dumpFontIdx( const sal_Char* pcName = 0, bool b16Bit = true );
-    sal_uInt16          dumpFormatIdx( const sal_Char* pcName = 0 );
-    sal_uInt16          dumpXfIdx( const sal_Char* pcName = 0, bool bBiff2Style = false );
+    sal_uInt16          dumpPatternIdx( const String& rName = EMPTY_STRING, bool b16Bit = true );
+    sal_uInt16          dumpColorIdx( const String& rName = EMPTY_STRING, bool b16Bit = true );
+    sal_uInt16          dumpFontIdx( const String& rName = EMPTY_STRING, bool b16Bit = true );
+    sal_uInt16          dumpFormatIdx( const String& rName = EMPTY_STRING );
+    sal_uInt16          dumpXfIdx( const String& rName = EMPTY_STRING, bool bBiff2Style = false );
 
     sal_uInt16          dumpCellHeader( bool bBiff2Style = false );
     void                dumpBoolErr();
@@ -419,9 +422,29 @@ private:
     void                dumpXfRec();
 
     void                dumpObjRec();
+    void                dumpObjRecBiff3();
+    void                dumpObjRecBiff4();
     void                dumpObjRecBiff5();
     void                dumpObjRecBiff8();
-    void                dumpFormControl( sal_uInt32 nStrmPos, sal_uInt32 nStrmSize );
+
+    void                dumpObjRecLineData();
+    void                dumpObjRecFillData();
+    void                dumpObjRecRectData();
+    void                dumpObjRecTextDataBiff3( sal_uInt16& ornTextLen, sal_uInt16& ornFormatSize );
+    void                dumpObjRecTextDataBiff5( sal_uInt16& ornTextLen, sal_uInt16& ornFormatSize, sal_uInt16& ornLinkSize );
+    void                dumpObjRecSbsData();
+    void                dumpObjRecGboData();
+    void                dumpObjRecEdoData();
+    void                dumpObjRecRboData();
+    void                dumpObjRecCblsData();
+    void                dumpObjRecLbsData();
+
+    void                dumpObjRecPadding();
+    void                dumpObjRecString( const String& rName, sal_uInt16 nTextLen, bool bRepeatLen );
+    void                dumpObjRecTextFmt( sal_uInt16 nFormatSize );
+    void                dumpObjRecFmlaRaw();
+    void                dumpObjRecFmla( const String& rName, sal_uInt16 nFmlaSize );
+    void                dumpObjRecPictFmla( sal_uInt16 nFmlaSize );
 
 private:
     NameListRef         mxColors;
@@ -434,6 +457,7 @@ private:
     sal_uInt16          mnPTColFields;
     sal_uInt16          mnPTSxliIdx;
     bool                mbHasCodePage;
+    bool                mbHasDff;
 };
 
 // ============================================================================
@@ -441,26 +465,31 @@ private:
 class PivotCacheStreamObject : public RecordStreamObject
 {
 public:
-    explicit            PivotCacheStreamObject( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, BinaryInputStreamRef xStrm );
+    explicit            PivotCacheStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
 
 protected:
-    virtual void        implDumpRecord();
+    virtual void        implDumpRecordBody();
 };
 
 // ============================================================================
 // ============================================================================
 
-class RootStorageObject : public RootStorageObjectBase
+class RootStorageObject : public OleStorageObject
 {
 public:
     explicit            RootStorageObject( const DumperBase& rParent );
 
 protected:
     virtual void        implDumpStream(
-                            BinaryInputStreamRef xStrm,
+                            const BinaryInputStreamRef& rxStrm,
                             const ::rtl::OUString& rStrgPath,
                             const ::rtl::OUString& rStrmName,
-                            const ::rtl::OUString& rSystemFileName );
+                            const ::rtl::OUString& rSysFileName );
+
+    virtual void        implDumpStorage(
+                            const StorageRef& rxStrg,
+                            const ::rtl::OUString& rStrgPath,
+                            const ::rtl::OUString& rSysPath );
 };
 
 // ============================================================================
@@ -471,6 +500,11 @@ class Dumper : public DumperBase
 public:
     explicit            Dumper( const ::oox::core::FilterBase& rFilter );
 
+    explicit            Dumper(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+                            const ::rtl::OUString& rSysFileName );
+
 protected:
     virtual void        implDump();
 };
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/dump/dffdumper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/dffdumper.hxx
--- oox/inc/oox/dump/dffdumper.hxx	2008-04-10 16:35:08.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/dffdumper.hxx	2008-10-06 16:28:34.000000000 +0200
@@ -40,57 +40,36 @@ namespace dump {
 
 // ============================================================================
 
-class DffRecordHeaderObject : public RecordHeaderBase< sal_uInt16, sal_uInt32 >
+class DffStreamObject : public SequenceRecordObjectBase
 {
 public:
-    explicit            DffRecordHeaderObject( const InputObjectBase& rParent );
-
-    inline sal_Int64    getBodyStart() const { return mnBodyStart; }
-    inline sal_Int64    getBodyEnd() const { return mnBodyEnd; }
     inline sal_uInt16   getVer() const { return mnInstVer & 0x000F; }
     inline sal_uInt16   getInst() const { return (mnInstVer & 0xFFF0) >> 4; }
+    inline bool         isContainer() const { return getVer() == 15; }
 
 protected:
-    virtual bool        implIsValid() const;
-    virtual bool        implReadHeader( sal_Int64& ornRecPos, sal_uInt16& ornRecId, sal_uInt32& ornRecSize );
-    virtual void        implWriteExtHeader();
-
-private:
-    NameListRef         mxRecInst;
-    sal_Int64           mnBodyStart;
-    sal_Int64           mnBodyEnd;
-    sal_uInt16          mnInstVer;
-};
+    inline explicit     DffStreamObject() {}
 
-// ============================================================================
+    using               SequenceRecordObjectBase::construct;
+    void                construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
+    void                construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm );
 
-class DffDumpObject : public InputObjectBase
-{
-public:
-    explicit            DffDumpObject( const InputObjectBase& rParent );
-    virtual             ~DffDumpObject();
-
-    void                dumpDffClientPos( const sal_Char* pcName, sal_Int32 nSubScale );
-    void                dumpDffClientRect();
-
-protected:
-    virtual bool        implIsValid() const;
-    virtual void        implDump();
+    virtual bool        implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+    virtual void        implWriteExtHeader();
+    virtual void        implDumpRecordBody();
+    virtual void        implDumpClientAnchor();
 
 private:
-    void                dumpRecordBody();
+    void                constructDffObj();
 
-    void                dumpDffOptRec();
     sal_uInt16          dumpDffOptPropHeader();
     void                dumpDffOptPropValue( sal_uInt16 nPropId, sal_uInt32 nValue );
 
 private:
-    typedef ::boost::shared_ptr< DffRecordHeaderObject > DffRecHeaderObjRef;
-    DffRecHeaderObjRef  mxHdrObj;
+    sal_uInt16          mnInstVer;
+    sal_Int32           mnRealSize;
 };
 
-typedef ::boost::shared_ptr< DffDumpObject > DffDumpObjectRef;
-
 // ============================================================================
 
 } // namespace dump
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/dump/dumperbase.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/dumperbase.hxx
--- oox/inc/oox/dump/dumperbase.hxx	2008-04-10 16:36:04.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/dumperbase.hxx	2008-10-06 16:28:34.000000000 +0200
@@ -37,8 +37,10 @@
 #include <set>
 #include <map>
 #include <boost/shared_ptr.hpp>
+#include <rtl/strbuf.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/DateTime.hpp>
 #include "oox/helper/helper.hxx"
 #include "oox/helper/storagebase.hxx"
 #include "oox/helper/binaryinputstream.hxx"
@@ -48,14 +50,16 @@
 #if OOX_INCLUDE_DUMPER
 
 namespace com { namespace sun { namespace star {
-    namespace util { struct DateTime; }
     namespace io { class XInputStream; }
     namespace io { class XTextInputStream; }
     namespace io { class XOutputStream; }
     namespace io { class XTextOutputStream; }
+    namespace lang { class XMultiServiceFactory; }
 } } }
 
-namespace oox { class BinaryInputStream; }
+namespace oox {
+    class BinaryOutputStream;
+}
 
 namespace oox { namespace core {
     class FilterBase;
@@ -76,6 +80,8 @@ namespace dump {
 #define OOX_DUMP_ERR_NONAME                 OOX_DUMP_ERRSTRING( "no-name" )
 #define OOX_DUMP_ERR_STREAM                 OOX_DUMP_ERRSTRING( "stream-error" )
 
+#define OOX_DUMP_DUMPEXT                    CREATE_OUSTRING( ".dump" )
+
 const sal_Unicode OOX_DUMP_STRQUOTE         = '\'';
 const sal_Unicode OOX_DUMP_FMLASTRQUOTE     = '"';
 const sal_Unicode OOX_DUMP_ADDRABS          = '$';
@@ -103,12 +109,6 @@ typedef ::std::vector< sal_Int64 >      
 class InputOutputHelper
 {
 public:
-    typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >      XInputStreamRef;
-    typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream >  XTextInputStreamRef;
-    typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >     XOutputStreamRef;
-    typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream > XTextOutputStreamRef;
-
-public:
     // file names -------------------------------------------------------------
 
     static ::rtl::OUString convertFileNameToUrl( const ::rtl::OUString& rFileName );
@@ -117,15 +117,44 @@ public:
 
     // input streams ----------------------------------------------------------
 
-    static XInputStreamRef openInputStream( const ::rtl::OUString& rFileName );
-    static XTextInputStreamRef openTextInputStream( const XInputStreamRef& rxInStrm, const ::rtl::OUString& rEncoding );
-    static XTextInputStreamRef openTextInputStream( const ::rtl::OUString& rFileName, const ::rtl::OUString& rEncoding );
+    static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+                        getXInputStream( BinaryInputStream& rStrm );
+
+    static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+                        openInputStream(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const ::rtl::OUString& rFileName );
+
+    static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream >
+                        openTextInputStream(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+                            const ::rtl::OUString& rEncoding );
+
+    static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextInputStream >
+                        openTextInputStream(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const ::rtl::OUString& rFileName,
+                            const ::rtl::OUString& rEncoding );
 
     // output streams ---------------------------------------------------------
 
-    static XOutputStreamRef openOutputStream( const ::rtl::OUString& rFileName );
-    static XTextOutputStreamRef openTextOutputStream( const XOutputStreamRef& rxOutStrm, const ::rtl::OUString& rEncoding );
-    static XTextOutputStreamRef openTextOutputStream( const ::rtl::OUString& rFileName, const ::rtl::OUString& rEncoding );
+    static ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+                        openOutputStream(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const ::rtl::OUString& rFileName );
+
+    static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >
+                        openTextOutputStream(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm,
+                            const ::rtl::OUString& rEncoding );
+
+    static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >
+                        openTextOutputStream(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const ::rtl::OUString& rFileName,
+                            const ::rtl::OUString& rEncoding );
 };
 
 // ============================================================================
@@ -155,6 +184,7 @@ enum FormatType
     FORMATTYPE_NONE,            /// No numeric format (e.g. show name only).
     FORMATTYPE_DEC,             /// Decimal.
     FORMATTYPE_HEX,             /// Hexadecimal.
+    FORMATTYPE_SHORTHEX,        /// Hexadecimal, as short as possible (no leading zeros).
     FORMATTYPE_BIN,             /// Binary.
     FORMATTYPE_FIX,             /// Fixed-point.
     FORMATTYPE_BOOL             /// Boolean ('true' or 'false').
@@ -168,7 +198,7 @@ enum FormatType
 
     <NAME>=<VALUE>=<NAME-FROM-LIST>
 
-    NAME is the name of the data item. The name is contained in the members
+    NAME is the name of the data item. The name is contained in the member
     maItemName. If the name is empty, only the value is written (without a
     leading equality sign).
 
@@ -199,7 +229,7 @@ struct ItemFormat
         The vector must contain at least 2 strings. The struct is filled from
         the strings in the vector in the following order:
         1) Data type (one of: [u]int8, [u]int16, [u]int32, [u]int64, float, double).
-        2) Format type (one of: dec, hex, bin, fix, bool, unused, unknown).
+        2) Format type (one of: dec, hex, shorthex, bin, fix, bool, unused, unknown).
         3) Item name (optional).
         4) Name list name (optional).
 
@@ -310,6 +340,7 @@ public:
     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, sal_Int32  nData, bool bPrefix = true );
     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
     static void         appendShortHex( ::rtl::OUStringBuffer& rStr, sal_Int64  nData, bool bPrefix = true );
+    static void         appendShortHex( ::rtl::OUStringBuffer& rStr, double     fData, bool bPrefix = true );
 
     // append binary ----------------------------------------------------------
 
@@ -406,6 +437,7 @@ void StringHelper::appendValue( ::rtl::O
     {
         case FORMATTYPE_DEC:        appendDec( rStr, nData );   break;
         case FORMATTYPE_HEX:        appendHex( rStr, nData );   break;
+        case FORMATTYPE_SHORTHEX:   appendShortHex( rStr, nData );  break;
         case FORMATTYPE_BIN:        appendBin( rStr, nData );   break;
         case FORMATTYPE_FIX:        appendFix( rStr, nData );   break;
         case FORMATTYPE_BOOL:       appendBool( rStr, nData );  break;
@@ -415,21 +447,20 @@ void StringHelper::appendValue( ::rtl::O
 
 // ============================================================================
 
-class StringWrapper
+class String : public ::rtl::OUString
 {
 public:
-    inline              StringWrapper() {}
-    inline /*implicit*/ StringWrapper( const ::rtl::OUString& rStr ) : maStr( rStr ) {}
-    inline /*implicit*/ StringWrapper( const sal_Char* pcStr ) : maStr( ::rtl::OUString::createFromAscii( pcStr ? pcStr : "" ) ) {}
-    inline /*implicit*/ StringWrapper( sal_Unicode cChar ) : maStr( cChar ) {}
+    inline              String() {}
+    inline /*implicit*/ String( const ::rtl::OUString& rStr ) : ::rtl::OUString( rStr ) {}
+    inline /*implicit*/ String( const sal_Char* pcStr ) : ::rtl::OUString( ::rtl::OUString::createFromAscii( pcStr ? pcStr : "" ) ) {}
+    inline /*implicit*/ String( sal_Unicode cChar ) : ::rtl::OUString( cChar ) {}
 
-    inline bool         isEmpty() const { return maStr.getLength() == 0; }
-    inline const ::rtl::OUString& getString() const { return maStr; }
-
-private:
-    ::rtl::OUString     maStr;
+    inline bool         has() const { return getLength() > 0; }
+    inline ::rtl::OUString operator()( const sal_Char* pcDefault ) const { if( has() ) return *this; return String( pcDefault ); }
 };
 
+static const String EMPTY_STRING;
+
 // ============================================================================
 // ============================================================================
 
@@ -442,11 +473,11 @@ public:
     inline const ::rtl::OUString& getFormulaString() const { return getString( maFmlaStack ); }
     inline const ::rtl::OUString& getClassesString() const { return getString( maClassStack ); }
 
-    void                pushOperand( const StringWrapper& rOp, const ::rtl::OUString& rTokClass );
-    void                pushOperand( const StringWrapper& rOp );
-    void                pushUnaryOp( const StringWrapper& rLOp, const StringWrapper& rROp );
-    void                pushBinaryOp( const StringWrapper& rOp );
-    void                pushFuncOp( const StringWrapper& rFunc, const ::rtl::OUString& rTokClass, sal_uInt8 nParamCount );
+    void                pushOperand( const String& rOp, const ::rtl::OUString& rTokClass );
+    void                pushOperand( const String& rOp );
+    void                pushUnaryOp( const String& rLOp, const String& rROp );
+    void                pushBinaryOp( const String& rOp );
+    void                pushFuncOp( const String& rFunc, const ::rtl::OUString& rTokClass, sal_uInt8 nParamCount );
 
     inline void         setError() { mbError = true; }
     void                replaceOnTop( const ::rtl::OUString& rOld, const ::rtl::OUString& rNew );
@@ -487,30 +518,36 @@ typedef ::boost::shared_ptr< Base > Base
     +---->  NameListBase
     |       |
     |       +---->  ConstList  ------>  MultiList
+    |       |
     |       +---->  FlagsList  ------>  CombiList
+    |       |
     |       +---->  UnitConverter
     |
     +---->  SharedConfigData
+    |
     +---->  Config
     |
-    +---->  Input  ------>  BinaryInput
     +---->  Output
     |
     +---->  StorageIterator
     |
     +---->  ObjectBase
             |
-            +---->  RootStorageObjectBase
+            +---->  StorageObjectBase
             |
             +---->  OutputObjectBase
             |       |
             |       +---->  InputObjectBase
             |               |
-            |               +---->  InputStreamObject
+            |               +---->  BinaryStreamObject
+            |               |
+            |               +---->  TextStreamObject
+            |               |       |
+            |               |       +---->  XmlStreamObject
             |               |
-            |               +---->  RecordHeaderImplBase
+            |               +---->  RecordObjectBase
             |                       |
-            |                       +---->  RecordHeaderBase<>
+            |                       +---->  SequenceRecordObjectBase
             |
             +---->  DumperBase
  */
@@ -520,7 +557,7 @@ public:
     virtual             ~Base();
 
     inline bool         isValid() const { return implIsValid(); }
-    inline static bool  isValid( BaseRef xBase ) { return xBase.get() && xBase->isValid(); }
+    inline static bool  isValid( const BaseRef& rxBase ) { return rxBase.get() && rxBase->isValid(); }
 
 protected:
     inline explicit     Base() {}
@@ -598,10 +635,10 @@ public:
     virtual             ~NameListBase();
 
     /** Sets a name for the specified key. */
-    void                setName( sal_Int64 nKey, const StringWrapper& rNameWrp );
+    void                setName( sal_Int64 nKey, const String& rName );
 
     /** Include all names of the passed list. */
-    void                includeList( NameListRef xList );
+    void                includeList( const NameListRef& rxList );
 
     /** Returns true, if the map contains an entry for the passed key. */
     template< typename Type >
@@ -670,7 +707,7 @@ public:
     explicit            ConstList( const SharedConfigData& rCfgData );
 
     /** Sets a default name for unknown keys. */
-    inline void         setDefaultName( const StringWrapper& rDefName ) { maDefName = rDefName.getString(); }
+    inline void         setDefaultName( const String& rDefName ) { maDefName = rDefName; }
     /** Enables or disables automatic quotation of returned names. */
     inline void         setQuoteNames( bool bQuoteNames ) { mbQuoteNames = bQuoteNames; }
 
@@ -781,7 +818,7 @@ class UnitConverter : public NameListBas
 public:
     explicit            UnitConverter( const SharedConfigData& rCfgData );
 
-    inline void         setUnitName( const StringWrapper& rUnitName ) { maUnitName = rUnitName.getString(); }
+    inline void         setUnitName( const String& rUnitName ) { maUnitName = rUnitName; }
     inline void         setFactor( double fFactor ) { mfFactor = fFactor; }
 
 protected:
@@ -805,15 +842,15 @@ class NameListWrapper
 {
 public:
     inline              NameListWrapper() {}
-    inline /*implicit*/ NameListWrapper( const ::rtl::OUString& rListName ) : maNameWrp( rListName ) {}
-    inline /*implicit*/ NameListWrapper( const sal_Char* pcListName ) : maNameWrp( pcListName ) {}
-    inline /*implicit*/ NameListWrapper( NameListRef xList ) : mxList( xList ) {}
+    inline /*implicit*/ NameListWrapper( const ::rtl::OUString& rListName ) : maName( rListName ) {}
+    inline /*implicit*/ NameListWrapper( const sal_Char* pcListName ) : maName( pcListName ) {}
+    inline /*implicit*/ NameListWrapper( const NameListRef& rxList ) : mxList( rxList ) {}
 
-    inline bool         isEmpty() const { return !mxList && maNameWrp.isEmpty(); }
+    inline bool         isEmpty() const { return !mxList && !maName.has(); }
     NameListRef         getNameList( const Config& rCfg ) const;
 
 private:
-    StringWrapper       maNameWrp;
+    String              maName;
     mutable NameListRef mxList;
 };
 
@@ -825,22 +862,28 @@ static const NameListWrapper NO_LIST;
 class SharedConfigData : public Base, public ConfigItemBase
 {
 public:
-    explicit            SharedConfigData( const ::rtl::OUString& rFileName );
+    explicit            SharedConfigData(
+                            const ::rtl::OUString& rFileName,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const StorageRef& rxRootStrg,
+                            const ::rtl::OUString& rSysFileName );
+
     virtual             ~SharedConfigData();
 
+    inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getFactory() const { return mxFactory; }
+    inline const StorageRef& getRootStorage() const { return mxRootStrg; }
+    inline const ::rtl::OUString& getSysFileName() const { return maSysFileName; }
+
     void                setOption( const ::rtl::OUString& rKey, const ::rtl::OUString& rData );
     const ::rtl::OUString* getOption( const ::rtl::OUString& rKey ) const;
 
     template< typename ListType >
     ::boost::shared_ptr< ListType > createNameList( const ::rtl::OUString& rListName );
-    void                setNameList( const ::rtl::OUString& rListName, NameListRef xList );
+    void                setNameList( const ::rtl::OUString& rListName, const NameListRef& rxList );
     void                eraseNameList( const ::rtl::OUString& rListName );
     NameListRef         getNameList( const ::rtl::OUString& rListName ) const;
 
 protected:
-    inline explicit     SharedConfigData() : mbLoaded( false ) {}
-    void                construct( const ::rtl::OUString& rFileName );
-
     virtual bool        implIsValid() const;
     virtual void        implProcessConfigItemStr(
                             const ConfigInputStreamRef& rxStrm,
@@ -859,6 +902,9 @@ private:
     typedef ::std::map< ::rtl::OUString, ::rtl::OUString >  ConfigDataMap;
     typedef ::std::map< ::rtl::OUString, NameListRef >      NameListMap;
 
+    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxFactory;
+    StorageRef          mxRootStrg;
+    ::rtl::OUString     maSysFileName;
     ConfigFileSet       maConfigFiles;
     ConfigDataMap       maConfigData;
     NameListMap         maNameLists;
@@ -894,38 +940,55 @@ class Config : public Base
 {
 public:
     explicit            Config( const Config& rParent );
-    explicit            Config( const ::rtl::OUString& rFileName );
-    explicit            Config( const sal_Char* pcEnvVar );
+    explicit            Config(
+                            const sal_Char* pcEnvVar,
+                            const ::oox::core::FilterBase& rFilter );
+    explicit            Config(
+                            const sal_Char* pcEnvVar,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const StorageRef& rxRootStrg,
+                            const ::rtl::OUString& rSysFileName );
+
     virtual             ~Config();
 
-    void                setStringOption( const StringWrapper& rKey, const StringWrapper& rData );
+    inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getFactory() const { return mxCfgData->getFactory(); }
+    inline const StorageRef& getRootStorage() const { return mxCfgData->getRootStorage(); }
+    inline const ::rtl::OUString& getSysFileName() const { return mxCfgData->getSysFileName(); }
 
-    const ::rtl::OUString& getStringOption( const StringWrapper& rKey, const ::rtl::OUString& rDefault ) const;
-    bool                getBoolOption( const StringWrapper& rKey, bool bDefault ) const;
+    void                setStringOption( const String& rKey, const String& rData );
+
+    const ::rtl::OUString& getStringOption( const String& rKey, const ::rtl::OUString& rDefault ) const;
+    bool                getBoolOption( const String& rKey, bool bDefault ) const;
     template< typename Type >
-    Type                getIntOption( const StringWrapper& rKey, Type nDefault ) const;
+    Type                getIntOption( const String& rKey, Type nDefault ) const;
 
     bool                isDumperEnabled() const;
     bool                isImportEnabled() const;
 
     template< typename ListType >
-    ::boost::shared_ptr< ListType > createNameList( const StringWrapper& rListName );
-    void                setNameList( const StringWrapper& rListName, NameListRef xList );
-    void                eraseNameList( const StringWrapper& rListName );
-    NameListRef         getNameList( const StringWrapper& rListName ) const;
+    ::boost::shared_ptr< ListType > createNameList( const String& rListName );
+    void                setNameList( const String& rListName, const NameListRef& rxList );
+    void                eraseNameList( const String& rListName );
+    NameListRef         getNameList( const String& rListName ) const;
 
     /** Returns the name for the passed key from the passed name list. */
     template< typename Type >
     ::rtl::OUString     getName( const NameListWrapper& rListWrp, Type nKey ) const;
     /** Returns true, if the passed name list contains an entry for the passed key. */
     template< typename Type >
-    bool                hasName( const NameListWrapper& rList, Type nKey ) const;
+    bool                hasName( const NameListWrapper& rListWrp, Type nKey ) const;
 
 protected:
     inline explicit     Config() {}
     void                construct( const Config& rParent );
-    void                construct( const ::rtl::OUString& rFileName );
-    void                construct( const sal_Char* pcEnvVar );
+    void                construct(
+                            const sal_Char* pcEnvVar,
+                            const ::oox::core::FilterBase& rFilter );
+    void                construct(
+                            const sal_Char* pcEnvVar,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const StorageRef& rxRootStrg,
+                            const ::rtl::OUString& rSysFileName );
 
     virtual bool        implIsValid() const;
     virtual const ::rtl::OUString* implGetOption( const ::rtl::OUString& rKey ) const;
@@ -941,18 +1004,18 @@ typedef ::boost::shared_ptr< Config > Co
 // ----------------------------------------------------------------------------
 
 template< typename Type >
-Type Config::getIntOption( const StringWrapper& rKey, Type nDefault ) const
+Type Config::getIntOption( const String& rKey, Type nDefault ) const
 {
     sal_Int64 nRawData;
-    const ::rtl::OUString* pData = implGetOption( rKey.getString() );
+    const ::rtl::OUString* pData = implGetOption( rKey );
     return (pData && StringHelper::convertStringToInt( nRawData, *pData )) ?
         static_cast< Type >( nRawData ) : nDefault;
 }
 
 template< typename ListType >
-::boost::shared_ptr< ListType > Config::createNameList( const StringWrapper& rListName )
+::boost::shared_ptr< ListType > Config::createNameList( const String& rListName )
 {
-    return mxCfgData->createNameList< ListType >( rListName.getString() );
+    return mxCfgData->createNameList< ListType >( rListName );
 }
 
 template< typename Type >
@@ -972,77 +1035,15 @@ bool Config::hasName( const NameListWrap
 // ============================================================================
 // ============================================================================
 
-class Input : public Base
-{
-public:
-    virtual sal_Int64   getSize() const = 0;
-    virtual sal_Int64   tell() const = 0;
-    virtual void        seek( sal_Int64 nPos ) = 0;
-    virtual void        skip( sal_Int32 nBytes ) = 0;
-    virtual sal_Int32   read( void* pBuffer, sal_Int32 nBytes ) = 0;
-
-    virtual Input&      operator>>( sal_Int8& rnData ) = 0;
-    virtual Input&      operator>>( sal_uInt8& rnData ) = 0;
-    virtual Input&      operator>>( sal_Int16& rnData ) = 0;
-    virtual Input&      operator>>( sal_uInt16& rnData ) = 0;
-    virtual Input&      operator>>( sal_Int32& rnData ) = 0;
-    virtual Input&      operator>>( sal_uInt32& rnData ) = 0;
-    virtual Input&      operator>>( float& rfData ) = 0;
-    virtual Input&      operator>>( double& rfData ) = 0;
-
-    inline bool         isValidPos() const { return tell() < getSize(); }
-    template< typename Type >
-    inline Type         readValue() { Type nValue; *this >> nValue; return nValue; }
-
-protected:
-    virtual bool        implIsValid() const;
-};
-
-typedef ::boost::shared_ptr< Input > InputRef;
-
-Input& operator>>( Input& rIn, sal_Int64& rnData );
-Input& operator>>( Input& rIn, sal_uInt64& rnData );
-
-// ============================================================================
-
-class BinaryInput : public Input
-{
-public:
-    explicit            BinaryInput( BinaryInputStream& rStrm );
-
-    virtual sal_Int64   getSize() const;
-    virtual sal_Int64   tell() const;
-    virtual void        seek( sal_Int64 nPos );
-    virtual void        skip( sal_Int32 nBytes );
-    virtual sal_Int32   read( void* pBuffer, sal_Int32 nBytes );
-
-    virtual BinaryInput& operator>>( sal_Int8& rnData );
-    virtual BinaryInput& operator>>( sal_uInt8& rnData );
-    virtual BinaryInput& operator>>( sal_Int16& rnData );
-    virtual BinaryInput& operator>>( sal_uInt16& rnData );
-    virtual BinaryInput& operator>>( sal_Int32& rnData );
-    virtual BinaryInput& operator>>( sal_uInt32& rnData );
-    virtual BinaryInput& operator>>( float& rfData );
-    virtual BinaryInput& operator>>( double& rfData );
-
-protected:
-    virtual bool        implIsValid() const;
-
-private:
-    BinaryInputStream&  mrStrm;
-};
-
-// ============================================================================
-// ============================================================================
-
 class Output : public Base
 {
 public:
-    typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream > XTextOutputStreamRef;
+    explicit            Output(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >& rxStrm );
 
-public:
-    explicit            Output( const XTextOutputStreamRef& rxStrm );
-    explicit            Output( const ::rtl::OUString& rFileName );
+    explicit            Output(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const ::rtl::OUString& rFileName );
 
     // ------------------------------------------------------------------------
 
@@ -1064,7 +1065,7 @@ public:
     void                endTable();
 
     void                resetItemIndex( sal_Int64 nIdx = 0 );
-    void                startItem( const sal_Char* pcName = 0 );
+    void                startItem( const String& rItemName );
     void                contItem();
     void                endItem();
     inline const ::rtl::OUString& getLastItemValue() const { return maLastItem; }
@@ -1079,7 +1080,7 @@ public:
     void                writeString( const ::rtl::OUString& rStr );
     void                writeArray( const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
     void                writeBool( bool bData );
-    void                writeColor( sal_Int32 nColor );
+    void                writeColorABGR( sal_Int32 nColor );
     void                writeDateTime( const ::com::sun::star::util::DateTime& rDateTime );
     void                writeColIndex( sal_Int32 nCol );
     void                writeRowIndex( sal_Int32 nRow );
@@ -1097,6 +1098,9 @@ public:
     inline void         writeHex( Type nData, bool bPrefix = true )
                             { StringHelper::appendHex( maLine, nData, bPrefix ); }
     template< typename Type >
+    inline void         writeShortHex( Type nData, bool bPrefix = true )
+                            { StringHelper::appendShortHex( maLine, nData, bPrefix ); }
+    template< typename Type >
     inline void         writeBin( Type nData, bool bDots = true )
                             { StringHelper::appendBin( maLine, nData, bDots ); }
     template< typename Type >
@@ -1111,17 +1115,17 @@ public:
 
     // ------------------------------------------------------------------------
 protected:
-    void                construct( const XTextOutputStreamRef& rxStrm );
+    void                construct( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream >& rxStrm );
 
     virtual bool        implIsValid() const;
 
 private:
-    void                writeItemName( const sal_Char* pcName );
+    void                writeItemName( const String& rItemName );
 
 private:
     typedef ::std::vector< sal_Int32 > StringLenVec;
 
-    XTextOutputStreamRef mxStrm;
+    ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream > mxStrm;
     ::rtl::OUString     maIndent;
     ::rtl::OUStringBuffer maLine;
     ::rtl::OUString     maLastItem;
@@ -1180,8 +1184,8 @@ private:
 class ItemGuard
 {
 public:
-    inline explicit     ItemGuard( Output& rOut, const sal_Char* pcName = 0 ) :
-                            mrOut( rOut ) { mrOut.startItem( pcName ); }
+    inline explicit     ItemGuard( Output& rOut, const String& rName = EMPTY_STRING ) :
+                            mrOut( rOut ) { mrOut.startItem( rName ); }
     inline              ~ItemGuard() { mrOut.endItem(); }
     inline void         cont() { mrOut.contItem(); }
 private:
@@ -1206,6 +1210,31 @@ private:
 };
 
 // ============================================================================
+
+class StorageIterator : public Base
+{
+public:
+    explicit            StorageIterator( const StorageRef& rxStrg );
+    virtual             ~StorageIterator();
+
+    size_t              getElementCount() const;
+
+    StorageIterator&    operator++();
+
+    ::rtl::OUString     getName() const;
+    bool                isStream() const;
+    bool                isStorage() const;
+
+private:
+    virtual bool        implIsValid() const;
+
+private:
+    StorageRef          mxStrg;
+    OUStringVector      maNames;
+    OUStringVector::const_iterator maIt;
+};
+
+// ============================================================================
 // ============================================================================
 
 class ObjectBase : public Base
@@ -1213,27 +1242,27 @@ class ObjectBase : public Base
 public:
     virtual             ~ObjectBase();
 
+    inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getFactory() const { return mxConfig->getFactory(); }
+
     void                dump();
 
     // ------------------------------------------------------------------------
 protected:
-    inline explicit     ObjectBase() : mpFilter( 0 ) {}
-    void                construct( const ::oox::core::FilterBase& rFilter, ConfigRef xConfig );
+    inline explicit     ObjectBase() {}
+
+    void                construct( const ConfigRef& rxConfig );
     void                construct( const ObjectBase& rParent );
 
     virtual bool        implIsValid() const;
-    virtual ConfigRef   implReconstructConfig();
     virtual void        implDump();
 
     // ------------------------------------------------------------------------
 
-    void                reconstructConfig();
+    void                reconstructConfig( const ConfigRef& rxConfig );
 
-    inline const ::oox::core::FilterBase& getFilter() const { return *mpFilter; }
     inline Config&      cfg() const { return *mxConfig; }
 
 private:
-    const ::oox::core::FilterBase* mpFilter;
     ConfigRef           mxConfig;
 };
 
@@ -1242,62 +1271,73 @@ typedef ::boost::shared_ptr< ObjectBase 
 // ============================================================================
 // ============================================================================
 
-class RootStorageObjectBase : public ObjectBase
+class StorageObjectBase : public ObjectBase
 {
-public:
-    virtual             ~RootStorageObjectBase();
-
 protected:
-    inline explicit     RootStorageObjectBase() {}
+    inline explicit     StorageObjectBase() {}
 
+protected:
     using               ObjectBase::construct;
+    void                construct( const ObjectBase& rParent, const StorageRef& rxStrg, const ::rtl::OUString& rSysPath );
     void                construct( const ObjectBase& rParent );
 
+    virtual bool        implIsValid() const;
     virtual void        implDump();
 
     virtual void        implDumpStream(
-                            BinaryInputStreamRef xStrm,
+                            const BinaryInputStreamRef& rxStrm,
                             const ::rtl::OUString& rStrgPath,
                             const ::rtl::OUString& rStrmName,
-                            const ::rtl::OUString& rSystemFileName );
+                            const ::rtl::OUString& rSysFileName );
+
+    virtual void        implDumpStorage(
+                            const StorageRef& rxStrg,
+                            const ::rtl::OUString& rStrgPath,
+                            const ::rtl::OUString& rSysPath );
+
+    void                addPreferredStream( const String& rStrmName );
+    void                addPreferredStorage( const String& rStrgPath );
 
 private:
+    ::rtl::OUString     getSysFileName(
+                            const ::rtl::OUString& rStrmName,
+                            const ::rtl::OUString& rSysOutPath );
+
     void                extractStream(
                             StorageBase& rStrg,
+                            const ::rtl::OUString& rStrgPath,
                             const ::rtl::OUString& rStrmName,
-                            const ::rtl::OUString& rSystemFileName );
+                            const ::rtl::OUString& rSysFileName );
     void                extractStorage(
-                            StorageRef xStrg,
-                            const ::rtl::OUString& rSystemPath );
-};
-
-typedef ::boost::shared_ptr< RootStorageObjectBase > RootStorageObjectRef;
+                            const StorageRef& rxStrg,
+                            const ::rtl::OUString& rStrgPath,
+                            const ::rtl::OUString& rSysPath );
 
-// ============================================================================
+    void                extractItem(
+                            const StorageRef& rxStrg,
+                            const ::rtl::OUString& rStrgPath,
+                            const ::rtl::OUString& rItemName,
+                            const ::rtl::OUString& rSysOutPath,
+                            bool bIsStrg, bool bIsStrm );
 
-class StorageIterator : public Base
+private:
+    struct PreferredItem
 {
-public:
-    explicit            StorageIterator( StorageRef xStrg );
-    virtual             ~StorageIterator();
-
-    size_t              getElementCount() const;
-
-    StorageIterator&    operator++();
-
-    ::rtl::OUString     getName() const;
-    bool                isStream() const;
-    bool                isStorage() const;
+        ::rtl::OUString     maName;
+        bool                mbStorage;
 
-private:
-    virtual bool        implIsValid() const;
+        inline explicit     PreferredItem( const ::rtl::OUString rName, bool bStorage ) :
+                                maName( rName ), mbStorage( bStorage ) {}
+    };
+    typedef ::std::vector< PreferredItem > PreferredItemVector;
 
-private:
     StorageRef          mxStrg;
-    OUStringVector      maNames;
-    OUStringVector::const_iterator maIt;
+    ::rtl::OUString     maSysPath;
+    PreferredItemVector maPreferred;
 };
 
+typedef ::boost::shared_ptr< StorageObjectBase > StorageObjectRef;
+
 // ============================================================================
 // ============================================================================
 
@@ -1311,59 +1351,59 @@ protected:
     inline explicit     OutputObjectBase() {}
 
     using               ObjectBase::construct;
-    void                construct( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName );
-    void                construct( const ObjectBase& rParent, OutputRef xOut );
+    void                construct( const ObjectBase& rParent, const ::rtl::OUString& rSysFileName );
+    void                construct( const ObjectBase& rParent, const OutputRef& rxOut );
     void                construct( const OutputObjectBase& rParent );
 
     virtual bool        implIsValid() const;
-    virtual OutputRef   implReconstructOutput();
 
     // ------------------------------------------------------------------------
 
-    void                reconstructOutput();
-
     inline Output&      out() const { return *mxOut; }
 
     // ------------------------------------------------------------------------
 
-    void                writeEmptyItem( const sal_Char* pcName );
-    void                writeInfoItem( const sal_Char* pcName, const StringWrapper& rData );
-    void                writeStringItem( const sal_Char* pcName, const ::rtl::OUString& rData );
-    void                writeArrayItem( const sal_Char* pcName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
-    void                writeBoolItem( const sal_Char* pcName, bool bData );
-    double              writeRkItem( const sal_Char* pcName, sal_Int32 nRk );
-    void                writeColorItem( const sal_Char* pcName, sal_Int32 nColor );
-    void                writeDateTimeItem( const sal_Char* pcName, const ::com::sun::star::util::DateTime& rDateTime );
-    void                writeGuidItem( const sal_Char* pcName, const ::rtl::OUString& rGuid );
-    void                writeColIndexItem( const sal_Char* pcName, sal_Int32 nCol );
-    void                writeRowIndexItem( const sal_Char* pcName, sal_Int32 nRow );
-    void                writeColRangeItem( const sal_Char* pcName, sal_Int32 nCol1, sal_Int32 nCol2 );
-    void                writeRowRangeItem( const sal_Char* pcName, sal_Int32 nRow1, sal_Int32 nRow2 );
-    void                writeAddressItem( const sal_Char* pcName, const Address& rPos );
-    void                writeRangeItem( const sal_Char* pcName, const Range& rRange );
-    void                writeRangeListItem( const sal_Char* pcName, const RangeList& rRanges );
-    void                writeTokenAddressItem( const sal_Char* pcName, const TokenAddress& rPos, bool bNameMode );
-    void                writeTokenAddress3dItem( const sal_Char* pcName, const ::rtl::OUString& rRef, const TokenAddress& rPos, bool bNameMode );
-    void                writeTokenRangeItem( const sal_Char* pcName, const TokenRange& rRange, bool bNameMode );
-    void                writeTokenRange3dItem( const sal_Char* pcName, const ::rtl::OUString& rRef, const TokenRange& rRange, bool bNameMode );
+    void                writeEmptyItem( const String& rName );
+    void                writeInfoItem( const String& rName, const String& rData );
+    void                writeCharItem( const String& rName, sal_Unicode cData );
+    void                writeStringItem( const String& rName, const ::rtl::OUString& rData );
+    void                writeArrayItem( const String& rName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+    void                writeBoolItem( const String& rName, bool bData );
+    double              writeRkItem( const String& rName, sal_Int32 nRk );
+    void                writeColorABGRItem( const String& rName, sal_Int32 nColor );
+    void                writeDateTimeItem( const String& rName, const ::com::sun::star::util::DateTime& rDateTime );
+    void                writeGuidItem( const String& rName, const ::rtl::OUString& rGuid );
+    void                writeColIndexItem( const String& rName, sal_Int32 nCol );
+    void                writeRowIndexItem( const String& rName, sal_Int32 nRow );
+    void                writeColRangeItem( const String& rName, sal_Int32 nCol1, sal_Int32 nCol2 );
+    void                writeRowRangeItem( const String& rName, sal_Int32 nRow1, sal_Int32 nRow2 );
+    void                writeAddressItem( const String& rName, const Address& rPos );
+    void                writeRangeItem( const String& rName, const Range& rRange );
+    void                writeRangeListItem( const String& rName, const RangeList& rRanges );
+    void                writeTokenAddressItem( const String& rName, const TokenAddress& rPos, bool bNameMode );
+    void                writeTokenAddress3dItem( const String& rName, const ::rtl::OUString& rRef, const TokenAddress& rPos, bool bNameMode );
+    void                writeTokenRangeItem( const String& rName, const TokenRange& rRange, bool bNameMode );
+    void                writeTokenRange3dItem( const String& rName, const ::rtl::OUString& rRef, const TokenRange& rRange, bool bNameMode );
 
     template< typename Type >
     void                addNameToItem( Type nData, const NameListWrapper& rListWrp );
 
     template< typename Type >
-    void                writeNameItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp );
+    void                writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp );
     template< typename Type >
-    void                writeDecItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+    void                writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type >
-    void                writeHexItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+    void                writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type >
-    void                writeBinItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+    void                writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type >
-    void                writeFixItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+    void                writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type >
-    void                writeDecBoolItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+    void                writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type >
-    void                writeValueItem( const sal_Char* pcName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp = NO_LIST );
+    void                writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+    template< typename Type >
+    void                writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp = NO_LIST );
 
     template< typename Type >
     void                writeValueItem( const ItemFormat& rItemFmt, Type nData );
@@ -1387,48 +1427,56 @@ void OutputObjectBase::addNameToItem( Ty
 }
 
 template< typename Type >
-void OutputObjectBase::writeNameItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
+void OutputObjectBase::writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
 {
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
     mxOut->writeName( cfg(), nData, rListWrp );
 }
 
 template< typename Type >
-void OutputObjectBase::writeDecItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
+void OutputObjectBase::writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
 {
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
     mxOut->writeDec( nData );
     addNameToItem( nData, rListWrp );
 }
 
 template< typename Type >
-void OutputObjectBase::writeHexItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
+void OutputObjectBase::writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
 {
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
     mxOut->writeHex( nData );
     addNameToItem( nData, rListWrp );
 }
 
 template< typename Type >
-void OutputObjectBase::writeBinItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
+void OutputObjectBase::writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+    ItemGuard aItem( *mxOut, rName );
+    mxOut->writeShortHex( nData );
+    addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
 {
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
     mxOut->writeBin( nData );
     addNameToItem( nData, rListWrp );
 }
 
 template< typename Type >
-void OutputObjectBase::writeFixItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
+void OutputObjectBase::writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
 {
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
     mxOut->writeFix( nData );
     addNameToItem( nData, rListWrp );
 }
 
 template< typename Type >
-void OutputObjectBase::writeDecBoolItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
+void OutputObjectBase::writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
 {
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
     mxOut->writeDec( nData );
     aItem.cont();
     mxOut->writeBool( nData != 0 );
@@ -1436,13 +1484,13 @@ void OutputObjectBase::writeDecBoolItem(
 }
 
 template< typename Type >
-void OutputObjectBase::writeValueItem( const sal_Char* pcName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp )
+void OutputObjectBase::writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp )
 {
     if( eFmtType == FORMATTYPE_BOOL )
-        writeDecBoolItem( pcName, nData, rListWrp );
+        writeDecBoolItem( rName, nData, rListWrp );
     else
     {
-        ItemGuard aItem( *mxOut, pcName );
+        ItemGuard aItem( *mxOut, rName );
         mxOut->writeValue( nData, eFmtType );
         addNameToItem( nData, rListWrp );
     }
@@ -1468,70 +1516,81 @@ protected:
     inline explicit     InputObjectBase() {}
 
     using               OutputObjectBase::construct;
-    void                construct( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, InputRef xIn );
-    void                construct( const ObjectBase& rParent, OutputRef xOut, InputRef xIn );
-    void                construct( const OutputObjectBase& rParent, InputRef xIn );
+    void                construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
+    void                construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OutputRef& rxOut );
+    void                construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm );
     void                construct( const InputObjectBase& rParent );
 
     virtual bool        implIsValid() const;
-    virtual InputRef    implReconstructInput();
 
     // ------------------------------------------------------------------------
 
-    void                reconstructInput();
-
-    inline Input&       in() const { return *mxIn; }
+    inline BinaryInputStream& in() const { return *mxStrm; }
+    ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+                        getXInputStream() const;
 
     // ------------------------------------------------------------------------
 
-    void                skipBlock( sal_Int32 nBytes, bool bShowSize = true );
-    void                dumpRawBinary( sal_Int32 nBytes, bool bShowOffset = true, bool bStream = false );
+    void                skipBlock( sal_Int64 nBytes, bool bShowSize = true );
+    void                dumpRawBinary( sal_Int64 nBytes, bool bShowOffset = true, bool bStream = false );
+
+    void                dumpBinary( const String& rName, sal_Int64 nBytes, bool bShowOffset = true );
+    void                dumpRemaining( sal_Int64 nBytes );
+    void                dumpRemainingTo( sal_Int64 nPos );
+    void                dumpRemainingStream();
 
-    void                dumpBinary( const sal_Char* pcName, sal_Int32 nBytes, bool bShowOffset = true );
-    void                dumpArray( const sal_Char* pcName, sal_Int32 nBytes, sal_Unicode cSep = OOX_DUMP_LISTSEP );
-    void                dumpRemaining( sal_Int32 nBytes );
+    void                dumpArray( const String& rName, sal_Int32 nBytes, sal_Unicode cSep = OOX_DUMP_LISTSEP );
     inline void         dumpUnused( sal_Int32 nBytes ) { dumpArray( OOX_DUMP_UNUSED, nBytes ); }
     inline void         dumpUnknown( sal_Int32 nBytes ) { dumpArray( OOX_DUMP_UNKNOWN, nBytes ); }
 
-    ::rtl::OUString     dumpCharArray( const sal_Char* pcName, sal_Int32 nSize, rtl_TextEncoding eTextEnc );
-    ::rtl::OUString     dumpUnicodeArray( const sal_Char* pcName, sal_Int32 nSize );
+    sal_Unicode         dumpChar( const String& rName, rtl_TextEncoding eTextEnc );
+    sal_Unicode         dumpUnicode( const String& rName );
+
+    ::rtl::OUString     dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc );
+    ::rtl::OUString     dumpUnicodeArray( const String& rName, sal_Int32 nLen );
+
+    ::rtl::OUString     dumpNullCharArray( const String& rName, rtl_TextEncoding eTextEnc );
+    ::rtl::OUString     dumpNullUnicodeArray( const String& rName );
+
+    double              dumpRk( const String& rName = EMPTY_STRING );
+    sal_Int32           dumpColorABGR( const String& rName = EMPTY_STRING );
+    ::com::sun::star::util::DateTime dumpFileTime( const String& rName = EMPTY_STRING );
+    ::rtl::OUString     dumpGuid( const String& rName = EMPTY_STRING );
 
-    double              dumpRk( const sal_Char* pcName = 0 );
-    ::rtl::OUString     dumpGuid( const sal_Char* pcName = 0 );
     void                dumpItem( const ItemFormat& rItemFmt );
 
     template< typename Type >
-    Type                dumpName( const sal_Char* pcName, const NameListWrapper& rListWrp );
+    Type                dumpName( const String& rName, const NameListWrapper& rListWrp );
     template< typename Type >
-    Type                dumpDec( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
+    Type                dumpDec( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type >
-    Type                dumpHex( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
+    Type                dumpHex( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type >
-    Type                dumpBin( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
+    Type                dumpBin( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type >
-    Type                dumpFix( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
+    Type                dumpFix( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type >
-    Type                dumpBool( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
+    Type                dumpBool( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type >
     Type                dumpValue( const ItemFormat& rItemFmt );
 
     template< typename Type1, typename Type2 >
-    Type1               dumpName( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
+    Type1               dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type1, typename Type2 >
-    Type1               dumpDec( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
+    Type1               dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type1, typename Type2 >
-    Type1               dumpHex( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
+    Type1               dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type1, typename Type2 >
-    Type1               dumpBin( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
+    Type1               dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type1, typename Type2 >
-    Type1               dumpFix( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
+    Type1               dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type1, typename Type2 >
-    Type1               dumpBool( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
+    Type1               dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
     template< typename Type1, typename Type2 >
     Type1               dumpValue( bool bType1, const ItemFormat& rItemFmt );
 
 private:
-    InputRef            mxIn;
+    BinaryInputStreamRef mxStrm;
 };
 
 typedef ::boost::shared_ptr< InputObjectBase > InputObjectRef;
@@ -1539,56 +1598,56 @@ typedef ::boost::shared_ptr< InputObject
 // ----------------------------------------------------------------------------
 
 template< typename Type >
-Type InputObjectBase::dumpName( const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type InputObjectBase::dumpName( const String& rName, const NameListWrapper& rListWrp )
 {
     Type nData;
-    *mxIn >> nData;
-    writeNameItem( pcName, nData, rListWrp );
+    *mxStrm >> nData;
+    writeNameItem( rName, nData, rListWrp );
     return nData;
 }
 
 template< typename Type >
-Type InputObjectBase::dumpDec( const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type InputObjectBase::dumpDec( const String& rName, const NameListWrapper& rListWrp )
 {
     Type nData;
-    *mxIn >> nData;
-    writeDecItem( pcName, nData, rListWrp );
+    *mxStrm >> nData;
+    writeDecItem( rName, nData, rListWrp );
     return nData;
 }
 
 template< typename Type >
-Type InputObjectBase::dumpHex( const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type InputObjectBase::dumpHex( const String& rName, const NameListWrapper& rListWrp )
 {
     Type nData;
-    *mxIn >> nData;
-    writeHexItem( pcName, nData, rListWrp );
+    *mxStrm >> nData;
+    writeHexItem( rName, nData, rListWrp );
     return nData;
 }
 
 template< typename Type >
-Type InputObjectBase::dumpBin( const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type InputObjectBase::dumpBin( const String& rName, const NameListWrapper& rListWrp )
 {
     Type nData;
-    *mxIn >> nData;
-    writeBinItem( pcName, nData, rListWrp );
+    *mxStrm >> nData;
+    writeBinItem( rName, nData, rListWrp );
     return nData;
 }
 
 template< typename Type >
-Type InputObjectBase::dumpFix( const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type InputObjectBase::dumpFix( const String& rName, const NameListWrapper& rListWrp )
 {
     Type nData;
-    *mxIn >> nData;
-    writeFixItem( pcName, nData, rListWrp );
+    *mxStrm >> nData;
+    writeFixItem( rName, nData, rListWrp );
     return nData;
 }
 
 template< typename Type >
-Type InputObjectBase::dumpBool( const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type InputObjectBase::dumpBool( const String& rName, const NameListWrapper& rListWrp )
 {
     Type nData;
-    *mxIn >> nData;
-    writeDecBoolItem( pcName, nData, rListWrp );
+    *mxStrm >> nData;
+    writeDecBoolItem( rName, nData, rListWrp );
     return nData;
 }
 
@@ -1596,45 +1655,45 @@ template< typename Type >
 Type InputObjectBase::dumpValue( const ItemFormat& rItemFmt )
 {
     Type nData;
-    *mxIn >> nData;
+    *mxStrm >> nData;
     writeValueItem( rItemFmt, nData );
     return nData;
 }
 
 template< typename Type1, typename Type2 >
-Type1 InputObjectBase::dumpName( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type1 InputObjectBase::dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp )
 {
-    return bType1 ? dumpName< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( dumpName< Type2 >( pcName, rListWrp ) );
+    return bType1 ? dumpName< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpName< Type2 >( rName, rListWrp ) );
 }
 
 template< typename Type1, typename Type2 >
-Type1 InputObjectBase::dumpDec( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type1 InputObjectBase::dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp )
 {
-    return bType1 ? dumpDec< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( dumpDec< Type2 >( pcName, rListWrp ) );
+    return bType1 ? dumpDec< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpDec< Type2 >( rName, rListWrp ) );
 }
 
 template< typename Type1, typename Type2 >
-Type1 InputObjectBase::dumpHex( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type1 InputObjectBase::dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp )
 {
-    return bType1 ? dumpHex< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( dumpHex< Type2 >( pcName, rListWrp ) );
+    return bType1 ? dumpHex< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpHex< Type2 >( rName, rListWrp ) );
 }
 
 template< typename Type1, typename Type2 >
-Type1 InputObjectBase::dumpBin( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type1 InputObjectBase::dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp )
 {
-    return bType1 ? dumpBin< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( dumpBin< Type2 >( pcName, rListWrp ) );
+    return bType1 ? dumpBin< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBin< Type2 >( rName, rListWrp ) );
 }
 
 template< typename Type1, typename Type2 >
-Type1 InputObjectBase::dumpFix( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type1 InputObjectBase::dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp )
 {
-    return bType1 ? dumpFix< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( dumpFix< Type2 >( pcName, rListWrp ) );
+    return bType1 ? dumpFix< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpFix< Type2 >( rName, rListWrp ) );
 }
 
 template< typename Type1, typename Type2 >
-Type1 InputObjectBase::dumpBool( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
+Type1 InputObjectBase::dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp )
 {
-    return bType1 ? dumpBool< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( dumpBool< Type2 >( pcName, rListWrp ) );
+    return bType1 ? dumpBool< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBool< Type2 >( rName, rListWrp ) );
 }
 
 template< typename Type1, typename Type2 >
@@ -1644,48 +1703,52 @@ Type1 InputObjectBase::dumpValue( bool b
 }
 
 // ============================================================================
+// ============================================================================
 
-class InputStreamObject : public InputObjectBase
+class BinaryStreamObject : public InputObjectBase
 {
 public:
-    explicit            InputStreamObject( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, BinaryInputStreamRef xStrm );
-    virtual             ~InputStreamObject();
+    explicit            BinaryStreamObject(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rSysFileName );
 
-    inline BinaryInputStream& getStream() { return *mxStrm; }
-    sal_Int64           getStreamSize() const;
+    explicit            BinaryStreamObject(
+                            const OutputObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm );
 
 protected:
-    inline explicit     InputStreamObject() {}
-
-    using               InputObjectBase::construct;
-    void                construct( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, BinaryInputStreamRef xStrm );
-
     void                dumpBinaryStream( bool bShowOffset = true );
 
-    virtual bool        implIsValid() const;
     virtual void        implDump();
-
-private:
-    BinaryInputStreamRef mxStrm;
 };
 
-typedef ::boost::shared_ptr< InputStreamObject > InputStreamObjectRef;
-
-// ============================================================================
 // ============================================================================
 
-class TextStreamObject : public InputStreamObject
+class TextStreamObject : public InputObjectBase
 {
 public:
-    explicit            TextStreamObject( const ObjectBase& rParent,
-                            const ::rtl::OUString& rOutFileName,
-                            BinaryInputStreamRef xStrm, rtl_TextEncoding eTextEnc );
+    explicit            TextStreamObject(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm,
+                            rtl_TextEncoding eTextEnc,
+                            const ::rtl::OUString& rSysFileName );
+
+    explicit            TextStreamObject(
+                            const OutputObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm,
+                            rtl_TextEncoding eTextEnc );
 
 protected:
     virtual void        implDump();
     virtual void        implDumpLine( const ::rtl::OUString& rLine, sal_uInt32 nLine );
 
 private:
+    bool                readCharLine( ::rtl::OUString& orLine, sal_Unicode& orcNextLineChar );
+    bool                readUcs2Line( ::rtl::OUString& orLine, sal_Unicode& orcNextLineChar );
+    bool                readLine( ::rtl::OUString& orLine, sal_Unicode& orcNextLineChar );
+
+private:
     rtl_TextEncoding    meTextEnc;
 };
 
@@ -1694,7 +1757,10 @@ private:
 class XmlStreamObject : public TextStreamObject
 {
 public:
-    explicit            XmlStreamObject( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, BinaryInputStreamRef xStrm );
+    explicit            XmlStreamObject(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rSysFileName );
 
 protected:
     virtual void        implDump();
@@ -1707,122 +1773,97 @@ private:
 // ============================================================================
 // ============================================================================
 
-struct RecordHeaderConfigInfo
+class RecordObjectBase : public InputObjectBase
 {
-    const sal_Char*     mpcTitle;
-    const sal_Char*     mpcRecNames;
-    const sal_Char*     mpcShowRecPos;
-    const sal_Char*     mpcShowRecSize;
-    const sal_Char*     mpcShowRecId;
-    const sal_Char*     mpcShowRecName;
-    const sal_Char*     mpcShowRecBody;
-};
-
-// ============================================================================
-
-class RecordHeaderImplBase : public InputObjectBase
-{
-public:
-    inline const sal_Char* getTitle() const { return mpcTitle; }
-    inline NameListRef  getRecNames() const { return mxRecNames; }
-    inline bool         isShowRecPos() const { return mbShowRecPos; }
-    inline bool         isShowRecSize() const { return mbShowRecSize; }
-    inline bool         isShowRecId() const { return mbShowRecId; }
-    inline bool         isShowRecName() const { return mbShowRecName; }
-    inline bool         isShowRecBody() const { return mbShowRecBody; }
-
 protected:
-    inline explicit     RecordHeaderImplBase() {}
-    virtual             ~RecordHeaderImplBase();
+    inline explicit     RecordObjectBase() {}
 
-    using               InputObjectBase::construct;
-    void                construct( const InputObjectBase& rParent, const RecordHeaderConfigInfo& rCfgInfo );
-
-    virtual bool        implIsValid() const;
-
-private:
-    const sal_Char*     mpcTitle;
-    NameListRef         mxRecNames;
-    bool                mbShowRecPos;
-    bool                mbShowRecSize;
-    bool                mbShowRecId;
-    bool                mbShowRecName;
-    bool                mbShowRecBody;
-};
-
-// ============================================================================
-
-template< typename RecIdType, typename RecSizeType >
-class RecordHeaderBase : public RecordHeaderImplBase
-{
-public:
-    inline bool         isValidHeader() const { return mbValidHeader; }
     inline sal_Int64    getRecPos() const { return mnRecPos; }
-    inline RecIdType    getRecId() const { return mnRecId; }
-    inline RecSizeType  getRecSize() const { return mnRecSize; }
-    inline bool         hasRecName() const { return getRecNames()->hasName( mnRecId ); }
+    inline sal_Int64    getRecId() const { return mnRecId; }
+    inline sal_Int64    getRecSize() const { return mnRecSize; }
+    inline NameListRef  getRecNames() const { return maRecNames.getNameList( cfg() ); }
 
-    bool                startNextRecord();
+    using               InputObjectBase::construct;
+    void                construct(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxBaseStrm,
+                            const ::rtl::OUString& rSysFileName,
+                            const BinaryInputStreamRef& rxRecStrm,
+                            const String& rRecNames,
+                            const String& rSimpleRecs = EMPTY_STRING );
+    void                construct(
+                            const OutputObjectBase& rParent,
+                            const BinaryInputStreamRef& rxBaseStrm,
+                            const BinaryInputStreamRef& rxRecStrm,
+                            const String& rRecNames,
+                            const String& rSimpleRecs = EMPTY_STRING );
 
-protected:
-    using               RecordHeaderImplBase::construct;
-    void                construct( const InputObjectBase& rParent, const RecordHeaderConfigInfo& rCfgInfo );
+    virtual bool        implIsValid() const;
+    virtual void        implDump();
 
-    inline virtual void implDump();
-    virtual bool        implReadHeader( sal_Int64& ornRecPos, RecIdType& ornRecId, RecSizeType& ornRecSize ) = 0;
-    inline virtual void implWriteExtHeader() {}
+    virtual bool        implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
+    virtual void        implWriteExtHeader();
+    virtual void        implDumpRecordBody();
 
 private:
+    void                constructRecObjBase(
+                            const BinaryInputStreamRef& rxBaseStrm,
+                            const String& rRecNames,
+                            const String& rSimpleRecs );
+
     void                writeHeader();
 
 private:
+    BinaryInputStreamRef mxBaseStrm;
+    NameListWrapper     maRecNames;
+    NameListWrapper     maSimpleRecs;
     sal_Int64           mnRecPos;
-    RecIdType           mnRecId;
-    RecSizeType         mnRecSize;
-    bool                mbValidHeader;
+    sal_Int64           mnRecId;
+    sal_Int64           mnRecSize;
 };
 
-// ----------------------------------------------------------------------------
-
-template< typename RecIdType, typename RecSizeType >
-bool RecordHeaderBase< RecIdType, RecSizeType >::startNextRecord()
-{
-    dump();
-    return mbValidHeader;
-}
+// ============================================================================
 
-template< typename RecIdType, typename RecSizeType >
-void RecordHeaderBase< RecIdType, RecSizeType >::construct(
-        const InputObjectBase& rParent, const RecordHeaderConfigInfo& rCfgInfo )
+class SequenceRecordObjectBase : public RecordObjectBase
 {
-    RecordHeaderImplBase::construct( rParent, rCfgInfo );
-    mnRecPos = 0;
-    mnRecId = 0;
-    mnRecSize = 0;
-    mbValidHeader = false;
-}
+protected:
+    inline explicit     SequenceRecordObjectBase() : mxRecData( new StreamDataSequence ) {}
+
+    inline StreamDataSequence& getRecordDataSequence() { return *mxRecData; }
+
+    using               RecordObjectBase::construct;
+    void                construct(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxBaseStrm,
+                            const ::rtl::OUString& rSysFileName,
+                            const BinaryInputStreamRef& rxRecStrm,
+                            const String& rRecNames,
+                            const String& rSimpleRecs = EMPTY_STRING );
+    void                construct(
+                            const OutputObjectBase& rParent,
+                            const BinaryInputStreamRef& rxBaseStrm,
+                            const BinaryInputStreamRef& rxRecStrm,
+                            const String& rRecNames,
+                            const String& rSimpleRecs = EMPTY_STRING );
+    void                construct(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxBaseStrm,
+                            const ::rtl::OUString& rSysFileName,
+                            const String& rRecNames,
+                            const String& rSimpleRecs = EMPTY_STRING );
+    void                construct(
+                            const OutputObjectBase& rParent,
+                            const BinaryInputStreamRef& rxBaseStrm,
+                            const String& rRecNames,
+                            const String& rSimpleRecs = EMPTY_STRING );
 
-template< typename RecIdType, typename RecSizeType >
-inline void RecordHeaderBase< RecIdType, RecSizeType >::implDump()
-{
-    mbValidHeader = implReadHeader( mnRecPos, mnRecId, mnRecSize );
-    if( mbValidHeader )
-    {
-        writeHeader();
-        implWriteExtHeader();
-    }
-}
+    virtual bool        implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+    virtual bool        implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
 
-template< typename RecIdType, typename RecSizeType >
-void RecordHeaderBase< RecIdType, RecSizeType >::writeHeader()
-{
-    MultiItemsGuard aMultiGuard( out() );
-    writeEmptyItem( getTitle() );
-    if( isShowRecPos() )  writeHexItem( "pos", static_cast< sal_uInt32 >( mnRecPos ), "CONV-DEC" );
-    if( isShowRecSize() ) writeHexItem( "size", mnRecSize, "CONV-DEC" );
-    if( isShowRecId() )   writeHexItem( "id", mnRecId );
-    if( isShowRecName() ) writeNameItem( "name", mnRecId, getRecNames() );
-}
+private:
+    typedef ::boost::shared_ptr< StreamDataSequence > StreamDataSeqRef;
+    StreamDataSeqRef    mxRecData;
+};
 
 // ============================================================================
 // ============================================================================
@@ -1837,14 +1878,11 @@ public:
 
     bool                isImportEnabled() const;
 
-    StorageRef          getRootStorage() const;
-    BinaryInputStreamRef getRootStream() const;
-
 protected:
     inline explicit     DumperBase() {}
 
     using               ObjectBase::construct;
-    void                construct( const ::oox::core::FilterBase& rFilter, ConfigRef xConfig );
+    void                construct( const ConfigRef& rxConfig );
 };
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/dump/oledumper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/oledumper.hxx
--- oox/inc/oox/dump/oledumper.hxx	1970-01-01 01:00:00.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/oledumper.hxx	2008-10-06 16:28:34.000000000 +0200
@@ -0,0 +1,763 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: oledumper.hxx,v $
+ * $Revision: 1.1.2.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_DUMP_OLEDUMPER_HXX
+#define OOX_DUMP_OLEDUMPER_HXX
+
+#include "oox/helper/storagebase.hxx"
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace com { namespace sun { namespace star {
+    namespace io { class XInputStream; }
+} } }
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+// ============================================================================
+
+class StdFontObject : public InputObjectBase
+{
+public:
+    explicit            StdFontObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDump();
+};
+
+// ============================================================================
+
+class StdPicObject : public InputObjectBase
+{
+public:
+    explicit            StdPicObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDump();
+};
+
+// ============================================================================
+
+class StdHlinkObject : public InputObjectBase
+{
+public:
+    explicit            StdHlinkObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDump();
+
+private:
+    ::rtl::OUString     dumpHyperlinkString( const String& rName, bool bUnicode );
+
+    bool                dumpGuidAndMoniker();
+    void                dumpUrlMoniker();
+    void                dumpFileMoniker();
+    void                dumpItemMoniker();
+    void                dumpAntiMoniker();
+    void                dumpCompositeMoniker();
+};
+
+// ============================================================================
+// ============================================================================
+
+class OlePropertyStreamObject : public BinaryStreamObject
+{
+public:
+    explicit            OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
+
+protected:
+    virtual void        implDump();
+
+private:
+    void                dumpSection( const ::rtl::OUString& rGuid, sal_uInt32 nStartPos );
+
+    void                dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos );
+    void                dumpCodePageProperty( sal_uInt32 nStartPos );
+    void                dumpDictionaryProperty( sal_uInt32 nStartPos );
+
+    void                dumpPropertyContents( sal_Int32 nPropId );
+    void                dumpPropertyValue( sal_Int32 nPropId, sal_Int32 nBaseType );
+
+    sal_Int32           dumpPropertyType();
+    void                dumpBlob( const String& rName );
+    ::rtl::OUString     dumpString8( const String& rName );
+    ::rtl::OUString     dumpCharArray8( const String& rName, sal_Int32 nLen );
+    ::rtl::OUString     dumpString16( const String& rName );
+    ::rtl::OUString     dumpCharArray16( const String& rName, sal_Int32 nLen );
+
+    bool                startElement( sal_uInt32 nStartPos );
+    void                writeSectionHeader( const ::rtl::OUString& rGuid, sal_uInt32 nStartPos );
+    void                writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos );
+
+private:
+    NameListRef         mxPropIds;
+    rtl_TextEncoding    meTextEnc;
+    bool                mbIsUnicode;
+};
+
+// ============================================================================
+
+class OleStorageObject : public StorageObjectBase
+{
+public:
+    explicit            OleStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const ::rtl::OUString& rSysPath );
+
+protected:
+    inline explicit     OleStorageObject() {}
+
+    using               StorageObjectBase::construct;
+    void                construct( const ObjectBase& rParent, const StorageRef& rxStrg, const ::rtl::OUString& rSysPath );
+    void                construct( const ObjectBase& rParent );
+
+    virtual void        implDumpStream(
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rStrgPath,
+                            const ::rtl::OUString& rStrmName,
+                            const ::rtl::OUString& rSysFileName );
+};
+
+// ============================================================================
+// ============================================================================
+
+struct OcxFormSiteInfo
+{
+    ::rtl::OUString     maProgId;
+    sal_Int32           mnId;
+    sal_uInt32          mnLength;
+    bool                mbInStream;
+
+    inline explicit     OcxFormSiteInfo() : mnId( 0 ), mnLength( 0 ), mbInStream( false ) {}
+};
+
+typedef ::std::vector< OcxFormSiteInfo > OcxFormSiteInfoVector;
+
+// ----------------------------------------------------------------------------
+
+struct OcxFormSharedData
+{
+    OUStringVector      maClassInfoProgIds;
+    OcxFormSiteInfoVector maSiteInfos;
+};
+
+// ============================================================================
+// ============================================================================
+
+class OcxPropertyObjectBase : public InputObjectBase
+{
+protected:
+    inline explicit     OcxPropertyObjectBase() {}
+
+    using               InputObjectBase::construct;
+    void                construct(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rSysFileName,
+                            const String& rPropNameList,
+                            bool b64BitPropFlags = false );
+    void                construct(
+                            const OutputObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm,
+                            const String& rPropNameList,
+                            bool b64BitPropFlags = false );
+    void                construct(
+                            const InputObjectBase& rParent,
+                            const String& rPropNameList,
+                            bool b64BitPropFlags = false );
+
+    virtual bool        implIsValid() const;
+    virtual void        implDump();
+
+    virtual void        implDumpShortProperties();
+    virtual void        implDumpExtended();
+
+    bool                ensureValid( bool bCondition = true );
+
+    template< typename Type >
+    void                alignInput();
+
+    void                setAlignAnchor();
+    bool                startNextProperty();
+    ::rtl::OUString     getPropertyName() const;
+
+    template< typename Type >
+    Type                dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
+    template< typename Type >
+    Type                dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
+
+    inline bool         dumpBoolProperty() { return startNextProperty(); }
+    inline sal_Int32    dumpHmmProperty() { return dumpDecProperty< sal_Int32 >( 0, "CONV-HMM-TO-CM" ); }
+    inline sal_uInt8    dumpMousePtrProperty() { return dumpDecProperty< sal_uInt8 >( 0, "OCX-MOUSEPTR" ); }
+    template< typename Type >
+    inline Type         dumpBorderStyleProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "OCX-BORDERSTYLE" ); }
+    template< typename Type >
+    inline Type         dumpSpecialEffectProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "OCX-SPECIALEFFECT" ); }
+    inline sal_uInt32   dumpEnabledProperty() { return dumpDecProperty< sal_uInt32 >( 1, "OCX-ENABLED" ); }
+    inline sal_Int32    dumpOrientationProperty() { return dumpDecProperty< sal_Int32 >( -1, "OCX-ORIENTATION" ); }
+    inline sal_Int32    dumpDelayProperty() { return dumpDecProperty< sal_Int32 >( 50, "OCX-CONV-MS" ); }
+    inline sal_uInt32   dumpImagePosProperty() { return dumpHexProperty< sal_uInt32 >( 0x00070001, "OCX-IMAGEPOS" ); }
+    inline sal_uInt8    dumpImageSizeModeProperty() { return dumpDecProperty< sal_uInt8 >( 0, "OCX-IMAGESIZEMODE" ); }
+    inline sal_uInt8    dumpImageAlignProperty() { return dumpDecProperty< sal_uInt8 >( 2, "OCX-IMAGEALIGN" ); }
+
+    sal_uInt32          dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList = "OCX-FLAGS" );
+    sal_uInt32          dumpColorProperty( sal_uInt32 nDefault );
+    sal_Unicode         dumpUnicodeProperty();
+    void                dumpUnknownProperty();
+
+    void                dumpPosProperty();
+    void                dumpSizeProperty();
+    void                dumpGuidProperty( ::rtl::OUString* pValue = 0 );
+    void                dumpStringProperty( ::rtl::OUString* pValue = 0 );
+    void                dumpStringArrayProperty();
+    void                dumpStreamProperty();
+
+    void                dumpEmbeddedFont();
+    void                dumpToPosition( sal_Int64 nPos );
+
+private:
+    void                constructOcxPropObj( const String& rPropNameList, bool b64BitPropFlags );
+
+    void                dumpVersion();
+    ::rtl::OUString     dumpString( const String& rName, sal_uInt32 nSize, bool bArray );
+    void                dumpShortProperties();
+    void                dumpLargeProperties();
+
+private:
+    struct LargeProperty
+    {
+        enum LargePropertyType { PROPTYPE_POS, PROPTYPE_SIZE, PROPTYPE_GUID, PROPTYPE_STRING, PROPTYPE_STRINGARRAY };
+
+        LargePropertyType   mePropType;
+        ::rtl::OUString     maItemName;
+        sal_uInt32          mnDataSize;
+        ::rtl::OUString*    mpItemValue;
+        inline explicit     LargeProperty( LargePropertyType ePropType, const String& rItemName, sal_uInt32 nDataSize, ::rtl::OUString* pItemValue = 0 ) :
+                                mePropType( ePropType ), maItemName( rItemName ), mnDataSize( nDataSize ), mpItemValue( pItemValue ) {}
+    };
+    typedef ::std::vector< LargeProperty > LargePropertyVector;
+
+    struct StreamProperty
+    {
+        ::rtl::OUString     maItemName;
+        sal_uInt16          mnData;
+        inline explicit     StreamProperty( const String& rItemName, sal_uInt16 nData ) :
+                                maItemName( rItemName ), mnData( nData ) {}
+    };
+    typedef ::std::vector< StreamProperty > StreamPropertyVector;
+
+    LargePropertyVector maLargeProps;
+    StreamPropertyVector maStreamProps;
+    NameListRef         mxPropNames;
+    sal_Int64           mnPropertiesStart;
+    sal_Int64           mnPropertiesEnd;
+    sal_Int64           mnPropFlags;
+    sal_Int64           mnCurrProp;
+    bool                mb64BitPropFlags;
+    bool                mbValid;
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void OcxPropertyObjectBase::alignInput()
+{
+    in().skip( (sizeof( Type ) - ((in().tell() - mnPropertiesStart) % sizeof( Type ))) % sizeof( Type ) );
+}
+
+template< typename Type >
+Type OcxPropertyObjectBase::dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp )
+{
+    if( startNextProperty() )
+    {
+        alignInput< Type >();
+        return dumpDec< Type >( getPropertyName(), rListWrp );
+    }
+    return nDefault;
+}
+
+template< typename Type >
+Type OcxPropertyObjectBase::dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp )
+{
+    if( startNextProperty() )
+    {
+        alignInput< Type >();
+        return dumpHex< Type >( getPropertyName(), rListWrp );
+    }
+    return nDefault;
+}
+
+// ============================================================================
+
+class OcxCFontNewObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxCFontNewObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+};
+
+// ============================================================================
+
+class OcxColumnInfoObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxColumnInfoObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+};
+
+// ============================================================================
+
+class OcxCommandButtonObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxCommandButtonObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+    virtual void        implDumpExtended();
+};
+
+// ============================================================================
+
+class OcxMorphControlObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxMorphControlObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+    virtual void        implDumpExtended();
+
+private:
+    void                dumpColumnInfos();
+
+private:
+    sal_uInt16          mnColInfoCount;
+    sal_uInt8           mnCtrlType;
+};
+
+// ============================================================================
+
+class OcxLabelObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxLabelObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+    virtual void        implDumpExtended();
+};
+
+// ============================================================================
+
+class OcxImageObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxImageObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+};
+
+// ============================================================================
+
+class OcxScrollBarObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxScrollBarObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+};
+
+// ============================================================================
+
+class OcxSpinButtonObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxSpinButtonObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+};
+
+// ============================================================================
+
+class OcxTabStripObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxTabStripObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+    virtual void        implDumpExtended();
+
+private:
+    sal_Int32           mnTabFlagCount;
+};
+
+// ============================================================================
+
+class OcxControlObject : public InputObjectBase
+{
+public:
+    explicit            OcxControlObject(
+                            const InputObjectBase& rParent,
+                            const ::rtl::OUString& rProgId,
+                            sal_Int64 nLength );
+
+protected:
+    virtual void        implDump();
+
+private:
+    ::rtl::OUString     maProgId;
+    sal_Int64           mnLength;
+};
+
+// ============================================================================
+
+class OcxGuidControlObject : public InputObjectBase
+{
+public:
+    explicit            OcxGuidControlObject(
+                            const InputObjectBase& rParent,
+                            sal_Int64 nLength );
+
+protected:
+    virtual void        implDump();
+
+private:
+    sal_Int64           mnLength;
+};
+
+// ============================================================================
+
+class OcxControlsStreamObject : public InputObjectBase
+{
+public:
+    explicit            OcxControlsStreamObject(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rSysFileName,
+                            OcxFormSharedData& rFormData );
+
+protected:
+    virtual void        implDump();
+
+private:
+    OcxFormSharedData&  mrFormData;
+};
+
+// ============================================================================
+// ============================================================================
+
+class OcxPageObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxPageObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+};
+
+// ============================================================================
+
+class OcxMultiPageObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxMultiPageObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+    virtual void        implDumpExtended();
+
+private:
+    sal_Int32           mnPageCount;
+};
+
+// ============================================================================
+
+class OcxMultiPageStreamObject : public InputObjectBase
+{
+public:
+    explicit            OcxMultiPageStreamObject(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rSysFileName,
+                            OcxFormSharedData& rFormData );
+
+protected:
+    virtual void        implDump();
+
+private:
+    OcxFormSharedData&  mrFormData;
+};
+
+// ============================================================================
+// ============================================================================
+
+class OcxFormClassInfoObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxFormClassInfoObject( const InputObjectBase& rParent, OcxFormSharedData& rFormData );
+
+protected:
+    virtual void        implDumpShortProperties();
+
+private:
+    OcxFormSharedData&  mrFormData;
+};
+
+// ============================================================================
+
+class OcxFormSiteObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxFormSiteObject( const InputObjectBase& rParent, OcxFormSharedData& rFormData );
+
+protected:
+    virtual void        implDumpShortProperties();
+
+private:
+    OcxFormSharedData&  mrFormData;
+};
+
+// ============================================================================
+
+class OcxFormDesignExtObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxFormDesignExtObject( const InputObjectBase& rParent );
+
+protected:
+    virtual void        implDumpShortProperties();
+};
+
+// ============================================================================
+
+class OcxFormObject : public OcxPropertyObjectBase
+{
+public:
+    explicit            OcxFormObject(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rSysFileName,
+                            OcxFormSharedData& rFormData );
+
+protected:
+    virtual void        implDumpShortProperties();
+    virtual void        implDumpExtended();
+
+private:
+    void                dumpClassInfos();
+    void                dumpFormSites( sal_uInt32 nCount );
+    void                dumpSiteData();
+    void                dumpDesignExtender();
+
+private:
+    OcxFormSharedData&  mrFormData;
+    sal_uInt32          mnFlags;
+};
+
+// ============================================================================
+
+class OcxFormStorageObject : public OleStorageObject
+{
+public:
+    explicit            OcxFormStorageObject(
+                            const ObjectBase& rParent,
+                            const StorageRef& rxStrg,
+                            const ::rtl::OUString& rSysPath );
+
+protected:
+    virtual void        implDumpStream(
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rStrgPath,
+                            const ::rtl::OUString& rStrmName,
+                            const ::rtl::OUString& rSysFileName );
+
+    virtual void        implDumpStorage(
+                            const StorageRef& rxStrg,
+                            const ::rtl::OUString& rStrgPath,
+                            const ::rtl::OUString& rSysPath );
+
+private:
+    bool                isFormStorage( const ::rtl::OUString& rStrgPath ) const;
+
+private:
+    OcxFormSharedData   maFormData;
+};
+
+// ============================================================================
+// ============================================================================
+
+struct VbaSharedData
+{
+    typedef ::std::map< ::rtl::OUString, sal_Int32 > StreamOffsetMap;
+
+    StreamOffsetMap     maStrmOffsets;
+    rtl_TextEncoding    meTextEnc;
+
+    explicit            VbaSharedData();
+
+    bool                isModuleStream( const ::rtl::OUString& rStrmName ) const;
+    sal_Int32           getStreamOffset( const ::rtl::OUString& rStrmName ) const;
+};
+
+// ============================================================================
+
+class VbaDirStreamObject : public SequenceRecordObjectBase
+{
+public:
+    explicit            VbaDirStreamObject(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rSysFileName,
+                            VbaSharedData& rVbaData );
+
+protected:
+    virtual bool        implIsValid() const;
+    virtual bool        implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+    virtual void        implDumpRecordBody();
+
+private:
+    ::rtl::OUString     dumpByteString( const String& rName = EMPTY_STRING );
+    ::rtl::OUString     dumpUniString( const String& rName = EMPTY_STRING );
+
+    ::rtl::OUString     dumpByteStringWithLength( const String& rName = EMPTY_STRING );
+
+private:
+    VbaSharedData&      mrVbaData;
+    BinaryInputStreamRef mxInStrm;
+    ::rtl::OUString     maCurrStream;
+    sal_Int32           mnCurrOffset;
+};
+
+// ============================================================================
+
+class VbaModuleStreamObject : public InputObjectBase
+{
+public:
+    explicit            VbaModuleStreamObject(
+                            const ObjectBase& rParent,
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rSysFileName,
+                            VbaSharedData& rVbaData,
+                            sal_Int32 nStrmOffset );
+
+protected:
+    virtual void        implDump();
+
+private:
+    VbaSharedData&      mrVbaData;
+    sal_Int32           mnStrmOffset;
+};
+
+// ============================================================================
+
+class VbaStorageObject : public OleStorageObject
+{
+public:
+    explicit            VbaStorageObject(
+                            const ObjectBase& rParent,
+                            const StorageRef& rxStrg,
+                            const ::rtl::OUString& rSysPath,
+                            VbaSharedData& rVbaData );
+
+protected:
+    virtual void        implDumpStream(
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rStrgPath,
+                            const ::rtl::OUString& rStrmName,
+                            const ::rtl::OUString& rSysFileName );
+
+private:
+    VbaSharedData&      mrVbaData;
+};
+
+// ============================================================================
+
+class VbaFormStorageObject : public OcxFormStorageObject
+{
+public:
+    explicit            VbaFormStorageObject(
+                            const ObjectBase& rParent,
+                            const StorageRef& rxStrg,
+                            const ::rtl::OUString& rSysPath,
+                            VbaSharedData& rVbaData );
+
+protected:
+    virtual void        implDumpStream(
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rStrgPath,
+                            const ::rtl::OUString& rStrmName,
+                            const ::rtl::OUString& rSysFileName );
+
+private:
+    VbaSharedData&      mrVbaData;
+};
+
+// ============================================================================
+
+class VbaProjectStorageObject : public OleStorageObject
+{
+public:
+    explicit            VbaProjectStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const ::rtl::OUString& rSysPath );
+
+protected:
+    virtual void        implDumpStream(
+                            const BinaryInputStreamRef& rxStrm,
+                            const ::rtl::OUString& rStrgPath,
+                            const ::rtl::OUString& rStrmName,
+                            const ::rtl::OUString& rSysFileName );
+
+    virtual void        implDumpStorage(
+                            const StorageRef& rxStrg,
+                            const ::rtl::OUString& rStrgPath,
+                            const ::rtl::OUString& rSysPath );
+
+private:
+    VbaSharedData       maVbaData;
+};
+
+// ============================================================================
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/dump/olestoragedumper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/olestoragedumper.hxx
--- oox/inc/oox/dump/olestoragedumper.hxx	2008-04-10 16:36:19.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/olestoragedumper.hxx	1970-01-01 01:00:00.000000000 +0100
@@ -1,91 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: olestoragedumper.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef OOX_DUMP_OLESTORAGEDUMPER_HXX
-#define OOX_DUMP_OLESTORAGEDUMPER_HXX
-
-#include "oox/helper/storagebase.hxx"
-#include "oox/dump/dumperbase.hxx"
-
-#if OOX_INCLUDE_DUMPER
-
-namespace com { namespace sun { namespace star {
-    namespace io { class XInputStream; }
-} } }
-
-namespace oox {
-namespace dump {
-
-// ============================================================================
-
-class OlePropertyStreamObject : public InputStreamObject
-{
-public:
-    explicit            OlePropertyStreamObject( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, BinaryInputStreamRef xStrm );
-
-protected:
-    virtual void        implDump();
-
-private:
-    void                dumpSection( const ::rtl::OUString& rGuid, sal_uInt32 nStartPos );
-
-    void                dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos );
-    void                dumpCodePageProperty( sal_uInt32 nStartPos );
-    void                dumpDictionaryProperty( sal_uInt32 nStartPos );
-
-    void                dumpPropertyContents( sal_Int32 nPropId );
-    void                dumpPropertyValue( sal_Int32 nPropId, sal_Int32 nBaseType );
-
-    sal_Int32           dumpPropertyType();
-    void                dumpBlob( const sal_Char* pcName );
-    ::rtl::OUString     dumpString8( const sal_Char* pcName );
-    ::rtl::OUString     dumpCharArray8( const sal_Char* pcName, sal_Int32 nCharCount );
-    ::rtl::OUString     dumpString16( const sal_Char* pcName );
-    ::rtl::OUString     dumpCharArray16( const sal_Char* pcName, sal_Int32 nCharCount );
-    ::com::sun::star::util::DateTime dumpFileTime( const sal_Char* pcName );
-
-    bool                startElement( sal_uInt32 nStartPos );
-    void                writeSectionHeader( const ::rtl::OUString& rGuid, sal_uInt32 nStartPos );
-    void                writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos );
-
-private:
-    NameListRef         mxPropIds;
-    rtl_TextEncoding    meTextEnc;
-    bool                mbIsUnicode;
-};
-
-// ============================================================================
-
-} // namespace dump
-} // namespace oox
-
-#endif
-#endif
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/dump/pptxdumper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/pptxdumper.hxx
--- oox/inc/oox/dump/pptxdumper.hxx	2008-04-10 16:36:33.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/pptxdumper.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -41,17 +41,17 @@ namespace pptx {
 
 // ============================================================================
 
-class RootStorageObject : public RootStorageObjectBase
+class RootStorageObject : public StorageObjectBase
 {
 public:
     explicit            RootStorageObject( const DumperBase& rParent );
 
 protected:
     virtual void        implDumpStream(
-                            BinaryInputStreamRef xStrm,
+                            const BinaryInputStreamRef& rxStrm,
                             const ::rtl::OUString& rStrgPath,
                             const ::rtl::OUString& rStrmName,
-                            const ::rtl::OUString& rSystemFileName );
+                            const ::rtl::OUString& rSysFileName );
 };
 
 // ============================================================================
@@ -61,6 +61,11 @@ class Dumper : public DumperBase
 public:
     explicit            Dumper( const ::oox::core::FilterBase& rFilter );
 
+    explicit            Dumper(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+                            const ::rtl::OUString& rSysFileName );
+
 protected:
     virtual void        implDump();
 };
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/dump/xlsbdumper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/xlsbdumper.hxx
--- oox/inc/oox/dump/xlsbdumper.hxx	2008-04-10 16:37:08.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/dump/xlsbdumper.hxx	2008-10-06 16:28:34.000000000 +0200
@@ -47,58 +47,19 @@ namespace oox {
 namespace dump {
 namespace xlsb {
 
-typedef ::boost::shared_ptr< RecordInputStream > RecordInputStreamRef;
-
-// ============================================================================
-
-class RecordStreamInput : public Input
-{
-public:
-    explicit            RecordStreamInput();
-    virtual             ~RecordStreamInput();
-
-    void                createStream( const RecordDataSequence& rData );
-    inline RecordInputStream& getStream() { return *mxStrm; }
-
-    virtual sal_Int64   getSize() const;
-    virtual sal_Int64   tell() const;
-    virtual void        seek( sal_Int64 nPos );
-    virtual void        skip( sal_Int32 nBytes );
-    virtual sal_Int32   read( void* pBuffer, sal_Int32 nBytes );
-
-    virtual RecordStreamInput& operator>>( sal_Int8& rnData );
-    virtual RecordStreamInput& operator>>( sal_uInt8& rnData );
-    virtual RecordStreamInput& operator>>( sal_Int16& rnData );
-    virtual RecordStreamInput& operator>>( sal_uInt16& rnData );
-    virtual RecordStreamInput& operator>>( sal_Int32& rnData );
-    virtual RecordStreamInput& operator>>( sal_uInt32& rnData );
-    virtual RecordStreamInput& operator>>( float& rfData );
-    virtual RecordStreamInput& operator>>( double& rfData );
-
-protected:
-    virtual bool        implIsValid() const;
-
-private:
-    RecordInputStreamRef mxStrm;
-};
-
-typedef ::boost::shared_ptr< RecordStreamInput > RecordStreamInputRef;
-
 // ============================================================================
 
-class RecordObjectBase : public InputObjectBase
+class RecordObjectBase : public SequenceRecordObjectBase
 {
 protected:
     explicit            RecordObjectBase();
     virtual             ~RecordObjectBase();
 
-    void                construct( const OutputObjectBase& rParent );
+    using               SequenceRecordObjectBase::construct;
+    void                construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
     void                construct( const RecordObjectBase& rParent );
 
-    virtual bool        implIsValid() const;
-
-    void                createRecordStream( const RecordDataSequence& rData );
-    inline RecordInputStream& getRecordStream() const { return mxStrmIn->getStream(); }
+    virtual bool        implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
 
     ::rtl::OUString     getErrorName( sal_uInt8 nErrCode ) const;
 
@@ -110,37 +71,36 @@ protected:
 
     // ------------------------------------------------------------------------
 
-    void                writeBooleanItem( const sal_Char* pcName, sal_uInt8 nBool );
-    void                writeErrorCodeItem( const sal_Char* pcName, sal_uInt8 nErrCode );
+    void                writeBooleanItem( const String& rName, sal_uInt8 nBool );
+    void                writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode );
 
     void                writeFontPortions( const ::oox::xls::BinFontPortionList& rPortions );
     void                writePhoneticPortions( const ::oox::xls::BinPhoneticPortionList& rPhonetics );
 
     // ------------------------------------------------------------------------
 
-    sal_uInt8           dumpBoolean( const sal_Char* pcName = 0 );
-    sal_uInt8           dumpErrorCode( const sal_Char* pcName = 0 );
-    ::rtl::OUString     dumpString( const sal_Char* pcName = 0, bool bRich = false, bool b32BitLen = true );
-    void                dumpColor( const sal_Char* pcName = 0 );
-
-    sal_Int32           dumpColIndex( const sal_Char* pcName = 0 );
-    sal_Int32           dumpRowIndex( const sal_Char* pcName = 0 );
-    sal_Int32           dumpColRange( const sal_Char* pcName = 0 );
-    sal_Int32           dumpRowRange( const sal_Char* pcName = 0 );
-
-    Address             dumpAddress( const sal_Char* pcName = 0 );
-    Range               dumpRange( const sal_Char* pcName = 0 );
-    void                dumpRangeList( const sal_Char* pcName = 0 );
+    sal_uInt8           dumpBoolean( const String& rName = EMPTY_STRING );
+    sal_uInt8           dumpErrorCode( const String& rName = EMPTY_STRING );
+    ::rtl::OUString     dumpString( const String& rName = EMPTY_STRING, bool bRich = false, bool b32BitLen = true );
+    void                dumpColor( const String& rName = EMPTY_STRING );
+
+    sal_Int32           dumpColIndex( const String& rName = EMPTY_STRING );
+    sal_Int32           dumpRowIndex( const String& rName = EMPTY_STRING );
+    sal_Int32           dumpColRange( const String& rName = EMPTY_STRING );
+    sal_Int32           dumpRowRange( const String& rName = EMPTY_STRING );
+
+    Address             dumpAddress( const String& rName = EMPTY_STRING );
+    Range               dumpRange( const String& rName = EMPTY_STRING );
+    void                dumpRangeList( const String& rName = EMPTY_STRING );
 
     // ------------------------------------------------------------------------
-
-    using               InputObjectBase::construct;
-
 private:
-    void                constructRecObjBase();
+    bool                readCompressedInt( BinaryInputStream& rStrm, sal_Int32& ornValue );
 
 private:
-    RecordStreamInputRef mxStrmIn;
+    typedef ::boost::shared_ptr< RecordInputStream > RecordInputStreamRef;
+
+    RecordInputStreamRef mxStrm;
     NameListRef         mxErrCodes;
 };
 
@@ -152,8 +112,8 @@ public:
     explicit            FormulaObject( const RecordObjectBase& rParent );
     virtual             ~FormulaObject();
 
-    void                dumpCellFormula( const sal_Char* pcName = 0 );
-    void                dumpNameFormula( const sal_Char* pcName = 0 );
+    void                dumpCellFormula( const String& rName = EMPTY_STRING );
+    void                dumpNameFormula( const String& rName = EMPTY_STRING );
 
 protected:
     virtual void        implDump();
@@ -161,7 +121,7 @@ protected:
 private:
     void                constructFmlaObj();
 
-    void                dumpFormula( const sal_Char* pcName, bool bNameMode );
+    void                dumpFormula( const String& rName, bool bNameMode );
 
     TokenAddress        createTokenAddress( sal_Int32 nCol, sal_Int32 nRow, bool bRelC, bool bRelR, bool bNameMode ) const;
     ::rtl::OUString     createRef( const ::rtl::OUString& rData ) const;
@@ -171,8 +131,8 @@ private:
 
     ::rtl::OUString     writeFuncIdItem( sal_uInt16 nFuncId, const ::oox::xls::FunctionInfo** oppFuncInfo = 0 );
 
-    sal_Int32           dumpTokenCol( const sal_Char* pcName, bool& rbRelC, bool& rbRelR );
-    sal_Int32           dumpTokenRow( const sal_Char* pcName );
+    sal_Int32           dumpTokenCol( const String& rName, bool& rbRelC, bool& rbRelR );
+    sal_Int32           dumpTokenRow( const String& rName );
     TokenAddress        dumpTokenAddress( bool bNameMode );
     TokenRange          dumpTokenRange( bool bNameMode );
 
@@ -198,9 +158,9 @@ private:
     void                dumpMemFuncToken( const ::rtl::OUString& rTokClass );
     void                dumpMemAreaToken( const ::rtl::OUString& rTokClass, bool bAddData );
 
-    void                dumpExpToken( const StringWrapper& rName );
-    void                dumpUnaryOpToken( const StringWrapper& rLOp, const StringWrapper& rROp );
-    void                dumpBinaryOpToken( const StringWrapper& rOp );
+    void                dumpExpToken( const String& rName );
+    void                dumpUnaryOpToken( const String& rLOp, const String& rROp );
+    void                dumpBinaryOpToken( const String& rOp );
     void                dumpFuncToken( const ::rtl::OUString& rTokClass );
     void                dumpFuncVarToken( const ::rtl::OUString& rTokClass );
     bool                dumpTableToken();
@@ -233,92 +193,44 @@ private:
     FuncProvRef         mxFuncProv;
     AddDataTypeVec      maAddData;
     ::rtl::OUString     maRefPrefix;
-    const sal_Char*     mpcName;
+    ::rtl::OUString     maName;
     sal_Int32           mnSize;
     bool                mbNameMode;
 };
 
-typedef ::boost::shared_ptr< FormulaObject > FormulaObjectRef;
-
 // ============================================================================
 
-class RecordObject : public RecordObjectBase
+class RecordStreamObject : public RecordObjectBase
 {
 public:
-    explicit            RecordObject( OutputObjectBase& rParent );
-
-    void                dumpRecord( const RecordDataSequence& rData, sal_Int32 nRecId );
-
+    explicit            RecordStreamObject( ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
 
 protected:
     virtual bool        implIsValid() const;
-    virtual void        implDump();
+    virtual void        implDumpRecordBody();
 
 private:
     void                dumpCellHeader( bool bWithColumn );
-    void                dumpSimpleRecord( const ::rtl::OUString& rRecData );
-    void                dumpRecordBody();
 
 private:
-    FormulaObjectRef    mxFmlaObj;
-    NameListRef         mxSimpleRecs;
-    sal_Int32           mnRecId;
-};
-
-typedef ::boost::shared_ptr< RecordObject > RecordObjectRef;
-
-// ============================================================================
-
-class RecordHeaderObject : public RecordHeaderBase< sal_Int32, sal_Int32 >
-{
-public:
-    explicit            RecordHeaderObject( const InputObjectBase& rParent );
-    virtual             ~RecordHeaderObject();
-
-    inline const RecordDataSequence& getRecordData() const { return maData; }
-
-protected:
-    virtual bool        implReadHeader( sal_Int64& ornRecPos, sal_Int32& ornRecId, sal_Int32& ornRecSize );
-
-private:
-    bool                readByte( sal_Int64& ornRecPos, sal_uInt8& ornByte );
-    bool                readCompressedInt( sal_Int64& ornRecPos, sal_Int32& ornValue );
-
-private:
-    RecordDataSequence  maData;
-};
-
-typedef ::boost::shared_ptr< RecordHeaderObject > RecordHeaderObjectRef;
-
-// ============================================================================
-
-class RecordStreamObject : public InputStreamObject
-{
-public:
-    explicit            RecordStreamObject( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, BinaryInputStreamRef xStrm );
-
-protected:
-    virtual bool        implIsValid() const;
-    virtual void        implDump();
+    typedef ::boost::shared_ptr< FormulaObject > FormulaObjectRef;
 
-private:
-    RecordHeaderObjectRef mxHdrObj;
-    RecordObjectRef     mxRecObj;
+    FormulaObjectRef    mxFmlaObj;
 };
 
 // ============================================================================
 
-class RootStorageObject : public RootStorageObjectBase
+class RootStorageObject : public StorageObjectBase
 {
 public:
     explicit            RootStorageObject( const DumperBase& rParent );
 
 protected:
     virtual void        implDumpStream(
-                            BinaryInputStreamRef xStrm,
+                            const BinaryInputStreamRef& rxStrm,
                             const ::rtl::OUString& rStrgPath,
                             const ::rtl::OUString& rStrmName,
-                            const ::rtl::OUString& rSystemFileName );
+                            const ::rtl::OUString& rSysFileName );
 };
 
 // ============================================================================
@@ -328,6 +240,11 @@ class Dumper : public DumperBase
 public:
     explicit            Dumper( const ::oox::core::FilterBase& rFilter );
 
+    explicit            Dumper(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+                            const ::rtl::OUString& rSysFileName );
+
 protected:
     virtual void        implDump();
 };
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/helper/binaryinputstream.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/binaryinputstream.hxx
--- oox/inc/oox/helper/binaryinputstream.hxx	2008-04-10 16:37:54.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/binaryinputstream.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -32,21 +32,79 @@
 #define OOX_HELPER_BINARYINPUTSTREAM_HXX
 
 #include <boost/shared_ptr.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
 #include "oox/helper/binarystreambase.hxx"
 
-namespace com { namespace sun { namespace star {
-    namespace io { class XInputStream; }
-} } }
-
 namespace oox {
 
 // ============================================================================
 
-/** Wraps a binary input stream and provides convenient access functions.
+/** Interface for binary input stream classes.
+
+    The binary data in the stream is assumed to be in little-endian format.
+ */
+class BinaryInputStream : public virtual BinaryStreamBase
+{
+public:
+    /** Derived classes implement reading nBytes bytes to the passed sequence.
+        @return  Number of bytes really read. */
+    virtual sal_Int32   readData( StreamDataSequence& orData, sal_Int32 nBytes ) = 0;
+    /** Derived classes implement reading nBytes bytes to the (existing) buffer opMem.
+        @return  Number of bytes really read. */
+    virtual sal_Int32   readMemory( void* opMem, sal_Int32 nBytes ) = 0;
+    /** Derived classes implement seeking the stream forward by the passed
+        number of bytes. This should work for non-seekable streams too. */
+    virtual void        skip( sal_Int32 nBytes ) = 0;
+
+    /** Reads a value from the stream and converts it to platform byte order.
+        Supported types: SAL integers (8 to 64 bit), float, double. */
+    template< typename Type >
+    void                readValue( Type& ornValue );
+    /** Reads a value from the stream and converts it to platform byte order.
+        Supported types: SAL integers (8 to 64 bit), float, double. */
+    template< typename Type >
+    inline Type         readValue() { Type nValue; readValue( nValue ); return nValue; }
+    /** Stream operator for integral and floating-point types. */
+    template< typename Type >
+    inline BinaryInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+
+    inline sal_Int8     readInt8() { return readValue< sal_Int8 >(); }
+    inline sal_uInt8    readuInt8() { return readValue< sal_uInt8 >(); }
+    inline sal_Int16    readInt16() { return readValue< sal_Int16 >(); }
+    inline sal_uInt16   readuInt16() { return readValue< sal_uInt16 >(); }
+    inline sal_Int32    readInt32() { return readValue< sal_Int32 >(); }
+    inline sal_uInt32   readuInt32() { return readValue< sal_uInt32 >(); }
+    inline sal_Int64    readInt64() { return readValue< sal_Int64 >(); }
+    inline sal_uInt64   readuInt64() { return readValue< sal_uInt64 >(); }
+    inline float        readFloat() { return readValue< float >(); }
+    inline double       readDouble() { return readValue< double >(); }
+
+private:
+    /** Used by the readValue() template functions to read built-in types.
+        @descr  Derived classes may overwrite this default implementation which
+            simply calls readMemory() with something own. */
+    virtual void        readAtom( void* opMem, sal_uInt8 nSize );
+};
+
+typedef ::boost::shared_ptr< BinaryInputStream > BinaryInputStreamRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void BinaryInputStream::readValue( Type& ornValue )
+{
+    // can be instanciated for all types supported in class ByteOrderConverter
+    readAtom( &ornValue, static_cast< sal_Int32 >( sizeof( Type ) ) );
+    ByteOrderConverter::convertLittleEndian( ornValue );
+}
+
+// ============================================================================
+
+/** Wraps a com.sun.star.io.XInputStream and provides convenient access functions.
 
     The binary data in the stream is assumed to be in little-endian format.
  */
-class BinaryInputStream : public BinaryStreamBase
+class BinaryXInputStream : public BinaryXSeekableStream, public BinaryInputStream
 {
 public:
     /** Constructs the wrapper object for the passed input stream.
@@ -56,63 +114,75 @@ public:
         @param bAutoClose  True = automatically close the wrapped input stream
             on destruction of this wrapper.
      */
-    explicit            BinaryInputStream(
+    explicit            BinaryXInputStream(
                             const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
                             bool bAutoClose );
 
-    virtual             ~BinaryInputStream();
-
-    /** Returns true, if the wrapped stream is valid. */
-    inline bool         is() const { return mxInStrm.is(); }
-    /** Returns the XInputStream interface of the wrapped input stream. */
-    inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
-                        getXInputStream() const { return mxInStrm; }
-
-    /** Seeks the stream forward by the passed number of bytes. This works for
-        non-seekable streams too. */
-    void                skip( sal_Int32 nBytes );
+    virtual             ~BinaryXInputStream();
 
     /** Reads nBytes bytes to the passed sequence.
         @return  Number of bytes really read. */
-    sal_Int32           read( ::com::sun::star::uno::Sequence< sal_Int8 >& orBuffer, sal_Int32 nBytes );
-    /** Reads nBytes bytes to the (existing) buffer pBuffer.
+    virtual sal_Int32   readData( StreamDataSequence& orData, sal_Int32 nBytes );
+    /** Reads nBytes bytes to the (existing) buffer opMem.
         @return  Number of bytes really read. */
-    sal_Int32           read( void* opBuffer, sal_Int32 nBytes );
+    virtual sal_Int32   readMemory( void* opMem, sal_Int32 nBytes );
+    /** Seeks the stream forward by the passed number of bytes. This works for
+        non-seekable streams too. */
+    virtual void        skip( sal_Int32 nBytes );
 
-    /** Reads a value from the stream and converts it to platform byte order. */
+    /** Stream operator for integral and floating-point types. */
     template< typename Type >
-    void                readValue( Type& ornValue );
-    /** Reads a value from the stream and converts it to platform byte order. */
-    template< typename Type >
-    inline Type         readValue() { Type nValue; readValue( nValue ); return nValue; }
+    inline BinaryXInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
 
+    /** Returns the XInputStream interface of the wrapped input stream. */
+    inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+                        getXInputStream() const { return mxInStrm; }
     /** Closes the wrapped XInputStream. */
     void                close();
 
 private:
+    StreamDataSequence  maBuffer;       /// Data buffer used in readMemory() function.
     ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
                         mxInStrm;       /// Reference to the input stream.
     bool                mbAutoClose;    /// True = automatically close stream on destruction.
 };
 
-typedef ::boost::shared_ptr< BinaryInputStream > BinaryInputStreamRef;
+typedef ::boost::shared_ptr< BinaryXInputStream > BinaryXInputStreamRef;
 
-// ----------------------------------------------------------------------------
+// ============================================================================
 
-template< typename Type >
-void BinaryInputStream::readValue( Type& ornValue )
+/** Wraps a StreamDataSequence and provides convenient access functions.
+
+    The binary data in the stream is assumed to be in little-endian format.
+ */
+class SequenceInputStream : public SequenceSeekableStream, public BinaryInputStream
 {
-    // can be instanciated for all types supported in class ByteOrderConverter
-    read( &ornValue, static_cast< sal_Int32 >( sizeof( Type ) ) );
-    ByteOrderConverter::convertLittleEndian( ornValue );
-}
+public:
+    /** Constructs the wrapper object for the passed data sequence.
 
+        @attention
+            The passed data sequence MUST live at least as long as this stream
+            wrapper. The data sequence MUST NOT be changed from outside as long
+            as this stream wrapper is used to read from it.
+     */
+    explicit            SequenceInputStream( StreamDataSequence& rData );
+
+    /** Reads nBytes bytes to the passed sequence.
+        @return  Number of bytes really read. */
+    virtual sal_Int32   readData( StreamDataSequence& orData, sal_Int32 nBytes );
+    /** Reads nBytes bytes to the (existing) buffer opMem.
+        @return  Number of bytes really read. */
+    virtual sal_Int32   readMemory( void* opMem, sal_Int32 nBytes );
+    /** Seeks the stream forward by the passed number of bytes. This works for
+        non-seekable streams too. */
+    virtual void        skip( sal_Int32 nBytes );
+
+    /** Stream operator for integral and floating-point types. */
 template< typename Type >
-inline BinaryInputStream& operator>>( BinaryInputStream& rInStrm, Type& ornValue )
-{
-    rInStrm.readValue( ornValue );
-    return rInStrm;
-}
+    inline SequenceInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+};
+
+typedef ::boost::shared_ptr< SequenceInputStream > SequenceInputStreamRef;
 
 // ============================================================================
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/helper/binaryoutputstream.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/binaryoutputstream.hxx
--- oox/inc/oox/helper/binaryoutputstream.hxx	2008-04-10 16:38:19.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/binaryoutputstream.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -32,23 +32,64 @@
 #define OOX_HELPER_BINARYOUTPUTSTREAM_HXX
 
 #include <boost/shared_ptr.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
 #include "oox/helper/binarystreambase.hxx"
 
-namespace com { namespace sun { namespace star {
-    namespace io { class XOutputStream; }
-} } }
-
 namespace oox {
 
 class BinaryInputStream;
 
 // ============================================================================
 
-/** Wraps a binary output stream and provides convenient access functions.
+/** Interface for binary output stream classes.
+
+    The binary data in the stream is written in little-endian format.
+ */
+class BinaryOutputStream : public virtual BinaryStreamBase
+{
+public:
+    /** Derived classes implement writing the passed data sequence. */
+    virtual void        writeData( const StreamDataSequence& rData ) = 0;
+    /** Derived classes implement writing from the (existing) buffer pMem. */
+    virtual void        writeMemory( const void* pMem, sal_Int32 nBytes ) = 0;
+
+    /** Copies nBytes bytes from the current position of the passed input stream. */
+    void                copyStream( BinaryInputStream& rInStrm, sal_Int64 nBytes = SAL_MAX_INT64 );
+
+    /** Writes a value to the stream and converts it to platform byte order.
+        Supported types: SAL integers (8 to 64 bit), float, double. */
+    template< typename Type >
+    void                writeValue( Type nValue );
+    /** Stream operator for integral and floating-point types. */
+    template< typename Type >
+    inline BinaryOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
+
+private:
+    /** Used by the writeValue() template function to write built-in types.
+        @descr  Derived classes may overwrite this default implementation which
+            simply calls writeMemory() with something own. */
+    virtual void        writeAtom( const void* pMem, sal_uInt8 nSize );
+};
+
+typedef ::boost::shared_ptr< BinaryOutputStream > BinaryOutputStreamRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void BinaryOutputStream::writeValue( Type nValue )
+{
+    // can be instanciated for all types supported in class ByteOrderConverter
+    ByteOrderConverter::convertLittleEndian( nValue );
+    writeMemory( &nValue, static_cast< sal_Int32 >( sizeof( Type ) ) );
+}
+
+// ============================================================================
+
+/** Wraps a com.sun.star.io.XOutputStream and provides convenient access functions.
 
     The binary data in the stream is written in little-endian format.
  */
-class BinaryOutputStream : public BinaryStreamBase
+class BinaryXOutputStream : public BinaryXSeekableStream, public BinaryOutputStream
 {
 public:
     /** Constructs the wrapper object for the passed output stream.
@@ -58,57 +99,65 @@ public:
         @param bAutoClose  True = automatically close the wrapped output stream
             on destruction of this wrapper.
      */
-    explicit            BinaryOutputStream(
+    explicit            BinaryXOutputStream(
                             const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm,
                             bool bAutoClose );
 
-    virtual             ~BinaryOutputStream();
+    virtual             ~BinaryXOutputStream();
 
-    /** Returns true, if the wrapped stream is valid. */
-    inline bool         is() const { return mxOutStrm.is(); }
-    /** Returns the XOutputStream interface of the wrapped output stream. */
-    inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
-                        getXOutputStream() const { return mxOutStrm; }
-
-    /** Writes the passed sequence. */
-    void                write( const ::com::sun::star::uno::Sequence< sal_Int8 >& rBuffer );
-    /** Writes nBytes bytes from the (existing) buffer pBuffer. */
-    void                write( const void* pBuffer, sal_Int32 nBytes );
+    /** Writes the passed data sequence. */
+    virtual void        writeData( const StreamDataSequence& rData );
+    /** Write nBytes bytes from the (existing) buffer pMem. */
+    virtual void        writeMemory( const void* pMem, sal_Int32 nBytes );
 
-    /** Writes a value to the stream and converts it to platform byte order. */
+    /** Stream operator for integral and floating-point types. */
     template< typename Type >
-    void                writeValue( Type nValue );
-
-    /** Copies nBytes bytes from the current position of the passed input stream. */
-    void                copy( BinaryInputStream& rInStrm, sal_Int64 nBytes = SAL_MAX_INT32 );
+    inline BinaryXOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
 
+    /** Returns the XOutputStream interface of the wrapped output stream. */
+    inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+                        getXOutputStream() const { return mxOutStrm; }
     /** Flushes and closes the wrapped XOutputStream. */
     void                close();
 
 private:
+    StreamDataSequence  maBuffer;       /// Data buffer used in writeMemory() function.
     ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
                         mxOutStrm;      /// Reference to the output stream.
     bool                mbAutoClose;    /// True = automatically close stream on destruction.
 };
 
-typedef ::boost::shared_ptr< BinaryOutputStream > BinaryOutputStreamRef;
+typedef ::boost::shared_ptr< BinaryXOutputStream > BinaryXOutputStreamRef;
 
-// ----------------------------------------------------------------------------
+// ============================================================================
 
-template< typename Type >
-void BinaryOutputStream::writeValue( Type nValue )
+/** Wraps a StreamDataSequence and provides convenient access functions.
+
+    The binary data in the stream is written in little-endian format.
+ */
+class SequenceOutputStream : public SequenceSeekableStream, public BinaryOutputStream
 {
-    // can be instanciated for all types supported in class ByteOrderConverter
-    ByteOrderConverter::convertLittleEndian( nValue );
-    write( &nValue, static_cast< sal_Int32 >( sizeof( Type ) ) );
-}
+public:
+    /** Constructs the wrapper object for the passed data sequence.
 
+        @attention
+            The passed data sequence MUST live at least as long as this stream
+            wrapper. The data sequence MUST NOT be changed from outside as long
+            as this stream wrapper is used to write to it.
+     */
+    explicit            SequenceOutputStream( StreamDataSequence& rData );
+
+    /** Writes the passed data sequence. */
+    virtual void        writeData( const StreamDataSequence& rData );
+    /** Write nBytes bytes from the (existing) buffer pMem. */
+    virtual void        writeMemory( const void* pMem, sal_Int32 nBytes );
+
+    /** Stream operator for integral and floating-point types. */
 template< typename Type >
-inline BinaryOutputStream& operator<<( BinaryOutputStream& rOutStrm, Type nValue )
-{
-    rOutStrm.writeValue( nValue );
-    return rOutStrm;
-}
+    inline SequenceOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
+};
+
+typedef ::boost::shared_ptr< SequenceOutputStream > SequenceOutputStreamRef;
 
 // ============================================================================
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/helper/binarystreambase.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/binarystreambase.hxx
--- oox/inc/oox/helper/binarystreambase.hxx	2008-04-10 16:38:37.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/binarystreambase.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -37,53 +37,102 @@
 
 namespace oox {
 
+typedef ::com::sun::star::uno::Sequence< sal_Int8 > StreamDataSequence;
+
 // ============================================================================
 
-/** Base class for binary input and output streams. */
+/** Base interface for seekable binary stream classes. */
 class BinaryStreamBase
 {
 public:
-    template< typename Interface >
-    explicit            BinaryStreamBase(
-                            const ::com::sun::star::uno::Reference< Interface >& rxStrm );
-
     virtual             ~BinaryStreamBase();
 
-    /** Returns true, if the wrapped stream is seekable. */
-    inline bool         isSeekable() const { return mxSeekable.is(); }
-    /** Returns the XSeekable interface of the wrapped stream. */
-    inline ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable >
-                        getXSeekable() const { return mxSeekable; }
+    /** Derived classes return whether the stream is seekable. default: false. */
+    virtual bool        isSeekable() const;
+    /** Derived classes returns the size of the stream, if seekable, otherwise/default: -1. */
+    virtual sal_Int64   getLength() const;
+    /** Derived classes return the current stream position, if seekable, otherwise/default: -1. */
+    virtual sal_Int64   tell() const;
+    /** Derived classes implment seeking the stream to the passed position, if seekable. */
+    virtual void        seek( sal_Int64 nPos );
+
+    /** Returns true, if the stream position is invalid (EOF). This flag turns
+        true *after* the first attempt to seek/read beyond the stream end. */
+    inline bool         isEof() const { return mbEof; }
 
-    /** Returns the size of the stream, if stream is seekable, otherwise -1. */
-    sal_Int64           getLength() const;
-    /** Returns the current stream position, if stream is seekable, otherwise -1. */
-    sal_Int64           tell() const;
-
-    /** Seeks the stream to the passed position, if stream is seekable. */
-    void                seek( sal_Int64 nPos );
+    /** Returns the size of the remaining data, if stream is seekable, otherwise -1. */
+    sal_Int64           getRemaining() const;
     /** Seeks the stream to the beginning, if stream is seekable. */
     inline void         seekToStart() { seek( 0 ); }
     /** Seeks the stream to the end, if stream is seekable. */
     inline void         seekToEnd() { seek( getLength() ); }
 
 protected:
-    ::com::sun::star::uno::Sequence< sal_Int8 >
-                        maBuffer;       /// Data buffer.
+    inline explicit     BinaryStreamBase() : mbEof( false ) {}
+
+private:
+                        BinaryStreamBase( const BinaryStreamBase& );
+    BinaryStreamBase&   operator=( const BinaryStreamBase& );
+
+protected:
+    bool                mbEof;
+};
+
+// ============================================================================
+
+/** Base class for binary input and output streams wrapping an API stream,
+    seekable via the com.sun.star.io.XSeekable interface.
+ */
+class BinaryXSeekableStream : public virtual BinaryStreamBase
+{
+public:
+    /** Returns true, if the wrapped stream is seekable. */
+    virtual bool        isSeekable() const;
+    /** Returns the size of the stream, if stream is seekable, otherwise -1. */
+    virtual sal_Int64   getLength() const;
+    /** Returns the current stream position, if stream is seekable, otherwise -1. */
+    virtual sal_Int64   tell() const;
+    /** Seeks the stream to the passed position, if stream is seekable. */
+    virtual void        seek( sal_Int64 nPos );
+
+protected:
+    explicit            BinaryXSeekableStream(
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable >& rxSeekable );
 
 private:
     ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable >
                         mxSeekable;     /// Stream seeking interface.
 };
 
-// ----------------------------------------------------------------------------
+// ============================================================================
 
-template< typename Interface >
-BinaryStreamBase::BinaryStreamBase( const ::com::sun::star::uno::Reference< Interface >& rxStrm ) :
-    maBuffer( 0x8000 ),
-    mxSeekable( rxStrm, ::com::sun::star::uno::UNO_QUERY )
+/** Base class for binary input and output streams wrapping a StreamDataSequence. */
+class SequenceSeekableStream : public virtual BinaryStreamBase
 {
-}
+public:
+    /** Returns true, if the wrapped stream is seekable. */
+    virtual bool        isSeekable() const;
+    /** Returns the size of the stream, if stream is seekable, otherwise -1. */
+    virtual sal_Int64   getLength() const;
+    /** Returns the current stream position, if stream is seekable, otherwise -1. */
+    virtual sal_Int64   tell() const;
+    /** Seeks the stream to the passed position, if stream is seekable. */
+    virtual void        seek( sal_Int64 nPos );
+
+protected:
+    /** Constructs the wrapper object for the passed data sequence.
+
+        @attention
+            The passed data sequence MUST live at least as long as this stream
+            wrapper. The data sequence MUST NOT be changed from outside as long
+            as this stream wrapper is used to modify it.
+     */
+    inline explicit     SequenceSeekableStream( StreamDataSequence& rData ) : mrData( rData ), mnPos( 0 ) {}
+
+protected:
+    StreamDataSequence& mrData;         /// Wrapped data sequence.
+    sal_Int32           mnPos;          /// Current position in the sequence.
+};
 
 // ============================================================================
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/helper/containerhelper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/containerhelper.hxx
--- oox/inc/oox/helper/containerhelper.hxx	2008-07-22 15:23:30.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/containerhelper.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -214,7 +214,7 @@ public:
     typedef typename container_type::iterator           iterator;
     typedef typename container_type::const_iterator     const_iterator;
 
-    inline explicit     Matrix() : mnWidth( 0 ) {};
+    inline explicit     Matrix() : mnWidth( 0 ) {}
     inline explicit     Matrix( size_type nWidth, size_type nHeight ) { this->resize( nWidth, nHeight ); }
     inline explicit     Matrix( size_type nWidth, size_type nHeight, const_reference rData ) { this->resize( nWidth, nHeight, rData ); }
 
@@ -273,7 +273,7 @@ public:
 
     /** Creates a new index container object from scratch. */
     static ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
-                        createIndexContainer();
+                        createIndexContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory );
 
     /** Inserts an object into an indexed container.
 
@@ -295,7 +295,7 @@ public:
 
     /** Creates a new name container object from scratch. */
     static ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
-                        createNameContainer();
+                        createNameContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory );
 
     /** Returns a name that is not used in the passed name container.
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/helper/olestorage.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/olestorage.hxx
--- oox/inc/oox/helper/olestorage.hxx	2008-04-10 16:40:04.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/olestorage.hxx	2009-01-06 14:16:56.000000000 +0100
@@ -54,7 +54,7 @@ public:
 
     explicit            OleStorage(
                             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
-                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream,
                             bool bBaseStreamAccess );
 
     virtual             ~OleStorage();
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/helper/recordinputstream.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/recordinputstream.hxx
--- oox/inc/oox/helper/recordinputstream.hxx	2008-04-10 16:41:56.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/recordinputstream.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -31,89 +31,27 @@
 #ifndef OOX_HELPER_RECORDINPUTSTREAM_HXX
 #define OOX_HELPER_RECORDINPUTSTREAM_HXX
 
-#include <com/sun/star/uno/Sequence.hxx>
-#include "oox/helper/helper.hxx"
+#include "oox/helper/binaryinputstream.hxx"
 
 namespace oox {
 
 // ============================================================================
 
-typedef ::com::sun::star::uno::Sequence< sal_Int8 > RecordDataSequence;
-
-// ----------------------------------------------------------------------------
-
-/** Buffers the contents of a record from a binary OOBIN stream. */
-class RecordInputStream
+/** Reads the contents of a record from a binary OOBIN stream. */
+class RecordInputStream : public SequenceInputStream
 {
 public:
-    explicit            RecordInputStream( const RecordDataSequence& rData );
-
-    /** Returns record reading state: false = record overread. */
-    inline bool         isValid() const { return mbValid; }
-    /** Returns the record size. */
-    inline sal_Int32    getRecSize() const { return mnRecSize; }
-    /** Returns the current read position in the record body. */
-    inline sal_Int32    getRecPos() const { return mnRecPos; }
-    /** Returns the number of remaining bytes in the record body. */
-    inline sal_Int32    getRecLeft() const { return mnRecSize - mnRecPos; }
-
-    /** Reads nBytes bytes, writes them to the existing buffer pData. */
-    sal_Int32           read( void* opData, sal_Int32 nBytes );
-
-    /** Reads a value from the stream and converts it to platform byte order. */
-    template< typename Type >
-    void                readValue( Type& ornValue );
-    /** Reads a value from the stream and converts it to platform byte order. */
-    template< typename Type >
-    inline Type         readValue() { Type nValue; readValue( nValue ); return nValue; }
-
-    inline sal_Int8     readInt8() { return readValue< sal_Int8 >(); }
-    inline sal_uInt8    readuInt8() { return readValue< sal_uInt8 >(); }
-    inline sal_Int16    readInt16() { return readValue< sal_Int16 >(); }
-    inline sal_uInt16   readuInt16() { return readValue< sal_uInt16 >(); }
-    inline sal_Int32    readInt32() { return readValue< sal_Int32 >(); }
-    inline sal_uInt32   readuInt32() { return readValue< sal_uInt32 >(); }
-    inline sal_Int64    readInt64() { return readValue< sal_Int64 >(); }
-    inline sal_uInt64   readuInt64() { return readValue< sal_uInt64 >(); }
-    inline float        readFloat() { return readValue< float >(); }
-    inline double       readDouble() { return readValue< double >(); }
+    explicit            RecordInputStream( StreamDataSequence& rData );
 
     /** Reads a string with leading 16-bit or 32-bit length field. */
     ::rtl::OUString     readString( bool b32BitLen = true );
 
-    /** Seeks to the passed record position. */
-    void                seek( sal_Int32 nRecPos );
-    /** Ignores nBytes bytes. */
-    void                skip( sal_Int32 nBytes );
-
-private:
-    RecordDataSequence  maData;             /// Reference to record data.
-    sal_Int32           mnRecSize;          /// Current record size.
-    sal_Int32           mnRecPos;           /// Current position in record body.
-    bool                mbValid;            /// False = record overread.
-};
-
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-inline void RecordInputStream::readValue( Type& ornValue )
-{
-    read( &ornValue, static_cast< sal_Int32 >( sizeof( Type ) ) );
-    ByteOrderConverter::convertLittleEndian( ornValue );
-}
-
+    /** Stream operator for integral types. */
 template< typename Type >
-inline RecordInputStream& operator>>( RecordInputStream& rStrm, Type& ornValue )
-{
-    rStrm.readValue( ornValue );
-    return rStrm;
-}
-
-inline RecordInputStream& operator>>( RecordInputStream& rStrm, ::rtl::OUString& orString )
-{
-    orString = rStrm.readString();
-    return rStrm;
-}
+    inline RecordInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+    /** Stream operator for an ::rtl::OUString, reads 32-bit string length and Unicode array. */
+    inline RecordInputStream& operator>>( ::rtl::OUString& orString ) { orString = readString(); return *this; }
+};
 
 // ============================================================================
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/helper/storagebase.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/storagebase.hxx
--- oox/inc/oox/helper/storagebase.hxx	2008-04-10 16:42:16.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/storagebase.hxx	2009-01-06 14:16:56.000000000 +0100
@@ -36,11 +36,13 @@
 #include <boost/shared_ptr.hpp>
 #include <rtl/ustring.hxx>
 #include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
 
 namespace com { namespace sun { namespace star {
     namespace embed { class XStorage; }
     namespace io { class XInputStream; }
     namespace io { class XOutputStream; }
+    namespace io { class XStream; }
 } } }
 
 namespace oox {
@@ -56,7 +58,7 @@ typedef ::boost::shared_ptr< StorageBase
     for ZIP storages containing XML streams, and OLE storages containing binary
     data streams.
  */
-class StorageBase
+class OOX_DLLPUBLIC StorageBase
 {
 public:
     explicit            StorageBase(
@@ -64,7 +66,7 @@ public:
                             bool bBaseStreamAccess );
 
     explicit            StorageBase(
-                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream,
                             bool bBaseStreamAccess );
 
     virtual             ~StorageBase();
@@ -117,6 +119,10 @@ public:
     ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
                         openOutputStream( const ::rtl::OUString& rStreamName );
 
+    /** Commits the changes to the storage and all the substorages. (in case it is transacted object)
+     */
+    void commit();
+
 protected:
     /** Special constructor for sub storage objects. */
     explicit            StorageBase( const StorageBase& rParentStorage, const ::rtl::OUString& rStorageName );
@@ -151,11 +157,11 @@ private:
 private:
     typedef ::std::map< ::rtl::OUString, StorageRef >                               SubStorageMap;
     typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >  XInputStreamRef;
-    typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > XOutputStreamRef;
+    typedef ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > XStreamRef;
 
     SubStorageMap       maSubStorages;      /// Map of direct sub storages.
     XInputStreamRef     mxInStream;         /// Cached base input stream (to keep it alive).
-    XOutputStreamRef    mxOutStream;        /// Cached base output stream (to keep it alive).
+    XStreamRef          mxStream;           /// Cached base output stream (to keep it alive).
     ::rtl::OUString     maStorageName;      /// Name of this storage, if it is a substorage.
     const StorageBase*  mpParentStorage;    /// Parent storage if this is a sub storage.
     bool                mbBaseStreamAccess; /// True = access base streams with empty stream name.
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/helper/zipstorage.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/zipstorage.hxx
--- oox/inc/oox/helper/zipstorage.hxx	2008-04-10 16:42:33.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/helper/zipstorage.hxx	2009-01-06 14:16:56.000000000 +0100
@@ -51,7 +51,7 @@ public:
 
     explicit            ZipStorage(
                             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory,
-                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStream );
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxStream );
 
     virtual             ~ZipStorage();
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/ole/vbainputstream.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/ole/vbainputstream.hxx
--- oox/inc/oox/ole/vbainputstream.hxx	1970-01-01 01:00:00.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/ole/vbainputstream.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: vbainputstream.hxx,v $
+ * $Revision: 1.1.2.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_HELPER_VBAINPUTSTREAM_HXX
+#define OOX_HELPER_VBAINPUTSTREAM_HXX
+
+#include <vector>
+#include "oox/helper/binaryinputstream.hxx"
+
+namespace oox {
+namespace ole {
+
+// ============================================================================
+
+/** A non-seekable input stream that implements run-length decompression. */
+class VbaInputStream : public BinaryInputStream
+{
+public:
+    explicit            VbaInputStream( BinaryInputStream& rInStrm );
+
+    /** Reads nBytes bytes to the passed sequence.
+        @return  Number of bytes really read. */
+    virtual sal_Int32   readData( StreamDataSequence& orData, sal_Int32 nBytes );
+    /** Reads nBytes bytes to the (existing) buffer opMem.
+        @return  Number of bytes really read. */
+    virtual sal_Int32   readMemory( void* opMem, sal_Int32 nBytes );
+    /** Seeks the stream forward by the passed number of bytes. */
+    virtual void        skip( sal_Int32 nBytes );
+
+private:
+    /** If no data left in chunk buffer, reads the next chunk from stream. */
+    bool                updateChunk();
+
+private:
+    typedef ::std::vector< sal_uInt8 > ChunkBuffer;
+
+    BinaryInputStream&  mrInStrm;
+    ChunkBuffer         maChunk;
+    size_t              mnChunkPos;
+};
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
+#endif
+
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/ppt/timenode.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/ppt/timenode.hxx
--- oox/inc/oox/ppt/timenode.hxx	2008-07-22 15:26:21.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/ppt/timenode.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -70,7 +70,8 @@ namespace oox { namespace ppt {
 		void setId( sal_Int32 nId );
 		const ::rtl::OUString & getId() const { return msId; }
 
-		void addNode( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &rxModel,
+        void addNode(
+            const ::oox::core::XmlFilterBase& rFilter,
 									const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rxNode,
 									const SlidePersistPtr & slide);
 		// data setters
@@ -80,8 +81,10 @@ namespace oox { namespace ppt {
 		void setTransitionFilter( const SlideTransition & aTransition)
 			{ maTransitionFilter = aTransition; }
 
-		void setNode( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &rxModel,
-					  const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const SlidePersistPtr & pSlide );
+        void setNode(
+            const ::oox::core::XmlFilterBase& rFilter,
+            const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
+            const SlidePersistPtr & pSlide );
 
 		AnimTargetElementPtr getTarget()
 			{
@@ -105,8 +108,9 @@ namespace oox { namespace ppt {
 		static rtl::OUString getServiceName( sal_Int16 nNodeType );
 
 		::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >
-		createAndInsert( const rtl::OUString& rServiceName,
-										 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &rxModel,
+        createAndInsert(
+            const ::oox::core::XmlFilterBase& rFilter,
+            const rtl::OUString& rServiceName,
 										 const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rxNode );
 
 	private:
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/addressconverter.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/addressconverter.hxx
--- oox/inc/oox/xls/addressconverter.hxx	2008-04-10 16:49:28.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/addressconverter.hxx	2009-01-06 15:57:48.000000000 +0100
@@ -210,6 +210,18 @@ inline BiffOutputStream& operator<<( Bif
 }
 
 // ============================================================================
+
+/** Different target types that can be encoded in a BIFF URL. */
+enum BiffTargetType
+{
+    BIFF_TARGETTYPE_URL,            /// URL, URL with sheet name, or sheet name.
+    BIFF_TARGETTYPE_SAMESHEET,      /// Target for special '!A1' syntax to refer to current sheet.
+    BIFF_TARGETTYPE_LIBRARY,        /// Library directory in application installation.
+    BIFF_TARGETTYPE_DDE_OLE,        /// DDE server/topic or OLE class/target.
+    BIFF_TARGETTYPE_UNKNOWN         /// Unknown/unsupported target type.
+};
+
+// ============================================================================
 // ============================================================================
 
 /** Converter for cell addresses and cell ranges for OOX and BIFF filters.
@@ -277,16 +289,14 @@ public:
         @param orClassName  (out-parameter) DDE server name or OLE class name.
         @param orTargetUrl  (out-parameter) Target URL, DDE topic or OLE object name.
         @param orSheetName  (out-parameter) Sheet name in target document.
-        @param orbSameSheet  (out-parameter)  True = target for special '!A1' syntax.
         @param rBiffEncoded  Encoded name of the external link target.
 
-        @return  true = Parsed string was valid, return values can be used.
+        @return  Type of the decoded target.
       */
-    bool                parseBiffTargetUrl(
+    BiffTargetType      parseBiffTargetUrl(
                             ::rtl::OUString& orClassName,
                             ::rtl::OUString& orTargetUrl,
                             ::rtl::OUString& orSheetName,
-                            bool& orbSameSheet,
                             const ::rtl::OUString& rBiffTargetUrl );
 
     // ------------------------------------------------------------------------
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/bifffragmenthandler.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/bifffragmenthandler.hxx
--- oox/inc/oox/xls/bifffragmenthandler.hxx	2008-04-10 16:50:46.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/bifffragmenthandler.hxx	1970-01-01 01:00:00.000000000 +0100
@@ -1,118 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: bifffragmenthandler.hxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef OOX_XLS_BIFFFRAGMENTHANDLER_HXX
-#define OOX_XLS_BIFFFRAGMENTHANDLER_HXX
-
-#include "oox/xls/worksheethelper.hxx"
-
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-/** An enumeration for all types of fragments in a BIFF workbook stream. */
-enum BiffFragmentType
-{
-    BIFF_FRAGMENT_GLOBALS,      /// Workbook globals fragment.
-    BIFF_FRAGMENT_WORKSHEET,    /// Worksheet fragment.
-    BIFF_FRAGMENT_CHARTSHEET,   /// Chart sheet fragment.
-    BIFF_FRAGMENT_MACROSHEET,   /// Macro sheet fragment.
-    BIFF_FRAGMENT_MODULESHEET,  /// BIFF5 VB module fragment.
-    BIFF_FRAGMENT_EMPTYSHEET,   /// Sheet fragment of unsupported type.
-    BIFF_FRAGMENT_WORKSPACE,    /// BIFF4 workspace/workbook globals.
-    BIFF_FRAGMENT_UNKNOWN       /// Unknown fragment/error.
-};
-
-// ============================================================================
-
-class BiffFragmentHandler
-{
-public:
-    inline explicit     BiffFragmentHandler() {}
-    virtual             ~BiffFragmentHandler();
-
-    /** Imports the fragment, returns true, if EOF record has been reached. */
-    virtual bool        importFragment( BiffInputStream& rStrm );
-
-protected:
-    /** @return  True = passed record identifier is a BOF record. */
-    static bool         isBofRecord( sal_uInt16 nRecId );
-
-    /** Starts a new fragment in a workbbok stream and returns the fragment type.
-
-        The passed stream must point before a BOF record. The function will
-        try to start the next record and read the contents of the BOF record,
-        if extant.
-
-        @return  Fragment type according to the imported BOF record.
-     */
-    static BiffFragmentType startFragment( BiffInputStream& rStrm, BiffType eBiff );
-
-    /** Skips the current fragment (processes embedded BOF/EOF blocks correctly).
-
-        Skips all records until next EOF record. When this function returns,
-        stream points to the EOF record, and the next call of startNextRecord()
-        at the stream will start the record following the EOF record.
-
-        @return  True = stream points to the EOF record of the current fragment.
-     */
-    static bool         skipFragment( BiffInputStream& rStrm );
-};
-
-// ============================================================================
-
-class BiffWorkbookFragmentBase : public BiffFragmentHandler, public WorkbookHelper
-{
-public:
-    explicit            BiffWorkbookFragmentBase( const WorkbookHelper& rHelper );
-};
-
-// ============================================================================
-
-class BiffWorksheetFragmentBase : public BiffFragmentHandler, public WorksheetHelperRoot
-{
-public:
-    explicit            BiffWorksheetFragmentBase(
-                            const WorkbookHelper& rHelper,
-                            ISegmentProgressBarRef xProgressBar,
-                            WorksheetType eSheetType,
-                            sal_Int32 nSheet );
-
-    explicit            BiffWorksheetFragmentBase( const WorksheetHelper& rHelper );
-};
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
-
-#endif
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/biffhelper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/biffhelper.hxx
--- oox/inc/oox/xls/biffhelper.hxx	2008-04-10 16:52:13.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/biffhelper.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -75,6 +75,8 @@ const sal_Int32 OOBIN_ID_COLORS         
 const sal_Int32 OOBIN_ID_COLORSCALE         = 0x01D5;
 const sal_Int32 OOBIN_ID_COLS               = 0x0186;
 const sal_Int32 OOBIN_ID_CONDFORMATTING     = 0x01CD;
+const sal_Int32 OOBIN_ID_CONTROL            = 0x0284;
+const sal_Int32 OOBIN_ID_CONTROLS           = 0x0283;
 const sal_Int32 OOBIN_ID_CUSTOMCHARTVIEW    = 0x028F;
 const sal_Int32 OOBIN_ID_CUSTOMCHARTVIEWS   = 0x028D;
 const sal_Int32 OOBIN_ID_CUSTOMSHEETVIEW    = 0x01A7;
@@ -126,6 +128,7 @@ const sal_Int32 OOBIN_ID_HEADERFOOTER   
 const sal_Int32 OOBIN_ID_HYPERLINK          = 0x01EE;
 const sal_Int32 OOBIN_ID_ICONSET            = 0x01D1;
 const sal_Int32 OOBIN_ID_INDEXEDCOLORS      = 0x0235;
+const sal_Int32 OOBIN_ID_LEGACYDRAWING      = 0x0227;
 const sal_Int32 OOBIN_ID_MERGECELL          = 0x00B0;
 const sal_Int32 OOBIN_ID_MERGECELLS         = 0x00B1;
 const sal_Int32 OOBIN_ID_MRUCOLORS          = 0x0239;
@@ -139,6 +142,8 @@ const sal_Int32 OOBIN_ID_MULTCELL_SI    
 const sal_Int32 OOBIN_ID_MULTCELL_STRING    = 0x0011;
 const sal_Int32 OOBIN_ID_NUMFMT             = 0x002C;
 const sal_Int32 OOBIN_ID_NUMFMTS            = 0x0267;
+const sal_Int32 OOBIN_ID_OLEOBJECT          = 0x027F;
+const sal_Int32 OOBIN_ID_OLEOBJECTS         = 0x027E;
 const sal_Int32 OOBIN_ID_PAGEMARGINS        = 0x01DC;
 const sal_Int32 OOBIN_ID_PAGESETUP          = 0x01DE;
 const sal_Int32 OOBIN_ID_PANE               = 0x0097;
@@ -273,6 +278,7 @@ const sal_uInt16 BIFF_ID_COLINFO        
 const sal_uInt16 BIFF_ID_COLUMNDEFAULT      = 0x0020;
 const sal_uInt16 BIFF_ID_COLWIDTH           = 0x0024;
 const sal_uInt16 BIFF_ID_CONT               = 0x003C;
+const sal_uInt16 BIFF_ID_COORDLIST          = 0x00A9;
 const sal_uInt16 BIFF_ID_CRN                = 0x005A;
 const sal_uInt16 BIFF2_ID_DATATABLE         = 0x0036;
 const sal_uInt16 BIFF3_ID_DATATABLE         = 0x0236;
@@ -315,6 +321,8 @@ const sal_uInt16 BIFF_ID_HEADER         
 const sal_uInt16 BIFF_ID_HIDEOBJ            = 0x008D;
 const sal_uInt16 BIFF_ID_HORPAGEBREAKS      = 0x001B;
 const sal_uInt16 BIFF_ID_HYPERLINK          = 0x01B8;
+const sal_uInt16 BIFF3_ID_IMGDATA           = 0x007F;
+const sal_uInt16 BIFF8_ID_IMGDATA           = 0x00E9;
 const sal_uInt16 BIFF2_ID_INTEGER           = 0x0002;
 const sal_uInt16 BIFF_ID_ITERATION          = 0x0011;
 const sal_uInt16 BIFF_ID_IXFE               = 0x0044;
@@ -397,14 +405,20 @@ const sal_uInt16 BIFF_ID_UNKNOWN        
 
 const sal_uInt16 BIFF_ID_OBJEND             = 0x0000;   /// End of OBJ.
 const sal_uInt16 BIFF_ID_OBJMACRO           = 0x0004;   /// Macro link.
+const sal_uInt16 BIFF_ID_OBJBUTTON          = 0x0005;   /// Button data.
 const sal_uInt16 BIFF_ID_OBJGMO             = 0x0006;   /// Group marker.
 const sal_uInt16 BIFF_ID_OBJCF              = 0x0007;   /// Clipboard format.
-const sal_uInt16 BIFF_ID_OBJPIOGRBIT        = 0x0008;   /// Option flags.
+const sal_uInt16 BIFF_ID_OBJFLAGS           = 0x0008;   /// Option flags.
 const sal_uInt16 BIFF_ID_OBJPICTFMLA        = 0x0009;   /// OLE link formula.
 const sal_uInt16 BIFF_ID_OBJCBLS            = 0x000A;   /// Check box/radio button data.
+const sal_uInt16 BIFF_ID_OBJRBO             = 0x000B;   /// Radio button group data.
 const sal_uInt16 BIFF_ID_OBJSBS             = 0x000C;   /// Scroll bar data.
+const sal_uInt16 BIFF_ID_OBJNTS             = 0x000C;   /// Note data.
 const sal_uInt16 BIFF_ID_OBJSBSFMLA         = 0x000E;   /// Scroll bar/list box/combo box cell link.
 const sal_uInt16 BIFF_ID_OBJGBODATA         = 0x000F;   /// Group box data.
+const sal_uInt16 BIFF_ID_OBJEDODATA         = 0x0010;   /// Edit box data.
+const sal_uInt16 BIFF_ID_OBJRBODATA         = 0x0011;   /// Radio button group data.
+const sal_uInt16 BIFF_ID_OBJCBLSDATA        = 0x0012;   /// Check box/radio button data.
 const sal_uInt16 BIFF_ID_OBJLBSDATA         = 0x0013;   /// List box/combo box data.
 const sal_uInt16 BIFF_ID_OBJCBLSFMLA        = 0x0014;   /// Check box/radio button cell link.
 const sal_uInt16 BIFF_ID_OBJCMO             = 0x0015;   /// Common object settings.
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/biffinputstream.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/biffinputstream.hxx
--- oox/inc/oox/xls/biffinputstream.hxx	2008-04-10 16:53:04.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/biffinputstream.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -32,22 +32,17 @@
 #define OOX_XLS_BIFFINPUTSTREAM_HXX
 
 #include <vector>
+#include "oox/helper/binaryinputstream.hxx"
 #include "oox/xls/biffhelper.hxx"
 #include "oox/xls/biffcodec.hxx"
 
 namespace rtl { class OUStringBuffer; }
-namespace oox { class BinaryInputStream; }
 
 namespace oox {
 namespace xls {
 
 // ============================================================================
 
-const sal_uInt32 BIFF_REC_SEEK_TO_BEGIN     = 0;
-const sal_uInt32 BIFF_REC_SEEK_TO_END       = SAL_MAX_UINT32;
-
-// ============================================================================
-
 namespace prv {
 
 /** Buffers the contents of a raw record and encapsulates stream decoding. */
@@ -56,9 +51,8 @@ class BiffInputRecordBuffer
 public:
     explicit            BiffInputRecordBuffer( BinaryInputStream& rInStrm );
 
-    /** Returns the core stream object. */
-    inline const BinaryInputStream&
-                        getCoreStream() const { return mrInStrm; }
+    /** Returns the wrapped binary base stream. */
+    inline const BinaryInputStream& getBaseStream() const { return mrInStrm; }
 
     /** Sets a decoder object and decrypts buffered record data. */
     void                setDecoder( BiffDecoderRef xDecoder );
@@ -91,11 +85,8 @@ public:
 
     /** Reads nBytes bytes to the existing buffer opData. Must NOT overread the source buffer. */
     void                read( void* opData, sal_uInt16 nBytes );
-    /** Reads a value. Must NOT overread the buffer. */
-    template< typename Type >
-    inline void         readValue( Type& ornValue );
     /** Ignores nBytes bytes. Must NOT overread the buffer. */
-    inline void         skip( sal_uInt16 nBytes );
+    void                skip( sal_uInt16 nBytes );
 
 private:
     /** Updates data buffer from stream, if needed. */
@@ -121,15 +112,6 @@ private:
     bool                mbValidHeader;          /// True = valid record header.
 };
 
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-inline void BiffInputRecordBuffer::readValue( Type& ornValue )
-{
-    read( &ornValue, static_cast< sal_uInt16 >( sizeof( Type ) ) );
-    ByteOrderConverter::convertLittleEndian( ornValue );
-}
-
 } // namespace prv
 
 // ============================================================================
@@ -170,13 +152,8 @@ inline void BiffInputRecordBuffer::readV
     records or the stream position in SHEET records). Decryption will be
     reenabled automatically, if a new record is started with the function
     startNextRecord().
-
-    Be careful with used data types:
-    sal_uInt16: Record identifiers, raw size of single records.
-    sal_uInt32: Record position and size (including CONTINUE records).
-    sal_Int64: Core stream position and size.
 */
-class BiffInputStream
+class BiffInputStream : public BinaryInputStream
 {
 public:
     /** Constructs the BIFF record stream using the passed binary stream.
@@ -191,8 +168,6 @@ public:
                             BinaryInputStream& rInStream,
                             bool bContLookup = true );
 
-                        ~BiffInputStream();
-
     // record control ---------------------------------------------------------
 
     /** Sets stream pointer to the start of the next record content.
@@ -259,64 +234,45 @@ public:
 
     // stream/record state and info -------------------------------------------
 
-    /** Returns record reading state: false = record overread. */
-    inline bool         isValid() const { return mbValid; }
     /** Returns the current record identifier. */
     inline sal_uInt16   getRecId() const { return mnRecId; }
-    /** Returns the position inside of the whole record content. */
-    sal_uInt32          getRecPos() const;
-    /** Returns the data size of the whole record without record headers. */
-    sal_uInt32          getRecSize();
-    /** Returns remaining data size of the whole record without record headers. */
-    sal_uInt32          getRecLeft();
-    /** Returns a unique handle for the current record that can be used with
-        the function startRecordByHandle(). */
-    inline sal_Int64    getRecHandle() const { return mnRecHandle; }
     /** Returns the record identifier of the following record. */
     sal_uInt16          getNextRecId();
 
-    /** Returns the absolute core stream position. */
-    sal_Int64           getCoreStreamPos() const;
-    /** Returns the stream size. */
-    sal_Int64           getCoreStreamSize() const;
-
-    // stream read access -----------------------------------------------------
+    /** Returns a unique handle for the current record that can be used with
+        the function startRecordByHandle(). */
+    inline sal_Int64    getRecHandle() const { return mnRecHandle; }
 
-    /** Reads nBytes bytes and copies them to the passed buffer opData.
+    // BinaryStreamBase interface (seeking) -----------------------------------
 
-        @return  Number of bytes really read.
-     */
-    sal_uInt32          read( void* opData, sal_uInt32 nBytes );
+    /** Returns true, as the BIFF input stream is required to be seekable. */
+    virtual bool        isSeekable() const;
+    /** Returns the position inside of the whole record content. */
+    virtual sal_Int64   tell() const;
+    /** Returns the data size of the whole record without record headers. */
+    virtual sal_Int64   getLength() const;
+    /** Seeks in record content to the specified position. */
+    virtual void        seek( sal_Int64 nRecPos );
+
+    /** Returns the absolute position in the wrapped binary stream. */
+    sal_Int64           tellBase() const;
+    /** Returns the total size of the wrapped binary stream. */
+    sal_Int64           getBaseLength() const;
+
+    // BinaryInputStream interface (stream read access) -----------------------
+
+    /** Reads nBytes bytes to the passed sequence.
+        @return  Number of bytes really read. */
+    virtual sal_Int32   readData( StreamDataSequence& orData, sal_Int32 nBytes );
+    /** Reads nBytes bytes and copies them to the passed buffer opMem.
+        @return  Number of bytes really read. */
+    virtual sal_Int32   readMemory( void* opMem, sal_Int32 nBytes );
+    /** Seeks forward inside the current record. */
+    virtual void        skip( sal_Int32 nBytes );
 
-    /** Reads a value from the stream and converts it to platform byte order. */
+    /** Stream operator for integral and floating-point types. */
     template< typename Type >
-    void                readValue( Type& ornValue );
-    /** Reads a value from the stream and converts it to platform byte order. */
-    template< typename Type >
-    inline Type         readValue() { Type nValue; readValue( nValue ); return nValue; }
-
-    inline sal_Int8     readInt8() { return readValue< sal_Int8 >(); }
-    inline sal_uInt8    readuInt8() { return readValue< sal_uInt8 >(); }
-    inline sal_Int16    readInt16() { return readValue< sal_Int16 >(); }
-    inline sal_uInt16   readuInt16() { return readValue< sal_uInt16 >(); }
-    inline sal_Int32    readInt32() { return readValue< sal_Int32 >(); }
-    inline sal_uInt32   readuInt32() { return readValue< sal_uInt32 >(); }
-    inline sal_Int64    readInt64() { return readValue< sal_Int64 >(); }
-    inline sal_uInt64   readuInt64() { return readValue< sal_uInt64 >(); }
-    inline float        readFloat() { return readValue< float >(); }
-    inline double       readDouble() { return readValue< double >(); }
-
-    // seeking ----------------------------------------------------------------
-
-    /** Seeks absolute in record content to the specified position.
-
-        The value 0 means start of record, independent from physical stream
-        position.
-     */
-    BiffInputStream&    seek( sal_uInt32 nRecPos );
-
-    /** Seeks forward inside the current record. */
-    BiffInputStream&    skip( sal_uInt32 nBytes );
+    inline BiffInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
 
     // strings ----------------------------------------------------------------
 
@@ -349,6 +305,8 @@ public:
 
     // Unicode strings --------------------------------------------------------
 
+    /** Reads a null-terminated Unicode characters and returns the string. */
+    ::rtl::OUString     readNulUnicodeArray();
     /** Reads nChars Unicode characters and returns the string. */
     ::rtl::OUString     readUnicodeArray( sal_uInt16 nChars );
 
@@ -372,6 +330,9 @@ public:
 
     // ------------------------------------------------------------------------
 private:
+    /** Forwards calls of readValue() template functions to the record buffer. */
+    virtual void        readAtom( void* opMem, sal_uInt8 nSize );
+
     /** Initializes all members after base stream has been seeked to new record. */
     void                setupRecord();
     /** Restarts the current record from the beginning. */
@@ -386,7 +347,7 @@ private:
     /** Goes to start of the next CONTINUE record.
         @descr  Stream must be located at the end of a raw record, and handling
         of CONTINUE records must be enabled.
-        @return  Copy of mbValid. */
+        @return  True if next CONTINUE record has been found and initialized. */
     bool                jumpToNextContinue();
     /** Goes to start of the next CONTINUE record while reading strings.
         @descr  Stream must be located at the end of a raw record. If reading
@@ -394,21 +355,24 @@ private:
         CONTINUE record, even if handling of CONTINUE records is disabled (this
         is a special handling for TXO string data). Reads additional Unicode
         flag byte at start of the new raw record and sets or resets rb16Bit.
-        @return  Copy of mbValid. */
+        @return  True if next CONTINUE record has been found and initialized. */
     bool                jumpToNextStringContinue( bool& rb16Bit );
+    /** Calculates the complete length of the current record including CONTINUE
+        records, stores the length in mnComplRecSize. */
+    void                calcRecordLength();
 
     /** Ensures that reading nBytes bytes is possible with next stream access.
         @descr  Stream must be located at the end of a raw record, and handling
         of CONTINUE records must be enabled.
-        @return  Copy of mbValid. */
+        @return  True if nBytes can be read from stream. */
     bool                ensureRawReadSize( sal_uInt16 nBytes );
     /** Returns the maximum size of raw data possible to read in one block. */
-    sal_uInt16          getMaxRawReadSize( sal_uInt32 nBytes ) const;
+    sal_uInt16          getMaxRawReadSize( sal_Int32 nBytes ) const;
 
     /** Reads an array of Unicode characters and appends them to the passed buffer. */
     void                appendUnicodeArray( ::rtl::OUStringBuffer& orBuffer, sal_uInt16 nChars, bool b16Bit );
     /** Reads the BIFF8 Unicode string header fields. */
-    void                readUniStringHeader( bool& orb16Bit, sal_uInt32& ornAddSize );
+    void                readUniStringHeader( bool& orb16Bit, sal_Int32& ornAddSize );
 
 private:
     prv::BiffInputRecordBuffer maRecBuffer; /// Raw record data buffer.
@@ -417,31 +381,14 @@ private:
     sal_uInt16          mnRecId;            /// Identifier of current record (not the CONTINUE ID).
     sal_uInt16          mnAltContId;        /// Alternative identifier for content continuation records.
 
-    sal_uInt32          mnCurrRecSize;      /// Helper for record size and position.
-    sal_uInt32          mnComplRecSize;     /// Size of complete record data (with CONTINUEs).
+    sal_Int64           mnCurrRecSize;      /// Helper for record size and position.
+    sal_Int64           mnComplRecSize;     /// Size of complete record data (with CONTINUEs).
     bool                mbHasComplRec;      /// True = mnComplRecSize is valid.
 
     bool                mbCont;             /// True = automatic CONTINUE lookup enabled.
     bool                mbNulChars;         /// True = import NUL characters.
-    bool                mbValid;            /// True = last stream operation successful (no overread).
 };
 
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-inline void BiffInputStream::readValue( Type& ornValue )
-{
-    if( ensureRawReadSize( static_cast< sal_uInt16 >( sizeof( Type ) ) ) )
-        maRecBuffer.readValue( ornValue );
-}
-
-template< typename Type >
-inline BiffInputStream& operator>>( BiffInputStream& rStrm, Type& ornValue )
-{
-    rStrm.readValue( ornValue );
-    return rStrm;
-}
-
 // ============================================================================
 
 class BiffInputStreamPos
@@ -456,16 +403,16 @@ public:
 private:
     BiffInputStream&    mrStrm;
     sal_Int64           mnRecHandle;
-    sal_uInt32          mnRecPos;
+    sal_Int64           mnRecPos;
 };
 
 // ============================================================================
 
-class BiffInputStreamGuard : private BiffInputStreamPos
+class BiffInputStreamPosGuard : private BiffInputStreamPos
 {
 public:
-    explicit            BiffInputStreamGuard( BiffInputStream& rStrm );
-                        ~BiffInputStreamGuard();
+    explicit            BiffInputStreamPosGuard( BiffInputStream& rStrm );
+                        ~BiffInputStreamPosGuard();
 };
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/biffoutputstream.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/biffoutputstream.hxx
--- oox/inc/oox/xls/biffoutputstream.hxx	2008-04-10 16:53:19.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/biffoutputstream.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -32,6 +32,7 @@
 #define OOX_XLS_BIFFOUTPUTSTREAM_HXX
 
 #include <vector>
+#include "oox/helper/binaryoutputstream.hxx"
 #include "oox/xls/biffhelper.hxx"
 
 namespace oox { class BinaryOutputStream; }
@@ -51,9 +52,8 @@ public:
                             BinaryOutputStream& rOutStrm,
                             sal_uInt16 nMaxRecSize );
 
-    /** Returns the core stream object. */
-    inline const BinaryOutputStream&
-                        getCoreStream() const { return mrOutStrm; }
+    /** Returns the wrapped binary base stream. */
+    inline const BinaryOutputStream& getBaseStream() const { return mrOutStrm; }
 
     /** Starts a new record. */
     void                startRecord( sal_uInt16 nRecId );
@@ -67,9 +67,6 @@ public:
     void                write( const void* pData, sal_uInt16 nBytes );
     /** Writes a sequence of nBytes bytes with the passed value. */
     void                fill( sal_uInt8 nValue, sal_uInt16 nBytes );
-    /** Writes a value. Must NOT overread the buffer. */
-    template< typename Type >
-    inline void         writeValue( Type nValue );
 
 private:
     typedef ::std::vector< sal_uInt8 > DataBuffer;
@@ -81,15 +78,6 @@ private:
     bool                mbInRec;                /// True = currently writing inside of a record.
 };
 
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-inline void BiffOutputRecordBuffer::writeValue( Type nValue )
-{
-    ByteOrderConverter::convertLittleEndian( nValue );
-    write( &nValue, static_cast< sal_uInt16 >( sizeof( Type ) ) );
-}
-
 } // namespace prv
 
 // ============================================================================
@@ -113,15 +101,13 @@ inline void BiffOutputRecordBuffer::writ
     To write unicode character arrays, call writeUnicodeBuffer(). It creates
     CONTINUE records and repeats the unicode string flag byte automatically.
 */
-class BiffOutputStream
+class BiffOutputStream : public BinaryOutputStream
 {
 public:
     explicit            BiffOutputStream(
                             BinaryOutputStream& rOutStream,
                             sal_uInt16 nMaxRecSize );
 
-                        ~BiffOutputStream();
-
     // record control ---------------------------------------------------------
 
     /** Starts a new record. */
@@ -133,25 +119,39 @@ public:
     /** Sets size of data portion in bytes. 0 means no portions are used. */
     void                setPortionSize( sal_uInt16 nSize );
 
-    // stream/record state and info -------------------------------------------
+    // BinaryStreamBase interface (seeking) -----------------------------------
 
-    // stream write access ----------------------------------------------------
+    /** Returns the absolute position in the wrapped binary stream. */
+    sal_Int64           tellBase() const;
+    /** Returns the total size of the wrapped binary stream. */
+    sal_Int64           getBaseLength() const;
+
+    // BinaryOutputStream interface (stream write access) ---------------------
+
+    /** Writes the passed data sequence. */
+    virtual void        writeData( const StreamDataSequence& rData );
+    /** Writes nBytes bytes from the passed buffer pMem. */
+    virtual void        writeMemory( const void* pMem, sal_Int32 nBytes );
 
-    /** Writes nBytes bytes from the passed buffer pData. */
-    void                write( const void* pData, sal_uInt32 nBytes );
     /** Writes a sequence of nBytes bytes with the passed value. */
-    void                fill( sal_uInt8 nValue, sal_uInt32 nBytes );
+    void                fill( sal_uInt8 nValue, sal_Int32 nBytes );
+    /** Writes a block of memory, ensures that it is not split to a CONTINUE record. */
+    void                writeBlock( const void* pMem, sal_uInt16 nBytes );
 
-    /** Writes a value to the stream and converts it to little-endian byte order. */
+    /** Stream operator for integral and floating-point types. */
     template< typename Type >
-    void                writeValue( Type nValue );
+    inline BiffOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
 
+    // ------------------------------------------------------------------------
 private:
+    /** Forwards calls of writeValue() template functions to the record buffer. */
+    virtual void        writeAtom( const void* pMem, sal_uInt8 nSize );
+
     /** Checks the remaining size in the current record, creates CONTINUE record if needed. */
     void                ensureRawBlock( sal_uInt16 nSize );
     /** Checks the remaining size in the current record and creates CONTINUE record if needed.
         @return  Maximum size left for writing to current record. */
-    sal_uInt16          prepareRawBlock( sal_uInt32 nTotalSize );
+    sal_uInt16          prepareRawBlock( sal_Int32 nTotalSize );
 
 private:
     prv::BiffOutputRecordBuffer maRecBuffer;    /// Raw record data buffer.
@@ -159,22 +159,6 @@ private:
     sal_uInt16          mnPortionPos;           /// Position in current portion.
 };
 
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-inline void BiffOutputStream::writeValue( Type nValue )
-{
-    ensureRawBlock( static_cast< sal_uInt16 >( sizeof( Type ) ) );
-    maRecBuffer.writeValue( nValue );
-}
-
-template< typename Type >
-inline BiffOutputStream& operator<<( BiffOutputStream& rStrm, Type nValue )
-{
-    rStrm.writeValue( nValue );
-    return rStrm;
-}
-
 // ============================================================================
 
 } // namespace xls
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/chartsheetfragment.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/chartsheetfragment.hxx
--- oox/inc/oox/xls/chartsheetfragment.hxx	2008-04-10 16:53:34.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/chartsheetfragment.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -31,7 +31,6 @@
 #ifndef OOX_XLS_CHARTSHEETFRAGMENT_HXX
 #define OOX_XLS_CHARTSHEETFRAGMENT_HXX
 
-#include "oox/xls/bifffragmenthandler.hxx"
 #include "oox/xls/excelhandlers.hxx"
 
 namespace oox {
@@ -77,12 +76,12 @@ class BiffChartsheetFragment : public Bi
 {
 public:
     explicit            BiffChartsheetFragment(
-                            const WorkbookHelper& rHelper,
+                            const BiffWorkbookFragmentBase& rParent,
                             ISegmentProgressBarRef xProgressBar,
                             sal_Int32 nSheet );
 
     /** Imports the entire sheet fragment, returns true, if EOF record has been reached. */
-    virtual bool        importFragment( BiffInputStream& rStrm );
+    virtual bool        importFragment();
 };
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/condformatbuffer.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/condformatbuffer.hxx
--- oox/inc/oox/xls/condformatbuffer.hxx	2008-04-10 16:53:51.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/condformatbuffer.hxx	2009-03-25 12:15:34.000000000 +0100
@@ -31,6 +31,7 @@
 #ifndef OOX_XLS_CONDFORMATBUFFER_HXX
 #define OOX_XLS_CONDFORMATBUFFER_HXX
 
+#include <com/sun/star/sheet/ConditionOperator.hpp>
 #include "oox/helper/containerhelper.hxx"
 #include "oox/xls/formulaparser.hxx"
 #include "oox/xls/worksheethelper.hxx"
@@ -176,6 +177,10 @@ public:
     /** Creates all conditional formattings in the Calc document. */
     void                finalizeImport();
 
+    /** Converts an OOXML condition operator token to the API constant. */
+    static ::com::sun::star::sheet::ConditionOperator
+                        convertToApiOperator( sal_Int32 nToken );
+
 private:
     CondFormatRef       createCondFormat();
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/defnamesbuffer.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/defnamesbuffer.hxx
--- oox/inc/oox/xls/defnamesbuffer.hxx	2008-04-10 16:54:35.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/defnamesbuffer.hxx	2009-01-06 15:57:48.000000000 +0100
@@ -93,9 +93,13 @@ public:
 
     /** Returns the original name as imported from or exported to the file. */
     inline const ::rtl::OUString& getOoxName() const { return maOoxData.maName; }
+    /** Returns the name as used in the Calc document. */
+    inline const ::rtl::OUString& getDocName() const { return maFinalName; }
     /** Returns the 0-based sheet index for local names, or -1 for global names. */
     inline sal_Int32    getSheetIndex() const { return maOoxData.mnSheet; }
 
+    /** Returns the original name as imported from or exported to the file. */
+    const ::rtl::OUString& getUpcaseOoxName() const;
     /** Returns an Any with a SingleReference or ComplexReference, or an empty Any. */
     ::com::sun::star::uno::Any getReference( const ::com::sun::star::table::CellAddress& rBaseAddress ) const;
 
@@ -112,6 +116,7 @@ protected:
 
 protected:
     OoxDefinedNameData  maOoxData;          /// OOX data for this defined name.
+    mutable ::rtl::OUString maUpOoxName;    /// OOX name converted to uppercase ASCII.
     ::rtl::OUString     maFinalName;        /// Final name used in the Calc document.
 
 private:
@@ -142,7 +147,7 @@ public:
     /** Returns true, if this defined name is a special builtin name. */
     inline bool         isBuiltinName() const { return mcBuiltinId != OOX_DEFNAME_UNKNOWN; }
     /** Returns true, if this defined name is a macro function call. */
-    inline bool         isMacroFunc( bool bVBName ) const { return maOoxData.mbMacro && maOoxData.mbFunction && (maOoxData.mbVBName == bVBName); }
+    inline bool         isMacroFunction() const { return maOoxData.mbMacro && maOoxData.mbFunction; }
 
     /** Returns the token index used in API token arrays (com.sun.star.sheet.FormulaToken). */
     inline sal_Int32    getTokenIndex() const { return mnTokenIndex; }
@@ -154,14 +159,14 @@ private:
     void                implImportBiffFormula( FormulaContext& rContext );
 
 private:
-    typedef ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange >    XNamedRangeRef;
-    typedef ::std::auto_ptr< RecordDataSequence >                                       RecordDataSeqPtr;
+    typedef ::std::auto_ptr< StreamDataSequence >   StreamDataSeqPtr;
     typedef ::std::auto_ptr< BiffInputStreamPos >                                       BiffStreamPosPtr;
 
-    XNamedRangeRef      mxNamedRange;       /// XNamedRange interface of the defined name.
+    ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange >
+                        mxNamedRange;       /// XNamedRange interface of the defined name.
     sal_Int32           mnTokenIndex;       /// Name index used in API token array.
     sal_Unicode         mcBuiltinId;        /// Identifier for built-in defined names.
-    RecordDataSeqPtr    mxFormula;          /// Formula data for OOBIN import.
+    StreamDataSeqPtr    mxFormula;          /// Formula data for OOBIN import.
     BiffStreamPosPtr    mxBiffStrm;         /// Cached BIFF stream for formula import.
     sal_uInt16          mnFmlaSize;         /// Cached BIFF formula size for formula import.
 };
@@ -175,15 +180,6 @@ class DefinedNamesBuffer : public Workbo
 public:
     explicit            DefinedNamesBuffer( const WorkbookHelper& rHelper );
 
-    /** Creates and returns a defined name on-the-fly in the Calc document.
-        The name will not be buffered in this defined names buffer.
-        @param orName  (in/out-parameter) Returns the resulting used name. */
-    ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange >
-                        createDefinedName( ::rtl::OUString& orName, sal_Int32 nNameFlags = 0 ) const;
-
-    /** Returns the index of the passed defined name used in formula token arrays. */
-    sal_Int32           getTokenIndex( const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange >& rxNamedRange ) const;
-
     /** Sets the current sheet index for files with local defined names, e.g.
         BIFF4 workspaces. All created names initially will contain this index. */
     void                setLocalSheetIndex( sal_Int32 nLocalSheet );
@@ -199,6 +195,8 @@ public:
 
     /** Returns a defined name by zero-based index (order of appearence). */
     DefinedNameRef      getByIndex( sal_Int32 nIndex ) const;
+    /** Returns a defined name by token index (index in XDefinedNames container). */
+    DefinedNameRef      getByTokenIndex( sal_Int32 nIndex ) const;
     /** Returns a defined name by its OOX name.
         @param nSheet  The sheet index for local names or -1 for global names.
             If no local name is found, tries to find a matching global name.
@@ -209,11 +207,12 @@ private:
     DefinedNameRef      createDefinedName();
 
 private:
-    typedef RefVector< DefinedName > DefNameVec;
+    typedef RefVector< DefinedName >            DefNameVector;
+    typedef RefMap< sal_Int32, DefinedName >    DefNameMap;
 
-    const ::rtl::OUString maTokenIndexProp;
-    DefNameVec          maDefNames;
-    sal_Int32           mnLocalSheet;
+    DefNameVector       maDefNames;         /// List of all defined names in insertion order.
+    DefNameMap          maDefNameMap;       /// Maps all defined names by API token index. */
+    sal_Int32           mnLocalSheet;       /// Current sheet index for import of BIFF sheet-local names.
 };
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/excelhandlers.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/excelhandlers.hxx
--- oox/inc/oox/xls/excelhandlers.hxx	2008-04-18 22:06:47.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/excelhandlers.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -43,15 +43,19 @@
 namespace oox {
 namespace xls {
 
+typedef ::oox::core::ContextHandler2    OoxContextHandler;
+typedef ::oox::core::FragmentHandler2   OoxFragmentHandler;
+
 typedef ::oox::core::ContextWrapper ContextWrapper;
 
 // ============================================================================
+// ============================================================================
 
 /** Context handler derived from the WorkbookHelper helper class.
 
     Used to import contexts in global workbook fragments.
  */
-class OoxWorkbookContextBase : public ::oox::core::ContextHandler2, public WorkbookHelper
+class OoxWorkbookContextBase : public OoxContextHandler, public WorkbookHelper
 {
 public:
     template< typename ParentType >
@@ -62,7 +66,7 @@ public:
 
 template< typename ParentType >
 OoxWorkbookContextBase::OoxWorkbookContextBase( ParentType& rParent ) :
-    ::oox::core::ContextHandler2( rParent ),
+    OoxContextHandler( rParent ),
     WorkbookHelper( rParent )
 {
 }
@@ -73,7 +77,7 @@ OoxWorkbookContextBase::OoxWorkbookConte
 
     Used to import contexts in sheet fragments.
  */
-class OoxWorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelperRoot
+class OoxWorksheetContextBase : public OoxContextHandler, public WorksheetHelperRoot
 {
 public:
     template< typename ParentType >
@@ -92,14 +96,14 @@ public:
 template< typename ParentType >
 OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent,
         ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
-    ::oox::core::ContextHandler2( rParent ),
+    OoxContextHandler( rParent ),
     WorksheetHelperRoot( rParent, xProgressBar, eSheetType, nSheet )
 {
 }
 
 template< typename ParentType >
 OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent ) :
-    ::oox::core::ContextHandler2( rParent ),
+    OoxContextHandler( rParent ),
     WorksheetHelperRoot( rParent )
 {
 }
@@ -110,7 +114,7 @@ OoxWorksheetContextBase::OoxWorksheetCon
 
     Used to import global workbook fragments.
  */
-class OoxWorkbookFragmentBase : public ::oox::core::FragmentHandler2, public WorkbookHelper
+class OoxWorkbookFragmentBase : public OoxFragmentHandler, public WorkbookHelper
 {
 public:
     explicit            OoxWorkbookFragmentBase(
@@ -124,7 +128,7 @@ public:
 
     Used to import sheet fragments.
  */
-class OoxWorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelperRoot
+class OoxWorksheetFragmentBase : public OoxFragmentHandler, public WorksheetHelperRoot
 {
 public:
     explicit            OoxWorksheetFragmentBase(
@@ -140,6 +144,216 @@ public:
 };
 
 // ============================================================================
+// ============================================================================
+
+/** An enumeration for all types of fragments in a BIFF workbook stream. */
+enum BiffFragmentType
+{
+    BIFF_FRAGMENT_GLOBALS,      /// Workbook globals fragment.
+    BIFF_FRAGMENT_WORKSHEET,    /// Worksheet fragment.
+    BIFF_FRAGMENT_CHARTSHEET,   /// Chart sheet fragment.
+    BIFF_FRAGMENT_MACROSHEET,   /// Macro sheet fragment.
+    BIFF_FRAGMENT_MODULESHEET,  /// BIFF5 VB module fragment.
+    BIFF_FRAGMENT_EMPTYSHEET,   /// Sheet fragment of unsupported type.
+    BIFF_FRAGMENT_WORKSPACE,    /// BIFF4 workspace/workbook globals.
+    BIFF_FRAGMENT_UNKNOWN       /// Unknown fragment/error.
+};
+
+// ============================================================================
+
+/** Base class for all BIFF context handlers and fragment handlers.
+
+    This base class holds a reference to the BIFF input stream which can be
+    accessed in all derived classes.
+ */
+class BiffHandlerBase
+{
+protected:
+    inline explicit     BiffHandlerBase( BiffInputStream& rStrm ) : mrStrm( rStrm ) {}
+    virtual             ~BiffHandlerBase();
+
+    /** Skips a block of records up to the specified end record.
+
+        Skips all records until next end record. When this function returns,
+        stream points to the end record, and the next call of startNextRecord()
+        at the stream will start the record following the end record.
+
+        The identifier of the record that is active while this function is
+        called is used as start record identifier. This identifier is used to
+        correctly skip embedded record blocks with the same start and end
+        record identifier.
+
+        @return  True = stream points to the end record.
+     */
+    bool                skipRecordBlock( sal_uInt16 nEndRecId );
+
+    /** @return  True = current record identifier is a BOF record. */
+    bool                isBofRecord() const;
+
+protected:
+    BiffInputStream&    mrStrm;
+};
+
+// ============================================================================
+
+/** Base class for all BIFF context handlers.
+
+    Derived handlers have to implement the importRecord() function that has to
+    import the record the BIFF input stream currently points to.
+ */
+class BiffContextHandler : public BiffHandlerBase
+{
+public:
+    /** Derived classes have to implement importing the current record. */
+    virtual void        importRecord() = 0;
+
+protected:
+    explicit            BiffContextHandler( const BiffHandlerBase& rParent );
+};
+
+// ============================================================================
+
+/** Context handler derived from the WorkbookHelper helper class.
+
+    Used to import contexts in global workbook fragments.
+ */
+class BiffWorkbookContextBase : public BiffContextHandler, public WorkbookHelper
+{
+protected:
+    template< typename ParentType >
+    explicit            BiffWorkbookContextBase( const ParentType& rParent );
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename ParentType >
+BiffWorkbookContextBase::BiffWorkbookContextBase( const ParentType& rParent ) :
+    BiffContextHandler( rParent ),
+    WorkbookHelper( rParent )
+{
+}
+
+// ============================================================================
+
+/** Context handler derived from the WorksheetHelper helper class.
+
+    Used to import contexts in sheet fragments.
+ */
+class BiffWorksheetContextBase : public BiffContextHandler, public WorksheetHelperRoot
+{
+protected:
+    template< typename ParentType >
+    explicit            BiffWorksheetContextBase(
+                            const ParentType& rParent,
+                            ISegmentProgressBarRef xProgressBar,
+                            WorksheetType eSheetType,
+                            sal_Int32 nSheet );
+
+    template< typename ParentType >
+    explicit            BiffWorksheetContextBase( const ParentType& rParent );
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename ParentType >
+BiffWorksheetContextBase::BiffWorksheetContextBase( const ParentType& rParent,
+        ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
+    BiffContextHandler( rParent ),
+    WorksheetHelperRoot( rParent, xProgressBar, eSheetType, nSheet )
+{
+}
+
+template< typename ParentType >
+BiffWorksheetContextBase::BiffWorksheetContextBase( const ParentType& rParent ) :
+    BiffContextHandler( rParent ),
+    WorksheetHelperRoot( rParent )
+{
+}
+
+// ============================================================================
+
+class BiffFragmentHandler : public BiffHandlerBase
+{
+public:
+    /** Imports the fragment, returns true, if EOF record has been reached. */
+    virtual bool        importFragment() = 0;
+
+protected:
+    explicit            BiffFragmentHandler( BiffInputStream& rStrm );
+
+    /** Starts a new fragment in a workbbok stream and returns the fragment type.
+
+        The passed stream must point before a BOF record. The function will
+        try to start the next record and read the contents of the BOF record,
+        if extant.
+
+        @return  Fragment type according to the imported BOF record.
+     */
+    BiffFragmentType    startFragment( BiffType eBiff );
+
+    /** Skips the current fragment up to its trailing EOF record.
+
+        Skips all records until next EOF record. When this function returns,
+        stream points to the EOF record, and the next call of startNextRecord()
+        at the stream will start the record following the EOF record.
+
+        Embedded fragments enclosed in BOF/EOF records (e.g. embedded chart
+        objects) are skipped correctly.
+
+        @return  True = stream points to the EOF record of the current fragment.
+     */
+    bool                skipFragment();
+};
+
+// ============================================================================
+
+/** Fragment handler derived from the WorkbookHelper helper class.
+
+    Used to import global workbook fragments.
+ */
+class BiffWorkbookFragmentBase : public BiffFragmentHandler, public WorkbookHelper
+{
+protected:
+    explicit            BiffWorkbookFragmentBase(
+                            const WorkbookHelper& rHelper,
+                            BiffInputStream& rStrm );
+};
+
+// ============================================================================
+
+/** Fragment handler derived from the WorksheetHelper helper class.
+
+    Used to import sheet fragments.
+ */
+class BiffWorksheetFragmentBase : public BiffFragmentHandler, public WorksheetHelperRoot
+{
+protected:
+    explicit            BiffWorksheetFragmentBase(
+                            const BiffWorkbookFragmentBase& rParent,
+                            ISegmentProgressBarRef xProgressBar,
+                            WorksheetType eSheetType,
+                            sal_Int32 nSheet );
+
+    explicit            BiffWorksheetFragmentBase(
+                            const WorksheetHelper& rHelper,
+                            BiffInputStream& rStrm );
+};
+
+// ============================================================================
+
+class BiffSkipWorksheetFragment : public BiffWorksheetFragmentBase
+{
+public:
+    explicit            BiffSkipWorksheetFragment(
+                            const BiffWorkbookFragmentBase& rParent,
+                            ISegmentProgressBarRef xProgressBar,
+                            sal_Int32 nSheet );
+
+    virtual bool        importFragment();
+};
+
+// ============================================================================
+// ============================================================================
 
 } // namespace xls
 } // namespace oox
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/externallinkbuffer.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/externallinkbuffer.hxx
--- oox/inc/oox/xls/externallinkbuffer.hxx	2008-04-10 16:55:46.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/externallinkbuffer.hxx	2009-01-06 15:57:48.000000000 +0100
@@ -31,11 +31,15 @@
 #ifndef OOX_XLS_EXTERNALLINKBUFFER_HXX
 #define OOX_XLS_EXTERNALLINKBUFFER_HXX
 
+#include <com/sun/star/sheet/ExternalLinkInfo.hpp>
 #include "oox/helper/containerhelper.hxx"
 #include "oox/xls/defnamesbuffer.hxx"
 
 namespace com { namespace sun { namespace star {
+    namespace sheet { struct DDEItemInfo; }
     namespace sheet { class XDDELink; }
+    namespace sheet { class XExternalDocLink; }
+    namespace sheet { class XExternalSheetCache; }
 } } }
 
 namespace oox { namespace core {
@@ -47,30 +51,6 @@ namespace xls {
 
 // ============================================================================
 
-/** Contains indexes for a range of sheets in the spreadsheet document. */
-struct LinkSheetRange
-{
-    sal_Int32           mnFirst;        /// Index of the first sheet.
-    sal_Int32           mnLast;         /// Index of the last sheet.
-    bool                mbRel;          /// True = relative indexes.
-
-    inline explicit     LinkSheetRange() { setDeleted(); }
-    inline explicit     LinkSheetRange( sal_Int32 nFirst, sal_Int32 nLast ) { setRange( nFirst, nLast ); }
-
-    /** Sets this struct to deleted state. */
-    inline void         setDeleted() { mnFirst = mnLast = -1; mbRel = false; }
-    /** Sets this struct to use current sheet state. */
-    inline void         setRelative() { mnFirst = mnLast = 0; mbRel = true; }
-    /** Sets the passed absolute sheet range to the memebers of this struct. */
-    inline void         setRange( sal_Int32 nFirst, sal_Int32 nLast )
-                            { mnFirst = ::std::min( nFirst, nLast ); mnLast = ::std::max( nFirst, nLast ); mbRel = false; }
-
-    /** Returns true, if the sheet indexes are valid and different. */
-    inline bool         is3dRange() const { return (0 <= mnFirst) && (mnFirst < mnLast); }
-};
-
-// ============================================================================
-
 struct OoxExternalNameData
 {
     bool                mbBuiltIn;          /// Name is a built-in name.
@@ -129,6 +109,13 @@ public:
     /** Returns true, if the name refers to an OLE object. */
     inline bool         isOleObject() const { return maOoxExtNameData.mbOleObj; }
 
+    /** Returns the sheet cache index if this is a sheet-local external name. */
+    sal_Int32           getSheetCacheIndex() const;
+
+    /** Returns the DDE item info needed by the XML formula parser. */
+    bool                getDdeItemInfo(
+                            ::com::sun::star::sheet::DDEItemInfo& orItemInfo ) const;
+
     /** Returns the complete DDE link data of this DDE item. */
     bool                getDdeLinkData(
                             ::rtl::OUString& orDdeServer,
@@ -146,7 +133,7 @@ private:
     OoxExternalNameData maOoxExtNameData;   /// Additional name data.
     ResultMatrix        maResults;          /// DDE/OLE link results.
     ResultMatrix::iterator maCurrIt;        /// Current position in result matrix.
-    sal_uInt32          mnStorageId;        /// OLE storage identifier.
+    sal_uInt32          mnStorageId;        /// OLE storage identifier (BIFF).
     ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDDELink >
                         mxDdeLink;          /// Interface of a DDE link.
     bool                mbDdeLinkCreated;   /// True = already tried to create the DDE link.
@@ -156,20 +143,67 @@ typedef ::boost::shared_ptr< ExternalNam
 
 // ============================================================================
 
+/** Contains indexes for a range of sheets in the spreadsheet document. */
+class LinkSheetRange
+{
+public:
+    inline explicit     LinkSheetRange() { setDeleted(); }
+    inline explicit     LinkSheetRange( sal_Int32 nFirst, sal_Int32 nLast ) { setRange( nFirst, nLast ); }
+    inline explicit     LinkSheetRange( sal_Int32 nDocLink, sal_Int32 nFirst, sal_Int32 nLast ) { setExternalRange( nDocLink, nFirst, nLast ); }
+
+    /** Sets this struct to deleted state. */
+    void                setDeleted();
+    /** Sets this struct to "use current sheet" state. */
+    void                setSameSheet();
+    /** Sets the passed absolute sheet range to the members of this struct. */
+    void                setRange( sal_Int32 nFirst, sal_Int32 nLast );
+    /** Sets the passed external sheet cache range to the members of this struct. */
+    void                setExternalRange( sal_Int32 nDocLink, sal_Int32 nFirst, sal_Int32 nLast );
+
+    /** Returns true, if the sheet indexes are valid and different. */
+    inline bool         isDeleted() const { return mnFirst < 0; }
+    /** Returns true, if the sheet range points to an external document. */
+    inline bool         isExternal() const { return !isDeleted() && (meType == LINKSHEETRANGE_EXTERNAL); }
+    /** Returns true, if the sheet indexes are valid and different. */
+    inline bool         isSameSheet() const { return meType == LINKSHEETRANGE_SAMESHEET; }
+    /** Returns true, if the sheet indexes are valid and different. */
+    inline bool         is3dRange() const { return (0 <= mnFirst) && (mnFirst < mnLast); }
+
+    inline sal_Int32    getDocLinkIndex() const { return mnDocLink; }
+    inline sal_Int32    getFirstSheet() const { return mnFirst; }
+    inline sal_Int32    getLastSheet() const { return mnLast; }
+
+private:
+    enum LinkSheetRangeType
+    {
+        LINKSHEETRANGE_INTERNAL,    /// Sheet range in the own document.
+        LINKSHEETRANGE_EXTERNAL,    /// Sheet range in an external document.
+        LINKSHEETRANGE_SAMESHEET    /// Current sheet depending on context.
+    };
+
+    LinkSheetRangeType  meType;         /// Link sheet range type.
+    sal_Int32           mnDocLink;      /// Document link token index for external links.
+    sal_Int32           mnFirst;        /// Index of the first sheet or index of first external sheet cache.
+    sal_Int32           mnLast;         /// Index of the last sheet or index of last external sheet cache.
+};
+
+// ============================================================================
+
 enum ExternalLinkType
 {
     LINKTYPE_SELF,          /// Link refers to the current workbook.
     LINKTYPE_SAME,          /// Link refers to the current sheet.
     LINKTYPE_INTERNAL,      /// Link refers to a sheet in the own workbook.
     LINKTYPE_EXTERNAL,      /// Link refers to an external spreadsheet document.
-    LINKTYPE_ANALYSIS,      /// Link refers to Analysis add-in.
+    LINKTYPE_ANALYSIS,      /// Link refers to the Analysis add-in.
+    LINKTYPE_LIBRARY,       /// Link refers to an external add-in.
     LINKTYPE_DDE,           /// DDE link.
     LINKTYPE_OLE,           /// OLE link.
     LINKTYPE_MAYBE_DDE_OLE, /// Could be DDE or OLE link (BIFF only).
     LINKTYPE_UNKNOWN        /// Unknown or unsupported link type.
 };
 
-// ============================================================================
+// ----------------------------------------------------------------------------
 
 class ExternalLink : public WorkbookHelper
 {
@@ -219,37 +253,54 @@ public:
     inline ExternalLinkType getLinkType() const { return meLinkType; }
     /** Returns true, if the link refers to the current workbook. */
     inline bool         isInternalLink() const { return (meLinkType == LINKTYPE_SELF) || (meLinkType == LINKTYPE_INTERNAL); }
+
     /** Returns the relation identifier for the external link fragment. */
     inline const ::rtl::OUString& getRelId() const { return maRelId; }
     /** Returns the class name of this external link. */
     inline const ::rtl::OUString& getClassName() const { return maClassName; }
     /** Returns the target URL of this external link. */
     inline const ::rtl::OUString& getTargetUrl() const { return maTargetUrl; }
+    /** Returns the link info needed by the XML formula parser. */
+    ::com::sun::star::sheet::ExternalLinkInfo getLinkInfo() const;
 
-    /** Returns the internal sheet index for the specified external sheet index. */
+    /** Returns the type of the external library if this is a library link. */
+    FunctionLibraryType getFuncLibraryType() const;
+    /** Returns the internal sheet index or external sheet cache index for the passed sheet. */
     sal_Int32           getSheetIndex( sal_Int32 nTabId = 0 ) const;
-    /** Returns the sheet range for the specified sheets (BIFF only). */
+    /** Returns the internal sheet range or range of external sheet caches for the passed sheet range (BIFF only). */
     void                getSheetRange( LinkSheetRange& orSheetRange, sal_Int32 nTabId1, sal_Int32 nTabId2 ) const;
+
+    /** Returns the sheet cache of the external sheet with the passed index. */
+    ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >
+                        getExternalSheetCache( sal_Int32 nTabId );
+
     /** Returns the external name with the passed zero-based index. */
     ExternalNameRef     getNameByIndex( sal_Int32 nIndex ) const;
 
 private:
-    void                setExternalTargetUrl( const ::rtl::OUString& rTargetUrl );
+    void                setExternalTargetUrl( const ::rtl::OUString& rTargetUrl, const ::rtl::OUString& rTargetType );
     void                setDdeOleTargetUrl( const ::rtl::OUString& rClassName, const ::rtl::OUString& rTargetUrl, ExternalLinkType eLinkType );
+    void                parseExternalReference( const ::oox::core::Relations& rRelations, const ::rtl::OUString& rRelId );
     ::rtl::OUString     parseBiffTargetUrl( const ::rtl::OUString& rBiffTargetUrl );
 
+    /** Creates an external locument link and the sheet cache for the passed sheet name. */
+    void                insertExternalSheet( const ::rtl::OUString& rSheetName );
+
     ExternalNameRef     createExternalName();
 
 private:
-    typedef ::std::vector< sal_Int32 >  SheetIndexVec;
-    typedef RefVector< ExternalName >   ExternalNameVec;
+    typedef ::std::vector< sal_Int32 >  IndexVector;
+    typedef RefVector< ExternalName >   ExternalNameVector;
 
-    ExternalLinkType    meLinkType;
-    ::rtl::OUString     maRelId;
-    ::rtl::OUString     maClassName;
-    ::rtl::OUString     maTargetUrl;
-    SheetIndexVec       maSheetIndexes;
-    ExternalNameVec     maExtNames;
+    ExternalLinkType    meLinkType;         /// Type of this link object.
+    FunctionLibraryType meFuncLibType;      /// Type of the function library, if link type is LINKTYPE_LIBRARY.
+    ::rtl::OUString     maRelId;            /// Relation identifier for the external link fragment.
+    ::rtl::OUString     maClassName;        /// DDE service, OLE class name.
+    ::rtl::OUString     maTargetUrl;        /// Target link, DDE topic, OLE target.
+    ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLink >
+                        mxDocLink;          /// Interface for an external document.
+    IndexVector         maIndexes;          /// Internal sheet indexes or external sheet cache indexes.
+    ExternalNameVector  maExtNames;         /// Defined names in external document.
 };
 
 typedef ::boost::shared_ptr< ExternalLink > ExternalLinkRef;
@@ -305,6 +356,10 @@ public:
     /** Imports the BIFF8 EXTERNSHEET record from the passed stream. */
     void                importExternSheet8( BiffInputStream& rStrm );
 
+    /** Returns the sequence of link infos needed by the XML formula parser. */
+    ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::ExternalLinkInfo >
+                        getLinkInfos() const;
+
     /** Returns the external link for the passed reference identifier. */
     ExternalLinkRef     getExternalLink( sal_Int32 nRefId ) const;
 
@@ -324,7 +379,8 @@ private:
     typedef RefVector< ExternalLink >       ExternalLinkVec;
     typedef ::std::vector< OoxRefSheets >   OoxRefSheetsVec;
 
-    ExternalLinkVec     maExtLinks;         /// List of external documents.
+    ExternalLinkVec     maLinks;            /// List of link structures for all kinds of links.
+    ExternalLinkVec     maExtLinks;         /// Real external links needed for formula parser.
     OoxRefSheetsVec     maRefSheets;        /// Sheet indexes for reference ids.
     bool                mbUseRefSheets;     /// True = use maRefSheets list (OOBIN only).
 };
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/externallinkfragment.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/externallinkfragment.hxx
--- oox/inc/oox/xls/externallinkfragment.hxx	2008-04-10 16:56:01.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/externallinkfragment.hxx	2008-12-12 11:38:47.000000000 +0100
@@ -31,7 +31,6 @@
 #ifndef OOX_XLS_EXTERNALLINKFRAGMENT_HXX
 #define OOX_XLS_EXTERNALLINKFRAGMENT_HXX
 
-#include "oox/xls/bifffragmenthandler.hxx"
 #include "oox/xls/excelhandlers.hxx"
 #include "oox/xls/externallinkbuffer.hxx"
 
@@ -39,7 +38,55 @@ namespace oox {
 namespace xls {
 
 class ExternalLink;
-class OoxExternalSheetDataContext;
+
+// ============================================================================
+
+/** This class implements importing the sheetData element in external sheets.
+
+    The sheetData element embedded in the externalBook element contains cached
+    cells from externally linked sheets.
+ */
+class OoxExternalSheetDataContext : public OoxWorkbookContextBase
+{
+public:
+    explicit            OoxExternalSheetDataContext(
+                            OoxWorkbookFragmentBase& rFragment,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >& rxSheetCache );
+
+protected:
+    // oox.core.ContextHandler2Helper interface -------------------------------
+
+    virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+    virtual void        onStartElement( const AttributeList& rAttribs );
+    virtual void        onEndElement( const ::rtl::OUString& rChars );
+
+    virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+    virtual void        onStartRecord( RecordInputStream& rStrm );
+
+private:
+    /** Imports cell settings from a c element. */
+    void                importCell( const AttributeList& rAttribs );
+
+    /** Imports the EXTCELL_BLANK from the passed stream. */
+    void                importExtCellBlank( RecordInputStream& rStrm );
+    /** Imports the EXTCELL_BOOL from the passed stream. */
+    void                importExtCellBool( RecordInputStream& rStrm );
+    /** Imports the EXTCELL_DOUBLE from the passed stream. */
+    void                importExtCellDouble( RecordInputStream& rStrm );
+    /** Imports the EXTCELL_ERROR from the passed stream. */
+    void                importExtCellError( RecordInputStream& rStrm );
+    /** Imports the EXTCELL_STRING from the passed stream. */
+    void                importExtCellString( RecordInputStream& rStrm );
+
+    /** Sets the passed cell value to the current position in the sheet cache. */
+    void                setCellValue( const ::com::sun::star::uno::Any& rValue );
+
+private:
+    ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >
+                        mxSheetCache;               /// The sheet cache used to store external cell values.
+    ::com::sun::star::table::CellAddress maCurrPos; /// Position of current cell.
+    sal_Int32           mnCurrType;                 /// Data type of current cell.
+};
 
 // ============================================================================
 
@@ -66,8 +113,7 @@ protected:
     virtual const ::oox::core::RecordInfo* getRecordInfos() const;
 
 private:
-    ::rtl::Reference< OoxExternalSheetDataContext >
-                        createSheetDataContext( sal_Int32 nSheetId );
+    ContextWrapper      createSheetDataContext( sal_Int32 nSheetId );
 
 private:
     ExternalLink&       mrExtLink;
@@ -78,36 +124,36 @@ private:
 
 // ============================================================================
 
-class BiffExternalSheetDataContext;
-
 class BiffExternalLinkFragment : public BiffWorkbookFragmentBase
 {
 public:
-    explicit            BiffExternalLinkFragment( const WorkbookHelper& rHelper, bool bImportDefNames );
+    explicit            BiffExternalLinkFragment( const BiffWorkbookFragmentBase& rParent, bool bImportDefNames );
     virtual             ~BiffExternalLinkFragment();
 
     /** Imports all records related to external links. */
-    virtual bool        importFragment( BiffInputStream& rStrm );
+    virtual bool        importFragment();
 
     /** Tries to import a record related to external links and defined names. */
-    void                importRecord( BiffInputStream& rStrm );
+    void                importRecord();
 
     /** Finalizes buffers related to external links and defined names. */
     void                finalizeImport();
 
 private:
-    void                importExternSheet( BiffInputStream& rStrm );
-    void                importExternalBook( BiffInputStream& rStrm );
-    void                importExternalName( BiffInputStream& rStrm );
-    void                importXct( BiffInputStream& rStrm );
-    void                importCrn( BiffInputStream& rStrm );
-    void                importDefinedName( BiffInputStream& rStrm );
+    void                importExternSheet();
+    void                importExternalBook();
+    void                importExternalName();
+    void                importXct();
+    void                importCrn();
+    void                importDefinedName();
 
-private:
-    typedef ::boost::shared_ptr< BiffExternalSheetDataContext > SheetContextRef;
+    /** Sets the passed cell value to the passed position in the sheet cache. */
+    void                setCellValue( const BinAddress& rBinAddr, const ::com::sun::star::uno::Any& rValue );
 
-    SheetContextRef     mxContext;
-    ExternalLinkRef     mxExtLink;
+private:
+    ExternalLinkRef     mxExtLink;              /// Current external link.
+    ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache >
+                        mxSheetCache;           /// The sheet cache used to store external cell values.
     bool                mbImportDefNames;
 };
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/formulabase.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/formulabase.hxx
--- oox/inc/oox/xls/formulabase.hxx	2008-07-22 15:30:03.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/formulabase.hxx	2009-01-06 15:57:48.000000000 +0100
@@ -36,10 +36,12 @@
 #include <com/sun/star/table/CellRangeAddress.hpp>
 #include <com/sun/star/sheet/FormulaToken.hpp>
 #include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp>
+#include "oox/helper/containerhelper.hxx"
 #include "oox/xls/addressconverter.hxx"
 
 namespace com { namespace sun { namespace star {
     namespace sheet { class XFormulaTokens; }
+    namespace sheet { class XFormulaOpCodeMapper; }
 } } }
 
 namespace oox { template< typename Type > class Matrix; }
@@ -216,12 +218,13 @@ const sal_uInt16 OOBIN_FUNC_FALSE       
 const sal_uInt16 OOBIN_FUNC_ROWS                = 76;       /// OOBIN function id of the ROWS function.
 const sal_uInt16 OOBIN_FUNC_COLUMNS             = 77;       /// OOBIN function id of the COLUMNS function.
 const sal_uInt16 OOBIN_FUNC_OFFSET              = 78;       /// OOBIN function id of the OFFSET function.
-const sal_uInt16 OOBIN_FUNC_EXTERNCALL          = 255;      /// OOBIN function id of the EXTERN.CALL function.
 const sal_uInt16 OOBIN_FUNC_FLOOR               = 285;      /// OOBIN function id of the FLOOR function.
 const sal_uInt16 OOBIN_FUNC_CEILING             = 288;      /// OOBIN function id of the CEILING function.
+const sal_uInt16 OOBIN_FUNC_HYPERLINK           = 359;      /// OOBIN function id of the HYPERLINK function.
 const sal_uInt16 OOBIN_FUNC_WEEKNUM             = 465;      /// OOBIN function id of the WEEKNUM function.
 
 const sal_uInt16 BIFF_FUNC_SUM                  = 4;        /// BIFF function id of the SUM function.
+const sal_uInt16 BIFF_FUNC_EXTERNCALL           = 255;      /// BIFF function id of the EXTERN.CALL function.
 
 // reference helpers ==========================================================
 
@@ -257,14 +260,61 @@ struct BinComplexRef2d
     void                readBiff8Data( BiffInputStream& rStrm, bool bRelativeAsOffset );
 };
 
+// token vector, sequence =====================================================
+
+typedef ::com::sun::star::sheet::FormulaToken       ApiToken;
+typedef ::com::sun::star::uno::Sequence< ApiToken > ApiTokenSequence;
+
+/** A vector of formula tokens with additional convenience functions. */
+class ApiTokenVector : public ::std::vector< ApiToken >
+{
+public:
+    explicit            ApiTokenVector();
+
+    /** Appends a new token with the passed op-code, returns its data field. */
+    ::com::sun::star::uno::Any&
+                        append( sal_Int32 nOpCode );
+
+    /** Appends a new token with the passed op-code and data. */
+    template< typename Type >
+    inline void         append( sal_Int32 nOpCode, const Type& rData ) { append( nOpCode ) <<= rData; }
+};
+
+// token sequence iterator ====================================================
+
+/** Token sequence iterator that is able to skip space tokens. */
+class ApiTokenIterator
+{
+public:
+    explicit            ApiTokenIterator( const ApiTokenSequence& rTokens, sal_Int32 nSpacesOpCode, bool bSkipSpaces );
+    /** Copy constructor that allows to change the skip spaces mode. */
+    explicit            ApiTokenIterator( const ApiTokenIterator& rIter, bool bSkipSpaces );
+
+    inline bool         is() const { return mpToken != mpTokenEnd; }
+    inline const ApiToken* get() const { return mpToken; }
+    inline const ApiToken* operator->() const { return mpToken; }
+    inline const ApiToken& operator*() const { return *mpToken; }
+
+    ApiTokenIterator&   operator++();
+
+private:
+    void                skipSpaces();
+
+private:
+    const ApiToken*     mpToken;            /// Pointer to current token of the token sequence.
+    const ApiToken*     mpTokenEnd;         /// Pointer behind last token of the token sequence.
+    const sal_Int32     mnSpacesOpCode;     /// Op-code for whitespace tokens.
+    const bool          mbSkipSpaces;       /// true = Skip whitespace tokens.
+};
+
 // list of API op-codes =======================================================
 
 /** Contains all API op-codes needed to build formulas with tokens. */
 struct ApiOpCodes
 {
     // special
-    sal_Int32           OPCODE_EXTERNAL;        /// External function call (e.g. add-ins).
     sal_Int32           OPCODE_UNKNOWN;         /// Internal: function name unknown to mapper.
+    sal_Int32           OPCODE_EXTERNAL;        /// External function call (e.g. add-ins).
     // formula structure
     sal_Int32           OPCODE_PUSH;            /// Op-code for common value operands.
     sal_Int32           OPCODE_MISSING;         /// Placeholder for a missing function parameter.
@@ -274,7 +324,7 @@ struct ApiOpCodes
     sal_Int32           OPCODE_NLR;             /// Natural language reference.
     sal_Int32           OPCODE_DDE;             /// DDE link function.
     sal_Int32           OPCODE_MACRO;           /// Macro function call.
-    sal_Int32           OPCODE_BAD;             /// Bad token (formula error).
+    sal_Int32           OPCODE_BAD;             /// Bad token (unknown name, formula error).
     sal_Int32           OPCODE_NONAME;          /// Function style #NAME? error.
     // separators
     sal_Int32           OPCODE_OPEN;            /// Opening parenthesis.
@@ -309,6 +359,16 @@ struct ApiOpCodes
 
 // function data ==============================================================
 
+/** This enumeration contains constants for all known external libraries
+    containing supported sheet functions. */
+enum FunctionLibraryType
+{
+    FUNCLIB_EUROTOOL,           /// EuroTool add-in with EUROCONVERT function.
+    FUNCLIB_UNKNOWN             /// Unknown library.
+};
+
+// ----------------------------------------------------------------------------
+
 const sal_uInt8 FUNCINFO_MAXPARAM           = 30;       /// Maximum parameter count.
 
 const sal_uInt8 FUNCINFO_PARAM_EXCELONLY    = 0x01;     /// Flag for a parameter existing in Excel, but not in Calc.
@@ -331,8 +391,9 @@ struct FunctionInfo
 {
     ::rtl::OUString     maOdfFuncName;      /// ODF function name.
     ::rtl::OUString     maOoxFuncName;      /// OOXML function name.
-    ::rtl::OUString     maExternCallName;   /// Expected name in EXTERN.CALL function.
+    ::rtl::OUString     maBiffMacroName;    /// Expected macro name in EXTERN.CALL function.
     ::rtl::OUString     maExtProgName;      /// Programmatic function name for external functions.
+    FunctionLibraryType meFuncLibType;      /// The external library this function is part of.
     sal_Int32           mnApiOpCode;        /// API function opcode.
     sal_uInt16          mnOobFuncId;        /// OOBIN function identifier.
     sal_uInt16          mnBiffFuncId;       /// BIFF function identifier.
@@ -341,6 +402,9 @@ struct FunctionInfo
     sal_uInt8           mnRetClass;         /// BIFF token class of the return value.
     const sal_uInt8*    mpnParamClass;      /// Expected BIFF token classes of parameters.
     bool                mbVolatile;         /// True = volatile function.
+    bool                mbExternal;         /// True = external function in Calc.
+    bool                mbMacroFunc;        /// True = macro sheet function or command.
+    bool                mbVarParam;         /// True = use a tFuncVar token, also if min/max are equal.
 };
 
 // function info parameter class iterator =====================================
@@ -369,32 +433,21 @@ private:
     const sal_uInt8*    mpnParamClassEnd;
 };
 
-// function provider ==========================================================
-
-typedef ::com::sun::star::sheet::FormulaToken       ApiToken;
-typedef ::com::sun::star::uno::Sequence< ApiToken > ApiTokenSequence;
+// base function provider =====================================================
 
 class FunctionProviderImpl;
+namespace { struct FunctionData; }
 
-/** Provides access to function info structs for all available functions.
+/** Provides access to function info structs for all available sheet functions.
  */
-class FunctionProvider : public ApiOpCodes  // not derived from WorkbookHelper to make it usable in BIFF dumper
+class FunctionProvider  // not derived from WorkbookHelper to make it usable in file dumpers
 {
 public:
-    explicit            FunctionProvider( const WorkbookHelper& rHelper );
-
-    explicit            FunctionProvider(
-                            const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >& rxDocument,
-                            bool bImportFilter );
-
-    explicit            FunctionProvider(
-                            const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >& rxDocument,
-                            BiffType eBiff, bool bImportFilter );
+    explicit            FunctionProvider( FilterType eFilter, BiffType eBiff, bool bImportFilter );
+    virtual             ~FunctionProvider();
 
-                        ~FunctionProvider();
-
-    /** Returns the function info for an API token, or 0 on error. */
-    const FunctionInfo* getFuncInfoFromApiToken( const ApiToken& rToken ) const;
+    /** Returns the function info for an ODF function name, or 0 on error. */
+    const FunctionInfo* getFuncInfoFromOdfFuncName( const ::rtl::OUString& rFuncName ) const;
 
     /** Returns the function info for an OOX function name, or 0 on error. */
     const FunctionInfo* getFuncInfoFromOoxFuncName( const ::rtl::OUString& rFuncName ) const;
@@ -405,43 +458,83 @@ public:
     /** Returns the function info for a BIFF function index, or 0 on error. */
     const FunctionInfo* getFuncInfoFromBiffFuncId( sal_uInt16 nFuncId ) const;
 
-    /** Returns the function info for a specific function expressed by the
+    /** Returns the function info for a macro function referred by the
         EXTERN.CALL function, or 0 on error. */
-    const FunctionInfo* getFuncInfoFromExternCallName( const ::rtl::OUString& rExtCallName ) const;
+    const FunctionInfo* getFuncInfoFromMacroName( const ::rtl::OUString& rFuncName ) const;
 
-    /** Returns the op-code map that is used by the OOX formula parser. */
-    ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry >
-                        getOoxParserMap() const;
+protected:
+    typedef RefVector< FunctionInfo >               FuncVector;
+    typedef RefMap< ::rtl::OUString, FunctionInfo > FuncNameMap;
+    typedef RefMap< sal_uInt16, FunctionInfo >      FuncIdMap;
+
+    typedef ::boost::shared_ptr< FuncVector >       FuncVectorRef;
+    typedef ::boost::shared_ptr< FuncNameMap >      FuncNameMapRef;
+    typedef ::boost::shared_ptr< FuncIdMap >        FuncIdMapRef;
+
+    /** Returns the list of all function infos. */
+    inline const FuncVector& getFuncs() const { return *mxFuncs; }
+
+private:
+    /** Creates and inserts a function info struct from the passed function data. */
+    void                initFunc( const FunctionData& rFuncData, sal_uInt8 nMaxParam );
+
+    /** Initializes the members from the passed function data list. */
+    void                initFuncs(
+                            const FunctionData* pBeg, const FunctionData* pEnd,
+                            sal_uInt8 nMaxParam, bool bImportFilter );
 
 private:
-    ::std::auto_ptr< FunctionProviderImpl > mxImpl;
+    FuncVectorRef       mxFuncs;            /// All function infos in one list.
+    FuncNameMapRef      mxOdfFuncs;         /// Maps ODF function names to function data.
+    FuncNameMapRef      mxOoxFuncs;         /// Maps OOXML function names to function data.
+    FuncIdMapRef        mxOobFuncs;         /// Maps OOBIN function indexes to function data.
+    FuncIdMapRef        mxBiffFuncs;        /// Maps BIFF function indexes to function data.
+    FuncNameMapRef      mxMacroFuncs;       /// Maps macro function names to function data.
 };
 
-// token sequence iterator ====================================================
+// op-code and function provider ==============================================
 
-/** Token sequence iterator that is able to skip space tokens. */
-class ApiTokenIterator
+/** Provides access to API op-codes for all available formula tokens and to
+    function info structs for all available sheet functions.
+ */
+class OpCodeProvider : public ApiOpCodes, public FunctionProvider, public WorkbookHelper
 {
 public:
-    explicit            ApiTokenIterator( const ApiTokenSequence& rTokens, sal_Int32 nSpacesOpCode, bool bSkipSpaces );
-    /** Copy constructor that allows to change the skip spaces mode. */
-    explicit            ApiTokenIterator( const ApiTokenIterator& rIter, bool bSkipSpaces );
+    explicit            OpCodeProvider( const WorkbookHelper& rHelper );
+    virtual             ~OpCodeProvider();
 
-    inline bool         is() const { return mpToken != mpTokenEnd; }
-    inline const ApiToken* get() const { return mpToken; }
-    inline const ApiToken* operator->() const { return mpToken; }
-    inline const ApiToken& operator*() const { return *mpToken; }
+    /** Returns the function info for an API token, or 0 on error. */
+    const FunctionInfo* getFuncInfoFromApiToken( const ApiToken& rToken ) const;
 
-    ApiTokenIterator&   operator++();
+    /** Returns the op-code map that is used by the OOX formula parser. */
+    ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry >
+                        getOoxParserMap() const;
 
 private:
-    void                skipSpaces();
+    typedef ::std::map< ::rtl::OUString, ApiToken >                                             ApiTokenMap;
+    typedef ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry >   OpCodeEntrySequence;
+    typedef ::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >                     OpCodeEntryVector;
+
+    static bool         fillEntrySeq( OpCodeEntrySequence& orEntrySeq, const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper >& rxMapper, sal_Int32 nMapGroup );
+    static bool         fillTokenMap( ApiTokenMap& orTokenMap, OpCodeEntrySequence& orEntrySeq, const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper >& rxMapper, sal_Int32 nMapGroup );
+    bool                fillFuncTokenMaps( ApiTokenMap& orIntFuncTokenMap, ApiTokenMap& orExtFuncTokenMap, OpCodeEntrySequence& orEntrySeq, const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper >& rxMapper ) const;
+
+    static bool         initOpCode( sal_Int32& ornOpCode, const OpCodeEntrySequence& rEntrySeq, sal_Int32 nSpecialId );
+    bool                initOpCode( sal_Int32& ornOpCode, const ApiTokenMap& rTokenMap, const ::rtl::OUString& rOdfName, const ::rtl::OUString& rOoxName );
+    bool                initOpCode( sal_Int32& ornOpCode, const ApiTokenMap& rTokenMap, const sal_Char* pcOdfName, const sal_Char* pcOoxName );
+    bool                initOpCode( sal_Int32& ornOpCode, const ApiTokenMap& rTokenMap, sal_Unicode cOdfName, sal_Unicode cOoxName );
+
+    bool                initFuncOpCode( FunctionInfo& orFuncInfo, const ApiTokenMap& rFuncTokenMap );
+    bool                initFuncOpCodes( const ApiTokenMap& rIntFuncTokenMap, const ApiTokenMap& rExtFuncTokenMap );
 
 private:
-    const ApiToken*     mpToken;            /// Pointer to current token of the token sequence.
-    const ApiToken*     mpTokenEnd;         /// Pointer behind last token of the token sequence.
-    const sal_Int32     mnSpacesOpCode;     /// Op-code for whitespace tokens.
-    const bool          mbSkipSpaces;       /// true = Skip whitespace tokens.
+    typedef RefMap< sal_Int32, FunctionInfo >           OpCodeFuncMap;
+    typedef ::boost::shared_ptr< OpCodeFuncMap >        OpCodeFuncMapRef;
+    typedef ::boost::shared_ptr< OpCodeEntryVector >    OpCodeEntryVectorRef;
+
+    OpCodeFuncMapRef    mxOpCodeFuncs;      /// Maps API op-codes to function data.
+    FuncNameMapRef      mxExtProgFuncs;     /// Maps programmatical API function names to function data.
+    OpCodeEntryVectorRef mxParserMap;       /// OOXML token mapping for formula parser service.
 };
 
 // formula contexts ===========================================================
@@ -509,7 +602,7 @@ private:
 // formula parser/formula compiler base class =================================
 
 /** Base class for import formula parsers and export formula compilers. */
-class FormulaProcessorBase : public WorkbookHelper
+class FormulaProcessorBase : public OpCodeProvider
 {
 public:
     explicit            FormulaProcessorBase( const WorkbookHelper& rHelper );
@@ -682,8 +775,7 @@ public:
                             sal_Unicode cStringSep,
                             bool bTrimLeadingSpaces ) const;
 
-protected:
-    FunctionProvider    maFuncProv;         /// Provides info structs for all functions.
+private:
     const ::rtl::OUString maAbsNameProp;    /// Property name for absolute name of cells and ranges.
 };
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/formulaparser.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/formulaparser.hxx
--- oox/inc/oox/xls/formulaparser.hxx	2008-04-10 16:56:39.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/formulaparser.hxx	2009-03-20 10:28:22.000000000 +0100
@@ -80,6 +80,14 @@ public:
                             FormulaContext& rContext,
                             sal_Int32 nTokenIndex ) const;
 
+    /** Converts the passed number into a HYPERLINK formula with the passed URL. */
+    void                convertNumberToHyperlink(
+                            FormulaContext& rContext,
+                            const ::rtl::OUString& rUrl,
+                            double fValue ) const;
+
+    ::rtl::OUString     printFormulaTokens( const ApiTokenSequence& rTokens );
+
 private:
     ::std::auto_ptr< FormulaParserImpl > mxImpl;
 };
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/richstring.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/richstring.hxx
--- oox/inc/oox/xls/richstring.hxx	2008-04-10 16:58:54.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/richstring.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -86,6 +86,15 @@ typedef ::boost::shared_ptr< RichStringP
 
 // ----------------------------------------------------------------------------
 
+enum BiffFontPortionMode
+{
+    BIFF_FONTPORTION_8BIT,              /// Font portion with 8-bit values.
+    BIFF_FONTPORTION_16BIT,             /// Font portion with 16-bit values.
+    BIFF_FONTPORTION_OBJ                /// Font portion in OBJ or TXO record.
+};
+
+// ----------------------------------------------------------------------------
+
 /** Represents a position in a rich-string containing current font identifier.
 
     This object stores the position of a formatted character in a rich-string
@@ -102,7 +111,7 @@ struct BinFontPortionData
                             mnPos( nPos ), mnFontId( nFontId ) {}
 
     void                read( RecordInputStream& rStrm );
-    void                read( BiffInputStream& rStrm, bool b16Bit );
+    void                read( BiffInputStream& rStrm, BiffFontPortionMode eMode );
 };
 
 // ----------------------------------------------------------------------------
@@ -118,7 +127,7 @@ public:
     /** Reads count and font identifiers from the passed stream. */
     void                importPortions( RecordInputStream& rStrm );
     /** Reads nCount font identifiers from the passed stream. */
-    void                importPortions( BiffInputStream& rStrm, sal_uInt16 nCount, bool b16Bit );
+    void                importPortions( BiffInputStream& rStrm, sal_uInt16 nCount, BiffFontPortionMode eMode );
     /** Reads count and font identifiers from the passed stream. */
     void                importPortions( BiffInputStream& rStrm, bool b16Bit );
 };
@@ -213,7 +222,7 @@ public:
     /** Reads all phonetic portions from the passed stream. */
     void                importPortions( RecordInputStream& rStrm );
     /** Reads phonetic portion data from the passed stream. */
-    ::rtl::OUString     importPortions( BiffInputStream& rStrm, sal_uInt32 nPhoneticSize );
+    ::rtl::OUString     importPortions( BiffInputStream& rStrm, sal_Int32 nPhoneticSize );
 };
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/sheetdatacontext.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/sheetdatacontext.hxx
--- oox/inc/oox/xls/sheetdatacontext.hxx	2008-04-10 17:00:33.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/sheetdatacontext.hxx	2008-12-12 11:38:47.000000000 +0100
@@ -33,7 +33,6 @@
 
 #include "oox/xls/excelhandlers.hxx"
 #include "oox/xls/richstring.hxx"
-#include "oox/xls/worksheethelper.hxx"
 
 namespace com { namespace sun { namespace star {
     namespace table { class XCell; }
@@ -115,101 +114,54 @@ private:
 
 // ============================================================================
 
-/** This class implements importing the sheetData element in external sheets.
-
-    The sheetData element embedded in the externalBook element contains cached
-    cells from externally linked sheets.
- */
-class OoxExternalSheetDataContext : public OoxWorksheetContextBase
-{
-public:
-    explicit            OoxExternalSheetDataContext(
-                            OoxWorkbookFragmentBase& rFragment,
-                            WorksheetType eSheetType,
-                            sal_Int32 nSheet );
-
-protected:
-    // oox.core.ContextHandler2Helper interface -------------------------------
-
-    virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
-    virtual void        onStartElement( const AttributeList& rAttribs );
-    virtual void        onEndElement( const ::rtl::OUString& rChars );
-
-    virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
-    virtual void        onStartRecord( RecordInputStream& rStrm );
-
-private:
-    /** Imports cell settings from a c element. */
-    void                importCell( const AttributeList& rAttribs );
-
-    void                importCellHeader( RecordInputStream& rStrm );
-
-    /** Imports the EXTCELL_BLANK from the passed stream. */
-    void                importExtCellBlank( RecordInputStream& rStrm );
-    /** Imports the EXTCELL_BOOL from the passed stream. */
-    void                importExtCellBool( RecordInputStream& rStrm );
-    /** Imports the EXTCELL_DOUBLE from the passed stream. */
-    void                importExtCellDouble( RecordInputStream& rStrm );
-    /** Imports the EXTCELL_ERROR from the passed stream. */
-    void                importExtCellError( RecordInputStream& rStrm );
-    /** Imports the EXTCELL_STRING from the passed stream. */
-    void                importExtCellString( RecordInputStream& rStrm );
-
-private:
-    OoxCellData         maCurrCell;         /// Position of current imported cell.
-    BinAddress          maCurrPos;          /// Current position for binary import.
-};
-
-// ============================================================================
-
 /** This class implements importing row settings and all cells of a sheet.
  */
-class BiffSheetDataContext : public WorksheetHelper
+class BiffSheetDataContext : public BiffWorksheetContextBase
 {
 public:
-    explicit            BiffSheetDataContext( const WorksheetHelper& rHelper );
+    explicit            BiffSheetDataContext( const BiffWorksheetFragmentBase& rParent );
 
     /** Tries to import a sheet data record. */
-    void                importRecord( BiffInputStream& rStrm );
+    virtual void        importRecord();
 
 private:
     /** Sets current cell according to the passed address. */
     void                setCurrCell( const BinAddress& rAddr );
 
     /** Imports an XF identifier and sets the mnXfId member. */
-    void                importXfId( BiffInputStream& rStrm, bool bBiff2 );
+    void                importXfId( bool bBiff2 );
     /** Imports a BIFF cell address and the following XF identifier. */
-    void                importCellHeader( BiffInputStream& rStrm, bool bBiff2 );
+    void                importCellHeader( bool bBiff2 );
 
     /** Imports a BLANK record describing a blank but formatted cell. */
-    void                importBlank( BiffInputStream& rStrm );
+    void                importBlank();
     /** Imports a BOOLERR record describing a boolean or error code cell. */
-    void                importBoolErr( BiffInputStream& rStrm );
+    void                importBoolErr();
     /** Imports a FORMULA record describing a formula cell. */
-    void                importFormula( BiffInputStream& rStrm );
+    void                importFormula();
     /** Imports an INTEGER record describing a BIFF2 integer cell. */
-    void                importInteger( BiffInputStream& rStrm );
+    void                importInteger();
     /** Imports a LABEL record describing an unformatted string cell. */
-    void                importLabel( BiffInputStream& rStrm );
+    void                importLabel();
     /** Imports a LABELSST record describing a string cell using the shared string list. */
-    void                importLabelSst( BiffInputStream& rStrm );
+    void                importLabelSst();
     /** Imports a MULTBLANK record describing a range of blank but formatted cells. */
-    void                importMultBlank( BiffInputStream& rStrm );
+    void                importMultBlank();
     /** Imports a MULTRK record describing a range of numeric cells. */
-    void                importMultRk( BiffInputStream& rStrm );
+    void                importMultRk();
     /** Imports a NUMBER record describing a floating-point cell. */
-    void                importNumber( BiffInputStream& rStrm );
+    void                importNumber();
     /** Imports an RK record describing a numeric cell. */
-    void                importRk( BiffInputStream& rStrm );
+    void                importRk();
 
     /** Imports row settings from a ROW record. */
-    void                importRow( BiffInputStream& rStrm );
+    void                importRow();
     /** Imports an ARRAY record describing an array formula of a cell range. */
-    void                importArray( BiffInputStream& rStrm );
+    void                importArray();
     /** Imports a SHAREDFMLA record describing a shared formula in a cell range. */
-    void                importSharedFmla( BiffInputStream& rStrm );
+    void                importSharedFmla();
     /** Imports table operation from a DATATABLE or DATATABLE2 record. */
-    void                importDataTable( BiffInputStream& rStrm );
+    void                importDataTable();
 
 private:
     OoxCellData         maCurrCell;             /// Position and formatting of current imported cell.
@@ -220,22 +172,6 @@ private:
 
 // ============================================================================
 
-/** This class implements importing cached cell data of external links.
- */
-class BiffExternalSheetDataContext : public WorksheetHelperRoot
-{
-public:
-    explicit            BiffExternalSheetDataContext(
-                            const WorkbookHelper& rHelper,
-                            WorksheetType eSheetType,
-                            sal_Int32 nSheet );
-
-    /** Import the CRN record containing cached cell values. */
-    void                importCrn( BiffInputStream& rStrm );
-};
-
-// ============================================================================
-
 } // namespace xls
 } // namespace oox
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/stylespropertyhelper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/stylespropertyhelper.hxx
--- oox/inc/oox/xls/stylespropertyhelper.hxx	2008-04-10 17:01:26.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/stylespropertyhelper.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -83,20 +83,32 @@ struct ApiFontUsedFlags
 
 // ----------------------------------------------------------------------------
 
+/** Contains API font name, family, and charset for a script type. */
+struct ApiScriptFontName
+{
+    ::rtl::OUString     maName;             /// Font name.
+    sal_Int16           mnFamily;           /// Font family.
+    sal_Int16           mnCharSet;          /// Font character set.
+
+    explicit            ApiScriptFontName();
+};
+
+// ----------------------------------------------------------------------------
+
 /** Contains all API font attributes. */
 struct ApiFontData
 {
     typedef ::com::sun::star::awt::FontDescriptor ApiFontDescriptor;
 
-    ApiFontDescriptor   maDesc;             /// Font descriptor holding most font information (height in twips, weight in %).
+    ApiScriptFontName   maLatinFont;        /// Font name for latin scripts.
+    ApiScriptFontName   maAsianFont;        /// Font name for east-asian scripts.
+    ApiScriptFontName   maCmplxFont;        /// Font name for complex scripts.
+    ApiFontDescriptor   maDesc;             /// Font descriptor (height in twips, weight in %).
     sal_Int32           mnColor;            /// Font color.
     sal_Int16           mnEscapement;       /// Escapement style.
     sal_Int8            mnEscapeHeight;     /// Escapement font height.
     bool                mbOutline;          /// True = outlined characters.
     bool                mbShadow;           /// True = shadowed chgaracters.
-    bool                mbHasWstrn;         /// True = font contains Western script characters.
-    bool                mbHasAsian;         /// True = font contains Asian script characters.
-    bool                mbHasCmplx;         /// True = font contains Complex script characters.
 
     explicit            ApiFontData();
 };
@@ -231,7 +243,7 @@ public:
                             const ApiSolidFillData& rFillData );
 
 private:
-    PropertySequence    maWstrnFontNameProps;
+    PropertySequence    maLatinFontNameProps;
     PropertySequence    maAsianFontNameProps;
     PropertySequence    maCmplxFontNameProps;
     PropertySequence    maFontHeightProps;
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/themebuffer.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/themebuffer.hxx
--- oox/inc/oox/xls/themebuffer.hxx	2008-04-18 16:07:28.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/themebuffer.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -41,18 +41,12 @@ struct OoxFontData;
 
 // ============================================================================
 
-class ThemeBuffer : public WorkbookHelper
+class ThemeBuffer : public ::oox::drawingml::Theme, public WorkbookHelper
 {
 public:
     explicit            ThemeBuffer( const WorkbookHelper& rHelper );
     virtual             ~ThemeBuffer();
 
-    /** Returns the pointer to the core drawingml theme. */
-    inline const ::oox::drawingml::ThemePtr& getCoreThemePtr() const { return mxTheme; }
-
-    /** Returns the core drawingml theme needed by the theme fragment importer. */
-    ::oox::drawingml::Theme& getOrCreateCoreTheme();
-
     /** Returns the theme color with the specified token identifier. */
     sal_Int32           getColorByToken( sal_Int32 nToken ) const;
     /** Returns the theme color with the specified index. */
@@ -63,8 +57,6 @@ public:
 
 private:
     typedef ::std::auto_ptr< OoxFontData > OoxFontDataPtr;
-
-    ::oox::drawingml::ThemePtr mxTheme;
     OoxFontDataPtr      mxDefFontData;
 };
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/validationpropertyhelper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/validationpropertyhelper.hxx
--- oox/inc/oox/xls/validationpropertyhelper.hxx	2008-04-10 17:02:42.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/validationpropertyhelper.hxx	1970-01-01 01:00:00.000000000 +0100
@@ -1,71 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: validationpropertyhelper.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef OOX_XLS_VALIDATIONPROPERTYHELPER_HXX
-#define OOX_XLS_VALIDATIONPROPERTYHELPER_HXX
-
-#include <com/sun/star/sheet/ConditionOperator.hpp>
-#include "oox/helper/propertysequence.hxx"
-#include "oox/xls/workbookhelper.hxx"
-
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-struct OoxValidationData;
-
-/** Helper for data validation related properties. */
-class ValidationPropertyHelper : public WorkbookHelper
-{
-public:
-    explicit            ValidationPropertyHelper( const WorkbookHelper& rHelper );
-
-    /** Writes data validation properties to the passed property set. */
-    void                writeValidationProperties(
-                            PropertySet& rPropSet,
-                            const OoxValidationData& rValData );
-
-    /** Converts an OOXML condition operator token to the API constant. */
-    static ::com::sun::star::sheet::ConditionOperator
-                        convertToApiOperator( sal_Int32 nToken );
-
-private:
-    PropertySequence    maValProps;
-    const ::rtl::OUString maValidationProp;     /// Property name for data validation settings.
-};
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
-
-#endif
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/viewsettings.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/viewsettings.hxx
--- oox/inc/oox/xls/viewsettings.hxx	2008-04-18 16:07:51.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/viewsettings.hxx	2009-03-19 14:28:43.000000000 +0100
@@ -83,6 +83,7 @@ struct OoxSheetViewData
     bool                mbShowZeros;                    /// True = show zero value zells.
     bool                mbShowOutline;                  /// True = show outlines.
     bool                mbZoomToFit;                    /// True = zoom chart sheet to fit window.
+    Color               maTabColor;                     /// Sheet tab color.
 
     explicit            OoxSheetViewData();
 
@@ -112,6 +113,8 @@ public:
 
     /** Imports the sheetView element containing sheet view settings. */
     void                importSheetView( const AttributeList& rAttribs );
+    /** Imports the tabcolor element containing tab color settings. */
+    void                importTabColor( const AttributeList& rAttribs );
     /** Imports the pane element containing sheet pane settings. */
     void                importPane( const AttributeList& rAttribs );
     /** Imports the selection element containing selection settings for a pane. */
@@ -121,6 +124,8 @@ public:
 
     /** Imports the SHEETVIEW record containing sheet view settings. */
     void                importSheetView( RecordInputStream& rStrm );
+    /** Imports the tabcolor element containing tab color settings. */
+    void                importTabColor( RecordInputStream& rStrm );
     /** Imports the PANE record containing sheet pane settings. */
     void                importPane( RecordInputStream& rStrm );
     /** Imports the SELECTION record containing selection settings for a pane. */
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/workbookfragment.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/workbookfragment.hxx
--- oox/inc/oox/xls/workbookfragment.hxx	2008-04-10 17:03:32.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/workbookfragment.hxx	2008-09-30 16:51:36.000000000 +0200
@@ -31,7 +31,6 @@
 #ifndef OOX_XLS_WORKBOOKFRAGMENT_HXX
 #define OOX_XLS_WORKBOOKFRAGMENT_HXX
 
-#include "oox/xls/bifffragmenthandler.hxx"
 #include "oox/xls/defnamesbuffer.hxx"
 #include "oox/xls/excelhandlers.hxx"
 
@@ -82,26 +81,23 @@ private:
 class BiffWorkbookFragment : public BiffWorkbookFragmentBase
 {
 public:
-    explicit            BiffWorkbookFragment( const WorkbookHelper& rHelper );
+    explicit            BiffWorkbookFragment( const WorkbookHelper& rHelper, BiffInputStream& rStrm );
 
     /** Imports the entire workbook stream, including all contained worksheets. */
-    virtual bool        importFragment( BiffInputStream& rStrm );
+    virtual bool        importFragment();
 
 private:
     /** Imports a complete BIFF4 workspace fragment (with embedded sheets). */
-    bool                importWorkspaceFragment( BiffInputStream& rStrm );
+    bool                importWorkspaceFragment();
     /** Imports the workbook globals fragment from current stream position. */
-    bool                importGlobalsFragment(
-                            BiffInputStream& rStrm,
-                            ISegmentProgressBar& rProgressBar );
+    bool                importGlobalsFragment( ISegmentProgressBar& rProgressBar );
     /** Imports a sheet fragment with passed type from current stream position. */
     bool                importSheetFragment(
-                            BiffInputStream& rStrm,
                             ISegmentProgressBar& rProgressBar,
                             BiffFragmentType eFragment, sal_Int32 nSheet );
 
     /** Imports the FILEPASS record and sets a decoder at the passed stream. */
-    bool                importFilePass( BiffInputStream& rStrm );
+    bool                importFilePass();
 };
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/workbookhelper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/workbookhelper.hxx
--- oox/inc/oox/xls/workbookhelper.hxx	2008-04-18 16:08:14.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/workbookhelper.hxx	2008-12-12 11:38:47.000000000 +0100
@@ -43,7 +43,9 @@ namespace com { namespace sun { namespac
     namespace sheet { class XSpreadsheetDocument; }
     namespace sheet { class XSpreadsheet; }
     namespace sheet { class XNamedRanges; }
+    namespace sheet { class XNamedRange; }
     namespace sheet { class XDatabaseRanges; }
+    namespace sheet { class XExternalDocLinks; }
     namespace style { class XStyle; }
 } } }
 
@@ -60,6 +62,10 @@ namespace oox { namespace core {
     class XmlFilterBase;
 } }
 
+namespace oox { namespace drawingml {
+    class Theme;
+} }
+
 namespace oox {
 namespace xls {
 
@@ -109,7 +115,6 @@ class AddressConverter;
 class ExcelChartConverter;
 class StylesPropertyHelper;
 class PageSettingsPropertyHelper;
-class ValidationPropertyHelper;
 
 /** Helper class to provice access to global workbook data.
 
@@ -162,6 +167,9 @@ public:
     /** Returns the container for database ranges from the Calc document. */
     ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDatabaseRanges >
                         getDatabaseRanges() const;
+    /** Returns the container for external documents from the Calc document. */
+    ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLinks >
+                        getExternalDocLinks() const;
     /** Returns the container for DDE links from the Calc document. */
     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
                         getDdeLinks() const;
@@ -173,12 +181,19 @@ public:
     ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >
                         getStyleObject( const ::rtl::OUString& rStyleName, bool bPageStyle ) const;
 
+    /** Creates and returns a defined name on-the-fly in the Calc document.
+        The name will not be buffered in this defined names buffer.
+        @param orName  (in/out-parameter) Returns the resulting used name. */
+    ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XNamedRange >
+                        createNamedRangeObject(
+                            ::rtl::OUString& orName,
+                            sal_Int32 nNameFlags = 0 ) const;
     /** Creates a com.sun.star.style.Style object and returns its final name. */
     ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >
                         createStyleObject(
                             ::rtl::OUString& orStyleName,
                             bool bPageStyle,
-                            bool bRenameOldExisting = false );
+                            bool bRenameOldExisting = false ) const;
 
     // buffers ----------------------------------------------------------------
 
@@ -190,6 +205,8 @@ public:
     WorksheetBuffer&    getWorksheets() const;
     /** Returns the office theme object read from the theme substorage. */
     ThemeBuffer&        getTheme() const;
+    /** Returns the office theme object reference read from the theme substorage. */
+    ::boost::shared_ptr< ::oox::drawingml::Theme > getThemeRef() const;
     /** Returns all cell formatting objects read from the styles substream. */
     StylesBuffer&       getStyles() const;
     /** Returns the shared strings read from the shared strings substream. */
@@ -222,8 +239,6 @@ public:
     StylesPropertyHelper& getStylesPropertyHelper() const;
     /** Returns the converter for properties related to page and print settings. */
     PageSettingsPropertyHelper& getPageSettingsPropertyHelper() const;
-    /** Returns the converter for properties related to data validation. */
-    ValidationPropertyHelper& getValidationPropertyHelper() const;
 
     // OOX specific -----------------------------------------------------------
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/worksheetbuffer.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/worksheetbuffer.hxx
--- oox/inc/oox/xls/worksheetbuffer.hxx	2008-07-08 09:25:57.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/worksheetbuffer.hxx	2008-12-12 11:38:47.000000000 +0100
@@ -48,7 +48,7 @@ namespace xls {
 /** Contains data from the 'sheet' element describing a sheet in the workbook. */
 struct OoxSheetInfo
 {
-    ::rtl::OUString     maId;           /// Relation identifier for the sheet substream.
+    ::rtl::OUString     maRelId;        /// Relation identifier for the sheet substream.
     ::rtl::OUString     maName;         /// Original name of the sheet.
     ::rtl::OUString     maFinalName;    /// Final (converted) name of the sheet.
     sal_Int32           mnSheetId;      /// Sheet identifier.
@@ -59,8 +59,7 @@ struct OoxSheetInfo
 
 // ============================================================================
 
-/** Stores information about all internal and external linked sheets in a
-    spreadsheet document.
+/** Stores information about all sheets in a spreadsheet document.
 
     Information about sheets includes the sheet name, the visibility state, and
     for the OOX filter, the relation identifier of the sheet used to obtain the
@@ -81,14 +80,8 @@ public:
     /** Imports the SHEET record from the passed BIFF stream. */
     void                importSheet( BiffInputStream& rStrm );
 
-    /** Inserts an external linked sheet into the document, looks for existing sheet.
-         @return  Internal index of the linked sheet. */
-    sal_Int32           insertExternalSheet(
-                            const ::rtl::OUString& rTargetUrl,
-                            const ::rtl::OUString& rSheetName );
-
-    /** Returns the number of internal sheets. */
-    sal_Int32           getInternalSheetCount() const;
+    /** Returns the number of sheets contained in the workbook. */
+    sal_Int32           getSheetCount() const;
     /** Returns the OOX relation identifier of the specified sheet. */
     ::rtl::OUString     getSheetRelId( sal_Int32 nSheet ) const;
     /** Returns the finalized name of the specified sheet. */
@@ -99,7 +92,6 @@ public:
     sal_Int32           getFinalSheetIndex( const ::rtl::OUString& rName ) const;
 
 private:
-    sal_Int16           getTotalSheetCount() const;
     const OoxSheetInfo* getSheetInfo( sal_Int32 nSheet ) const;
 
     ::rtl::OUString     insertSheet( const ::rtl::OUString& rName, sal_Int16 nSheet, bool bVisible );
@@ -107,12 +99,9 @@ private:
 
 private:
     typedef ::std::vector< OoxSheetInfo >                   SheetInfoVec;
-    typedef ::std::pair< ::rtl::OUString, ::rtl::OUString > ExternalSheetName;
-    typedef ::std::map< ExternalSheetName, sal_Int16 >      ExternalSheetMap;
 
     const ::rtl::OUString maIsVisibleProp;
     SheetInfoVec        maSheetInfos;
-    ExternalSheetMap    maExternalSheets;
 };
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/worksheetfragment.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/worksheetfragment.hxx
--- oox/inc/oox/xls/worksheetfragment.hxx	2008-04-10 17:04:36.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/worksheetfragment.hxx	2009-03-23 21:12:46.000000000 +0100
@@ -31,7 +31,6 @@
 #ifndef OOX_XLS_WORKSHEETFRAGMENT_HXX
 #define OOX_XLS_WORKSHEETFRAGMENT_HXX
 
-#include "oox/xls/bifffragmenthandler.hxx"
 #include "oox/xls/excelhandlers.hxx"
 
 namespace oox {
@@ -84,6 +83,12 @@ private:
     void                importBrk( const AttributeList& rAttribs );
     /** Imports the the relation identifier for the DrawingML part. */
     void                importDrawing( const AttributeList& rAttribs );
+    /** Imports the the relation identifier for the legacy VML drawing part. */
+    void                importLegacyDrawing( const AttributeList& rAttribs );
+    /** Imports additional data for an OLE object. */
+    void                importOleObject( const AttributeList& rAttribs );
+    /** Imports additional data for an OCX form control. */
+    void                importControl( const AttributeList& rAttribs );
 
     /** Imports the DIMENSION record containing the used area of the sheet. */
     void                importDimension( RecordInputStream& rStrm );
@@ -101,6 +106,12 @@ private:
     void                importBrk( RecordInputStream& rStrm );
     /** Imports the DRAWING record containing the relation identifier for the DrawingML part. */
     void                importDrawing( RecordInputStream& rStrm );
+    /** Imports the LEGACYDRAWING record containing the relation identifier for the VML drawing part. */
+    void                importLegacyDrawing( RecordInputStream& rStrm );
+    /** Imports additional data for an OLE object. */
+    void                importOleObject( RecordInputStream& rStrm );
+    /** Imports additional data for an OCX form control. */
+    void                importControl( RecordInputStream& rStrm );
 
 private:
     ::std::auto_ptr< OoxValidationData > mxValData;
@@ -112,41 +123,43 @@ class BiffWorksheetFragment : public Bif
 {
 public:
     explicit            BiffWorksheetFragment(
-                            const WorkbookHelper& rHelper,
+                            const BiffWorkbookFragmentBase& rParent,
                             ISegmentProgressBarRef xProgressBar,
                             WorksheetType eSheetType,
                             sal_Int32 nSheet );
 
     /** Imports the entire worksheet fragment, returns true, if EOF record has been reached. */
-    virtual bool        importFragment( BiffInputStream& rStrm );
+    virtual bool        importFragment();
 
 private:
     /** Imports the COLINFO record and sets column properties and formatting. */
-    void                importColInfo( BiffInputStream& rStrm );
+    void                importColInfo();
     /** Imports the BIFF2 COLUMNDEFAULT record and sets column default formatting. */
-    void                importColumnDefault( BiffInputStream& rStrm );
+    void                importColumnDefault();
     /** Imports the BIFF2 COLWIDTH record and sets column width. */
-    void                importColWidth( BiffInputStream& rStrm );
+    void                importColWidth();
     /** Imports the DATAVALIDATION record containing cell ranges with data validation settings. */
-    void                importDataValidation( BiffInputStream& rStrm );
+    void                importDataValidation();
     /** Imports the DATAVALIDATIONS record containing global data validation settings. */
-    void                importDataValidations( BiffInputStream& rStrm );
+    void                importDataValidations();
     /** Imports the DEFCOLWIDTH record and sets default column width. */
-    void                importDefColWidth( BiffInputStream& rStrm );
+    void                importDefColWidth();
     /** Imports the DEFROWHEIGHT record and sets default row height and properties. */
-    void                importDefRowHeight( BiffInputStream& rStrm );
+    void                importDefRowHeight();
     /** Imports the DIMENSION record containing the used area of the sheet. */
-    void                importDimension( BiffInputStream& rStrm );
+    void                importDimension();
+    /** Reads a string as used in the HYPERLINK record. */
+    ::rtl::OUString     readHyperlinkString( rtl_TextEncoding eTextEnc, bool bUnicode );
     /** Imports the HYPERLINK record and sets a cell hyperlink. */
-    void                importHyperlink( BiffInputStream& rStrm );
+    void                importHyperlink();
     /** Imports the LABELRANGES record and sets the imported label ranges. */
-    void                importLabelRanges( BiffInputStream& rStrm );
+    void                importLabelRanges();
     /** Imports the MEREDCELLS record and merges all cells in the document. */
-    void                importMergedCells( BiffInputStream& rStrm );
+    void                importMergedCells();
     /** Imports the HORPAGEBREAKS or VERPAGEBREAKS record and inserts page breaks. */
-    void                importPageBreaks( BiffInputStream& rStrm, bool bRowBreak );
+    void                importPageBreaks( bool bRowBreak );
     /** Imports the STANDARDWIDTH record and sets standard column width. */
-    void                importStandardWidth( BiffInputStream& rStrm );
+    void                importStandardWidth();
 };
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/worksheethelper.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/worksheethelper.hxx
--- oox/inc/oox/xls/worksheethelper.hxx	2008-04-10 17:04:55.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/worksheethelper.hxx	2009-03-23 21:13:25.000000000 +0100
@@ -68,7 +68,8 @@ enum WorksheetType
     SHEETTYPE_CHARTSHEET,           /// Chart sheet.
     SHEETTYPE_MACROSHEET,           /// Macro sheet.
     SHEETTYPE_DIALOGSHEET,          /// Dialog sheet (BIFF5+).
-    SHEETTYPE_MODULESHEET           /// VB module sheet (BIFF5 only).
+    SHEETTYPE_MODULESHEET,          /// VB module sheet (BIFF5 only).
+    SHEETTYPE_EMPTYSHEET            /// Other (unsupported) sheet type.
 };
 
 // ============================================================================
@@ -172,6 +173,7 @@ struct OoxHyperlinkData
     ::rtl::OUString     maTarget;
     ::rtl::OUString     maLocation;
     ::rtl::OUString     maDisplay;
+    ::rtl::OUString     maFrame;
     ::rtl::OUString     maTooltip;
 
     explicit            OoxHyperlinkData();
@@ -207,6 +209,33 @@ struct OoxValidationData
     void                setBinErrorStyle( sal_uInt8 nErrorStyle );
 };
 
+// ----------------------------------------------------------------------------
+
+/** Stores data about embedded objects. */
+struct OoxOleObjectData
+{
+    ::rtl::OUString     maProgId;
+    ::rtl::OUString     maStoragePath;
+    sal_Int32           mnAspect;
+    sal_Int32           mnUpdateMode;
+    sal_Int32           mnShapeId;
+    bool                mbAutoLoad;
+
+    explicit            OoxOleObjectData();
+};
+
+// ----------------------------------------------------------------------------
+
+/** Stores data about embedded form controls. */
+struct OoxFormControlData
+{
+    ::rtl::OUString     maStoragePath;
+    ::rtl::OUString     maName;
+    sal_Int32           mnShapeId;
+
+    explicit            OoxFormControlData();
+};
+
 // ============================================================================
 // ============================================================================
 
@@ -310,14 +339,10 @@ public:
     /** Returns the view settings for this sheet. */
     SheetViewSettings&  getSheetViewSettings() const;
 
-    /** Sets a formula resulting in an empty string to the cell. */
-    void                setEmptyStringCell(
-                            const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell ) const;
     /** Sets the passed string to the cell. */
     void                setStringCell(
                             const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
-                            const ::rtl::OUString& rText,
-                            bool bEmptyStringAsFormula = false ) const;
+                            const ::rtl::OUString& rText ) const;
     /** Sets the shared string with the passed identifier to the cell. */
     void                setSharedStringCell(
                             const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
@@ -336,7 +361,7 @@ public:
                             const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
                             sal_uInt8 nErrorCode ) const;
     /** Sets cell contents to the cell specified in the passed cell data object. */
-    void                setOoxCell( OoxCellData& orCellData, bool bEmptyStringAsFormula = false ) const;
+    void                setOoxCell( OoxCellData& orCellData ) const;
 
     /** Changes the current sheet type. */
     void                setSheetType( WorksheetType eSheetType );
@@ -362,6 +387,12 @@ public:
                             const ApiCellRangeList& rRowRanges );
     /** Sets the path to the DrawingML fragment of this sheet. */
     void                setDrawingPath( const ::rtl::OUString& rDrawingPath );
+    /** Sets the path to the legacy VML drawing fragment of this sheet. */
+    void                setVmlDrawingPath( const ::rtl::OUString& rVmlDrawingPath );
+    /** Sets additional data for an OLE object. */
+    void                setOleObject( const OoxOleObjectData& rOleObjectData );
+    /** Sets additional data for an OCX form control. */
+    void                setFormControl( const OoxFormControlData& rFormControlData );
 
     /** Sets base width for all columns (without padding pixels). This value
         is only used, if width has not been set with setDefaultColumnWidth(). */
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/inc/oox/xls/worksheetsettings.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/worksheetsettings.hxx
--- oox/inc/oox/xls/worksheetsettings.hxx	2008-04-18 16:08:46.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/inc/oox/xls/worksheetsettings.hxx	2009-03-19 14:28:43.000000000 +0100
@@ -43,7 +43,6 @@ namespace xls {
 struct OoxSheetPrData
 {
     ::rtl::OUString     maCodeName;             /// VBA module codename.
-    Color               maTabColor;             /// Sheet tab color.
     bool                mbFilterMode;           /// True = sheet contains active filter.
     bool                mbApplyStyles;          /// True = automatic styles when creating outlines.
     bool                mbSummaryBelow;         /// True = row outline symbols below group.
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/prj/build.lst /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/prj/build.lst
--- oox/prj/build.lst	2008-11-03 16:19:11.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/prj/build.lst	2009-03-19 14:28:41.000000000 +0100
@@ -4,6 +4,7 @@ oox	oox\prj				get	-   all	oox_prj NULL
 oox	oox\source\token		nmake	-   all	oox_token NULL
 oox	oox\source\helper		nmake	-   all	oox_helper oox_token NULL
 oox	oox\source\core			nmake	-   all	oox_core oox_token NULL
+oox	oox\source\ole			nmake	-   all	oox_ole oox_token NULL
 oox	oox\source\docprop		nmake	-   all	oox_docprop oox_token NULL
 oox	oox\source\drawingml		nmake	-   all	oox_drawingml oox_token NULL
 oox	oox\source\drawingml\diagram	nmake	-   all	oox_diagram oox_token NULL
@@ -14,4 +15,4 @@ oox	oox\source\vml			nmake	-   all	oox_v
 oox	oox\source\xls			nmake	-   all	oox_xls oox_token NULL
 oox	oox\source\dump			nmake	-   all	oox_dump oox_token NULL
 oox	oox\source\shape		nmake   -   all oox_shape oox_token NULL
-oox	oox\util			nmake   -   all oox_util oox_token oox_helper oox_core oox_vml oox_drawingml oox_diagram oox_chart oox_table oox_ppt oox_xls oox_dump oox_shape oox_docprop NULL
+oox	oox\util			nmake   -   all oox_util oox_token oox_helper oox_core oox_ole oox_vml oox_drawingml oox_diagram oox_chart oox_table oox_ppt oox_xls oox_dump oox_shape oox_docprop NULL
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/prj/d.lst /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/prj/d.lst
--- oox/prj/d.lst	2008-04-18 16:09:00.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/prj/d.lst	2009-01-06 14:16:56.000000000 +0100
@@ -1,4 +1,10 @@
 mkdir: %_DEST%\inc%_EXT%\oox
+mkdir: %_DEST%\inc%_EXT%\oox\core
+mkdir: %_DEST%\inc%_EXT%\oox\helper
+mkdir: %_DEST%\inc%_EXT%\oox\vml
+mkdir: %_DEST%\inc%_EXT%\oox\drawingml
+mkdir: %_DEST%\inc%_EXT%\oox\drawingml\chart
+mkdir: %_DEST%\inc%_EXT%\oox\drawingml\table
 
 ..\%__SRC%\misc\*.map %_DEST%\bin%_EXT%\*.map
 ..\%__SRC%\lib\ixo.lib %_DEST%\lib%_EXT%\ixo.lib
@@ -6,9 +12,21 @@ mkdir: %_DEST%\inc%_EXT%\oox
 ..\%__SRC%\lib\libxol.a %_DEST%\lib%_EXT%\libxol.a
 ..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
 ..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so
+..\%__SRC%\lib\i*.lib %_DEST%\lib%_EXT%\i*.lib
 
 ..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h
 ..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token.txt
+..\inc\oox\core\filterbase.hxx %_DEST%\inc%_EXT%\oox\core\filterbase.hxx
+..\inc\oox\core\relations.hxx %_DEST%\inc%_EXT%\oox\core\relations.hxx
+..\%__SRC%\inc\tokens.hxx %_DEST%\inc%_EXT%\oox\core\tokens.hxx
+..\inc\oox\core\xmlfilterbase.hxx %_DEST%\inc%_EXT%\oox\core\xmlfilterbase.hxx
+..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx
+..\inc\oox\helper\storagebase.hxx %_DEST%\inc%_EXT%\oox\helper\storagebase.hxx
+..\inc\oox\helper\zipstorage.hxx %_DEST%\inc%_EXT%\oox\helper\zipstorage.hxx
+..\inc\oox\vml\drawing.hxx %_DEST%\inc%_EXT%\oox\vml\drawing.hxx
+..\inc\oox\drawingml\chart\chartconverter.hxx %_DEST%\inc%_EXT%\oox\drawingml\chart\chartconverter.hxx
+..\inc\oox\drawingml\table\tablestylelist.hxx %_DEST%\inc%_EXT%\oox\drawingml\table\tablestylelist.hxx
+..\inc\oox\vml\shape.hxx %_DEST%\inc%_EXT%\oox\vml\shape.hxx
 
 ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/core/binaryfilterbase.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/binaryfilterbase.cxx
--- oox/source/core/binaryfilterbase.cxx	2008-04-10 17:05:50.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/binaryfilterbase.cxx	2009-01-06 14:16:56.000000000 +0100
@@ -35,7 +35,7 @@ using ::rtl::OUString;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::lang::XMultiServiceFactory;
 using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
 
 namespace oox {
 namespace core {
@@ -52,13 +52,13 @@ BinaryFilterBase::~BinaryFilterBase()
 }
 
 StorageRef BinaryFilterBase::implCreateStorage(
-        Reference< XInputStream >& rxInStream, Reference< XOutputStream >& rxOutStream ) const
+        Reference< XInputStream >& rxInStream, Reference< XStream >& rxOutStream ) const
 {
     StorageRef xStorage;
     if( rxInStream.is() )
-        xStorage.reset( new OleStorage( getServiceFactory(), rxInStream, true ) );
+        xStorage.reset( new OleStorage( getGlobalFactory(), rxInStream, true ) );
     else if( rxOutStream.is() )
-        xStorage.reset( new OleStorage( getServiceFactory(), rxOutStream, true ) );
+        xStorage.reset( new OleStorage( getGlobalFactory(), rxOutStream, true ) );
     return xStorage;
 }
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/core/filterbase.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/filterbase.cxx
--- oox/source/core/filterbase.cxx	2008-04-18 16:09:37.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/filterbase.cxx	2009-01-06 14:16:56.000000000 +0100
@@ -49,6 +49,7 @@ using ::com::sun::star::beans::PropertyV
 using ::com::sun::star::frame::XModel;
 using ::com::sun::star::io::XInputStream;
 using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
 using ::com::sun::star::task::XStatusIndicator;
 using ::com::sun::star::task::XInteractionHandler;
 using ::comphelper::MediaDescriptor;
@@ -64,10 +65,11 @@ struct FilterBaseImpl
     OUString            maFileUrl;
     StorageRef          mxStorage;
 
+    Sequence< Any >                     maArguments;
     Reference< XMultiServiceFactory >   mxFactory;
     Reference< XModel >                 mxModel;
     Reference< XInputStream >           mxInStream;
-    Reference< XOutputStream >          mxOutStream;
+    Reference< XStream >                mxStream;
     Reference< XStatusIndicator >       mxStatusIndicator;
     Reference< XInteractionHandler >    mxInteractionHandler;
 
@@ -80,18 +82,21 @@ struct FilterBaseImpl
 FilterBaseImpl::FilterBaseImpl( const Reference< XMultiServiceFactory >& rxFactory ) :
     mxFactory( rxFactory )
 {
+    OSL_ENSURE( mxFactory.is(), "FilterBaseImpl::FilterBaseImpl - missing service factory" );
 }
 
 void FilterBaseImpl::setMediaDescriptor( const Sequence< PropertyValue >& rDescriptor )
 {
     maDescriptor = rDescriptor;
-    maDescriptor.addInputStream();
 
     maFileUrl = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), maFileUrl );
     mxInStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_INPUTSTREAM(), mxInStream );
-    mxOutStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_OUTPUTSTREAM(), mxOutStream );
+    mxStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT(), mxStream );
     mxStatusIndicator = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STATUSINDICATOR(), mxStatusIndicator );
     mxInteractionHandler = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER(), mxInteractionHandler );
+
+    if( mxInStream.is() )
+        maDescriptor.addInputStream();
 }
 
 // ============================================================================
@@ -112,12 +117,17 @@ bool FilterBase::isImportFilter() const
 
 bool FilterBase::isExportFilter() const
 {
-    return mxImpl->mxOutStream.is();
+    return mxImpl->mxStream.is();
 }
 
 // ----------------------------------------------------------------------------
 
-const Reference< XMultiServiceFactory >& FilterBase::getServiceFactory() const
+const Sequence< Any >& FilterBase::getArguments() const
+{
+    return mxImpl->maArguments;
+}
+
+const Reference< XMultiServiceFactory >& FilterBase::getGlobalFactory() const
 {
     return mxImpl->mxFactory;
 }
@@ -250,8 +260,9 @@ Sequence< OUString > SAL_CALL FilterBase
 
 // com.sun.star.lang.XInitialization interface --------------------------------
 
-void SAL_CALL FilterBase::initialize( const Sequence< Any >& /*rArgs*/ ) throw( Exception, RuntimeException )
+void SAL_CALL FilterBase::initialize( const Sequence< Any >& rArgs ) throw( Exception, RuntimeException )
 {
+    mxImpl->maArguments = rArgs;
 }
 
 // com.sun.star.document.XImporter interface ----------------------------------
@@ -277,17 +288,20 @@ void SAL_CALL FilterBase::setSourceDocum
 sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rDescriptor ) throw( RuntimeException )
 {
     sal_Bool bRet = sal_False;
+    if( mxImpl->mxFactory.is() && mxImpl->mxModel.is() )
+    {
     mxImpl->setMediaDescriptor( rDescriptor );
-    mxImpl->mxStorage = implCreateStorage( mxImpl->mxInStream, mxImpl->mxOutStream );
-    if( mxImpl->mxModel.is() && mxImpl->mxStorage.get() )
+        mxImpl->mxStorage = implCreateStorage( mxImpl->mxInStream, mxImpl->mxStream );
+        if( mxImpl->mxStorage.get() )
     {
         mxImpl->mxModel->lockControllers();
         if( mxImpl->mxInStream.is() )
             bRet = importDocument();
-        else if( mxImpl->mxOutStream.is() )
+            else if( mxImpl->mxStream.is() )
             bRet = exportDocument();
         mxImpl->mxModel->unlockControllers();
     }
+    }
     return bRet;
 }
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/core/filterdetect.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/filterdetect.cxx
--- oox/source/core/filterdetect.cxx	2008-11-03 16:19:10.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/filterdetect.cxx	2009-03-19 14:28:40.000000000 +0100
@@ -40,7 +40,6 @@
 
 #include <ucbhelper/commandenvironment.hxx>
 
-#include <comphelper/processfactory.hxx>
 #include <comphelper/mediadescriptor.hxx>
 #include <cppuhelper/implbase1.hxx>
 #include <cppuhelper/implbase2.hxx>
@@ -320,6 +319,7 @@ Reference< XInterface > SAL_CALL FilterD
 FilterDetect::FilterDetect( const Reference< XMultiServiceFactory >& xFactory ) :
     mxFactory( xFactory )
 {
+    OSL_ENSURE( mxFactory.is(), "FilterDetect::FilterDetect - no service factory" );
 }
 
 FilterDetect::~FilterDetect()
@@ -348,9 +348,9 @@ OUString SAL_CALL FilterDetect::detect( 
 
     OUString aFilter;
 
-    try
+    if( mxFactory.is() ) try
     {
-        Reference< XFastParser > xParser( ::comphelper::getProcessServiceFactory()->createInstance(
+        Reference< XFastParser > xParser( mxFactory->createInstance(
             CREATE_OUSTRING( "com.sun.star.xml.sax.FastParser" ) ), UNO_QUERY_THROW );
 
         xParser->setFastDocumentHandler( new FilterDetectDocHandler( aFilter ) );
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/core/filterdetect.cxx.orig /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/filterdetect.cxx.orig
--- oox/source/core/filterdetect.cxx.orig	2008-07-01 13:54:19.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/filterdetect.cxx.orig	2008-09-30 16:51:36.000000000 +0200
@@ -37,7 +37,6 @@
 #include <com/sun/star/xml/sax/XFastContextHandler.hpp>
 #include <com/sun/star/xml/sax/XFastParser.hpp>
 
-#include <comphelper/processfactory.hxx>
 #include <comphelper/mediadescriptor.hxx>
 #include <cppuhelper/implbase1.hxx>
 #include <cppuhelper/implbase2.hxx>
@@ -311,6 +310,7 @@ Reference< XInterface > SAL_CALL FilterD
 FilterDetect::FilterDetect( const Reference< XMultiServiceFactory >& xFactory ) :
     mxFactory( xFactory )
 {
+    OSL_ENSURE( mxFactory.is(), "FilterDetect::FilterDetect - no service factory" );
 }
 
 FilterDetect::~FilterDetect()
@@ -323,9 +323,9 @@ OUString SAL_CALL FilterDetect::detect( 
 {
     OUString aFilter;
 
-    try
+    if( mxFactory.is() ) try
     {
-        Reference< XFastParser > xParser( ::comphelper::getProcessServiceFactory()->createInstance(
+        Reference< XFastParser > xParser( mxFactory->createInstance(
             CREATE_OUSTRING( "com.sun.star.xml.sax.FastParser" ) ), UNO_QUERY_THROW );
 
         xParser->setFastDocumentHandler( new FilterDetectDocHandler( aFilter ) );
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/core/recordparser.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/recordparser.cxx
--- oox/source/core/recordparser.cxx	2008-04-10 17:08:23.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/recordparser.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -182,7 +182,7 @@ namespace {
 /** Reads a byte from the passed stream, returns true on success. */
 inline bool lclReadByte( sal_uInt8& ornByte, BinaryInputStream& rStrm )
 {
-    return rStrm.read( &ornByte, 1 ) == 1;
+    return rStrm.readMemory( &ornByte, 1 ) == 1;
 }
 
 /** Reads a compressed signed 32-bit integer from the passed stream. */
@@ -211,14 +211,14 @@ bool lclReadRecordHeader( sal_Int32& orn
         lclReadCompressedInt( ornRecSize, rStrm ) && (ornRecSize >= 0);
 }
 
-bool lclReadNextRecord( sal_Int32& ornRecId, RecordDataSequence& orData, BinaryInputStream& rStrm )
+bool lclReadNextRecord( sal_Int32& ornRecId, StreamDataSequence& orData, BinaryInputStream& rStrm )
 {
     sal_Int32 nRecSize = 0;
     bool bValid = lclReadRecordHeader( ornRecId, nRecSize, rStrm );
     if( bValid )
     {
         orData.realloc( nRecSize );
-        bValid = (nRecSize == 0) || (rStrm.read( orData, nRecSize ) == nRecSize);
+        bValid = (nRecSize == 0) || (rStrm.readData( orData, nRecSize ) == nRecSize);
     }
     return bValid;
 }
@@ -259,7 +259,7 @@ void RecordParser::parseStream( const Re
 {
     maSource = rInputSource;
 
-    if( !maSource.mxInStream || !maSource.mxInStream->is() )
+    if( !maSource.mxInStream || maSource.mxInStream->isEof() )
         throw IOException();
     if( !mxHandler.is() )
         throw SAXException();
@@ -272,7 +272,7 @@ void RecordParser::parseStream( const Re
     // parse the stream
     mxStack.reset( new prv::ContextStack( mxHandler ) );
     sal_Int32 nRecId = 0;
-    RecordDataSequence aRecData;
+    StreamDataSequence aRecData;
     while( lclReadNextRecord( nRecId, aRecData, *maSource.mxInStream ) )
     {
         // create record stream object from imported record data
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/core/xmlfilterbase.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/xmlfilterbase.cxx
--- oox/source/core/xmlfilterbase.cxx	2008-07-22 15:35:39.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/core/xmlfilterbase.cxx	2009-01-13 19:32:48.000000000 +0100
@@ -30,12 +30,17 @@
 
 #include "oox/core/xmlfilterbase.hxx"
 #include <set>
+#include <stdio.h>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/embed/XRelationshipAccess.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/xml/sax/XFastParser.hpp>
+#include <sax/fshelper.hxx>
 #include "oox/helper/containerhelper.hxx"
 #include "oox/helper/zipstorage.hxx"
 #include "oox/core/fasttokenhandler.hxx"
@@ -46,16 +51,23 @@
 #include "oox/core/relationshandler.hxx"
 
 using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::StringPair;
 using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
 using ::com::sun::star::uno::Exception;
 using ::com::sun::star::uno::RuntimeException;
 using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::makeAny;
 using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::embed::XRelationshipAccess;
 using ::com::sun::star::embed::XStorage;
 using ::com::sun::star::embed::XTransactedObject;
 using ::com::sun::star::io::XInputStream;
 using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
 using ::com::sun::star::container::XNameContainer;
 using ::com::sun::star::document::XDocumentSubStorageSupplier;
 using ::com::sun::star::xml::sax::XFastParser;
@@ -63,6 +75,8 @@ using ::com::sun::star::xml::sax::XFastT
 using ::com::sun::star::xml::sax::XFastDocumentHandler;
 using ::com::sun::star::xml::sax::InputSource;
 using ::com::sun::star::xml::sax::SAXException;
+using ::sax_fastparser::FastSerializerHelper;
+using ::sax_fastparser::FSHelperPtr;
 
 namespace oox {
 namespace core {
@@ -97,7 +111,9 @@ XmlFilterBaseImpl::XmlFilterBaseImpl() :
 
 XmlFilterBase::XmlFilterBase( const Reference< XMultiServiceFactory >& rxFactory ) :
     FilterBase( rxFactory ),
-    mxImpl( new XmlFilterBaseImpl )
+    mxImpl( new XmlFilterBaseImpl ),
+    mnRelId( 1 ),
+    mnMaxDocId( 0 )
 {
 }
 
@@ -141,7 +157,7 @@ bool XmlFilterBase::importFragment( cons
 
             // create the input source and parse the stream
             RecordInputSource aSource;
-            aSource.mxInStream.reset( new BinaryInputStream( xInStrm, true ) );
+            aSource.mxInStream.reset( new BinaryXInputStream( xInStrm, true ) );
             aSource.maSystemId = aFragmentPath;
             aParser.parseStream( aSource );
             return true;
@@ -161,7 +177,7 @@ bool XmlFilterBase::importFragment( cons
     try
     {
         // create the fast parser
-        Reference< XFastParser > xParser( getServiceFactory()->createInstance(
+        Reference< XFastParser > xParser( getGlobalFactory()->createInstance(
             CREATE_OUSTRING( "com.sun.star.xml.sax.FastParser" ) ), UNO_QUERY_THROW );
         xParser->setFastDocumentHandler( xDocHandler );
         xParser->setTokenHandler( mxImpl->mxTokenHandler );
@@ -170,22 +186,23 @@ bool XmlFilterBase::importFragment( cons
         xParser->registerNamespace( CREATE_OUSTRING( "http://www.w3.org/XML/1998/namespace" ), NMSP_XML );
         xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships" ), NMSP_PACKAGE_RELATIONSHIPS );
         xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ), NMSP_RELATIONSHIPS );
-        xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:office" ), NMSP_OFFICE );
 
         xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/main" ), NMSP_DRAWINGML );
         xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/diagram" ), NMSP_DIAGRAM );
         xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/chart" ), NMSP_CHART );
-        xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:vml" ), NMSP_VML );
 
-        xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:word" ), NMSP_WORD );
+        xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:vml" ), NMSP_VML );
+        xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:office" ), NMSP_OFFICE );
+        xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:word" ), NMSP_VML_DOC );
+        xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:excel" ), NMSP_VML_XLS );
+        xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:powerpoint" ), NMSP_VML_PPT );
+        xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/activeX" ), NMSP_AX );
 
         xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/spreadsheetml/2006/main"), NMSP_XLS );
         xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" ), NMSP_XDR );
         xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/excel/2006/main" ), NMSP_XM );
-        xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:excel" ), NMSP_EXCEL );
 
         xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/presentationml/2006/main"), NMSP_PPT );
-        xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:powerpoint" ), NMSP_POWERPOINT );
 
         // create the input source and parse the stream
         InputSource aSource;
@@ -273,16 +290,79 @@ ModelObjectContainer& XmlFilterBase::get
 }
 
 StorageRef XmlFilterBase::implCreateStorage(
-        Reference< XInputStream >& rxInStream, Reference< XOutputStream >& rxOutStream ) const
+        Reference< XInputStream >& rxInStream, Reference< XStream >& rxStream ) const
 {
     StorageRef xStorage;
     if( rxInStream.is() )
-        xStorage.reset( new ZipStorage( getServiceFactory(), rxInStream ) );
-    else if( rxOutStream.is() )
-        xStorage.reset( new ZipStorage( getServiceFactory(), rxOutStream ) );
+        xStorage.reset( new ZipStorage( getGlobalFactory(), rxInStream ) );
+    else if( rxStream.is() )
+        xStorage.reset( new ZipStorage( getGlobalFactory(), rxStream ) );
+
     return xStorage;
 }
 
+Reference< XOutputStream > XmlFilterBase::openOutputStream( const OUString& rStreamName, const OUString& rMediaType )
+{
+    Reference< XOutputStream > xOutputStream = FilterBase::openOutputStream( rStreamName );
+    Reference< XPropertySet > xPropSet( xOutputStream, UNO_QUERY_THROW );
+
+    if( xPropSet.is() )
+        xPropSet->setPropertyValue( CREATE_OUSTRING( "MediaType" ),
+                                    makeAny( rMediaType ) );
+
+    return xOutputStream;
+}
+
+FSHelperPtr XmlFilterBase::openOutputStreamWithSerializer( const OUString& rStreamName, const OUString& rMediaType )
+{
+    return FSHelperPtr( new FastSerializerHelper ( openOutputStream( rStreamName, rMediaType ) ) );
+}
+
+static OUString addRelation_impl( const Reference< XRelationshipAccess > xRelations, sal_Int32 nId, const OUString& rType, const OUString& rTarget, const OUString& rTargetMode )
+{
+    OUString sId = OUStringBuffer().appendAscii( "rId" ).append( nId ).makeStringAndClear();
+
+    Sequence< StringPair > aEntry( rTargetMode.getLength() > 0 ? 3 : 2 );
+    aEntry[0].First = CREATE_OUSTRING( "Type" );
+    aEntry[0].Second = rType;
+    aEntry[1].First = CREATE_OUSTRING( "Target" );
+    aEntry[1].Second = rTarget;
+    if( rTargetMode.getLength() > 0 )
+    {
+        aEntry[2].First = CREATE_OUSTRING( "TargetMode" );
+        aEntry[2].Second = rTargetMode;
+    }
+    xRelations->insertRelationshipByID( sId, aEntry, true );
+
+    return sId;
+}
+
+OUString XmlFilterBase::addRelation( const OUString& rType, const OUString& rTarget, const OUString& rTargetMode )
+{
+    Reference< XRelationshipAccess > xRelations( getStorage()->getXStorage(), UNO_QUERY );
+    if( xRelations.is() )
+        return addRelation_impl( xRelations, mnRelId ++, rType, rTarget, rTargetMode );
+
+    return OUString();
+}
+
+OUString XmlFilterBase::addRelation( const Reference< XOutputStream > xOutputStream, const OUString& rType, const OUString& rTarget, const OUString& rTargetMode )
+{
+    sal_Int32 nId = 0;
+
+    Reference< XPropertySet > xPropertySet( xOutputStream, UNO_QUERY );
+    if( xPropertySet.is() )
+        xPropertySet->getPropertyValue( CREATE_OUSTRING( "RelId" ) ) >>= nId;
+    else
+        nId = mnRelId ++;
+
+    Reference< XRelationshipAccess > xRelations( xOutputStream, UNO_QUERY );
+    if( xRelations.is() )
+        return addRelation_impl( xRelations, nId, rType, rTarget, rTargetMode );
+
+    return OUString();
+}
+
 // ============================================================================
 
 } // namespace core
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/docprop/docprophandler.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/docprop/docprophandler.cxx
--- oox/source/docprop/docprophandler.cxx	2008-07-01 13:55:39.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/docprop/docprophandler.cxx	2008-12-11 09:05:03.000000000 +0100
@@ -273,9 +273,9 @@ void OOXMLDocPropHandler::UpdateDocStati
 // ------------------------------------------------
 sal_Bool OOXMLDocPropHandler::Is16Digit( sal_Unicode cSign )
 {
-    return ( cSign >= (sal_Unicode)'0' && cSign <= (sal_Unicode)'9'
-          || cSign >= (sal_Unicode)'a' && cSign <= (sal_Unicode)'f'
-          || cSign >= (sal_Unicode)'A' && cSign <= (sal_Unicode)'F' );
+    return ( (cSign >= (sal_Unicode)'0' && cSign <= (sal_Unicode)'9')
+          || (cSign >= (sal_Unicode)'a' && cSign <= (sal_Unicode)'f')
+          || (cSign >= (sal_Unicode)'A' && cSign <= (sal_Unicode)'F') );
 }
 
 // ------------------------------------------------
@@ -521,7 +521,15 @@ void SAL_CALL OOXMLDocPropHandler::chara
                         break;
 
                     case XML_revision|NMSP_COREPR:
-                        m_xDocProp->setEditingCycles( (sal_Int16)aChars.toInt32() );
+                        try
+                        {
+                            m_xDocProp->setEditingCycles(
+                                static_cast<sal_Int16>(aChars.toInt32()) );
+                        }
+                        catch (lang::IllegalArgumentException &)
+                        {
+                            // ignore
+                        }
                         break;
 
                     case XML_subject|NMSP_DC:
@@ -549,7 +557,14 @@ void SAL_CALL OOXMLDocPropHandler::chara
                         break;
 
                     case XML_TotalTime|NMSP_EXTPR:
+                        try
+                        {
                         m_xDocProp->setEditingDuration( aChars.toInt32() );
+                        }
+                        catch (lang::IllegalArgumentException &)
+                        {
+                            // ignore
+                        }
                         break;
 
                     case XML_Characters|NMSP_EXTPR:
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/chart/axisconverter.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/chart/axisconverter.cxx
--- oox/source/drawingml/chart/axisconverter.cxx	2008-07-22 15:47:16.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/chart/axisconverter.cxx	2008-12-12 14:17:17.000000000 +0100
@@ -30,7 +30,7 @@
  ************************************************************************/
 
 #include "oox/drawingml/chart/axisconverter.hxx"
-#include <com/sun/star/chart2/AxisPosition.hpp>
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
 #include <com/sun/star/chart2/TickmarkStyle.hpp>
 #include <com/sun/star/chart2/AxisType.hpp>
 #include <com/sun/star/chart2/XAxis.hpp>
@@ -261,9 +261,7 @@ void AxisConverter::convertFromModel( co
 
         // axis position ------------------------------------------------------
 
-        namespace ApiAxisPosition = ::com::sun::star::chart2::AxisPosition;
-        sal_Int32 nPosition = (nAxesSetIdx == API_PRIM_AXESSET) ? ApiAxisPosition::MAIN : ApiAxisPosition::SECONDARY;
-        aAxisProp.setProperty( CREATE_OUSTRING( "AxisPosition" ), nPosition );
+        aAxisProp.setProperty( CREATE_OUSTRING( "CrossoverPosition" ), (nAxesSetIdx == API_PRIM_AXESSET) ? ::com::sun::star::chart::ChartAxisPosition_START : ::com::sun::star::chart::ChartAxisPosition_END );
 
         // axis title ---------------------------------------------------------
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/chart/converterbase.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/chart/converterbase.cxx
--- oox/source/drawingml/chart/converterbase.cxx	2008-07-22 15:49:09.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/chart/converterbase.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -30,12 +30,12 @@
  ************************************************************************/
 
 #include "oox/drawingml/chart/converterbase.hxx"
-#include "oox/drawingml/theme.hxx"
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/drawing/LineStyle.hpp>
-#include <comphelper/processfactory.hxx>
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/theme.hxx"
 
 using ::rtl::OUString;
 using ::com::sun::star::uno::Reference;
@@ -135,9 +135,9 @@ Reference< XInterface > ConverterRoot::c
     return xInt;
 }
 
-Reference< XInterface > ConverterRoot::createInstance( const OUString& rServiceName )
+Reference< XInterface > ConverterRoot::createInstance( const OUString& rServiceName ) const
 {
-    return createInstance( ::comphelper::getProcessServiceFactory(), rServiceName );
+    return createInstance( mxData->mrFilter.getGlobalFactory(), rServiceName );
 }
 
 XmlFilterBase& ConverterRoot::getFilter() const
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/chart/seriesconverter.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/chart/seriesconverter.cxx
--- oox/source/drawingml/chart/seriesconverter.cxx	2008-07-22 15:53:57.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/chart/seriesconverter.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -90,7 +90,7 @@ Reference< XLabeledDataSequence > lclCre
     Reference< XLabeledDataSequence > xLabeledSeq;
     if( xValueSeq.is() || xTitleSeq.is() )
     {
-        xLabeledSeq.set( ConverterRoot::createInstance( CREATE_OUSTRING( "com.sun.star.chart2.data.LabeledDataSequence" ) ), UNO_QUERY );
+        xLabeledSeq.set( rParent.createInstance( CREATE_OUSTRING( "com.sun.star.chart2.data.LabeledDataSequence" ) ), UNO_QUERY );
         if( xLabeledSeq.is() )
         {
             xLabeledSeq->setValues( xValueSeq );
@@ -526,23 +526,27 @@ Reference< XDataSeries > SeriesConverter
     ObjectType eObjType = rTypeGroup.getSeriesObjectType();
     rFormatter.convertFrameFormatting( aSeriesProp, mrModel.mxShapeProp, eObjType, mrModel.mnIndex );
 
-    // set the property default value used by the Chart2 templates (true for pie/doughnut charts)
-    aSeriesProp.setProperty( CREATE_OUSTRING( "VaryColorsByPoint" ), rTypeInfo.meTypeCategory == TYPECATEGORY_PIE );
+    // set the (unused) property default value used by the Chart2 templates (true for pie/doughnut charts)
+    bool bIsPie = rTypeInfo.meTypeCategory == TYPECATEGORY_PIE;
+    aSeriesProp.setProperty( CREATE_OUSTRING( "VaryColorsByPoint" ), bIsPie );
+
     // own area formatting for every data point (TODO: varying line color not supported)
-    if( bVaryColorsByPoint && rTypeGroup.isSeriesFrameFormat() && ObjectFormatter::isAutomaticFill( mrModel.mxShapeProp ) )
+    // #i91271# always set area formatting for every point in pie/doughnut charts to override their automatic point formatting
+    if( bIsPie || (bVaryColorsByPoint && rTypeGroup.isSeriesFrameFormat() && ObjectFormatter::isAutomaticFill( mrModel.mxShapeProp )) )
     {
         /*  Set the series point number as color cycle size at the object
             formatter to get correct start-shade/end-tint. TODO: in doughnut
             charts, the sizes of the series may vary, need to use the maximum
             point count of all series. */
         sal_Int32 nOldMax = rFormatter.getMaxSeriesIndex();
+        if( bVaryColorsByPoint )
         rFormatter.setMaxSeriesIndex( nDataPointCount - 1 );
         for( sal_Int32 nIndex = 0; nIndex < nDataPointCount; ++nIndex )
         {
             try
             {
                 PropertySet aPointProp( xDataSeries->getDataPointByIndex( nIndex ) );
-                rFormatter.convertAutomaticFill( aPointProp, eObjType, nIndex );
+                rFormatter.convertAutomaticFill( aPointProp, eObjType, bVaryColorsByPoint ? nIndex : mrModel.mnIndex );
             }
             catch( Exception& )
             {
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/customshapeproperties.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/customshapeproperties.cxx
--- oox/source/drawingml/customshapeproperties.cxx	2008-07-01 13:57:44.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/customshapeproperties.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -28,7 +28,6 @@
  *
  ************************************************************************/
 
-#include <comphelper/processfactory.hxx>
 #include "oox/drawingml/customshapeproperties.hxx"
 #include "oox/helper/helper.hxx"
 #include "oox/helper/propertyset.hxx"
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/fillproperties.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/fillproperties.cxx
--- oox/source/drawingml/fillproperties.cxx	2008-07-22 15:38:57.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/fillproperties.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -115,8 +115,7 @@ const awt::DeviceInfo& lclGetDeviceInfo(
     {
         try
         {
-            Reference< lang::XMultiServiceFactory > xMSFT( rFilter.getServiceFactory(), UNO_QUERY_THROW );
-            Reference< frame::XFramesSupplier > xDesktop( xMSFT->createInstance(
+            Reference< frame::XFramesSupplier > xDesktop( rFilter.getGlobalFactory()->createInstance(
                     CREATE_OUSTRING( "com.sun.star.frame.Desktop" ) ), UNO_QUERY_THROW );
             Reference< frame::XFrame > xFrame( xDesktop->getActiveFrame() );
             Reference< awt::XWindow > xWindow( xFrame->getContainerWindow() );
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/fillpropertiesgroupcontext.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/fillpropertiesgroupcontext.cxx
--- oox/source/drawingml/fillpropertiesgroupcontext.cxx	2008-07-22 15:39:10.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/fillpropertiesgroupcontext.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -299,8 +299,7 @@ void BlipFillPropertiesContext::endFastE
 
 			// load the fill bitmap into an XGraphic with the GraphicProvider
             static const OUString sGraphicProvider = CREATE_OUSTRING( "com.sun.star.graphic.GraphicProvider" );
-            Reference< lang::XMultiServiceFactory > xMSFT( rFilter.getServiceFactory(), UNO_QUERY_THROW );
-            Reference< graphic::XGraphicProvider > xGraphicProvider( xMSFT->createInstance( sGraphicProvider ), UNO_QUERY_THROW );
+            Reference< graphic::XGraphicProvider > xGraphicProvider( rFilter.getGlobalFactory()->createInstance( sGraphicProvider ), UNO_QUERY_THROW );
 
             static const OUString sInputStream = CREATE_OUSTRING( "InputStream" );
             beans::PropertyValues aMediaProperties(1);
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/graphicshapecontext.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/graphicshapecontext.cxx
--- oox/source/drawingml/graphicshapecontext.cxx	2008-07-22 15:39:22.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/graphicshapecontext.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -43,7 +43,6 @@
 #include "oox/drawingml/chart/chartspacefragment.hxx"
 #include "oox/drawingml/chart/chartspacemodel.hxx"
 #include "tokens.hxx"
-#include <comphelper/processfactory.hxx>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/io/XStream.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -207,9 +206,8 @@ PresentationOle2006Context::~Presentatio
             {
                 try
                 {
-                    Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
                     Reference< io::XInputStream > xInputStream( rFilter.openInputStream( aGraphicURL ), UNO_QUERY_THROW );
-                    Reference< graphic::XGraphicProvider > xGraphicProvider( xMSF->createInstance( CREATE_OUSTRING( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY_THROW );
+                    Reference< graphic::XGraphicProvider > xGraphicProvider( rFilter.getGlobalFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY_THROW );
                     Sequence< PropertyValue > aArgs( 1 );
                     const OUString sInputStream = CREATE_OUSTRING( "InputStream" );
                     aArgs[ 0 ].Name = sInputStream;
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/shape.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/shape.cxx
--- oox/source/drawingml/shape.cxx	2008-07-22 15:40:31.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/shape.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -360,10 +360,10 @@ Reference< XShape > Shape::createAndInse
 	    rxShapes->add( mxShape );
 
         LineProperties aLineProperties;
-        aLineProperties.maLineFill.moFillType = XML_none;
+        aLineProperties.maLineFill.moFillType = XML_noFill;
         sal_Int32 nLinePhClr = -1;
         FillProperties aFillProperties;
-        aFillProperties.moFillType = XML_none;
+        aFillProperties.moFillType = XML_noFill;
         sal_Int32 nFillPhClr = -1;
 
         if( rxTheme.get() )
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/table/tablestylecellstylecontext.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/table/tablestylecellstylecontext.cxx
--- oox/source/drawingml/table/tablestylecellstylecontext.cxx	2008-07-22 15:59:10.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/table/tablestylecellstylecontext.cxx	2008-10-01 09:50:54.000000000 +0200
@@ -93,7 +93,7 @@ TableStyleCellStyleContext::createFastCh
 			{
 				if ( mnLineType != XML_none )
 				{
-                    ShapeStyleRef rLineStyleRef = mrTableStylePart.getStyleRefs()[ mnLineType ];
+                    ShapeStyleRef& rLineStyleRef = mrTableStylePart.getStyleRefs()[ mnLineType ];
                     rLineStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
 					xRet.set( new StyleMatrixReferenceContext( *this, rLineStyleRef.maPhClr ) );
 				}
@@ -110,7 +110,7 @@ TableStyleCellStyleContext::createFastCh
 			break;
 		case NMSP_DRAWINGML|XML_fillRef:	// CT_StyleMatrixReference
 			{
-                ShapeStyleRef rStyleRef = mrTableStylePart.getStyleRefs()[ XML_fillRef ];
+                ShapeStyleRef& rStyleRef = mrTableStylePart.getStyleRefs()[ XML_fillRef ];
                 rStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
                 xRet.set( new StyleMatrixReferenceContext( *this, rStyleRef.maPhClr ) );
             }
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/table/tablestylelist.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/table/tablestylelist.cxx
--- oox/source/drawingml/table/tablestylelist.cxx	2008-07-22 15:59:22.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/table/tablestylelist.cxx	2009-01-06 14:16:56.000000000 +0100
@@ -29,6 +29,7 @@
  ************************************************************************/
 
 #include "oox/drawingml/table/tablestylelist.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
 
 namespace oox { namespace drawingml { namespace table {
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/textparagraph.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/textparagraph.cxx
--- oox/source/drawingml/textparagraph.cxx	2008-07-22 15:44:09.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/textparagraph.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -35,7 +35,6 @@
 #include <com/sun/star/text/XText.hpp>
 #include <com/sun/star/text/XTextCursor.hpp>
 #include <com/sun/star/text/ControlCharacter.hpp>
-#include <comphelper/processfactory.hxx>
 
 using ::rtl::OUString;
 using namespace ::com::sun::star::text;
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/drawingml/theme.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/theme.cxx
--- oox/source/drawingml/theme.cxx	2008-07-22 15:45:48.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/drawingml/theme.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -45,6 +45,39 @@ Theme::~Theme()
 {
 }
 
+namespace {
+
+template< typename Type >
+const Type* lclGetStyleElement( const RefVector< Type >& rVector, sal_Int32 nIndex )
+{
+    return (rVector.empty() || (nIndex < 1)) ? 0 :
+        rVector.get( ::std::min( static_cast< sal_Int32 >( nIndex - 1 ), static_cast< sal_Int32 >( rVector.size() - 1 ) ) ).get();
+}
+
+} // namespace
+
+const FillProperties* Theme::getFillStyle( sal_Int32 nIndex ) const
+{
+    return (nIndex >= 1000) ?
+        lclGetStyleElement( maBgFillStyleList, nIndex - 1000 ) :
+        lclGetStyleElement( maFillStyleList, nIndex );
+}
+
+const LineProperties* Theme::getLineStyle( sal_Int32 nIndex ) const
+{
+     return lclGetStyleElement( maLineStyleList, nIndex );
+}
+
+const PropertyMap* Theme::getEffectStyle( sal_Int32 nIndex ) const
+{
+    return lclGetStyleElement( maEffectStyleList, nIndex );
+}
+
+const TextCharacterProperties* Theme::getFontStyle( sal_Int32 nSchemeType ) const
+{
+    return maFontScheme.get( nSchemeType ).get();
+}
+
 const TextFont* Theme::resolveFont( const OUString& rName ) const
 {
     /*  Resolves the following names:
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/biffdumperconfig.dat /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/biffdumperconfig.dat
--- oox/source/dump/biffdumperconfig.dat	2008-03-05 19:40:05.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/biffdumperconfig.dat	1970-01-01 01:00:00.000000000 +0100
@@ -1,1796 +0,0 @@
-﻿
-# dumper settings ============================================================
-
-# Path to additional configuration data, relative to this file.
-include-config-file=dumperconfig.dat
-include-config-file=dffdumperconfig.dat
-include-config-file=olestoragedumperconfig.dat
-
-# Enable entire dumper (default=off). This option does not affect the option
-# 'enable-import'.
-#   0=off, 1=on
-enable-dumper=1
-
-# Enable import after dumping (default=on). Disabling this option allows
-# to dump a file without loading it. This option is independent from the
-# 'enable-dumper' option.
-#   0=off, 1=on
-enable-import=1
-
-# BIFF record settings -------------------------------------------------------
-
-# Show total stream position of the record (default=on).
-#   0=off, 1=on
-show-record-pos=0
-
-# Show total record size in bytes (including CONTINUE records, if enabled,
-# see 'merge-continue-record' option) (default=on).
-#   0=off, 1=on
-show-record-size=1
-
-# Show record identifier (default=on).
-#   0=off, 1=on
-show-record-id=1
-
-# Show record name, if known (default=on).
-#   0=off, 1=on
-show-record-name=1
-
-# Show record contents (default=on).
-#   0=off, 1=on
-show-record-body=1
-
-# Merge CONTINUE records with leading record (default=on).
-#   0=off - show CONTINUE records separately (hex dump)
-#   1=on  - show contents of leading record together with following CONTINUE
-merge-continue-record=1
-
-# name maps ==================================================================
-#
-# List of constants
-# -----------------
-# Defines names for specific values.
-#
-# constlist = <LISTNAME>
-#   default = <constname>                   (default=?err:no-name)
-#   include = <LISTNAME>[,<LISTNAME>...]
-#   exclude = <value>[,<value>...]
-#   quote-names = 0|1|false|true            (default=0)
-#   <value> = <constname>
-# end
-#
-# List of multiple contants per line
-# ----------------------------------
-# Defines names for contiguous ranges of values.
-#
-# multilist = <LISTNAME>
-#   default = <constname>                   (default=?err:no-name)
-#   ignore-empty = 0|1|false|true           (default=1)
-#   include = <LISTNAME>[,<LISTNAME>...]
-#   exclude = <value>[,<value>...]
-#   <firstvalue> = <constname>[,<constname>...]
-# end
-#
-# List of multiple contants, shortened format
-# -------------------------------------------
-# Defines names for a contiguous range of values. The entire list definition
-# is given in a single text line.
-#
-# shortlist = <LISTNAME>,<firstvalue>,<constname>[,<constname>...]
-#
-# List of flags
-# -------------
-# Defines names for single bits in a bit field.
-#
-# flagslist = <LISTNAME>
-#   ignore = <bitfield>                     (default=0)
-#   include = <LISTNAME>[,<LISTNAME>...]
-#   exclude = <bitfield>[,<bitfield>...]
-#   <bitmask> = [!]<constname>
-# end
-#
-# List of flags and values in a bitfield
-# --------------------------------------
-# Defines names for single bits and for embedded values in a bit field.
-#
-# combilist = <LISTNAME>
-#   ignore = <bitfield>                     (default=0)
-#   include = <LISTNAME>[,<LISTNAME>...]
-#   exclude = <bitmask>[,<bitmask>...]
-#   <bitmask> = [!]<constname>
-#   <bitfield> = <datatype>,<dataformat>,<constname>[,<LISTNAME>]
-# end
-#
-# Unit converter
-# --------------
-# Converts values and appends a unit name.
-#
-# unitconverter = <LISTNAME>,[/]<factor>,<unitname>
-
-# common ---------------------------------------------------------------------
-
-unitconverter=CONV-PERCENT-NEG,-1,%
-unitconverter=CONV-COLWIDTH,/256,chars
-
-shortlist=BIFF,0,biff2,biff3,biff4,biff5,biff8
-
-constlist=ERRORCODES
-  0x00=#NULL!
-  0x07=#DIV/0!
-  0x0F=#VALUE!
-  0x17=#REF!
-  0x1D=#NAME?
-  0x24=#NUM!
-  0x2A=#N/A
-end
-
-shortlist=EGA-COLORS,0,ega-black,ega-white,ega-red,ega-green,ega-blue,ega-yellow,ega-magenta,ega-cyan
-
-constlist=COLORS-BIFF2
-  include=EGA-COLORS
-  default=
-  24=sys-window-text
-  25=sys-window-bg
-  0x7FFF=sys-window-text
-end
-
-constlist=COLORS-BIFF5
-  include=EGA-COLORS
-  default=
-  64=sys-window-text
-  65=sys-window-bg
-  67=sys-button-face
-  77=sys-window-text-chart
-  78=sys-window-bg-chart
-  79=auto-border-chart
-  80=sys-tooltip-bg
-  81=sys-tooltip-text
-  0x7FFF=sys-window-text
-end
-
-shortlist=BORDERSTYLES-BIFF3,0,none,thin,medium,dash,dot,thick,double,hair
-
-multilist=BORDERSTYLES-BIFF8
-  include=BORDERSTYLES-BIFF3
-  8=medium-dash,thin-dash-dot,medium-dash-dot,thin-dash-dot-dot,medium-dash-dot-dot,slant-dash-dot
-end
-
-multilist=FILLPATTERNS-BIFF3
-  0=no-fill,solid-fill,50%-grey,75%-grey,25%-grey
-  5=hor-stripe,ver-stripe,rev-diag-stripe,diag-stripe,diag-crosshatch
-  10=thick-diag-crosshatch,thin-hor-stripe,thin-ver-stripe,thin-rev-diag-stripe,thin-diag-stripe
-  15=thin-hor-crosshatch,thin-diag-crosshatch,12.5%-grey,6.25%-grey
-end
-
-shortlist=TEXTORIENTATION,0,horizontal,stacked,90°-ccw,90°-cw
-
-constlist=TEXTROTATION-BIFF8
-  default=
-  255=stacked
-end
-
-multilist=BUILTIN-FORMATS
-  quote-names=1
-  0=General,0,0.00,'#,##0','#,##0.00'
-  5='"$"#,##0_);\("$"#,##0\)','"$"#,##0_);[Red]\("$"#,##0\)','"$"#,##0.00_);\("$"#,##0.00\)','"$"#,##0.00_);[Red]\("$"#,##0.00\)',0%
-  10=0.00%,0.00E+00,# ?/?,# ??/??,M/D/YYYY
-  15=D-MMM-YY,D-MMM,MMM-YY,h:mm AM/PM,h:mm:ss AM/PM
-  20=h:mm,h:mm:ss,M/D/YYYY h:mm,General,General
-  25=General,General,M/D/YYYY,M/D/YYYY,M/D/YYYY
-  30=M/D/YYYY,M/D/YYYY,h:mm:ss,h:mm:ss,h:mm:ss
-  35=h:mm:ss,M/D/YYYY,'#,##0_);(#,##0)','#,##0_);[Red](#,##0)','#,##0.00_);(#,##0.00)'
-  40='#,##0.00_);[Red](#,##0.00)'
-  41='_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)'
-  42='_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_)'
-  43='_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)'
-  44='_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)'
-  45=mm:ss,[h]:mm:ss,mm:ss.0,##0.0E+0,@
-  50=M/D/YYYY,M/D/YYYY,M/D/YYYY,M/D/YYYY,M/D/YYYY
-  55=M/D/YYYY,M/D/YYYY,M/D/YYYY,M/D/YYYY,0
-  60=0.00,'#,##0','#,##0.00','$#,##0_);($#,##0)','$#,##0_);[Red]($#,##0)'
-  65='$#,##0.00_);($#,##0.00)','$#,##0.00_);[Red]($#,##0.00)',0%,0.00%,# ?/?
-  70=# ??/??,M/D/YYYY,M/D/YYYY,D-MMM-YY,D-MMM
-  75=MMM-YY,h:mm,h:mm:ss,M/D/YYYY h:mm,mm:ss
-  80=[h]:mm:ss,mm:ss.0
-end
-
-constlist=CONSTVALUE-TYPE
-  0=empty
-  1=number
-  2=string
-  4=boolean
-  16=error
-end
-
-# formulas -------------------------------------------------------------------
-
-multilist=BASETOKENS-BIFF2
-  0x00=,tExp,tTbl,tAdd,tSub,tMul,tDiv,tPower
-  0x08=tConcat,tLT,tLE,tEQ,tGE,tGT,tNE,tIsect
-  0x10=tList,tRange,tUplus,tUminus,tPercent,tParen,tMissArg,tStr
-  0x18=,tAttr,tSheet,tEndSheet,tErr,tBool,tInt,tNum
-end
-
-constlist=BASETOKENS-BIFF5
-  include=BASETOKENS-BIFF2
-  exclude=0x1A,0x1B
-end
-
-constlist=BASETOKENS-BIFF8
-  include=BASETOKENS-BIFF5
-  0x18=tNlr
-end
-
-constlist=TOKENCLASSES
-  0x20=R
-  0x40=V
-  0x60=A
-end
-
-multilist=CLASSTOKENS-BIFF2
-  0x00=tArray,tFunc,tFuncVar,tName,tRef,tArea,tMemArea,tMemErr
-  0x08=tMemNoMem,tMemFunc,tRefErr,tAreaErr,tRefN,tAreaN,tMemAreaN,tMemNoMemN
-  0x18=tFuncCE
-end
-
-constlist=CLASSTOKENS-BIFF4
-  include=CLASSTOKENS-BIFF2
-  exclude=0x18
-end
-
-multilist=CLASSTOKENS-BIFF5
-  include=CLASSTOKENS-BIFF4
-  0x19=tNameX,tRef3d,tArea3d,tRefErr3d,tAreaErr3d
-end
-
-combilist=FUNCID
-  0x7FFF=uint16,dec,func-id
-  0x8000=command
-end
-
-combilist=PARAMCOUNT-CMD
-  0x7F=uint8,dec,count
-  0x80=prompt
-end
-
-combilist=REFRELFLAGS
-  0x3FFF=uint16,dec,value
-  0x4000=col-rel
-  0x8000=row-rel
-end
-
-multilist=NLRTYPES
-  0x00=,tNlrErr,tNlrRowR,tNlrColR,,,tNlrRowV,tNlrColV
-  0x08=,,tNlrRange,tNlrSRange,tNlrSRowR,tNlrSColR,tNlrSRowV,tNlrSColV
-  0x10=tNlrRangeErr,,,,,,,
-  0x18=,,,,,tNlrSxName,,
-end
-
-combilist=NLRADDFLAGS
-  0x3FFFFFFF=uint32,dec,count
-  0x80000000=rel
-end
-
-flagslist=ATTRTYPES
-  0x01=volatile
-  0x02=if
-  0x04=choose
-  0x08=skip
-  0x10=sum
-  0x20=assign
-  0x40=space
-end
-
-shortlist=ATTRSPACETYPES,0,space-before-token,cr-before-token,space-before-open,cr-before-open,space-before-close,cr-before-close,leading-space
-
-# record names ---------------------------------------------------------------
-
-multilist=RECORD-NAMES-BIFF2
-  # worksheet records
-  0x0000=DIMENSION,BLANK,INTEGER,NUMBER,LABEL,BOOLERR,FORMULA,STRING
-  0x0008=ROW,BOF,EOF,INDEX,CALCCOUNT,CALCMODE,PRECISION,REFMODE
-  0x0010=DELTA,ITERATION,PROTECT,PASSWORD,HEADER,FOOTER,EXTERNCOUNT,EXTERNSHEET
-  0x0018=DEFINEDNAME,WINDOWPROTECT,VERTICALPAGEBREAKS,HORIZONTALPAGEBREAKS,NOTE,SELECTION,FORMAT,BUILTINFMTCOUNT
-  0x0020=COLUMNDEFAULT,ARRAY,DATEMODE,EXTERNALNAME,COLWIDTH,DEFAULTROWHEIGHT,LEFTMARGIN,RIGHTMARGIN
-  0x0028=TOPMARGIN,BOTTOMMARGIN,PRINTHEADERS,PRINTGRIDLINES,,,,FILEPASS
-  0x0030=,FONT,FONT2,PRINTSIZE,,INFOOPTS,DATATABLE,DATATABLE2
-  0x0038=WNDESK,,BEGINPREF,ENDPREF,CONTINUE,WINDOW1,WINDOW2,
-  0x0040=BACKUP,PANE,CODEPAGE,XF,IXFE,EFONT,SHOWSCROLL,SHOWFORMULA
-  0x0048=STATUSBAR,SHORTMENUS,DDEENABLED,AUTODEC,MENUKEY,PLS|ZOOM,MENUUND,MOVESEL
-  0x0050=DCON,DCONREF,DCONNAME,,,DEFCOLWIDTH,,
-  # worksheet records new in BIFF3, but supported in BIFF2 streams
-  0x0200=DIMENSION,BLANK,,NUMBER,LABEL,BOOLERR,,
-  0x027E=RK
-  # BIFF5 style BOF
-  0x0809=BOF
-  # chart records
-  0x1000=,CHUNITS,CHCHART,CHSERIES,CHSOURCELINK,,CHDATAFORMAT,CHLINEFORMAT
-  0x1008=,CHMARKERFORMAT,CHAREAFORMAT,CHPIEFORMAT,CHATTACHEDLABEL,CHSTRING,,
-  0x1010=,,,,CHTYPEGROUP,CHLEGEND,CHSERIESLIST,CHBAR
-  0x1018=CHLINE,CHPIE,CHAREA,CHSCATTER,CHCHARTLINE,CHAXIS,CHTICK,CHVALUERANGE
-  0x1020=CHLABELRANGE,CHAXISLINE,CHFORMATLINK,,CHDEFAULTTEXT,CHTEXT,CHFONT,CHOBJECTLINK
-  0x1028=,,,,,CHARROW,,CHARROWHEAD
-  0x1030=,,CHFRAME,CHBEGIN,CHEND,CHPLOTFRAME,CHCHARTSIZE,CHRELPOSITION
-  0x1038=CHARROWRELPOS,,CHCHART3D,,,,,
-end
-
-multilist=RECORD-NAMES-BIFF3
-  include=RECORD-NAMES-BIFF2
-  # worksheet records
-  exclude=0x0006,0x0008,0x0009,0x000B,0x0018,0x0020,0x0021,0x0023,0x0024,0x0025,0x0031,0x0036,0x0037,0x003E,0x0043,0x0044,0x0045
-  0x0050=,,,,,,BUILTINFMTCOUNT,
-  0x0058=TOOLBAR,XCT,CRN,FILESHARING,WRITEACCESS,OBJ,UNCALCED,SAFERECALC
-  0x0060=TEMPLATE,INTL,,OBJECTPROTECT,,,,
-  0x0068=,,,,,,,
-  0x0070=,,,,,,,
-  0x0078=,,,,,COLINFO,,IMDATA
-  0x0080=GUTS,SHEETPR,GRIDSET,HCENTER,VCENTER,,WRITEPROT,ADDIN
-  0x0088=EDG,PUB,NOTEOFF,LH,COUNTRY,HIDEOBJ,,
-  0x0090=SORT,SUB,PALETTE,,LHRECORD,LHNGRAPH,,
-  0x0200=,,,,,,FORMULA,STRING
-  0x0208=ROW,BOF,,INDEX,,,,
-  0x0218=DEFINEDNAME
-  0x0221=ARRAY
-  0x0223=EXTERNALNAME
-  0x0225=DEFAULTROWHEIGHT
-  0x0231=FONT
-  0x0236=DATATABLE
-  0x023E=WINDOW2
-  0x0243=XF
-  0x0293=STYLE
-  # chart records
-  0x103C=CHPICFORMAT
-end
-
-multilist=RECORD-NAMES-BIFF4
-  include=RECORD-NAMES-BIFF3
-  # worksheet/workbook records
-  exclude=0x0206,0x0209,0x001E,0x0243
-  0x0085=SHEET
-  0x0088=,,,,,,SHEETSOFFSET,SHEETHEADER
-  0x0090=,,,,,SOUND,SYNC
-  0x0098=LPR,STANDARDWIDTH,FNGROUPNAME,,FNGROUPCOUNT,,,
-  0x00A0=SCL,PAGESETUP,FNPROTO,PROJEXTSHEET,,,,
-  0x00A8=DRAGDROP,COORDLIST,,GCW,,,,
-  0x0406=FORMULA
-  0x0409=BOF
-  0x041E=FORMAT
-  0x0443=XF
-  # chart records
-  0x1038=,,,CHMULTILINK,,CHDROPBAR,CHRADARLINE,CHSURFACE
-end
-
-multilist=RECORD-NAMES-BIFF5
-  include=RECORD-NAMES-BIFF4
-  # worksheet/workbook records
-  exclude=0x0409,0x0218,0x0223,0x0231,0x0443
-  0x0006=FORMULA
-  0x0018=DEFINEDNAME
-  0x0023=EXTERNALNAME
-  0x0031=FONT
-  0x0098=,,,FILTERMODE,,AUTOFILTERINFO,AUTOFILTER,
-  0x00A8=,,,,,,SCENMAN,SCENARIO
-  0x00B0=SXVIEW,SXVD,SXVI,,SXIVD,SXLI,SXPI,
-  0x00B8=DOCROUTE,RECIPNAME,,,SHAREDFMLA,MULTRK,MULTBLANK,
-  0x00C0=,MMS,ADDMENU,DELMENU,,SXDI,SXDB,SXFIELD
-  0x00C8=SXINDEXLIST,SXDOUBLE,SXBOOLEAN,SXERROR,SXINTEGER,SXSTRING,SXDATETIME,SXEMPTY
-  0x00D0=SXTBL,SXTBRGITEM,SXTBPG,OBPROJ,,SXIDSTM,RSTRING,DBCELL
-  0x00D8=SXNUMGROUP,SXGROUPINFO,BOOKBOOL,REVERT,SXEXT|PARAMQRY,SCENPROTECT,OLESIZE,UDDESC
-  0x00E0=XF,INTERFACEHDR,INTERFACEEND,SXVS,,,,
-  0x0206=FORMULA
-  # chart records
-  exclude=0x1004,0x102D,0x102F,0x1036,0x1037,0x1038,0x103B
-  0x1040=CHRADARAREA,CHAXESSET,,CHLEGENDENTRY,CHPROPERTIES,CHSERGROUP,CHUSEDAXESSETS,
-  0x1048=CHPIVOTREF,,CHSERPARENT,CHSERTRENDLINE,,,CHFORMAT,CHPOS
-  0x1050=CHFORMATRUNS,CHSOURCELINK,,,,,,
-  0x1058=,,,CHSERERRORBAR,,CHSERIESFORMAT,,
-end
-
-multilist=RECORD-NAMES-BIFF8
-  include=RECORD-NAMES-BIFF5
-  # worksheet/workbook records
-  0x00E0=,,,,,CELLMERGING,,
-  0x00E8=,PICTURE,,MSODRAWINGGROUP,MSODRAWING,MSODRAWINGSELECTION,,PHONETICPR
-  0x00F0=SXRULE,SXEX,SXFILT,,,,SXNAME,SXSELECT
-  0x00F8=SXPAIR,SXFMLA,,SXFORMAT,SST,LABELSST,,EXTSST
-  0x0100=SXVDEX,,,SXFORMULA,,,,
-  0x0120=,,SXDBEX,,,,,
-  0x0130=,,,,,,,CHTRINSERT
-  0x0138=CHTRINFO,,,CHTRCELLCONTENT,,TABID,,
-  0x0140=CHTRMOVERANGE,,,,,,,
-  0x0148=,,,,,CHTRINSERTTAB,,
-  0x0158=,,,,,,,LABELRANGES
-  0x0160=USESELFS,DSF,XL5MODIFY,,,,,
-  0x0190=,,,,,,CHTRHEADER,
-  0x01A8=,USERBVIEW,USERSVIEWBEGIN,USERSVIEWEND,,QSI,EXTERNALBOOK,PROT4REV
-  0x01B0=CFHEADER,CFRULE,DATAVALIDATIONS,,,DCONBIN,TXO,REFRESHALL
-  0x01B8=HYPERLINK,NLRDELNAME,CODENAME,SXFDBTYPE,PROT4REVPASS,,DATAVALIDATION,
-  0x0800=SCREENTIP,,,WEBQRYSETTINGS,WEBQRYTABLES,,,
-  0x0850=,CHWRAPPEDRECORD,,,,,,CHUNITPROPERTIES
-  0x0858=CHPIVOTREF,,,,,,,
-  0x0860=,,SHEETLAYOUT,,,,,SHEETPROTECTION
-  # chart records
-  0x1058=,,,,,,,CH3DDATAFORMAT
-  0x1060=CHFONTBASE,CHPIEEXT,CHLABELRANGE2,CHDATATABLE,CHPLOTGROWTH,CHSERINDEX,CHESCHERFORMAT,CHPIEEXTSETT
-end
-
-# simple records -------------------------------------------------------------
-
-constlist=SIMPLE-RECORDS-BIFF2
-  0x000C=uint16,dec,max-iterations
-  0x000D=int16,dec,calc-mode,CALCMODE
-  0x000E=uint16,bool,calc-precise
-  0x000F=uint16,dec,ref-mode,REFMODE
-  0x0010=double,dec,epsilon
-  0x0011=uint16,bool,iterate-recursive
-  0x0012=uint16,bool,workbook-protected
-  0x0013=uint16,hex,password-hash
-  0x0016=uint16,dec,externsheets
-  0x0019=uint16,bool,window-protected
-  0x001F=uint16,dec,builtin-fmt-count
-  0x0022=uint16,dec,null-date,DATEMODE
-  0x0025=uint16,hex,rowheight-flags,DEFROWHEIGHT-FLAGS
-  0x0026=double,dec,left-margin,CONV-INCH-TO-CM
-  0x0027=double,dec,right-margin,CONV-INCH-TO-CM
-  0x0028=double,dec,top-margin,CONV-INCH-TO-CM
-  0x0029=double,dec,bottom-margin,CONV-INCH-TO-CM
-  0x002A=uint16,bool,print-sheet-headers
-  0x002B=uint16,bool,print-gridlines
-  0x0040=uint16,bool,backup-on-save
-  0x0044=uint16,dec,xf-idx
-  0x0045=uint16,dec,font-color-idx,COLORS
-  0x0055=uint16,dec,base-col-width
-  0x100B=uint16,dec,extrusion,CONV-PERCENT
-  0x100C=uint16,hex,flags,CHATTACHEDLABEL-FLAGS
-  0x1018=uint16,hex,flags,CHLINE-FLAGS
-  0x101A=uint16,hex,flags,CHAREA-FLAGS
-  0x101C=uint16,dec,line-type,CHCHARTLINE-TYPE
-  0x1021=uint16,dec,axisline-id,CHAXISLINE-ID
-  0x1024=uint16,dec,text-idx
-  0x1026=uint16,dec,font-idx,FONTNAMES
-  0x1045=uint16,dec,group-idx
-  0x1046=uint16,dec,used-axessets
-  0x104A=uint16,dec,series-idx
-  0x104E=uint16,dec,fmt-idx,FORMATS
-end
-
-constlist=SIMPLE-RECORDS-BIFF3
-  include=SIMPLE-RECORDS-BIFF2
-  0x0056=uint16,dec,builtin-fmt-count
-  0x005E=uint16,unused
-  0x005F=uint16,bool,recalc-on-save
-  0x0063=uint16,bool,objects-protected
-  0x0081=uint16,hex,flags,SHEETPR-FLAGS
-  0x0082=uint16,bool,print-gridlines-changed
-  0x0083=uint16,bool,horizontal-centered
-  0x0084=uint16,bool,vertical-centered
-  0x008D=uint16,dec,object-mode,HIDEOBJ
-end
-
-constlist=SIMPLE-RECORDS-BIFF4
-  include=SIMPLE-RECORDS-BIFF3
-  0x008E=uint32,hex,stream-pos,CONV-DEC
-  0x0099=uint16,dec,default-col-width,CONV-COLWIDTH
-  0x009C=uint16,dec,func-group-count
-  0x103D=uint16,dec,bar-dist
-  0x103E=uint16,hex,flags,CHRADAR-FLAGS
-  0x103F=uint16,hex,flags,CHSURFACE-FLAGS
-end
-
-constlist=SIMPLE-RECORDS-BIFF5
-  include=SIMPLE-RECORDS-BIFF4
-  0x00C9=double,dec,value
-  0x00CA=uint16,bool,value
-  0x00CB=uint16,hex,error-code,ERRORCODES
-  0x00CC=int16,dec,value
-  0x00D5=uint16,hex,pivotcache-stream-id
-  0x00D8=uint16,hex,flags,SXNUMGROUP-FLAGS
-  0x00DA=uint16,bool,strip-cached-values
-  0x00DD=uint16,bool,scenarios-protected
-  0x00E3=uint16,dec,source-type,SXVS-TYPE
-  0x1040=uint16,hex,flags,CHRADAR-FLAGS
-  0x105D=uint16,hex,flags,CHSERIESFORMAT-FLAGS
-end
-
-constlist=SIMPLE-RECORDS-BIFF8
-  include=SIMPLE-RECORDS-BIFF5
-  0x00E1=uint16,dec,codepage,CODEPAGES
-  0x0160=uint16,bool,use-nat-lang-refs
-  0x0161=uint16,bool,double-stream
-  0x01AF=uint16,bool,revlog-protected
-  0x01B7=uint16,bool,refresh-all
-  0x01BB=uint16,dec,sql-data-type,SXFDBTYPE-DATATYPE
-  0x01BC=uint16,hex,password-hash
-  0x1065=uint16,dec,series-idx
-end
-
-# ARRAY ----------------------------------------------------------------------
-
-flagslist=ARRAY-FLAGS-BIFF2
-  0x0001=recalc-always
-end
-
-flagslist=ARRAY-FLAGS-BIFF3
-  include=ARRAY-FLAGS-BIFF2
-  0x0002=recalc-onload
-end
-
-# BOF ------------------------------------------------------------------------
-
-constlist=BOF-BIFFTYPE
-  0x0000=from-id
-  0x0007=biff2
-  0x0200=biff2
-  0x0300=biff3
-  0x0400=biff4
-  0x0500=biff5
-  0x0600=biff8
-end
-
-constlist=BOF-SHEETTYPE
-  0x0005=globals
-  0x0006=vb-module
-  0x0010=sheet
-  0x0020=chart
-  0x0040=macro
-  0x0100=workspace
-end
-
-flagslist=BOF-HISTORY-FLAGS
-  0x00000001=windows
-  0x00000002=risc
-  0x00000004=beta
-  0x00000008=win-any
-  0x00000010=mac-any
-  0x00000020=beta-any
-  0x00000100=risc-any
-  # missing mac here?
-end
-
-# CALCMODE -------------------------------------------------------------------
-
-shortlist=CALCMODE,-1,automatic-no-table,manual,automatic
-
-# CFRULE ---------------------------------------------------------------------
-
-shortlist=CFRULE-TYPE,1,value,formula
-shortlist=CFRULE-OPERATOR,0,none,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
-
-flagslist=CFRULE-FLAGS
-  ignore=0x00380080
-  0x00000001=!hor-align-used
-  0x00000002=!vert-align-used
-  0x00000004=!text-wrap-used
-  0x00000008=!rotation-used
-  0x00000010=!justify-lastline-used
-  0x00000020=!indent-used
-  0x00000040=!shrinktofit-used
-  0x00000100=!cell-locked-used
-  0x00000200=!cell-hidden-used
-  0x00000400=!left-border-used
-  0x00000800=!right-border-used
-  0x00001000=!top-border-used
-  0x00002000=!bottom-border-used
-  0x00004000=!tl-to-br-used
-  0x00008000=!bl-to-tr-used
-  0x00010000=!fill-pattern-used
-  0x00020000=!fg-color-idx-used
-  0x00040000=!bg-color-idx-used
-  0x04000000=font-block
-  0x08000000=alignment-block
-  0x10000000=border-block
-  0x20000000=pattern-block
-  0x40000000=protection-block
-  0x80000000=!text-dir-used
-end
-
-combilist=CFRULE-ALIGNMENT
-  0x07=uint8,dec,hor-align,XF-HORALIGN
-  0x08=text-wrap
-  0x70=uint8,dec,ver-align,XF-VERALIGN
-  0x80=justify-lastline
-end
-
-combilist=CFRULE-INDENT
-  0x000F=uint8,dec,indent
-  0x0010=shrink-to-fit
-  0x00C0=uint8,dec,text-dir,XF-TEXTDIRECTION
-end
-
-flagslist=CFRULE-FONTFLAGS
-  0x00000002=italic
-  0x00000008=outline
-  0x00000010=shadow
-  0x00000020=condense
-  0x00000040=extend
-  0x00000080=strikeout
-end
-
-flagslist=CFRULE-FONTUSEDFLAGS
-  0x00000002=!italic-used
-  0x00000008=!outline-used
-  0x00000010=!shadow-used
-  0x00000020=!condense-used
-  0x00000040=!extend-used
-  0x00000080=!strikeout-used
-end
-
-constlist=CFRULE-FONTUSED
-  0=used
-  1=not-used
-end
-
-combilist=CFRULE-BORDERCOLOR2
-  0x0000007F=uint8,dec,top-color,COLORS
-  0x00003F80=uint8,dec,bottom-color,COLORS
-  0x001FC000=uint8,dec,diag-color,COLORS
-  0x01E00000=uint8,dec,diag-style,BORDERSTYLES
-end
-
-combilist=CFRULE-FILLBLOCK
-  0x0000FC00=uint8,dec,fill-pattern,FILLPATTERNS
-  0x007F0000=uint8,dec,fg-color-idx,COLORS
-  0x3F800000=uint8,dec,bg-color-idx,COLORS
-end
-
-flagslist=CFRULE-PROTECTION-FLAGS
-  0x0001=locked
-  0x0002=formula-hidden
-end
-
-# CH3DDATAFORMAT -------------------------------------------------------------
-
-shortlist=CH3DDATAFORMAT-BASE,0,rectangular,circular
-shortlist=CH3DDATAFORMAT-TOP,0,straight,sharp,trunc
-
-# CHAREA ---------------------------------------------------------------------
-
-flagslist=CHAREA-FLAGS
-  0x0001=stacked
-  0x0002=percent
-  0x0004=shadow
-end
-
-# CHAREAFORMAT ---------------------------------------------------------------
-
-flagslist=CHAREAFORMAT-FLAGS
-  0x0001=auto
-  0x0002=swap-negative
-end
-
-# CHATTACHEDLABEL ------------------------------------------------------------
-
-flagslist=CHATTACHEDLABEL-FLAGS
-  0x0001=show-value
-  0x0002=show-percent
-  0x0004=show-categ-percent
-  0x0008=smoothed
-  0x0010=show-categ
-  0x0020=show-bubble
-end
-
-# CHAXESSET ------------------------------------------------------------------
-
-shortlist=CHAXESSET-ID,0,primary,secondary
-
-# CHAXIS ---------------------------------------------------------------------
-
-shortlist=CHAXIS-TYPE,0,x-axis,y-axis,z-axis
-
-# CHAXISLINE -----------------------------------------------------------------
-
-shortlist=CHAXISLINE-ID,0,axisline,major-grid,minor-grid,wall
-
-# CHBAR ----------------------------------------------------------------------
-
-flagslist=CHBAR-FLAGS
-  0x0001=horizontal
-  0x0002=stacked
-  0x0004=percent
-  0x0008=shadow
-end
-
-# CHCHART3D ------------------------------------------------------------------
-
-flagslist=CHCHART3D-FLAGS
-  ignore=0x0010
-  0x0001=real3d
-  0x0002=clustered
-  0x0004=auto-height
-  0x0020=2d-plotarea
-end
-
-# CHTYPEGROUP ----------------------------------------------------------------
-
-flagslist=CHTYPEGROUP-FLAGS
-  0x0001=varied-colors
-end
-
-# CHCHARTLINE ----------------------------------------------------------------
-
-shortlist=CHCHARTLINE-TYPE,0,drop-line,hi-lo-line,series-connector
-
-# CHDATAFORMAT ---------------------------------------------------------------
-
-constlist=CHDATAFORMAT-POINTIDX
-  default=
-  -1=all-points
-end
-
-constlist=CHDATAFORMAT-FORMATIDX
-  default=
-  -3=axesset-global
-end
-
-flagslist=CHDATAFORMAT-FLAGS
-  0x0001=excel4-colors
-end
-
-# CHFRAME --------------------------------------------------------------------
-
-shortlist=CHFRAME-FORMAT,0,standard,,,,shadow
-
-flagslist=CHFRAME-FLAGS
-  0x0001=auto-size
-  0x0002=auto-pos
-end
-
-# CHFRAMEPOS -----------------------------------------------------------------
-
-shortlist=CHFRAMEPOS-OBJTYPE,2,any,,,legend
-shortlist=CHFRAMEPOS-SIZEMODE,1,manual,auto
-
-# CHLABELRANGE ---------------------------------------------------------------
-
-flagslist=CHLABELRANGE-FLAGS
-  0x0001=cross-between-categ
-  0x0002=maximum-axis-cross
-  0x0004=reverse-order
-end
-
-# CHLABELRANGE2 --------------------------------------------------------------
-
-flagslist=CHLABELRANGE2-FLAGS
-  0x0001=auto-minimum
-  0x0002=auto-maximum
-  0x0004=auto-major
-  0x0008=auto-minor
-  0x0010=date-axis
-  0x0020=auto-base
-  0x0040=auto-axis-cross
-  0x0080=auto-date
-end
-
-# CHLEGEND -------------------------------------------------------------------
-
-shortlist=CHLEGEND-DOCKPOS,0,bottom,top-left,top,right,left,,,manual
-shortlist=CHLEGEND-SPACING,0,close,medium,open
-
-flagslist=CHLEGEND-FLAGS
-  0x0001=docked
-  0x0002=auto-series
-  0x0004=auto-pos-x
-  0x0008=auto-pos-y
-  0x0010=stacked
-  0x0020=data-table
-end
-
-# CHLINE ---------------------------------------------------------------------
-
-flagslist=CHLINE-FLAGS
-  0x0001=stacked
-  0x0002=percent
-  0x0004=shadow
-end
-
-# CHLINEFORMAT ---------------------------------------------------------------
-
-shortlist=CHLINEFORMAT-LINETYPE,0,solid,dash,dot,dash-dot,dash-dot-dot,none,25%-pattern,50%-pattern,75%-pattern
-shortlist=CHLINEFORMAT-LINEWEIGHT,-1,hair,thin,medium,thick
-
-flagslist=CHLINEFORMAT-FLAGS
-  0x0001=auto
-  0x0004=axis-enabled
-end
-
-# CHMARKERFORMAT -------------------------------------------------------------
-
-shortlist=CHMARKERFORMAT-TYPE,0,none,square,diamond,triangle,cross,star,dow-jones,std-dev,circle,plus
-
-flagslist=CHMARKERFORMAT-FLAGS
-  0x0001=auto
-  0x0010=no-fill
-  0x0020=no-border
-end
-
-# CHOBJECTLINK ---------------------------------------------------------------
-
-shortlist=CHOBJECTLINK-TARGET,0,none,title,y-axis,x-axis,datapoint,legend,none,z-axis,,,,,axis-unit
-
-constlist=CHOBJECTLINK-POINT
-  default=
-  -2=unknown
-  -1=all-points
-end
-
-# CHPICFORMAT ----------------------------------------------------------------
-
-shortlist=CHPICFORMAT-BITMAP-MODE,1,stretched,stacked,stacked-scaled
-
-constlist=CHPICFORMAT-IMAGE-FORMAT
-  2=wmf
-  9=bmp
-  19=?emf
-end
-
-shortlist=CHPICFORMAT-ENV,1,windows,apple
-
-combilist=CHPICFORMAT-FLAGS
-  0x00FF=uint16,dec,environment,CHPICFORMAT-ENV
-  0x0100=format-only
-  0x0200=top-bottom
-  0x0400=front-back
-  0x0800=left-right
-end
-
-# CHPIE ----------------------------------------------------------------------
-
-flagslist=CHPIE-FLAGS
-  0x0001=shadow
-  0x0002=connectors
-end
-
-# CHRADAR, CHRADARAREA -------------------------------------------------------
-
-flagslist=CHRADAR-FLAGS
-  0x0001=axis-labels
-  0x0002=shadow
-end
-
-# CHPROPERTIES ---------------------------------------------------------------
-
-shortlist=CHPROPERTIES-EMPTYCELLS,0,do-not-plot,as-zero,interpolated
-
-flagslist=CHPROPERTIES-FLAGS
-  0x0001=manual-format
-  0x0002=plot-visible-only
-  0x0004=fixed-size
-  0x0008=manual-plotarea
-end
-
-# CHSCATTER ------------------------------------------------------------------
-
-shortlist=CHSCATTER-SIZETYPE,0,none,area,width
-
-flagslist=CHSCATTER-FLAGS
-  0x0001=bubbles
-  0x0002=show-negative
-  0x0004=shadow
-end
-
-# CHSERERRORBAR --------------------------------------------------------------
-
-shortlist=CHSERERRORBAR-TYPE,1,x-plus,x-minus,y-plus,y-minus
-shortlist=CHSERERRORBAR-SOURCE,1,percent,fixed,std-deviation,custom,std-error
-
-# CHSERIES -------------------------------------------------------------------
-
-shortlist=CHSERIES-TYPE,0,date,numeric,sequence,text
-
-# CHSERIESFORMAT -------------------------------------------------------------
-
-flagslist=CHSERIESFORMAT-FLAGS
-  0x0001=spline
-  0x0002=bubbles-3d
-  0x0004=shadow
-end
-
-# CHSERTRENDLINE -------------------------------------------------------------
-
-shortlist=CHSERTRENDLINE-TYPE,0,poynomial,exponential,logarithmic,power,moving-average
-
-# CHSOURCELINK ---------------------------------------------------------------
-
-shortlist=CHSOURCELINK-TARGET,0,title,values,category,bubbles
-shortlist=CHSOURCELINK-TYPE,0,default,constant,sheet-link
-
-flagslist=CHSOURCELINK-FLAGS
-  0x0001=custom-numfmt
-end
-
-# CHSTRING -------------------------------------------------------------------
-
-shortlist=CHSTRING-TYPE,0,text,category-default,value-default,x-prefix,x-postfix,y-prefix,y-postfix,comment
-
-# CHSURFACE ------------------------------------------------------------------
-
-flagslist=CHSURFACE-FLAGS
-  0x0001=filled
-  0x0002=shadow
-end
-
-# CHTEXT ---------------------------------------------------------------------
-
-shortlist=CHTEXT-HORALIGN,1,left,center,right,block,distribute
-shortlist=CHTEXT-VERALIGN,1,top,center,bottom,block,distribute
-shortlist=CHTEXT-FILLMODE,1,transparent,opaque
-
-combilist=CHTEXT-FLAGS-BIFF2
-  0x0001=auto-color
-  0x0002=show-symbol
-  0x0004=show-value
-  0x0008=vertical
-  0x0010=auto-text
-  0x0020=default-format
-  0x0040=deleted
-  0x0080=auto-fill
-end
-
-combilist=CHTEXT-FLAGS-BIFF3
-  include=CHTEXT-FLAGS-BIFF2
-  0x0700=uint8,dec,orientation,TEXTORIENTATION
-end
-
-combilist=CHTEXT-FLAGS-BIFF5
-  include=CHTEXT-FLAGS-BIFF3
-  0x0800=show-categ-percent
-  0x1000=show-percent
-end
-
-combilist=CHTEXT-FLAGS-BIFF8
-  include=CHTEXT-FLAGS-BIFF5
-  0x2000=show-bubble-size
-  0x4000=show-categ
-end
-
-multilist=CHTEXT-PLACEMENT
-  default=
-  0=context,outside,inside,center,axis,above,below,left,right,auto,manual
-end
-
-# CHTICK ---------------------------------------------------------------------
-
-shortlist=CHTICK-TYPE,0,none,inside,outside,both
-# TODO: really different label positions in BIFF2-BIFF4?
-shortlist=CHTICK-LABELPOS-BIFF2,0,none,near,below,above
-shortlist=CHTICK-LABELPOS-BIFF5,0,none,below,above,near
-
-flagslist=CHTICK-FLAGS-BIFF2
-  0x0001=auto-color
-  0x0002=auto-fill
-end
-
-combilist=CHTICK-FLAGS-BIFF3
-  include=CHTICK-FLAGS-BIFF2
-  0x001C=uint8,dec,orientation,TEXTORIENTATION
-  0x0020=auto-rotation
-end
-
-# CHUNITPROPERTIES -----------------------------------------------------------
-
-shortlist=CHUNITPROPERTIES-PRESET,-1,manual,none,hundred,thousand,(10000),(100000),million,(10million),(100million),billion,trillion
-
-flagslist=CHUNITPROPERTIES-FLAGS
-  0x0002=show-unit
-end
-
-# CHVALUERANGE ---------------------------------------------------------------
-
-flagslist=CHVALUERANGE-FLAGS
-  ignore=0x0100
-  0x0001=auto-minimum
-  0x0002=auto-maximum
-  0x0004=auto-major
-  0x0008=auto-minor
-  0x0010=auto-axis-cross
-  0x0020=logarithmic
-  0x0040=reverse-order
-  0x0080=maximum-axis-cross
-end
-
-# COLINFO --------------------------------------------------------------------
-
-combilist=COLINFO-FLAGS
-  0x0001=hidden
-  0x0002=custom-width
-  0x0004=best-fit
-  0x0008=show-phonetic
-  0x0700=uint8,dec,outline-level
-  0x1000=outline-collapsed
-end
-
-# DATATABLE ------------------------------------------------------------------
-
-flagslist=DATATABLE-FLAGS-BIFF3
-  0x0001=recalc-always
-  0x0002=recalc-on-load
-  0x0004=row-table
-  0x0008=table-2d
-end
-
-flagslist=DATATABLE-FLAGS-BIFF8
-  include=DATATABLE-FLAGS-BIFF3
-  0x0010=ref1-deleted
-  0x0020=ref2-deleted
-end
-
-# DATAVALIDATION -------------------------------------------------------------
-
-combilist=DATAVALIDATION-FLAGS
-  0x0000000F=uint8,dec,type,DATAVALIDATION-TYPE
-  0x00000070=uint8,dec,error-style,DATAVALIDATION-ERRORSTYLE
-  0x00000080=string-list
-  0x00000100=ignore-empty
-  0x00000200=no-dropdown
-  0x00040000=show-input-box
-  0x00080000=show-error-box
-  0x00F00000=uint8,dec,operator,DATAVALIDATION-OPERATOR
-end
-
-shortlist=DATAVALIDATION-TYPE,0,any,whole,decimal,list,date,time,text-length,custom
-shortlist=DATAVALIDATION-OPERATOR,0,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
-shortlist=DATAVALIDATION-ERRORSTYLE,0,error,warning,info
-
-# DATAVALIDATIONS ------------------------------------------------------------
-
-flagslist=DATAVALIDATIONS-FLAGS
-  0x0001=input-box-visible
-  0x0002=input-box-at-cell
-  0x0004=cached
-end
-
-# DATEMODE -------------------------------------------------------------------
-
-shortlist=DATEMODE,0,1899-12-31,1904-01-01
-
-# DEFINEDNAME ----------------------------------------------------------------
-
-flagslist=DEFINEDNAME-FLAGS-BIFF2
-  0x02=macro
-  0x04=complex
-end
-
-shortlist=DEFINEDNAME-MACROTYPE-BIFF2,0,none,function,procedure
-
-flagslist=DEFINEDNAME-FLAGS-BIFF3
-  0x0001=hidden
-  0x0002=function
-  0x0004=command
-  0x0008=macro
-  0x0010=complex
-  0x0020=builtin
-end
-
-combilist=DEFINEDNAME-FLAGS-BIFF4
-  include=DEFINEDNAME-FLAGS-BIFF3
-  0x0FC0=uint16,dec,func-group,DEFINEDNAME-FUNCGROUP
-end
-
-combilist=DEFINEDNAME-FLAGS-BIFF5
-  include=DEFINEDNAME-FLAGS-BIFF4
-  0x0004=vba
-  0x1000=binary
-end
-
-shortlist=DEFINEDNAME-FUNCGROUP,0,none,financial,date-time,math-trig,statistical,lookup-ref,database,text,logical,information,commands,customizing,macro-control,dde-external,user-definded
-
-constlist=DEFINEDNAME-SHEETIDX
-  default=
-  0=global
-end
-
-# DEFROWHEIGHT ---------------------------------------------------------------
-
-combilist=DEFROWHEIGHT-FLAGS-BIFF2
-  0x7FFF=uint16,dec,row-height,CONV-TWIP-TO-PT
-  0x8000=unchanged
-end
-
-flagslist=DEFROWHEIGHT-FLAGS-BIFF3
-  0x0001=custom-height
-  0x0002=hidden
-  0x0004=thick-top
-  0x0008=thick-bottom
-end
-
-# EXTERNALBOOK ---------------------------------------------------------------
-
-constlist=EXTERNALBOOK-KEY
-  0x0401=self-reference
-  0x3A01=analysis-addin
-end
-
-# EXTERNALNAME ---------------------------------------------------------------
-
-flagslist=EXTERNALNAME-FLAGS-BIFF3
-  0x0001=builtin
-  0x0002=automatic
-  0x0004=pic-link
-end
-
-combilist=EXTERNALNAME-FLAGS-BIFF5
-  include=EXTERNALNAME-FLAGS-BIFF3
-  0x0008=dde-stddocumentname
-  0x0010=ole-link
-  0x7FE0=uint16,dec,clipboard-format
-  0x8000=iconified
-end
-
-# EXTERNSHEET ----------------------------------------------------------------
-
-constlist=EXTERNSHEET-IDX-BIFF8
-  default=
-  -1=deleted
-  -2=special
-end
-
-# FONT -----------------------------------------------------------------------
-
-flagslist=FONT-FLAGS
-  0x0001=bold
-  0x0002=italic
-  0x0004=underline
-  0x0008=strikeout
-  0x0010=outline
-  0x0020=shadow
-  0x0040=condense
-  0x0080=extend
-end
-
-constlist=FONT-WEIGHT
-  400=normal
-  700=bold
-end
-
-multilist=FONT-UNDERLINE
-  0x00=none,single,double
-  0x21=single-acc,double-acc
-end
-
-shortlist=FONT-ESCAPEMENT,0,none,superscript,subscript
-shortlist=FONT-FAMILY,0,none,roman,swiss,modern,script,decorative
-
-# FORMULA --------------------------------------------------------------------
-
-flagslist=FORMULA-FLAGS-BIFF2
-  0x0001=recalc-always
-end
-
-flagslist=FORMULA-FLAGS-BIFF3
-  include=FORMULA-FLAGS-BIFF2
-  0x0002=recalc-onload
-end
-
-flagslist=FORMULA-FLAGS-BIFF5
-  include=FORMULA-FLAGS-BIFF3
-  0x0008=shared-fmla
-end
-
-shortlist=FORMULA-RESULTTYPE,0,string,boolean,error,empty
-
-# HIDEOBJ --------------------------------------------------------------------
-
-shortlist=HIDEOBJ,0,show,placeholder,hide
-
-# HYPERLINK ------------------------------------------------------------------
-
-79EAC9D0-BAF9-11CE-8C82-00AA004BA90B=StdHlink
-00000303-0000-0000-C000-000000000046=FileMoniker
-79EAC9E0-BAF9-11CE-8C82-00AA004BA90B=URLMoniker
-
-flagslist=HYPERLINK-FLAGS
-  0x00000001=target
-  0x00000002=absolute
-  0x00000004=display-1
-  0x00000008=location
-  0x00000010=display-2
-  0x00000080=frame
-  0x00000100=unc-path
-end
-
-# OBJ ------------------------------------------------------------------------
-
-multilist=OBJ-TYPE-BIFF5
-  0=group,line,rect,oval,arc,chart,textbox,button,pic,polygon
-  10=,checkbox,optbutton,edit,label,dialog,spin,scrollbar,listbox,groupbox
-  20=dropdown
-end
-
-flagslist=OBJ-FLAGS-BIFF5
-  0x0001=selected
-  0x0002=auto-size
-  0x0004=auto-move
-  0x0010=protected
-  0x0080=grouped
-  0x0100=hidden
-  0x0200=visible
-  0x0400=printable
-end
-
-flagslist=OBJ-FLAGS-AUTO-BIFF5
-  0x0001=auto
-end
-
-shortlist=OBJ-LINETYPE,0,solid,dash,dot,dash-dot,dash-dot-dot,25%-pattern,50%-pattern,75%-pattern
-shortlist=OBJ-LINEWEIGHT,0,hair,thin,medium,thick
-
-shortlist=OBJ-ARROWHEAD-TYPE-BIFF5,0,none,open,filled,double-end-open,double-end-filled
-shortlist=OBJ-ARROWHEAD-WIDTH-BIFF5,0,narrow,medium,wide
-shortlist=OBJ-ARROWHEAD-LENGTH-BIFF5,0,short,medium,long
-
-combilist=OBJ-LINEENDS-BIFF5
-  0x000F=uint8,dec,arrowhead-type,OBJ-ARROWHEAD-TYPE
-  0x00F0=uint8,dec,arrowhead-width,OBJ-ARROWHEAD-WIDTH
-  0x0F00=uint8,dec,arrowhead-length,OBJ-ARROWHEAD-LENGTH
-end
-
-shortlist=OBJ-LINEDIR-BIFF5,0,topleft-to-bottomright,topright-to-bottomleft,bottomright-to-topleft,bottomleft-to-topright
-
-combilist=OBJ-FRAMESTYLE-FLAGS-BIFF5
-  0x0001=rounded
-  0x0002=shadow
-  0x03FC=uint16,dec,rounded-diameter
-end
-
-flagslist=OBJ-CHART-FLAGS-BIFF5
-  0x0001=linked-to-sheet
-end
-
-multilist=OBJ-RECNAMES-BIFF8
-  0x0000=OBJEND,,,,OBJMACRO,,OBJGMO,OBJCF
-  0x0008=OBJPIOGRBIT,OBJPICTFMLA,OBJCBLS,,OBJSBS,,OBJSBSFMLA,OBJGBODATA
-  0x0010=,,,OBJLBSDATA,OBJCBLSFMLA,OBJCMO,,
-end
-
-flagslist=OBJPIOGRBIT-FLAGS
-  0x0001=manual-size
-  0x0002=linked
-  0x0008=symbol
-  0x0010=control
-  0x0020=ctls-stream
-  0x0200=auto-load
-end
-
-shortlist=OBJPICTFMLA-HASCLASSNAME,0,false,,,true
-
-multilist=OBJCMO-TYPE
-  include=OBJ-TYPE-BIFF5
-  25=note
-  30=drawing
-end
-
-flagslist=OBJCMO-FLAGS
-  0x0001=locked
-  0x0010=printable
-  0x2000=auto-line
-  0x4000=auto-area
-end
-
-# PAGESETUP ------------------------------------------------------------------
-
-multilist=PAGESETUP-PAPERSIZE
-  0=undefined,letter,letter-small,tabloid,ledger,legal,statement,executive,a3,a4
-  10=a4-small,a5,b4,b5,folio,quarto,10x14,11x17,note,envelope-9
-  20=envelope-10,envelope-11,envelope-12,envelope-14,c,d,e,envelope-dl,envelope-c5,envelope-c3
-  30=envelope-c4,envelope-c6,envelope-c65,envelope-b4,envelope-b5,envelope-b6,envelope-italy,envelope-monarch,envelope-6-3/4,us-standard-fanfold
-  40=german-standard-fanfold,german-legal-fanfold,b4,japanese-dbl-postcaed,9x11,10x11,15x11,,
-  50=envelope-invite,letter-extra,legal-extra,tabloid-extra,a4-extra,letter-transverse,a4-transverse,letter-extra-transverse,super-a-a4,super-b-a3,letter-plus
-  60=a4-plus,a5-transverse,jis-b5-transverse,a3-extra,a5-extra,b5-extra,a2,a3-transverse,a3-extra-transverse
-end
-
-constlist=PAGESETUP-SCALETOPAGES
-  default=
-  0=automatic
-end
-
-flagslist=PAGESETUP-FLAGS-BIFF4
-  0x0001=print-in-rows
-  0x0002=portrait
-  0x0004=uninitialized
-  0x0008=black-and-white
-end
-
-flagslist=PAGESETUP-FLAGS-BIFF5
-  include=PAGESETUP-FLAGS-BIFF4
-  0x0010=draft-quality
-  0x0020=print-notes
-  0x0040=default-orientation
-  0x0080=use-first-page
-end
-
-combilist=PAGESETUP-FLAGS-BIFF8
-  include=PAGESETUP-FLAGS-BIFF5
-  0x0200=print-notes-at-end
-  0x0C00=uint8,dec,print-errors,PAGESETUP-PRINTERRORS
-end
-
-shortlist=PAGESETUP-PRINTERRORS,0,displayed,none,as-dashes,as-na
-
-unitconverter=PAGESETUP-DPI,1,dpi
-
-# PANE -----------------------------------------------------------------------
-
-shortlist=PANE-ID,0,bottom-right,top-right,bottom-left,top-left
-
-# PHONETICPR -----------------------------------------------------------------
-
-shortlist=PHONETICPR-TYPE,0,halfwidth-katakana,fullwidth-katakana,hiragana,no-conversion
-shortlist=PHONETICPR-ALIGNMENT,0,no-control,left,center,distributed
-
-combilist=PHONETICPR-FLAGS
-  ignore=0x0030
-  0x0003=uint8,dec,type,PHONETICPR-TYPE
-  0x000C=uint8,dec,alignment,PHONETICPR-ALIGNMENT
-end
-
-# PROJEXTSHEET ---------------------------------------------------------------
-
-shortlist=PROJEXTSHEET-TYPE,0,sheet,macro,chart
-
-# REFMODE --------------------------------------------------------------------
-
-shortlist=REFMODE,0,R1C1,A1
-
-# ROW ------------------------------------------------------------------------
-
-combilist=ROW-HEIGHT
-  0x7FFF=uint16,dec,height,CONV-TWIP-TO-PT
-  0x8000=default-height
-end
-
-combilist=ROW-FLAGS
-  ignore=0x00000100
-  0x00000007=uint8,dec,outline-level
-  0x00000010=outline-collapsed
-  0x00000020=hidden
-  0x00000040=custom-height
-  0x00000080=custom-format
-  0x0FFF0000=uint16,dec,custom-xf-idx
-  0x10000000=thick-top
-  0x20000000=thick-bottom
-  0x40000000=show-phonetic
-end
-
-# SHEET ----------------------------------------------------------------------
-
-shortlist=SHEET-STATE,0,visible,hidden,very-hidden
-shortlist=SHEET-TYPE,0,worksheet,macrosheet,chartsheet,,,,vb-module
-
-# SHEETPR --------------------------------------------------------------------
-
-shortlist=SHEETPR-WINDOWPOS,0,tiled,horizontal,vertical,cascaded
-
-flagslist=SHEETPR-FLAGS-BIFF3
-  0x0001=show-autopagebreaks
-  0x0020=outline-auto-style
-  0x0040=outline-symbols-below
-  0x0080=outline-symbols-right
-  0x0100=fit-to-pages
-  0x0200=skip-linked-values
-  0x0400=show-row-outline
-  0x0800=show-column-outline
-end
-
-flagslist=SHEETPR-FLAGS-BIFF4
-  include=SHEETPR-FLAGS-BIFF3
-  0x3000=uint8,dec,window-pos,SHEETPR-WINDOWPOS
-  0x4000=lotus-expr-eval
-  0x8000=lotus-formula-edit
-end
-
-flagslist=SHEETPR-FLAGS-BIFF5
-  include=SHEETPR-FLAGS-BIFF4
-  exclude=0x0200,0x3000
-  0x0010=dialog-sheet
-end
-
-# SHEETPROTECTION ------------------------------------------------------------
-
-flagslist=SHEETPROTECTION-FLAGS
-  0x0001=edit-object
-  0x0002=edit-scenario
-  0x0004=format-cell
-  0x0008=format-column
-  0x0010=format-row
-  0x0020=insert-column
-  0x0040=insert-row
-  0x0080=insert-hyperlink
-  0x0100=delete-column
-  0x0200=delete-row
-  0x0400=select-locked
-  0x0800=sort
-  0x1000=use-autofilter
-  0x2000=pivottable-report
-  0x4000=select-unlocked
-end
-
-# STYLE ----------------------------------------------------------------------
-
-combilist=STYLE-FLAGS
-  0x0FFF=uint16,dec,xf-idx
-  0x8000=builtin
-end
-
-shortlist=STYLE-BUILTIN,0,normal,rowlevel,collevel,comma,currency,percent,comma-0,currency-0,hyperlink,followed-hyperlink
-
-# common for pivot tables ----------------------------------------------------
-
-constlist=SX-NAMELEN
-  default=
-  0xFFFF=name-in-cache
-end
-
-# SXDB -----------------------------------------------------------------------
-
-flagslist=SXDB-FLAGS
-  0x0001=save-data
-  0x0002=invalid
-  0x0004=refresh-on-load
-  0x0008=opt-cache
-  0x0010=backgr-query
-  0x0020=enable-refresh
-end
-
-constlist=SXDB-TYPE
-  1=worksheet
-  2=external
-  4=consolidation
-  8=scenario
-end
-
-# SXDI -----------------------------------------------------------------------
-
-shortlist=SXDI-FUNC,0,sum,count-all,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p
-shortlist=SXDI-FORMAT,0,normal,diff-from,percent-of,percent-diff-from,running-total-in,percent-of-row,percent-of-column,percent-of-total,index
-
-multilist=SXDI-BASEITEM
-  default=
-  0x7FFB=previous-item,next-item
-end
-
-# SXEXT ----------------------------------------------------------------------
-
-combilist=SXEXT-FLAGS
-  0x0007=uint8,dec,source-type,SXEXT-SOURCETYPE
-  0x0008=odbc-connection
-  0x0010=odbc-sql
-  0x0020=server-pagefields
-  0x0040=webquery
-  0x0080=save-password
-  0x0100=tables-html-only
-end
-
-shortlist=SXEXT-SOURCETYPE,1,odbc,dao,,webquery
-
-# SXFDBTYPE ------------------------------------------------------------------
-
-shortlist=SXFDBTYPE-DATATYPE,0,unknown,char,numeric,decimal,integer,small-int,float,real,double,datetime,,,var-char
-
-# SXFIELD --------------------------------------------------------------------
-
-combilist=SXFIELD-FLAGS
-  0x0001=has-items
-  0x0002=postpone-items
-  0x0004=calculated
-  0x0008=has-child
-  0x0010=numeric-group
-  0x0020=16bit-indexes
-  0x0DE0=uint16,hex,data-type,SXFIELD-TYPE,noshift
-end
-
-constlist=SXFIELD-TYPE
-  0x0000=none
-  0x0480=string-only
-  0x0520=integer-optdouble
-  0x0560=double-only
-  0x05A0=string-integer-optdouble
-  0x05E0=string-double-only
-  0x0900=date-only
-  0x0980=date-empty-only
-  0x0D00=date-number
-  0x0D80=date-string-optnumber
-end
-
-# SXLI -----------------------------------------------------------------------
-
-shortlist=SXLI-ITEMTYPE,0,data,default,sum,count-num,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p,grandtotal,blank-line
-
-combilist=SXLI-FLAGS
-  0x0001=field-name
-  0x01FE=uint16,dec,data-field-idx
-  0x0200=subtotal
-  0x0400=blocktotal
-  0x0800=grandtotal
-  0x1000=multi-data
-end
-
-# SXNUMGROUP -----------------------------------------------------------------
-
-combilist=SXNUMGROUP-FLAGS
-  0x0001=auto-min
-  0x0002=auto-max
-  0x003C=uint8,dec,data-type,SXNUMGROUP-TYPE
-end
-
-shortlist=SXNUMGROUP-TYPE,1,second,minute,hour,day,month,quarter,year,numeric
-
-# SXVD -----------------------------------------------------------------------
-
-flagslist=SXVD-AXISTYPE
-  0x0001=row
-  0x0002=column
-  0x0004=page
-  0x0008=data
-end
-
-flagslist=SXVD-SUBTOTALS
-  0x0001=default
-  0x0002=sum
-  0x0004=count-all
-  0x0008=average
-  0x0010=max
-  0x0020=min
-  0x0040=product
-  0x0080=count-num
-  0x0100=std-dev
-  0x0200=std-dev-p
-  0x0400=variance
-  0x0800=variance-p
-end
-
-# SXVDEX ---------------------------------------------------------------------
-
-combilist=SXVDEX-FLAGS
-  0x00000001=show-all-items
-  0x00000002=drag-to-row
-  0x00000004=drag-to-column
-  0x00000008=drag-to-page
-  0x00000010=drag-to-hide
-  0x00000080=server-based
-  0x00000200=autosort
-  0x00000400=autosort-ascending
-  0x00000800=autoshow
-  0x00001000=autoshow-top-values
-  0x00002000=calculated
-  0x00200000=layout-report
-  0x00400000=layout-blank
-  0x00800000=layout-top
-  0xFF000000=uint8,dec,autoshow-item-count
-end
-
-# SXVI -----------------------------------------------------------------------
-
-multilist=SXVI-ITEMTYPE
-  0=data,default,sum,count-num,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p,grandtotal
-  254=page,none
-end
-
-flagslist=SXVI-FLAGS
-  0x0001=hidden
-  0x0002=hide-detail
-  0x0004=calculated
-  0x0008=missing
-end
-
-# SXVIEW ---------------------------------------------------------------------
-
-flagslist=SXVIEW-FLAGS
-  0x0001=row-grandtotals
-  0x0002=column-grandtotals
-  0x0008=auto-format
-  0x0010=size-auto-format
-  0x0020=font-auto-format
-  0x0040=align-auto-format
-  0x0080=border-auto-format
-  0x0100=pattern-auto-format
-  0x0200=number-auto-format
-end
-
-# SXVS -----------------------------------------------------------------------
-
-flagslist=SXVS-TYPE
-  0x0001=spreadsheet
-  0x0002=extern
-  0x0004=consolidation-area
-  0x0008=pivot-table
-  0x0010=scenario
-end
-
-# WINDOW1 --------------------------------------------------------------------
-
-flagslist=WINDOW1-FLAGS
-  0x0001=hidden
-  0x0002=minimized
-  0x0008=show-horizontal-scroll
-  0x0010=show-vertical-scroll
-  0x0020=show-tabbar
-end
-
-unitconverter=WINDOW1-TABBARRATIO,/10,%
-
-# WINDOW2 --------------------------------------------------------------------
-
-flagslist=WINDOW2-FLAGS-BIFF3
-  0x0001=show-formulas
-  0x0002=show-gridlines
-  0x0004=show-headings
-  0x0008=frozen-panes
-  0x0010=show-zeros
-  0x0020=default-gridcolor
-  0x0040=right-to-left
-  0x0080=show-outline-symbols
-  0x0100=remove-split-with-freeze
-end
-
-flagslist=WINDOW2-FLAGS-BIFF5
-  include=WINDOW2-FLAGS-BIFF3
-  0x0200=sheet-selected
-  0x0400=sheet-active
-end
-
-flagslist=WINDOW2-FLAGS-BIFF8
-  include=WINDOW2-FLAGS-BIFF5
-  0x0800=pagebreak-mode
-end
-
-# XF -------------------------------------------------------------------------
-
-shortlist=XF-HORALIGN,0,general,left,center,right,fill,block,center-across-sel,distribute
-shortlist=XF-VERALIGN,0,top,center,bottom,justify,distribute
-shortlist=XF-TEXTDIRECTION,0,context,left-to-right,right-to-left
-
-flagslist=XF-PROTECTION-FLAGS
-  0x01=locked
-  0x02=formula-hidden
-  0x04=style-xf
-end
-
-flagslist=XF-USEDATTRIBS-FLAGS
-  0x04=format
-  0x08=font
-  0x10=alignment
-  0x20=border
-  0x40=area
-  0x80=protection
-end
-
-combilist=XF-STYLEFLAGS-BIFF2
-  0x07=uint8,dec,hor-align,XF-HORALIGN
-  0x08=left-border
-  0x10=right-border
-  0x20=top-border
-  0x40=bottom-border
-  0x80=fill
-end
-
-combilist=XF-TYPEFLAGS-BIFF2
-  0x3F=uint8,dec,fmt-idx,FORMATS
-  0x40=locked
-  0x80=formula-hidden
-end
-
-flagslist=XF-TYPEFLAGS-BIFF3
-  include=XF-PROTECTION-FLAGS
-end
-
-combilist=XF-TYPEFLAGS-BIFF4
-  include=XF-TYPEFLAGS-BIFF3
-  0xFFF0=uint16,dec,parent-xf-idx
-end
-
-combilist=XF-ALIGNMENT-BIFF3
-  0x0007=uint8,dec,hor-align,XF-HORALIGN
-  0x0008=text-wrap
-  0xFFF0=uint16,dec,parent-xf-idx
-end
-
-combilist=XF-ALIGNMENT-BIFF4
-  0x07=uint8,dec,hor-align,XF-HORALIGN
-  0x08=text-wrap
-  0x30=uint8,dec,ver-align,XF-VERALIGN
-  0xC0=uint8,dec,orientation,TEXTORIENTATION
-end
-
-combilist=XF-ALIGNMENT-BIFF5
-  0x07=uint8,dec,hor-align,XF-HORALIGN
-  0x08=text-wrap
-  0x70=uint8,dec,ver-align,XF-VERALIGN
-  0x80=justify-lastline
-end
-
-combilist=XF-ORIENTATTRIBS-BIFF5
-  include=XF-USEDATTRIBS-FLAGS
-  0x03=uint8,dec,orientation,TEXTORIENTATION
-end
-
-combilist=XF-TEXTFLAGS-BIFF8
-  0x0F=uint8,dec,indent
-  0x10=shrink-to-fit
-  0xC0=uint8,dec,text-dir,XF-TEXTDIRECTION
-end
-
-combilist=XF-FILL-BIFF3
-  0x003F=uint8,dec,fill-pattern,FILLPATTERNS
-  0x07C0=uint8,dec,fg-color-idx,COLORS
-  0xF800=uint8,dec,bg-color-idx,COLORS
-end
-
-combilist=XF-BORDER-BIFF3
-  0x00000007=uint8,dec,top-style,BORDERSTYLES
-  0x000000F8=uint8,dec,top-color,COLORS
-  0x00000700=uint8,dec,left-style,BORDERSTYLES
-  0x0000F800=uint8,dec,left-color,COLORS
-  0x00070000=uint8,dec,bottom-style,BORDERSTYLES
-  0x00F80000=uint8,dec,bottom-color,COLORS
-  0x07000000=uint8,dec,right-style,BORDERSTYLES
-  0xF8000000=uint8,dec,right-color,COLORS
-end
-
-combilist=XF-FILL-BIFF5
-  0x0000007F=uint8,dec,fg-color-idx,COLORS
-  0x00003F80=uint8,dec,bg-color-idx,COLORS
-  0x003F0000=uint8,dec,fill-pattern,FILLPATTERNS
-  0x01C00000=uint8,dec,bottom-style,BORDERSTYLES
-  0xFE000000=uint8,dec,bottom-color,COLORS
-end
-
-combilist=XF-BORDER-BIFF5
-  0x00000007=uint8,dec,top-style,BORDERSTYLES
-  0x00000038=uint8,dec,left-style,BORDERSTYLES
-  0x000001C0=uint8,dec,right-style,BORDERSTYLES
-  0x0000FE00=uint8,dec,top-color,COLORS
-  0x007F0000=uint8,dec,left-color,COLORS
-  0x3F800000=uint8,dec,right-color,COLORS
-end
-
-combilist=XF-BORDERSTYLE-BIFF8
-  0x000F=uint8,dec,left-style,BORDERSTYLES
-  0x00F0=uint8,dec,right-style,BORDERSTYLES
-  0x0F00=uint8,dec,top-style,BORDERSTYLES
-  0xF000=uint8,dec,bottom-style,BORDERSTYLES
-end
-
-combilist=XF-BORDERCOLOR1-BIFF8
-  0x007F=uint8,dec,left-color,COLORS
-  0x3F80=uint8,dec,right-color,COLORS
-  0x4000=diag-tl-to-br
-  0x8000=diag-bl-to-tr
-end
-
-combilist=XF-BORDERCOLOR2-BIFF8
-  0x0000007F=uint8,dec,top-color,COLORS
-  0x00003F80=uint8,dec,bottom-color,COLORS
-  0x001FC000=uint8,dec,diag-color,COLORS
-  0x01E00000=uint8,dec,diag-style,BORDERSTYLES
-  0xFC000000=uint8,dec,fill-pattern,FILLPATTERNS
-end
-
-combilist=XF-FILLCOLOR-BIFF8
-  0x007F=uint8,dec,fg-color-idx,COLORS
-  0x3F80=uint8,dec,bg-color-idx,COLORS
-end
-
-# BIFF2 XF index field -------------------------------------------------------
-
-constlist=XFINDEX-BIFF2
-  default=
-  63=from-ixfe
-end
-
-combilist=CELL-XFINDEX-BIFF2
-  0x3F=uint8,dec,xf-idx,XFINDEX-BIFF2
-  0x40=locked
-  0x80=formula-hidden
-end
-
-combilist=CELL-XFFORMAT-BIFF2
-  0x3F=uint8,dec,fmt-idx,FORMATS
-  0xC0=uint8,dec,font-idx,FONTNAMES
-end
-
-combilist=CELL-XFSTYLE-BIFF2
-  include=XF-STYLEFLAGS-BIFF2
-end
-
-# ============================================================================
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/biffdumper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/biffdumper.cxx
--- oox/source/dump/biffdumper.cxx	2008-04-18 16:25:34.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/biffdumper.cxx	2008-10-06 16:28:34.000000000 +0200
@@ -32,10 +32,8 @@
 
 #include <osl/thread.h>
 #include <rtl/tencinfo.h>
-#include <rtl/strbuf.hxx>
-#include <com/sun/star/util/DateTime.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include "oox/dump/olestoragedumper.hxx"
+#include "oox/dump/oledumper.hxx"
+#include "oox/helper/olestorage.hxx"
 #include "oox/core/filterbase.hxx"
 #include "oox/xls/biffdetector.hxx"
 #include "oox/xls/biffinputstream.hxx"
@@ -49,9 +47,9 @@ using ::rtl::OString;
 using ::rtl::OStringBuffer;
 using ::rtl::OStringToOUString;
 using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::util::DateTime;
-using ::com::sun::star::sheet::XSpreadsheetDocument;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::io::XInputStream;
 using ::oox::core::FilterBase;
 
 using namespace ::oox::xls;
@@ -67,42 +65,31 @@ namespace  {
 const sal_uInt16 BIFF_FONTFLAG_BOLD         = 0x0001;
 const sal_uInt16 BIFF_FONTFLAG_ITALIC       = 0x0002;
 
-const sal_uInt32 BIFF_HYPERLINK_TARGET      = 0x00000001;   /// File name or URL.
-const sal_uInt32 BIFF_HYPERLINK_ABS         = 0x00000002;   /// Absolute path.
-const sal_uInt32 BIFF_HYPERLINK_DISPLAY     = 0x00000014;   /// Display string.
-const sal_uInt32 BIFF_HYPERLINK_LOC         = 0x00000008;   /// Target location.
-const sal_uInt32 BIFF_HYPERLINK_FRAME       = 0x00000080;   /// Target frame.
-const sal_uInt32 BIFF_HYPERLINK_UNC         = 0x00000100;   /// UNC path.
-
-const sal_uInt16 BIFF_OBJPIO_MANUALSIZE     = 0x0001;
-const sal_uInt16 BIFF_OBJPIO_LINKED         = 0x0002;
-const sal_uInt16 BIFF_OBJPIO_SYMBOL         = 0x0008;
-const sal_uInt16 BIFF_OBJPIO_CONTROL        = 0x0010;   /// Form control.
-const sal_uInt16 BIFF_OBJPIO_CTLSSTREAM     = 0x0020;   /// Data in Ctls stream.
-const sal_uInt16 BIFF_OBJPIO_AUTOLOAD       = 0x0200;
-
-const sal_uInt16 BIFF_OBJCMO_GROUP          = 0x0000;
-const sal_uInt16 BIFF_OBJCMO_LINE           = 0x0001;
-const sal_uInt16 BIFF_OBJCMO_RECTANGLE      = 0x0002;
-const sal_uInt16 BIFF_OBJCMO_ELLIPSE        = 0x0003;
-const sal_uInt16 BIFF_OBJCMO_ARC            = 0x0004;
-const sal_uInt16 BIFF_OBJCMO_CHART          = 0x0005;
-const sal_uInt16 BIFF_OBJCMO_TEXT           = 0x0006;
-const sal_uInt16 BIFF_OBJCMO_BUTTON         = 0x0007;
-const sal_uInt16 BIFF_OBJCMO_PICTURE        = 0x0008;
-const sal_uInt16 BIFF_OBJCMO_POLYGON        = 0x0009;
-const sal_uInt16 BIFF_OBJCMO_CHECKBOX       = 0x000B;
-const sal_uInt16 BIFF_OBJCMO_OPTIONBUTTON   = 0x000C;
-const sal_uInt16 BIFF_OBJCMO_EDIT           = 0x000D;
-const sal_uInt16 BIFF_OBJCMO_LABEL          = 0x000E;
-const sal_uInt16 BIFF_OBJCMO_DIALOG         = 0x000F;
-const sal_uInt16 BIFF_OBJCMO_SPIN           = 0x0010;
-const sal_uInt16 BIFF_OBJCMO_SCROLLBAR      = 0x0011;
-const sal_uInt16 BIFF_OBJCMO_LISTBOX        = 0x0012;
-const sal_uInt16 BIFF_OBJCMO_GROUPBOX       = 0x0013;
-const sal_uInt16 BIFF_OBJCMO_COMBOBOX       = 0x0014;
-const sal_uInt16 BIFF_OBJCMO_NOTE           = 0x0019;
-const sal_uInt16 BIFF_OBJCMO_DRAWING        = 0x001E;
+const sal_uInt16 BIFF_OBJTYPE_GROUP         = 0;
+const sal_uInt16 BIFF_OBJTYPE_LINE          = 1;
+const sal_uInt16 BIFF_OBJTYPE_RECTANGLE     = 2;
+const sal_uInt16 BIFF_OBJTYPE_OVAL          = 3;
+const sal_uInt16 BIFF_OBJTYPE_ARC           = 4;
+const sal_uInt16 BIFF_OBJTYPE_CHART         = 5;
+const sal_uInt16 BIFF_OBJTYPE_TEXT          = 6;
+const sal_uInt16 BIFF_OBJTYPE_BUTTON        = 7;
+const sal_uInt16 BIFF_OBJTYPE_PICTURE       = 8;
+const sal_uInt16 BIFF_OBJTYPE_POLYGON       = 9;
+const sal_uInt16 BIFF_OBJTYPE_CHECKBOX      = 11;
+const sal_uInt16 BIFF_OBJTYPE_OPTIONBUTTON  = 12;
+const sal_uInt16 BIFF_OBJTYPE_EDIT          = 13;
+const sal_uInt16 BIFF_OBJTYPE_LABEL         = 14;
+const sal_uInt16 BIFF_OBJTYPE_DIALOG        = 15;
+const sal_uInt16 BIFF_OBJTYPE_SPIN          = 16;
+const sal_uInt16 BIFF_OBJTYPE_SCROLLBAR     = 17;
+const sal_uInt16 BIFF_OBJTYPE_LISTBOX       = 18;
+const sal_uInt16 BIFF_OBJTYPE_GROUPBOX      = 19;
+const sal_uInt16 BIFF_OBJTYPE_DROPDOWN      = 20;
+const sal_uInt16 BIFF_OBJTYPE_NOTE          = 25;
+const sal_uInt16 BIFF_OBJTYPE_DRAWING       = 30;
+
+const sal_uInt16 BIFF_OBJFLAGS_CONTROL      = 0x0010;   /// Form control.
+const sal_uInt16 BIFF_OBJFLAGS_CTLSSTREAM   = 0x0020;   /// Data in Ctls stream.
 
 const sal_uInt16 BIFF_STYLE_BUILTIN         = 0x8000;
 
@@ -113,70 +100,80 @@ const sal_uInt16 BIFF_PT_NOSTRING       
 // ============================================================================
 // ============================================================================
 
-class BiffStreamInput : public Input
-{
-public:
-    inline explicit     BiffStreamInput( BiffInputStream& rStrm ) : mrStrm( rStrm ) {}
-    virtual             ~BiffStreamInput();
-
-    virtual sal_Int64   getSize() const;
-    virtual sal_Int64   tell() const;
-    virtual void        seek( sal_Int64 nPos );
-    virtual void        skip( sal_Int32 nBytes );
-    virtual sal_Int32   read( void* pBuffer, sal_Int32 nBytes );
-
-    virtual BiffStreamInput& operator>>( sal_Int8& rnData );
-    virtual BiffStreamInput& operator>>( sal_uInt8& rnData );
-    virtual BiffStreamInput& operator>>( sal_Int16& rnData );
-    virtual BiffStreamInput& operator>>( sal_uInt16& rnData );
-    virtual BiffStreamInput& operator>>( sal_Int32& rnData );
-    virtual BiffStreamInput& operator>>( sal_uInt32& rnData );
-    virtual BiffStreamInput& operator>>( float& rfData );
-    virtual BiffStreamInput& operator>>( double& rfData );
-
-private:
-    BiffInputStream&    mrStrm;
-};
-
-// ----------------------------------------------------------------------------
+namespace {
 
-BiffStreamInput::~BiffStreamInput()
+void lclDumpDffClientPos( Output& rOut, BinaryInputStream& rStrm, const String& rName, sal_uInt16 nSubScale )
+{
+    MultiItemsGuard aMultiGuard( rOut );
+    TableGuard aTabGuard( rOut, 17 );
 {
+        sal_uInt16 nPos = rStrm.readuInt16();
+        ItemGuard aItem( rOut, rName );
+        rOut.writeDec( nPos );
+    }
+    {
+        sal_uInt16 nSubUnits = rStrm.readuInt16();
+        ItemGuard aItem( rOut, "sub-units" );
+        rOut.writeDec( nSubUnits );
+        rOut.writeChar( '/' );
+        rOut.writeDec( nSubScale );
+    }
 }
 
-sal_Int64 BiffStreamInput::getSize() const
+void lclDumpDffClientRect( Output& rOut, BinaryInputStream& rStrm )
 {
-    return mrStrm.getRecSize();
+    lclDumpDffClientPos( rOut, rStrm, "start-col", 1024 );
+    lclDumpDffClientPos( rOut, rStrm, "start-row", 256 );
+    lclDumpDffClientPos( rOut, rStrm, "end-col", 1024 );
+    lclDumpDffClientPos( rOut, rStrm, "end-row", 256 );
 }
 
-sal_Int64 BiffStreamInput::tell() const
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+BiffDffStreamObject::BiffDffStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
 {
-    return mrStrm.getRecPos();
+    DffStreamObject::construct( rParent, rxStrm );
 }
 
-void BiffStreamInput::seek( sal_Int64 nPos )
+void BiffDffStreamObject::implDumpClientAnchor()
 {
-    mrStrm.seek( static_cast< sal_uInt32 >( nPos ) );
+    dumpHex< sal_uInt16 >( "flags", "DFF-CLIENTANCHOR-FLAGS" );
+    lclDumpDffClientRect( out(), in() );
 }
 
-void BiffStreamInput::skip( sal_Int32 nBytes )
+// ============================================================================
+
+BiffCtlsStreamObject::BiffCtlsStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
 {
-    mrStrm.skip( static_cast< sal_uInt32 >( nBytes ) );
+    InputObjectBase::construct( rParent, rxStrm );
+    mnStartPos = mnLength = 0;
 }
 
-sal_Int32 BiffStreamInput::read( void* pBuffer, sal_Int32 nSize )
+void BiffCtlsStreamObject::dumpControl( sal_uInt32 nStartPos, sal_uInt32 nLength )
 {
-    return static_cast< sal_Int32 >( mrStrm.read( pBuffer, static_cast< sal_uInt32 >( nSize ) ) );
+    mnStartPos = nStartPos;
+    mnLength = nLength;
+    dump();
+    mnStartPos = mnLength = 0;
 }
 
-BiffStreamInput& BiffStreamInput::operator>>( sal_Int8& rnData )   { mrStrm >> rnData; return *this; }
-BiffStreamInput& BiffStreamInput::operator>>( sal_uInt8& rnData )  { mrStrm >> rnData; return *this; }
-BiffStreamInput& BiffStreamInput::operator>>( sal_Int16& rnData )  { mrStrm >> rnData; return *this; }
-BiffStreamInput& BiffStreamInput::operator>>( sal_uInt16& rnData ) { mrStrm >> rnData; return *this; }
-BiffStreamInput& BiffStreamInput::operator>>( sal_Int32& rnData )  { mrStrm >> rnData; return *this; }
-BiffStreamInput& BiffStreamInput::operator>>( sal_uInt32& rnData ) { mrStrm >> rnData; return *this; }
-BiffStreamInput& BiffStreamInput::operator>>( float& rfData )      { mrStrm >> rfData; return *this; }
-BiffStreamInput& BiffStreamInput::operator>>( double& rfData )     { mrStrm >> rfData; return *this; }
+void BiffCtlsStreamObject::implDump()
+{
+    if( mnLength > 0 )
+    {
+        out().emptyLine();
+        writeEmptyItem( "CTLS-START" );
+        {
+            IndentGuard aIndGuard( out() );
+            in().seek( mnStartPos );
+            OcxGuidControlObject( *this, mnLength ).dump();
+        }
+        writeEmptyItem( "CTLS-END" );
+        out().emptyLine();
+    }
+}
 
 // ============================================================================
 // ============================================================================
@@ -220,8 +217,11 @@ BiffSharedData::BiffSharedData( BiffType
 {
 }
 
-BiffSharedData::~BiffSharedData()
+void BiffSharedData::initializePerSheet()
 {
+    maFontEncs.clear();
+    maXfFontIds.clear();
+    meTextEnc = osl_getThreadTextEncoding();
 }
 
 void BiffSharedData::setTextEncoding( rtl_TextEncoding eTextEnc )
@@ -270,32 +270,32 @@ bool BiffSharedData::implIsValid() const
 
 // ============================================================================
 
-BiffObjectBase::BiffObjectBase()
-{
-}
-
 BiffObjectBase::~BiffObjectBase()
 {
 }
 
-void BiffObjectBase::construct( const ObjectBase& rParent, const OUString& rOutFileName, BinaryInputStreamRef xStrm, BiffType eBiff )
+void BiffObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, BiffType eBiff, const OUString& rSysFileName )
 {
-    if( eBiff != BIFF_UNKNOWN )
-    {
-        InputStreamObject::construct( rParent, rOutFileName, xStrm );
-        if( InputStreamObject::implIsValid() )
+    if( rParent.isValid() && rxStrm.get() && (eBiff != BIFF_UNKNOWN) )
         {
             mxBiffData.reset( new BiffSharedData( eBiff ) );
-            mxStrm.reset( new BiffInputStream( getStream() ) );
-            reconstructConfig();
-            reconstructInput();
-        }
-        if( BiffObjectBase::implIsValid() )
+        mxBiffStrm.reset( new BiffInputStream( *rxStrm ) );
+        RecordObjectBase::construct( rParent, rxStrm, rSysFileName, mxBiffStrm, "RECORD-NAMES", "SIMPLE-RECORDS" );
+        if( RecordObjectBase::implIsValid() )
+        {
+            reconstructConfig( ConfigRef( new BiffConfig( cfg(), eBiff ) ) );
+            mxDffObj.reset( new BiffDffStreamObject( *this, mxBiffStrm ) );
+            if( StorageBase* pRootStrg = cfg().getRootStorage().get() )
         {
+                BinaryInputStreamRef xCtlsStrm( new BinaryXInputStream( pRootStrg->openInputStream( CREATE_OUSTRING( "Ctls" ) ), true ) );
+                mxCtlsObj.reset( new BiffCtlsStreamObject( *this, xCtlsStrm ) );
+            }
             const Config& rCfg = cfg();
             mxErrCodes = rCfg.getNameList( "ERRORCODES" );
             mxConstType = rCfg.getNameList( "CONSTVALUE-TYPE" );
             mxResultType = rCfg.getNameList( "FORMULA-RESULTTYPE" );
+            mnLastRecId = BIFF_ID_UNKNOWN;
+            mbMergeContRec = rCfg.getBoolOption( "merge-continue-record", true );
         }
     }
 }
@@ -307,21 +307,52 @@ void BiffObjectBase::construct( const Bi
 
 bool BiffObjectBase::implIsValid() const
 {
-    return isValid( mxBiffCfg ) && isValid( mxBiffData ) && mxStrm.get() && InputStreamObject::implIsValid();
+    return isValid( mxBiffData ) && mxBiffStrm.get() && isValid( mxDffObj ) && InputObjectBase::implIsValid();
 }
 
-ConfigRef BiffObjectBase::implReconstructConfig()
+bool BiffObjectBase::implStartRecord( BinaryInputStream&, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize )
 {
-    mxBiffCfg.reset( new BiffConfig( cfg(), getBiff() ) );
-    return mxBiffCfg;
+    // previous record
+    mnLastRecId = mxBiffStrm->getRecId();
+    switch( mnLastRecId )
+    {
+        case BIFF_ID_CHBEGIN:
+            out().incIndent();
+        break;
 }
 
-InputRef BiffObjectBase::implReconstructInput()
+    // start next record
+    bool bValid = mxBiffStrm->startNextRecord();
+    ornRecPos = mxBiffStrm->tellBase() - 4;
+    ornRecId = mxBiffStrm->getRecId();
+
+    // record specific settings
+    switch( mxBiffStrm->getRecId() )
 {
-    InputRef xIn;
-    if( mxStrm.get() )
-        xIn.reset( new BiffStreamInput( *mxStrm ) );
-    return xIn;
+        case BIFF_ID_CHEND:
+            out().decIndent();
+        break;
+    }
+
+    // special CONTINUE handling
+    mxBiffStrm->resetRecord( mbMergeContRec );
+    if( mbMergeContRec ) switch( mxBiffStrm->getRecId() )
+    {
+        case BIFF_ID_OBJ:
+        case BIFF_ID_TXO:
+        case BIFF_ID_EOF:
+        case BIFF_ID_CONT:
+            mxBiffStrm->resetRecord( false );
+        break;
+        case BIFF_ID_MSODRAWINGGROUP:
+        case BIFF_ID_CHESCHERFORMAT:
+            mxBiffStrm->resetRecord( true, mxBiffStrm->getRecId() );
+        break;
+    }
+
+    ornRecSize = mxBiffStrm->getLength();
+    mxBiffStrm->enableNulChars( true );
+    return bValid;
 }
 
 OUString BiffObjectBase::getErrorName( sal_uInt8 nErrCode ) const
@@ -333,12 +364,12 @@ OUString BiffObjectBase::getErrorName( s
 
 sal_Int32 BiffObjectBase::readCol( bool bCol16Bit )
 {
-    return bCol16Bit ? mxStrm->readuInt16() : mxStrm->readuInt8();
+    return bCol16Bit ? mxBiffStrm->readuInt16() : mxBiffStrm->readuInt8();
 }
 
 sal_Int32 BiffObjectBase::readRow( bool bRow32Bit )
 {
-    return bRow32Bit ? mxStrm->readInt32() : mxStrm->readuInt16();
+    return bRow32Bit ? mxBiffStrm->readInt32() : mxBiffStrm->readuInt16();
 }
 
 void BiffObjectBase::readAddress( Address& orAddress, bool bCol16Bit, bool bRow32Bit )
@@ -358,22 +389,22 @@ void BiffObjectBase::readRange( Range& o
 void BiffObjectBase::readRangeList( RangeList& orRanges, bool bCol16Bit, bool bRow32Bit )
 {
     sal_uInt16 nCount;
-    *mxStrm >> nCount;
+    *mxBiffStrm >> nCount;
     orRanges.resize( nCount );
-    for( RangeList::iterator aIt = orRanges.begin(), aEnd = orRanges.end(); mxStrm->isValid() && (aIt != aEnd); ++aIt )
+    for( RangeList::iterator aIt = orRanges.begin(), aEnd = orRanges.end(); !mxBiffStrm->isEof() && (aIt != aEnd); ++aIt )
         readRange( *aIt, bCol16Bit, bRow32Bit );
 }
 
 // ----------------------------------------------------------------------------
 
-void BiffObjectBase::writeBooleanItem( const sal_Char* pcName, sal_uInt8 nBool )
+void BiffObjectBase::writeBooleanItem( const String& rName, sal_uInt8 nBool )
 {
-    writeDecItem( pcName, nBool, "BOOLEAN" );
+    writeDecItem( rName, nBool, "BOOLEAN" );
 }
 
-void BiffObjectBase::writeErrorCodeItem( const sal_Char* pcName, sal_uInt8 nErrCode )
+void BiffObjectBase::writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode )
 {
-    writeHexItem( pcName, nErrCode, mxErrCodes );
+    writeHexItem( rName, nErrCode, mxErrCodes );
 }
 
 void BiffObjectBase::writeFontPortions( const BinFontPortionList& rPortions )
@@ -393,15 +424,15 @@ void BiffObjectBase::writeFontPortions( 
 
 // ----------------------------------------------------------------------------
 
-OUString BiffObjectBase::dumpByteString( const sal_Char* pcName, BiffStringFlags nFlags, rtl_TextEncoding eDefaultTextEnc )
+OUString BiffObjectBase::dumpByteString( const String& rName, BiffStringFlags nFlags, rtl_TextEncoding eDefaultTextEnc )
 {
     OSL_ENSURE( !getFlag( nFlags, static_cast< BiffStringFlags >( ~(BIFF_STR_8BITLENGTH | BIFF_STR_EXTRAFONTS) ) ), "BiffObjectBase::dumpByteString - unknown flag" );
     bool b8BitLength = getFlag( nFlags, BIFF_STR_8BITLENGTH );
 
-    OString aString = mxStrm->readByteString( !b8BitLength );
+    OString aString = mxBiffStrm->readByteString( !b8BitLength );
     BinFontPortionList aPortions;
     if( getFlag( nFlags, BIFF_STR_EXTRAFONTS ) )
-        aPortions.importPortions( *mxStrm, false );
+        aPortions.importPortions( *mxBiffStrm, false );
 
     // create string portions
     OUStringBuffer aBuffer;
@@ -434,29 +465,29 @@ OUString BiffObjectBase::dumpByteString(
     }
 
     OUString aUniStr = aBuffer.makeStringAndClear();
-    writeStringItem( pcName ? pcName : "text", aUniStr );
+    writeStringItem( rName( "text" ), aUniStr );
     return aUniStr;
 }
 
-OUString BiffObjectBase::dumpUniString( const sal_Char* pcName, BiffStringFlags nFlags )
+OUString BiffObjectBase::dumpUniString( const String& rName, BiffStringFlags nFlags )
 {
     OSL_ENSURE( !getFlag( nFlags, static_cast< BiffStringFlags >( ~(BIFF_STR_8BITLENGTH | BIFF_STR_SMARTFLAGS) ) ), "BiffObjectBase::dumpUniString - unknown flag" );
     bool b8BitLength = getFlag( nFlags, BIFF_STR_8BITLENGTH );
 
     // --- string header ---
-    sal_uInt16 nChars = b8BitLength ? mxStrm->readuInt8() : mxStrm->readuInt16();
+    sal_uInt16 nChars = b8BitLength ? mxBiffStrm->readuInt8() : mxBiffStrm->readuInt16();
     sal_uInt8 nFlagField = 0;
     if( (nChars > 0) || !getFlag( nFlags, BIFF_STR_SMARTFLAGS ) )
-        *mxStrm >> nFlagField;
+        *mxBiffStrm >> nFlagField;
     bool b16Bit    = getFlag( nFlagField, BIFF_STRF_16BIT );
     bool bFonts    = getFlag( nFlagField, BIFF_STRF_RICH );
     bool bPhonetic = getFlag( nFlagField, BIFF_STRF_PHONETIC );
-    sal_uInt16 nFontCount = bFonts ? mxStrm->readuInt16() : 0;
-    sal_uInt32 nPhoneticSize = bPhonetic ? mxStrm->readuInt32() : 0;
+    sal_uInt16 nFontCount = bFonts ? mxBiffStrm->readuInt16() : 0;
+    sal_uInt32 nPhoneticSize = bPhonetic ? mxBiffStrm->readuInt32() : 0;
 
     // --- character array ---
-    OUString aString = mxStrm->readUniStringChars( nChars, b16Bit );
-    writeStringItem( pcName ? pcName : "text", aString );
+    OUString aString = mxBiffStrm->readUniStringChars( nChars, b16Bit );
+    writeStringItem( rName( "text" ), aString );
 
     // --- formatting ---
     // #122185# bRich flag may be set, but format runs may be missing
@@ -464,7 +495,7 @@ OUString BiffObjectBase::dumpUniString( 
     {
         IndentGuard aIndGuard( out() );
         BinFontPortionList aPortions;
-        aPortions.importPortions( *mxStrm, nFontCount, true );
+        aPortions.importPortions( *mxBiffStrm, nFontCount, BIFF_FONTPORTION_16BIT );
         writeFontPortions( aPortions );
     }
 
@@ -479,101 +510,39 @@ OUString BiffObjectBase::dumpUniString( 
     return aString;
 }
 
-OUString BiffObjectBase::dumpString( const sal_Char* pcName, BiffStringFlags nByteFlags, BiffStringFlags nUniFlags, rtl_TextEncoding eDefaultTextEnc )
-{
-    return (getBiff() == BIFF8) ? dumpUniString( pcName, nUniFlags ) : dumpByteString( pcName, nByteFlags, eDefaultTextEnc );
-}
-
-OUString BiffObjectBase::dumpOleString( const sal_Char* pcName, sal_Int32 nCharCount, bool bUnicode )
+OUString BiffObjectBase::dumpString( const String& rName, BiffStringFlags nByteFlags, BiffStringFlags nUniFlags, rtl_TextEncoding eDefaultTextEnc )
 {
-    OUString aString;
-    if( nCharCount > 0 )
-    {
-        sal_uInt16 nReadChars = getLimitedValue< sal_uInt16, sal_Int32 >( nCharCount, 0, SAL_MAX_UINT16 );
-        aString = bUnicode ?
-            mxStrm->readUnicodeArray( nReadChars ) :
-            mxStrm->readCharArray( nReadChars, getBiffData().getTextEncoding() );
-        // skip remaining chars
-        sal_uInt32 nSkip = static_cast< sal_uInt32 >( nCharCount - nReadChars );
-        mxStrm->skip( bUnicode ? (nSkip * 2) : nSkip );
-    }
-    writeStringItem( pcName ? pcName : "text", aString );
-    return aString;
+    return (getBiff() == BIFF8) ? dumpUniString( rName, nUniFlags ) : dumpByteString( rName, nByteFlags, eDefaultTextEnc );
 }
 
-OUString BiffObjectBase::dumpOleString( const sal_Char* pcName, bool bUnicode )
-{
-    return dumpOleString( pcName, mxStrm->readInt32(), bUnicode );
-}
-
-OUString BiffObjectBase::dumpNullString( const sal_Char* pcName, bool bUnicode )
-{
-    OUString aString;
-    if( bUnicode )
-    {
-        OUStringBuffer aBuffer;
-        sal_uInt16 nChar;
-        for( bool bLoop = true; bLoop && mxStrm->isValid(); )
-        {
-            *mxStrm >> nChar;
-            if( (bLoop = (nChar != 0)) == true )
-                aBuffer.append( static_cast< sal_Unicode >( nChar ) );
-        }
-        aString = aBuffer.makeStringAndClear();
-    }
-    else
-    {
-        OStringBuffer aBuffer;
-        sal_uInt8 nChar;
-        for( bool bLoop = true; bLoop && mxStrm->isValid(); )
-        {
-            *mxStrm >> nChar;
-            if( (bLoop = (nChar != 0)) == true )
-                aBuffer.append( static_cast< sal_Char >( nChar ) );
-        }
-        aString = OStringToOUString( aBuffer.makeStringAndClear(), getBiffData().getTextEncoding() );
-    }
-    writeStringItem( pcName ? pcName : "text", aString );
-    return aString;
-}
-
-sal_uInt8 BiffObjectBase::dumpBoolean( const sal_Char* pcName )
+sal_uInt8 BiffObjectBase::dumpBoolean( const String& rName )
 {
     sal_uInt8 nBool;
-    *mxStrm >> nBool;
-    writeBooleanItem( pcName ? pcName : "boolean", nBool );
+    *mxBiffStrm >> nBool;
+    writeBooleanItem( rName( "boolean" ), nBool );
     return nBool;
 }
 
-sal_uInt8 BiffObjectBase::dumpErrorCode( const sal_Char* pcName )
+sal_uInt8 BiffObjectBase::dumpErrorCode( const String& rName )
 {
     sal_uInt8 nErrCode;
-    *mxStrm >> nErrCode;
-    writeErrorCodeItem( pcName ? pcName : "errorcode", nErrCode );
+    *mxBiffStrm >> nErrCode;
+    writeErrorCodeItem( rName( "error-code" ), nErrCode );
     return nErrCode;
 }
 
-sal_Int32 BiffObjectBase::dumpRgbColor( const sal_Char* pcName )
+rtl_TextEncoding BiffObjectBase::dumpCodePage( const String& rName )
 {
-    sal_uInt8 nR, nG, nB, nA;
-    *mxStrm >> nR >> nG >> nB >> nA;
-    sal_Int32 nValue = (nA << 24) | (nR << 16) | (nG << 8) | nB;
-    writeColorItem( pcName ? pcName : "color-rgb", nValue );
-    return nValue;
-}
-
-rtl_TextEncoding BiffObjectBase::dumpCodePage( const sal_Char* pcName )
-{
-    sal_uInt16 nCodePage = dumpDec< sal_uInt16 >( pcName ? pcName : "codepage", "CODEPAGES" );
+    sal_uInt16 nCodePage = dumpDec< sal_uInt16 >( rName( "codepage" ), "CODEPAGES" );
     return BiffHelper::calcTextEncodingFromCodePage( nCodePage );
 }
 
-void BiffObjectBase::dumpFormulaResult( const sal_Char* pcName )
+void BiffObjectBase::dumpFormulaResult( const String& rName )
 {
     MultiItemsGuard aMultiGuard( out() );
     sal_uInt8 pnResult[ 8 ];
-    mxStrm->read( pnResult, 8 );
-    writeArrayItem( pcName ? pcName : "result", pnResult, 8 );
+    mxBiffStrm->readMemory( pnResult, 8 );
+    writeArrayItem( rName( "result" ), pnResult, 8 );
     if( (pnResult[ 6 ] == 0xFF) && (pnResult[ 7 ] == 0xFF) )
     {
         sal_uInt8 nType = pnResult[ 0 ];
@@ -593,57 +562,57 @@ void BiffObjectBase::dumpFormulaResult( 
     }
 }
 
-sal_Int32 BiffObjectBase::dumpColIndex( const sal_Char* pcName, bool bCol16Bit )
+sal_Int32 BiffObjectBase::dumpColIndex( const String& rName, bool bCol16Bit )
 {
     sal_Int32 nCol = readCol( bCol16Bit );
-    writeColIndexItem( pcName ? pcName : "col-idx", nCol );
+    writeColIndexItem( rName( "col-idx" ), nCol );
     return nCol;
 }
 
-sal_Int32 BiffObjectBase::dumpRowIndex( const sal_Char* pcName, bool bRow32Bit )
+sal_Int32 BiffObjectBase::dumpRowIndex( const String& rName, bool bRow32Bit )
 {
     sal_Int32 nRow = readRow( bRow32Bit );
-    writeRowIndexItem( pcName ? pcName : "row-idx", nRow );
+    writeRowIndexItem( rName( "row-idx" ), nRow );
     return nRow;
 }
 
-sal_Int32 BiffObjectBase::dumpColRange( const sal_Char* pcName, bool bCol16Bit )
+sal_Int32 BiffObjectBase::dumpColRange( const String& rName, bool bCol16Bit )
 {
     sal_Int32 nCol1 = readCol( bCol16Bit );
     sal_Int32 nCol2 = readCol( bCol16Bit );
-    writeColRangeItem( pcName ? pcName : "col-range", nCol1, nCol2 );
+    writeColRangeItem( rName( "col-range" ), nCol1, nCol2 );
     return nCol2 - nCol1 + 1;
 }
 
-sal_Int32 BiffObjectBase::dumpRowRange( const sal_Char* pcName, bool bRow32Bit )
+sal_Int32 BiffObjectBase::dumpRowRange( const String& rName, bool bRow32Bit )
 {
     sal_Int32 nRow1 = readRow( bRow32Bit );
     sal_Int32 nRow2 = readRow( bRow32Bit );
-    writeRowRangeItem( pcName ? pcName : "row-range", nRow1, nRow2 );
+    writeRowRangeItem( rName( "row-range" ), nRow1, nRow2 );
     return nRow2 - nRow1 + 1;
 }
 
-Address BiffObjectBase::dumpAddress( const sal_Char* pcName, bool bCol16Bit, bool bRow32Bit )
+Address BiffObjectBase::dumpAddress( const String& rName, bool bCol16Bit, bool bRow32Bit )
 {
     Address aPos;
     readAddress( aPos, bCol16Bit, bRow32Bit );
-    writeAddressItem( pcName ? pcName : "addr", aPos );
+    writeAddressItem( rName( "addr" ), aPos );
     return aPos;
 }
 
-Range BiffObjectBase::dumpRange( const sal_Char* pcName, bool bCol16Bit, bool bRow32Bit )
+Range BiffObjectBase::dumpRange( const String& rName, bool bCol16Bit, bool bRow32Bit )
 {
     Range aRange;
     readRange( aRange, bCol16Bit, bRow32Bit );
-    writeRangeItem( pcName ? pcName : "range", aRange );
+    writeRangeItem( rName( "range" ), aRange );
     return aRange;
 }
 
-void BiffObjectBase::dumpRangeList( const sal_Char* pcName, bool bCol16Bit, bool bRow32Bit )
+void BiffObjectBase::dumpRangeList( const String& rName, bool bCol16Bit, bool bRow32Bit )
 {
     RangeList aRanges;
     readRangeList( aRanges, bCol16Bit, bRow32Bit );
-    writeRangeListItem( pcName ? pcName : "range-list", aRanges );
+    writeRangeListItem( rName( "range-list" ), aRanges );
 }
 
 void BiffObjectBase::dumpConstArrayHeader( sal_uInt32& rnCols, sal_uInt32& rnRows )
@@ -702,11 +671,40 @@ OUString BiffObjectBase::dumpConstValue(
     return aValue.makeStringAndClear();
 }
 
+sal_uInt16 BiffObjectBase::dumpRepeatedRecId()
+{
+    return dumpHex< sal_uInt16 >( "repeated-rec-id", getRecNames() );
+}
+
+void BiffObjectBase::dumpDffClientRect()
+{
+    lclDumpDffClientRect( out(), in() );
+}
+
+void BiffObjectBase::dumpEmbeddedDff()
+{
+    out().decIndent();
+    writeEmptyItem( "EMBEDDED-DFF-START" );
+    out().incIndent();
+    mxDffObj->dump();
+    out().emptyLine();
+    out().decIndent();
+    writeEmptyItem( "EMBEDDED-DFF-END" );
+    out().incIndent();
+}
+
+void BiffObjectBase::dumpOcxControl()
+{
+    sal_uInt32 nStartPos = dumpHex< sal_uInt32 >( "ctls-stream-pos", "CONV-DEC" );
+    sal_uInt32 nLength = dumpHex< sal_uInt32 >( "ctls-stream-length", "CONV-DEC" );
+    if( isValid( mxCtlsObj ) )
+        mxCtlsObj->dumpControl( nStartPos, nLength );
+}
+
 // ============================================================================
 // ============================================================================
 
 FormulaObject::FormulaObject( const BiffObjectBase& rParent ) :
-    mpcName( 0 ),
     mnSize( 0 )
 {
     BiffObjectBase::construct( rParent );
@@ -722,46 +720,45 @@ sal_uInt16 FormulaObject::readFormulaSiz
     return (getBiff() == BIFF2) ? getBiffStream().readuInt8() : getBiffStream().readuInt16();
 }
 
-sal_uInt16 FormulaObject::dumpFormulaSize( const sal_Char* pcName )
+sal_uInt16 FormulaObject::dumpFormulaSize( const String& rName )
 {
-    if( !pcName ) pcName = "formula-size";
     sal_uInt16 nSize = readFormulaSize();
-    writeDecItem( pcName, nSize );
+    writeDecItem( rName( "formula-size" ), nSize );
     return nSize;
 }
 
-void FormulaObject::dumpCellFormula( const sal_Char* pcName, sal_uInt16 nSize )
+void FormulaObject::dumpCellFormula( const String& rName, sal_uInt16 nSize )
 {
-    dumpFormula( pcName, nSize, false );
+    dumpFormula( rName, nSize, false );
 }
 
-void FormulaObject::dumpCellFormula( const sal_Char* pcName )
+void FormulaObject::dumpCellFormula( const String& rName )
 {
-    dumpFormula( pcName, false );
+    dumpFormula( rName, false );
 }
 
-void FormulaObject::dumpNameFormula( const sal_Char* pcName, sal_uInt16 nSize )
+void FormulaObject::dumpNameFormula( const String& rName, sal_uInt16 nSize )
 {
-    dumpFormula( pcName, nSize, true );
+    dumpFormula( rName, nSize, true );
 }
 
-void FormulaObject::dumpNameFormula( const sal_Char* pcName )
+void FormulaObject::dumpNameFormula( const String& rName )
 {
-    dumpFormula( pcName, true );
+    dumpFormula( rName, true );
 }
 
 void FormulaObject::implDump()
 {
     {
         MultiItemsGuard aMultiGuard( out() );
-        writeEmptyItem( mpcName );
+        writeEmptyItem( maName );
         writeDecItem( "formula-size", mnSize );
     }
     if( mnSize == 0 ) return;
 
-    Input& rIn = in();
-    sal_Int64 nStartPos = rIn.tell();
-    sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, rIn.getSize() );
+    BinaryInputStream& rStrm = in();
+    sal_Int64 nStartPos = rStrm.tell();
+    sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, rStrm.getLength() );
 
     bool bValid = mxTokens.get();
     mxStack.reset( new FormulaStack );
@@ -769,11 +766,11 @@ void FormulaObject::implDump()
     IndentGuard aIndGuard( out() );
     {
         TableGuard aTabGuard( out(), 8, 18 );
-        while( bValid && (rIn.tell() < nEndPos) )
+        while( bValid && !rStrm.isEof() && (rStrm.tell() < nEndPos) )
         {
             MultiItemsGuard aMultiGuard( out() );
-            writeHexItem( 0, static_cast< sal_uInt16 >( rIn.tell() - nStartPos ) );
-            sal_uInt8 nTokenId = dumpHex< sal_uInt8 >( 0, mxTokens );
+            writeHexItem( EMPTY_STRING, static_cast< sal_uInt16 >( rStrm.tell() - nStartPos ) );
+            sal_uInt8 nTokenId = dumpHex< sal_uInt8 >( EMPTY_STRING, mxTokens );
             bValid = mxTokens->hasName( nTokenId );
             if( bValid )
             {
@@ -850,7 +847,7 @@ void FormulaObject::implDump()
             }
         }
     }
-    bValid = nEndPos == rIn.tell();
+    bValid = nEndPos == rStrm.tell();
     if( bValid )
     {
         dumpAddTokenData();
@@ -858,23 +855,23 @@ void FormulaObject::implDump()
         writeInfoItem( "classes", mxStack->getClassesString() );
     }
     else
-        dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), static_cast< sal_Int32 >( nEndPos - rIn.tell() ), false );
+        dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), nEndPos - rStrm.tell(), false );
 
-    mpcName = 0;
     mnSize = 0;
 }
 
-void FormulaObject::dumpFormula( const sal_Char* pcName, sal_uInt16 nSize, bool bNameMode )
+void FormulaObject::dumpFormula( const String& rName, sal_uInt16 nSize, bool bNameMode )
 {
-    mpcName = pcName ? pcName : "formula";
+    maName = rName( "formula" );
     mnSize = nSize;
     mbNameMode = bNameMode;
     dump();
+    mnSize = 0;
 }
 
-void FormulaObject::dumpFormula( const sal_Char* pcName, bool bNameMode )
+void FormulaObject::dumpFormula( const String& rName, bool bNameMode )
 {
-    dumpFormula( pcName, readFormulaSize(), bNameMode );
+    dumpFormula( rName, readFormulaSize(), bNameMode );
 }
 
 // private --------------------------------------------------------------------
@@ -883,8 +880,7 @@ void FormulaObject::constructFmlaObj()
 {
     if( BiffObjectBase::implIsValid() )
     {
-        Reference< XSpreadsheetDocument > xDocument( getFilter().getModel(), UNO_QUERY );
-        mxFuncProv.reset( new FunctionProvider( xDocument, getBiff(), true ) );
+        mxFuncProv.reset( new FunctionProvider( FILTER_BIFF, getBiff(), true ) );
 
         Config& rCfg = cfg();
         mxClasses   = rCfg.getNameList( "TOKENCLASSES" );
@@ -976,13 +972,13 @@ OUString FormulaObject::createPlaceHolde
 
 sal_uInt16 FormulaObject::readFuncId()
 {
-    return (getBiff() >= BIFF4) ? in().readValue< sal_uInt16 >() : in().readValue< sal_uInt8 >();
+    return (getBiff() >= BIFF4) ? in().readuInt16() : in().readuInt8();
 }
 
 OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo** oppFuncInfo )
 {
     ItemGuard aItemGuard( out(), "func-id" );
-    writeHexItem( 0, nFuncId, "FUNCID" );
+    writeHexItem( EMPTY_STRING, nFuncId, "FUNCID" );
     OUStringBuffer aBuffer;
     const FunctionInfo* pFuncInfo = mxFuncProv->getFuncInfoFromBiffFuncId( nFuncId );
     if( pFuncInfo )
@@ -995,34 +991,36 @@ OUString FormulaObject::writeFuncIdItem(
     }
     OUString aFuncName = aBuffer.makeStringAndClear();
     aItemGuard.cont();
+    out().writeChar( OOX_DUMP_STRQUOTE );
     out().writeString( aFuncName );
+    out().writeChar( OOX_DUMP_STRQUOTE );
     if( oppFuncInfo ) *oppFuncInfo = pFuncInfo;
     return aFuncName;
 }
 
-sal_uInt16 FormulaObject::dumpTokenCol( const sal_Char* pcName, bool& rbRelC, bool& rbRelR )
+sal_uInt16 FormulaObject::dumpTokenCol( const String& rName, bool& rbRelC, bool& rbRelR )
 {
     sal_uInt16 nCol = 0;
     if( getBiff() == BIFF8 )
     {
-        nCol = dumpHex< sal_uInt16 >( pcName, mxRelFlags );
+        nCol = dumpHex< sal_uInt16 >( rName, mxRelFlags );
         rbRelC = getFlag( nCol, BIFF_TOK_REF_COLREL );
         rbRelR = getFlag( nCol, BIFF_TOK_REF_ROWREL );
         nCol &= BIFF_TOK_REF_COLMASK;
     }
     else
-        nCol = dumpDec< sal_uInt8 >( pcName );
+        nCol = dumpDec< sal_uInt8 >( rName );
     return nCol;
 }
 
-sal_uInt16 FormulaObject::dumpTokenRow( const sal_Char* pcName, bool& rbRelC, bool& rbRelR )
+sal_uInt16 FormulaObject::dumpTokenRow( const String& rName, bool& rbRelC, bool& rbRelR )
 {
     sal_uInt16 nRow = 0;
     if( getBiff() == BIFF8 )
-        nRow = dumpDec< sal_uInt16 >( pcName );
+        nRow = dumpDec< sal_uInt16 >( rName );
     else
     {
-        nRow = dumpHex< sal_uInt16 >( pcName, mxRelFlags );
+        nRow = dumpHex< sal_uInt16 >( rName, mxRelFlags );
         rbRelC = getFlag( nRow, BIFF_TOK_REF_COLREL );
         rbRelR = getFlag( nRow, BIFF_TOK_REF_ROWREL );
         nRow &= BIFF_TOK_REF_ROWMASK;
@@ -1221,23 +1219,23 @@ void FormulaObject::dumpMemAreaToken( co
         maAddData.push_back( ADDDATA_MEMAREA );
 }
 
-void FormulaObject::dumpExpToken( const StringWrapper& rName )
+void FormulaObject::dumpExpToken( const String& rName )
 {
     Address aPos;
     aPos.mnRow = dumpDec< sal_uInt16 >( "row" );
     aPos.mnCol = dumpDec< sal_uInt16, sal_uInt8 >( getBiff() != BIFF2, "col" );
     writeAddressItem( "base-addr", aPos );
-    OUStringBuffer aOp( rName.getString() );
+    OUStringBuffer aOp( rName );
     StringHelper::appendIndex( aOp, out().getLastItemValue() );
     mxStack->pushOperand( aOp.makeStringAndClear() );
 }
 
-void FormulaObject::dumpUnaryOpToken( const StringWrapper& rLOp, const StringWrapper& rROp )
+void FormulaObject::dumpUnaryOpToken( const String& rLOp, const String& rROp )
 {
     mxStack->pushUnaryOp( rLOp, rROp );
 }
 
-void FormulaObject::dumpBinaryOpToken( const StringWrapper& rOp )
+void FormulaObject::dumpBinaryOpToken( const String& rOp )
 {
     mxStack->pushBinaryOp( rOp );
 }
@@ -1494,151 +1492,49 @@ void FormulaObject::dumpAddDataArray( si
 
 void FormulaObject::dumpAddDataMemArea( size_t /*nIdx*/ )
 {
-    dumpRangeList( 0, getBiff() == BIFF8 );
+    dumpRangeList( EMPTY_STRING, getBiff() == BIFF8 );
 }
 
 // ============================================================================
 // ============================================================================
 
-RecordHeaderObject::RecordHeaderObject( const InputObjectBase& rParent, BiffInputStream& rStrm ) :
-    mrStrm( rStrm )
-{
-    static const RecordHeaderConfigInfo saHeaderCfgInfo =
-    {
-        "REC",
-        "RECORD-NAMES",
-        "show-record-pos",
-        "show-record-size",
-        "show-record-id",
-        "show-record-name",
-        "show-record-body",
-    };
-    RecordHeaderBase< sal_uInt16, sal_uInt32 >::construct( rParent, saHeaderCfgInfo );
-    if( RecordHeaderBase< sal_uInt16, sal_uInt32 >::implIsValid() )
-        mbMergeContRec = cfg().getBoolOption( "merge-continue-record", true );
-}
-
-bool RecordHeaderObject::implReadHeader( sal_Int64& ornRecPos, sal_uInt16& ornRecId, sal_uInt32& ornRecSize )
-{
-    // previous record
-    switch( mrStrm.getRecId() )
-    {
-        case BIFF_ID_CHBEGIN:
-            out().incIndent();
-        break;
-    }
-
-    // start next record
-    bool bValidRec = mrStrm.startNextRecord();
-    ornRecPos = mrStrm.getCoreStreamPos() - 4;
-    ornRecId = mrStrm.getRecId();
-
-    // record specific settings
-    switch( ornRecId )
-    {
-        case BIFF_ID_CHEND:
-            out().decIndent();
-        break;
-    }
-
-    // special CONTINUE handling
-    mrStrm.resetRecord( mbMergeContRec );
-    if( mbMergeContRec ) switch( ornRecId )
-    {
-        case BIFF_ID_OBJ:
-        case BIFF_ID_TXO:
-        case BIFF_ID_EOF:
-        case BIFF_ID_CONT:
-            mrStrm.resetRecord( false );
-        break;
-        case BIFF_ID_MSODRAWINGGROUP:
-        case BIFF_ID_CHESCHERFORMAT:
-            mrStrm.resetRecord( true, ornRecId );
-        break;
-    }
-
-    ornRecSize = mrStrm.getRecSize();
-    return bValidRec;
-}
-
-// ============================================================================
-
 RecordStreamObject::~RecordStreamObject()
 {
 }
 
-void RecordStreamObject::construct( const ObjectBase& rParent, const OUString& rOutFileName, BinaryInputStreamRef xStrm, BiffType eBiff )
+void RecordStreamObject::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, BiffType eBiff, const OUString& rSysFileName )
 {
-    BiffObjectBase::construct( rParent, rOutFileName, xStrm, eBiff );
+    BiffObjectBase::construct( rParent, rxStrm, eBiff, rSysFileName );
     if( BiffObjectBase::implIsValid() )
-    {
-        mxHdrObj.reset( new RecordHeaderObject( *this, getBiffStream() ) );
         mxFmlaObj.reset( new FormulaObject( *this ) );
-        mxDffObj.reset( new DffDumpObject( *this ) );
-        mxSimpleRecs = cfg().getNameList( "SIMPLE-RECORDS" );
-    }
 }
 
 bool RecordStreamObject::implIsValid() const
 {
-    return isValid( mxHdrObj ) && isValid( mxFmlaObj ) && isValid( mxDffObj ) && BiffObjectBase::implIsValid();
+    return isValid( mxFmlaObj ) && BiffObjectBase::implIsValid();
 }
 
-void RecordStreamObject::implDump()
-{
-    while( mxHdrObj->startNextRecord() )
-    {
-        if( mxHdrObj->isShowRecBody() )
-        {
-            IndentGuard aIndGuard( out() );
-            if( mxHdrObj->hasRecName() )
-                dumpRecordBody();
-            else
-                dumpRawBinary( mxHdrObj->getRecSize(), false );
-            if( !getBiffStream().isValid() )
-                writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
-        }
-        out().emptyLine();
-    }
-}
+// ============================================================================
 
-void RecordStreamObject::implDumpRecord()
+WorkbookStreamObject::WorkbookStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
 {
-}
-
-sal_uInt16 RecordStreamObject::dumpRepeatedRecId()
+    if( rxStrm.get() )
 {
-    return dumpHex< sal_uInt16 >( "repeated-rec-id", mxHdrObj->getRecNames() );
-}
-
-void RecordStreamObject::dumpRecordBody()
+        BiffType eBiff = BiffDetector::detectStreamBiffVersion( *rxStrm );
+        RecordStreamObject::construct( rParent, rxStrm, eBiff, rSysFileName );
+        if( RecordStreamObject::implIsValid() )
 {
-    BiffInputStream& rStrm = getBiffStream();
-    sal_uInt16 nRecId = rStrm.getRecId();
-    rStrm.enableNulChars( true );
-    if( cfg().hasName( mxSimpleRecs, nRecId ) )
-        dumpSimpleRecord( cfg().getName( mxSimpleRecs, nRecId ) );
-    else
-        implDumpRecord();
-    // remaining undumped data
-    if( rStrm.getRecPos() == 0 )
-        dumpRawBinary( rStrm.getRecSize(), false );
-    else
-        dumpRemaining( rStrm.getRecLeft() );
+            Config& rCfg = cfg();
+            mxColors = rCfg.getNameList( "COLORS" );
+            mxBorderStyles = rCfg.getNameList( "BORDERSTYLES" );
+            mxFillPatterns = rCfg.getNameList( "FILLPATTERNS" );
+            mnPTRowFields = 0;
+            mnPTColFields = 0;
+            mnPTSxliIdx = 0;
+            mbHasDff = false;
+            initializePerSheet();
 }
-
-void RecordStreamObject::dumpSimpleRecord( const OUString& rRecData )
-{
-    ItemFormat aItemFmt;
-    aItemFmt.parse( rRecData );
-    dumpItem( aItemFmt );
 }
-
-// ============================================================================
-
-WorkbookStreamObject::WorkbookStreamObject( const ObjectBase& rParent, const OUString& rOutFileName, BinaryInputStreamRef xStrm )
-{
-    construct( rParent, rOutFileName, xStrm );
 }
 
 WorkbookStreamObject::~WorkbookStreamObject()
@@ -1651,36 +1547,11 @@ WorkbookStreamObject::~WorkbookStreamObj
     }
 }
 
-void WorkbookStreamObject::construct( const ObjectBase& rParent, const OUString& rOutFileName, BinaryInputStreamRef xStrm )
-{
-    if( xStrm.get() )
-    {
-        BiffType eBiff = BiffDetector::detectStreamBiffVersion( *xStrm );
-        RecordStreamObject::construct( rParent, rOutFileName, xStrm, eBiff );
-        if( RecordStreamObject::implIsValid() )
-        {
-            Config& rCfg = cfg();
-            mxColors        = rCfg.getNameList( "COLORS" );
-            mxBorderStyles  = rCfg.getNameList( "BORDERSTYLES" );
-            mxFillPatterns  = rCfg.getNameList( "FILLPATTERNS" );
-            mxFontNames     = rCfg.createNameList< ConstList >( "FONTNAMES" );
-            mxFontNames->setName( 0, createFontName( CREATE_OUSTRING( "Arial" ), 200, false, false ) );
-            mxFormats       = rCfg.createNameList< ConstList >( "FORMATS" );
-            mxFormats->includeList( rCfg.getNameList( "BUILTIN-FORMATS" ) );
-            mnFormatIdx = 0;
-            mnPTRowFields = 0;
-            mnPTColFields = 0;
-            mnPTSxliIdx = 0;
-            mbHasCodePage = false;
-        }
-    }
-}
-
-void WorkbookStreamObject::implDumpRecord()
+void WorkbookStreamObject::implDumpRecordBody()
 {
     BiffInputStream& rStrm = getBiffStream();
     sal_uInt16 nRecId = rStrm.getRecId();
-    sal_Size nRecSize = rStrm.getRecSize();
+    sal_Int64 nRecSize = rStrm.getLength();
     BiffType eBiff = getBiff();
 
     switch( nRecId )
@@ -1708,6 +1579,8 @@ void WorkbookStreamObject::implDumpRecor
             if( nRecSize >= 8 )  dumpDec< sal_uInt16 >( "build-year" );
             if( nRecSize >= 12 ) dumpHex< sal_uInt32 >( "history-flags", "BOF-HISTORY-FLAGS" );
             if( nRecSize >= 16 ) dumpDec< sal_uInt32 >( "lowest-ver" );
+            if( (eBiff == BIFF4) && (getLastRecId() != BIFF_ID_OBJ) )
+                initializePerSheet();
         break;
 
         case BIFF2_ID_BOOLERR:
@@ -1735,9 +1608,9 @@ void WorkbookStreamObject::implDumpRecor
             {
                 writeEmptyItem( "font-block" );
                 IndentGuard aIndGuard( out() );
-                sal_uInt32 nRecPos = rStrm.getRecPos();
+                sal_Int64 nRecPos = rStrm.tell();
                 dumpUniString( "name", BIFF_STR_8BITLENGTH );
-                dumpUnused( nRecPos + 64 - rStrm.getRecPos() );
+                dumpUnused( static_cast< sal_Int32 >( nRecPos + 64 - rStrm.tell() ) );
                 dumpDec< sal_Int32 >( "height", "CONV-TWIP-TO-PT" );
                 dumpHex< sal_uInt32 >( "flags", "CFRULE-FONTFLAGS" );
                 dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
@@ -1794,8 +1667,8 @@ void WorkbookStreamObject::implDumpRecor
         break;
 
         case BIFF_ID_CHAREAFORMAT:
-            dumpRgbColor( "fg-color-rgb" );
-            dumpRgbColor( "bg-color-rgb" );
+            dumpColorABGR( "fg-color" );
+            dumpColorABGR( "bg-color" );
             dumpPatternIdx();
             dumpHex< sal_uInt16 >( "flags", "CHAREAFORMAT-FLAGS" );
             if( eBiff == BIFF8 ) dumpColorIdx( "fg-color-idx" );
@@ -1849,7 +1722,7 @@ void WorkbookStreamObject::implDumpRecor
         break;
 
         case BIFF_ID_CHESCHERFORMAT:
-            getDffDumper().dump();
+            dumpEmbeddedDff();
         break;
 
         case BIFF_ID_CHFRAME:
@@ -1890,7 +1763,7 @@ void WorkbookStreamObject::implDumpRecor
         break;
 
         case BIFF_ID_CHLINEFORMAT:
-            dumpRgbColor();
+            dumpColorABGR();
             dumpDec< sal_uInt16 >( "line-type", "CHLINEFORMAT-LINETYPE" );
             dumpDec< sal_Int16 >( "line-weight", "CHLINEFORMAT-LINEWEIGHT" );
             dumpHex< sal_uInt16 >( "flags", "CHLINEFORMAT-FLAGS" );
@@ -1898,8 +1771,8 @@ void WorkbookStreamObject::implDumpRecor
         break;
 
         case BIFF_ID_CHMARKERFORMAT:
-            dumpRgbColor( "border-color-rgb" );
-            dumpRgbColor( "fill-color-rgb" );
+            dumpColorABGR( "border-color" );
+            dumpColorABGR( "fill-color" );
             dumpDec< sal_uInt16 >( "marker-type", "CHMARKERFORMAT-TYPE" );
             dumpHex< sal_uInt16 >( "flags", "CHMARKERFORMAT-FLAGS" );
             if( eBiff == BIFF8 ) dumpColorIdx( "border-color-idx" );
@@ -1991,7 +1864,7 @@ void WorkbookStreamObject::implDumpRecor
             dumpDec< sal_uInt8 >( "horizontal-align", "CHTEXT-HORALIGN" );
             dumpDec< sal_uInt8 >( "vertical-align", "CHTEXT-VERALIGN" );
             dumpDec< sal_uInt16 >( "fill-mode", "CHTEXT-FILLMODE" );
-            dumpRgbColor();
+            dumpColorABGR();
             dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" );
             dumpHex< sal_uInt16 >( "flags", "CHTEXT-FLAGS" );
             if( eBiff == BIFF8 ) dumpColorIdx();
@@ -2004,7 +1877,7 @@ void WorkbookStreamObject::implDumpRecor
             dumpDec< sal_uInt8 >( "minor-ticks", "CHTICK-TYPE" );
             dumpDec< sal_uInt8 >( "label-position", "CHTICK-LABELPOS" );
             dumpDec< sal_uInt8 >( "fill-mode", "CHTEXT-FILLMODE" );
-            dumpRgbColor( "label-color-rgb" );
+            dumpColorABGR( "label-color" );
             dumpUnused( 16 );
             dumpHex< sal_uInt16 >( "flags", "CHTICK-FLAGS" );
             if( eBiff == BIFF8 ) dumpColorIdx( "label-color-idx" );
@@ -2058,17 +1931,36 @@ void WorkbookStreamObject::implDumpRecor
         break;
 
         case BIFF_ID_COLWIDTH:
-            dumpColRange( 0, false );
+            dumpColRange( EMPTY_STRING, false );
             dumpDec< sal_uInt16 >( "col-width", "CONV-COLWIDTH" );
         break;
 
+        case BIFF_ID_CONT:
+            if( (eBiff == BIFF8) && (getLastRecId() == BIFF_ID_OBJ) )
+                dumpEmbeddedDff();
+        break;
+
+        case BIFF_ID_COORDLIST:
+        {
+            out().resetItemIndex();
+            TableGuard aTabGuard( out(), 12, 10 );
+            while( rStrm.getRemaining() >= 4 )
+            {
+                MultiItemsGuard aMultiGuard( out() );
+                writeEmptyItem( "#point" );
+                dumpDec< sal_uInt16 >( "x" );
+                dumpDec< sal_uInt16 >( "y" );
+            }
+        }
+        break;
+
         case BIFF_ID_CRN:
         {
             sal_Int32 nCol2 = dumpColIndex( "last-col-idx", false );
             sal_Int32 nCol1 = dumpColIndex( "first-col-idx", false );
             sal_Int32 nRow = dumpRowIndex( "row-idx" );
             TableGuard aTabGuard( out(), 14, 17 );
-            for( Address aPos( nCol1, nRow ); rStrm.isValid() && (aPos.mnCol <= nCol2); ++aPos.mnCol )
+            for( Address aPos( nCol1, nRow ); !rStrm.isEof() && (aPos.mnCol <= nCol2); ++aPos.mnCol )
             {
                 MultiItemsGuard aMultiGuard( out() );
                 writeAddressItem( "pos", aPos );
@@ -2139,12 +2031,12 @@ void WorkbookStreamObject::implDumpRecor
         case BIFF2_ID_DEFINEDNAME:
         case BIFF3_ID_DEFINEDNAME:
         {
+            rtl_TextEncoding eTextEnc = getBiffData().getTextEncoding();
             dumpHex< sal_uInt16, sal_uInt8 >( eBiff != BIFF2, "flags", "DEFINEDNAME-FLAGS" );
             if( eBiff == BIFF2 ) dumpDec< sal_uInt8 >( "macro-type", "DEFINEDNAME-MACROTYPE-BIFF2" );
-            dumpHex< sal_uInt8 >( "keyboard-shortcut" );
+            dumpChar( "accelerator", eTextEnc );
             sal_uInt8 nNameLen = dumpDec< sal_uInt8 >( "name-len" );
             sal_uInt16 nFmlaSize = getFormulaDumper().dumpFormulaSize();
-            rtl_TextEncoding eTextEnc = getBiffData().getTextEncoding();
             if( eBiff >= BIFF5 )
             {
                 bool bBiff8 = eBiff == BIFF8;
@@ -2155,7 +2047,7 @@ void WorkbookStreamObject::implDumpRecor
                 sal_uInt8 nHelpLen = dumpDec< sal_uInt8 >( "help-text-len" );
                 sal_uInt8 nStatusLen = dumpDec< sal_uInt8 >( "statusbar-text-len" );
                 writeStringItem( "name", bBiff8 ? rStrm.readUniString( nNameLen ) : rStrm.readCharArray( nNameLen, eTextEnc ) );
-                getFormulaDumper().dumpNameFormula( 0, nFmlaSize );
+                getFormulaDumper().dumpNameFormula( EMPTY_STRING, nFmlaSize );
                 if( nMenuLen > 0 ) writeStringItem( "menu-text", bBiff8 ? rStrm.readUniString( nMenuLen ) : rStrm.readCharArray( nMenuLen, eTextEnc ) );
                 if( nDescrLen > 0 ) writeStringItem( "description-text", bBiff8 ? rStrm.readUniString( nDescrLen ) : rStrm.readCharArray( nDescrLen, eTextEnc ) );
                 if( nHelpLen > 0 ) writeStringItem( "help-text", bBiff8 ? rStrm.readUniString( nHelpLen ) : rStrm.readCharArray( nHelpLen, eTextEnc ) );
@@ -2164,7 +2056,7 @@ void WorkbookStreamObject::implDumpRecor
             else
             {
                 writeStringItem( "name", rStrm.readCharArray( nNameLen, eTextEnc ) );
-                getFormulaDumper().dumpNameFormula( 0, nFmlaSize );
+                getFormulaDumper().dumpNameFormula( EMPTY_STRING, nFmlaSize );
                 if( eBiff == BIFF2 ) getFormulaDumper().dumpFormulaSize();
             }
         }
@@ -2184,13 +2076,13 @@ void WorkbookStreamObject::implDumpRecor
         case BIFF_ID_EXTERNALBOOK:
         {
             sal_uInt16 nCount = dumpDec< sal_uInt16 >( "sheet-count" );
-            if( rStrm.getRecLeft() == 2 )
+            if( rStrm.getRemaining() == 2 )
                 dumpHex< sal_uInt16 >( "special-key", "EXTERNALBOOK-KEY" );
             else
             {
                 dumpString( "workbook-url" );
                 out().resetItemIndex();
-                for( sal_uInt16 nSheet = 0; rStrm.isValid() && (nSheet < nCount); ++nSheet )
+                for( sal_uInt16 nSheet = 0; !rStrm.isEof() && (nSheet < nCount); ++nSheet )
                     dumpString( "#sheet-name" );
             }
         }
@@ -2213,7 +2105,7 @@ void WorkbookStreamObject::implDumpRecor
                 }
             }
             OUString aName = dumpString( "name", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH );
-            if( (aName.getLength() > 0) && (aName[ 0 ] == 1) && (rStrm.getRecLeft() >= 2) )
+            if( (aName.getLength() > 0) && (aName[ 0 ] == 1) && (rStrm.getRemaining() >= 2) )
                 getFormulaDumper().dumpNameFormula();
         }
         break;
@@ -2224,7 +2116,7 @@ void WorkbookStreamObject::implDumpRecor
                 sal_uInt16 nCount = dumpDec< sal_uInt16 >( "ref-count" );
                 TableGuard aTabGuard( out(), 10, 17, 24 );
                 out().resetItemIndex();
-                for( sal_uInt16 nRefId = 0; rStrm.isValid() && (nRefId < nCount); ++nRefId )
+                for( sal_uInt16 nRefId = 0; !rStrm.isEof() && (nRefId < nCount); ++nRefId )
                 {
                     MultiItemsGuard aMultiGuard( out() );
                     writeEmptyItem( "#ref" );
@@ -2263,56 +2155,40 @@ void WorkbookStreamObject::implDumpRecor
         break;
 
         case BIFF_ID_FOOTER:
-            if( rStrm.getRecLeft() > 0 )
+            if( rStrm.getRemaining() > 0 )
                 dumpString( "footer", BIFF_STR_8BITLENGTH );
         break;
 
         case BIFF_ID_HEADER:
-            if( rStrm.getRecLeft() > 0 )
+            if( rStrm.getRemaining() > 0 )
                 dumpString( "header", BIFF_STR_8BITLENGTH );
         break;
 
         case BIFF_ID_HYPERLINK:
             dumpRange();
             if( cfg().getStringOption( dumpGuid( "guid" ), OUString() ).equalsAscii( "StdHlink" ) )
+                StdHlinkObject( *this ).dump();
+        break;
+
+        case BIFF3_ID_IMGDATA:
+        case BIFF8_ID_IMGDATA:
             {
-                dumpUnknown( 4 );
-                sal_uInt32 nFlags = dumpHex< sal_uInt32 >( "flags", "HYPERLINK-FLAGS" );
-                if( getFlag( nFlags, BIFF_HYPERLINK_DISPLAY ) )
-                    dumpOleString( "display", true );
-                if( getFlag( nFlags, BIFF_HYPERLINK_FRAME ) )
-                    dumpOleString( "target-frame", true );
-                if( getFlag( nFlags, BIFF_HYPERLINK_TARGET ) )
-                {
-                    if( getFlag( nFlags, BIFF_HYPERLINK_UNC ) )
-                    {
-                        dumpOleString( "unc-path", true );
-                    }
-                    else
-                    {
-                        OUString aGuid = cfg().getStringOption( dumpGuid( "content-type" ), OUString() );
-                        if( aGuid.equalsAscii( "FileMoniker" ) )
-                        {
-                            dumpDec< sal_Int16 >( "up-level" );
-                            dumpOleString( "dos-name", false );
-                            dumpUnknown( 24 );
-                            if( dumpDec< sal_Int32 >( "total-bytes" ) > 0 )
+            sal_uInt16 nFormat = dumpDec< sal_uInt16 >( "image-format", "IMGDATA-FORMAT" );
+            dumpDec< sal_uInt16 >( "environment", "IMGDATA-ENV" );
+            dumpDec< sal_uInt32 >( "data-size" );
+            if( nFormat == 9 )
                             {
-                                sal_Int32 nBytes = dumpDec< sal_Int32 >( "filename-bytes" );
-                                dumpUnknown( 2 );
-                                dumpOleString( "filename", nBytes / 2, true );
-                            }
-                        }
-                        else if( aGuid.equalsAscii( "URLMoniker" ) )
+                writeEmptyItem( "bitmap-header" );
+                IndentGuard aIndGuard( out() );
+                if( dumpDec< sal_uInt32 >( "header-size" ) == 12 )
                         {
-                            sal_Int32 nBytes = dumpDec< sal_Int32 >( "url-bytes" );
-                            dumpOleString( "url", nBytes / 2, true );
+                    dumpDec< sal_Int16 >( "width" );
+                    dumpDec< sal_Int16 >( "height" );
+                    dumpDec< sal_Int16 >( "planes" );
+                    dumpDec< sal_Int16 >( "bit-count" );
                         }
                     }
                 }
-                if( getFlag( nFlags, BIFF_HYPERLINK_LOC ) )
-                    dumpOleString( "location", true );
-            }
         break;
 
         case BIFF2_ID_INTEGER:
@@ -2345,7 +2221,8 @@ void WorkbookStreamObject::implDumpRecor
         case BIFF_ID_MSODRAWING:
         case BIFF_ID_MSODRAWINGGROUP:
         case BIFF_ID_MSODRAWINGSEL:
-            getDffDumper().dump();
+            dumpEmbeddedDff();
+            mbHasDff = true;
         break;
 
         case BIFF_ID_MULTBLANK:
@@ -2353,7 +2230,7 @@ void WorkbookStreamObject::implDumpRecor
             Address aPos = dumpAddress();
             {
                 TableGuard aTabGuard( out(), 12 );
-                for( ; rStrm.getRecLeft() >= 4; ++aPos.mnCol )
+                for( ; rStrm.getRemaining() >= 4; ++aPos.mnCol )
                 {
                     MultiItemsGuard aMultiGuard( out() );
                     writeAddressItem( "pos", aPos );
@@ -2369,7 +2246,7 @@ void WorkbookStreamObject::implDumpRecor
             Address aPos = dumpAddress();
             {
                 TableGuard aTabGuard( out(), 12, 12 );
-                for( ; rStrm.getRecLeft() >= 8; ++aPos.mnCol )
+                for( ; rStrm.getRemaining() >= 8; ++aPos.mnCol )
                 {
                     MultiItemsGuard aMultiGuard( out() );
                     writeAddressItem( "pos", aPos );
@@ -2381,6 +2258,20 @@ void WorkbookStreamObject::implDumpRecor
         }
         break;
 
+        case BIFF_ID_NOTE:
+            dumpAddress( "anchor-cell" );
+            if( eBiff == BIFF8 )
+            {
+                dumpHex< sal_uInt16 >( "flags", "NOTE-FLAGS" );
+                dumpDec< sal_uInt16 >( "obj-id" );
+            }
+            else
+            {
+                sal_uInt16 nTextLen = ::std::min( dumpDec< sal_uInt16 >( "text-len" ), static_cast< sal_uInt16 >( rStrm.getRemaining() ) );
+                writeStringItem( "note-text", rStrm.readCharArray( nTextLen, getBiffData().getTextEncoding() ) );
+            }
+        break;
+
         case BIFF2_ID_NUMBER:
         case BIFF3_ID_NUMBER:
             dumpCellHeader( nRecId == BIFF2_ID_NUMBER );
@@ -2480,7 +2371,7 @@ void WorkbookStreamObject::implDumpRecor
         case BIFF_ID_SCREENTIP:
             dumpRepeatedRecId();
             dumpRange();
-            dumpNullString( "tooltip", true );
+            dumpNullUnicodeArray( "tooltip" );
         break;
 
         case BIFF_ID_SELECTION:
@@ -2520,7 +2411,7 @@ void WorkbookStreamObject::implDumpRecor
             dumpDec< sal_uInt32 >( "string-cell-count" );
             dumpDec< sal_uInt32 >( "sst-size" );
             out().resetItemIndex();
-            while( rStrm.isValid() && (rStrm.getRecLeft() >= 3) )
+            while( !rStrm.isEof() && (rStrm.getRemaining() >= 3) )
                 dumpUniString( "#entry" );
         break;
 
@@ -2570,7 +2461,7 @@ void WorkbookStreamObject::implDumpRecor
 
         case BIFF_ID_SXIVD:
             out().resetItemIndex();
-            for( sal_Size nIdx = 0, nCount = rStrm.getRecLeft() / 2; nIdx < nCount; ++nIdx )
+            for( sal_Int64 nIdx = 0, nCount = rStrm.getRemaining() / 2; nIdx < nCount; ++nIdx )
                 dumpDec< sal_uInt16 >( "#field-idx" );
         break;
 
@@ -2578,9 +2469,9 @@ void WorkbookStreamObject::implDumpRecor
             if( mnPTSxliIdx < 2 )
             {
                 sal_uInt16 nCount = (mnPTSxliIdx == 0) ? mnPTRowFields : mnPTColFields;
-                sal_Size nLineSize = 8 + 2 * nCount;
+                sal_Int64 nLineSize = 8 + 2 * nCount;
                 out().resetItemIndex();
-                while( rStrm.getRecLeft() >= nLineSize )
+                while( rStrm.getRemaining() >= nLineSize )
                 {
                     writeEmptyItem( "#line-data" );
                     IndentGuard aIndGuard( out() );
@@ -2591,7 +2482,7 @@ void WorkbookStreamObject::implDumpRecor
                     dumpHex< sal_uInt16 >( "flags", "SXLI-FLAGS" );
                     OUStringBuffer aItemList;
                     for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
-                        StringHelper::appendToken( aItemList, in().readValue< sal_uInt16 >() );
+                        StringHelper::appendToken( aItemList, in().readuInt16() );
                     writeInfoItem( "item-idxs", aItemList.makeStringAndClear() );
                 }
                 ++mnPTSxliIdx;
@@ -2658,6 +2549,17 @@ void WorkbookStreamObject::implDumpRecor
         }
         break;
 
+        case BIFF_ID_TXO:
+            dumpHex< sal_uInt16 >( "flags", "TXO-FLAGS" );
+            dumpDec< sal_uInt16 >( "orientation", "TEXTORIENTATION" );
+            dumpHex< sal_uInt16 >( "button-flags", "OBJ-BUTTON-FLAGS" );
+            dumpUnicode( "accelerator" );
+            dumpUnicode( "fareast-accelerator" );
+            dumpDec< sal_uInt16 >( "text-len" );
+            dumpDec< sal_uInt16 >( "format-run-size" );
+            dumpUnused( 4 );
+        break;
+
         case BIFF_ID_WINDOW1:
             dumpDec< sal_uInt16 >( "window-x", "CONV-TWIP-TO-CM" );
             dumpDec< sal_uInt16 >( "window-y", "CONV-TWIP-TO-CM" );
@@ -2685,7 +2587,7 @@ void WorkbookStreamObject::implDumpRecor
             dumpBool< sal_uInt8 >( "show-zeros" );
             dumpAddress( "first-visible-cell" );
             dumpBool< sal_uInt8 >( "auto-grid-color" );
-            dumpRgbColor( "grid-color-rgb" );
+            dumpColorABGR( "grid-color" );
         break;
 
         case BIFF3_ID_WINDOW2:
@@ -2695,7 +2597,7 @@ void WorkbookStreamObject::implDumpRecor
             {
                 dumpColorIdx( "grid-color-idx" );
                 dumpUnused( 2 );
-                if( rStrm.getRecLeft() >= 8 )
+                if( rStrm.getRemaining() >= 8 )
                 {
                     dumpDec< sal_uInt16 >( "pagebreak-zoom", "CONV-PERCENT" );
                     dumpDec< sal_uInt16 >( "normal-zoom", "CONV-PERCENT" );
@@ -2703,7 +2605,7 @@ void WorkbookStreamObject::implDumpRecor
                 }
             }
             else
-                dumpRgbColor( "grid-color-rgb" );
+                dumpColorABGR( "grid-color" );
         break;
 
         case BIFF_ID_XCT:
@@ -2720,6 +2622,17 @@ void WorkbookStreamObject::implDumpRecor
     }
 }
 
+void WorkbookStreamObject::initializePerSheet()
+{
+    getBiffData().initializePerSheet();
+    mxFontNames = cfg().createNameList< ConstList >( "FONTNAMES" );
+    mxFontNames->setName( 0, createFontName( CREATE_OUSTRING( "Arial" ), 200, false, false ) );
+    mxFormats = cfg().createNameList< ConstList >( "FORMATS" );
+    mxFormats->includeList( cfg().getNameList( "BUILTIN-FORMATS" ) );
+    mnFormatIdx = 0;
+    mbHasCodePage = false;
+}
+
 OUString WorkbookStreamObject::createFontName( const OUString& rName, sal_uInt16 nHeight, bool bBold, bool bItalic ) const
 {
     OUStringBuffer aName( rName );
@@ -2732,45 +2645,45 @@ OUString WorkbookStreamObject::createFon
     return aName.makeStringAndClear();
 }
 
-sal_uInt16 WorkbookStreamObject::dumpPatternIdx( const sal_Char* pcName, bool b16Bit )
+sal_uInt16 WorkbookStreamObject::dumpPatternIdx( const String& rName, bool b16Bit )
 {
-    return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, pcName ? pcName : "fill-pattern", mxFillPatterns );
+    return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, rName( "fill-pattern" ), mxFillPatterns );
 }
 
-sal_uInt16 WorkbookStreamObject::dumpColorIdx( const sal_Char* pcName, bool b16Bit )
+sal_uInt16 WorkbookStreamObject::dumpColorIdx( const String& rName, bool b16Bit )
 {
-    return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, pcName ? pcName : "color-idx", mxColors );
+    return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, rName( "color-idx" ), mxColors );
 }
 
-sal_uInt16 WorkbookStreamObject::dumpFontIdx( const sal_Char* pcName, bool b16Bit )
+sal_uInt16 WorkbookStreamObject::dumpFontIdx( const String& rName, bool b16Bit )
 {
-    return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, pcName ? pcName : "font-idx", "FONTNAMES" );
+    return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, rName( "font-idx" ), "FONTNAMES" );
 }
 
-sal_uInt16 WorkbookStreamObject::dumpFormatIdx( const sal_Char* pcName )
+sal_uInt16 WorkbookStreamObject::dumpFormatIdx( const String& rName )
 {
-    return dumpDec< sal_uInt16, sal_uInt8 >( getBiff() >= BIFF5, pcName ? pcName : "fmt-idx", "FORMATS" );
+    return dumpDec< sal_uInt16, sal_uInt8 >( getBiff() >= BIFF5, rName( "fmt-idx" ), "FORMATS" );
 }
 
-sal_uInt16 WorkbookStreamObject::dumpXfIdx( const sal_Char* pcName, bool bBiff2Style )
+sal_uInt16 WorkbookStreamObject::dumpXfIdx( const String& rName, bool bBiff2Style )
 {
-    if( !pcName ) pcName = "xf-idx";
+    String aName = rName( "xf-idx" );
     sal_uInt16 nXfIdx = 0;
     if( bBiff2Style )
     {
-        dumpHex< sal_uInt8 >( pcName, "CELL-XFINDEX" );
+        dumpHex< sal_uInt8 >( aName, "CELL-XFINDEX" );
         dumpHex< sal_uInt8 >( "fmt-font-idx", "CELL-XFFORMAT" );
         dumpHex< sal_uInt8 >( "style", "CELL-XFSTYLE" );
     }
     else
-        nXfIdx = dumpDec< sal_uInt16 >( pcName );
+        nXfIdx = dumpDec< sal_uInt16 >( aName );
     return nXfIdx;
 }
 
 sal_uInt16 WorkbookStreamObject::dumpCellHeader( bool bBiff2Style )
 {
     dumpAddress();
-    return dumpXfIdx( 0, bBiff2Style );
+    return dumpXfIdx( EMPTY_STRING, bBiff2Style );
 }
 
 void WorkbookStreamObject::dumpBoolErr()
@@ -2854,7 +2767,7 @@ void WorkbookStreamObject::dumpXfRec()
     sal_uInt16 nXfId = getBiffData().getXfCount();
     out().resetItemIndex( nXfId );
     writeEmptyItem( "#xf" );
-    sal_uInt16 nFontId = dumpFontIdx( 0, getBiff() >= BIFF5 );
+    sal_uInt16 nFontId = dumpFontIdx( EMPTY_STRING, getBiff() >= BIFF5 );
     switch( getBiff() )
     {
         case BIFF2:
@@ -2907,55 +2820,324 @@ void WorkbookStreamObject::dumpObjRec()
 {
     switch( getBiff() )
     {
-        case BIFF5: dumpObjRecBiff5();  break;
-        case BIFF8: dumpObjRecBiff8();  break;
+        case BIFF3:
+            dumpObjRecBiff3();
+        break;
+        case BIFF4:
+            dumpObjRecBiff4();
+        break;
+        case BIFF5:
+            dumpObjRecBiff5();
+        break;
+        case BIFF8:
+            // #i61786# OBJ records without DFF stream are in BIFF5 format
+            if( mbHasDff ) dumpObjRecBiff8(); else dumpObjRecBiff5();
+        break;
         default:;
     }
 }
 
+void WorkbookStreamObject::dumpObjRecBiff3()
+{
+    dumpDec< sal_uInt32 >( "obj-count" );
+    sal_uInt16 nObjType = dumpDec< sal_uInt16 >( "obj-type", "OBJ-TYPE" );
+    dumpDec< sal_uInt16 >( "obj-id" );
+    dumpHex< sal_uInt16 >( "flags", "OBJ-FLAGS" );
+    dumpDffClientRect();
+    sal_uInt16 nMacroSize = dumpDec< sal_uInt16 >( "macro-size" );
+    dumpUnused( 2 );
+    sal_uInt16 nTextLen = 0, nFormatSize = 0, nLinkSize = 0;
+    switch( nObjType )
+    {
+        case BIFF_OBJTYPE_GROUP:
+            dumpUnused( 4 );
+            dumpDec< sal_uInt16 >( "next-ungrouped-id" );
+            dumpUnused( 16 );
+            dumpObjRecString( "macro", nMacroSize, true );
+        break;
+        case BIFF_OBJTYPE_LINE:
+            dumpObjRecLineData();
+            dumpHex< sal_uInt16 >( "line-end", "OBJ-LINEENDS" );
+            dumpDec< sal_uInt8 >( "line-direction", "OBJ-LINEDIR" );
+            dumpUnused( 1 );
+            dumpObjRecString( "macro", nMacroSize, true );
+        break;
+        case BIFF_OBJTYPE_RECTANGLE:
+        case BIFF_OBJTYPE_OVAL:
+            dumpObjRecRectData();
+            dumpObjRecString( "macro", nMacroSize, true );
+        break;
+        case BIFF_OBJTYPE_ARC:
+            dumpObjRecFillData();
+            dumpObjRecLineData();
+            dumpDec< sal_uInt8 >( "quadrant", "OBJ-ARC-QUADRANT" );
+            dumpUnused( 1 );
+            dumpObjRecString( "macro", nMacroSize, true );
+        break;
+        case BIFF_OBJTYPE_CHART:
+            dumpObjRecRectData();
+            dumpUnused( 18 );
+            dumpObjRecString( "macro", nMacroSize, true );
+        break;
+        case BIFF_OBJTYPE_TEXT:
+        case BIFF_OBJTYPE_BUTTON:
+            dumpObjRecRectData();
+            dumpObjRecTextDataBiff3( nTextLen, nFormatSize );
+            dumpObjRecString( "macro", nMacroSize, true );
+            dumpObjRecString( "text", nTextLen, false );
+            dumpObjRecTextFmt( nFormatSize );
+        break;
+        case BIFF_OBJTYPE_PICTURE:
+            dumpObjRecRectData();
+            dumpDec< sal_Int16 >( "image-format", "IMGDATA-FORMAT" );
+            dumpUnused( 4 );
+            nLinkSize = dumpDec< sal_uInt16 >( "pic-link-size" );
+            dumpUnused( 2 );
+            dumpHex< sal_uInt16 >( "flags", "OBJ-PICTURE-FLAGS" );
+            dumpObjRecString( "macro", nMacroSize, true );
+            dumpObjRecPictFmla( nLinkSize );
+        break;
+    }
+}
+
+void WorkbookStreamObject::dumpObjRecBiff4()
+{
+    dumpDec< sal_uInt32 >( "obj-count" );
+    sal_uInt16 nObjType = dumpDec< sal_uInt16 >( "obj-type", "OBJ-TYPE" );
+    dumpDec< sal_uInt16 >( "obj-id" );
+    dumpHex< sal_uInt16 >( "flags", "OBJ-FLAGS" );
+    dumpDffClientRect();
+    sal_uInt16 nMacroSize = dumpDec< sal_uInt16 >( "macro-size" );
+    dumpUnused( 2 );
+    sal_uInt16 nTextLen = 0, nFormatSize = 0, nLinkSize = 0;
+    switch( nObjType )
+    {
+        case BIFF_OBJTYPE_GROUP:
+            dumpUnused( 4 );
+            dumpDec< sal_uInt16 >( "next-ungrouped-id" );
+            dumpUnused( 16 );
+            dumpObjRecFmla( "macro", nMacroSize );
+        break;
+        case BIFF_OBJTYPE_LINE:
+            dumpObjRecLineData();
+            dumpHex< sal_uInt16 >( "line-end", "OBJ-LINEENDS" );
+            dumpDec< sal_uInt8 >( "line-direction", "OBJ-LINEDIR" );
+            dumpUnused( 1 );
+            dumpObjRecFmla( "macro", nMacroSize );
+        break;
+        case BIFF_OBJTYPE_RECTANGLE:
+        case BIFF_OBJTYPE_OVAL:
+            dumpObjRecRectData();
+            dumpObjRecFmla( "macro", nMacroSize );
+        break;
+        case BIFF_OBJTYPE_ARC:
+            dumpObjRecFillData();
+            dumpObjRecLineData();
+            dumpDec< sal_uInt8 >( "quadrant", "OBJ-ARC-QUADRANT" );
+            dumpUnused( 1 );
+            dumpObjRecFmla( "macro", nMacroSize );
+        break;
+        case BIFF_OBJTYPE_CHART:
+            dumpObjRecRectData();
+            dumpUnused( 18 );
+            dumpObjRecFmla( "macro", nMacroSize );
+        break;
+        case BIFF_OBJTYPE_TEXT:
+        case BIFF_OBJTYPE_BUTTON:
+            dumpObjRecRectData();
+            dumpObjRecTextDataBiff3( nTextLen, nFormatSize );
+            dumpObjRecFmla( "macro", nMacroSize );
+            dumpObjRecString( "text", nTextLen, false );
+            dumpObjRecTextFmt( nFormatSize );
+        break;
+        case BIFF_OBJTYPE_PICTURE:
+            dumpObjRecRectData();
+            dumpDec< sal_Int16 >( "image-format", "IMGDATA-FORMAT" );
+            dumpUnused( 4 );
+            nLinkSize = dumpDec< sal_uInt16 >( "pic-link-size" );
+            dumpUnused( 2 );
+            dumpHex< sal_uInt16 >( "flags", "OBJ-PICTURE-FLAGS" );
+            dumpObjRecFmla( "macro", nMacroSize );
+            dumpObjRecPictFmla( nLinkSize );
+        break;
+        case BIFF_OBJTYPE_POLYGON:
+            dumpObjRecRectData();
+            dumpHex< sal_uInt16 >( "flags", "OBJ-POLYGON-FLAGS" );
+            dumpUnused( 10 );
+            dumpDec< sal_uInt16 >( "point-count" );
+            dumpUnused( 8 );
+            dumpObjRecFmla( "macro", nMacroSize );
+        break;
+    }
+}
+
 void WorkbookStreamObject::dumpObjRecBiff5()
 {
+    BiffInputStream& rStrm = getBiffStream();
     dumpDec< sal_uInt32 >( "obj-count" );
     sal_uInt16 nObjType = dumpDec< sal_uInt16 >( "obj-type", "OBJ-TYPE" );
     dumpDec< sal_uInt16 >( "obj-id" );
     dumpHex< sal_uInt16 >( "flags", "OBJ-FLAGS" );
-    getDffDumper().dumpDffClientRect();
-    dumpDec< sal_uInt16 >( "macro-len" );
-    dumpUnused( 6 );
+    dumpDffClientRect();
+    sal_uInt16 nMacroSize = dumpDec< sal_uInt16 >( "macro-size" );
+    dumpUnused( 2 );
+    sal_uInt16 nNameLen = dumpDec< sal_uInt16 >( "name-len" );
+    dumpUnused( 2 );
+    sal_uInt16 nTextLen = 0, nFormatSize = 0, nLinkSize = 0;
     switch( nObjType )
     {
-        case BIFF_OBJCMO_LINE:
-            dumpColorIdx( "line-color-idx", false );
-            dumpDec< sal_uInt8 >( "line-type", "OBJ-LINETYPE" );
-            dumpDec< sal_uInt8 >( "line-weight", "OBJ-LINEWEIGHT" );
-            dumpHex< sal_uInt8 >( "line-flags", "OBJ-FLAGS-AUTO" );
+        case BIFF_OBJTYPE_GROUP:
+            dumpUnused( 4 );
+            dumpDec< sal_uInt16 >( "next-ungrouped-id" );
+            dumpUnused( 16 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", nMacroSize );
+        break;
+        case BIFF_OBJTYPE_LINE:
+            dumpObjRecLineData();
             dumpHex< sal_uInt16 >( "line-end", "OBJ-LINEENDS" );
             dumpDec< sal_uInt8 >( "line-direction", "OBJ-LINEDIR" );
             dumpUnused( 1 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", nMacroSize );
         break;
-        case BIFF_OBJCMO_RECTANGLE:
-            dumpColorIdx( "back-color-idx", false );
-            dumpColorIdx( "patt-color-idx", false );
-            dumpPatternIdx( 0, false );
-            dumpHex< sal_uInt8 >( "area-flags", "OBJ-FLAGS-AUTO" );
-            dumpColorIdx( "line-color-idx", false );
-            dumpDec< sal_uInt8 >( "line-type", "OBJ-LINETYPE" );
-            dumpDec< sal_uInt8 >( "line-weight", "OBJ-LINEWEIGHT" );
-            dumpHex< sal_uInt8 >( "line-flags", "OBJ-FLAGS-AUTO" );
-            dumpHex< sal_uInt16 >( "frame-style", "OBJ-FRAMESTYLE-FLAGS" );
+        case BIFF_OBJTYPE_RECTANGLE:
+        case BIFF_OBJTYPE_OVAL:
+            dumpObjRecRectData();
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", nMacroSize );
+        break;
+        case BIFF_OBJTYPE_ARC:
+            dumpObjRecFillData();
+            dumpObjRecLineData();
+            dumpDec< sal_uInt8 >( "quadrant", "OBJ-ARC-QUADRANT" );
+            dumpUnused( 1 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", nMacroSize );
         break;
-        case BIFF_OBJCMO_CHART:
-            dumpColorIdx( "back-color-idx", false );
-            dumpColorIdx( "patt-color-idx", false );
-            dumpPatternIdx( 0, false );
-            dumpHex< sal_uInt8 >( "area-flags", "OBJ-FLAGS-AUTO" );
-            dumpColorIdx( "line-color-idx", false );
-            dumpDec< sal_uInt8 >( "line-type", "OBJ-LINETYPE" );
-            dumpDec< sal_uInt8 >( "line-weight", "OBJ-LINEWEIGHT" );
-            dumpHex< sal_uInt8 >( "line-flags", "OBJ-FLAGS-AUTO" );
-            dumpHex< sal_uInt16 >( "frame-style", "OBJ-FRAMESTYLE-FLAGS" );
+        case BIFF_OBJTYPE_CHART:
+            dumpObjRecRectData();
             dumpHex< sal_uInt16 >( "chart-flags", "OBJ-CHART-FLAGS" );
             dumpUnused( 16 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", nMacroSize );
+        break;
+        case BIFF_OBJTYPE_TEXT:
+        case BIFF_OBJTYPE_BUTTON:
+        case BIFF_OBJTYPE_LABEL:
+        case BIFF_OBJTYPE_DIALOG:
+            dumpObjRecRectData();
+            dumpObjRecTextDataBiff5( nTextLen, nFormatSize, nLinkSize );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", nMacroSize );
+            dumpObjRecString( "text", nTextLen, false );
+            dumpObjRecFmla( "text-link", nLinkSize );
+            dumpObjRecTextFmt( nFormatSize );
+        break;
+        case BIFF_OBJTYPE_PICTURE:
+            dumpObjRecRectData();
+            dumpDec< sal_Int16 >( "image-format", "IMGDATA-FORMAT" );
+            dumpUnused( 4 );
+            nLinkSize = dumpDec< sal_uInt16 >( "pic-link-size" );
+            dumpUnused( 2 );
+            dumpHex< sal_uInt16 >( "flags", "OBJ-PICTURE-FLAGS" );
+            dumpUnused( 4 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", nMacroSize );
+            dumpObjRecPictFmla( nLinkSize );
+            if( rStrm.getRemaining() >= 4 )
+                dumpHex< sal_uInt32 >( "ole-storage-id" );
+        break;
+        case BIFF_OBJTYPE_POLYGON:
+            dumpObjRecRectData();
+            dumpHex< sal_uInt16 >( "flags", "OBJ-POLYGON-FLAGS" );
+            dumpUnused( 10 );
+            dumpDec< sal_uInt16 >( "point-count" );
+            dumpUnused( 8 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", nMacroSize );
+        break;
+        case BIFF_OBJTYPE_CHECKBOX:
+            dumpObjRecRectData();
+            dumpUnused( 10 );
+            dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+            dumpUnused( 20 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+            dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+            dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
+            dumpObjRecCblsData();
+        break;
+        case BIFF_OBJTYPE_OPTIONBUTTON:
+            dumpObjRecRectData();
+            dumpUnused( 10 );
+            dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+            dumpUnused( 32 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+            dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+            dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
+            dumpObjRecCblsData();
+            dumpObjRecRboData();
+        break;
+        case BIFF_OBJTYPE_EDIT:
+            dumpObjRecRectData();
+            dumpUnused( 10 );
+            dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+            dumpUnused( 14 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+            dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
+            dumpObjRecEdoData();
+        break;
+        case BIFF_OBJTYPE_SPIN:
+        case BIFF_OBJTYPE_SCROLLBAR:
+            dumpObjRecRectData();
+            dumpObjRecSbsData();
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+            dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+        break;
+        case BIFF_OBJTYPE_LISTBOX:
+            dumpObjRecRectData();
+            dumpObjRecSbsData();
+            dumpUnused( 18 );
+            dumpFontIdx( "font-idx" );
+            dumpUnused( 4 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+            dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+            dumpObjRecLbsData();
+        break;
+        case BIFF_OBJTYPE_GROUPBOX:
+            dumpObjRecRectData();
+            dumpUnused( 10 );
+            dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+            dumpUnused( 26 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+            dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
+            dumpObjRecGboData();
+        break;
+        case BIFF_OBJTYPE_DROPDOWN:
+            dumpObjRecRectData();
+            dumpObjRecSbsData();
+            dumpUnused( 18 );
+            dumpFontIdx( "font-idx" );
+            dumpUnused( 14 );
+            dumpDec< sal_uInt16 >( "bounding-left" );
+            dumpDec< sal_uInt16 >( "bounding-top" );
+            dumpDec< sal_uInt16 >( "bounding-right" );
+            dumpDec< sal_uInt16 >( "bounding-bottom" );
+            dumpUnused( 4 );
+            dumpObjRecString( "obj-name", nNameLen, true );
+            dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+            dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+            dumpObjRecLbsData();
+            dumpDec< sal_uInt16 >( "type", "OBJ-DROPDOWN-TYPE" );
+            dumpDec< sal_uInt16 >( "line-count" );
+            dumpDec< sal_uInt16 >( "min-list-width" );
+            dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
         break;
     }
 }
@@ -2965,137 +3147,307 @@ void WorkbookStreamObject::dumpObjRecBif
     Output& rOut = out();
     BiffInputStream& rStrm = getBiffStream();
     NameListRef xRecNames = cfg().getNameList( "OBJ-RECNAMES" );
-    bool bLinked = false;
+    sal_uInt16 nObjType = 0xFFFF;
     bool bControl = false;
     bool bCtlsStrm = false;
     bool bLoop = true;
-    while( bLoop && (rStrm.getRecLeft() >= 4) )
+    while( bLoop && (rStrm.getRemaining() >= 4) )
     {
         rOut.emptyLine();
         sal_uInt16 nSubRecId, nSubRecSize;
         {
             MultiItemsGuard aMultiGuard( rOut );
             writeEmptyItem( "OBJREC" );
-            writeHexItem( "pos", rStrm.getRecPos() );
+            writeHexItem( "pos", static_cast< sal_uInt32 >( rStrm.tell() ) );
             rStrm >> nSubRecId >> nSubRecSize;
             writeHexItem( "size", nSubRecSize );
             writeHexItem( "id", nSubRecId, xRecNames );
         }
 
-        sal_uInt32 nSubRecStart = rStrm.getRecPos();
+        sal_Int64 nSubRecStart = rStrm.tell();
         // sometimes the last subrecord has an invalid length
-        sal_uInt32 nRealRecSize = ::std::min< sal_uInt32 >( nSubRecSize, rStrm.getRecLeft() );
-        sal_uInt32 nSubRecEnd = nSubRecStart + nRealRecSize;
+        sal_Int64 nRealRecSize = ::std::min< sal_Int64 >( nSubRecSize, rStrm.getRemaining() );
+        sal_Int64 nSubRecEnd = nSubRecStart + nRealRecSize;
 
         IndentGuard aIndGuard( rOut );
         switch( nSubRecId )
         {
-            case BIFF_ID_OBJPIOGRBIT:
+            case BIFF_ID_OBJMACRO:
+                dumpObjRecFmlaRaw();
+            break;
+            case BIFF_ID_OBJCF:
+                dumpDec< sal_Int16 >( "clipboard-format", "IMGDATA-FORMAT" );
+            break;
+            case BIFF_ID_OBJFLAGS:
             {
-                sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "OBJPIOGRBIT-FLAGS" );
-                bLinked = getFlag( nFlags, BIFF_OBJPIO_LINKED );
-                bControl = getFlag( nFlags, BIFF_OBJPIO_CONTROL );
-                bCtlsStrm = getFlag( nFlags, BIFF_OBJPIO_CTLSSTREAM );
+                sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "OBJFLAGS-FLAGS" );
+                bControl = getFlag( nFlags, BIFF_OBJFLAGS_CONTROL );
+                bCtlsStrm = getFlag( nFlags, BIFF_OBJFLAGS_CTLSSTREAM );
             }
             break;
             case BIFF_ID_OBJPICTFMLA:
             {
-                sal_uInt16 nLinkDataSize = dumpDec< sal_uInt16 >( "link-data-size" );
-                sal_uInt32 nLinkDataEnd = rStrm.getRecPos() + nLinkDataSize;
-                {
-                    IndentGuard aIndGuard2( rOut );
-                    sal_uInt16 nFmlaSize = getFormulaDumper().dumpFormulaSize();
-                    dumpUnused( 4 );
-                    getFormulaDumper().dumpNameFormula( "link", nFmlaSize );
-                    if( dumpDec< sal_uInt8 >( "has-class-name", "OBJPICTFMLA-HASCLASSNAME" ) == 3 )
-                    {
-                        dumpUniString( "class-name", BIFF_STR_SMARTFLAGS );
-                        if( ((rStrm.getRecPos() - nSubRecStart) & 1) != 0 )
-                            dumpHex< sal_uInt8 >( "padding" );
-                    }
-                }
-                if( rStrm.getRecPos() != nLinkDataEnd )
-                    writeEmptyItem( OOX_DUMP_ERRASCII( "link-data-size" ) );
-                if( rStrm.getRecPos() < nLinkDataEnd )
-                    dumpRemaining( nLinkDataEnd - rStrm.getRecPos() );
-                rStrm.seek( nLinkDataEnd );
-                if( nLinkDataEnd + 4 <= nSubRecEnd )
+                dumpObjRecPictFmla( dumpDec< sal_uInt16 >( "pic-link-size" ) );
+                if( rStrm.tell() + 4 <= nSubRecEnd )
                 {
                     if( bControl && bCtlsStrm )
-                    {
-                        sal_uInt32 nPos = dumpHex< sal_uInt32 >( "ctls-stream-pos", "CONV-DEC" );
-                        sal_uInt32 nSize = dumpHex< sal_uInt32 >( "ctls-stream-size", "CONV-DEC" );
-                        IndentGuard aIndGuard2( rOut );
-                        rOut.emptyLine();
-                        dumpFormControl( nPos, nSize );
-                        rOut.emptyLine();
-                    }
+                        dumpOcxControl();
                     else
                         dumpHex< sal_uInt32 >( "ole-storage-id" );
                 }
-                if( bControl && (rStrm.getRecPos() + 8 <= nSubRecEnd) )
-                {
-                    sal_uInt32 nClassIdSize = dumpDec< sal_uInt32 >( "class-id-size" );
-                    if( nClassIdSize > 0 )
+                if( bControl && (rStrm.tell() + 8 <= nSubRecEnd) )
                     {
-                        IndentGuard aIndGuard2( rOut );
-                        sal_uInt32 nClassIdEnd = rStrm.getRecPos() + nClassIdSize;
-                        dumpUnicodeArray( "class-id", static_cast< sal_Int32 >( nClassIdSize / 2 ) );
-                        rStrm.seek( nClassIdEnd );
-                    }
-                    sal_uInt16 nCellLinkSize = dumpDec< sal_uInt16 >( "cell-link-size" );
-                    if( nCellLinkSize > 0 )
+                    sal_uInt32 nKeySize = dumpDec< sal_uInt32 >( "licence-key-size" );
+                    if( nKeySize > 0 )
                     {
                         IndentGuard aIndGuard2( rOut );
-                        sal_uInt32 nCellLinkEnd = rStrm.getRecPos() + nCellLinkSize;
-                        sal_uInt16 nFmlaSize = getFormulaDumper().dumpFormulaSize( "cell-link-fmla-size" );
-                        dumpUnused( 4 );
-                        getFormulaDumper().dumpNameFormula( "cell-link", nFmlaSize );
-                        rStrm.seek( nCellLinkEnd );
+                        sal_Int64 nKeyEnd = rStrm.tell() + nKeySize;
+                        dumpArray( "licence-key", static_cast< sal_Int32 >( nKeySize ) );
+                        rStrm.seek( nKeyEnd );
                     }
-                    sal_uInt16 nSrcRangeSize = dumpDec< sal_uInt16 >( "source-range-size" );
-                    if( nSrcRangeSize > 0 )
-                    {
-                        IndentGuard aIndGuard2( rOut );
-                        sal_uInt32 nSrcRangeEnd = rStrm.getRecPos() + nSrcRangeSize;
-                        sal_uInt16 nFmlaSize = getFormulaDumper().dumpFormulaSize( "source-range-fmla-size" );
-                        dumpUnused( 4 );
-                        getFormulaDumper().dumpNameFormula( "source-range", nFmlaSize );
-                        rStrm.seek( nSrcRangeEnd );
+                    dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+                    dumpObjRecFmla( "source-range", dumpDec< sal_uInt16 >( "source-range-size" ) );
                     }
                 }
+            break;
+            case BIFF_ID_OBJCBLS:
+                dumpDec< sal_uInt16 >( "state", "OBJ-CHECKBOX-STATE" );
+                dumpUnused( 4 );
+                dumpUnicode( "accelerator" );
+                dumpUnicode( "fareast-accelerator" );
+                dumpHex< sal_uInt16 >( "checkbox-flags", "OBJ-CHECKBOX-FLAGS" );
+            break;
+            case BIFF_ID_OBJRBO:
+                dumpUnused( 4 );
+                dumpBool< sal_uInt16 >( "first-in-group" );
+            break;
+            case BIFF_ID_OBJSBS:
+                dumpObjRecSbsData();
+            break;
+            case BIFF_ID_OBJGBODATA:
+                dumpObjRecGboData();
+            break;
+            case BIFF_ID_OBJEDODATA:
+                dumpObjRecEdoData();
+            break;
+            case BIFF_ID_OBJRBODATA:
+                dumpObjRecRboData();
+            break;
+            case BIFF_ID_OBJCBLSDATA:
+                dumpObjRecCblsData();
+            break;
+            case BIFF_ID_OBJLBSDATA:
+                dumpObjRecLbsData();
+                if( nObjType == BIFF_OBJTYPE_DROPDOWN )
+                {
+                    dumpHex< sal_uInt16 >( "dropdown-flags", "OBJ-DROPDOWN-FLAGS" );
+                    dumpDec< sal_uInt16 >( "line-count" );
+                    dumpDec< sal_uInt16 >( "min-list-width" );
+                    dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
             }
             break;
+            case BIFF_ID_OBJCBLSFMLA:
+            case BIFF_ID_OBJSBSFMLA:
+                dumpObjRecFmlaRaw();
+            break;
             case BIFF_ID_OBJCMO:
-                dumpDec< sal_uInt16 >( "type", "OBJCMO-TYPE" );
+                nObjType = dumpDec< sal_uInt16 >( "type", "OBJ-TYPE" );
                 dumpDec< sal_uInt16 >( "id" );
                 dumpHex< sal_uInt16 >( "flags", "OBJCMO-FLAGS" );
                 dumpUnused( 12 );
             break;
         }
         // remaining undumped data
-        if( rStrm.getRecPos() == nSubRecStart )
+        if( !rStrm.isEof() && (rStrm.tell() == nSubRecStart) )
             dumpRawBinary( nRealRecSize, false );
         else
-            dumpRemaining( nSubRecEnd - rStrm.getRecPos() );
-        rStrm.seek( nSubRecStart + nRealRecSize );
+            dumpRemainingTo( nSubRecEnd );
+    }
+}
+
+void WorkbookStreamObject::dumpObjRecLineData()
+{
+    dumpColorIdx( "line-color-idx", false );
+    dumpDec< sal_uInt8 >( "line-type", "OBJ-LINETYPE" );
+    dumpDec< sal_uInt8 >( "line-weight", "OBJ-LINEWEIGHT" );
+    dumpHex< sal_uInt8 >( "line-flags", "OBJ-AUTO-FLAGS" );
+}
+
+void WorkbookStreamObject::dumpObjRecFillData()
+{
+    dumpColorIdx( "back-color-idx", false );
+    dumpColorIdx( "patt-color-idx", false );
+    dumpPatternIdx( EMPTY_STRING, false );
+    dumpHex< sal_uInt8 >( "area-flags", "OBJ-AUTO-FLAGS" );
     }
+
+void WorkbookStreamObject::dumpObjRecRectData()
+{
+    dumpObjRecFillData();
+    dumpObjRecLineData();
+    dumpHex< sal_uInt16 >( "frame-style", "OBJ-FRAMESTYLE-FLAGS" );
 }
 
-void WorkbookStreamObject::dumpFormControl( sal_uInt32 nStrmPos, sal_uInt32 nStrmSize )
+void WorkbookStreamObject::dumpObjRecTextDataBiff3( sal_uInt16& ornTextLen, sal_uInt16& ornFormatSize )
 {
-    writeHexItem( "stream-pos", nStrmPos, "CONV-DEC" );
-    writeHexItem( "stream-size", nStrmSize, "CONV-DEC" );
+    ornTextLen = dumpDec< sal_uInt16 >( "text-len" );
+    dumpUnused( 2 );
+    ornFormatSize = dumpDec< sal_uInt16 >( "format-run-size" );
+    dumpFontIdx( "default-font-idx" );
+    dumpUnused( 2 );
+    dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+    dumpDec< sal_uInt16 >( "orientation", "TEXTORIENTATION" );
+    dumpUnused( 8 );
+}
+
+void WorkbookStreamObject::dumpObjRecTextDataBiff5( sal_uInt16& ornTextLen, sal_uInt16& ornFormatSize, sal_uInt16& ornLinkSize )
+{
+    ornTextLen = dumpDec< sal_uInt16 >( "text-len" );
+    dumpUnused( 2 );
+    ornFormatSize = dumpDec< sal_uInt16 >( "format-run-size" );
+    dumpFontIdx( "default-font-idx" );
+    dumpUnused( 2 );
+    dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+    dumpDec< sal_uInt16 >( "orientation", "TEXTORIENTATION" );
+    dumpUnused( 2 );
+    ornLinkSize = dumpDec< sal_uInt16 >( "link-size" );
+    dumpUnused( 2 );
+    dumpHex< sal_uInt16 >( "button-flags", "OBJ-BUTTON-FLAGS" );
+    dumpUnicode( "accelerator" );
+    dumpUnicode( "fareast-accelerator" );
+}
+
+void WorkbookStreamObject::dumpObjRecSbsData()
+{
+    dumpUnused( 4 );
+    dumpDec< sal_uInt16 >( "value" );
+    dumpDec< sal_uInt16 >( "min" );
+    dumpDec< sal_uInt16 >( "max" );
+    dumpDec< sal_uInt16 >( "step" );
+    dumpDec< sal_uInt16 >( "page-step" );
+    dumpBool< sal_uInt16 >( "horizontal" );
+    dumpDec< sal_uInt16 >( "thumb-width" );
+    dumpHex< sal_uInt16 >( "scrollbar-flags", "OBJ-SCROLLBAR-FLAGS" );
+}
+
+void WorkbookStreamObject::dumpObjRecGboData()
+{
+    dumpUnicode( "accelerator" );
+    dumpUnicode( "fareast-accelerator" );
+    dumpHex< sal_uInt16 >( "groupbox-flags", "OBJ-GROUPBOX-FLAGS" );
+}
+
+void WorkbookStreamObject::dumpObjRecEdoData()
+{
+    dumpDec< sal_uInt16 >( "type", "OBJ-EDIT-TYPE" );
+    dumpBool< sal_uInt16 >( "multiline" );
+    dumpBool< sal_uInt16 >( "scrollbar" );
+    dumpDec< sal_uInt16 >( "listbox-obj-id" );
+}
+
+void WorkbookStreamObject::dumpObjRecRboData()
+{
+    dumpDec< sal_uInt16 >( "next-in-group" );
+    dumpBool< sal_uInt16 >( "first-in-group" );
+}
+
+void WorkbookStreamObject::dumpObjRecCblsData()
+{
+    dumpDec< sal_uInt16 >( "state", "OBJ-CHECKBOX-STATE" );
+    dumpUnicode( "accelerator" );
+    dumpUnicode( "fareast-accelerator" );
+    dumpHex< sal_uInt16 >( "checkbox-flags", "OBJ-CHECKBOX-FLAGS" );
+}
+
+void WorkbookStreamObject::dumpObjRecLbsData()
+{
+    dumpObjRecFmla( "source-range", dumpDec< sal_uInt16 >( "source-range-size" ) );
+    dumpDec< sal_uInt16 >( "entry-count" );
+    dumpDec< sal_uInt16 >( "selected-entry" );
+    dumpHex< sal_uInt16 >( "listbox-flags", "OBJ-LISTBOX-FLAGS" );
+    dumpDec< sal_uInt16 >( "edit-obj-id" );
+}
+
+void WorkbookStreamObject::dumpObjRecPadding()
+{
+    if( getBiffStream().tell() & 1 )
+    {
+        IndentGuard aIndGuard( out() );
+        dumpHex< sal_uInt8 >( "padding" );
+    }
+}
+
+void WorkbookStreamObject::dumpObjRecString( const String& rName, sal_uInt16 nTextLen, bool bRepeatLen )
+{
+    if( nTextLen > 0 )
+    {
+        if( bRepeatLen )
+            dumpByteString( rName, BIFF_STR_8BITLENGTH );
+        else
+            writeStringItem( rName, getBiffStream().readCharArray( nTextLen, getBiffData().getTextEncoding() ) );
+        dumpObjRecPadding();
+    }
+}
+
+void WorkbookStreamObject::dumpObjRecTextFmt( sal_uInt16 nFormatSize )
+{
+    BinFontPortionList aPortions;
+    aPortions.importPortions( getBiffStream(), nFormatSize / 8, BIFF_FONTPORTION_OBJ );
+    writeFontPortions( aPortions );
+}
+
+void WorkbookStreamObject::dumpObjRecFmlaRaw()
+{
+    sal_uInt16 nFmlaSize = dumpDec< sal_uInt16 >( "fmla-size" );
+    dumpUnused( 4 );
+    getFormulaDumper().dumpNameFormula( "fmla", nFmlaSize );
+    dumpObjRecPadding();
+}
+
+void WorkbookStreamObject::dumpObjRecFmla( const String& rName, sal_uInt16 nFmlaSize )
+{
+    BiffInputStream& rStrm = getBiffStream();
+    if( nFmlaSize > 0 )
+    {
+        writeEmptyItem( rName );
+        IndentGuard aIndGuard( out() );
+        sal_Int64 nStrmEnd = rStrm.tell() + nFmlaSize;
+        dumpObjRecFmlaRaw();
+        if( rStrm.isEof() || (rStrm.tell() != nStrmEnd) )
+            writeEmptyItem( OOX_DUMP_ERRASCII( "fmla-size" ) );
+        dumpRemainingTo( nStrmEnd );
+    }
+}
+
+void WorkbookStreamObject::dumpObjRecPictFmla( sal_uInt16 nFmlaSize )
+{
+    BiffInputStream& rStrm = getBiffStream();
+    if( nFmlaSize > 0 )
+    {
+        writeEmptyItem( "pic-link" );
+        IndentGuard aIndGuard( out() );
+        sal_Int64 nStrmEnd = rStrm.tell() + nFmlaSize;
+        if( (getBiff() == BIFF3) && (nStrmEnd & 1) ) ++nStrmEnd; // BIFF3 size without padding
+        dumpObjRecFmlaRaw();
+        if( rStrm.tell() + 2 <= nStrmEnd )
+        {
+            dumpString( "class-name", BIFF_STR_DEFAULT, BIFF_STR_SMARTFLAGS );
+            dumpObjRecPadding();
+        }
+        if( rStrm.isEof() || (rStrm.tell() != nStrmEnd) )
+            writeEmptyItem( OOX_DUMP_ERRASCII( "pic-link-size" ) );
+        dumpRemainingTo( nStrmEnd );
+    }
 }
 
 // ============================================================================
 
-PivotCacheStreamObject::PivotCacheStreamObject( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, BinaryInputStreamRef xStrm )
+PivotCacheStreamObject::PivotCacheStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName )
 {
-    RecordStreamObject::construct( rParent, rOutFileName, xStrm, BIFF8 );
+    RecordStreamObject::construct( rParent, rxStrm, BIFF8, rSysFileName );
 }
 
-void PivotCacheStreamObject::implDumpRecord()
+void PivotCacheStreamObject::implDumpRecordBody()
 {
     BiffInputStream& rStrm = getBiffStream();
     sal_uInt16 nRecId = rStrm.getRecId();
@@ -3132,7 +3484,7 @@ void PivotCacheStreamObject::implDumpRec
             dumpDec< sal_uInt16 >( "group-items" );
             dumpDec< sal_uInt16 >( "base-items" );
             dumpDec< sal_uInt16 >( "original-items" );
-            if( rStrm.getRecLeft() >= 3 )
+            if( rStrm.getRemaining() >= 3 )
                 dumpUniString( "item-name" );
         break;
 
@@ -3147,39 +3499,63 @@ void PivotCacheStreamObject::implDumpRec
 
 RootStorageObject::RootStorageObject( const DumperBase& rParent )
 {
-    RootStorageObjectBase::construct( rParent );
+    OleStorageObject::construct( rParent );
+    addPreferredStream( "Book" );
+    addPreferredStream( "Workbook" );
 }
 
-void RootStorageObject::implDumpStream( BinaryInputStreamRef xStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSystemFileName )
+void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
 {
-    if( rStrgPath.getLength() == 0 )
-    {
-        if( (rStrmName == CREATE_OUSTRING( "Book" )) || (rStrmName == CREATE_OUSTRING( "Workbook" )) )
-            WorkbookStreamObject( *this, rSystemFileName, xStrm ).dump();
-        else if( (rStrmName == CREATE_OUSTRING( "\005SummaryInformation" )) || (rStrmName == CREATE_OUSTRING( "\005DocumentSummaryInformation" )) )
-            OlePropertyStreamObject( *this, rSystemFileName, xStrm ).dump();
+    if( (rStrgPath.getLength() == 0) && (rStrmName.equalsAscii( "Book" ) || rStrmName.equalsAscii( "Workbook" )) )
+        WorkbookStreamObject( *this, rxStrm, rSysFileName ).dump();
+    else if( rStrgPath.equalsAscii( "_SX_DB_CUR" ) )
+        PivotCacheStreamObject( *this, rxStrm, rSysFileName ).dump();
         else
-            InputStreamObject( *this, rSystemFileName, xStrm ).dump();
+        OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
     }
-    else if( rStrgPath == CREATE_OUSTRING( "_SX_DB_CUR" ) )
+
+void RootStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
     {
-        PivotCacheStreamObject( *this, rSystemFileName, xStrm ).dump();
-    }
+    if( rStrgPath.equalsAscii( "_VBA_PROJECT_CUR" ) )
+        VbaProjectStorageObject( *this, rxStrg, rSysPath ).dump();
+    else
+        OleStorageObject::implDumpStorage( rxStrg, rStrgPath, rSysPath );
 }
 
 // ============================================================================
 // ============================================================================
 
+#define DUMP_BIFF_CONFIG_ENVVAR "OOO_BIFFDUMPER"
+
 Dumper::Dumper( const FilterBase& rFilter )
 {
-    ConfigRef xCfg( new Config( "OOO_BIFFDUMPER" ) );
-    DumperBase::construct( rFilter, xCfg );
+    ConfigRef xCfg( new Config( DUMP_BIFF_CONFIG_ENVVAR, rFilter ) );
+    DumperBase::construct( xCfg );
+}
+
+Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName )
+{
+    if( rxFactory.is() && rxInStrm.is() )
+    {
+        StorageRef xStrg( new OleStorage( rxFactory, rxInStrm, true ) );
+        ConfigRef xCfg( new Config( DUMP_BIFF_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName ) );
+        DumperBase::construct( xCfg );
+    }
 }
 
 void Dumper::implDump()
 {
-    WorkbookStreamObject( *this, getFilter().getFileUrl() + CREATE_OUSTRING( ".dump" ), getRootStream() ).dump();
-    RootStorageObject( *this ).dump();
+    RootStorageObject aRootStrg( *this );
+    if( aRootStrg.isValid() )
+    {
+        aRootStrg.dump();
+    }
+    else if( StorageBase* pRootStrg = cfg().getRootStorage().get() )
+    {
+        // try to dump plain BIFF stream
+        BinaryInputStreamRef xStrm( new BinaryXInputStream( pRootStrg->openInputStream( OUString() ), false ) );
+        WorkbookStreamObject( *this, xStrm, cfg().getSysFileName() ).dump();
+    }
 }
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/biffdumper.ini /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/biffdumper.ini
--- oox/source/dump/biffdumper.ini	1970-01-01 01:00:00.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/biffdumper.ini	2008-09-30 16:51:36.000000000 +0200
@@ -0,0 +1,1818 @@
+﻿
+# dumper settings ============================================================
+
+# Path to additional configuration data, relative to this file.
+include-config-file=dumperbase.ini
+include-config-file=dffdumper.ini
+include-config-file=oledumper.ini
+
+# Enable entire dumper (default=off). This option does not affect the option
+# 'enable-import'.
+#   0=off, 1=on, missing: setting from dumperbase.ini
+# enable-dumper=1
+
+# Enable import after dumping (default=on). Disabling this option allows
+# to dump a file without loading it. This option is independent from the
+# 'enable-dumper' option.
+#   0=off, 1=on, missing: setting from dumperbase.ini
+# enable-import=1
+
+# BIFF record settings -------------------------------------------------------
+
+# Merge CONTINUE records with leading record (default=on).
+#   0=off - show CONTINUE records separately (hex dump)
+#   1=on  - show contents of leading record together with following CONTINUE
+merge-continue-record=1
+
+# name lists =================================================================
+
+# common ---------------------------------------------------------------------
+
+unitconverter=CONV-PERCENT-NEG,-1,%
+unitconverter=CONV-COLWIDTH,/256,chars
+
+shortlist=BIFF,0,biff2,biff3,biff4,biff5,biff8
+
+constlist=ERRORCODES
+  0x00=#NULL!
+  0x07=#DIV/0!
+  0x0F=#VALUE!
+  0x17=#REF!
+  0x1D=#NAME?
+  0x24=#NUM!
+  0x2A=#N/A
+end
+
+shortlist=EGA-COLORS,0,ega-black,ega-white,ega-red,ega-green,ega-blue,ega-yellow,ega-magenta,ega-cyan
+
+constlist=COLORS-BIFF2
+  include=EGA-COLORS
+  default=
+  24=sys-window-text
+  25=sys-window-bg
+  0x7FFF=sys-window-text
+end
+
+constlist=COLORS-BIFF5
+  include=EGA-COLORS
+  default=
+  64=sys-window-text
+  65=sys-window-bg
+  67=sys-button-face
+  77=sys-window-text-chart
+  78=sys-window-bg-chart
+  79=auto-border-chart
+  80=sys-tooltip-bg
+  81=sys-tooltip-text
+  0x7FFF=sys-window-text
+end
+
+shortlist=BORDERSTYLES-BIFF3,0,none,thin,medium,dash,dot,thick,double,hair
+
+multilist=BORDERSTYLES-BIFF8
+  include=BORDERSTYLES-BIFF3
+  8=medium-dash,thin-dash-dot,medium-dash-dot,thin-dash-dot-dot,medium-dash-dot-dot,slant-dash-dot
+end
+
+multilist=FILLPATTERNS-BIFF3
+  0=no-fill,solid-fill,50%-grey,75%-grey,25%-grey
+  5=hor-stripe,ver-stripe,rev-diag-stripe,diag-stripe,diag-crosshatch
+  10=thick-diag-crosshatch,thin-hor-stripe,thin-ver-stripe,thin-rev-diag-stripe,thin-diag-stripe
+  15=thin-hor-crosshatch,thin-diag-crosshatch,12.5%-grey,6.25%-grey
+end
+
+shortlist=TEXTORIENTATION,0,horizontal,stacked,90°-ccw,90°-cw
+
+constlist=TEXTROTATION-BIFF8
+  default=
+  255=stacked
+end
+
+multilist=BUILTIN-FORMATS
+  quote-names=1
+  0=General,0,0.00,'#,##0','#,##0.00'
+  5='"$"#,##0_);\("$"#,##0\)','"$"#,##0_);[Red]\("$"#,##0\)','"$"#,##0.00_);\("$"#,##0.00\)','"$"#,##0.00_);[Red]\("$"#,##0.00\)',0%
+  10=0.00%,0.00E+00,# ?/?,# ??/??,M/D/YYYY
+  15=D-MMM-YY,D-MMM,MMM-YY,h:mm AM/PM,h:mm:ss AM/PM
+  20=h:mm,h:mm:ss,M/D/YYYY h:mm,General,General
+  25=General,General,M/D/YYYY,M/D/YYYY,M/D/YYYY
+  30=M/D/YYYY,M/D/YYYY,h:mm:ss,h:mm:ss,h:mm:ss
+  35=h:mm:ss,M/D/YYYY,'#,##0_);(#,##0)','#,##0_);[Red](#,##0)','#,##0.00_);(#,##0.00)'
+  40='#,##0.00_);[Red](#,##0.00)'
+  41='_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)'
+  42='_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_)'
+  43='_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)'
+  44='_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)'
+  45=mm:ss,[h]:mm:ss,mm:ss.0,##0.0E+0,@
+  50=M/D/YYYY,M/D/YYYY,M/D/YYYY,M/D/YYYY,M/D/YYYY
+  55=M/D/YYYY,M/D/YYYY,M/D/YYYY,M/D/YYYY,0
+  60=0.00,'#,##0','#,##0.00','$#,##0_);($#,##0)','$#,##0_);[Red]($#,##0)'
+  65='$#,##0.00_);($#,##0.00)','$#,##0.00_);[Red]($#,##0.00)',0%,0.00%,# ?/?
+  70=# ??/??,M/D/YYYY,M/D/YYYY,D-MMM-YY,D-MMM
+  75=MMM-YY,h:mm,h:mm:ss,M/D/YYYY h:mm,mm:ss
+  80=[h]:mm:ss,mm:ss.0
+end
+
+constlist=CONSTVALUE-TYPE
+  0=empty
+  1=number
+  2=string
+  4=boolean
+  16=error
+end
+
+# DFF ------------------------------------------------------------------------
+
+flagslist=DFF-CLIENTANCHOR-FLAGS
+  0x0001=pos-locked
+  0x0002=size-locked
+end
+
+# formulas -------------------------------------------------------------------
+
+multilist=BASETOKENS-BIFF2
+  0x00=,tExp,tTbl,tAdd,tSub,tMul,tDiv,tPower
+  0x08=tConcat,tLT,tLE,tEQ,tGE,tGT,tNE,tIsect
+  0x10=tList,tRange,tUplus,tUminus,tPercent,tParen,tMissArg,tStr
+  0x18=,tAttr,tSheet,tEndSheet,tErr,tBool,tInt,tNum
+end
+
+constlist=BASETOKENS-BIFF5
+  include=BASETOKENS-BIFF2
+  exclude=0x1A,0x1B
+end
+
+constlist=BASETOKENS-BIFF8
+  include=BASETOKENS-BIFF5
+  0x18=tNlr
+end
+
+constlist=TOKENCLASSES
+  0x20=R
+  0x40=V
+  0x60=A
+end
+
+multilist=CLASSTOKENS-BIFF2
+  0x00=tArray,tFunc,tFuncVar,tName,tRef,tArea,tMemArea,tMemErr
+  0x08=tMemNoMem,tMemFunc,tRefErr,tAreaErr,tRefN,tAreaN,tMemAreaN,tMemNoMemN
+  0x18=tFuncCE
+end
+
+constlist=CLASSTOKENS-BIFF4
+  include=CLASSTOKENS-BIFF2
+  exclude=0x18
+end
+
+multilist=CLASSTOKENS-BIFF5
+  include=CLASSTOKENS-BIFF4
+  0x19=tNameX,tRef3d,tArea3d,tRefErr3d,tAreaErr3d
+end
+
+combilist=FUNCID
+  0x7FFF=uint16,dec,func-id
+  0x8000=command
+end
+
+combilist=PARAMCOUNT-CMD
+  0x7F=uint8,dec,count
+  0x80=prompt
+end
+
+combilist=REFRELFLAGS
+  0x3FFF=uint16,dec,value
+  0x4000=col-rel
+  0x8000=row-rel
+end
+
+multilist=NLRTYPES
+  0x00=,tNlrErr,tNlrRowR,tNlrColR,,,tNlrRowV,tNlrColV
+  0x08=,,tNlrRange,tNlrSRange,tNlrSRowR,tNlrSColR,tNlrSRowV,tNlrSColV
+  0x10=tNlrRangeErr,,,,,,,
+  0x18=,,,,,tNlrSxName,,
+end
+
+combilist=NLRADDFLAGS
+  0x3FFFFFFF=uint32,dec,count
+  0x80000000=rel
+end
+
+flagslist=ATTRTYPES
+  0x01=volatile
+  0x02=if
+  0x04=choose
+  0x08=skip
+  0x10=sum
+  0x20=assign
+  0x40=space
+end
+
+shortlist=ATTRSPACETYPES,0,space-before-token,cr-before-token,space-before-open,cr-before-open,space-before-close,cr-before-close,leading-space
+
+# record names ---------------------------------------------------------------
+
+multilist=RECORD-NAMES-BIFF2
+  # worksheet records
+  0x0000=DIMENSION,BLANK,INTEGER,NUMBER,LABEL,BOOLERR,FORMULA,STRING
+  0x0008=ROW,BOF,EOF,INDEX,CALCCOUNT,CALCMODE,PRECISION,REFMODE
+  0x0010=DELTA,ITERATION,PROTECT,PASSWORD,HEADER,FOOTER,EXTERNCOUNT,EXTERNSHEET
+  0x0018=DEFINEDNAME,WINDOWPROTECT,VERTICALPAGEBREAKS,HORIZONTALPAGEBREAKS,NOTE,SELECTION,FORMAT,BUILTINFMTCOUNT
+  0x0020=COLUMNDEFAULT,ARRAY,DATEMODE,EXTERNALNAME,COLWIDTH,DEFAULTROWHEIGHT,LEFTMARGIN,RIGHTMARGIN
+  0x0028=TOPMARGIN,BOTTOMMARGIN,PRINTHEADERS,PRINTGRIDLINES,,,,FILEPASS
+  0x0030=,FONT,FONT2,PRINTSIZE,,INFOOPTS,DATATABLE,DATATABLE2
+  0x0038=WNDESK,,BEGINPREF,ENDPREF,CONTINUE,WINDOW1,WINDOW2,
+  0x0040=BACKUP,PANE,CODEPAGE,XF,IXFE,EFONT,SHOWSCROLL,SHOWFORMULA
+  0x0048=STATUSBAR,SHORTMENUS,DDEENABLED,AUTODEC,MENUKEY,PLS|ZOOM,MENUUND,MOVESEL
+  0x0050=DCON,DCONREF,DCONNAME,,,DEFCOLWIDTH,,
+  # worksheet records new in BIFF3, but supported in BIFF2 streams
+  0x0200=DIMENSION,BLANK,,NUMBER,LABEL,BOOLERR,,
+  0x027E=RK
+  # BIFF5 style BOF
+  0x0809=BOF
+  # chart records
+  0x1000=,CHUNITS,CHCHART,CHSERIES,CHSOURCELINK,,CHDATAFORMAT,CHLINEFORMAT
+  0x1008=,CHMARKERFORMAT,CHAREAFORMAT,CHPIEFORMAT,CHATTACHEDLABEL,CHSTRING,,
+  0x1010=,,,,CHTYPEGROUP,CHLEGEND,CHSERIESLIST,CHBAR
+  0x1018=CHLINE,CHPIE,CHAREA,CHSCATTER,CHCHARTLINE,CHAXIS,CHTICK,CHVALUERANGE
+  0x1020=CHLABELRANGE,CHAXISLINE,CHFORMATLINK,,CHDEFAULTTEXT,CHTEXT,CHFONT,CHOBJECTLINK
+  0x1028=,,,,,CHARROW,,CHARROWHEAD
+  0x1030=,,CHFRAME,CHBEGIN,CHEND,CHPLOTFRAME,CHCHARTSIZE,CHRELPOSITION
+  0x1038=CHARROWRELPOS,,CHCHART3D,,,,,
+end
+
+multilist=RECORD-NAMES-BIFF3
+  include=RECORD-NAMES-BIFF2
+  # worksheet records
+  exclude=0x0006,0x0008,0x0009,0x000B,0x0018,0x0020,0x0021,0x0023,0x0024,0x0025,0x0031,0x0036,0x0037,0x003E,0x0043,0x0044,0x0045
+  0x0050=,,,,,,BUILTINFMTCOUNT,
+  0x0058=TOOLBAR,XCT,CRN,FILESHARING,WRITEACCESS,OBJ,UNCALCED,SAFERECALC
+  0x0060=TEMPLATE,INTL,,OBJECTPROTECT,,,,
+  0x0068=,,,,,,,
+  0x0070=,,,,,,,
+  0x0078=,,,,,COLINFO,,IMGDATA
+  0x0080=GUTS,SHEETPR,GRIDSET,HCENTER,VCENTER,,WRITEPROT,ADDIN
+  0x0088=EDG,PUB,NOTEOFF,LH,COUNTRY,HIDEOBJ,,
+  0x0090=SORT,SUB,PALETTE,,LHRECORD,LHNGRAPH,,
+  0x0200=,,,,,,FORMULA,STRING
+  0x0208=ROW,BOF,,INDEX,,,,
+  0x0218=DEFINEDNAME
+  0x0221=ARRAY
+  0x0223=EXTERNALNAME
+  0x0225=DEFAULTROWHEIGHT
+  0x0231=FONT
+  0x0236=DATATABLE
+  0x023E=WINDOW2
+  0x0243=XF
+  0x0293=STYLE
+  # chart records
+  0x103C=CHPICFORMAT
+end
+
+multilist=RECORD-NAMES-BIFF4
+  include=RECORD-NAMES-BIFF3
+  # worksheet/workbook records
+  exclude=0x0206,0x0209,0x001E,0x0243
+  0x0085=SHEET
+  0x0088=,,,,,,SHEETSOFFSET,SHEETHEADER
+  0x0090=,,,,,SOUND,SYNC
+  0x0098=LPR,STANDARDWIDTH,FNGROUPNAME,,FNGROUPCOUNT,,,
+  0x00A0=SCL,PAGESETUP,FNPROTO,PROJEXTSHEET,,,,
+  0x00A8=DRAGDROP,COORDLIST,,GCW,,,,
+  0x0406=FORMULA
+  0x0409=BOF
+  0x041E=FORMAT
+  0x0443=XF
+  # chart records
+  0x1038=,,,CHMULTILINK,,CHDROPBAR,CHRADARLINE,CHSURFACE
+end
+
+multilist=RECORD-NAMES-BIFF5
+  include=RECORD-NAMES-BIFF4
+  # worksheet/workbook records
+  exclude=0x0409,0x0218,0x0223,0x0231,0x0443
+  0x0006=FORMULA
+  0x0018=DEFINEDNAME
+  0x0023=EXTERNALNAME
+  0x0031=FONT
+  0x0098=,,,FILTERMODE,,AUTOFILTERINFO,AUTOFILTER,
+  0x00A8=,,,,,,SCENMAN,SCENARIO
+  0x00B0=SXVIEW,SXVD,SXVI,,SXIVD,SXLI,SXPI,
+  0x00B8=DOCROUTE,RECIPNAME,,,SHAREDFMLA,MULTRK,MULTBLANK,
+  0x00C0=,MMS,ADDMENU,DELMENU,,SXDI,SXDB,SXFIELD
+  0x00C8=SXINDEXLIST,SXDOUBLE,SXBOOLEAN,SXERROR,SXINTEGER,SXSTRING,SXDATETIME,SXEMPTY
+  0x00D0=SXTBL,SXTBRGITEM,SXTBPG,OBPROJ,,SXIDSTM,RSTRING,DBCELL
+  0x00D8=SXNUMGROUP,SXGROUPINFO,BOOKBOOL,REVERT,SXEXT|PARAMQRY,SCENPROTECT,OLESIZE,UDDESC
+  0x00E0=XF,INTERFACEHDR,INTERFACEEND,SXVS,,,,
+  0x0206=FORMULA
+  # chart records
+  exclude=0x1004,0x102D,0x102F,0x1036,0x1037,0x1038,0x103B
+  0x1040=CHRADARAREA,CHAXESSET,,CHLEGENDENTRY,CHPROPERTIES,CHSERGROUP,CHUSEDAXESSETS,
+  0x1048=CHPIVOTREF,,CHSERPARENT,CHSERTRENDLINE,,,CHFORMAT,CHPOS
+  0x1050=CHFORMATRUNS,CHSOURCELINK,,,,,,
+  0x1058=,,,CHSERERRORBAR,,CHSERIESFORMAT,,
+end
+
+multilist=RECORD-NAMES-BIFF8
+  include=RECORD-NAMES-BIFF5
+  # worksheet/workbook records
+  0x00E0=,,,,,CELLMERGING,,
+  0x00E8=,IMGDATA,,MSODRAWINGGROUP,MSODRAWING,MSODRAWINGSELECTION,,PHONETICPR
+  0x00F0=SXRULE,SXEX,SXFILT,,,,SXNAME,SXSELECT
+  0x00F8=SXPAIR,SXFMLA,,SXFORMAT,SST,LABELSST,,EXTSST
+  0x0100=SXVDEX,,,SXFORMULA,,,,
+  0x0120=,,SXDBEX,,,,,
+  0x0130=,,,,,,,CHTRINSERT
+  0x0138=CHTRINFO,,,CHTRCELLCONTENT,,TABID,,
+  0x0140=CHTRMOVERANGE,,,,,,,
+  0x0148=,,,,,CHTRINSERTTAB,,
+  0x0158=,,,,,,,LABELRANGES
+  0x0160=USESELFS,DSF,XL5MODIFY,,,,,
+  0x0190=,,,,,,CHTRHEADER,
+  0x01A8=,USERBVIEW,USERSVIEWBEGIN,USERSVIEWEND,,QSI,EXTERNALBOOK,PROT4REV
+  0x01B0=CFHEADER,CFRULE,DATAVALIDATIONS,,,DCONBIN,TXO,REFRESHALL
+  0x01B8=HYPERLINK,NLRDELNAME,CODENAME,SXFDBTYPE,PROT4REVPASS,,DATAVALIDATION,
+  0x0800=SCREENTIP,,,WEBQRYSETTINGS,WEBQRYTABLES,,,
+  0x0850=,CHWRAPPEDRECORD,,,,,,CHUNITPROPERTIES
+  0x0858=CHPIVOTREF,,,,,,,
+  0x0860=,,SHEETLAYOUT,,,,,SHEETPROTECTION
+  # chart records
+  0x1058=,,,,,,,CH3DDATAFORMAT
+  0x1060=CHFONTBASE,CHPIEEXT,CHLABELRANGE2,CHDATATABLE,CHPLOTGROWTH,CHSERINDEX,CHESCHERFORMAT,CHPIEEXTSETT
+end
+
+# simple records -------------------------------------------------------------
+
+constlist=SIMPLE-RECORDS-BIFF2
+  0x000C=uint16,dec,max-iterations
+  0x000D=int16,dec,calc-mode,CALCMODE
+  0x000E=uint16,bool,calc-precise
+  0x000F=uint16,dec,ref-mode,REFMODE
+  0x0010=double,dec,epsilon
+  0x0011=uint16,bool,iterate-recursive
+  0x0012=uint16,bool,contents-protected
+  0x0013=uint16,hex,password-hash
+  0x0016=uint16,dec,externsheets
+  0x0019=uint16,bool,window-protected
+  0x001F=uint16,dec,builtin-fmt-count
+  0x0022=uint16,dec,null-date,DATEMODE
+  0x0025=uint16,hex,rowheight-flags,DEFROWHEIGHT-FLAGS
+  0x0026=double,dec,left-margin,CONV-INCH-TO-CM
+  0x0027=double,dec,right-margin,CONV-INCH-TO-CM
+  0x0028=double,dec,top-margin,CONV-INCH-TO-CM
+  0x0029=double,dec,bottom-margin,CONV-INCH-TO-CM
+  0x002A=uint16,bool,print-sheet-headers
+  0x002B=uint16,bool,print-gridlines
+  0x0040=uint16,bool,backup-on-save
+  0x0044=uint16,dec,xf-idx
+  0x0045=uint16,dec,font-color-idx,COLORS
+  0x0055=uint16,dec,base-col-width
+  0x100B=uint16,dec,extrusion,CONV-PERCENT
+  0x100C=uint16,hex,flags,CHATTACHEDLABEL-FLAGS
+  0x1018=uint16,hex,flags,CHLINE-FLAGS
+  0x101A=uint16,hex,flags,CHAREA-FLAGS
+  0x101C=uint16,dec,line-type,CHCHARTLINE-TYPE
+  0x1021=uint16,dec,axisline-id,CHAXISLINE-ID
+  0x1024=uint16,dec,text-idx
+  0x1026=uint16,dec,font-idx,FONTNAMES
+  0x1045=uint16,dec,group-idx
+  0x1046=uint16,dec,used-axessets
+  0x104A=uint16,dec,series-idx
+  0x104E=uint16,dec,fmt-idx,FORMATS
+end
+
+constlist=SIMPLE-RECORDS-BIFF3
+  include=SIMPLE-RECORDS-BIFF2
+  0x0056=uint16,dec,builtin-fmt-count
+  0x005E=uint16,unused
+  0x005F=uint16,bool,recalc-on-save
+  0x0063=uint16,bool,objects-protected
+  0x0081=uint16,hex,flags,SHEETPR-FLAGS
+  0x0082=uint16,bool,print-gridlines-changed
+  0x0083=uint16,bool,horizontal-centered
+  0x0084=uint16,bool,vertical-centered
+  0x008D=uint16,dec,object-mode,HIDEOBJ
+end
+
+constlist=SIMPLE-RECORDS-BIFF4
+  include=SIMPLE-RECORDS-BIFF3
+  0x008E=uint32,hex,stream-pos,CONV-DEC
+  0x0099=uint16,dec,default-col-width,CONV-COLWIDTH
+  0x009C=uint16,dec,func-group-count
+  0x103D=uint16,dec,bar-dist
+  0x103E=uint16,hex,flags,CHRADAR-FLAGS
+  0x103F=uint16,hex,flags,CHSURFACE-FLAGS
+end
+
+constlist=SIMPLE-RECORDS-BIFF5
+  include=SIMPLE-RECORDS-BIFF4
+  0x00C9=double,dec,value
+  0x00CA=uint16,bool,value
+  0x00CB=uint16,hex,error-code,ERRORCODES
+  0x00CC=int16,dec,value
+  0x00D5=uint16,hex,pivotcache-stream-id
+  0x00D8=uint16,hex,flags,SXNUMGROUP-FLAGS
+  0x00DA=uint16,bool,strip-cached-values
+  0x00DD=uint16,bool,scenarios-protected
+  0x00E3=uint16,dec,source-type,SXVS-TYPE
+  0x1040=uint16,hex,flags,CHRADAR-FLAGS
+  0x105D=uint16,hex,flags,CHSERIESFORMAT-FLAGS
+end
+
+constlist=SIMPLE-RECORDS-BIFF8
+  include=SIMPLE-RECORDS-BIFF5
+  0x00E1=uint16,dec,codepage,CODEPAGES
+  0x0160=uint16,bool,use-nat-lang-refs
+  0x0161=uint16,bool,double-stream
+  0x01AF=uint16,bool,revlog-protected
+  0x01B7=uint16,bool,refresh-all
+  0x01BB=uint16,dec,sql-data-type,SXFDBTYPE-DATATYPE
+  0x01BC=uint16,hex,password-hash
+  0x1065=uint16,dec,series-idx
+end
+
+# ARRAY ----------------------------------------------------------------------
+
+flagslist=ARRAY-FLAGS-BIFF2
+  0x0001=recalc-always
+end
+
+flagslist=ARRAY-FLAGS-BIFF3
+  include=ARRAY-FLAGS-BIFF2
+  0x0002=recalc-onload
+end
+
+# BOF ------------------------------------------------------------------------
+
+constlist=BOF-BIFFTYPE
+  0x0000=from-id
+  0x0007=biff2
+  0x0200=biff2
+  0x0300=biff3
+  0x0400=biff4
+  0x0500=biff5
+  0x0600=biff8
+end
+
+constlist=BOF-SHEETTYPE
+  0x0005=globals
+  0x0006=vb-module
+  0x0010=sheet
+  0x0020=chart
+  0x0040=macro
+  0x0100=workspace
+end
+
+flagslist=BOF-HISTORY-FLAGS
+  0x00000001=windows
+  0x00000002=risc
+  0x00000004=beta
+  0x00000008=win-any
+  0x00000010=mac-any
+  0x00000020=beta-any
+  0x00000100=risc-any
+  # missing mac here?
+end
+
+# CALCMODE -------------------------------------------------------------------
+
+shortlist=CALCMODE,-1,automatic-no-table,manual,automatic
+
+# CFRULE ---------------------------------------------------------------------
+
+shortlist=CFRULE-TYPE,1,value,formula
+shortlist=CFRULE-OPERATOR,0,none,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
+
+flagslist=CFRULE-FLAGS
+  ignore=0x00380080
+  0x00000001=!hor-align-used
+  0x00000002=!vert-align-used
+  0x00000004=!text-wrap-used
+  0x00000008=!rotation-used
+  0x00000010=!justify-lastline-used
+  0x00000020=!indent-used
+  0x00000040=!shrinktofit-used
+  0x00000100=!cell-locked-used
+  0x00000200=!cell-hidden-used
+  0x00000400=!left-border-used
+  0x00000800=!right-border-used
+  0x00001000=!top-border-used
+  0x00002000=!bottom-border-used
+  0x00004000=!tl-to-br-used
+  0x00008000=!bl-to-tr-used
+  0x00010000=!fill-pattern-used
+  0x00020000=!fg-color-idx-used
+  0x00040000=!bg-color-idx-used
+  0x04000000=font-block
+  0x08000000=alignment-block
+  0x10000000=border-block
+  0x20000000=pattern-block
+  0x40000000=protection-block
+  0x80000000=!text-dir-used
+end
+
+combilist=CFRULE-ALIGNMENT
+  0x07=uint8,dec,hor-align,XF-HORALIGN
+  0x08=text-wrap
+  0x70=uint8,dec,ver-align,XF-VERALIGN
+  0x80=justify-lastline
+end
+
+combilist=CFRULE-INDENT
+  0x000F=uint8,dec,indent
+  0x0010=shrink-to-fit
+  0x00C0=uint8,dec,text-dir,XF-TEXTDIRECTION
+end
+
+flagslist=CFRULE-FONTFLAGS
+  0x00000002=italic
+  0x00000008=outline
+  0x00000010=shadow
+  0x00000020=condense
+  0x00000040=extend
+  0x00000080=strikeout
+end
+
+flagslist=CFRULE-FONTUSEDFLAGS
+  0x00000002=!italic-used
+  0x00000008=!outline-used
+  0x00000010=!shadow-used
+  0x00000020=!condense-used
+  0x00000040=!extend-used
+  0x00000080=!strikeout-used
+end
+
+constlist=CFRULE-FONTUSED
+  0=used
+  1=not-used
+end
+
+combilist=CFRULE-BORDERCOLOR2
+  0x0000007F=uint8,dec,top-color,COLORS
+  0x00003F80=uint8,dec,bottom-color,COLORS
+  0x001FC000=uint8,dec,diag-color,COLORS
+  0x01E00000=uint8,dec,diag-style,BORDERSTYLES
+end
+
+combilist=CFRULE-FILLBLOCK
+  0x0000FC00=uint8,dec,fill-pattern,FILLPATTERNS
+  0x007F0000=uint8,dec,fg-color-idx,COLORS
+  0x3F800000=uint8,dec,bg-color-idx,COLORS
+end
+
+flagslist=CFRULE-PROTECTION-FLAGS
+  0x0001=locked
+  0x0002=formula-hidden
+end
+
+# CH3DDATAFORMAT -------------------------------------------------------------
+
+shortlist=CH3DDATAFORMAT-BASE,0,rectangular,circular
+shortlist=CH3DDATAFORMAT-TOP,0,straight,sharp,trunc
+
+# CHAREA ---------------------------------------------------------------------
+
+flagslist=CHAREA-FLAGS
+  0x0001=stacked
+  0x0002=percent
+  0x0004=shadow
+end
+
+# CHAREAFORMAT ---------------------------------------------------------------
+
+flagslist=CHAREAFORMAT-FLAGS
+  0x0001=auto
+  0x0002=swap-negative
+end
+
+# CHATTACHEDLABEL ------------------------------------------------------------
+
+flagslist=CHATTACHEDLABEL-FLAGS
+  0x0001=show-value
+  0x0002=show-percent
+  0x0004=show-categ-percent
+  0x0008=smoothed
+  0x0010=show-categ
+  0x0020=show-bubble
+end
+
+# CHAXESSET ------------------------------------------------------------------
+
+shortlist=CHAXESSET-ID,0,primary,secondary
+
+# CHAXIS ---------------------------------------------------------------------
+
+shortlist=CHAXIS-TYPE,0,x-axis,y-axis,z-axis
+
+# CHAXISLINE -----------------------------------------------------------------
+
+shortlist=CHAXISLINE-ID,0,axisline,major-grid,minor-grid,wall
+
+# CHBAR ----------------------------------------------------------------------
+
+flagslist=CHBAR-FLAGS
+  0x0001=horizontal
+  0x0002=stacked
+  0x0004=percent
+  0x0008=shadow
+end
+
+# CHCHART3D ------------------------------------------------------------------
+
+flagslist=CHCHART3D-FLAGS
+  ignore=0x0010
+  0x0001=real3d
+  0x0002=clustered
+  0x0004=auto-height
+  0x0020=2d-plotarea
+end
+
+# CHTYPEGROUP ----------------------------------------------------------------
+
+flagslist=CHTYPEGROUP-FLAGS
+  0x0001=varied-colors
+end
+
+# CHCHARTLINE ----------------------------------------------------------------
+
+shortlist=CHCHARTLINE-TYPE,0,drop-line,hi-lo-line,series-connector
+
+# CHDATAFORMAT ---------------------------------------------------------------
+
+constlist=CHDATAFORMAT-POINTIDX
+  default=
+  -1=all-points
+end
+
+constlist=CHDATAFORMAT-FORMATIDX
+  default=
+  -3=axesset-global
+end
+
+flagslist=CHDATAFORMAT-FLAGS
+  0x0001=excel4-colors
+end
+
+# CHFRAME --------------------------------------------------------------------
+
+shortlist=CHFRAME-FORMAT,0,standard,,,,shadow
+
+flagslist=CHFRAME-FLAGS
+  0x0001=auto-size
+  0x0002=auto-pos
+end
+
+# CHFRAMEPOS -----------------------------------------------------------------
+
+shortlist=CHFRAMEPOS-OBJTYPE,2,any,,,legend
+shortlist=CHFRAMEPOS-SIZEMODE,1,manual,auto
+
+# CHLABELRANGE ---------------------------------------------------------------
+
+flagslist=CHLABELRANGE-FLAGS
+  0x0001=cross-between-categ
+  0x0002=maximum-axis-cross
+  0x0004=reverse-order
+end
+
+# CHLABELRANGE2 --------------------------------------------------------------
+
+flagslist=CHLABELRANGE2-FLAGS
+  0x0001=auto-minimum
+  0x0002=auto-maximum
+  0x0004=auto-major
+  0x0008=auto-minor
+  0x0010=date-axis
+  0x0020=auto-base
+  0x0040=auto-axis-cross
+  0x0080=auto-date
+end
+
+# CHLEGEND -------------------------------------------------------------------
+
+shortlist=CHLEGEND-DOCKPOS,0,bottom,top-left,top,right,left,,,manual
+shortlist=CHLEGEND-SPACING,0,close,medium,open
+
+flagslist=CHLEGEND-FLAGS
+  0x0001=docked
+  0x0002=auto-series
+  0x0004=auto-pos-x
+  0x0008=auto-pos-y
+  0x0010=stacked
+  0x0020=data-table
+end
+
+# CHLINE ---------------------------------------------------------------------
+
+flagslist=CHLINE-FLAGS
+  0x0001=stacked
+  0x0002=percent
+  0x0004=shadow
+end
+
+# CHLINEFORMAT ---------------------------------------------------------------
+
+shortlist=CHLINEFORMAT-LINETYPE,0,solid,dash,dot,dash-dot,dash-dot-dot,none,25%-pattern,50%-pattern,75%-pattern
+shortlist=CHLINEFORMAT-LINEWEIGHT,-1,hair,thin,medium,thick
+
+flagslist=CHLINEFORMAT-FLAGS
+  0x0001=auto
+  0x0004=axis-enabled
+end
+
+# CHMARKERFORMAT -------------------------------------------------------------
+
+shortlist=CHMARKERFORMAT-TYPE,0,none,square,diamond,triangle,cross,star,dow-jones,std-dev,circle,plus
+
+flagslist=CHMARKERFORMAT-FLAGS
+  0x0001=auto
+  0x0010=no-fill
+  0x0020=no-border
+end
+
+# CHOBJECTLINK ---------------------------------------------------------------
+
+shortlist=CHOBJECTLINK-TARGET,0,none,title,y-axis,x-axis,datapoint,legend,none,z-axis,,,,,axis-unit
+
+constlist=CHOBJECTLINK-POINT
+  default=
+  -2=unknown
+  -1=all-points
+end
+
+# CHPICFORMAT ----------------------------------------------------------------
+
+shortlist=CHPICFORMAT-BITMAP-MODE,1,stretched,stacked,stacked-scaled
+
+constlist=CHPICFORMAT-IMAGE-FORMAT
+  2=wmf
+  9=bmp
+  19=?emf
+end
+
+shortlist=CHPICFORMAT-ENV,1,windows,apple
+
+combilist=CHPICFORMAT-FLAGS
+  0x00FF=uint16,dec,environment,CHPICFORMAT-ENV
+  0x0100=format-only
+  0x0200=top-bottom
+  0x0400=front-back
+  0x0800=left-right
+end
+
+# CHPIE ----------------------------------------------------------------------
+
+flagslist=CHPIE-FLAGS
+  0x0001=shadow
+  0x0002=connectors
+end
+
+# CHRADAR, CHRADARAREA -------------------------------------------------------
+
+flagslist=CHRADAR-FLAGS
+  0x0001=axis-labels
+  0x0002=shadow
+end
+
+# CHPROPERTIES ---------------------------------------------------------------
+
+shortlist=CHPROPERTIES-EMPTYCELLS,0,do-not-plot,as-zero,interpolated
+
+flagslist=CHPROPERTIES-FLAGS
+  0x0001=manual-format
+  0x0002=plot-visible-only
+  0x0004=fixed-size
+  0x0008=manual-plotarea
+end
+
+# CHSCATTER ------------------------------------------------------------------
+
+shortlist=CHSCATTER-SIZETYPE,0,none,area,width
+
+flagslist=CHSCATTER-FLAGS
+  0x0001=bubbles
+  0x0002=show-negative
+  0x0004=shadow
+end
+
+# CHSERERRORBAR --------------------------------------------------------------
+
+shortlist=CHSERERRORBAR-TYPE,1,x-plus,x-minus,y-plus,y-minus
+shortlist=CHSERERRORBAR-SOURCE,1,percent,fixed,std-deviation,custom,std-error
+
+# CHSERIES -------------------------------------------------------------------
+
+shortlist=CHSERIES-TYPE,0,date,numeric,sequence,text
+
+# CHSERIESFORMAT -------------------------------------------------------------
+
+flagslist=CHSERIESFORMAT-FLAGS
+  0x0001=spline
+  0x0002=bubbles-3d
+  0x0004=shadow
+end
+
+# CHSERTRENDLINE -------------------------------------------------------------
+
+shortlist=CHSERTRENDLINE-TYPE,0,poynomial,exponential,logarithmic,power,moving-average
+
+# CHSOURCELINK ---------------------------------------------------------------
+
+shortlist=CHSOURCELINK-TARGET,0,title,values,category,bubbles
+shortlist=CHSOURCELINK-TYPE,0,default,constant,sheet-link
+
+flagslist=CHSOURCELINK-FLAGS
+  0x0001=custom-numfmt
+end
+
+# CHSTRING -------------------------------------------------------------------
+
+shortlist=CHSTRING-TYPE,0,text,category-default,value-default,x-prefix,x-postfix,y-prefix,y-postfix,comment
+
+# CHSURFACE ------------------------------------------------------------------
+
+flagslist=CHSURFACE-FLAGS
+  0x0001=filled
+  0x0002=shadow
+end
+
+# CHTEXT ---------------------------------------------------------------------
+
+shortlist=CHTEXT-HORALIGN,1,left,center,right,block,distribute
+shortlist=CHTEXT-VERALIGN,1,top,center,bottom,block,distribute
+shortlist=CHTEXT-FILLMODE,1,transparent,opaque
+
+combilist=CHTEXT-FLAGS-BIFF2
+  0x0001=auto-color
+  0x0002=show-symbol
+  0x0004=show-value
+  0x0008=vertical
+  0x0010=auto-text
+  0x0020=default-format
+  0x0040=deleted
+  0x0080=auto-fill
+end
+
+combilist=CHTEXT-FLAGS-BIFF3
+  include=CHTEXT-FLAGS-BIFF2
+  0x0700=uint8,dec,orientation,TEXTORIENTATION
+end
+
+combilist=CHTEXT-FLAGS-BIFF5
+  include=CHTEXT-FLAGS-BIFF3
+  0x0800=show-categ-percent
+  0x1000=show-percent
+end
+
+combilist=CHTEXT-FLAGS-BIFF8
+  include=CHTEXT-FLAGS-BIFF5
+  0x2000=show-bubble-size
+  0x4000=show-categ
+end
+
+multilist=CHTEXT-PLACEMENT
+  default=
+  0=context,outside,inside,center,axis,above,below,left,right,auto,manual
+end
+
+# CHTICK ---------------------------------------------------------------------
+
+shortlist=CHTICK-TYPE,0,none,inside,outside,both
+# TODO: really different label positions in BIFF2-BIFF4?
+shortlist=CHTICK-LABELPOS-BIFF2,0,none,near,below,above
+shortlist=CHTICK-LABELPOS-BIFF5,0,none,below,above,near
+
+flagslist=CHTICK-FLAGS-BIFF2
+  0x0001=auto-color
+  0x0002=auto-fill
+end
+
+combilist=CHTICK-FLAGS-BIFF3
+  include=CHTICK-FLAGS-BIFF2
+  0x001C=uint8,dec,orientation,TEXTORIENTATION
+  0x0020=auto-rotation
+end
+
+# CHUNITPROPERTIES -----------------------------------------------------------
+
+shortlist=CHUNITPROPERTIES-PRESET,-1,manual,none,hundred,thousand,(10000),(100000),million,(10million),(100million),billion,trillion
+
+flagslist=CHUNITPROPERTIES-FLAGS
+  0x0002=show-unit
+end
+
+# CHVALUERANGE ---------------------------------------------------------------
+
+flagslist=CHVALUERANGE-FLAGS
+  ignore=0x0100
+  0x0001=auto-minimum
+  0x0002=auto-maximum
+  0x0004=auto-major
+  0x0008=auto-minor
+  0x0010=auto-axis-cross
+  0x0020=logarithmic
+  0x0040=reverse-order
+  0x0080=maximum-axis-cross
+end
+
+# COLINFO --------------------------------------------------------------------
+
+combilist=COLINFO-FLAGS
+  0x0001=hidden
+  0x0002=custom-width
+  0x0004=best-fit
+  0x0008=show-phonetic
+  0x0700=uint8,dec,outline-level
+  0x1000=outline-collapsed
+end
+
+# DATATABLE ------------------------------------------------------------------
+
+flagslist=DATATABLE-FLAGS-BIFF3
+  0x0001=recalc-always
+  0x0002=recalc-on-load
+  0x0004=row-table
+  0x0008=table-2d
+end
+
+flagslist=DATATABLE-FLAGS-BIFF8
+  include=DATATABLE-FLAGS-BIFF3
+  0x0010=ref1-deleted
+  0x0020=ref2-deleted
+end
+
+# DATAVALIDATION -------------------------------------------------------------
+
+combilist=DATAVALIDATION-FLAGS
+  0x0000000F=uint8,dec,type,DATAVALIDATION-TYPE
+  0x00000070=uint8,dec,error-style,DATAVALIDATION-ERRORSTYLE
+  0x00000080=string-list
+  0x00000100=ignore-empty
+  0x00000200=no-dropdown
+  0x00040000=show-input-box
+  0x00080000=show-error-box
+  0x00F00000=uint8,dec,operator,DATAVALIDATION-OPERATOR
+end
+
+shortlist=DATAVALIDATION-TYPE,0,any,whole,decimal,list,date,time,text-length,custom
+shortlist=DATAVALIDATION-OPERATOR,0,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
+shortlist=DATAVALIDATION-ERRORSTYLE,0,error,warning,info
+
+# DATAVALIDATIONS ------------------------------------------------------------
+
+flagslist=DATAVALIDATIONS-FLAGS
+  0x0001=input-box-visible
+  0x0002=input-box-at-cell
+  0x0004=cached
+end
+
+# DATEMODE -------------------------------------------------------------------
+
+shortlist=DATEMODE,0,1899-12-31,1904-01-01
+
+# DEFINEDNAME ----------------------------------------------------------------
+
+flagslist=DEFINEDNAME-FLAGS-BIFF2
+  0x02=macro
+  0x04=complex
+end
+
+shortlist=DEFINEDNAME-MACROTYPE-BIFF2,0,none,function,procedure
+
+flagslist=DEFINEDNAME-FLAGS-BIFF3
+  0x0001=hidden
+  0x0002=function
+  0x0004=command
+  0x0008=macro
+  0x0010=complex
+  0x0020=builtin
+end
+
+combilist=DEFINEDNAME-FLAGS-BIFF4
+  include=DEFINEDNAME-FLAGS-BIFF3
+  0x0FC0=uint16,dec,func-group,DEFINEDNAME-FUNCGROUP
+end
+
+combilist=DEFINEDNAME-FLAGS-BIFF5
+  include=DEFINEDNAME-FLAGS-BIFF4
+  0x0004=vba
+  0x1000=binary
+end
+
+shortlist=DEFINEDNAME-FUNCGROUP,0,none,financial,date-time,math-trig,statistical,lookup-ref,database,text,logical,information,commands,customizing,macro-control,dde-external,user-definded
+
+constlist=DEFINEDNAME-SHEETIDX
+  default=
+  0=global
+end
+
+# DEFROWHEIGHT ---------------------------------------------------------------
+
+combilist=DEFROWHEIGHT-FLAGS-BIFF2
+  0x7FFF=uint16,dec,row-height,CONV-TWIP-TO-PT
+  0x8000=unchanged
+end
+
+flagslist=DEFROWHEIGHT-FLAGS-BIFF3
+  0x0001=custom-height
+  0x0002=hidden
+  0x0004=thick-top
+  0x0008=thick-bottom
+end
+
+# EXTERNALBOOK ---------------------------------------------------------------
+
+constlist=EXTERNALBOOK-KEY
+  0x0401=self-reference
+  0x3A01=analysis-addin
+end
+
+# EXTERNALNAME ---------------------------------------------------------------
+
+flagslist=EXTERNALNAME-FLAGS-BIFF3
+  0x0001=builtin
+  0x0002=automatic
+  0x0004=pic-link
+  0x0008=dde-stddocumentname
+end
+
+combilist=EXTERNALNAME-FLAGS-BIFF5
+  include=EXTERNALNAME-FLAGS-BIFF3
+  0x0010=ole-link
+  0x7FE0=uint16,dec,clipboard-format
+  0x8000=iconified
+end
+
+# EXTERNSHEET ----------------------------------------------------------------
+
+constlist=EXTERNSHEET-IDX-BIFF8
+  default=
+  -1=deleted
+  -2=special
+end
+
+# FONT -----------------------------------------------------------------------
+
+flagslist=FONT-FLAGS
+  0x0001=bold
+  0x0002=italic
+  0x0004=underline
+  0x0008=strikeout
+  0x0010=outline
+  0x0020=shadow
+  0x0040=condense
+  0x0080=extend
+end
+
+multilist=FONT-UNDERLINE
+  0x00=none,single,double
+  0x21=single-acc,double-acc
+end
+
+shortlist=FONT-ESCAPEMENT,0,none,superscript,subscript
+
+# FORMULA --------------------------------------------------------------------
+
+flagslist=FORMULA-FLAGS-BIFF2
+  0x0001=recalc-always
+end
+
+flagslist=FORMULA-FLAGS-BIFF3
+  include=FORMULA-FLAGS-BIFF2
+  0x0002=recalc-onload
+end
+
+flagslist=FORMULA-FLAGS-BIFF5
+  include=FORMULA-FLAGS-BIFF3
+  0x0008=shared-fmla
+end
+
+shortlist=FORMULA-RESULTTYPE,0,string,boolean,error,empty
+
+# HIDEOBJ --------------------------------------------------------------------
+
+shortlist=HIDEOBJ,0,show,placeholder,hide
+
+# IMGDATA --------------------------------------------------------------------
+
+constlist=IMGDATA-FORMAT
+  -1=none
+  2=wmf-pict
+  9=bmp
+  14=native
+end
+
+shortlist=IMGDATA-ENV,1,windows,apple
+
+# NOTE -----------------------------------------------------------------------
+
+flagslist=NOTE-FLAGS-BIFF8
+  0x0002=visible
+end
+
+# OBJ ------------------------------------------------------------------------
+
+# object types ---
+
+multilist=OBJ-TYPE-BIFF3
+  0=group,line,rectangle,oval,arc,chart,textbox,button,picture
+end
+
+multilist=OBJ-TYPE-BIFF4
+  include=OBJ-TYPE-BIFF3
+  9=polygon
+end
+
+multilist=OBJ-TYPE-BIFF5
+  include=OBJ-TYPE-BIFF4
+  10=,checkbox,optionbutton,edit,label,dialog,spin,scrollbar,listbox,groupbox
+  20=dropdown
+end
+
+multilist=OBJ-TYPE-BIFF8
+  include=OBJ-TYPE-BIFF5
+  25=note
+  30=drawing
+end
+
+# flags and constants ---
+
+flagslist=OBJ-FLAGS-BIFF3
+  0x0001=selected
+  0x0002=auto-size
+  0x0004=auto-move
+  0x0010=protected
+  0x0080=grouped
+  0x0100=hidden
+  0x0200=visible
+end
+
+flagslist=OBJ-FLAGS-BIFF4
+  include=OBJ-FLAGS-BIFF3
+  0x0400=printable
+end
+
+flagslist=OBJ-AUTO-FLAGS
+  0x01=auto
+end
+
+multilist=OBJ-LINETYPE
+  0=solid,dash,dot,dash-dot,dash-dot-dot,25%-pattern,50%-pattern,75%-pattern
+  255=none
+end
+
+shortlist=OBJ-LINEWEIGHT,0,hair,thin,medium,thick
+
+shortlist=OBJ-ARROWHEAD-TYPE,0,none,open,filled,double-end-open,double-end-filled
+shortlist=OBJ-ARROWHEAD-WIDTH,0,narrow,medium,wide
+shortlist=OBJ-ARROWHEAD-LENGTH,0,short,medium,long
+
+combilist=OBJ-LINEENDS
+  0x000F=uint8,dec,arrowhead-type,OBJ-ARROWHEAD-TYPE
+  0x00F0=uint8,dec,arrowhead-width,OBJ-ARROWHEAD-WIDTH
+  0x0F00=uint8,dec,arrowhead-length,OBJ-ARROWHEAD-LENGTH
+end
+
+shortlist=OBJ-LINEDIR,0,topleft-to-bottomright,topright-to-bottomleft,bottomright-to-topleft,bottomleft-to-topright
+
+shortlist=OBJ-ARC-QUADRANT,0,upper-right,upper-left,lower-left,lower-right
+
+combilist=OBJ-FRAMESTYLE-FLAGS
+  0x0001=rounded
+  0x0002=shadow
+  0x03FC=uint16,dec,rounded-diameter
+end
+
+shortlist=OBJ-HORALIGN,0,none,left,center,right,justify
+shortlist=OBJ-VERALIGN,0,none,top,center,bottom,justify
+
+combilist=OBJ-TEXT-FLAGS
+  0x000E=uint16,dec,hor-align,OBJ-HORALIGN
+  0x0070=uint16,dec,ver-align,OBJ-VERALIGN
+  0x0080=auto-size
+  0x0200=text-locked
+  0x0400=selected
+end
+
+flagslist=OBJ-PICTURE-FLAGS
+  0x0001=auto-size
+  0x0002=linked
+  0x0008=symbol
+end
+
+flagslist=OBJ-POLYGON-FLAGS
+  0x0100=closed
+end
+
+flagslist=OBJ-CHART-FLAGS-BIFF5
+  0x0001=linked-to-sheet
+end
+
+flagslist=OBJ-BUTTON-FLAGS-BIFF5
+  0x0001=default-btn
+  0x0002=help-btn
+  0x0004=cancel-btn
+  0x0008=close-btn
+end
+
+shortlist=OBJ-CHECKBOX-STATE-BIFF5,0,unchecked,checked,tristate
+
+flagslist=OBJ-CHECKBOX-FLAGS-BIFF5
+  0x0001=flat
+  0x0002=box-only
+end
+
+shortlist=OBJ-EDIT-TYPE-BIFF5,0,text,integer,double,reference,formula
+
+flagslist=OBJ-SCROLLBAR-FLAGS-BIFF5
+  0x0001=visible
+  0x0002=slider-only
+  0x0004=tracking
+  0x0008=flat
+end
+
+combilist=OBJ-LISTBOX-FLAGS-BIFF5
+  0x0004=linked-edit
+  0x0008=flat
+  0x0030=uint8,dec,selection-type,OBJ-LISTBOX-SELTYPE-BIFF5
+end
+
+shortlist=OBJ-LISTBOX-SELTYPE-BIFF5,0,single,multi,range
+
+flagslist=OBJ-GROUPBOX-FLAGS-BIFF5
+  0x0001=flat
+end
+
+combilist=OBJ-DROPDOWN-FLAGS-BIFF5
+  0x0003=uint8,dec,type,OBJ-DROPDOWN-TYPE-BIFF5
+  0x0008=filtered
+end
+
+shortlist=OBJ-DROPDOWN-TYPE-BIFF5,0,listbox,combobox,simple,max
+
+multilist=OBJ-RECNAMES-BIFF8
+  0x0000=OBJEND,,,,OBJMACRO,,OBJGMO,OBJCF
+  0x0008=OBJFLAGS,OBJPICTFMLA,OBJCBLS,OBJRBO,OBJSBS,OBJNTS,OBJSBSFMLA,OBJGBODATA
+  0x0010=OBJEDODATA,OBJRBODATA,OBJCBLSDATA,OBJLBSDATA,OBJCBLSFMLA,OBJCMO,,
+end
+
+flagslist=OBJFLAGS-FLAGS
+  0x0001=manual-size
+  0x0002=linked
+  0x0004=update-on-print
+  0x0008=symbol
+  0x0010=control
+  0x0020=ctls-stream
+  0x0080=camera-pic
+  0x0100=default-size
+  0x0200=auto-load
+end
+
+flagslist=OBJCMO-FLAGS
+  0x0001=locked
+  0x0004=default-size
+  0x0008=published
+  0x0010=printable
+  0x0080=disabled
+  0x0100=auxiliary
+  0x0200=recalc-on-load
+  0x1000=recalc-always
+  0x2000=auto-line
+  0x4000=auto-area
+end
+
+# PAGESETUP ------------------------------------------------------------------
+
+multilist=PAGESETUP-PAPERSIZE
+  0=undefined,letter,letter-small,tabloid,ledger,legal,statement,executive,a3,a4
+  10=a4-small,a5,b4,b5,folio,quarto,10x14,11x17,note,envelope-9
+  20=envelope-10,envelope-11,envelope-12,envelope-14,c,d,e,envelope-dl,envelope-c5,envelope-c3
+  30=envelope-c4,envelope-c6,envelope-c65,envelope-b4,envelope-b5,envelope-b6,envelope-italy,envelope-monarch,envelope-6-3/4,us-standard-fanfold
+  40=german-standard-fanfold,german-legal-fanfold,b4,japanese-dbl-postcaed,9x11,10x11,15x11,,
+  50=envelope-invite,letter-extra,legal-extra,tabloid-extra,a4-extra,letter-transverse,a4-transverse,letter-extra-transverse,super-a-a4,super-b-a3,letter-plus
+  60=a4-plus,a5-transverse,jis-b5-transverse,a3-extra,a5-extra,b5-extra,a2,a3-transverse,a3-extra-transverse
+end
+
+constlist=PAGESETUP-SCALETOPAGES
+  default=
+  0=automatic
+end
+
+flagslist=PAGESETUP-FLAGS-BIFF4
+  0x0001=print-in-rows
+  0x0002=portrait
+  0x0004=uninitialized
+  0x0008=black-and-white
+end
+
+flagslist=PAGESETUP-FLAGS-BIFF5
+  include=PAGESETUP-FLAGS-BIFF4
+  0x0010=draft-quality
+  0x0020=print-notes
+  0x0040=default-orientation
+  0x0080=use-first-page
+end
+
+combilist=PAGESETUP-FLAGS-BIFF8
+  include=PAGESETUP-FLAGS-BIFF5
+  0x0200=print-notes-at-end
+  0x0C00=uint8,dec,print-errors,PAGESETUP-PRINTERRORS
+end
+
+shortlist=PAGESETUP-PRINTERRORS,0,displayed,none,as-dashes,as-na
+
+unitconverter=PAGESETUP-DPI,1,dpi
+
+# PANE -----------------------------------------------------------------------
+
+shortlist=PANE-ID,0,bottom-right,top-right,bottom-left,top-left
+
+# PHONETICPR -----------------------------------------------------------------
+
+shortlist=PHONETICPR-TYPE,0,halfwidth-katakana,fullwidth-katakana,hiragana,no-conversion
+shortlist=PHONETICPR-ALIGNMENT,0,no-control,left,center,distributed
+
+combilist=PHONETICPR-FLAGS
+  ignore=0x0030
+  0x0003=uint8,dec,type,PHONETICPR-TYPE
+  0x000C=uint8,dec,alignment,PHONETICPR-ALIGNMENT
+end
+
+# PROJEXTSHEET ---------------------------------------------------------------
+
+shortlist=PROJEXTSHEET-TYPE,0,sheet,macro,chart
+
+# REFMODE --------------------------------------------------------------------
+
+shortlist=REFMODE,0,R1C1,A1
+
+# ROW ------------------------------------------------------------------------
+
+combilist=ROW-HEIGHT
+  0x7FFF=uint16,dec,height,CONV-TWIP-TO-PT
+  0x8000=default-height
+end
+
+combilist=ROW-FLAGS
+  ignore=0x00000100
+  0x00000007=uint8,dec,outline-level
+  0x00000010=outline-collapsed
+  0x00000020=hidden
+  0x00000040=custom-height
+  0x00000080=custom-format
+  0x0FFF0000=uint16,dec,custom-xf-idx
+  0x10000000=thick-top
+  0x20000000=thick-bottom
+  0x40000000=show-phonetic
+end
+
+# SHEET ----------------------------------------------------------------------
+
+shortlist=SHEET-STATE,0,visible,hidden,very-hidden
+shortlist=SHEET-TYPE,0,worksheet,macrosheet,chartsheet,,,,vb-module
+
+# SHEETPR --------------------------------------------------------------------
+
+shortlist=SHEETPR-WINDOWPOS,0,tiled,horizontal,vertical,cascaded
+
+flagslist=SHEETPR-FLAGS-BIFF3
+  0x0001=show-autopagebreaks
+  0x0020=outline-auto-style
+  0x0040=outline-symbols-below
+  0x0080=outline-symbols-right
+  0x0100=fit-to-pages
+  0x0200=skip-linked-values
+  0x0400=show-row-outline
+  0x0800=show-column-outline
+end
+
+flagslist=SHEETPR-FLAGS-BIFF4
+  include=SHEETPR-FLAGS-BIFF3
+  0x3000=uint8,dec,window-pos,SHEETPR-WINDOWPOS
+  0x4000=lotus-expr-eval
+  0x8000=lotus-formula-edit
+end
+
+flagslist=SHEETPR-FLAGS-BIFF5
+  include=SHEETPR-FLAGS-BIFF4
+  exclude=0x0200,0x3000
+  0x0010=dialog-sheet
+end
+
+# SHEETPROTECTION ------------------------------------------------------------
+
+flagslist=SHEETPROTECTION-FLAGS
+  0x0001=edit-object
+  0x0002=edit-scenario
+  0x0004=format-cell
+  0x0008=format-column
+  0x0010=format-row
+  0x0020=insert-column
+  0x0040=insert-row
+  0x0080=insert-hyperlink
+  0x0100=delete-column
+  0x0200=delete-row
+  0x0400=select-locked
+  0x0800=sort
+  0x1000=use-autofilter
+  0x2000=pivottable-report
+  0x4000=select-unlocked
+end
+
+# STYLE ----------------------------------------------------------------------
+
+combilist=STYLE-FLAGS
+  0x0FFF=uint16,dec,xf-idx
+  0x8000=builtin
+end
+
+shortlist=STYLE-BUILTIN,0,normal,rowlevel,collevel,comma,currency,percent,comma-0,currency-0,hyperlink,followed-hyperlink
+
+# common for pivot tables ----------------------------------------------------
+
+constlist=SX-NAMELEN
+  default=
+  0xFFFF=name-in-cache
+end
+
+# SXDB -----------------------------------------------------------------------
+
+flagslist=SXDB-FLAGS
+  0x0001=save-data
+  0x0002=invalid
+  0x0004=refresh-on-load
+  0x0008=opt-cache
+  0x0010=backgr-query
+  0x0020=enable-refresh
+end
+
+constlist=SXDB-TYPE
+  1=worksheet
+  2=external
+  4=consolidation
+  8=scenario
+end
+
+# SXDI -----------------------------------------------------------------------
+
+shortlist=SXDI-FUNC,0,sum,count-all,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p
+shortlist=SXDI-FORMAT,0,normal,diff-from,percent-of,percent-diff-from,running-total-in,percent-of-row,percent-of-column,percent-of-total,index
+
+multilist=SXDI-BASEITEM
+  default=
+  0x7FFB=previous-item,next-item
+end
+
+# SXEXT ----------------------------------------------------------------------
+
+combilist=SXEXT-FLAGS
+  0x0007=uint8,dec,source-type,SXEXT-SOURCETYPE
+  0x0008=odbc-connection
+  0x0010=odbc-sql
+  0x0020=server-pagefields
+  0x0040=webquery
+  0x0080=save-password
+  0x0100=tables-html-only
+end
+
+shortlist=SXEXT-SOURCETYPE,1,odbc,dao,,webquery
+
+# SXFDBTYPE ------------------------------------------------------------------
+
+shortlist=SXFDBTYPE-DATATYPE,0,unknown,char,numeric,decimal,integer,small-int,float,real,double,datetime,,,var-char
+
+# SXFIELD --------------------------------------------------------------------
+
+combilist=SXFIELD-FLAGS
+  0x0001=has-items
+  0x0002=postpone-items
+  0x0004=calculated
+  0x0008=has-child
+  0x0010=numeric-group
+  0x0020=16bit-indexes
+  0x0DE0=uint16,hex,data-type,SXFIELD-TYPE,noshift
+end
+
+constlist=SXFIELD-TYPE
+  0x0000=none
+  0x0480=string-only
+  0x0520=integer-optdouble
+  0x0560=double-only
+  0x05A0=string-integer-optdouble
+  0x05E0=string-double-only
+  0x0900=date-only
+  0x0980=date-empty-only
+  0x0D00=date-number
+  0x0D80=date-string-optnumber
+end
+
+# SXLI -----------------------------------------------------------------------
+
+shortlist=SXLI-ITEMTYPE,0,data,default,sum,count-num,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p,grandtotal,blank-line
+
+combilist=SXLI-FLAGS
+  0x0001=field-name
+  0x01FE=uint16,dec,data-field-idx
+  0x0200=subtotal
+  0x0400=blocktotal
+  0x0800=grandtotal
+  0x1000=multi-data
+end
+
+# SXNUMGROUP -----------------------------------------------------------------
+
+combilist=SXNUMGROUP-FLAGS
+  0x0001=auto-min
+  0x0002=auto-max
+  0x003C=uint8,dec,data-type,SXNUMGROUP-TYPE
+end
+
+shortlist=SXNUMGROUP-TYPE,1,second,minute,hour,day,month,quarter,year,numeric
+
+# SXVD -----------------------------------------------------------------------
+
+flagslist=SXVD-AXISTYPE
+  0x0001=row
+  0x0002=column
+  0x0004=page
+  0x0008=data
+end
+
+flagslist=SXVD-SUBTOTALS
+  0x0001=default
+  0x0002=sum
+  0x0004=count-all
+  0x0008=average
+  0x0010=max
+  0x0020=min
+  0x0040=product
+  0x0080=count-num
+  0x0100=std-dev
+  0x0200=std-dev-p
+  0x0400=variance
+  0x0800=variance-p
+end
+
+# SXVDEX ---------------------------------------------------------------------
+
+combilist=SXVDEX-FLAGS
+  0x00000001=show-all-items
+  0x00000002=drag-to-row
+  0x00000004=drag-to-column
+  0x00000008=drag-to-page
+  0x00000010=drag-to-hide
+  0x00000080=server-based
+  0x00000200=autosort
+  0x00000400=autosort-ascending
+  0x00000800=autoshow
+  0x00001000=autoshow-top-values
+  0x00002000=calculated
+  0x00200000=layout-report
+  0x00400000=layout-blank
+  0x00800000=layout-top
+  0xFF000000=uint8,dec,autoshow-item-count
+end
+
+# SXVI -----------------------------------------------------------------------
+
+multilist=SXVI-ITEMTYPE
+  0=data,default,sum,count-num,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p,grandtotal
+  254=page,none
+end
+
+flagslist=SXVI-FLAGS
+  0x0001=hidden
+  0x0002=hide-detail
+  0x0004=calculated
+  0x0008=missing
+end
+
+# SXVIEW ---------------------------------------------------------------------
+
+flagslist=SXVIEW-FLAGS
+  0x0001=row-grandtotals
+  0x0002=column-grandtotals
+  0x0008=auto-format
+  0x0010=size-auto-format
+  0x0020=font-auto-format
+  0x0040=align-auto-format
+  0x0080=border-auto-format
+  0x0100=pattern-auto-format
+  0x0200=number-auto-format
+end
+
+# SXVS -----------------------------------------------------------------------
+
+flagslist=SXVS-TYPE
+  0x0001=spreadsheet
+  0x0002=extern
+  0x0004=consolidation-area
+  0x0008=pivot-table
+  0x0010=scenario
+end
+
+# TXO ------------------------------------------------------------------------
+
+combilist=TXO-FLAGS
+  0x000E=uint16,dec,hor-align,OBJ-HORALIGN
+  0x0070=uint16,dec,ver-align,OBJ-VERALIGN
+  0x0200=text-locked
+end
+
+# WINDOW1 --------------------------------------------------------------------
+
+flagslist=WINDOW1-FLAGS
+  0x0001=hidden
+  0x0002=minimized
+  0x0008=show-horizontal-scroll
+  0x0010=show-vertical-scroll
+  0x0020=show-tabbar
+end
+
+unitconverter=WINDOW1-TABBARRATIO,/10,%
+
+# WINDOW2 --------------------------------------------------------------------
+
+flagslist=WINDOW2-FLAGS-BIFF3
+  0x0001=show-formulas
+  0x0002=show-gridlines
+  0x0004=show-headings
+  0x0008=frozen-panes
+  0x0010=show-zeros
+  0x0020=default-gridcolor
+  0x0040=right-to-left
+  0x0080=show-outline-symbols
+  0x0100=remove-split-with-freeze
+end
+
+flagslist=WINDOW2-FLAGS-BIFF5
+  include=WINDOW2-FLAGS-BIFF3
+  0x0200=sheet-selected
+  0x0400=sheet-active
+end
+
+flagslist=WINDOW2-FLAGS-BIFF8
+  include=WINDOW2-FLAGS-BIFF5
+  0x0800=pagebreak-mode
+end
+
+# XF -------------------------------------------------------------------------
+
+shortlist=XF-HORALIGN,0,general,left,center,right,fill,block,center-across-sel,distribute
+shortlist=XF-VERALIGN,0,top,center,bottom,justify,distribute
+shortlist=XF-TEXTDIRECTION,0,context,left-to-right,right-to-left
+
+flagslist=XF-PROTECTION-FLAGS
+  0x01=locked
+  0x02=formula-hidden
+  0x04=style-xf
+end
+
+flagslist=XF-USEDATTRIBS-FLAGS
+  0x04=format
+  0x08=font
+  0x10=alignment
+  0x20=border
+  0x40=area
+  0x80=protection
+end
+
+combilist=XF-STYLEFLAGS-BIFF2
+  0x07=uint8,dec,hor-align,XF-HORALIGN
+  0x08=left-border
+  0x10=right-border
+  0x20=top-border
+  0x40=bottom-border
+  0x80=fill
+end
+
+combilist=XF-TYPEFLAGS-BIFF2
+  0x3F=uint8,dec,fmt-idx,FORMATS
+  0x40=locked
+  0x80=formula-hidden
+end
+
+flagslist=XF-TYPEFLAGS-BIFF3
+  include=XF-PROTECTION-FLAGS
+end
+
+combilist=XF-TYPEFLAGS-BIFF4
+  include=XF-TYPEFLAGS-BIFF3
+  0xFFF0=uint16,dec,parent-xf-idx
+end
+
+combilist=XF-ALIGNMENT-BIFF3
+  0x0007=uint8,dec,hor-align,XF-HORALIGN
+  0x0008=text-wrap
+  0xFFF0=uint16,dec,parent-xf-idx
+end
+
+combilist=XF-ALIGNMENT-BIFF4
+  0x07=uint8,dec,hor-align,XF-HORALIGN
+  0x08=text-wrap
+  0x30=uint8,dec,ver-align,XF-VERALIGN
+  0xC0=uint8,dec,orientation,TEXTORIENTATION
+end
+
+combilist=XF-ALIGNMENT-BIFF5
+  0x07=uint8,dec,hor-align,XF-HORALIGN
+  0x08=text-wrap
+  0x70=uint8,dec,ver-align,XF-VERALIGN
+  0x80=justify-lastline
+end
+
+combilist=XF-ORIENTATTRIBS-BIFF5
+  include=XF-USEDATTRIBS-FLAGS
+  0x03=uint8,dec,orientation,TEXTORIENTATION
+end
+
+combilist=XF-TEXTFLAGS-BIFF8
+  0x0F=uint8,dec,indent
+  0x10=shrink-to-fit
+  0xC0=uint8,dec,text-dir,XF-TEXTDIRECTION
+end
+
+combilist=XF-FILL-BIFF3
+  0x003F=uint8,dec,fill-pattern,FILLPATTERNS
+  0x07C0=uint8,dec,fg-color-idx,COLORS
+  0xF800=uint8,dec,bg-color-idx,COLORS
+end
+
+combilist=XF-BORDER-BIFF3
+  0x00000007=uint8,dec,top-style,BORDERSTYLES
+  0x000000F8=uint8,dec,top-color,COLORS
+  0x00000700=uint8,dec,left-style,BORDERSTYLES
+  0x0000F800=uint8,dec,left-color,COLORS
+  0x00070000=uint8,dec,bottom-style,BORDERSTYLES
+  0x00F80000=uint8,dec,bottom-color,COLORS
+  0x07000000=uint8,dec,right-style,BORDERSTYLES
+  0xF8000000=uint8,dec,right-color,COLORS
+end
+
+combilist=XF-FILL-BIFF5
+  0x0000007F=uint8,dec,fg-color-idx,COLORS
+  0x00003F80=uint8,dec,bg-color-idx,COLORS
+  0x003F0000=uint8,dec,fill-pattern,FILLPATTERNS
+  0x01C00000=uint8,dec,bottom-style,BORDERSTYLES
+  0xFE000000=uint8,dec,bottom-color,COLORS
+end
+
+combilist=XF-BORDER-BIFF5
+  0x00000007=uint8,dec,top-style,BORDERSTYLES
+  0x00000038=uint8,dec,left-style,BORDERSTYLES
+  0x000001C0=uint8,dec,right-style,BORDERSTYLES
+  0x0000FE00=uint8,dec,top-color,COLORS
+  0x007F0000=uint8,dec,left-color,COLORS
+  0x3F800000=uint8,dec,right-color,COLORS
+end
+
+combilist=XF-BORDERSTYLE-BIFF8
+  0x000F=uint8,dec,left-style,BORDERSTYLES
+  0x00F0=uint8,dec,right-style,BORDERSTYLES
+  0x0F00=uint8,dec,top-style,BORDERSTYLES
+  0xF000=uint8,dec,bottom-style,BORDERSTYLES
+end
+
+combilist=XF-BORDERCOLOR1-BIFF8
+  0x007F=uint8,dec,left-color,COLORS
+  0x3F80=uint8,dec,right-color,COLORS
+  0x4000=diag-tl-to-br
+  0x8000=diag-bl-to-tr
+end
+
+combilist=XF-BORDERCOLOR2-BIFF8
+  0x0000007F=uint8,dec,top-color,COLORS
+  0x00003F80=uint8,dec,bottom-color,COLORS
+  0x001FC000=uint8,dec,diag-color,COLORS
+  0x01E00000=uint8,dec,diag-style,BORDERSTYLES
+  0xFC000000=uint8,dec,fill-pattern,FILLPATTERNS
+end
+
+combilist=XF-FILLCOLOR-BIFF8
+  0x007F=uint8,dec,fg-color-idx,COLORS
+  0x3F80=uint8,dec,bg-color-idx,COLORS
+end
+
+# BIFF2 XF index field -------------------------------------------------------
+
+constlist=XFINDEX-BIFF2
+  default=
+  63=from-ixfe
+end
+
+combilist=CELL-XFINDEX-BIFF2
+  0x3F=uint8,dec,xf-idx,XFINDEX-BIFF2
+  0x40=locked
+  0x80=formula-hidden
+end
+
+combilist=CELL-XFFORMAT-BIFF2
+  0x3F=uint8,dec,fmt-idx,FORMATS
+  0xC0=uint8,dec,font-idx,FONTNAMES
+end
+
+combilist=CELL-XFSTYLE-BIFF2
+  include=XF-STYLEFLAGS-BIFF2
+end
+
+# ============================================================================
+
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/dffdumperconfig.dat /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dffdumperconfig.dat
--- oox/source/dump/dffdumperconfig.dat	2008-03-05 19:40:20.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dffdumperconfig.dat	1970-01-01 01:00:00.000000000 +0100
@@ -1,250 +0,0 @@
-﻿
-# dumper settings ============================================================
-
-# Path to additional configuration data, relative to this file.
-include-config-file=dumperconfig.dat
-
-# DFF record settings ========================================================
-
-# Show total stream position of the DFF record (default=on).
-#   0=off, 1=on
-show-dff-record-pos=0
-
-# Show total DFF record size in bytes (default=on).
-#   0=off, 1=on
-show-dff-record-size=1
-
-# Show DFF record identifier (default=on).
-#   0=off, 1=on
-show-dff-record-id=1
-
-# Show DFF record name, if known (default=on).
-#   0=off, 1=on
-show-dff-record-name=1
-
-# Show DFF record contents (default=on).
-#   0=off, 1=on
-show-dff-record-body=1
-
-# name lists =================================================================
-
-multilist=DFF-RECORD-NAMES
-  0xF000=DFFDGGCONTAINER,DFFBSTORECONTAINER,DFFDGCONTAINER,DFFSPGRCONTAINER,DFFSPCONTAINER,DFFSOLVERCONTAINER,DFFDGG,DFFBSE
-  0xF008=DFFDG,DFFSPGR,DFFSP,DFFOPT,DFFTEXTBOX,DFFCLIENTTEXTBOX,DFFANCHOR,DFFCHILDANCHOR
-  0xF010=DFFCLIENTANCHOR,DFFCLIENTDATA,DFFCONNECTORRULE,DFFALIGNRULE,DFFARCRULE,DFFCLIENTRULE,DFFCLASSID,DFFCALLOUTRULE
-  # 0xF018-0xF117 reserved for pictures
-  0xF118=DFFREGROUPITEM,DFFSELECTION,DFFCOLORMRU,,,DFFDELETEDPSPL,DFFSPLITMENUCOLORS,DFFOLEOBJECT
-  0xF120=DFFCOLORSCHEME,,DFFUSERDEFPROP
-end
-
-combilist=DFF-RECORD-INST
-  0x000F=uint8,hex,version,DFF-RECORD-VERSION
-  0xFFF0=uint16,dec,instance
-end
-
-constlist=DFF-RECORD-VERSION
-  default=
-  15=container
-end
-
-flagslist=DFFCLIENTANCHOR-FLAGS
-  0x0001=pos-locked
-  0x0002=size-locked
-end
-
-combilist=DFFOPT-PROPERTY-ID
-  0x3FFF=uint16,dec,id,DFFOPT-PROPERTY-NAMES
-  0x4000=picture
-  0x8000=complex
-end
-
-multilist=DFFOPT-PROPERTY-NAMES
-  # transform
-  0x0004=rotation
-  # protection
-  0x007F=lock-flags
-  # text
-  0x0080=text-id,text-left,text-top,text-right,text-bottom,text-wrap-mode,text-scale,text-anchor-mode
-  0x0088=text-flow,text-font-rotation,text-next-shape,text-bidi
-  0x00BF=text-flags
-  # text geometry
-  0x00C0=text-unicode-string,text-rtf-string,text-curve-align,text-def-size,text-spacing,text-font-family
-  0x00FF=text-geometry-flags
-  # picture
-  0x0100=pic-crop-top,pic-crop-bottom,pic-crop-left,pic-crop-right,pic-data,pic-file-name,pic-flags,pic-transparency-color
-  0x0108=pic-contrast,pic-brightness,pic-gamma,pic-id,pic-double-cr-mod,pic-fill-cr-mod,pic-line-cr-mod,pic-data-print
-  0x0110=pic-name-print,pic-flags-print
-  0x013F=pic-flags
-  # geometry
-  0x0140=geo-left,geo-top,geo-right,geo-bottom,geo-shape-path,geo-vertices,geo-segment-info,geo-adjust-1
-  0x0148=geo-adjust-2,geo-adjust-3,geo-adjust-4,geo-adjust-5,geo-adjust-6,geo-adjust-7,geo-adjust-8,geo-adjust-9
-  0x0150=geo-adjust-10,geo-connect-points,geo-stretch-x,geo-stretch-y,geo-handles,geo-formulas,geo-text-recs
-  0x0158=geo-connector-type
-  0x017F=geo-flags
-  # fill style
-  0x0180=fill-type,fill-color,fill-opacity,fill-back-color,fill-back-opacity,fill-cr-mod,fill-blip,fill-blip-name
-  0x0188=fill-blip-flags,fill-width,fill-height,fill-angle,fill-focus,fill-to-left,fill-to-top,fill-to-right
-  0x0190=fill-to-bottom,fill-rect-left,fill-rect-top,fill-rect-right,fill-rect-bottom,fill-dz-type,fill-shade-preset,fill-shade-colors
-  0x0198=fill-origin-x,fill-origin-y,fill-shape-origin-x,fill-shape-origin-y,fill-shade-type
-  0x01BF=fill-flags
-  # line style
-  0x01C0=line-color,line-opacity,line-back-color,line-cr-mod,line-type,line-fill-blip,line-fill-blip-name,line-fill-blip-flags
-  0x01C8=line-fill-width,line-fill-height,line-fill-dz-type,line-width,line-miter-limit,line-style,line-dash,line-dash-style
-  0x01D0=line-start-arrow-head,line-end-arrow-head,line-start-arrow-width,line-start-arrow-length,line-end-arrow-width,line-end-arrow-length,line-join-style,line-end-cap-style
-  0x01FF=line-flags
-  # shadow style
-  0x0200=shadow-type,shadow-color,shadow-highlight,shadow-cr-mod,shadow-opacity,shadow-offset-x,shadow-offset-y,shadow-2nd-offset-x
-  0x0208=shadow-2nd-offset-y,shadow-scale-x-to-x,shadow-scale-y-to-x,shadow-scale-x-to-y,shadow-scale-y-to-y,shadow-persp-x,shadow-persp-y,shadow-weight
-  0x0210=shadow-origin-x,shadow-origin-y
-  0x023F=shadow-flags
-  # perspective
-  0x0240=persp-type,persp-offset-x,persp-offsety,persp-scale-x-to-x,persp-scale-y-to-x,persp-scale-x-to-y,persp-scale-y-to-y,persp-persp-x
-  0x0248=persp-persp-y,persp-weight,persp-origin-x,persp-origin-y
-  0x027F=persp-flags
-  # 3d object
-  0x0280=3dobj-specular-amt,3dobj-diffuse-amt,3dobj-shininess,3dobj-edge-thickness,3dobj-extrude-forward,3dobj-extrude-backward,3dobj-extrude-plane,3dobj-extrusion-color
-  0x0288=3dobj-cr-mod
-  0x02BF=3dobj-flags
-  # 3d style
-  0x02C0=3dstyle-y-rotation,3dstyle-x-rotation,3dstyle-rotation-axis-x,3dstyle-rotation-axis-y,3dstyle-rotation-axis-z,3dstyle-rotation,3dstyle-rotation-center-x,3dstyle-rotation-center-y
-  0x02C8=3dstyle-rotation-center-z,3dstyle-render-mode,3dstyle-tolerance,3dstyle-view-point-x,3dstyle-view-point-y,3dstyle-view-point-z,3dstyle-origin-x,3dstyle-origin-y
-  0x02D0=3dstyle-skew-angle,3dstyle-skew-amount,3dstyle-ambient-intensity,3dstyle-key-light-x,3dstyle-key-light-y,3dstyle-key-light-z,3dstyle-key-light-intensity,3dstyle-fill-light-x
-  0x02D8=3dstyle-fill-light-y,3dstyle-fill-light-z,3dstyle-fill-light-intensity
-  0x02FF=3dstyle-flags
-  # shape 1
-  0x0301=,shape-master,,shape-connect-style,shape-bw-mod,shape-bw-mode-pure-bw,shape-bw-mode-bw
-  0x033F=shape1-flags
-  # callout
-  0x0340=callout-type,callout-box-distance,callout-angle,callout-drop-type,callout-drop-distance,callout-length
-  0x037F=callout-flags
-  # shape 2
-  0x0380=shape-name,shape-description,shape-hyperlink,shape-wrap-polygon-vertices,shape-wrap-left,shape-wrap-top,shape-wrap-right,shape-wrap-bottom
-  0x0388=shape-regroup-id
-  0x03BF=shape2-flags
-end
-
-flagslist=DFFOPT-LOCK-FLAGS
-  0x00000001=lock-against-grouping
-  0x00000002=lock-adjust-handles
-  0x00000004=lock-text
-  0x00000008=lock-vertices
-  0x00000010=lock-cropping
-  0x00000020=lock-against-select
-  0x00000040=lock-position
-  0x00000080=lock-aspect-ratio
-  0x00000100=lock-rotation
-end
-
-flagslist=DFFOPT-TEXT-FLAGS
-  0x00000001=fit-text-to-shape
-  0x00000002=fit-shape-to-text
-  0x00000004=rotate-text
-  0x00000008=auto-text-margin
-  0x00000010=select-text
-end
-
-flagslist=DFFOPT-TEXTGEO-FLAGS
-  0x00000001=strike-through
-  0x00000002=small-caps
-  0x00000004=shadow
-  0x00000008=underline
-  0x00000010=italic
-  0x00000020=bold
-  0x00000040=no-measure-along-path
-  0x00000080=stretch-height
-  0x00000100=scale-on-path
-  0x00000200=shrink-to-fit
-  0x00000400=stretch-to-fit
-  0x00000800=tightening
-  0x00001000=kerning
-  0x00002000=vertical
-  0x00004000=has-effect
-  0x00008000=reverse-rows
-end
-
-flagslist=DFFOPT-PICTURE-FLAGS
-  0x00000001=ole-alive
-  0x00000002=bi-level-display
-  0x00000004=grayscale
-  0x00000008=no-hit-test
-end
-
-flagslist=DFFOPT-GEO-FLAGS
-  0x00000001=fill-support
-  0x00000002=fill-shade-shape-support
-  0x00000004=fontwork-support
-  0x00000008=line-support
-  0x00000010=3d-support
-  0x00000020=shadow-support
-end
-
-flagslist=DFFOPT-FILL-FLAGS
-  0x00000001=no-fill-hit-test
-  0x00000002=use-large-rect
-  0x00000004=register-pattern
-  0x00000008=hit-test-fill
-  0x00000010=has-fill
-end
-
-flagslist=DFFOPT-LINE-FLAGS
-  0x00000001=draw-dash-for-invisible
-  0x00000002=register-pattern
-  0x00000004=hit-test-line
-  0x00000008=has-line
-  0x00000010=arrowhead-support
-end
-
-flagslist=DFFOPT-SHADOW-FLAGS
-  0x00000001=excel5-style
-  0x00000002=has-shadow
-end
-
-flagslist=DFFOPT-PERSP-FLAGS
-  0x00000001=has-perspective
-end
-
-flagslist=DFFOPT-3DOBJ-FLAGS
-  0x00000001=light-face
-  0x00000002=extrusion-color
-  0x00000004=metallic
-  0x00000008=has-3d
-end
-
-flagslist=DFFOPT-3DSTYLE-FLAGS
-  0x00000001=fill-color-harsh
-  0x00000002=key-color-harsh
-  0x00000004=parallel
-  0x00000008=rotation-center-auto
-  0x00000010=constrain-rotation
-end
-
-flagslist=DFFOPT-SHAPE1-FLAGS
-  0x00000001=background
-  0x00000002=delete-attached-object
-  0x00000008=lock-shape-type
-  0x00000010=prefer-rel-resize
-  0x00000020=ole-iconified
-end
-
-flagslist=DFFOPT-CALLOUT-FLAGS
-  0x00000001=length-specified
-  0x00000002=drop-auto
-  0x00000004=minus-y
-  0x00000008=minus-x
-  0x00000010=has-text-border
-  0x00000020=has-accent-bar
-  0x00000040=is-callout
-end
-
-flagslist=DFFOPT-SHAPE2-FLAGS
-  0x00000001=print
-  0x00000002=hidden
-  0x00000004=1d-adjustment
-  0x00000008=action-attached
-  0x00000010=notify-double-click
-  0x00000020=behind-text
-  0x00000040=wrap-edited
-end
-
-# ============================================================================
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/dffdumper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dffdumper.cxx
--- oox/source/dump/dffdumper.cxx	2008-04-10 17:36:20.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dffdumper.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -32,143 +32,101 @@
 
 #if OOX_INCLUDE_DUMPER
 
+using ::rtl::OUString;
+
 namespace oox {
 namespace dump {
 
 // ============================================================================
 
-DffRecordHeaderObject::DffRecordHeaderObject( const InputObjectBase& rParent )
-{
-    static const RecordHeaderConfigInfo saHeaderCfgInfo =
-    {
-        "DFFREC",
-        "DFF-RECORD-NAMES",
-        "show-dff-record-pos",
-        "show-dff-record-size",
-        "show-dff-record-id",
-        "show-dff-record-name",
-        "show-dff-record-body",
-    };
-    RecordHeaderBase< sal_uInt16, sal_uInt32 >::construct( rParent, saHeaderCfgInfo );
-    if( RecordHeaderBase< sal_uInt16, sal_uInt32 >::implIsValid() )
+void DffStreamObject::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
     {
-        mxRecInst = cfg().getNameList( "DFF-RECORD-INST" );
-        mnBodyStart = mnBodyEnd = 0;
-        mnInstVer = 0;
-    }
+    SequenceRecordObjectBase::construct( rParent, rxStrm, rSysFileName, "DFF-RECORD-NAMES" );
+    constructDffObj();
 }
 
-bool DffRecordHeaderObject::implIsValid() const
+void DffStreamObject::construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
 {
-    return isValid( mxRecInst ) && RecordHeaderBase< sal_uInt16, sal_uInt32 >::implIsValid();
+    SequenceRecordObjectBase::construct( rParent, rxStrm, "DFF-RECORD-NAMES" );
+    constructDffObj();
 }
 
-bool DffRecordHeaderObject::implReadHeader( sal_Int64& ornRecPos, sal_uInt16& ornRecId, sal_uInt32& ornRecSize )
+bool DffStreamObject::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize )
 {
-    ornRecPos = in().tell();
-    if( ornRecPos >= in().getSize() ) return false;
-    in() >> mnInstVer >> ornRecId >> ornRecSize;
-    mnBodyStart = in().tell();
-    mnBodyEnd = ::std::min< sal_Int64 >( mnBodyStart + ornRecSize, in().getSize() );
-    return in().isValidPos();
+    sal_uInt16 nRecId;
+    rBaseStrm >> mnInstVer >> nRecId >> mnRealSize;
+    ornRecId = nRecId;
+    ornRecSize = isContainer() ? 0 : mnRealSize;
+    return !rBaseStrm.isEof();
 }
 
-void DffRecordHeaderObject::implWriteExtHeader()
+void DffStreamObject::implWriteExtHeader()
 {
-    writeHexItem( "instance", mnInstVer, mxRecInst );
-}
-
-// ============================================================================
-
-DffDumpObject::DffDumpObject( const InputObjectBase& rParent )
+    const sal_Char* pcListName = "DFF-RECORD-INST";
+    switch( getRecId() )
 {
-    InputObjectBase::construct( rParent );
-    if( InputObjectBase::implIsValid() )
-        mxHdrObj.reset( new DffRecordHeaderObject( *this ) );
+        case 0xF001:    pcListName = "DFFBSTORECONT-RECORD-INST";   break;  // DFFBSTORECONTAINER contains BLIP count
+        case 0xF007:    pcListName = "DFFBSE-RECORD-INST";          break;  // DFFBSE contains BLIP type
+        case 0xF00A:    pcListName = "DFFSP-RECORD-INST";           break;  // DFFSP contains shape type
+        case 0xF00B:    pcListName = "DFFOPT-RECORD-INST";          break;  // DFFOPT contains property count
 }
-
-DffDumpObject::~DffDumpObject()
-{
-}
-
-void DffDumpObject::dumpDffClientPos( const sal_Char* pcName, sal_Int32 nSubScale )
-{
     MultiItemsGuard aMultiGuard( out() );
-    TableGuard aTabGuard( out(), 17 );
-    dumpDec< sal_uInt16 >( pcName );
-    ItemGuard aItem( out(), "sub-units" );
-    sal_uInt16 nSubUnits;
-    in() >> nSubUnits;
-    out().writeDec( nSubUnits );
-    out().writeChar( '/' );
-    out().writeDec( nSubScale );
+    writeHexItem( "instance", mnInstVer, pcListName );
+    if( isContainer() ) writeDecItem( "container-size", mnRealSize );
 }
 
-void DffDumpObject::dumpDffClientRect()
+void DffStreamObject::implDumpRecordBody()
 {
-    dumpDffClientPos( "start-col", 1024 );
-    dumpDffClientPos( "start-row", 256 );
-    dumpDffClientPos( "end-col", 1024 );
-    dumpDffClientPos( "end-row", 256 );
-}
-
-bool DffDumpObject::implIsValid() const
+    switch( getRecId() )
 {
-    return isValid( mxHdrObj ) && InputObjectBase::implIsValid();
-}
+        case 0xF007:    // DFFBSE
+            dumpDec< sal_uInt8 >( "win-type", "DFFBSE-TYPE" );
+            dumpDec< sal_uInt8 >( "mac-type", "DFFBSE-TYPE" );
+            dumpGuid( "guid" );
+            dumpDec< sal_uInt16 >( "tag" );
+            dumpDec< sal_uInt32 >( "blip-size" );
+            dumpDec< sal_uInt32 >( "blip-refcount" );
+            dumpDec< sal_uInt32 >( "blip-streampos" );
+            dumpDec< sal_uInt8 >( "blip-usage", "DFFBSE-USAGE" );
+            dumpDec< sal_uInt8 >( "blip-name-len" );
+            dumpUnused( 2 );
+        break;
 
-void DffDumpObject::implDump()
-{
-    while( mxHdrObj->startNextRecord() )
+        case 0xF00A:    // DFFSP
+            dumpHex< sal_uInt32 >( "shape-id", "CONV-DEC" );
+            dumpHex< sal_uInt32 >( "shape-flags", "DFFSP-FLAGS" );
+        break;
+
+        case 0xF00B:    // DFFOPT
     {
-        if( mxHdrObj->getVer() != 0x0F )
+            sal_uInt16 nPropCount = getInst();
+            out().resetItemIndex();
+            for( sal_uInt16 nPropIdx = 0; !in().isEof() && (nPropIdx < nPropCount); ++nPropIdx )
         {
-            if( mxHdrObj->isShowRecBody() )
-                dumpRecordBody();
-            in().seek( mxHdrObj->getBodyEnd() );
-        }
-        out().emptyLine();
+                sal_uInt16 nPropId = dumpDffOptPropHeader();
+                IndentGuard aIndent( out() );
+                dumpDffOptPropValue( nPropId, in().readuInt32() );
     }
 }
-
-void DffDumpObject::dumpRecordBody()
-{
-    IndentGuard aIndGuard( out() );
-
-    // record contents
-    if( mxHdrObj->hasRecName() ) switch( mxHdrObj->getRecId() )
-    {
-        case 0xF00B:
-            dumpDffOptRec();
         break;
-        case 0xF010:
-            dumpHex< sal_uInt16 >( "flags", "DFFCLIENTANCHOR-FLAGS" );
-            dumpDffClientRect();
+
+        case 0xF010:    // DFFCLIENTANCHOR
+            implDumpClientAnchor();
         break;
     }
-
-    // remaining undumped data
-    sal_Int64 nPos = in().tell();
-    if( nPos == mxHdrObj->getBodyStart() )
-        dumpRawBinary( mxHdrObj->getRecSize(), false );
-    else if( nPos < mxHdrObj->getBodyEnd() )
-        dumpRemaining( static_cast< sal_Int32 >( mxHdrObj->getBodyEnd() - nPos ) );
 }
 
-void DffDumpObject::dumpDffOptRec()
+void DffStreamObject::implDumpClientAnchor()
 {
-    sal_uInt16 nInst = mxHdrObj->getInst();
-    sal_Int64 nBodyEnd = mxHdrObj->getBodyEnd();
-    out().resetItemIndex();
-    for( sal_uInt16 nIdx = 0; (nIdx < nInst) && (in().tell() < nBodyEnd); ++nIdx )
-    {
-        sal_uInt16 nPropId = dumpDffOptPropHeader();
-        IndentGuard aIndent( out() );
-        dumpDffOptPropValue( nPropId, in().readValue< sal_uInt32 >() );
     }
+
+void DffStreamObject::constructDffObj()
+{
+    mnInstVer = 0;
+    mnRealSize = 0;
 }
 
-sal_uInt16 DffDumpObject::dumpDffOptPropHeader()
+sal_uInt16 DffStreamObject::dumpDffOptPropHeader()
 {
     MultiItemsGuard aMultiGuard( out() );
     TableGuard aTabGuard( out(), 11 );
@@ -176,7 +134,7 @@ sal_uInt16 DffDumpObject::dumpDffOptProp
     return dumpHex< sal_uInt16 >( "id", "DFFOPT-PROPERTY-ID" );
 }
 
-void DffDumpObject::dumpDffOptPropValue( sal_uInt16 nPropId, sal_uInt32 nValue )
+void DffStreamObject::dumpDffOptPropValue( sal_uInt16 nPropId, sal_uInt32 nValue )
 {
     switch( nPropId & 0x3FFF )
     {
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/dffdumper.ini /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dffdumper.ini
--- oox/source/dump/dffdumper.ini	1970-01-01 01:00:00.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dffdumper.ini	2008-09-30 16:51:36.000000000 +0200
@@ -0,0 +1,311 @@
+﻿
+# dumper settings ============================================================
+
+# Path to additional configuration data, relative to this file.
+include-config-file=dumperbase.ini
+
+# name lists =================================================================
+
+multilist=DFF-RECORD-NAMES
+  0xF000=DFFDGGCONTAINER,DFFBSTORECONTAINER,DFFDGCONTAINER,DFFSPGRCONTAINER,DFFSPCONTAINER,DFFSOLVERCONTAINER,DFFDGG,DFFBSE
+  0xF008=DFFDG,DFFSPGR,DFFSP,DFFOPT,DFFTEXTBOX,DFFCLIENTTEXTBOX,DFFANCHOR,DFFCHILDANCHOR
+  0xF010=DFFCLIENTANCHOR,DFFCLIENTDATA,DFFCONNECTORRULE,DFFALIGNRULE,DFFARCRULE,DFFCLIENTRULE,DFFCLASSID,DFFCALLOUTRULE
+  # 0xF018-0xF117 reserved for pictures
+  0xF118=DFFREGROUPITEM,DFFSELECTION,DFFCOLORMRU,,,DFFDELETEDPSPL,DFFSPLITMENUCOLORS,DFFOLEOBJECT
+  0xF120=DFFCOLORSCHEME,,DFFUSERDEFPROP
+end
+
+combilist=DFF-RECORD-INST
+  0x000F=uint8,hex,version,DFF-RECORD-VERSION
+  0xFFF0=uint16,dec,instance
+end
+
+constlist=DFF-RECORD-VERSION
+  default=
+  15=container
+end
+
+# DFFBSTORECONTAINER ---------------------------------------------------------
+
+combilist=DFFBSTORECONT-RECORD-INST
+  include=DFF-RECORD-INST
+  0xFFF0=uint16,dec,blip-count
+end
+
+# DFFBSE ---------------------------------------------------------------------
+
+combilist=DFFBSE-RECORD-INST
+  include=DFF-RECORD-INST
+  0xFFF0=uint16,dec,blip-type,DFFBSE-TYPE
+end
+
+multilist=DFFBSE-TYPE
+  0=error,unknown,emf,wmf,pict,jpeg,png,dib
+  17=tiff,cmyk-jpeg
+end
+
+shortlist=DFFBSE-USAGE,0,default,texture
+
+# DFFSP ----------------------------------------------------------------------
+
+combilist=DFFSP-RECORD-INST
+  include=DFF-RECORD-INST
+  0xFFF0=uint16,dec,shape-type,DFFSP-TYPE
+end
+
+multilist=DFFSP-TYPE
+  0=not-primitive,rectangle,round-rectangle,ellipse,diamond,isoceles-triangle,right-triangle,parallelogram,trapezoid,hexagon
+  10=octagon,plus,star,arrow,thick-arrow,home-plate,cube,balloon,seal,arc
+  20=line,plaque,can,donut,text-simple,text-octagon,text-hexagon,text-curve,text-wave,text-ring
+  30=text-on-curve,text-on-ring,straight-connector-1,bent-connector-2,bent-connector-3,bent-connector-4,bent-connector-5,curved-connector-2,curved-connector-3,curved-connector-4
+  40=curved-connector-5,callout-1,callout-2,callout-3,accent-callout-1,accent-callout-2,accent-callout-3,border-callout-1,border-callout-2,border-callout-3
+  50=accent-border-callout-1,accent-border-callout-2,accent-border-callout-3,ribbon,ribbon-2,chevron,pentagon,no-smoking,seal-8,seal-16
+  60=seal-32,wedge-rect-callout,wedge-rrect-callout,wedge-ellipse-callout,wave,folded-corner,left-arrow,down-arrow,up-arrow,left-right-arrow
+  70=up-down-arrow,irregular-seal-1,irregular-seal-2,lightning-bolt,heart,picture-frame,quad-arrow,left-arrow-callout,right-arrow-callout,up-arrow-callout
+  80=down-arrow-callout,left-right-arrow-callout,up-down-arrow-callout,quad-arrow-callout,bevel,left-bracket,right-bracket,left-brace,right-brace,left-up-arrow
+  90=bent-up-arrow,bent-arrow,seal-24,striped-right-arrow,notched-right-arrow,block-arc,smiley-face,vertical-scroll,horizontal-scroll,circular-arrow
+  100=notched-circular-arrow,uturn-arrow,curved-right-arrow,curved-left-arrow,curved-up-arrow,curved-down-arrow,cloud-callout,ellipse-ribbon,ellipse-ribbon-2,flow-chart-process
+  110=flow-chart-decision,flow-chart-input-output,flow-chart-predefined-process,flow-chart-internal-storage,flow-chart-document,flow-chart-multidocument,flow-chart-terminator,flow-chart-preparation,flow-chart-manual-input,flow-chart-manual-operation
+  120=flow-chart-connector,flow-chart-punched-card,flow-chart-punched-tape,flow-chart-summing-junction,flow-chart-or,flow-chart-collate,flow-chart-sort,flow-chart-extract,flow-chart-merge,flow-chart-offline-storage
+  130=flow-chart-online-storage,flow-chart-magnetic-tape,flow-chart-magnetic-disk,flow-chart-magnetic-drum,flow-chart-display,flow-chart-delay,text-plain-text,text-stop,text-triangle,text-triangle-inverted
+  140=text-chevron,text-chevron-inverted,text-ring-inside,text-ring-outside,text-arch-up-curve,text-arch-down-curve,text-circle-curve,text-button-curve,text-arch-up-pour,text-arch-down-pour
+  150=text-circle-pour,text-button-pour,text-curve-up,text-curve-down,text-cascade-up,text-cascade-down,text-wave-1,text-wave-2,text-wave-3,text-wave-4
+  160=text-inflate,text-deflate,text-inflate-bottom,text-deflate-bottom,text-inflate-top,text-deflate-top,text-deflate-inflate,text-deflate-inflate-deflate,text-fade-right,text-fade-left
+  170=text-fade-up,text-fade-down,text-slant-up,text-slant-down,text-can-up,text-can-down,flow-chart-alternate-process,flow-chart-offpage-connector,callout-90,accent-callout-90
+  180=border-callout-90,accent-border-callout-90,left-right-up-arrow,sun,moon,bracket-pair,brace-pair,seal-4,double-wave,action-button-blank
+  190=action-button-home,action-button-help,action-button-information,action-button-forward-next,action-button-back-previous,action-button-end,action-button-beginning,action-button-return,action-button-document,action-button-sound
+  200=action-button-movie,host-control,text-box
+end
+
+flagslist=DFFSP-FLAGS
+  0x00000001=group
+  0x00000002=child
+  0x00000004=patriarch
+  0x00000008=deleted
+  0x00000010=ole
+  0x00000020=has-master
+  0x00000040=flip-horizontal
+  0x00000080=flip-vertical
+  0x00000100=connector
+  0x00000200=has-anchor
+  0x00000400=background
+  0x00000800=has-shape-type
+end
+
+# DFFOPT ---------------------------------------------------------------------
+
+combilist=DFFOPT-RECORD-INST
+  include=DFF-RECORD-INST
+  0xFFF0=uint16,dec,property-count
+end
+
+combilist=DFFOPT-PROPERTY-ID
+  0x3FFF=uint16,dec,id,DFFOPT-PROPERTY-NAMES
+  0x4000=picture
+  0x8000=complex
+end
+
+multilist=DFFOPT-PROPERTY-NAMES
+  # transform
+  0x0004=rotation
+  # protection
+  0x007F=lock-flags
+  # text
+  0x0080=text-id,text-left,text-top,text-right,text-bottom,text-wrap-mode,text-scale,text-anchor-mode
+  0x0088=text-flow,text-font-rotation,text-next-shape,text-bidi
+  0x00BF=text-flags
+  # text geometry
+  0x00C0=text-unicode-string,text-rtf-string,text-curve-align,text-def-size,text-spacing,text-font-family
+  0x00FF=text-geometry-flags
+  # picture
+  0x0100=pic-crop-top,pic-crop-bottom,pic-crop-left,pic-crop-right,pic-data,pic-file-name,pic-flags,pic-transparency-color
+  0x0108=pic-contrast,pic-brightness,pic-gamma,pic-id,pic-double-cr-mod,pic-fill-cr-mod,pic-line-cr-mod,pic-data-print
+  0x0110=pic-name-print,pic-flags-print
+  0x013F=pic-flags
+  # geometry
+  0x0140=geo-left,geo-top,geo-right,geo-bottom,geo-shape-path,geo-vertices,geo-segment-info,geo-adjust-1
+  0x0148=geo-adjust-2,geo-adjust-3,geo-adjust-4,geo-adjust-5,geo-adjust-6,geo-adjust-7,geo-adjust-8,geo-adjust-9
+  0x0150=geo-adjust-10,geo-connect-points,geo-stretch-x,geo-stretch-y,geo-handles,geo-formulas,geo-text-recs
+  0x0158=geo-connector-type
+  0x017F=geo-flags
+  # fill style
+  0x0180=fill-type,fill-color,fill-opacity,fill-back-color,fill-back-opacity,fill-cr-mod,fill-blip,fill-blip-name
+  0x0188=fill-blip-flags,fill-width,fill-height,fill-angle,fill-focus,fill-to-left,fill-to-top,fill-to-right
+  0x0190=fill-to-bottom,fill-rect-left,fill-rect-top,fill-rect-right,fill-rect-bottom,fill-dz-type,fill-shade-preset,fill-shade-colors
+  0x0198=fill-origin-x,fill-origin-y,fill-shape-origin-x,fill-shape-origin-y,fill-shade-type
+  0x01BF=fill-flags
+  # line style
+  0x01C0=line-color,line-opacity,line-back-color,line-cr-mod,line-type,line-fill-blip,line-fill-blip-name,line-fill-blip-flags
+  0x01C8=line-fill-width,line-fill-height,line-fill-dz-type,line-width,line-miter-limit,line-style,line-dash,line-dash-style
+  0x01D0=line-start-arrow-head,line-end-arrow-head,line-start-arrow-width,line-start-arrow-length,line-end-arrow-width,line-end-arrow-length,line-join-style,line-end-cap-style
+  0x01FF=line-flags
+  # shadow style
+  0x0200=shadow-type,shadow-color,shadow-highlight,shadow-cr-mod,shadow-opacity,shadow-offset-x,shadow-offset-y,shadow-2nd-offset-x
+  0x0208=shadow-2nd-offset-y,shadow-scale-x-to-x,shadow-scale-y-to-x,shadow-scale-x-to-y,shadow-scale-y-to-y,shadow-persp-x,shadow-persp-y,shadow-weight
+  0x0210=shadow-origin-x,shadow-origin-y
+  0x023F=shadow-flags
+  # perspective
+  0x0240=persp-type,persp-offset-x,persp-offsety,persp-scale-x-to-x,persp-scale-y-to-x,persp-scale-x-to-y,persp-scale-y-to-y,persp-persp-x
+  0x0248=persp-persp-y,persp-weight,persp-origin-x,persp-origin-y
+  0x027F=persp-flags
+  # 3d object
+  0x0280=3dobj-specular-amt,3dobj-diffuse-amt,3dobj-shininess,3dobj-edge-thickness,3dobj-extrude-forward,3dobj-extrude-backward,3dobj-extrude-plane,3dobj-extrusion-color
+  0x0288=3dobj-cr-mod
+  0x02BF=3dobj-flags
+  # 3d style
+  0x02C0=3dstyle-y-rotation,3dstyle-x-rotation,3dstyle-rotation-axis-x,3dstyle-rotation-axis-y,3dstyle-rotation-axis-z,3dstyle-rotation,3dstyle-rotation-center-x,3dstyle-rotation-center-y
+  0x02C8=3dstyle-rotation-center-z,3dstyle-render-mode,3dstyle-tolerance,3dstyle-view-point-x,3dstyle-view-point-y,3dstyle-view-point-z,3dstyle-origin-x,3dstyle-origin-y
+  0x02D0=3dstyle-skew-angle,3dstyle-skew-amount,3dstyle-ambient-intensity,3dstyle-key-light-x,3dstyle-key-light-y,3dstyle-key-light-z,3dstyle-key-light-intensity,3dstyle-fill-light-x
+  0x02D8=3dstyle-fill-light-y,3dstyle-fill-light-z,3dstyle-fill-light-intensity
+  0x02FF=3dstyle-flags
+  # shape 1
+  0x0301=,shape-master,,shape-connect-style,shape-bw-mod,shape-bw-mode-pure-bw,shape-bw-mode-bw
+  0x033F=shape1-flags
+  # callout
+  0x0340=callout-type,callout-box-distance,callout-angle,callout-drop-type,callout-drop-distance,callout-length
+  0x037F=callout-flags
+  # shape 2
+  0x0380=shape-name,shape-description,shape-hyperlink,shape-wrap-polygon-vertices,shape-wrap-left,shape-wrap-top,shape-wrap-right,shape-wrap-bottom
+  0x0388=shape-regroup-id
+  0x03BF=shape2-flags
+end
+
+flagslist=DFFOPT-LOCK-FLAGS
+  0x00000001=lock-against-grouping
+  0x00000002=lock-adjust-handles
+  0x00000004=lock-text
+  0x00000008=lock-vertices
+  0x00000010=lock-cropping
+  0x00000020=lock-against-select
+  0x00000040=lock-position
+  0x00000080=lock-aspect-ratio
+  0x00000100=lock-rotation
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-TEXT-FLAGS
+  0x00000001=fit-text-to-shape
+  0x00000002=fit-shape-to-text
+  0x00000004=rotate-text
+  0x00000008=auto-text-margin
+  0x00000010=select-text
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-TEXTGEO-FLAGS
+  0x00000001=strike-through
+  0x00000002=small-caps
+  0x00000004=shadow
+  0x00000008=underline
+  0x00000010=italic
+  0x00000020=bold
+  0x00000040=no-measure-along-path
+  0x00000080=stretch-height
+  0x00000100=scale-on-path
+  0x00000200=shrink-to-fit
+  0x00000400=stretch-to-fit
+  0x00000800=tightening
+  0x00001000=kerning
+  0x00002000=vertical
+  0x00004000=has-effect
+  0x00008000=reverse-rows
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-PICTURE-FLAGS
+  0x00000001=ole-alive
+  0x00000002=bi-level-display
+  0x00000004=grayscale
+  0x00000008=no-hit-test
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-GEO-FLAGS
+  0x00000001=fill-support
+  0x00000002=fill-shade-shape-support
+  0x00000004=fontwork-support
+  0x00000008=line-support
+  0x00000010=3d-support
+  0x00000020=shadow-support
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-FILL-FLAGS
+  0x00000001=no-fill-hit-test
+  0x00000002=use-large-rect
+  0x00000004=register-pattern
+  0x00000008=hit-test-fill
+  0x00000010=has-fill
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-LINE-FLAGS
+  0x00000001=draw-dash-for-invisible
+  0x00000002=register-pattern
+  0x00000004=hit-test-line
+  0x00000008=has-line
+  0x00000010=arrowhead-support
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-SHADOW-FLAGS
+  0x00000001=excel5-style
+  0x00000002=has-shadow
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-PERSP-FLAGS
+  0x00000001=has-perspective
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-3DOBJ-FLAGS
+  0x00000001=light-face
+  0x00000002=extrusion-color
+  0x00000004=metallic
+  0x00000008=has-3d
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-3DSTYLE-FLAGS
+  0x00000001=fill-color-harsh
+  0x00000002=key-color-harsh
+  0x00000004=parallel
+  0x00000008=rotation-center-auto
+  0x00000010=constrain-rotation
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-SHAPE1-FLAGS
+  0x00000001=background
+  0x00000002=delete-attached-object
+  0x00000008=lock-shape-type
+  0x00000010=prefer-rel-resize
+  0x00000020=ole-iconified
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-CALLOUT-FLAGS
+  0x00000001=length-specified
+  0x00000002=drop-auto
+  0x00000004=minus-y
+  0x00000008=minus-x
+  0x00000010=has-text-border
+  0x00000020=has-accent-bar
+  0x00000040=is-callout
+  ignore=0xFFFF0000
+end
+
+flagslist=DFFOPT-SHAPE2-FLAGS
+  0x00000001=print
+  0x00000002=hidden
+  0x00000004=1d-adjustment
+  0x00000008=action-attached
+  0x00000010=notify-double-click
+  0x00000020=behind-text
+  0x00000040=wrap-edited
+  ignore=0xFFFF0000
+end
+
+# ============================================================================
+
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/dumperbase.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dumperbase.cxx
--- oox/source/dump/dumperbase.cxx	2008-04-10 17:38:58.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dumperbase.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -31,25 +31,26 @@
 #include "oox/dump/dumperbase.hxx"
 
 #include <algorithm>
-#include <rtl/math.hxx>
-#include <rtl/tencinfo.h>
-#include <osl/file.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
 #include <com/sun/star/io/XActiveDataSink.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/io/XTextInputStream.hpp>
 #include <com/sun/star/io/XTextOutputStream.hpp>
-#include <comphelper/processfactory.hxx>
+#include <rtl/math.hxx>
+#include <osl/file.hxx>
 #include "oox/helper/binaryoutputstream.hxx"
 #include "oox/core/filterbase.hxx"
 #include "oox/xls/biffhelper.hxx"
 
 #if OOX_INCLUDE_DUMPER
 
+using ::rtl::OString;
+using ::rtl::OStringBuffer;
+using ::rtl::OStringToOUString;
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
-using ::rtl::OString;
+using ::rtl::OUStringToOString;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::Exception;
 using ::com::sun::star::uno::UNO_QUERY_THROW;
@@ -76,7 +77,7 @@ const sal_Unicode OOX_DUMP_CFG_QUOTE    
 const sal_Unicode OOX_DUMP_LF           = '\n';
 const sal_Unicode OOX_DUMP_ITEMSEP      = '=';
 const sal_Int32 OOX_DUMP_BYTESPERLINE   = 16;
-const sal_Int32 OOX_DUMP_MAXARRAY       = 16;
+const sal_Int64 OOX_DUMP_MAXARRAY       = 16;
 
 // ============================================================================
 // ============================================================================
@@ -106,13 +107,22 @@ OUString InputOutputHelper::getFileNameE
     return OUString();
 }
 
-Reference< XInputStream > InputOutputHelper::openInputStream( const OUString& rFileName )
+// input streams --------------------------------------------------------------
+
+Reference< XInputStream > InputOutputHelper::getXInputStream( BinaryInputStream& rStrm )
+{
+    if( BinaryXInputStream* pXStrm = dynamic_cast< BinaryXInputStream* >( &rStrm ) )
+        return pXStrm->getXInputStream();
+    return 0;
+}
+
+Reference< XInputStream > InputOutputHelper::openInputStream(
+        const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName )
 {
     Reference< XInputStream > xInStrm;
-    try
+    if( rxFactory.is() ) try
     {
-        Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-        Reference< XSimpleFileAccess > xFileAccess( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
+        Reference< XSimpleFileAccess > xFileAccess( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
         xInStrm = xFileAccess->openFileRead( rFileName );
     }
     catch( Exception& )
@@ -121,13 +131,13 @@ Reference< XInputStream > InputOutputHel
     return xInStrm;
 }
 
-Reference< XTextInputStream > InputOutputHelper::openTextInputStream( const Reference< XInputStream >& rxInStrm, const OUString& rEncoding )
+Reference< XTextInputStream > InputOutputHelper::openTextInputStream(
+        const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rEncoding )
 {
     Reference< XTextInputStream > xTextInStrm;
-    if( rxInStrm.is() ) try
+    if( rxFactory.is() && rxInStrm.is() ) try
     {
-        Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-        Reference< XActiveDataSink > xDataSink( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextInputStream" ) ), UNO_QUERY_THROW );
+        Reference< XActiveDataSink > xDataSink( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextInputStream" ) ), UNO_QUERY_THROW );
         xDataSink->setInputStream( rxInStrm );
         xTextInStrm.set( xDataSink, UNO_QUERY_THROW );
     }
@@ -139,37 +149,36 @@ Reference< XTextInputStream > InputOutpu
     return xTextInStrm;
 }
 
-Reference< XTextInputStream > InputOutputHelper::openTextInputStream( const OUString& rFileName, const OUString& rEncoding )
+Reference< XTextInputStream > InputOutputHelper::openTextInputStream(
+        const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName, const OUString& rEncoding )
 {
-    return openTextInputStream( openInputStream( rFileName ), rEncoding );
+    return openTextInputStream( rxFactory, openInputStream( rxFactory, rFileName ), rEncoding );
 }
 
-Reference< XOutputStream > InputOutputHelper::openOutputStream( const OUString& rFileName )
+// output streams -------------------------------------------------------------
+
+Reference< XOutputStream > InputOutputHelper::openOutputStream(
+        const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName )
 {
     Reference< XOutputStream > xOutStrm;
-    try
-    {
-        Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-        Reference< XSimpleFileAccess > xFileAccess( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
-        if( !xFileAccess->isFolder( rFileName ) )
+    if( rxFactory.is() ) try
         {
-            try { xFileAccess->kill( rFileName ); } catch( Exception& ) {}
+        Reference< XSimpleFileAccess > xFileAccess( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
             xOutStrm = xFileAccess->openFileWrite( rFileName );
         }
-    }
     catch( Exception& )
     {
     }
     return xOutStrm;
 }
 
-Reference< XTextOutputStream > InputOutputHelper::openTextOutputStream( const Reference< XOutputStream >& rxOutStrm, const OUString& rEncoding )
+Reference< XTextOutputStream > InputOutputHelper::openTextOutputStream(
+        const Reference< XMultiServiceFactory >& rxFactory, const Reference< XOutputStream >& rxOutStrm, const OUString& rEncoding )
 {
     Reference< XTextOutputStream > xTextOutStrm;
-    if( rxOutStrm.is() ) try
+    if( rxFactory.is() && rxOutStrm.is() ) try
     {
-        Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-        Reference< XActiveDataSource > xDataSource( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextOutputStream" ) ), UNO_QUERY_THROW );
+        Reference< XActiveDataSource > xDataSource( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextOutputStream" ) ), UNO_QUERY_THROW );
         xDataSource->setOutputStream( rxOutStrm );
         xTextOutStrm.set( xDataSource, UNO_QUERY_THROW );
     }
@@ -181,9 +190,10 @@ Reference< XTextOutputStream > InputOutp
     return xTextOutStrm;
 }
 
-Reference< XTextOutputStream > InputOutputHelper::openTextOutputStream( const OUString& rFileName, const OUString& rEncoding )
+Reference< XTextOutputStream > InputOutputHelper::openTextOutputStream(
+        const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName, const OUString& rEncoding )
 {
-    return openTextOutputStream( openOutputStream( rFileName ), rEncoding );
+    return openTextOutputStream( rxFactory, openOutputStream( rxFactory, rFileName ), rEncoding );
 }
 
 // ============================================================================
@@ -247,7 +257,7 @@ OUStringVector ItemFormat::parse( const 
 
 // append string to string ----------------------------------------------------
 
-void StringHelper::appendChar( ::rtl::OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount )
+void StringHelper::appendChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount )
 {
     for( sal_Int32 nIndex = 0; nIndex < nCount; ++nIndex )
         rStr.append( cChar );
@@ -370,21 +380,20 @@ void StringHelper::appendHex( OUStringBu
 
 void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix )
 {
-    if( nData != 0 )
         appendHex( rStr, nData, bPrefix );
 }
 
 void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix )
 {
-    appendShortHex( rStr, static_cast< sal_uInt8 >( nData ), bPrefix );
+    appendHex( rStr, nData, bPrefix );
 }
 
 void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix )
 {
-    if( nData > 0xFF )
+    if( nData > SAL_MAX_UINT8 )
         appendHex( rStr, nData, bPrefix );
     else
-        appendShortHex( rStr, static_cast< sal_uInt8 >( nData ), bPrefix );
+        appendHex( rStr, static_cast< sal_uInt8 >( nData ), bPrefix );
 }
 
 void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix )
@@ -394,7 +403,7 @@ void StringHelper::appendShortHex( OUStr
 
 void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix )
 {
-    if( nData > 0xFFFF )
+    if( nData > SAL_MAX_UINT16 )
         appendHex( rStr, nData, bPrefix );
     else
         appendShortHex( rStr, static_cast< sal_uInt16 >( nData ), bPrefix );
@@ -407,7 +416,7 @@ void StringHelper::appendShortHex( OUStr
 
 void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix )
 {
-    if( nData > 0xFFFFFFFF )
+    if( nData > SAL_MAX_UINT32 )
         appendHex( rStr, nData, bPrefix );
     else
         appendShortHex( rStr, static_cast< sal_uInt32 >( nData ), bPrefix );
@@ -418,6 +427,11 @@ void StringHelper::appendShortHex( OUStr
     appendShortHex( rStr, static_cast< sal_uInt64 >( nData ), bPrefix );
 }
 
+void StringHelper::appendShortHex( OUStringBuffer& rStr, double fData, bool bPrefix )
+{
+    appendHex( rStr, fData, bPrefix );
+}
+
 // append binary --------------------------------------------------------------
 
 void StringHelper::appendBin( OUStringBuffer& rStr, sal_uInt8 nData, bool bDots )
@@ -763,7 +777,7 @@ OUString StringHelper::trimSpaces( const
 
 OString StringHelper::convertToUtf8( const OUString& rStr )
 {
-    return ::rtl::OUStringToOString( rStr, RTL_TEXTENCODING_UTF8 );
+    return OUStringToOString( rStr, RTL_TEXTENCODING_UTF8 );
 }
 
 DataType StringHelper::convertToDataType( const OUString& rStr )
@@ -799,6 +813,8 @@ FormatType StringHelper::convertToFormat
         eType = FORMATTYPE_DEC;
     else if( rStr.equalsAscii( "hex" ) )
         eType = FORMATTYPE_HEX;
+    else if( rStr.equalsAscii( "shorthex" ) )
+        eType = FORMATTYPE_SHORTHEX;
     else if( rStr.equalsAscii( "bin" ) )
         eType = FORMATTYPE_BIN;
     else if( rStr.equalsAscii( "fix" ) )
@@ -912,32 +928,32 @@ FormulaStack::FormulaStack() :
 {
 }
 
-void FormulaStack::pushOperand( const StringWrapper& rOp, const OUString& rTokClass )
+void FormulaStack::pushOperand( const String& rOp, const OUString& rTokClass )
 {
-    maFmlaStack.push( rOp.getString() );
+    maFmlaStack.push( rOp );
     maClassStack.push( rTokClass );
 }
 
-void FormulaStack::pushOperand( const StringWrapper& rOp )
+void FormulaStack::pushOperand( const String& rOp )
 {
     pushOperand( rOp, OUString( OOX_DUMP_BASECLASS ) );
 }
 
-void FormulaStack::pushUnaryOp( const StringWrapper& rLOp, const StringWrapper& rROp )
+void FormulaStack::pushUnaryOp( const String& rLOp, const String& rROp )
 {
-    pushUnaryOp( maFmlaStack, rLOp.getString(), rROp.getString() );
-    pushUnaryOp( maClassStack, rLOp.getString(), rROp.getString() );
+    pushUnaryOp( maFmlaStack, rLOp, rROp );
+    pushUnaryOp( maClassStack, rLOp, rROp );
 }
 
-void FormulaStack::pushBinaryOp( const StringWrapper& rOp )
+void FormulaStack::pushBinaryOp( const String& rOp )
 {
-    pushBinaryOp( maFmlaStack, rOp.getString() );
-    pushBinaryOp( maClassStack, rOp.getString() );
+    pushBinaryOp( maFmlaStack, rOp );
+    pushBinaryOp( maClassStack, rOp );
 }
 
-void FormulaStack::pushFuncOp( const StringWrapper& rFunc, const OUString& rTokClass, sal_uInt8 nParamCount )
+void FormulaStack::pushFuncOp( const String& rFunc, const OUString& rTokClass, sal_uInt8 nParamCount )
 {
-    pushFuncOp( maFmlaStack, rFunc.getString(), nParamCount );
+    pushFuncOp( maFmlaStack, rFunc, nParamCount );
     pushFuncOp( maClassStack, rTokClass, nParamCount );
 }
 
@@ -1097,18 +1113,18 @@ NameListBase::~NameListBase()
 {
 }
 
-void NameListBase::setName( sal_Int64 nKey, const StringWrapper& rNameWrp )
+void NameListBase::setName( sal_Int64 nKey, const String& rName )
 {
-    implSetName( nKey, rNameWrp.getString() );
+    implSetName( nKey, rName );
 }
 
-void NameListBase::includeList( NameListRef xList )
+void NameListBase::includeList( const NameListRef& rxList )
 {
-    if( xList.get() )
+    if( rxList.get() )
     {
-        for( const_iterator aIt = xList->begin(), aEnd = xList->end(); aIt != aEnd; ++aIt )
+        for( const_iterator aIt = rxList->begin(), aEnd = rxList->end(); aIt != aEnd; ++aIt )
             maMap[ aIt->first ] = aIt->second;
-        implIncludeList( *xList );
+        implIncludeList( *rxList );
     }
 }
 
@@ -1285,8 +1301,22 @@ OUString FlagsList::implGetName( const C
         sal_Int64 nMask = aIt->first;
         const OUString& rFlagName = aIt->second;
         bool bNegated = (rFlagName.getLength() > 0) && (rFlagName[ 0 ] == '!');
-        if( getFlag( nFlags, nMask ) != bNegated )
-            StringHelper::appendToken( aName, bNegated ? rFlagName.copy( 1 ) : rFlagName );
+        sal_Int32 nBothSep = bNegated ? rFlagName.indexOf( '!', 1 ) : -1;
+        bool bFlag = getFlag( nFlags, nMask );
+        if( bFlag )
+        {
+            if( !bNegated )
+                StringHelper::appendToken( aName, rFlagName );
+            else if( nBothSep > 0 )
+                StringHelper::appendToken( aName, rFlagName.copy( nBothSep + 1 ) );
+        }
+        else if( bNegated )
+        {
+            if( nBothSep > 0 )
+                StringHelper::appendToken( aName, rFlagName.copy( 1, nBothSep - 1 ) );
+            else
+                StringHelper::appendToken( aName, rFlagName.copy( 1 ) );
+        }
         setFlag( nFound, nMask );
     }
     // add unknown flags
@@ -1430,24 +1460,19 @@ void UnitConverter::implIncludeList( con
 
 NameListRef NameListWrapper::getNameList( const Config& rCfg ) const
 {
-    return mxList.get() ? mxList : (mxList = rCfg.getNameList( maNameWrp.getString() ));
+    return mxList.get() ? mxList : (mxList = rCfg.getNameList( maName ));
 }
 
 // ============================================================================
 // ============================================================================
 
-SharedConfigData::SharedConfigData( const OUString& rFileName )
-{
-    construct( rFileName );
-}
-
-SharedConfigData::~SharedConfigData()
-{
-}
-
-void SharedConfigData::construct( const OUString& rFileName )
+SharedConfigData::SharedConfigData( const OUString& rFileName,
+        const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName ) :
+    mxFactory( rxFactory ),
+    mxRootStrg( rxRootStrg ),
+    maSysFileName( rSysFileName ),
+    mbLoaded( false )
 {
-    mbLoaded = false;
     OUString aFileUrl = InputOutputHelper::convertFileNameToUrl( rFileName );
     if( aFileUrl.getLength() > 0 )
     {
@@ -1457,6 +1482,10 @@ void SharedConfigData::construct( const 
     }
 }
 
+SharedConfigData::~SharedConfigData()
+{
+}
+
 void SharedConfigData::setOption( const OUString& rKey, const OUString& rData )
 {
     maConfigData[ rKey ] = rData;
@@ -1468,10 +1497,10 @@ const OUString* SharedConfigData::getOpt
     return (aIt == maConfigData.end()) ? 0 : &aIt->second;
 }
 
-void SharedConfigData::setNameList( const OUString& rListName, NameListRef xList )
+void SharedConfigData::setNameList( const OUString& rListName, const NameListRef& rxList )
 {
     if( rListName.getLength() > 0 )
-        maNameLists[ rListName ] = xList;
+        maNameLists[ rListName ] = rxList;
 }
 
 void SharedConfigData::eraseNameList( const OUString& rListName )
@@ -1490,7 +1519,7 @@ NameListRef SharedConfigData::getNameLis
 
 bool SharedConfigData::implIsValid() const
 {
-    return mbLoaded;
+    return mbLoaded && mxFactory.is() && mxRootStrg.get() && (maSysFileName.getLength() > 0);
 }
 
 void SharedConfigData::implProcessConfigItemStr(
@@ -1520,7 +1549,7 @@ bool SharedConfigData::readConfigFile( c
     if( !bLoaded )
     {
         Reference< XTextInputStream > xTextInStrm =
-            InputOutputHelper::openTextInputStream( rFileUrl, CREATE_OUSTRING( "UTF-8" ) );
+            InputOutputHelper::openTextInputStream( mxFactory, rFileUrl, CREATE_OUSTRING( "UTF-8" ) );
         if( xTextInStrm.is() )
         {
             maConfigFiles.insert( rFileUrl );
@@ -1582,14 +1611,14 @@ Config::Config( const Config& rParent ) 
     construct( rParent );
 }
 
-Config::Config( const OUString& rFileName )
+Config::Config( const sal_Char* pcEnvVar, const FilterBase& rFilter )
 {
-    construct( rFileName );
+    construct( pcEnvVar, rFilter );
 }
 
-Config::Config( const sal_Char* pcEnvVar )
+Config::Config( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName )
 {
-    construct( pcEnvVar );
+    construct( pcEnvVar, rxFactory, rxRootStrg, rSysFileName );
 }
 
 Config::~Config()
@@ -1601,32 +1630,33 @@ void Config::construct( const Config& rP
     *this = rParent;
 }
 
-void Config::construct( const OUString& rFileName )
+void Config::construct( const sal_Char* pcEnvVar, const FilterBase& rFilter )
 {
-    mxCfgData.reset( new SharedConfigData( rFileName ) );
+    if( rFilter.getFileUrl().getLength() > 0 )
+        construct( pcEnvVar, rFilter.getGlobalFactory(), rFilter.getStorage(), rFilter.getFileUrl() );
 }
 
-void Config::construct( const sal_Char* pcEnvVar )
+void Config::construct( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName )
 {
-    if( pcEnvVar )
+    if( pcEnvVar && rxRootStrg.get() && (rSysFileName.getLength() > 0) )
         if( const sal_Char* pcFileName = ::getenv( pcEnvVar ) )
-            construct( OUString::createFromAscii( pcFileName ) );
+            mxCfgData.reset( new SharedConfigData( OUString::createFromAscii( pcFileName ), rxFactory, rxRootStrg, rSysFileName ) );
 }
 
-void Config::setStringOption( const StringWrapper& rKey, const StringWrapper& rData )
+void Config::setStringOption( const String& rKey, const String& rData )
 {
-    mxCfgData->setOption( rKey.getString(), rData.getString() );
+    mxCfgData->setOption( rKey, rData );
 }
 
-const OUString& Config::getStringOption( const StringWrapper& rKey, const OUString& rDefault ) const
+const OUString& Config::getStringOption( const String& rKey, const OUString& rDefault ) const
 {
-    const OUString* pData = implGetOption( rKey.getString() );
+    const OUString* pData = implGetOption( rKey );
     return pData ? *pData : rDefault;
 }
 
-bool Config::getBoolOption( const StringWrapper& rKey, bool bDefault ) const
+bool Config::getBoolOption( const String& rKey, bool bDefault ) const
 {
-    const OUString* pData = implGetOption( rKey.getString() );
+    const OUString* pData = implGetOption( rKey );
     return pData ? StringHelper::convertStringToBool( *pData ) : bDefault;
 }
 
@@ -1640,19 +1670,19 @@ bool Config::isImportEnabled() const
     return getBoolOption( "enable-import", true );
 }
 
-void Config::setNameList( const StringWrapper& rListName, NameListRef xList )
+void Config::setNameList( const String& rListName, const NameListRef& rxList )
 {
-    mxCfgData->setNameList( rListName.getString(), xList );
+    mxCfgData->setNameList( rListName, rxList );
 }
 
-void Config::eraseNameList( const StringWrapper& rListName )
+void Config::eraseNameList( const String& rListName )
 {
-    mxCfgData->eraseNameList( rListName.getString() );
+    mxCfgData->eraseNameList( rListName );
 }
 
-NameListRef Config::getNameList( const StringWrapper& rListName ) const
+NameListRef Config::getNameList( const String& rListName ) const
 {
-    return implGetNameList( rListName.getString() );
+    return implGetNameList( rListName );
 }
 
 bool Config::implIsValid() const
@@ -1673,78 +1703,14 @@ NameListRef Config::implGetNameList( con
 // ============================================================================
 // ============================================================================
 
-bool Input::implIsValid() const
-{
-    return true;
-}
-
-Input& operator>>( Input& rIn, sal_Int64& rnData )
-{
-    return rIn >> *reinterpret_cast< double* >( &rnData );
-}
-
-Input& operator>>( Input& rIn, sal_uInt64& rnData )
-{
-    return rIn >> *reinterpret_cast< double* >( &rnData );
-}
-
-// ============================================================================
-
-BinaryInput::BinaryInput( BinaryInputStream& rStrm ) :
-    mrStrm( rStrm )
-{
-}
-
-sal_Int64 BinaryInput::getSize() const
-{
-    return mrStrm.getLength();
-}
-
-sal_Int64 BinaryInput::tell() const
-{
-    return mrStrm.tell();
-}
-
-void BinaryInput::seek( sal_Int64 nPos )
-{
-    mrStrm.seek( nPos );
-}
-
-void BinaryInput::skip( sal_Int32 nBytes )
-{
-    mrStrm.skip( nBytes );
-}
-
-sal_Int32 BinaryInput::read( void* pBuffer, sal_Int32 nBytes )
-{
-    return mrStrm.read( pBuffer, nBytes );
-}
-
-bool BinaryInput::implIsValid() const
-{
-    return mrStrm.is() && Input::implIsValid();
-}
-
-BinaryInput& BinaryInput::operator>>( sal_Int8& rnData )   { mrStrm >> rnData; return *this; }
-BinaryInput& BinaryInput::operator>>( sal_uInt8& rnData )  { mrStrm >> rnData; return *this; }
-BinaryInput& BinaryInput::operator>>( sal_Int16& rnData )  { mrStrm >> rnData; return *this; }
-BinaryInput& BinaryInput::operator>>( sal_uInt16& rnData ) { mrStrm >> rnData; return *this; }
-BinaryInput& BinaryInput::operator>>( sal_Int32& rnData )  { mrStrm >> rnData; return *this; }
-BinaryInput& BinaryInput::operator>>( sal_uInt32& rnData ) { mrStrm >> rnData; return *this; }
-BinaryInput& BinaryInput::operator>>( float& rfData )      { mrStrm >> rfData; return *this; }
-BinaryInput& BinaryInput::operator>>( double& rfData )     { mrStrm >> rfData; return *this; }
-
-// ============================================================================
-// ============================================================================
-
 Output::Output( const Reference< XTextOutputStream >& rxStrm )
 {
     construct( rxStrm );
 }
 
-Output::Output( const ::rtl::OUString& rFileName )
+Output::Output( const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName )
 {
-    construct( InputOutputHelper::openTextOutputStream( rFileName, CREATE_OUSTRING( "UTF-8" ) ) );
+    construct( InputOutputHelper::openTextOutputStream( rxFactory, rFileName, CREATE_OUSTRING( "UTF-8" ) ) );
 }
 
 // ----------------------------------------------------------------------------
@@ -1860,15 +1826,15 @@ void Output::resetItemIndex( sal_Int64 n
     mnItemIdx = nIdx;
 }
 
-void Output::startItem( const sal_Char* pcName )
+void Output::startItem( const String& rItemName )
 {
     if( mnItemLevel == 0 )
     {
         if( (mnMultiLevel > 0) && (maLine.getLength() > 0) )
             tab();
-        if( pcName )
+        if( rItemName.has() )
         {
-            writeItemName( pcName );
+            writeItemName( rItemName );
             writeChar( OOX_DUMP_ITEMSEP );
         }
     }
@@ -1951,16 +1917,16 @@ void Output::writeBool( bool bData )
     StringHelper::appendBool( maLine, bData );
 }
 
-void Output::writeColor( sal_Int32 nColor )
+void Output::writeColorABGR( sal_Int32 nColor )
 {
     writeChar( 'a' );
     writeDec( static_cast< sal_uInt8 >( nColor >> 24 ) );
     writeAscii( ",r" );
-    writeDec( static_cast< sal_uInt8 >( nColor >> 16 ) );
+    writeDec( static_cast< sal_uInt8 >( nColor ) );
     writeAscii( ",g" );
     writeDec( static_cast< sal_uInt8 >( nColor >> 8 ) );
     writeAscii( ",b" );
-    writeDec( static_cast< sal_uInt8 >( nColor ) );
+    writeDec( static_cast< sal_uInt8 >( nColor >> 16 ) );
 }
 
 void Output::writeDateTime( const DateTime& rDateTime )
@@ -2035,9 +2001,7 @@ void Output::construct( const Reference<
     if( mxStrm.is() )
     {
         writeChar( OOX_DUMP_BOM );
-        writeAscii( "OpenOffice.org binary file dumper v2.0" );
         newLine();
-        emptyLine();
     }
 }
 
@@ -2046,15 +2010,67 @@ bool Output::implIsValid() const
     return mxStrm.is();
 }
 
-void Output::writeItemName( const sal_Char* pcName )
+void Output::writeItemName( const String& rItemName )
 {
-    if( pcName && (*pcName == '#') )
+    if( rItemName.has() && (rItemName[ 0 ] == '#') )
     {
-        writeAscii( pcName + 1 );
+        writeString( rItemName.copy( 1 ) );
         StringHelper::appendIndex( maLine, mnItemIdx++ );
     }
     else
-        writeAscii( pcName );
+        writeString( rItemName );
+}
+
+// ============================================================================
+
+StorageIterator::StorageIterator( const StorageRef& rxStrg ) :
+    mxStrg( rxStrg )
+{
+    if( mxStrg.get() )
+        mxStrg->getElementNames( maNames );
+    maIt = maNames.begin();
+}
+
+StorageIterator::~StorageIterator()
+{
+}
+
+size_t StorageIterator::getElementCount() const
+{
+    return maNames.size();
+}
+
+StorageIterator& StorageIterator::operator++()
+{
+    if( maIt != maNames.end() )
+        ++maIt;
+    return *this;
+}
+
+OUString StorageIterator::getName() const
+{
+    OUString aName;
+    if( maIt != maNames.end() )
+        aName = *maIt;
+    return aName;
+}
+
+bool StorageIterator::isStream() const
+{
+    return isValid() && mxStrg->openInputStream( *maIt ).is();
+}
+
+bool StorageIterator::isStorage() const
+{
+    if( !isValid() )
+        return false;
+    StorageRef xStrg = mxStrg->openSubStorage( *maIt, false );
+    return xStrg.get() && xStrg->isStorage();
+}
+
+bool StorageIterator::implIsValid() const
+{
+    return mxStrg.get() && mxStrg->isStorage() && (maIt != maNames.end());
 }
 
 // ============================================================================
@@ -2064,10 +2080,9 @@ ObjectBase::~ObjectBase()
 {
 }
 
-void ObjectBase::construct( const FilterBase& rFilter, ConfigRef xConfig )
+void ObjectBase::construct( const ConfigRef& rxConfig )
 {
-    mpFilter = &rFilter;
-    mxConfig = xConfig;
+    mxConfig = rxConfig;
 }
 
 void ObjectBase::construct( const ObjectBase& rParent )
@@ -2083,141 +2098,149 @@ void ObjectBase::dump()
 
 bool ObjectBase::implIsValid() const
 {
-    return mpFilter && mpFilter->isImportFilter() && isValid( mxConfig );
-}
-
-ConfigRef ObjectBase::implReconstructConfig()
-{
-    return mxConfig;
+    return isValid( mxConfig );
 }
 
 void ObjectBase::implDump()
 {
 }
 
-void ObjectBase::reconstructConfig()
+void ObjectBase::reconstructConfig( const ConfigRef& rxConfig )
 {
-    mxConfig = implReconstructConfig();
+    if( isValid( rxConfig ) )
+        mxConfig = rxConfig;
 }
 
 // ============================================================================
 // ============================================================================
 
-RootStorageObjectBase::~RootStorageObjectBase()
+void StorageObjectBase::construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath )
 {
+    ObjectBase::construct( rParent );
+    mxStrg = rxStrg;
+    maSysPath = rSysPath;
 }
 
-void RootStorageObjectBase::construct( const ObjectBase& rParent )
+void StorageObjectBase::construct( const ObjectBase& rParent )
 {
     ObjectBase::construct( rParent );
+    if( ObjectBase::implIsValid() )
+    {
+        mxStrg = cfg().getRootStorage();
+        maSysPath = cfg().getSysFileName();
+    }
 }
 
-void RootStorageObjectBase::implDump()
+bool StorageObjectBase::implIsValid() const
 {
-    StorageRef xStrg = getFilter().getStorage();
-    if( xStrg.get() && xStrg->isStorage() )
-        extractStorage( xStrg, getFilter().getFileUrl() + CREATE_OUSTRING( ".dump" ) );
+    return mxStrg.get() && mxStrg->isStorage() && (maSysPath.getLength() > 0) && ObjectBase::implIsValid();
 }
 
-void RootStorageObjectBase::implDumpStream( BinaryInputStreamRef, const OUString&, const OUString&, const OUString& )
+void StorageObjectBase::implDump()
 {
+    try
+    {
+        Reference< XSimpleFileAccess > xFileAccess( getFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
+        xFileAccess->kill( maSysPath + OOX_DUMP_DUMPEXT );
 }
-
-void RootStorageObjectBase::extractStream( StorageBase& rStrg, const OUString& rStrmName, const OUString& rSystemFileName )
+    catch( Exception& )
 {
-    BinaryInputStream aInStrm( rStrg.openInputStream( rStrmName ), true );
-    if( aInStrm.is() )
+    }
+    extractStorage( mxStrg, OUString(), maSysPath );
+}
+
+void StorageObjectBase::implDumpStream( const BinaryInputStreamRef&, const OUString&, const OUString&, const OUString& )
     {
-        BinaryOutputStream aOutStrm( InputOutputHelper::openOutputStream( rSystemFileName ), true );
-        if( aOutStrm.is() )
-            aOutStrm.copy( aInStrm );
     }
-    BinaryInputStreamRef xDumpStrm( new BinaryInputStream( InputOutputHelper::openInputStream( rSystemFileName ), true ) );
-    if( xDumpStrm->is() )
-        implDumpStream( xDumpStrm, rStrg.getPath(), rStrmName, rSystemFileName + CREATE_OUSTRING( ".dump" ) );
+
+void StorageObjectBase::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
+{
+    extractStorage( rxStrg, rStrgPath, rSysPath );
 }
 
-void RootStorageObjectBase::extractStorage( StorageRef xStrg, const OUString& rSystemPath )
+void StorageObjectBase::addPreferredStream( const String& rStrmName )
 {
-    // create directory in file system
-    ::osl::FileBase::RC eRes = ::osl::Directory::create( rSystemPath );
-    if( (eRes == ::osl::FileBase::E_None) || (eRes == ::osl::FileBase::E_EXIST) )
+    if( rStrmName.has() )
+        maPreferred.push_back( PreferredItem( rStrmName, false ) );
+}
+
+void StorageObjectBase::addPreferredStorage( const String& rStrgPath )
     {
-        // process children of the storage
-        for( StorageIterator aIt( xStrg ); aIt.isValid(); ++aIt )
+    if( rStrgPath.has() )
+        maPreferred.push_back( PreferredItem( rStrgPath, true ) );
+}
+
+OUString StorageObjectBase::getSysFileName( const OUString& rStrmName, const OUString& rSysOutPath )
         {
             // encode all characters < 0x20
             OUStringBuffer aBuffer;
-            StringHelper::appendEncString( aBuffer, aIt.getName(), false );
+    StringHelper::appendEncString( aBuffer, rStrmName, false );
 
             // replace all characters reserved in file system
-            OUString aSystemName = aBuffer.makeStringAndClear();
+    OUString aFileName = aBuffer.makeStringAndClear();
             static const sal_Unicode spcReserved[] = { '/', '\\', ':', '*', '?', '<', '>', '|' };
             for( const sal_Unicode* pcChar = spcReserved; pcChar < STATIC_ARRAY_END( spcReserved ); ++pcChar )
-                aSystemName = aSystemName.replace( *pcChar, '_' );
+        aFileName = aFileName.replace( *pcChar, '_' );
 
             // build full path
-            OUString aFullSystemName = rSystemPath + OUString( sal_Unicode( '/' ) ) + aSystemName;
-
-            // handle storages and streams
-            if( aIt.isStorage() )
-                extractStorage( xStrg->openSubStorage( aIt.getName(), false ), aFullSystemName );
-            else if( aIt.isStream() )
-                extractStream( *xStrg, aIt.getName(), aFullSystemName );
+    return rSysOutPath + OUString( sal_Unicode( '/' ) ) + aFileName;
         }
-    }
-}
-
-// ============================================================================
 
-StorageIterator::StorageIterator( StorageRef xStrg ) :
-    mxStrg( xStrg )
+void StorageObjectBase::extractStream( StorageBase& rStrg, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
 {
-    if( mxStrg.get() )
-        mxStrg->getElementNames( maNames );
-    maIt = maNames.begin();
-}
-
-StorageIterator::~StorageIterator()
+    BinaryXInputStream aInStrm( rStrg.openInputStream( rStrmName ), true );
+    if( !aInStrm.isEof() )
 {
+        BinaryXOutputStream aOutStrm( InputOutputHelper::openOutputStream( getFactory(), rSysFileName ), true );
+        if( !aOutStrm.isEof() )
+            aOutStrm.copyStream( aInStrm );
 }
-
-size_t StorageIterator::getElementCount() const
-{
-    return maNames.size();
+    BinaryXInputStreamRef xDumpStrm( new BinaryXInputStream( InputOutputHelper::openInputStream( getFactory(), rSysFileName ), true ) );
+    if( !xDumpStrm->isEof() )
+        implDumpStream( xDumpStrm, rStrgPath, rStrmName, rSysFileName );
 }
 
-StorageIterator& StorageIterator::operator++()
+void StorageObjectBase::extractStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
 {
-    if( maIt != maNames.end() )
-        ++maIt;
-    return *this;
-}
+    OUString aSysOutPath = rSysPath + OOX_DUMP_DUMPEXT;
 
-OUString StorageIterator::getName() const
-{
-    OUString aName;
-    if( maIt != maNames.end() )
-        aName = *maIt;
-    return aName;
-}
+    // create directory in file system
+    ::osl::FileBase::RC eRes = ::osl::Directory::create( aSysOutPath );
+    if( (eRes != ::osl::FileBase::E_None) && (eRes != ::osl::FileBase::E_EXIST) )
+        return;
 
-bool StorageIterator::isStream() const
+    // process preferred storages and streams in root storage first
+    if( rStrgPath.getLength() == 0 )
+        for( PreferredItemVector::iterator aIt = maPreferred.begin(), aEnd = maPreferred.end(); aIt != aEnd; ++aIt )
+            extractItem( rxStrg, rStrgPath, aIt->maName, aSysOutPath, aIt->mbStorage, !aIt->mbStorage );
+
+    // process children of the storage
+    for( StorageIterator aIt( rxStrg ); aIt.isValid(); ++aIt )
 {
-    return isValid() && mxStrg->openInputStream( *maIt ).is();
+        // skip processed preferred items
+        OUString aItemName = aIt.getName();
+        bool bFound = false;
+        if( rStrgPath.getLength() == 0 )
+            for( PreferredItemVector::iterator aIIt = maPreferred.begin(), aIEnd = maPreferred.end(); !bFound && (aIIt != aIEnd); ++aIIt )
+                bFound = aIIt->maName == aItemName;
+        if( !bFound )
+            extractItem( rxStrg, rStrgPath, aItemName, aSysOutPath, aIt.isStorage(), aIt.isStream() );
+    }
 }
 
-bool StorageIterator::isStorage() const
+void StorageObjectBase::extractItem( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rItemName, const OUString& rSysOutPath, bool bIsStrg, bool bIsStrm )
 {
-    if( !isValid() )
-        return false;
-    StorageRef xStrg = mxStrg->openSubStorage( *maIt, false );
-    return xStrg.get() && xStrg->isStorage();
+    OUString aSysFileName = getSysFileName( rItemName, rSysOutPath );
+    if( bIsStrg )
+    {
+        OUStringBuffer aStrgPath( rStrgPath );
+        StringHelper::appendToken( aStrgPath, rItemName, '/' );
+        implDumpStorage( rxStrg->openSubStorage( rItemName, false ), aStrgPath.makeStringAndClear(), aSysFileName );
 }
-
-bool StorageIterator::implIsValid() const
+    else if( bIsStrm )
 {
-    return mxStrg.get() && mxStrg->isStorage() && (maIt != maNames.end());
+        extractStream( *rxStrg, rStrgPath, rItemName, aSysFileName );
+    }
 }
 
 // ============================================================================
@@ -2227,16 +2250,17 @@ OutputObjectBase::~OutputObjectBase()
 {
 }
 
-void OutputObjectBase::construct( const ObjectBase& rParent, const OUString& rOutFileName )
+void OutputObjectBase::construct( const ObjectBase& rParent, const OUString& rSysFileName )
 {
     ObjectBase::construct( rParent );
-    mxOut.reset( new Output( rOutFileName ) );
+    if( ObjectBase::implIsValid() )
+        mxOut.reset( new Output( getFactory(), rSysFileName + OOX_DUMP_DUMPEXT ) );
 }
 
-void OutputObjectBase::construct( const ObjectBase& rParent, OutputRef xOut )
+void OutputObjectBase::construct( const ObjectBase& rParent, const OutputRef& rxOut )
 {
     ObjectBase::construct( rParent );
-    mxOut = xOut;
+    mxOut = rxOut;
 }
 
 void OutputObjectBase::construct( const OutputObjectBase& rParent )
@@ -2249,30 +2273,28 @@ bool OutputObjectBase::implIsValid() con
     return isValid( mxOut ) && ObjectBase::implIsValid();
 }
 
-OutputRef OutputObjectBase::implReconstructOutput()
+void OutputObjectBase::writeEmptyItem( const String& rName )
 {
-    return mxOut;
+    ItemGuard aItem( *mxOut, rName );
 }
 
-void OutputObjectBase::reconstructOutput()
+void OutputObjectBase::writeInfoItem( const String& rName, const String& rData )
 {
-    mxOut = implReconstructOutput();
+    ItemGuard aItem( *mxOut, rName );
+    mxOut->writeString( rData );
 }
 
-void OutputObjectBase::writeEmptyItem( const sal_Char* pcName )
+void OutputObjectBase::writeCharItem( const String& rName, sal_Unicode cData )
 {
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
+    mxOut->writeChar( OOX_DUMP_STRQUOTE );
+    mxOut->writeChar( cData );
+    mxOut->writeChar( OOX_DUMP_STRQUOTE );
 }
 
-void OutputObjectBase::writeInfoItem( const sal_Char* pcName, const StringWrapper& rData )
+void OutputObjectBase::writeStringItem( const String& rName, const OUString& rData )
 {
-    ItemGuard aItem( *mxOut, pcName );
-    mxOut->writeString( rData.getString() );
-}
-
-void OutputObjectBase::writeStringItem( const sal_Char* pcName, const ::rtl::OUString& rData )
-{
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
     mxOut->writeAscii( "(len=" );
     mxOut->writeDec( rData.getLength() );
     mxOut->writeAscii( ")," );
@@ -2283,127 +2305,127 @@ void OutputObjectBase::writeStringItem( 
         mxOut->writeAscii( ",cut" );
 }
 
-void OutputObjectBase::writeArrayItem( const sal_Char* pcName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep )
+void OutputObjectBase::writeArrayItem( const String& rName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep )
 {
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
     mxOut->writeArray( pnData, nSize, cSep );
 }
 
-void OutputObjectBase::writeBoolItem( const sal_Char* pcName, bool bData )
+void OutputObjectBase::writeBoolItem( const String& rName, bool bData )
 {
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
     mxOut->writeBool( bData );
 }
 
-double OutputObjectBase::writeRkItem( const sal_Char* pcName, sal_Int32 nRk )
+double OutputObjectBase::writeRkItem( const String& rName, sal_Int32 nRk )
 {
     MultiItemsGuard aMultiGuard( out() );
-    writeHexItem( pcName, static_cast< sal_uInt32 >( nRk ), "RK-FLAGS" );
+    writeHexItem( rName, static_cast< sal_uInt32 >( nRk ), "RK-FLAGS" );
     double fValue = ::oox::xls::BiffHelper::calcDoubleFromRk( nRk );
     writeDecItem( "decoded", fValue );
     return fValue;
 }
 
-void OutputObjectBase::writeColorItem( const sal_Char* pcName, sal_Int32 nColor )
+void OutputObjectBase::writeColorABGRItem( const String& rName, sal_Int32 nColor )
 {
-    ItemGuard aItem( *mxOut, pcName );
-    writeHexItem( pcName, nColor );
-    mxOut->writeColor( nColor );
+    ItemGuard aItem( *mxOut, rName );
+    writeHexItem( rName, nColor );
+    mxOut->writeColorABGR( nColor );
 }
 
-void OutputObjectBase::writeDateTimeItem( const sal_Char* pcName, const DateTime& rDateTime )
+void OutputObjectBase::writeDateTimeItem( const String& rName, const DateTime& rDateTime )
 {
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
     mxOut->writeDateTime( rDateTime );
 }
 
-void OutputObjectBase::writeGuidItem( const sal_Char* pcName, const OUString& rGuid )
+void OutputObjectBase::writeGuidItem( const String& rName, const OUString& rGuid )
 {
-    ItemGuard aItem( *mxOut, pcName );
+    ItemGuard aItem( *mxOut, rName );
     mxOut->writeString( rGuid );
     aItem.cont();
     mxOut->writeString( cfg().getStringOption( rGuid, OUString() ) );
 }
 
-void OutputObjectBase::writeColIndexItem( const sal_Char* pcName, sal_Int32 nCol )
+void OutputObjectBase::writeColIndexItem( const String& rName, sal_Int32 nCol )
 {
     Output& rOut = out();
-    ItemGuard aItem( rOut, pcName );
+    ItemGuard aItem( rOut, rName );
     rOut.writeDec( nCol );
     aItem.cont();
     rOut.writeColIndex( nCol );
 }
 
-void OutputObjectBase::writeRowIndexItem( const sal_Char* pcName, sal_Int32 nRow )
+void OutputObjectBase::writeRowIndexItem( const String& rName, sal_Int32 nRow )
 {
     Output& rOut = out();
-    ItemGuard aItem( rOut, pcName );
+    ItemGuard aItem( rOut, rName );
     rOut.writeDec( nRow );
     aItem.cont();
     rOut.writeRowIndex( nRow );
 }
 
-void OutputObjectBase::writeColRangeItem( const sal_Char* pcName, sal_Int32 nCol1, sal_Int32 nCol2 )
+void OutputObjectBase::writeColRangeItem( const String& rName, sal_Int32 nCol1, sal_Int32 nCol2 )
 {
     Output& rOut = out();
-    ItemGuard aItem( rOut, pcName );
+    ItemGuard aItem( rOut, rName );
     rOut.writeColRowRange( nCol1, nCol2 );
     aItem.cont();
     rOut.writeColRange( nCol1, nCol2 );
 }
 
-void OutputObjectBase::writeRowRangeItem( const sal_Char* pcName, sal_Int32 nRow1, sal_Int32 nRow2 )
+void OutputObjectBase::writeRowRangeItem( const String& rName, sal_Int32 nRow1, sal_Int32 nRow2 )
 {
     Output& rOut = out();
-    ItemGuard aItem( rOut, pcName );
+    ItemGuard aItem( rOut, rName );
     rOut.writeColRowRange( nRow1, nRow2 );
     aItem.cont();
     rOut.writeRowRange( nRow1, nRow2 );
 }
 
-void OutputObjectBase::writeAddressItem( const sal_Char* pcName, const Address& rPos )
+void OutputObjectBase::writeAddressItem( const String& rName, const Address& rPos )
 {
-    ItemGuard aItem( out(), pcName );
+    ItemGuard aItem( out(), rName );
     StringHelper::appendAddress( out().getLine(), rPos );
 }
 
-void OutputObjectBase::writeRangeItem( const sal_Char* pcName, const Range& rRange )
+void OutputObjectBase::writeRangeItem( const String& rName, const Range& rRange )
 {
-    ItemGuard aItem( out(), pcName );
+    ItemGuard aItem( out(), rName );
     StringHelper::appendRange( out().getLine(), rRange );
 }
 
-void OutputObjectBase::writeRangeListItem( const sal_Char* pcName, const RangeList& rRanges )
+void OutputObjectBase::writeRangeListItem( const String& rName, const RangeList& rRanges )
 {
     MultiItemsGuard aMultiGuard( out() );
-    writeEmptyItem( pcName );
+    writeEmptyItem( rName );
     writeDecItem( "count", static_cast< sal_uInt16 >( rRanges.size() ) );
     ItemGuard aItem( out(), "ranges" );
     StringHelper::appendRangeList( out().getLine(), rRanges );
 }
 
-void OutputObjectBase::writeTokenAddressItem( const sal_Char* pcName, const TokenAddress& rPos, bool bNameMode )
+void OutputObjectBase::writeTokenAddressItem( const String& rName, const TokenAddress& rPos, bool bNameMode )
 {
-    ItemGuard aItem( out(), pcName );
+    ItemGuard aItem( out(), rName );
     StringHelper::appendAddress( out().getLine(), rPos, bNameMode );
 }
 
-void OutputObjectBase::writeTokenAddress3dItem( const sal_Char* pcName, const OUString& rRef, const TokenAddress& rPos, bool bNameMode )
+void OutputObjectBase::writeTokenAddress3dItem( const String& rName, const OUString& rRef, const TokenAddress& rPos, bool bNameMode )
 {
-    ItemGuard aItem( out(), pcName );
+    ItemGuard aItem( out(), rName );
     out().writeString( rRef );
     StringHelper::appendAddress( out().getLine(), rPos, bNameMode );
 }
 
-void OutputObjectBase::writeTokenRangeItem( const sal_Char* pcName, const TokenRange& rRange, bool bNameMode )
+void OutputObjectBase::writeTokenRangeItem( const String& rName, const TokenRange& rRange, bool bNameMode )
 {
-    ItemGuard aItem( out(), pcName );
+    ItemGuard aItem( out(), rName );
     StringHelper::appendRange( out().getLine(), rRange, bNameMode );
 }
 
-void OutputObjectBase::writeTokenRange3dItem( const sal_Char* pcName, const OUString& rRef, const TokenRange& rRange, bool bNameMode )
+void OutputObjectBase::writeTokenRange3dItem( const String& rName, const OUString& rRef, const TokenRange& rRange, bool bNameMode )
 {
-    ItemGuard aItem( out(), pcName );
+    ItemGuard aItem( out(), rName );
     out().writeString( rRef );
     StringHelper::appendRange( out().getLine(), rRange, bNameMode );
 }
@@ -2415,22 +2437,22 @@ InputObjectBase::~InputObjectBase()
 {
 }
 
-void InputObjectBase::construct( const ObjectBase& rParent, const ::rtl::OUString& rOutFileName, InputRef xIn )
+void InputObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
 {
-    OutputObjectBase::construct( rParent, rOutFileName );
-    mxIn = xIn;
+    OutputObjectBase::construct( rParent, rSysFileName );
+    mxStrm = rxStrm;
 }
 
-void InputObjectBase::construct( const ObjectBase& rParent, OutputRef xOut, InputRef xIn )
+void InputObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OutputRef& rxOut )
 {
-    OutputObjectBase::construct( rParent, xOut );
-    mxIn = xIn;
+    OutputObjectBase::construct( rParent, rxOut );
+    mxStrm = rxStrm;
 }
 
-void InputObjectBase::construct( const OutputObjectBase& rParent, InputRef xIn )
+void InputObjectBase::construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
 {
     OutputObjectBase::construct( rParent );
-    mxIn = xIn;
+    mxStrm = rxStrm;
 }
 
 void InputObjectBase::construct( const InputObjectBase& rParent )
@@ -2440,31 +2462,21 @@ void InputObjectBase::construct( const I
 
 bool InputObjectBase::implIsValid() const
 {
-    return isValid( mxIn ) && OutputObjectBase::implIsValid();
+    return mxStrm.get() && OutputObjectBase::implIsValid();
 }
 
-InputRef InputObjectBase::implReconstructInput()
+void InputObjectBase::skipBlock( sal_Int64 nBytes, bool bShowSize )
 {
-    return mxIn;
-}
-
-void InputObjectBase::reconstructInput()
-{
-    mxIn = implReconstructInput();
-}
-
-void InputObjectBase::skipBlock( sal_Int32 nBytes, bool bShowSize )
-{
-    sal_Int64 nEndPos = ::std::min< sal_Int64 >( mxIn->tell() + nBytes, mxIn->getSize() );
-    if( mxIn->tell() < nEndPos )
+    sal_Int64 nEndPos = ::std::min< sal_Int64 >( mxStrm->tell() + nBytes, mxStrm->getLength() );
+    if( mxStrm->tell() < nEndPos )
     {
         if( bShowSize )
-            writeDecItem( "skipped-data-size", static_cast< sal_uInt64 >( nEndPos - mxIn->tell() ) );
-        mxIn->seek( nEndPos );
+            writeDecItem( "skipped-data-size", static_cast< sal_uInt64 >( nEndPos - mxStrm->tell() ) );
+        mxStrm->seek( nEndPos );
     }
 }
 
-void InputObjectBase::dumpRawBinary( sal_Int32 nBytes, bool bShowOffset, bool bStream )
+void InputObjectBase::dumpRawBinary( sal_Int64 nBytes, bool bShowOffset, bool bStream )
 {
     Output& rOut = out();
     TableGuard aTabGuard( rOut,
@@ -2473,13 +2485,13 @@ void InputObjectBase::dumpRawBinary( sal
         3 * OOX_DUMP_BYTESPERLINE / 2 + 1,
         OOX_DUMP_BYTESPERLINE / 2 + 1 );
 
-    sal_Int32 nMaxShowSize = cfg().getIntOption< sal_Int32 >(
-        bStream ? "max-binary-stream-size" : "max-binary-data-size", SAL_MAX_INT32 );
+    sal_Int64 nMaxShowSize = cfg().getIntOption< sal_Int64 >(
+        bStream ? "max-binary-stream-size" : "max-binary-data-size", SAL_MAX_INT64 );
 
-    bool bSeekable = mxIn->getSize() >= 0;
-    sal_Int64 nEndPos = bSeekable ? ::std::min< sal_Int64 >( mxIn->tell() + nBytes, mxIn->getSize() ) : 0;
-    sal_Int64 nDumpEnd = bSeekable ? ::std::min< sal_Int64 >( mxIn->tell() + nMaxShowSize, nEndPos ) : nMaxShowSize;
-    sal_Int64 nPos = bSeekable ? mxIn->tell() : 0;
+    bool bSeekable = mxStrm->getLength() >= 0;
+    sal_Int64 nEndPos = bSeekable ? ::std::min< sal_Int64 >( mxStrm->tell() + nBytes, mxStrm->getLength() ) : 0;
+    sal_Int64 nDumpEnd = bSeekable ? ::std::min< sal_Int64 >( mxStrm->tell() + nMaxShowSize, nEndPos ) : nMaxShowSize;
+    sal_Int64 nPos = bSeekable ? mxStrm->tell() : 0;
     bool bLoop = true;
 
     while( bLoop && (nPos < nDumpEnd) )
@@ -2488,8 +2500,8 @@ void InputObjectBase::dumpRawBinary( sal
         rOut.tab();
 
         sal_uInt8 pnLineData[ OOX_DUMP_BYTESPERLINE ];
-        sal_Int32 nLineSize = bSeekable ? ::std::min( static_cast< sal_Int32 >( nDumpEnd - mxIn->tell() ), OOX_DUMP_BYTESPERLINE ) : OOX_DUMP_BYTESPERLINE;
-        sal_Int32 nReadSize = mxIn->read( pnLineData, nLineSize );
+        sal_Int32 nLineSize = bSeekable ? ::std::min( static_cast< sal_Int32 >( nDumpEnd - mxStrm->tell() ), OOX_DUMP_BYTESPERLINE ) : OOX_DUMP_BYTESPERLINE;
+        sal_Int32 nReadSize = mxStrm->readMemory( pnLineData, nLineSize );
         bLoop = nReadSize == nLineSize;
         nPos += nReadSize;
 
@@ -2505,7 +2517,7 @@ void InputObjectBase::dumpRawBinary( sal
             }
 
             aTabGuard.tab( 3 );
-            for( pnByte = pnLineData, pnEnd = pnLineData + nLineSize; pnByte != pnEnd; ++pnByte )
+            for( pnByte = pnLineData, pnEnd = pnLineData + nReadSize; pnByte != pnEnd; ++pnByte )
             {
                 if( (pnByte - pnLineData) == (OOX_DUMP_BYTESPERLINE / 2) ) rOut.tab();
                 rOut.writeChar( static_cast< sal_Unicode >( (*pnByte < 0x20) ? '.' : *pnByte ) );
@@ -2516,108 +2528,221 @@ void InputObjectBase::dumpRawBinary( sal
 
     // skip undumped data
     if( bSeekable )
-        skipBlock( static_cast< sal_Int32 >( nEndPos - mxIn->tell() ) );
+        skipBlock( nEndPos - mxStrm->tell() );
 }
 
-void InputObjectBase::dumpBinary( const sal_Char* pcName, sal_Int32 nBytes, bool bShowOffset )
+void InputObjectBase::dumpBinary( const String& rName, sal_Int64 nBytes, bool bShowOffset )
 {
     {
         MultiItemsGuard aMultiGuard( out() );
-        writeEmptyItem( pcName );
+        writeEmptyItem( rName );
         writeDecItem( "size", nBytes );
     }
     IndentGuard aIndGuard( out() );
     dumpRawBinary( nBytes, bShowOffset );
 }
 
-void InputObjectBase::dumpArray( const sal_Char* pcName, sal_Int32 nBytes, sal_Unicode cSep )
+void InputObjectBase::dumpRemaining( sal_Int64 nBytes )
 {
-    sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxIn->getSize() - mxIn->tell(), 0, nBytes );
+    if( nBytes > 0 )
+    {
+        if( cfg().getBoolOption( "show-trailing-unknown", true ) )
+            dumpBinary( "remaining-data", nBytes, false );
+        else
+            skipBlock( nBytes );
+    }
+}
+
+void InputObjectBase::dumpRemainingTo( sal_Int64 nPos )
+{
+    if( mxStrm->isEof() )
+        writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
+    else
+        dumpRemaining( nPos - mxStrm->tell() );
+    mxStrm->seek( nPos );
+}
+
+void InputObjectBase::dumpRemainingStream()
+{
+    dumpRemainingTo( mxStrm->getLength() );
+}
+
+void InputObjectBase::dumpArray( const String& rName, sal_Int32 nBytes, sal_Unicode cSep )
+{
+    sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxStrm->getLength() - mxStrm->tell(), 0, nBytes );
     if( nDumpSize > OOX_DUMP_MAXARRAY )
     {
-        dumpBinary( pcName, nBytes, false );
+        dumpBinary( rName, nBytes, false );
     }
     else if( nDumpSize > 1 )
     {
         sal_uInt8 pnData[ OOX_DUMP_MAXARRAY ];
-        mxIn->read( pnData, nDumpSize );
-        writeArrayItem( pcName, pnData, nDumpSize, cSep );
+        mxStrm->readMemory( pnData, nDumpSize );
+        writeArrayItem( rName, pnData, nDumpSize, cSep );
     }
     else if( nDumpSize == 1 )
-        dumpHex< sal_uInt8 >( pcName );
+        dumpHex< sal_uInt8 >( rName );
 }
 
-void InputObjectBase::dumpRemaining( sal_Int32 nBytes )
+sal_Unicode InputObjectBase::dumpChar( const String& rName, rtl_TextEncoding eTextEnc )
 {
-    if( nBytes > 0 )
-    {
-        if( cfg().getBoolOption( "show-trailing-unknown", true ) )
-            dumpBinary( "remaining-data", nBytes, false );
-        else
-            skipBlock( nBytes );
+    sal_uInt8 nChar;
+    *mxStrm >> nChar;
+    OUString aChar = OStringToOUString( OString( static_cast< sal_Char >( nChar ) ), eTextEnc );
+    sal_Unicode cChar = (aChar.getLength() > 0) ? aChar[ 0 ] : 0;
+    writeCharItem( rName( "char" ), cChar );
+    return cChar;
     }
+
+sal_Unicode InputObjectBase::dumpUnicode( const String& rName )
+{
+    sal_uInt16 nChar;
+    *mxStrm >> nChar;
+    sal_Unicode cChar = static_cast< sal_Unicode >( nChar );
+    writeCharItem( rName( "char" ), cChar );
+    return cChar;
 }
 
-OUString InputObjectBase::dumpCharArray( const sal_Char* pcName, sal_Int32 nSize, rtl_TextEncoding eTextEnc )
+OUString InputObjectBase::dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc )
 {
-    sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxIn->getSize() - mxIn->tell(), 0, nSize );
+    sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxStrm->getLength() - mxStrm->tell(), 0, nLen );
     OUString aString;
     if( nDumpSize > 0 )
     {
-        ::std::vector< sal_Char > aBuffer( static_cast< sal_Size >( nSize ) + 1 );
-        sal_Int32 nCharsRead = mxIn->read( &aBuffer.front(), nSize );
+        ::std::vector< sal_Char > aBuffer( static_cast< sal_Size >( nLen ) + 1 );
+        sal_Int32 nCharsRead = mxStrm->readMemory( &aBuffer.front(), nLen );
         aBuffer[ nCharsRead ] = 0;
         aString = OStringToOUString( OString( &aBuffer.front() ), eTextEnc );
     }
-    writeStringItem( pcName, aString );
+    writeStringItem( rName( "text" ), aString );
+    return aString;
+}
+
+OUString InputObjectBase::dumpUnicodeArray( const String& rName, sal_Int32 nLen )
+{
+    OUStringBuffer aBuffer;
+    for( sal_Int32 nIndex = 0; !mxStrm->isEof() && (nIndex < nLen); ++nIndex )
+        aBuffer.append( static_cast< sal_Unicode >( mxStrm->readuInt16() ) );
+    OUString aString = aBuffer.makeStringAndClear();
+    writeStringItem( rName( "text" ), aString );
+    return aString;
+}
+
+OUString InputObjectBase::dumpNullCharArray( const String& rName, rtl_TextEncoding eTextEnc )
+{
+    OStringBuffer aBuffer;
+    sal_uInt8 nChar;
+    for( *mxStrm >> nChar; !mxStrm->isEof() && (nChar > 0); *mxStrm >> nChar )
+        aBuffer.append( static_cast< sal_Char >( nChar ) );
+    OUString aString = OStringToOUString( aBuffer.makeStringAndClear(), eTextEnc );
+    writeStringItem( rName( "text" ), aString );
     return aString;
 }
 
-OUString InputObjectBase::dumpUnicodeArray( const sal_Char* pcName, sal_Int32 nSize )
+OUString InputObjectBase::dumpNullUnicodeArray( const String& rName )
 {
     OUStringBuffer aBuffer;
-    for( sal_Int32 nIndex = 0; mxIn->isValidPos() && (nIndex < nSize); ++nIndex )
-        aBuffer.append( static_cast< sal_Unicode >( mxIn->readValue< sal_uInt16 >() ) );
+    sal_uInt16 nChar;
+    for( *mxStrm >> nChar; !mxStrm->isEof() && (nChar > 0); *mxStrm >> nChar )
+        aBuffer.append( static_cast< sal_Unicode >( nChar ) );
     OUString aString = aBuffer.makeStringAndClear();
-    writeStringItem( pcName, aString );
+    writeStringItem( rName( "text" ), aString );
     return aString;
 }
 
-double InputObjectBase::dumpRk( const sal_Char* pcName )
+double InputObjectBase::dumpRk( const String& rName )
 {
     sal_Int32 nRk;
-    *mxIn >> nRk;
-    return writeRkItem( pcName ? pcName : "rk-value", nRk );
+    *mxStrm >> nRk;
+    return writeRkItem( rName( "rk-value" ), nRk );
+}
+
+sal_Int32 InputObjectBase::dumpColorABGR( const String& rName )
+{
+    sal_Int32 nColor;
+    *mxStrm >> nColor;
+    writeColorABGRItem( rName( "color" ), nColor );
+    return nColor;
+}
+
+DateTime InputObjectBase::dumpFileTime( const String& rName )
+{
+    DateTime aDateTime;
+
+    ItemGuard aItem( out(), rName( "file-time" ) );
+    sal_Int64 nFileTime = dumpDec< sal_Int64 >( EMPTY_STRING );
+    // file time is in 10^-7 seconds (100 nanoseconds), convert to 1/100 seconds
+    nFileTime /= 100000;
+    // entire days
+    sal_Int64 nDays = nFileTime / sal_Int64( 360000 * 24 );
+    // number of entire years
+    sal_Int64 nYears = (nDays - (nDays / (4 * 365)) + (nDays / (100 * 365)) - (nDays / (400 * 365))) / 365;
+    // remaining days in the year
+    sal_Int64 nDaysInYear = nDays - (nYears * 365 + nYears / 4 - nYears / 100 + nYears / 400);
+    // the year (file dates start from 1601-01-01)
+    aDateTime.Year = static_cast< sal_uInt16 >( 1601 + nYears );
+    // leap year?
+    bool bLeap = ((aDateTime.Year % 4 == 0) && (aDateTime.Year % 100 != 0)) || (aDateTime.Year % 400 == 0);
+    // static arrays with number of days in month
+    static const sal_Int64 spnDaysInMonth[]  = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+    static const sal_Int64 spnDaysInMonthL[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+    const sal_Int64* pnDaysInMonth = bLeap ? spnDaysInMonthL : spnDaysInMonth;
+    // the month
+    aDateTime.Month = 1;
+    while( nDaysInYear >= *pnDaysInMonth )
+    {
+        nDaysInYear -= *pnDaysInMonth++;
+        ++aDateTime.Month;
+    }
+    // the day
+    aDateTime.Day = static_cast< sal_uInt16 >( nDaysInYear + 1 );
+    // number of 1/100 seconds in the day
+    sal_Int64 nTimeInDay = nFileTime % sal_Int64( 360000 * 24 );
+    // 1/100 seconds
+    aDateTime.HundredthSeconds = static_cast< sal_uInt16 >( nTimeInDay % 100 );
+    nTimeInDay /= 100;
+    // seconds
+    aDateTime.Seconds = static_cast< sal_uInt16 >( nTimeInDay % 60 );
+    nTimeInDay /= 60;
+    // minutes
+    aDateTime.Minutes = static_cast< sal_uInt16 >( nTimeInDay % 60 );
+    nTimeInDay /= 60;
+    // hours
+    aDateTime.Hours = static_cast< sal_uInt16 >( nTimeInDay );
+
+    writeDateTimeItem( EMPTY_STRING, aDateTime );
+    return aDateTime;
 }
 
-OUString InputObjectBase::dumpGuid( const sal_Char* pcName )
+OUString InputObjectBase::dumpGuid( const String& rName )
 {
     OUStringBuffer aBuffer;
     sal_uInt32 nData32;
     sal_uInt16 nData16;
     sal_uInt8 nData8;
 
-    *mxIn >> nData32;
+    *mxStrm >> nData32;
     StringHelper::appendHex( aBuffer, nData32, false );
     aBuffer.append( sal_Unicode( '-' ) );
-    *mxIn >> nData16;
+    *mxStrm >> nData16;
     StringHelper::appendHex( aBuffer, nData16, false );
     aBuffer.append( sal_Unicode( '-' ) );
-    *mxIn >> nData16;
+    *mxStrm >> nData16;
     StringHelper::appendHex( aBuffer, nData16, false );
     aBuffer.append( sal_Unicode( '-' ) );
-    *mxIn >> nData8;
+    *mxStrm >> nData8;
     StringHelper::appendHex( aBuffer, nData8, false );
-    *mxIn >> nData8;
+    *mxStrm >> nData8;
     StringHelper::appendHex( aBuffer, nData8, false );
     aBuffer.append( sal_Unicode( '-' ) );
     for( int nIndex = 0; nIndex < 6; ++nIndex )
     {
-        *mxIn >> nData8;
+        *mxStrm >> nData8;
         StringHelper::appendHex( aBuffer, nData8, false );
     }
+    StringHelper::enclose( aBuffer, '{', '}' );
     OUString aGuid = aBuffer.makeStringAndClear();
-    writeGuidItem( pcName ? pcName : "guid", aGuid );
+    writeGuidItem( rName( "guid" ), aGuid );
     return aGuid;
 }
 
@@ -2641,70 +2766,100 @@ void InputObjectBase::dumpItem( const It
 }
 
 // ============================================================================
+// ============================================================================
 
-InputStreamObject::InputStreamObject( const ObjectBase& rParent, const OUString& rOutFileName, BinaryInputStreamRef xStrm )
+BinaryStreamObject::BinaryStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
 {
-    construct( rParent, rOutFileName, xStrm );
+    InputObjectBase::construct( rParent, rxStrm, rSysFileName );
 }
 
-InputStreamObject::~InputStreamObject()
+BinaryStreamObject::BinaryStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
 {
+    InputObjectBase::construct( rParent, rxStrm );
 }
 
-void InputStreamObject::construct( const ObjectBase& rParent, const OUString& rOutFileName, BinaryInputStreamRef xStrm )
+void BinaryStreamObject::dumpBinaryStream( bool bShowOffset )
 {
-    mxStrm = xStrm;
-    if( mxStrm.get() )
-        InputObjectBase::construct( rParent, rOutFileName, InputRef( new BinaryInput( *mxStrm ) ) );
+    in().seek( 0 );
+    dumpRawBinary( in().getLength(), bShowOffset, true );
+    out().emptyLine();
 }
 
-sal_Int64 InputStreamObject::getStreamSize() const
+void BinaryStreamObject::implDump()
 {
-    return mxStrm.get() ? mxStrm->getLength() : -1;
+    dumpBinaryStream();
 }
 
-void InputStreamObject::dumpBinaryStream( bool bShowOffset )
+// ============================================================================
+
+namespace {
+
+bool lclIsEof( BinaryInputStream& rStrm )
 {
-    in().seek( 0 );
-    dumpRawBinary( getLimitedValue< sal_Int32, sal_Int64 >( in().getSize(), 0, SAL_MAX_INT32 ), bShowOffset, true );
-    out().emptyLine();
+    return rStrm.isEof() || (rStrm.isSeekable() && (rStrm.tell() >= rStrm.getLength()));
 }
 
-bool InputStreamObject::implIsValid() const
+template< typename BufferType, typename CharType >
+CharType lclAppendChar( BufferType& orBuffer, CharType cChar )
 {
-    return mxStrm.get() && mxStrm->is() && InputObjectBase::implIsValid();
+    if( (cChar == 0x0A) || (cChar == 0x0D) )
+        return cChar;
+    orBuffer.append( cChar );
+    return 0;
 }
 
-void InputStreamObject::implDump()
+template< typename BufferType, typename CharType, typename StreamDataType >
+bool lclReadLine( BufferType& orBuffer, sal_Unicode& orcNextLineChar, BinaryInputStream& rStrm )
 {
-    dumpBinaryStream();
+    CharType cLineEndChar = (orcNextLineChar == 0) ? 0 : lclAppendChar( orBuffer, static_cast< CharType >( orcNextLineChar ) );
+    orcNextLineChar = 0;
+
+    // read chars until EOF or line end character (LF or CR)
+    bool bIsEof = lclIsEof( rStrm );
+    while( !bIsEof && (cLineEndChar == 0) )
+    {
+        CharType cChar = static_cast< CharType >( rStrm.readValue< StreamDataType >() );
+        bIsEof = rStrm.isEof();
+        cLineEndChar = bIsEof ? 0 : lclAppendChar( orBuffer, cChar );
 }
 
-// ============================================================================
-// ============================================================================
+    // try to skip LF following CR, or CR following LF
+    if( !lclIsEof( rStrm ) && (cLineEndChar != 0) )
+    {
+        CharType cChar = static_cast< CharType >( rStrm.readValue< StreamDataType >() );
+        bool bLineEnd = ((cChar == 0x0A) || (cChar == 0x0D)) && (cChar != cLineEndChar);
+        if( !rStrm.isEof() && !bLineEnd )
+            orcNextLineChar = static_cast< sal_Unicode >( cChar );
+    }
+
+    return (cLineEndChar != 0) || (orBuffer.getLength() > 0);
+}
+
+} // namespace
+
+// ----------------------------------------------------------------------------
 
 TextStreamObject::TextStreamObject( const ObjectBase& rParent,
-        const OUString& rOutFileName, BinaryInputStreamRef xStrm, rtl_TextEncoding eTextEnc ) :
-    InputStreamObject( rParent, rOutFileName, xStrm ),
+        const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc, const OUString& rSysFileName ) :
     meTextEnc( eTextEnc )
 {
+    InputObjectBase::construct( rParent, rxStrm, rSysFileName );
 }
 
-void TextStreamObject::implDump()
-{
-    const sal_Char* pcTextEnc = rtl_getBestMimeCharsetFromTextEncoding( meTextEnc );
-    OUString aEncoding = OUString::createFromAscii( pcTextEnc ? pcTextEnc : "UTF-8" );
-    Reference< XTextInputStream > xTextStrm = InputOutputHelper::openTextInputStream( getStream().getXInputStream(), aEncoding );
-    if( xTextStrm.is() ) try
+TextStreamObject::TextStreamObject( const OutputObjectBase& rParent,
+        const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc ) :
+    meTextEnc( eTextEnc )
     {
-        sal_uInt32 nLine = 0;
-        while( !xTextStrm->isEOF() )
-            implDumpLine( xTextStrm->readLine(), ++nLine );
+    InputObjectBase::construct( rParent, rxStrm );
     }
-    catch( Exception& )
+
+void TextStreamObject::implDump()
     {
-        writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
-    }
+    OUString aLine;
+    sal_Unicode cNextLineChar = 0;
+    sal_uInt32 nLine = 0;
+    while( readLine( aLine, cNextLineChar ) )
+        implDumpLine( aLine, ++nLine );
     out().emptyLine();
 }
 
@@ -2718,10 +2873,35 @@ void TextStreamObject::implDumpLine( con
     rOut.newLine();
 }
 
+bool TextStreamObject::readCharLine( OUString& orLine, sal_Unicode& orcNextLineChar )
+{
+    OStringBuffer aBuffer;
+    bool bHasData = lclReadLine< OStringBuffer, sal_Char, sal_uInt8 >( aBuffer, orcNextLineChar, in() );
+    if( bHasData )
+        orLine = OStringToOUString( aBuffer.makeStringAndClear(), meTextEnc );
+    return bHasData;
+}
+
+bool TextStreamObject::readUcs2Line( OUString& orLine, sal_Unicode& orcNextLineChar )
+{
+    OUStringBuffer aBuffer;
+    bool bHasData = lclReadLine< OUStringBuffer, sal_Unicode, sal_uInt16 >( aBuffer, orcNextLineChar, in() );
+    if( bHasData )
+        orLine = aBuffer.makeStringAndClear();
+    return bHasData;
+}
+
+bool TextStreamObject::readLine( OUString& orLine, sal_Unicode& orcNextLineChar )
+{
+    return (meTextEnc == RTL_TEXTENCODING_UCS2) ?
+        readUcs2Line( orLine, orcNextLineChar ) :
+        readCharLine( orLine, orcNextLineChar );
+}
+
 // ============================================================================
 
-XmlStreamObject::XmlStreamObject( const ObjectBase& rParent, const OUString& rOutFileName, BinaryInputStreamRef xStrm ) :
-    TextStreamObject( rParent, rOutFileName, xStrm, RTL_TEXTENCODING_UTF8 )
+XmlStreamObject::XmlStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName ) :
+    TextStreamObject( rParent, rxStrm, RTL_TEXTENCODING_UTF8, rSysFileName )
 {
 }
 
@@ -2832,60 +3012,164 @@ void XmlStreamObject::implDumpLine( cons
 // ============================================================================
 // ============================================================================
 
-RecordHeaderImplBase::~RecordHeaderImplBase()
+void RecordObjectBase::construct( const ObjectBase& rParent,
+        const BinaryInputStreamRef& rxBaseStrm, const OUString& rSysFileName,
+        const BinaryInputStreamRef& rxRecStrm, const String& rRecNames, const String& rSimpleRecs )
 {
+    InputObjectBase::construct( rParent, rxRecStrm, rSysFileName );
+    constructRecObjBase( rxBaseStrm, rRecNames, rSimpleRecs );
 }
 
-void RecordHeaderImplBase::construct( const InputObjectBase& rParent, const RecordHeaderConfigInfo& rCfgInfo )
+void RecordObjectBase::construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxBaseStrm,
+        const BinaryInputStreamRef& rxRecStrm, const String& rRecNames, const String& rSimpleRecs )
 {
-    InputObjectBase::construct( rParent );
-    if( InputObjectBase::implIsValid() )
+    InputObjectBase::construct( rParent, rxRecStrm );
+    constructRecObjBase( rxBaseStrm, rRecNames, rSimpleRecs );
+}
+
+bool RecordObjectBase::implIsValid() const
     {
-        const Config& rCfg = cfg();
-        mpcTitle      = rCfgInfo.mpcTitle;
-        mxRecNames    = rCfg.getNameList( rCfgInfo.mpcRecNames );
-        mbShowRecPos  = rCfg.getBoolOption( rCfgInfo.mpcShowRecPos,  true );
-        mbShowRecSize = rCfg.getBoolOption( rCfgInfo.mpcShowRecSize, true );
-        mbShowRecId   = rCfg.getBoolOption( rCfgInfo.mpcShowRecId,   true );
-        mbShowRecName = rCfg.getBoolOption( rCfgInfo.mpcShowRecName, true );
-        mbShowRecBody = rCfg.getBoolOption( rCfgInfo.mpcShowRecBody, true );
+    return mxBaseStrm.get() && InputObjectBase::implIsValid();
     }
+
+void RecordObjectBase::implDump()
+{
+    NameListRef xRecNames = getRecNames();
+
+    typedef ::std::map< sal_Int64, ItemFormat > ItemFormatMap;
+    ItemFormatMap aSimpleRecs;
+    if( NameListBase* pSimpleRecs = maSimpleRecs.getNameList( cfg() ).get() )
+        for( NameListBase::const_iterator aIt = pSimpleRecs->begin(), aEnd = pSimpleRecs->end(); aIt != aEnd; ++aIt )
+            aSimpleRecs[ aIt->first ].parse( aIt->second );
+
+    while( implStartRecord( *mxBaseStrm, mnRecPos, mnRecId, mnRecSize ) )
+    {
+        // record header
+        out().emptyLine();
+        writeHeader();
+        implWriteExtHeader();
+        IndentGuard aIndGuard( out() );
+        sal_Int64 nRecPos = in().tell();
+
+        // record body
+        if( cfg().hasName( xRecNames, mnRecId ) )
+        {
+            ItemFormatMap::const_iterator aIt = aSimpleRecs.find( mnRecId );
+            if( aIt != aSimpleRecs.end() )
+                dumpItem( aIt->second );
+            else
+                implDumpRecordBody();
 }
 
-bool RecordHeaderImplBase::implIsValid() const
+        // remaining undumped data
+        else if( !in().isEof() && (in().tell() == nRecPos) )
+            dumpRawBinary( mnRecSize, false );
+        else
+            dumpRemainingTo( nRecPos + mnRecSize );
+    }
+}
+
+void RecordObjectBase::implWriteExtHeader()
 {
-    return isValid( mxRecNames ) && InputObjectBase::implIsValid();
 }
 
-// ============================================================================
+void RecordObjectBase::implDumpRecordBody()
+{
+}
+
+void RecordObjectBase::constructRecObjBase( const BinaryInputStreamRef& rxBaseStrm, const String& rRecNames, const String& rSimpleRecs )
+{
+    mxBaseStrm = rxBaseStrm;
+    maRecNames = rRecNames;
+    maSimpleRecs = rSimpleRecs;
+    mnRecPos = mnRecId = mnRecSize = 0;
+}
+
+void RecordObjectBase::writeHeader()
+{
+    MultiItemsGuard aMultiGuard( out() );
+    writeEmptyItem( "REC" );
+    if( mxBaseStrm->isSeekable() )
+        writeShortHexItem( "pos", mnRecPos, "CONV-DEC" );
+    writeShortHexItem( "size", mnRecSize, "CONV-DEC" );
+    ItemGuard aItem( out(), "id" );
+    out().writeShortHex( mnRecId );
+    addNameToItem( mnRecId, "CONV-DEC" );
+    addNameToItem( mnRecId, maRecNames );
+}
+
 // ============================================================================
 
-DumperBase::~DumperBase()
+void SequenceRecordObjectBase::construct(
+        const ObjectBase& rParent, const BinaryInputStreamRef& rxBaseStrm, const ::rtl::OUString& rSysFileName,
+        const BinaryInputStreamRef& rxRecStrm, const String& rRecNames, const String& rSimpleRecs )
 {
+    RecordObjectBase::construct( rParent, rxBaseStrm, rSysFileName, rxRecStrm, rRecNames, rSimpleRecs );
 }
 
-bool DumperBase::isImportEnabled() const
+void SequenceRecordObjectBase::construct( const OutputObjectBase& rParent,
+        const BinaryInputStreamRef& rxBaseStrm, const BinaryInputStreamRef& rxRecStrm,
+        const String& rRecNames, const String& rSimpleRecs )
 {
-    return !isValid() || cfg().isImportEnabled();
+    RecordObjectBase::construct( rParent, rxBaseStrm, rxRecStrm, rRecNames, rSimpleRecs );
 }
 
-StorageRef DumperBase::getRootStorage() const
+void SequenceRecordObjectBase::construct( const ObjectBase& rParent,
+        const BinaryInputStreamRef& rxBaseStrm, const ::rtl::OUString& rSysFileName,
+        const String& rRecNames, const String& rSimpleRecs )
 {
-    return getFilter().getStorage();
+    BinaryInputStreamRef xRecStrm( new SequenceInputStream( *mxRecData ) );
+    RecordObjectBase::construct( rParent, rxBaseStrm, rSysFileName, xRecStrm, rRecNames, rSimpleRecs );
 }
 
-BinaryInputStreamRef DumperBase::getRootStream() const
+void SequenceRecordObjectBase::construct( const OutputObjectBase& rParent,
+        const BinaryInputStreamRef& rxBaseStrm, const String& rRecNames, const String& rSimpleRecs )
 {
-    BinaryInputStreamRef xStrm;
-    if( StorageBase* pStrg = getRootStorage().get() )
-        xStrm.reset( new BinaryInputStream( pStrg->openInputStream( OUString() ), false ) );
-    return xStrm;
+    BinaryInputStreamRef xRecStrm( new SequenceInputStream( *mxRecData ) );
+    RecordObjectBase::construct( rParent, rxBaseStrm, xRecStrm, rRecNames, rSimpleRecs );
+}
+
+bool SequenceRecordObjectBase::implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize )
+{
+    bool bValid = true;
+    if( rBaseStrm.isSeekable() )
+    {
+        ornRecPos = rBaseStrm.tell();
+        // do not try to overread seekable streams, may cause assertions
+        bValid = ornRecPos < rBaseStrm.getLength();
+    }
+
+    // read the record header
+    if( bValid )
+        bValid = implReadRecordHeader( rBaseStrm, ornRecId, ornRecSize ) && !rBaseStrm.isEof() && (0 <= ornRecSize) && (ornRecSize <= 0x00100000);
+
+    // read record contents into data sequence
+    if( bValid )
+    {
+        sal_Int32 nRecSize = static_cast< sal_Int32 >( ornRecSize );
+        mxRecData->realloc( nRecSize );
+        bValid = (nRecSize == 0) || (rBaseStrm.readData( *mxRecData, nRecSize ) == nRecSize);
+        in().seekToStart();
+    }
+    return bValid;
+}
+
+// ============================================================================
+// ============================================================================
+
+DumperBase::~DumperBase()
+{
+}
+
+bool DumperBase::isImportEnabled() const
+{
+    return !isValid() || cfg().isImportEnabled();
 }
 
-void DumperBase::construct( const FilterBase& rFilter, ConfigRef xConfig )
+void DumperBase::construct( const ConfigRef& rxConfig )
 {
-    if( rFilter.isImportFilter() && isValid( xConfig ) && xConfig->isDumperEnabled() )
-        ObjectBase::construct( rFilter, xConfig );
+    if( isValid( rxConfig ) && rxConfig->isDumperEnabled() )
+        ObjectBase::construct( rxConfig );
 }
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/dumperbase.ini /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dumperbase.ini
--- oox/source/dump/dumperbase.ini	1970-01-01 01:00:00.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dumperbase.ini	2008-09-30 16:51:36.000000000 +0200
@@ -0,0 +1,349 @@
+﻿
+# dumper settings ============================================================
+#
+# Basic concepts
+#
+# - Character encoding of dumper ini files is UTF-8.
+# - Whitespace characters are generally stripped, e.g. at start and end of
+#   lines, before/after equal signs, commas, etc.
+# - Comments start with the hash (#) or semicolon (;) character. Leading
+#   whitespace characters are ignored.
+#
+# ----------------------------------------------------------------------------
+
+# Enable entire dumper (default=off). This option does not affect the option
+# 'enable-import'.
+#   0=off, 1=on
+enable-dumper=1
+
+# Enable import after dumping (default=on). Disabling this option allows
+# to dump a file without loading it. This option is independent from the
+# 'enable-dumper' option.
+#   0=off, 1=on
+enable-import=1
+
+# Maximum size of binary stream dumps (default=infinite).
+max-binary-stream-size=65536
+
+# Maximum size of binary data blocks in content dumps (default=infinite).
+max-binary-data-size=128
+
+# Shows unknown trailing data as binary dump (default=on).
+#   0=off, 1=on
+show-trailing-unknown=1
+
+# name lists =================================================================
+#
+# Syntax descriptions
+#
+# - Optional items are enclosed in brackets [].
+# - Optional items that may be repeated are marked with an ellipsis (...).
+# - Items in a set to choose from are separated by vertical lines (|).
+# - <LISTNAME> denotes the name of a list. List names may consist of any non-
+#   whitespace characters.
+# - <value>, <firstvalue>, <bitfield>, <bitmask> etc. denote integer values.
+#   Decimal and hexadecimal notation is supported, using C/C++ notation.
+# - <bool> denotes a boolean value. Possible values are 0|1|false|true.
+# - <constname> denotes a literal name for a constant or bit.
+#
+# ----------------------------------------------------------------------------
+#
+# constlist
+#
+# Defines names for a list of specific values.
+#
+# Syntax:
+#
+# constlist = <LISTNAME>
+#   default = <constname>
+#   include = <LISTNAME>[,<LISTNAME>...]
+#   exclude = <value>[,<value>...]
+#   quote-names = <bool>
+#   <value> = <constname>
+# end
+#
+# - default (optional): Declares <constname> as a default name for values not
+#   specified in the name list. <constname> may be the empty string. If not
+#   set, the literal string '?err:no-name' (unquoted) is the default name.
+# - include (optional): Includes the specified name list(s) into the own list.
+# - exclude (optional): Removes values from the name lists, useful e.g. after
+#   a name list has been included.
+# - quote-names (optional): Specifies whether to return the contained names
+#   enclosed in single quote (') characters. Default is false.
+#
+# The order of the declarations is important, later declarations may overwrite
+# names generated from earlier declarations.
+#
+# Example:
+#
+# constlist = EXAMPLE-CONSTLIST
+#   1 = my-value
+#   include = OTHER-LIST
+#   exclude = 2,3
+#   0x0004 = other-value
+# end
+#
+# - Defines the name 'my-value' for the constant 1.
+# - Includes 'OTHER-LIST' which may overwrite the name of the constant 1.
+# - Excludes the names of constants 2 and 3, which may have been included from
+#   the name list 'OTHER-LIST'.
+# - Defines the name 'other-value' for the constant 4, which may overwrite the
+#   name of this constant included from the name list 'OTHER-LIST'.
+#
+# ----------------------------------------------------------------------------
+#
+# multilist
+#
+# Defines names for contiguous ranges of values.
+#
+# Syntax:
+#
+# multilist = <LISTNAME>
+#   default = <constname>
+#   include = <LISTNAME>[,<LISTNAME>...]
+#   exclude = <value>[,<value>...]
+#   ignore-empty = <bool>
+#   <firstvalue> = <constname>[,<constname>...]
+# end
+#
+# - default (optional): See constlist above.
+# - include (optional): See constlist above.
+# - exclude (optional): See constlist above.
+# - ignore-empty (optional): Specifies whether to skip empty names in a list.
+#   - True = skips an empty entry, the default name will be generated.
+#   - False = creates an empty string for the entry.
+#   Default is true (skip empty entries).
+#
+# Examples:
+#
+# multilist = EXAMPLE-MULTILIST
+#   0 = value0,value1,,value3
+#   8 = value8
+# end
+#
+# - Defines the names 'value0' for the constant 0, 'value1' for the constant
+#   1, 'value3' for the constant 3, and 'value8' for the constant 8.
+#
+# multilist = EXAMPLE-MULTILIST-2
+#   include = EXAMPLE-MULTILIST
+#   ignore-empty = false
+#   default = other
+# end
+#
+# - Same as example above (includes EXAMPLE-MULTILIST), but defines the empty
+#   string for the constant 2. Other constants (less than 0 or greater than 3
+#   and not equal to 8) get the default name 'other'.
+#
+# ----------------------------------------------------------------------------
+#
+# shortlist
+#
+# Defines names for a contiguous range of values. The entire list definition
+# is given in a single text line.
+#
+# Syntax:
+#
+# shortlist = <LISTNAME>,<firstvalue>,<constname>[,<constname>...]
+#
+# Uses default settings of the multi-list (i.e. skips empty entries).
+#
+# ----------------------------------------------------------------------------
+#
+# flagslist
+#
+# Defines names for single bits in a bit field.
+#
+# Syntax:
+#
+# flagslist = <LISTNAME>
+#   include = <LISTNAME>[,<LISTNAME>...]
+#   exclude = <bitfield>[,<bitfield>...]
+#   ignore = <bitfield>
+#   <bitmask> = <constname> | !<constname> | !<constname0>!<constname1>
+# end
+#
+# - include (optional): See constlist above.
+# - exclude (optional): See constlist above.
+# - ignore (optional): Specifies bits to be ignored. Bits without an explicit
+#   name and not set in this declaration will be shown as unknown. Default is
+#   to not ignore a bit.
+# - <bitmask>: The bit to be named. Must be a value with a single bit set.
+# - <constname>: sets a name for the bit that will be shown if it is set.
+# - !<constname>: sets a name for the bit that will be shown if it is cleared.
+# - !<constname0>!<constname1>: sets a name for the cleared bit (constname0),
+#   and for the set bit (constname1).
+#
+# ----------------------------------------------------------------------------
+#
+# combilist
+#
+# Defines names for single bits and for embedded values in a bit field. This
+# is an extension of the flagslist described above.
+#
+# Syntax:
+#
+# combilist = <LISTNAME>
+#   include = <LISTNAME>[,<LISTNAME>...]
+#   exclude = <bitmask>[,<bitmask>...]
+#   ignore = <bitfield>
+#   <bitmask> = <constname> | !<constname> | !<constname0>!<constname1>
+#   <bitfield> = <datatype>,<dataformat>,<bitfieldname>[,<LISTNAME>]
+# end
+#
+# - include (optional): See constlist above.
+# - exclude (optional): See constlist above.
+# - ignore (optional): See flagslist above.
+# - <bitmask>: See flagslist above.
+# - <bitfield>: The mask of the embedded bitfield. Must be a value with
+#   exactly one sequence of at least 2 consecutive bits.
+#   - <datatype>: [u]int8 | [u]int16 | [u]int32 | [u]int64 | float | double
+#   - <dataformat>: dec | hex | shorthex | bin | fix | bool
+#   - <bitfieldname>: The name of the embedded bitfield.
+#   - <LISTAME>: Optional name list with names for the values of the embedded
+#     bitfield.
+#
+# ----------------------------------------------------------------------------
+#
+# unitconverter
+#
+# Converts values and appends a unit name.
+#
+# Syntax:
+#
+# unitconverter = <LISTNAME>,[/]<factor>[,<unitname>]
+#
+# ----------------------------------------------------------------------------
+
+unitconverter=CONV-DEC,1
+unitconverter=CONV-PERCENT,1,%
+unitconverter=CONV-DEG,1,°
+unitconverter=CONV-HMM-TO-CM,/1000,cm
+unitconverter=CONV-INCH-TO-CM,2.54,cm
+unitconverter=CONV-PT-TO-CM,/28.346457,cm
+unitconverter=CONV-PT1616-TO-CM,/1857713.4,cm
+unitconverter=CONV-TWIP-TO-CM,/566.92913,cm
+unitconverter=CONV-TWIP-TO-PT,/20,pt
+
+constlist=BOOLEAN
+  0=FALSE
+  default=TRUE
+end
+
+combilist=RK-FLAGS
+  0x00000001=div-100
+  0x00000002=integer
+  0xFFFFFFFC=int32,dec,value
+end
+
+constlist=CHARSET
+  0=win-1252-latin-1
+  1=system-default
+  2=symbol
+  77=apple-roman
+  128=win-932-japanese-shift-jis
+  129=win-949-korean-hangul
+  130=win-1361-korean-johab
+  134=win-936-chinese-simplified-gbk
+  136=win-950-chinese-traditional-big5
+  161=win-1253-greek
+  162=win-1254-turkish
+  163=win-1258-vietnamese
+  177=win-1255-hebrew
+  178=win-1256-arabic
+  186=win-1257-baltic
+  204=win-1251-cyrillic
+  222=win-874-thai
+  238=win-1250-latin-2-central-european
+  255=ibm-850-latin-1
+end
+
+combilist=FONT-PITCHFAMILY
+  0x0F=uint8,dec,pitch,FONT-PITCH
+  0xF0=uint8,dec,family,FONT-FAMILY
+end
+
+constlist=FONT-WEIGHT
+  400=normal
+  700=bold
+end
+
+shortlist=FONT-PITCH,0,unknown,fixed,variable
+shortlist=FONT-FAMILY,0,unknown,roman,swiss,modern,script,decorative
+
+constlist=CODEPAGES
+  367=ascii
+  437=ibm-437-us
+  708=iso-8859-6
+  720=ibm-720-arabic
+  737=ibm-737-greek
+  775=ibm-775-baltic
+  850=ibm-850-latin-1
+  852=ibm-852-latin-2-central-european
+  855=ibm-855-cyrillic
+  857=ibm-857-turkish
+  858=ibm-858-multilingual-latin-1-with-euro
+  860=ibm-860-portuguese
+  861=ibm-861-icelandic
+  862=ibm-862-hebrew
+  863=ibm-863-canadian-french
+  864=ibm-864-arabic
+  865=ibm-865-nordic
+  866=ibm-866-cyrillic-russian
+  869=ibm-869-greek-modern
+  874=win-874-thai
+  932=win-932-japanese-shift-jis
+  936=win-936-chinese-simplified-gbk
+  949=win-949-korean-wansung
+  950=win-950-chinese-traditional-big5
+  1200=utf-16
+  1250=win-1250-latin-2-central-european
+  1251=win-1251-cyrillic
+  1252=win-1252-latin-1
+  1253=win-1253-greek
+  1254=win-1254-turkish
+  1255=win-1255-hebrew
+  1256=win-1256-arabic
+  1257=win-1257-baltic
+  1258=win-1258-vietnamese
+  1361=win-1361-korean-johab
+  10000=apple-roman
+  10001=apple-japanese
+  10002=apple-chinese-traditional
+  10003=apple-korean
+  10004=apple-arabic
+  10005=apple-hebrew
+  10006=apple-greek
+  10007=apple-cyrillic
+  10008=apple-chinese-simplified
+  10010=apple-romanian
+  10017=apple-ukrainian
+  10029=apple-central-european-with-euro
+  10079=apple-icelandic
+  10081=apple-turkish
+  10082=apple-croatian
+  20127=ascii
+  20866=koi8-r
+  21866=koi8-u
+  28591=iso-8859-1
+  28592=iso-8859-2
+  28593=iso-8859-3
+  28594=iso-8859-4
+  28595=iso-8859-5
+  28596=iso-8859-6
+  28597=iso-8859-7
+  28598=iso-8859-8
+  28599=iso-8859-9
+  28605=iso-8859-15
+  32768=apple-romanian
+  32769=win-1252-latin-1
+  50220=iso-2022-jp
+  50225=iso-2022-kr
+  51932=euc-jp
+  51936=euc-cn
+  51949=euc-kr
+  65000=utf-7
+  65001=utf-8
+end
+
+# ============================================================================
+
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/dumperconfig.dat /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dumperconfig.dat
--- oox/source/dump/dumperconfig.dat	2008-03-05 19:40:55.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/dumperconfig.dat	1970-01-01 01:00:00.000000000 +0100
@@ -1,193 +0,0 @@
-﻿
-# dumper settings ============================================================
-
-# Enable entire dumper (default=off). This option does not affect the option
-# 'enable-import'.
-#   0=off, 1=on
-# enable-dumper=0
-
-# Enable import after dumping (default=on). Disabling this option allows
-# to dump a file without loading it. This option is independent from the
-# 'enable-dumper' option.
-#   0=off, 1=on
-# enable-import=1
-
-# Maximum size of binary stream dumps (default=infinite).
-max-binary-stream-size=0x1000
-
-# Maximum size of binary data blocks in content dumps (default=infinite).
-max-binary-data-size=0x0200
-
-# Shows unknown trailing data as binary dump (default=on).
-#   0=off, 1=on
-show-trailing-unknown=1
-
-# name lists =================================================================
-
-unitconverter=CONV-DEC,1
-unitconverter=CONV-PERCENT,1,%
-unitconverter=CONV-DEG,1,°
-unitconverter=CONV-INCH-TO-CM,2.54,cm
-unitconverter=CONV-TWIP-TO-PT,/20,pt
-unitconverter=CONV-PT-TO-CM,/28.346457,cm
-unitconverter=CONV-PT1616-TO-CM,/1857713.4,cm
-unitconverter=CONV-TWIP-TO-CM,/566.92913,cm
-
-constlist=BOOLEAN
-  0=FALSE
-  default=TRUE
-end
-
-combilist=RK-FLAGS
-  0x00000001=div-100
-  0x00000002=integer
-  0xFFFFFFFC=int32,dec,value
-end
-
-constlist=CHARSET
-  0=win-1252-latin-1
-  1=system-default
-  2=symbol
-  77=apple-roman
-  128=win-932-japanese-shift-jis
-  129=win-949-korean-hangul
-  130=win-1361-korean-johab
-  134=win-936-chinese-simplified-gbk
-  136=win-950-chinese-traditional-big5
-  161=win-1253-greek
-  162=win-1254-turkish
-  163=win-1258-vietnamese
-  177=win-1255-hebrew
-  178=win-1256-arabic
-  186=win-1257-baltic
-  204=win-1251-cyrillic
-  222=win-874-thai
-  238=win-1250-latin-2-central-european
-  255=ibm-850-latin-1
-end
-
-constlist=CODEPAGES
-  367=ascii
-  437=ibm-437-us
-  708=iso-8859-6
-  720=ibm-720-arabic
-  737=ibm-737-greek
-  775=ibm-775-baltic
-  850=ibm-850-latin-1
-  852=ibm-852-latin-2-central-european
-  855=ibm-855-cyrillic
-  857=ibm-857-turkish
-  858=ibm-858-multilingual-latin-1-with-euro
-  860=ibm-860-portuguese
-  861=ibm-861-icelandic
-  862=ibm-862-hebrew
-  863=ibm-863-canadian-french
-  864=ibm-864-arabic
-  865=ibm-865-nordic
-  866=ibm-866-cyrillic-russian
-  869=ibm-869-greek-modern
-  874=win-874-thai
-  932=win-932-japanese-shift-jis
-  936=win-936-chinese-simplified-gbk
-  949=win-949-korean-wansung
-  950=win-950-chinese-traditional-big5
-  1200=utf-16
-  1250=win-1250-latin-2-central-european
-  1251=win-1251-cyrillic
-  1252=win-1252-latin-1
-  1253=win-1253-greek
-  1254=win-1254-turkish
-  1255=win-1255-hebrew
-  1256=win-1256-arabic
-  1257=win-1257-baltic
-  1258=win-1258-vietnamese
-  1361=win-1361-korean-johab
-  10000=apple-roman
-  10001=apple-japanese
-  10002=apple-chinese-traditional
-  10003=apple-korean
-  10004=apple-arabic
-  10005=apple-hebrew
-  10006=apple-greek
-  10007=apple-cyrillic
-  10008=apple-chinese-simplified
-  10010=apple-romanian
-  10017=apple-ukrainian
-  10029=apple-central-european-with-euro
-  10079=apple-icelandic
-  10081=apple-turkish
-  10082=apple-croatian
-  20127=ascii
-  20866=koi8-r
-  21866=koi8-u
-  28591=iso-8859-1
-  28592=iso-8859-2
-  28593=iso-8859-3
-  28594=iso-8859-4
-  28595=iso-8859-5
-  28596=iso-8859-6
-  28597=iso-8859-7
-  28598=iso-8859-8
-  28599=iso-8859-9
-  28605=iso-8859-15
-  32768=apple-romanian
-  32769=win-1252-latin-1
-  50220=iso-2022-jp
-  50225=iso-2022-kr
-  51932=euc-jp
-  51936=euc-cn
-  51949=euc-kr
-  65000=utf-7
-  65001=utf-8
-end
-
-# OLE property stream --------------------------------------------------------
-
-F29F85E0-4FF9-1068-AB91-08002B27B3D9=GlobalDocProp
-D5CDD502-2E9C-101B-9397-08002B2CF9AE=BuiltinDocProp
-D5CDD505-2E9C-101B-9397-08002B2CF9AE=CustomDocProp
-
-constlist=OLEPROP-BYTE-ORDER
-  0xFEFF=big-endian
-  0xFFFE=little-endian
-end
-
-shortlist=OLEPROP-OSTYPE,0,dos,mac,win32,unix
-
-multilist=OLEPROP-BASEIDS
-  quote-names=1
-  default=
-  0=dictionary,codepage
-end
-
-multilist=OLEPROP-GLOBALIDS
-  include=OLEPROP-BASEIDS
-  2=title,subject,author,keywords,comments,template,last-author,rev-number
-  10=edit-time,last-printed,create-time,last-saved,page-count,word-count,char-count,thumbnail,appname,security
-end
-
-multilist=OLEPROP-BUILTINIDS
-  include=OLEPROP-BASEIDS
-  2=category,pres-target,byte-count,line-count,para-count,slide-count,note-count,hidden-slide-count
-  10=clips,scale-crop,heading-pairs,part-titles,manager,company,links-uptodate
-end
-
-multilist=OLEPROP-TYPE-SIMPLE
-  0=empty,null,int16,int32,float,double,fixed,date,string8,dispatch
-  10=error,bool,variant,unknown,decimal,int8,uint8,uint16,uint32
-  20=int64,uint64,int,uint,void,hresult,ptr,savearray,c-array,userdef
-  30=string8,string16
-  64=time-stamp,blob,stream,storage,stream-obj,storage-obj
-  70=blob-obj,clip-fmt,guid,vers-stream
-  0x0FFF=str8-blob
-end
-
-combilist=OLEPROP-TYPE
-  0x0FFF=int32,dec,base-type,OLEPROP-TYPE-SIMPLE
-  0x1000=vector
-  0x2000=array
-  0x4000=byref
-end
-
-# ============================================================================
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/makefile.mk /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/makefile.mk
--- oox/source/dump/makefile.mk	2008-04-10 17:39:13.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/makefile.mk	2008-09-30 16:51:36.000000000 +0200
@@ -48,7 +48,7 @@ SLOFILES =								\
 		$(SLO)$/biffdumper.obj			\
 		$(SLO)$/dffdumper.obj			\
 		$(SLO)$/dumperbase.obj			\
-		$(SLO)$/olestoragedumper.obj	\
+		$(SLO)$/oledumper.obj		\
 		$(SLO)$/pptxdumper.obj			\
 		$(SLO)$/xlsbdumper.obj
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/oledumper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/oledumper.cxx
--- oox/source/dump/oledumper.cxx	1970-01-01 01:00:00.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/oledumper.cxx	2008-10-06 16:28:34.000000000 +0200
@@ -0,0 +1,1850 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: oledumper.cxx,v $
+ * $Revision: 1.1.2.13 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/dump/oledumper.hxx"
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <osl/thread.h>
+#include <osl/file.hxx>
+#include <rtl/tencinfo.h>
+#include "oox/helper/binaryoutputstream.hxx"
+#include "oox/core/filterbase.hxx"
+#include "oox/ole/vbainputstream.hxx"
+#include "oox/xls/biffhelper.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::rtl::OString;
+using ::rtl::OStringToOUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::io::XInputStream;
+using ::com::sun::star::io::XOutputStream;
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+// ============================================================================
+
+StdFontObject::StdFontObject( const InputObjectBase& rParent ) :
+    InputObjectBase( rParent )
+{
+}
+
+void StdFontObject::implDump()
+{
+    dumpDec< sal_uInt8 >( "version" );
+    dumpDec< sal_uInt16 >( "charset", "CHARSET" );
+    dumpHex< sal_uInt8 >( "flags", "STDFONT-FLAGS" );
+    dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
+    dumpDec< sal_uInt32 >( "height", "STDFONT-HEIGHT" );
+    dumpCharArray( "name", in().readuInt8(), RTL_TEXTENCODING_ASCII_US );
+}
+
+// ============================================================================
+
+StdPicObject::StdPicObject( const InputObjectBase& rParent ) :
+    InputObjectBase( rParent )
+{
+}
+
+void StdPicObject::implDump()
+{
+    dumpHex< sal_uInt32 >( "identifier" );
+    sal_uInt32 nSize = dumpHex< sal_uInt32 >( "image-size", "CONV-DEC" );
+    dumpBinary( "image-data", nSize );
+}
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt32 STDHLINK_HASTARGET         = 0x00000001;   /// Has hyperlink moniker.
+const sal_uInt32 STDHLINK_ABSOLUTE          = 0x00000002;   /// Absolute path.
+const sal_uInt32 STDHLINK_HASLOCATION       = 0x00000008;   /// Has target location.
+const sal_uInt32 STDHLINK_HASDISPLAY        = 0x00000010;   /// Has display string.
+const sal_uInt32 STDHLINK_HASGUID           = 0x00000020;   /// Has identification GUID.
+const sal_uInt32 STDHLINK_HASTIME           = 0x00000040;   /// Has creation time.
+const sal_uInt32 STDHLINK_HASFRAME          = 0x00000080;   /// Has frame.
+const sal_uInt32 STDHLINK_ASSTRING          = 0x00000100;   /// Hyperlink as simple string.
+
+} // namespace
+
+StdHlinkObject::StdHlinkObject( const InputObjectBase& rParent ) :
+    InputObjectBase( rParent )
+{
+}
+
+void StdHlinkObject::implDump()
+{
+    dumpDec< sal_uInt32 >( "stream-version" );
+    sal_uInt32 nFlags = dumpHex< sal_uInt32 >( "flags", "STDHLINK-FLAGS" );
+    if( getFlag( nFlags, STDHLINK_HASDISPLAY ) )
+        dumpHyperlinkString( "display", true );
+    if( getFlag( nFlags, STDHLINK_HASFRAME ) )
+        dumpHyperlinkString( "frame", true );
+    if( getFlag( nFlags, STDHLINK_HASTARGET ) )
+    {
+        if( getFlag( nFlags, STDHLINK_ASSTRING ) )
+            dumpHyperlinkString( "filename", true );
+        else if( !dumpGuidAndMoniker() )
+            return;
+    }
+    if( getFlag( nFlags, STDHLINK_HASLOCATION ) )
+        dumpHyperlinkString( "location", true );
+    if( getFlag( nFlags, STDHLINK_HASGUID ) )
+        dumpGuid( "id-guid" );
+    if( getFlag( nFlags, STDHLINK_HASTIME ) )
+        dumpFileTime( "creation-time" );
+}
+
+OUString StdHlinkObject::dumpHyperlinkString( const String& rName, bool bUnicode )
+{
+    sal_Int32 nLen = in().readInt32();
+    return bUnicode ? dumpUnicodeArray( rName, nLen ) : dumpCharArray( rName, nLen, osl_getThreadTextEncoding() );
+}
+
+bool StdHlinkObject::dumpGuidAndMoniker()
+{
+    bool bValidMoniker = true;
+    OUString aGuid = cfg().getStringOption( dumpGuid( "moniker" ), OUString() );
+    IndentGuard aIndGuard( out() );
+    if( aGuid.equalsAscii( "URLMoniker" ) )
+        dumpUrlMoniker();
+    else if( aGuid.equalsAscii( "FileMoniker" ) )
+        dumpFileMoniker();
+    else if( aGuid.equalsAscii( "ItemMoniker" ) )
+        dumpItemMoniker();
+    else if( aGuid.equalsAscii( "AntiMoniker" ) )
+        dumpAntiMoniker();
+    else if( aGuid.equalsAscii( "CompositeMoniker" ) )
+        dumpCompositeMoniker();
+    else
+        bValidMoniker = false;
+    return bValidMoniker;
+}
+
+void StdHlinkObject::dumpUrlMoniker()
+{
+    sal_Int32 nBytes = dumpDec< sal_Int32 >( "url-bytes" );
+    sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+    dumpNullUnicodeArray( "url" );
+    if( in().tell() + 24 == nEndPos )
+    {
+        dumpGuid( "implementation-id" );
+        dumpDec< sal_uInt32 >( "version" );
+        dumpHex< sal_uInt32 >( "flags", "STDHLINK-URL-FLAGS" );
+    }
+    dumpRemainingTo( nEndPos );
+}
+
+void StdHlinkObject::dumpFileMoniker()
+{
+    dumpDec< sal_Int16 >( "up-levels" );
+    dumpHyperlinkString( "ansi-filename", false );
+    dumpDec< sal_Int16 >( "server-path-len" );
+    dumpHex< sal_uInt16 >( "version" );
+    dumpUnused( 20 );
+    sal_Int32 nBytes = dumpDec< sal_Int32 >( "total-bytes" );
+    sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+    if( nBytes > 0 )
+    {
+        sal_Int32 nFileBytes = dumpDec< sal_Int32 >( "uni-filename-bytes" );
+        dumpDec< sal_uInt16 >( "key-value" );
+        dumpUnicodeArray( "unicode-filename", nFileBytes / 2 );
+    }
+    dumpRemainingTo( nEndPos );
+}
+
+void StdHlinkObject::dumpItemMoniker()
+{
+    sal_Int32 nBytes = dumpDec< sal_Int32 >( "delimiter-bytes" );
+    sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+    dumpNullCharArray( "ansi-delimiter", osl_getThreadTextEncoding() );
+    if( in().tell() < nEndPos )
+        dumpUnicodeArray( "unicode-delimiter", (nEndPos - in().tell()) / 2 );
+    in().seek( nEndPos );
+
+    nBytes = dumpDec< sal_Int32 >( "item-bytes" );
+    nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+    dumpNullCharArray( "ansi-item", osl_getThreadTextEncoding() );
+    if( in().tell() < nEndPos )
+        dumpUnicodeArray( "unicode-item", (nEndPos - in().tell()) / 2 );
+    in().seek( nEndPos );
+}
+
+void StdHlinkObject::dumpAntiMoniker()
+{
+    dumpDec< sal_Int32 >( "count" );
+}
+
+void StdHlinkObject::dumpCompositeMoniker()
+{
+    sal_Int32 nCount = dumpDec< sal_Int32 >( "moniker-count" );
+    for( sal_Int32 nIndex = 0; !in().isEof() && (nIndex < nCount); ++nIndex )
+        dumpGuidAndMoniker();
+}
+
+// ============================================================================
+// ============================================================================
+
+namespace {
+
+const sal_Int32 OLEPROP_ID_DICTIONARY   = 0;
+const sal_Int32 OLEPROP_ID_CODEPAGE     = 1;
+
+const sal_Int32 OLEPROP_TYPE_INT16      = 2;
+const sal_Int32 OLEPROP_TYPE_INT32      = 3;
+const sal_Int32 OLEPROP_TYPE_FLOAT      = 4;
+const sal_Int32 OLEPROP_TYPE_DOUBLE     = 5;
+const sal_Int32 OLEPROP_TYPE_DATE       = 7;
+const sal_Int32 OLEPROP_TYPE_STRING     = 8;
+const sal_Int32 OLEPROP_TYPE_STATUS     = 10;
+const sal_Int32 OLEPROP_TYPE_BOOL       = 11;
+const sal_Int32 OLEPROP_TYPE_VARIANT    = 12;
+const sal_Int32 OLEPROP_TYPE_INT8       = 16;
+const sal_Int32 OLEPROP_TYPE_UINT8      = 17;
+const sal_Int32 OLEPROP_TYPE_UINT16     = 18;
+const sal_Int32 OLEPROP_TYPE_UINT32     = 19;
+const sal_Int32 OLEPROP_TYPE_INT64      = 20;
+const sal_Int32 OLEPROP_TYPE_UINT64     = 21;
+const sal_Int32 OLEPROP_TYPE_STRING8    = 30;
+const sal_Int32 OLEPROP_TYPE_STRING16   = 31;
+const sal_Int32 OLEPROP_TYPE_FILETIME   = 64;
+const sal_Int32 OLEPROP_TYPE_BLOB       = 65;
+const sal_Int32 OLEPROP_TYPE_STREAM     = 66;
+const sal_Int32 OLEPROP_TYPE_STORAGE    = 67;
+const sal_Int32 OLEPROP_TYPE_CLIPFMT    = 71;
+
+const sal_uInt16 CODEPAGE_UNICODE       = 1200;
+
+const sal_uInt32 OCX_STRING_COMPRESSED  = 0x80000000;
+
+} // namespace
+
+// ============================================================================
+
+OlePropertyStreamObject::OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName ) :
+    BinaryStreamObject( rParent, rxStrm, rSysFileName )
+{
+}
+
+void OlePropertyStreamObject::implDump()
+{
+    BinaryInputStream& rStrm = in();
+    Output& rOut = out();
+
+    OUStringVector aGuidVec;
+    ::std::vector< sal_uInt32 > aStartPosVec;
+
+    // dump header
+    writeEmptyItem( "HEADER" );
+    {
+        IndentGuard aIndGuard( rOut );
+        dumpHex< sal_uInt16 >( "byte-order", "OLEPROP-BYTE-ORDER" );
+        dumpDec< sal_uInt16 >( "version" );
+        dumpDec< sal_uInt16 >( "os-minor" );
+        dumpDec< sal_uInt16 >( "os-type", "OLEPROP-OSTYPE" );
+        dumpGuid( "guid" );
+        sal_Int32 nSectCount = dumpDec< sal_Int32 >( "section-count" );
+
+        // dump table of section positions
+        {
+            TableGuard aTabGuard( rOut, 15, 60 );
+            rOut.resetItemIndex();
+            for( sal_Int32 nSectIdx = 0; !rStrm.isEof() && (nSectIdx < nSectCount); ++nSectIdx )
+            {
+                MultiItemsGuard aMultiGuard( rOut );
+                writeEmptyItem( "#section" );
+                aGuidVec.push_back( dumpGuid( "guid" ) );
+                aStartPosVec.push_back( dumpHex< sal_uInt32 >( "start-pos", "CONV-DEC" ) );
+            }
+        }
+    }
+    rOut.emptyLine();
+
+    // dump sections
+    for( size_t nSectIdx = 0; !rStrm.isEof() && (nSectIdx < aStartPosVec.size()); ++nSectIdx )
+        dumpSection( aGuidVec[ nSectIdx ], aStartPosVec[ nSectIdx ] );
+}
+
+void OlePropertyStreamObject::dumpSection( const OUString& rGuid, sal_uInt32 nStartPos )
+{
+    BinaryInputStream& rStrm = in();
+    Output& rOut = out();
+
+    // property ID names
+    mxPropIds = cfg().createNameList< ConstList >( "OLEPROP-IDS" );
+    OUString aGuidName = cfg().getStringOption( rGuid, OUString() );
+    if( aGuidName.equalsAscii( "GlobalDocProp" ) )
+        mxPropIds->includeList( cfg().getNameList( "OLEPROP-GLOBALIDS" ) );
+    else if( aGuidName.equalsAscii( "BuiltinDocProp" ) )
+        mxPropIds->includeList( cfg().getNameList( "OLEPROP-BUILTINIDS" ) );
+    else
+        mxPropIds->includeList( cfg().getNameList( "OLEPROP-BASEIDS" ) );
+
+    // property ID/position map
+    typedef ::std::map< sal_Int32, sal_uInt32 > PropertyPosMap;
+    PropertyPosMap aPropMap;
+
+    // dump section header line
+    writeSectionHeader( rGuid, nStartPos );
+
+    // seek to section
+    IndentGuard aIndGuard( rOut );
+    if( startElement( nStartPos ) )
+    {
+        // dump section header
+        dumpDec< sal_Int32 >( "size" );
+        sal_Int32 nPropCount = dumpDec< sal_Int32 >( "property-count" );
+
+        // dump table of property positions
+        {
+            TableGuard aTabGuard( rOut, 15, 25 );
+            rOut.resetItemIndex();
+            for( sal_Int32 nPropIdx = 0; !rStrm.isEof() && (nPropIdx < nPropCount); ++nPropIdx )
+            {
+                MultiItemsGuard aMultiGuard( rOut );
+                writeEmptyItem( "#property" );
+                sal_Int32 nPropId = dumpDec< sal_Int32 >( "id", mxPropIds );
+                sal_uInt32 nPropPos = nStartPos + dumpHex< sal_uInt32 >( "start-pos", "CONV-DEC" );
+                aPropMap[ nPropId ] = nPropPos;
+            }
+        }
+    }
+    rOut.emptyLine();
+
+    // code page property
+    meTextEnc = osl_getThreadTextEncoding();
+    mbIsUnicode = false;
+    PropertyPosMap::iterator aCodePageIt = aPropMap.find( OLEPROP_ID_CODEPAGE );
+    if( aCodePageIt != aPropMap.end() )
+    {
+        dumpCodePageProperty( aCodePageIt->second );
+        aPropMap.erase( aCodePageIt );
+    }
+
+    // dictionary property
+    PropertyPosMap::iterator aDictIt = aPropMap.find( OLEPROP_ID_DICTIONARY );
+    if( aDictIt != aPropMap.end() )
+    {
+        dumpDictionaryProperty( aDictIt->second );
+        aPropMap.erase( aDictIt );
+    }
+
+    // other properties
+    for( PropertyPosMap::const_iterator aIt = aPropMap.begin(), aEnd = aPropMap.end(); aIt != aEnd; ++aIt )
+        dumpProperty( aIt->first, aIt->second );
+
+    // remove the user defined list of property ID names
+    cfg().eraseNameList( "OLEPROP-IDS" );
+}
+
+void OlePropertyStreamObject::dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos )
+{
+    writePropertyHeader( nPropId, nStartPos );
+    IndentGuard aIndGuard( out() );
+    if( startElement( nStartPos ) )
+        dumpPropertyContents( nPropId );
+    out().emptyLine();
+}
+
+void OlePropertyStreamObject::dumpCodePageProperty( sal_uInt32 nStartPos )
+{
+    writePropertyHeader( OLEPROP_ID_CODEPAGE, nStartPos );
+    IndentGuard aIndGuard( out() );
+    if( startElement( nStartPos ) )
+    {
+        sal_Int32 nType = dumpPropertyType();
+        if( nType == OLEPROP_TYPE_INT16 )
+        {
+            sal_uInt16 nCodePage = dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" );
+            rtl_TextEncoding nNewTextEnc = rtl_getTextEncodingFromWindowsCodePage( nCodePage );
+            if( nNewTextEnc != RTL_TEXTENCODING_DONTKNOW )
+                meTextEnc = nNewTextEnc;
+            mbIsUnicode = nCodePage == CODEPAGE_UNICODE;
+        }
+        else
+            dumpPropertyContents( OLEPROP_ID_CODEPAGE );
+    }
+    out().emptyLine();
+}
+
+void OlePropertyStreamObject::dumpDictionaryProperty( sal_uInt32 nStartPos )
+{
+    writePropertyHeader( OLEPROP_ID_DICTIONARY, nStartPos );
+    IndentGuard aIndGuard( out() );
+    if( startElement( nStartPos ) )
+    {
+        sal_Int32 nCount = dumpDec< sal_Int32 >( "count" );
+        for( sal_Int32 nIdx = 0; !in().isEof() && (nIdx < nCount); ++nIdx )
+        {
+            MultiItemsGuard aMultiGuard( out() );
+            TableGuard aTabGuard( out(), 10, 20 );
+            sal_Int32 nId = dumpDec< sal_Int32 >( "id" );
+            OUString aName = dumpString8( "name" );
+            if( mxPropIds.get() )
+                mxPropIds->setName( nId, aName );
+        }
+    }
+    out().emptyLine();
+}
+
+void OlePropertyStreamObject::dumpPropertyContents( sal_Int32 nPropId )
+{
+    sal_Int32 nType = dumpPropertyType();
+    if( getFlag< sal_Int32 >( nType, 0x1000 ) ) // vector
+    {
+        sal_Int32 nBaseType = nType & 0x0FFF;
+        sal_Int32 nElemCount = dumpDec< sal_Int32 >( "element-count" );
+        for( sal_Int32 nElemIdx = 0; !in().isEof() && (nElemIdx < nElemCount); ++nElemIdx )
+        {
+            out().resetItemIndex( nElemIdx );
+            writeEmptyItem( "#element" );
+            IndentGuard aIndGuard( out() );
+            dumpPropertyValue( nPropId, nBaseType );
+        }
+    }
+    else if( !getFlag< sal_Int32 >( nType, 0x7000 ) )
+    {
+        dumpPropertyValue( nPropId, nType );
+    }
+}
+
+void OlePropertyStreamObject::dumpPropertyValue( sal_Int32 nPropId, sal_Int32 nBaseType )
+{
+    switch( nBaseType )
+    {
+        case OLEPROP_TYPE_INT16:        dumpDec< sal_Int16 >( "value" );        break;
+        case OLEPROP_TYPE_INT32:        dumpDec< sal_Int32 >( "value" );        break;
+        case OLEPROP_TYPE_FLOAT:        dumpDec< float >( "value" );            break;
+        case OLEPROP_TYPE_DOUBLE:       dumpDec< double >( "value" );           break;
+        case OLEPROP_TYPE_DATE:         dumpDec< double >( "date" );            break;
+        case OLEPROP_TYPE_STRING:       dumpString8( "value" );                 break;
+        case OLEPROP_TYPE_STATUS:       dumpHex< sal_Int32 >( "status" );       break;
+        case OLEPROP_TYPE_BOOL:         dumpBool< sal_Int16 >( "value" );       break;
+        case OLEPROP_TYPE_VARIANT:      dumpPropertyContents( nPropId );        break;
+        case OLEPROP_TYPE_INT8:         dumpDec< sal_Int8 >( "value" );         break;
+        case OLEPROP_TYPE_UINT8:        dumpDec< sal_uInt8 >( "value" );        break;
+        case OLEPROP_TYPE_UINT16:       dumpDec< sal_uInt16 >( "value" );       break;
+        case OLEPROP_TYPE_UINT32:       dumpDec< sal_uInt32 >( "value" );       break;
+        case OLEPROP_TYPE_INT64:        dumpDec< sal_Int64 >( "value" );        break;
+        case OLEPROP_TYPE_UINT64:       dumpDec< sal_uInt64 >( "value" );       break;
+        case OLEPROP_TYPE_STRING8:      dumpString8( "value" );                 break;
+        case OLEPROP_TYPE_STRING16:     dumpString16( "value" );                break;
+        case OLEPROP_TYPE_FILETIME:     dumpFileTime( "file-time" );            break;
+        case OLEPROP_TYPE_BLOB:         dumpBlob( "data" );                     break;
+        case OLEPROP_TYPE_STREAM:       dumpString8( "stream-name" );           break;
+        case OLEPROP_TYPE_STORAGE:      dumpString8( "storage-name" );          break;
+        case OLEPROP_TYPE_CLIPFMT:      dumpBlob( "clip-data" );                break;
+    }
+}
+
+sal_Int32 OlePropertyStreamObject::dumpPropertyType()
+{
+    return dumpHex< sal_Int32 >( "type", "OLEPROP-TYPE" );
+}
+
+void OlePropertyStreamObject::dumpBlob( const String& rName )
+{
+    sal_Int32 nSize = dumpDec< sal_Int32 >( "data-size" );
+    if( nSize > 0 )
+        dumpBinary( rName, nSize );
+}
+
+OUString OlePropertyStreamObject::dumpString8( const String& rName )
+{
+    sal_Int32 nLen = dumpDec< sal_Int32 >( "string-len" );
+    return mbIsUnicode ? dumpCharArray16( rName, nLen ) : dumpCharArray8( rName, nLen );
+}
+
+OUString OlePropertyStreamObject::dumpCharArray8( const String& rName, sal_Int32 nLen )
+{
+    OUString aData;
+    size_t nNewLen = getLimitedValue< size_t, sal_Int32 >( nLen, 0, 1024 );
+    if( nNewLen > 0 )
+    {
+        ::std::vector< sal_Char > aBuffer( nNewLen + 1 );
+        in().readMemory( &aBuffer.front(), nNewLen );
+        aBuffer[ nNewLen ] = 0;
+        aData = OStringToOUString( OString( &aBuffer.front() ), meTextEnc );
+    }
+    writeStringItem( rName, aData );
+    return aData;
+}
+
+OUString OlePropertyStreamObject::dumpString16( const String& rName )
+{
+    sal_Int32 nLen = dumpDec< sal_Int32 >( "string-len" );
+    return dumpCharArray16( rName, nLen );
+}
+
+OUString OlePropertyStreamObject::dumpCharArray16( const String& rName, sal_Int32 nLen )
+{
+    size_t nNewLen = getLimitedValue< size_t, sal_Int32 >( nLen, 0, 1024 );
+    ::std::vector< sal_Unicode > aBuffer;
+    aBuffer.reserve( nNewLen + 1 );
+    for( size_t nIdx = 0; nIdx < nNewLen; ++nIdx )
+        aBuffer.push_back( static_cast< sal_Unicode >( in().readuInt16() ) );
+    aBuffer.push_back( 0 );
+    OUString aData( &aBuffer.front() );
+    writeStringItem( rName, aData );
+    if( nNewLen & 1 ) dumpUnused( 2 ); // always padding to 32bit
+    return aData;
+}
+
+bool OlePropertyStreamObject::startElement( sal_uInt32 nStartPos )
+{
+    in().seek( nStartPos );
+    if( in().isEof() )
+        writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
+    return !in().isEof();
+}
+
+void OlePropertyStreamObject::writeSectionHeader( const OUString& rGuid, sal_uInt32 nStartPos )
+{
+    MultiItemsGuard aMultiGuard( out() );
+    writeEmptyItem( "SECTION" );
+    writeHexItem( "pos", nStartPos, "CONV-DEC" );
+    writeGuidItem( "guid", rGuid );
+}
+
+void OlePropertyStreamObject::writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos )
+{
+    MultiItemsGuard aMultiGuard( out() );
+    writeEmptyItem( "PROPERTY" );
+    writeHexItem( "pos", nStartPos, "CONV-DEC" );
+    writeDecItem( "id", nPropId, mxPropIds );
+}
+
+// ============================================================================
+
+OleStorageObject::OleStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath )
+{
+    construct( rParent, rxStrg, rSysPath );
+}
+
+void OleStorageObject::construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath )
+{
+    StorageObjectBase::construct( rParent, rxStrg, rSysPath );
+}
+
+void OleStorageObject::construct( const ObjectBase& rParent )
+{
+    StorageObjectBase::construct( rParent );
+}
+
+void OleStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& /*rStrgPath*/, const OUString& rStrmName, const OUString& rSysFileName )
+{
+    if( rStrmName.equalsAscii( "\005SummaryInformation" ) || rStrmName.equalsAscii( "\005DocumentSummaryInformation" ) )
+        OlePropertyStreamObject( *this, rxStrm, rSysFileName ).dump();
+    else
+        BinaryStreamObject( *this, rxStrm, rSysFileName ).dump();
+}
+
+// ============================================================================
+// ============================================================================
+
+void OcxPropertyObjectBase::construct( const ObjectBase& rParent,
+        const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, const String& rPropNameList, bool b64BitPropFlags )
+{
+    InputObjectBase::construct( rParent, rxStrm, rSysFileName );
+    constructOcxPropObj( rPropNameList, b64BitPropFlags );
+}
+
+void OcxPropertyObjectBase::construct( const OutputObjectBase& rParent,
+        const BinaryInputStreamRef& rxStrm, const String& rPropNameList, bool b64BitPropFlags )
+{
+    InputObjectBase::construct( rParent, rxStrm );
+    constructOcxPropObj( rPropNameList, b64BitPropFlags );
+}
+
+void OcxPropertyObjectBase::construct( const InputObjectBase& rParent,
+        const String& rPropNameList, bool b64BitPropFlags )
+{
+    InputObjectBase::construct( rParent );
+    constructOcxPropObj( rPropNameList, b64BitPropFlags );
+}
+
+bool OcxPropertyObjectBase::implIsValid() const
+{
+    return InputObjectBase::implIsValid() && in().isSeekable();
+}
+
+void OcxPropertyObjectBase::implDump()
+{
+    mbValid = true;
+    // header
+    setAlignAnchor();
+    dumpVersion();
+    sal_uInt16 nSize = dumpDec< sal_uInt16 >( "size" );
+    mnPropertiesEnd = in().tell() + nSize;
+    // property flags
+    maLargeProps.clear();
+    maStreamProps.clear();
+    mnPropFlags = dumpHex< sal_Int64, sal_uInt32 >( mb64BitPropFlags, "properties", mxPropNames );
+    mnCurrProp = 0;
+    // properties
+    dumpShortProperties();
+    dumpLargeProperties();
+    setAlignAnchor();
+    if( ensureValid() )
+        implDumpExtended();
+}
+
+void OcxPropertyObjectBase::implDumpShortProperties()
+{
+}
+
+void OcxPropertyObjectBase::implDumpExtended()
+{
+}
+
+bool OcxPropertyObjectBase::ensureValid( bool bCondition )
+{
+    if( mbValid && (!bCondition || in().isEof()) )
+    {
+        if( !bCondition )
+            writeInfoItem( "state", OOX_DUMP_ERRASCII( "format-error" ) );
+        mbValid = false;
+    }
+    return mbValid;
+}
+
+void OcxPropertyObjectBase::setAlignAnchor()
+{
+    mnPropertiesStart = in().tell();
+}
+
+bool OcxPropertyObjectBase::startNextProperty()
+{
+    if( mnCurrProp == 0 ) mnCurrProp = 1; else mnCurrProp <<= 1;
+    bool bHasProp = getFlag( mnPropFlags, mnCurrProp );
+    setFlag( mnPropFlags, mnCurrProp, false );
+    return ensureValid() && bHasProp;
+}
+
+OUString OcxPropertyObjectBase::getPropertyName() const
+{
+    return cfg().getName( mxPropNames, mnCurrProp );
+}
+
+sal_uInt32 OcxPropertyObjectBase::dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList )
+{
+    if( startNextProperty() )
+    {
+        alignInput< sal_uInt32 >();
+        return dumpHex< sal_uInt32 >( getPropertyName(), pcNameList );
+    }
+    return nDefault;
+}
+
+sal_uInt32 OcxPropertyObjectBase::dumpColorProperty( sal_uInt32 nDefault )
+{
+    if( startNextProperty() )
+    {
+        MultiItemsGuard aMultiGuard( out() );
+        alignInput< sal_uInt32 >();
+        sal_uInt32 nColor = dumpHex< sal_uInt32 >( getPropertyName(), "OCX-COLOR" );
+        switch( extractValue< sal_uInt8 >( nColor, 24, 8 ) )
+        {
+            case 0x00:  writeColorABGRItem( "rgb", extractValue< sal_Int32 >( nColor, 0, 24 ) );                        break;
+            case 0x01:  writeDecItem( "palette-index", extractValue< sal_uInt16 >( nColor, 0, 16 ) );                   break;
+            case 0x02:  writeColorABGRItem( "rgb", extractValue< sal_Int32 >( nColor, 0, 24 ) );                        break;
+            case 0x80:  writeDecItem( "sys-color", extractValue< sal_uInt16 >( nColor, 0, 16 ), "OCX-SYSTEMCOLOR" );    break;
+        }
+        return nColor;
+    }
+    return nDefault;
+}
+
+sal_Unicode OcxPropertyObjectBase::dumpUnicodeProperty()
+{
+    if( startNextProperty() )
+    {
+        alignInput< sal_uInt16 >();
+        return dumpUnicode( getPropertyName() );
+    }
+    return '\0';
+}
+
+void OcxPropertyObjectBase::dumpUnknownProperty()
+{
+    if( startNextProperty() )
+        ensureValid( false );
+}
+
+void OcxPropertyObjectBase::dumpPosProperty()
+{
+    if( startNextProperty() )
+        maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_POS, getPropertyName(), 8 ) );
+}
+
+void OcxPropertyObjectBase::dumpSizeProperty()
+{
+    if( startNextProperty() )
+        maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_SIZE, getPropertyName(), 8 ) );
+}
+
+void OcxPropertyObjectBase::dumpGuidProperty( OUString* pValue )
+{
+    if( startNextProperty() )
+        maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_GUID, getPropertyName(), 16, pValue ) );
+}
+
+void OcxPropertyObjectBase::dumpStringProperty( OUString* pValue )
+{
+    if( startNextProperty() )
+    {
+        alignInput< sal_uInt32 >();
+        sal_uInt32 nLen = dumpHex< sal_uInt32 >( getPropertyName(), "OCX-STRINGLEN" );
+        maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_STRING, getPropertyName(), nLen, pValue ) );
+    }
+}
+
+void OcxPropertyObjectBase::dumpStringArrayProperty()
+{
+    if( startNextProperty() )
+    {
+        alignInput< sal_uInt32 >();
+        sal_uInt32 nLen = dumpHex< sal_uInt32 >( getPropertyName(), "CONV-DEC" );
+        maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_STRINGARRAY, getPropertyName(), nLen ) );
+    }
+}
+
+void OcxPropertyObjectBase::dumpStreamProperty()
+{
+    if( startNextProperty() )
+    {
+        alignInput< sal_uInt16 >();
+        sal_uInt16 nData = dumpHex< sal_uInt16 >( getPropertyName() );
+        maStreamProps.push_back( StreamProperty( getPropertyName(), nData ) );
+    }
+}
+
+void OcxPropertyObjectBase::dumpEmbeddedFont()
+{
+    if( ensureValid() )
+    {
+        writeEmptyItem( "embedded-fontdata" );
+        IndentGuard aIndGuard( out() );
+        OcxCFontNewObject( *this ).dump();
+    }
+}
+
+void OcxPropertyObjectBase::dumpToPosition( sal_Int64 nPos )
+{
+    dumpRemainingTo( nPos );
+    mbValid = true;
+    ensureValid();
+}
+
+void OcxPropertyObjectBase::constructOcxPropObj( const String& rPropNameList, bool b64BitPropFlags )
+{
+    if( InputObjectBase::implIsValid() )
+    {
+        mxPropNames = cfg().getNameList( rPropNameList );
+        mb64BitPropFlags = b64BitPropFlags;
+        mbValid = true;
+    }
+}
+
+void OcxPropertyObjectBase::dumpVersion()
+{
+    ItemGuard aItem( out(), "version" );
+    sal_uInt8 nMinor, nMajor;
+    in() >> nMinor >> nMajor;
+    out().writeDec( nMajor );
+    out().writeChar( '.' );
+    out().writeDec( nMinor );
+}
+
+OUString OcxPropertyObjectBase::dumpString( const String& rName, sal_uInt32 nSize, bool bArray )
+{
+    bool bCompressed = getFlag( nSize, OCX_STRING_COMPRESSED );
+    sal_uInt32 nBufSize = extractValue< sal_uInt32 >( nSize, 0, 31 );
+    OUString aString = bCompressed ?
+        dumpCharArray( rName, nBufSize, RTL_TEXTENCODING_ISO_8859_1 ) :
+        dumpUnicodeArray( rName, bArray ? nBufSize : (nBufSize / 2) );
+    alignInput< sal_Int32 >();
+    return aString;
+}
+
+void OcxPropertyObjectBase::dumpShortProperties()
+{
+    if( ensureValid() )
+    {
+        writeEmptyItem( "short-properties" );
+        IndentGuard aIndGuard( out() );
+        implDumpShortProperties();
+        alignInput< sal_uInt32 >();
+    }
+}
+
+void OcxPropertyObjectBase::dumpLargeProperties()
+{
+    if( ensureValid( mnPropFlags == 0 ) && !maLargeProps.empty() )
+    {
+        writeEmptyItem( "large-properties" );
+        IndentGuard aIndGuard( out() );
+        for( LargePropertyVector::iterator aIt = maLargeProps.begin(), aEnd = maLargeProps.end(); ensureValid() && (aIt != aEnd); ++aIt )
+        {
+            switch( aIt->mePropType )
+            {
+                case LargeProperty::PROPTYPE_POS:
+                {
+                    MultiItemsGuard aMultiGuard( out() );
+                    writeEmptyItem( aIt->maItemName );
+                    dumpDec< sal_Int32 >( "top", "CONV-HMM-TO-CM" );
+                    dumpDec< sal_Int32 >( "left", "CONV-HMM-TO-CM" );
+                }
+                break;
+                case LargeProperty::PROPTYPE_SIZE:
+                {
+                    MultiItemsGuard aMultiGuard( out() );
+                    writeEmptyItem( aIt->maItemName );
+                    dumpDec< sal_Int32 >( "width", "CONV-HMM-TO-CM" );
+                    dumpDec< sal_Int32 >( "height", "CONV-HMM-TO-CM" );
+                }
+                break;
+                case LargeProperty::PROPTYPE_GUID:
+                {
+                    OUString aGuid = dumpGuid( aIt->maItemName );
+                    if( aIt->mpItemValue )
+                        *aIt->mpItemValue = cfg().getStringOption( aGuid, OUString() );
+                }
+                break;
+                case LargeProperty::PROPTYPE_STRING:
+                {
+                    OUString aString = dumpString( aIt->maItemName, aIt->mnDataSize, false );
+                    if( aIt->mpItemValue )
+                        *aIt->mpItemValue = aString;
+                }
+                break;
+                case LargeProperty::PROPTYPE_STRINGARRAY:
+                {
+                    writeEmptyItem( aIt->maItemName );
+                    IndentGuard aIndGuard2( out() );
+                    out().resetItemIndex();
+                    sal_Int64 nEndPos = in().tell() + aIt->mnDataSize;
+                    while( in().tell() < nEndPos )
+                    {
+                        MultiItemsGuard aMultiGuard( out() );
+                        sal_uInt32 nDataSize = dumpHex< sal_uInt32 >( "#flags", "OCX-ARRAYSTRINGLEN" );
+                        dumpString( "string", nDataSize, true );
+                    }
+                    dumpToPosition( nEndPos );
+                }
+                break;
+            }
+        }
+    }
+    dumpToPosition( mnPropertiesEnd );
+
+    if( ensureValid() && !maStreamProps.empty() )
+    {
+        writeEmptyItem( "stream-properties" );
+        IndentGuard aIndGuard( out() );
+        for( StreamPropertyVector::iterator aIt = maStreamProps.begin(), aEnd = maStreamProps.end(); ensureValid() && (aIt != aEnd); ++aIt )
+        {
+            writeEmptyItem( aIt->maItemName );
+            if( ensureValid( aIt->mnData == 0xFFFF ) )
+            {
+                IndentGuard aIndGuard2( out() );
+                OUString aClassName = cfg().getStringOption( dumpGuid(), OUString() );
+                if( aClassName.equalsAscii( "StdFont" ) )
+                    StdFontObject( *this ).dump();
+                else if( aClassName.equalsAscii( "StdPic" ) )
+                    StdPicObject( *this ).dump();
+                else if( aClassName.equalsAscii( "CFontNew" ) )
+                    OcxCFontNewObject( *this ).dump();
+                else
+                    ensureValid( false );
+            }
+        }
+    }
+}
+
+// ============================================================================
+
+OcxCFontNewObject::OcxCFontNewObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-CFONTNEW-PROPERTIES" );
+}
+
+void OcxCFontNewObject::implDumpShortProperties()
+{
+    dumpStringProperty();
+    dumpFlagsProperty( 0, "OCX-CFONTNEW-FLAGS" );
+    dumpDecProperty< sal_Int32 >( 160 );
+    dumpDecProperty< sal_Int32 >( 0 );
+    dumpDecProperty< sal_uInt8 >( 1, "CHARSET" );
+    dumpDecProperty< sal_uInt8 >( 0, "FONT-PITCHFAMILY" );
+    dumpDecProperty< sal_uInt8 >( 1, "OCX-CFONTNEW-ALIGNMENT" );
+    dumpDecProperty< sal_uInt16 >( 400, "FONT-WEIGHT" );
+}
+
+// ============================================================================
+
+OcxColumnInfoObject::OcxColumnInfoObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-COLUMNINFO-PROPERTIES" );
+}
+
+void OcxColumnInfoObject::implDumpShortProperties()
+{
+    dumpDecProperty< sal_Int32 >( -1, "CONV-HMM-TO-CM" );
+}
+
+// ============================================================================
+
+OcxCommandButtonObject::OcxCommandButtonObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-COMMANDBUTTON-PROPERTIES" );
+}
+
+void OcxCommandButtonObject::implDumpShortProperties()
+{
+    dumpColorProperty( 0x80000012 );
+    dumpColorProperty( 0x80000008 );
+    dumpFlagsProperty( 0x0000001B );
+    dumpStringProperty();
+    dumpImagePosProperty();
+    dumpSizeProperty();
+    dumpMousePtrProperty();
+    dumpStreamProperty();
+    dumpUnicodeProperty();
+    dumpBoolProperty();
+    dumpStreamProperty();
+}
+
+void OcxCommandButtonObject::implDumpExtended()
+{
+    dumpEmbeddedFont();
+}
+
+// ============================================================================
+
+OcxMorphControlObject::OcxMorphControlObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-MORPH-PROPERTIES", true );
+}
+
+void OcxMorphControlObject::implDumpShortProperties()
+{
+    dumpFlagsProperty( 0x2C80081B );
+    dumpColorProperty( 0x80000005 );
+    dumpColorProperty( 0x80000008 );
+    dumpDecProperty< sal_uInt32 >( 0 );
+    dumpBorderStyleProperty< sal_uInt8 >( 0 );
+    dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-SCROLLBARS" );
+    mnCtrlType = dumpDecProperty< sal_uInt8 >( 1, "OCX-MORPH-CONTROLTYPE" );
+    dumpMousePtrProperty();
+    dumpSizeProperty();
+    dumpUnicodeProperty();
+    dumpDecProperty< sal_uInt32 >( 0, "CONV-HMM-TO-CM" );
+    dumpDecProperty< sal_uInt16 >( 1, "OCX-MORPH-BOUNDCOLUMN" );
+    dumpDecProperty< sal_Int16 >( -1, "OCX-MORPH-TEXTCOLUMN" );
+    dumpDecProperty< sal_Int16 >( 1, "OCX-MORPH-COLUMNCOUNT" );
+    dumpDecProperty< sal_uInt16 >( 8 );
+    mnColInfoCount = dumpDecProperty< sal_uInt16 >( 1 );
+    dumpDecProperty< sal_uInt8 >( 2, "OCX-MORPH-MATCHENTRYTYPE" );
+    dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-LISTSTYLE" );
+    dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-SHOWDROPDOWNMODE" );
+    dumpUnknownProperty();
+    dumpDecProperty< sal_uInt8 >( 1, "OCX-MORPH-DROPDOWNSTYLE" );
+    dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-SELECTIONTYPE" );
+    dumpStringProperty();
+    dumpStringProperty();
+    dumpImagePosProperty();
+    dumpColorProperty( 0x80000006 );
+    dumpSpecialEffectProperty< sal_uInt32 >( 2 );
+    dumpStreamProperty();
+    dumpStreamProperty();
+    dumpUnicodeProperty();
+    dumpUnknownProperty();
+    dumpBoolProperty();
+    dumpStringProperty();
+}
+
+void OcxMorphControlObject::implDumpExtended()
+{
+    dumpEmbeddedFont();
+    dumpColumnInfos();
+}
+
+void OcxMorphControlObject::dumpColumnInfos()
+{
+    if( ensureValid() && (mnColInfoCount > 0) && ((mnCtrlType == 2) || (mnCtrlType == 3)) )
+    {
+        out().resetItemIndex();
+        for( sal_uInt16 nIdx = 0; ensureValid() && (nIdx < mnColInfoCount); ++nIdx )
+        {
+            writeEmptyItem( "#column-info" );
+            IndentGuard aIndGuard( out() );
+            OcxColumnInfoObject( *this ).dump();
+        }
+    }
+}
+
+// ============================================================================
+
+OcxLabelObject::OcxLabelObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-LABEL-PROPERTIES" );
+}
+
+void OcxLabelObject::implDumpShortProperties()
+{
+    dumpColorProperty( 0x80000012 );
+    dumpColorProperty( 0x8000000F );
+    dumpFlagsProperty( 0x0080001B );
+    dumpStringProperty();
+    dumpImagePosProperty();
+    dumpSizeProperty();
+    dumpMousePtrProperty();
+    dumpColorProperty( 0x80000006 );
+    dumpBorderStyleProperty< sal_uInt16 >( 0 );
+    dumpSpecialEffectProperty< sal_uInt16 >( 0 );
+    dumpStreamProperty();
+    dumpUnicodeProperty();
+    dumpBoolProperty();
+    dumpStreamProperty();
+}
+
+void OcxLabelObject::implDumpExtended()
+{
+    dumpEmbeddedFont();
+}
+
+// ============================================================================
+
+OcxImageObject::OcxImageObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-IMAGE-PROPERTIES" );
+}
+
+void OcxImageObject::implDumpShortProperties()
+{
+    dumpUnknownProperty();
+    dumpUnknownProperty();
+    dumpBoolProperty();
+    dumpColorProperty( 0x80000006 );
+    dumpColorProperty( 0x8000000F );
+    dumpBorderStyleProperty< sal_uInt8 >( 1 );
+    dumpMousePtrProperty();
+    dumpImageSizeModeProperty();
+    dumpSpecialEffectProperty< sal_uInt8 >( 0 );
+    dumpSizeProperty();
+    dumpStreamProperty();
+    dumpImageAlignProperty();
+    dumpBoolProperty();
+    dumpFlagsProperty( 0x0000001B );
+    dumpStreamProperty();
+}
+
+// ============================================================================
+
+OcxScrollBarObject::OcxScrollBarObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-SCROLLBAR-PROPERTIES" );
+}
+
+void OcxScrollBarObject::implDumpShortProperties()
+{
+    dumpColorProperty( 0x80000012 );
+    dumpColorProperty( 0x8000000F );
+    dumpFlagsProperty( 0x0000001B );
+    dumpSizeProperty();
+    dumpMousePtrProperty();
+    dumpDecProperty< sal_Int32 >( 0 );
+    dumpDecProperty< sal_Int32 >( 32767 );
+    dumpDecProperty< sal_Int32 >( 0 );
+    dumpHexProperty< sal_uInt32 >( 0 );
+    dumpEnabledProperty();
+    dumpEnabledProperty();
+    dumpDecProperty< sal_Int32 >( 1 );
+    dumpDecProperty< sal_Int32 >( 1 );
+    dumpOrientationProperty();
+    dumpDecProperty< sal_Int16 >( -1, "OCX-SCROLLBAR-PROPTHUMB" );
+    dumpDelayProperty();
+    dumpStreamProperty();
+}
+
+// ============================================================================
+
+OcxSpinButtonObject::OcxSpinButtonObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-SPINBUTTON-PROPERTIES" );
+}
+
+void OcxSpinButtonObject::implDumpShortProperties()
+{
+    dumpColorProperty( 0x80000012 );
+    dumpColorProperty( 0x8000000F );
+    dumpFlagsProperty( 0x0000001B );
+    dumpSizeProperty();
+    dumpHexProperty< sal_uInt32 >( 0 );
+    dumpDecProperty< sal_Int32 >( 0 );
+    dumpDecProperty< sal_Int32 >( 100 );
+    dumpDecProperty< sal_Int32 >( 0 );
+    dumpEnabledProperty();
+    dumpEnabledProperty();
+    dumpDecProperty< sal_Int32 >( 1 );
+    dumpOrientationProperty();
+    dumpDelayProperty();
+    dumpStreamProperty();
+    dumpMousePtrProperty();
+}
+
+// ============================================================================
+
+OcxTabStripObject::OcxTabStripObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-TABSTRIP-PROPERTIES" );
+}
+
+void OcxTabStripObject::implDumpShortProperties()
+{
+    dumpDecProperty< sal_Int32 >( -1 );
+    dumpColorProperty( 0x8000000F );
+    dumpColorProperty( 0x80000012 );
+    dumpUnknownProperty();
+    dumpSizeProperty();
+    dumpStringArrayProperty();
+    dumpMousePtrProperty();
+    dumpUnknownProperty();
+    dumpDecProperty< sal_uInt32 >( 0, "OCX-TABSTRIP-ORIENTATION" );
+    dumpDecProperty< sal_uInt32 >( 0, "OCX-TABSTRIP-TABSTYLE" );
+    dumpBoolProperty();
+    dumpHmmProperty();
+    dumpHmmProperty();
+    dumpBoolProperty();
+    dumpUnknownProperty();
+    dumpStringArrayProperty();
+    dumpUnknownProperty();
+    dumpStringArrayProperty();
+    dumpFlagsProperty( 0x0000001B );
+    dumpBoolProperty();
+    dumpDecProperty< sal_uInt32 >( 0 );
+    dumpStringArrayProperty();
+    mnTabFlagCount = dumpDecProperty< sal_Int32 >( 0 );
+    dumpStringArrayProperty();
+    dumpStreamProperty();
+}
+
+void OcxTabStripObject::implDumpExtended()
+{
+    dumpEmbeddedFont();
+    if( mnTabFlagCount > 0 )
+    {
+        writeEmptyItem( "tab-flags" );
+        IndentGuard aIndGuard( out() );
+        out().resetItemIndex();
+        for( sal_Int32 nIdx = 0; ensureValid() && (nIdx < mnTabFlagCount); ++nIdx )
+            dumpHex< sal_uInt32 >( "#flags", "OCX-TABSTRIP-FLAGS" );
+    }
+}
+
+// ============================================================================
+
+OcxControlObject::OcxControlObject( const InputObjectBase& rParent, const OUString& rProgId, sal_Int64 nLength ) :
+    maProgId( rProgId ),
+    mnLength( nLength )
+{
+    InputObjectBase::construct( rParent );
+}
+
+void OcxControlObject::implDump()
+{
+    sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int64 >( mnLength, 0 );
+    if( (maProgId.getLength() > 0) && (mnLength > 0) && !in().isEof() )
+    {
+        if( maProgId.equalsAscii( "Forms.CommandButton.1" ) )
+            OcxCommandButtonObject( *this ).dump();
+        else if( maProgId.equalsAscii( "Forms.TextBox.1" ) ||
+                 maProgId.equalsAscii( "Forms.ListBox.1" ) ||
+                 maProgId.equalsAscii( "Forms.ComboBox.1" ) ||
+                 maProgId.equalsAscii( "Forms.CheckBox.1" ) ||
+                 maProgId.equalsAscii( "Forms.OptionButton.1" ) ||
+                 maProgId.equalsAscii( "Forms.ToggleButton.1" ) ||
+                 maProgId.equalsAscii( "RefEdit.Ctrl" ) )
+            OcxMorphControlObject( *this ).dump();
+        else if( maProgId.equalsAscii( "Forms.Label.1" ) )
+            OcxLabelObject( *this ).dump();
+        else if( maProgId.equalsAscii( "Forms.Image.1" ) )
+            OcxImageObject( *this ).dump();
+        else if( maProgId.equalsAscii( "Forms.ScrollBar.1" ) )
+            OcxScrollBarObject( *this ).dump();
+        else if( maProgId.equalsAscii( "Forms.SpinButton.1" ) )
+            OcxSpinButtonObject( *this ).dump();
+        else if( maProgId.equalsAscii( "Forms.TabStrip.1" ) )
+            OcxTabStripObject( *this ).dump();
+    }
+    dumpRemainingTo( nEndPos );
+}
+
+// ============================================================================
+
+OcxGuidControlObject::OcxGuidControlObject( const InputObjectBase& rParent, sal_Int64 nLength ) :
+    mnLength( nLength )
+{
+    InputObjectBase::construct( rParent );
+}
+
+void OcxGuidControlObject::implDump()
+{
+    OUString aProgId = cfg().getStringOption( dumpGuid(), OUString() );
+    OcxControlObject( *this, aProgId, mnLength - 16 ).dump();
+}
+
+// ============================================================================
+
+OcxControlsStreamObject::OcxControlsStreamObject( const ObjectBase& rParent,
+        const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, OcxFormSharedData& rFormData ) :
+    mrFormData( rFormData )
+{
+    InputObjectBase::construct( rParent, rxStrm, rSysFileName );
+}
+
+void OcxControlsStreamObject::implDump()
+{
+    for( OcxFormSiteInfoVector::iterator aIt = mrFormData.maSiteInfos.begin(), aEnd = mrFormData.maSiteInfos.end(); !in().isEof() && (aIt != aEnd); ++aIt )
+    {
+        if( (aIt->mbInStream) && (aIt->mnLength > 0) )
+        {
+            out().emptyLine();
+            writeDecItem( "control-id", aIt->mnId );
+            writeInfoItem( "prog-id", aIt->maProgId );
+            IndentGuard aIndGuard( out() );
+            OcxControlObject( *this, aIt->maProgId, aIt->mnLength ).dump();
+        }
+    }
+    dumpRemainingStream();
+}
+
+// ============================================================================
+// ============================================================================
+
+OcxPageObject::OcxPageObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-PAGE-PROPERTIES" );
+}
+
+void OcxPageObject::implDumpShortProperties()
+{
+    dumpUnknownProperty();
+    dumpDecProperty< sal_uInt32 >( 0, "OCX-PAGE-TRANSITIONEFFECT" );
+    dumpDecProperty< sal_uInt32 >( 0, "OCX-CONV-MS" );
+}
+
+// ============================================================================
+
+OcxMultiPageObject::OcxMultiPageObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-MULTIPAGE-PROPERTIES" );
+}
+
+void OcxMultiPageObject::implDumpShortProperties()
+{
+    dumpUnknownProperty();
+    mnPageCount = dumpDecProperty< sal_Int32 >( 0 );
+    dumpDecProperty< sal_Int32 >( 0 );
+    dumpBoolProperty();
+}
+
+void OcxMultiPageObject::implDumpExtended()
+{
+    if( ensureValid() && (mnPageCount > 0) )
+    {
+        writeEmptyItem( "page-ids" );
+        IndentGuard aIndGuard( out() );
+        out().resetItemIndex();
+        for( sal_Int32 nIdx = 0; ensureValid() && (nIdx < mnPageCount); ++nIdx )
+            dumpDec< sal_Int32 >( "#id" );
+    }
+}
+
+// ============================================================================
+
+OcxMultiPageStreamObject::OcxMultiPageStreamObject( const ObjectBase& rParent,
+        const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, OcxFormSharedData& rFormData ) :
+    mrFormData( rFormData )
+{
+    InputObjectBase::construct( rParent, rxStrm,  rSysFileName );
+}
+
+void OcxMultiPageStreamObject::implDump()
+{
+    for( size_t nIdx = 0, nCount = mrFormData.maSiteInfos.size(); !in().isEof() && (nIdx < nCount); ++nIdx )
+    {
+        out().emptyLine();
+        writeEmptyItem( "page" );
+        IndentGuard aIndGuard( out() );
+        OcxPageObject( *this ).dump();
+    }
+    if( !in().isEof() )
+    {
+        out().emptyLine();
+        writeEmptyItem( "multi-page" );
+        IndentGuard aIndGuard( out() );
+        OcxMultiPageObject( *this ).dump();
+    }
+    dumpRemainingStream();
+}
+
+// ============================================================================
+// ============================================================================
+
+OcxFormClassInfoObject::OcxFormClassInfoObject( const InputObjectBase& rParent, OcxFormSharedData& rFormData ) :
+    mrFormData( rFormData )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-CLASSINFO-PROPERTIES" );
+}
+
+void OcxFormClassInfoObject::implDumpShortProperties()
+{
+    mrFormData.maClassInfoProgIds.push_back( OUString() );
+    dumpGuidProperty( &mrFormData.maClassInfoProgIds.back() );
+    dumpGuidProperty();
+    dumpUnknownProperty();
+    dumpGuidProperty();
+    dumpFlagsProperty( 0, "OCX-CLASSINFO-FLAGS" );
+    dumpDecProperty< sal_Int32 >( -1 );
+    dumpDecProperty< sal_uInt16 >( 0 );
+    dumpDecProperty< sal_uInt16 >( 0 );
+    dumpDecProperty< sal_uInt16 >( 0, "OLEPROP-TYPE" );
+    dumpDecProperty< sal_uInt16 >( 0 );
+    dumpDecProperty< sal_uInt16 >( 0 );
+    dumpDecProperty< sal_uInt16 >( 0, "OLEPROP-TYPE" );
+    dumpDecProperty< sal_Int32 >( -1 );
+    dumpDecProperty< sal_uInt16 >( 0 );
+}
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt32 OCX_FORMSITE_OBJSTREAM         = 0x0010;
+
+const sal_uInt16 OCX_FORMSITE_CLASSTABLEINDEX   = 0x8000;
+const sal_uInt16 OCX_FORMSITE_CLASSTABLEMASK    = 0x7FFF;
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+OcxFormSiteObject::OcxFormSiteObject( const InputObjectBase& rParent, OcxFormSharedData& rFormData ) :
+    mrFormData( rFormData )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-FORMSITE-PROPERTIES" );
+}
+
+void OcxFormSiteObject::implDumpShortProperties()
+{
+    OcxFormSiteInfo aSiteInfo;
+    dumpStringProperty();
+    dumpStringProperty();
+    sal_Int32 nId = dumpDecProperty< sal_Int32 >( 0 );
+    dumpDecProperty< sal_Int32 >( 0 );
+    sal_uInt32 nFlags = dumpFlagsProperty( 0x00000033, "OCX-FORMSITE-FLAGS" );
+    sal_uInt32 nLength = dumpDecProperty< sal_uInt32 >( 0 );
+    dumpDecProperty< sal_Int16 >( -1 );
+    sal_uInt16 nClassId = dumpHexProperty< sal_uInt16 >( 0x7FFF, "OCX-FORMSITE-CLASSIDCACHE" );
+    dumpPosProperty();
+    dumpDecProperty< sal_uInt16 >( 0 );
+    dumpUnknownProperty();
+    dumpStringProperty();
+    dumpStringProperty();
+    dumpStringProperty();
+    dumpStringProperty();
+
+    sal_uInt16 nIndex = nClassId & OCX_FORMSITE_CLASSTABLEMASK;
+    if( getFlag( nClassId, OCX_FORMSITE_CLASSTABLEINDEX ) )
+    {
+        if( nIndex < mrFormData.maClassInfoProgIds.size() )
+            aSiteInfo.maProgId = mrFormData.maClassInfoProgIds[ nIndex ];
+    }
+    else
+    {
+        if( cfg().hasName( "OCX-FORMSITE-CLASSNAMES", nIndex ) )
+            aSiteInfo.maProgId = cfg().getName( "OCX-FORMSITE-CLASSNAMES", nIndex );
+    }
+    aSiteInfo.mnId = nId;
+    aSiteInfo.mnLength = nLength;
+    aSiteInfo.mbInStream = getFlag( nFlags, OCX_FORMSITE_OBJSTREAM );
+
+    mrFormData.maSiteInfos.push_back( aSiteInfo );
+}
+
+// ============================================================================
+
+OcxFormDesignExtObject::OcxFormDesignExtObject( const InputObjectBase& rParent )
+{
+    OcxPropertyObjectBase::construct( rParent, "OCX-FORMDESIGNEXT-PROPERTIES" );
+}
+
+void OcxFormDesignExtObject::implDumpShortProperties()
+{
+    dumpFlagsProperty( 0x00015F55, "OCX-FORMDESIGNEXT-FLAGS" );
+    dumpHmmProperty();
+    dumpHmmProperty();
+    dumpDecProperty< sal_Int8 >( 0, "OCX-FORMDESIGNEXT-CLICKCTRLMODE" );
+    dumpDecProperty< sal_Int8 >( 0, "OCX-FORMDESIGNEXT-DBLCLICKCTRLMODE" );
+}
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt32 OCX_FORM_HASDESIGNEXTENDER     = 0x00004000;
+const sal_uInt32 OCX_FORM_SKIPCLASSTABLE        = 0x00008000;
+
+const sal_uInt8 OCX_FORM_SITECOUNTTYPE_COUNT    = 0x80;
+const sal_uInt8 OCX_FORM_SITECOUNTTYPE_MASK     = 0x7F;
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+OcxFormObject::OcxFormObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, OcxFormSharedData& rFormData ) :
+    mrFormData( rFormData )
+{
+    OcxPropertyObjectBase::construct( rParent, rxStrm, rSysFileName, "OCX-FORM-PROPERTIES" );
+}
+
+void OcxFormObject::implDumpShortProperties()
+{
+    dumpUnknownProperty();
+    dumpColorProperty( 0x8000000F );
+    dumpColorProperty( 0x80000012 );
+    dumpDecProperty< sal_uInt32 >( 0 );
+    dumpUnknownProperty();
+    dumpUnknownProperty();
+    mnFlags = dumpFlagsProperty( 0x00000004, "OCX-FORM-FLAGS" );
+    dumpBorderStyleProperty< sal_uInt8 >( 0 );
+    dumpMousePtrProperty();
+    dumpHexProperty< sal_uInt8 >( 0x0C, "OCX-FORM-SCROLLBARS" );
+    dumpSizeProperty();
+    dumpSizeProperty();
+    dumpPosProperty();
+    dumpDecProperty< sal_uInt32 >( 0 );
+    dumpUnknownProperty();
+    dumpStreamProperty();
+    dumpDecProperty< sal_uInt8 >( 0, "OCX-FORM-CYCLE" );
+    dumpSpecialEffectProperty< sal_uInt8 >( 0 );
+    dumpColorProperty( 0x80000012 );
+    dumpStringProperty();
+    dumpStreamProperty();
+    dumpStreamProperty();
+    dumpDecProperty< sal_Int32 >( 100, "CONV-PERCENT" );
+    dumpImageAlignProperty();
+    dumpBoolProperty();
+    dumpImageSizeModeProperty();
+    dumpDecProperty< sal_uInt32 >( 0 );
+    dumpDecProperty< sal_uInt32 >( 0 );
+}
+
+void OcxFormObject::implDumpExtended()
+{
+    dumpClassInfos();
+    dumpSiteData();
+    dumpDesignExtender();
+    dumpRemainingStream();
+}
+
+void OcxFormObject::dumpClassInfos()
+{
+    if( ensureValid() && !getFlag( mnFlags, OCX_FORM_SKIPCLASSTABLE ) )
+    {
+        out().emptyLine();
+        sal_uInt16 nCount = dumpDec< sal_uInt16 >( "class-info-count" );
+        out().resetItemIndex();
+        for( sal_uInt16 nIdx = 0; ensureValid() && (nIdx < nCount); ++nIdx )
+        {
+            writeEmptyItem( "#class-info" );
+            IndentGuard aIndGuard( out() );
+            OcxFormClassInfoObject( *this, mrFormData ).dump();
+        }
+    }
+}
+
+void OcxFormObject::dumpFormSites( sal_uInt32 nCount )
+{
+    out().resetItemIndex();
+    for( sal_uInt32 nIdx = 0; ensureValid() && (nIdx < nCount); ++nIdx )
+    {
+        out().emptyLine();
+        writeEmptyItem( "#form-site" );
+        IndentGuard aIndGuard( out() );
+        OcxFormSiteObject( *this, mrFormData ).dump();
+    }
+}
+
+void OcxFormObject::dumpSiteData()
+{
+    if( ensureValid() )
+    {
+        out().emptyLine();
+        setAlignAnchor();
+        sal_uInt32 nSiteCount = dumpDec< sal_uInt32 >( "site-count" );
+        sal_uInt32 nSiteLength = dumpDec< sal_uInt32 >( "site-data-size" );
+        sal_Int64 nEndPos = in().tell() + nSiteLength;
+        if( ensureValid( nEndPos <= in().getLength() ) )
+        {
+            out().resetItemIndex();
+            sal_uInt32 nSiteIdx = 0;
+            while( ensureValid() && (nSiteIdx < nSiteCount) )
+            {
+                out().emptyLine();
+                writeEmptyItem( "#site-info" );
+                IndentGuard aIndGuard( out() );
+                dumpDec< sal_uInt8 >( "depth" );
+                sal_uInt8 nTypeCount = dumpHex< sal_uInt8 >( "type-count", "OCX-FORM-SITE-TYPECOUNT" );
+                if( getFlag( nTypeCount, OCX_FORM_SITECOUNTTYPE_COUNT ) )
+                {
+                    dumpDec< sal_uInt8 >( "repeated-type" );
+                    nSiteIdx += (nTypeCount & OCX_FORM_SITECOUNTTYPE_MASK);
+                }
+                else
+                {
+                    ++nSiteIdx;
+                }
+            }
+            alignInput< sal_uInt32 >();
+            dumpFormSites( nSiteCount );
+            dumpToPosition( nEndPos );
+        }
+    }
+}
+
+void OcxFormObject::dumpDesignExtender()
+{
+    if( ensureValid() && getFlag( mnFlags, OCX_FORM_HASDESIGNEXTENDER ) )
+    {
+        out().emptyLine();
+        writeEmptyItem( "design-extender" );
+        IndentGuard aIndGuard( out() );
+        OcxFormDesignExtObject( *this ).dump();
+    }
+}
+
+// ============================================================================
+
+OcxFormStorageObject::OcxFormStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
+    OleStorageObject( rParent, rxStrg, rSysPath )
+{
+    addPreferredStream( "f" );
+}
+
+void OcxFormStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+    if( rStrmName.equalsAscii( "f" ) )
+        OcxFormObject( *this, rxStrm, rSysFileName, maFormData ).dump();
+    else if( rStrmName.equalsAscii( "o" ) )
+        OcxControlsStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
+    else if( rStrmName.equalsAscii( "x" ) )
+        OcxMultiPageStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
+    else
+        OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
+}
+
+void OcxFormStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
+{
+    if( isFormStorage( rStrgPath ) )
+        OcxFormStorageObject( *this, rxStrg, rSysPath ).dump();
+    else
+        OleStorageObject( *this, rxStrg, rSysPath ).dump();
+}
+
+bool OcxFormStorageObject::isFormStorage( const OUString& rStrgPath ) const
+{
+    if( (rStrgPath.getLength() >= 3) && (rStrgPath[ 0 ] == 'i') )
+    {
+        OUString aId = rStrgPath.copy( 1 );
+        if( (aId.getLength() == 2) && (aId[ 0 ] == '0') )
+            aId = aId.copy( 1 );
+        sal_Int32 nId = aId.toInt32();
+        if( (nId > 0) && (OUString::valueOf( nId ) == aId) )
+            for( OcxFormSiteInfoVector::const_iterator aIt = maFormData.maSiteInfos.begin(), aEnd = maFormData.maSiteInfos.end(); aIt != aEnd; ++aIt )
+                if( aIt->mnId == nId )
+                    return true;
+    }
+    return false;
+}
+
+// ============================================================================
+// ============================================================================
+
+VbaSharedData::VbaSharedData() :
+    meTextEnc( osl_getThreadTextEncoding() )
+{
+}
+
+bool VbaSharedData::isModuleStream( const ::rtl::OUString& rStrmName ) const
+{
+    return maStrmOffsets.count( rStrmName ) > 0;
+}
+
+sal_Int32 VbaSharedData::getStreamOffset( const OUString& rStrmName ) const
+{
+    StreamOffsetMap::const_iterator aIt = maStrmOffsets.find( rStrmName );
+    return (aIt == maStrmOffsets.end()) ? 0 : aIt->second;
+}
+
+// ============================================================================
+
+VbaDirStreamObject::VbaDirStreamObject( const ObjectBase& rParent,
+        const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaSharedData& rVbaData ) :
+    mrVbaData( rVbaData )
+{
+    mxInStrm = rxStrm;
+    if( mxInStrm.get() )
+    {
+        BinaryInputStreamRef xVbaStrm( new ::oox::ole::VbaInputStream( *mxInStrm ) );
+        SequenceRecordObjectBase::construct( rParent, xVbaStrm, rSysFileName, "VBA-DIR-RECORD-NAMES", "VBA-DIR-SIMPLE-RECORDS" );
+    }
+}
+
+bool VbaDirStreamObject::implIsValid() const
+{
+    return mxInStrm.get() && SequenceRecordObjectBase::implIsValid();
+}
+
+bool VbaDirStreamObject::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize )
+{
+    ornRecId = rBaseStrm.readuInt16();
+    ornRecSize = rBaseStrm.readInt32();
+
+    // for no obvious reason, PROJECTVERSION record contains size field of 4, but is 6 bytes long
+    if( ornRecId == 9 )
+        ornRecSize = 6;
+
+    return !rBaseStrm.isEof();
+}
+
+void VbaDirStreamObject::implDumpRecordBody()
+{
+    switch( getRecId() )
+    {
+        case 0x0003:
+            mrVbaData.meTextEnc = ::oox::xls::BiffHelper::calcTextEncodingFromCodePage( dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" ) );
+        break;
+        case 0x0004:
+            dumpByteString( "name" );
+        break;
+        case 0x0005:
+            dumpByteString( "description" );
+        break;
+        case 0x0006:
+            dumpByteString( "helpfile-path" );
+        break;
+        case 0x0009:
+            dumpDec< sal_uInt32 >( "major" );
+            dumpDec< sal_uInt16 >( "minor" );
+        break;
+        case 0x000C:
+            dumpByteString( "constants" );
+        break;
+        case 0x000D:
+            dumpByteStringWithLength( "lib-id" );
+            dumpUnused( 6 );
+        break;
+        case 0x000E:
+            dumpByteStringWithLength( "lib-id-absolute" );
+            dumpByteStringWithLength( "lib-id-relative" );
+            dumpDec< sal_uInt32 >( "major" );
+            dumpDec< sal_uInt16 >( "minor" );
+        break;
+        case 0x0016:
+            dumpByteString( "name" );
+        break;
+        case 0x0019:
+            dumpByteString( "name" );
+            maCurrStream = OUString();
+            mnCurrOffset = 0;
+        break;
+        case 0x001A:
+            maCurrStream = dumpByteString( "stream-name" );
+        break;
+        case 0x001C:
+            dumpByteString( "description" );
+        break;
+        case 0x002B:
+            if( maCurrStream.getLength() > 0 )
+                mrVbaData.maStrmOffsets[ maCurrStream ] = mnCurrOffset;
+            maCurrStream = OUString();
+            mnCurrOffset = 0;
+        break;
+        case 0x002F:
+            dumpByteStringWithLength( "lib-id-twiddled" );
+            dumpUnused( 6 );
+        break;
+        case 0x0030:
+            dumpByteStringWithLength( "lib-id-extended" );
+            dumpUnused( 6 );
+            dumpGuid( "original-typelib" );
+            dumpDec< sal_uInt32 >( "cookie" );
+        break;
+        case 0x0031:
+            mnCurrOffset = dumpHex< sal_Int32 >( "stream-offset", "CONV-DEC" );
+        break;
+        case 0x0032:
+            dumpUniString( "stream-name" );
+        break;
+        case 0x0033:
+            dumpByteString( "lib-id-original" );
+        break;
+        case 0x003C:
+            dumpUniString( "constants" );
+        break;
+        case 0x003D:
+            dumpUniString( "helpfile-path" );
+        break;
+        case 0x003E:
+            dumpUniString( "name" );
+        break;
+        case 0x0040:
+            dumpUniString( "description" );
+        break;
+        case 0x0047:
+            dumpUniString( "name" );
+        break;
+        case 0x0048:
+            dumpUniString( "description" );
+        break;
+    }
+}
+
+OUString VbaDirStreamObject::dumpByteString( const String& rName )
+{
+    return dumpCharArray( rName, static_cast< sal_Int32 >( getRecSize() ), mrVbaData.meTextEnc );
+}
+
+OUString VbaDirStreamObject::dumpUniString( const String& rName )
+{
+    return dumpUnicodeArray( rName, static_cast< sal_Int32 >( getRecSize() / 2 ) );
+}
+
+OUString VbaDirStreamObject::dumpByteStringWithLength( const String& rName )
+{
+    return dumpCharArray( rName, in().readInt32(), mrVbaData.meTextEnc );
+}
+
+// ============================================================================
+
+VbaModuleStreamObject::VbaModuleStreamObject(
+        const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm,
+        const OUString& rSysFileName, VbaSharedData& rVbaData, sal_Int32 nStrmOffset ) :
+    mrVbaData( rVbaData ),
+    mnStrmOffset( nStrmOffset )
+{
+    InputObjectBase::construct( rParent, rxStrm, rSysFileName );
+}
+
+void VbaModuleStreamObject::implDump()
+{
+    dumpBinary( "perf-cache", mnStrmOffset );
+    out().emptyLine();
+    writeEmptyItem( "source-code" );
+    IndentGuard aIndGuard( out() );
+    BinaryInputStreamRef xVbaStrm( new ::oox::ole::VbaInputStream( in() ) );
+    TextStreamObject( *this, xVbaStrm, mrVbaData.meTextEnc ).dump();
+}
+
+// ============================================================================
+
+VbaStorageObject::VbaStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath, VbaSharedData& rVbaData ) :
+    OleStorageObject( rParent, rxStrg, rSysPath ),
+    mrVbaData( rVbaData )
+{
+    addPreferredStream( "dir" );
+}
+
+void VbaStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+    if( (rStrgPath.getLength() == 0) && rStrmName.equalsAscii( "dir" ) )
+        VbaDirStreamObject( *this, rxStrm, rSysFileName, mrVbaData ).dump();
+    else if( mrVbaData.isModuleStream( rStrmName ) )
+        VbaModuleStreamObject( *this, rxStrm, rSysFileName, mrVbaData, mrVbaData.getStreamOffset( rStrmName ) ).dump();
+    else
+        OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
+}
+
+// ============================================================================
+
+VbaFormStorageObject::VbaFormStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath, VbaSharedData& rVbaData ) :
+    OcxFormStorageObject( rParent, rxStrg, rSysPath ),
+    mrVbaData( rVbaData )
+{
+}
+
+void VbaFormStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+    if( rStrmName.equalsAscii( "\003VBFrame" ) )
+        TextStreamObject( *this, rxStrm, mrVbaData.meTextEnc, rSysFileName ).dump();
+    else
+        OcxFormStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
+}
+
+// ============================================================================
+
+VbaProjectStorageObject::VbaProjectStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
+    OleStorageObject( rParent, rxStrg, rSysPath )
+{
+    addPreferredStorage( "VBA" );
+}
+
+void VbaProjectStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+    if( (rStrgPath.getLength() == 0) && rStrmName.equalsAscii( "PROJECT" ) )
+        TextStreamObject( *this, rxStrm, maVbaData.meTextEnc, rSysFileName ).dump();
+    else
+        OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
+}
+
+void VbaProjectStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
+{
+    if( rStrgPath.equalsAscii( "VBA" ) )
+        VbaStorageObject( *this, rxStrg, rSysPath, maVbaData ).dump();
+    else
+        VbaFormStorageObject( *this, rxStrg, rSysPath, maVbaData ).dump();
+}
+
+// ============================================================================
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#endif
+
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/oledumper.ini /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/oledumper.ini
--- oox/source/dump/oledumper.ini	1970-01-01 01:00:00.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/oledumper.ini	2008-09-30 16:51:36.000000000 +0200
@@ -0,0 +1,689 @@
+﻿
+# dumper settings ============================================================
+
+# Path to additional configuration data, relative to this file.
+include-config-file=dumperbase.ini
+
+# StdFont ====================================================================
+
+{0BE35203-8F91-11CE-9DE3-00AA004BB851}=StdFont
+
+flagslist=STDFONT-FLAGS
+  0x01=bold
+  0x02=italic
+  0x04=underline
+  0x08=strikeout
+end
+
+unitconverter=STDFONT-HEIGHT,/10000,pt
+
+# StdPic =====================================================================
+
+{0BE35204-8F91-11CE-9DE3-00AA004BB851}=StdPic
+
+# StdHlink ===================================================================
+
+{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}=StdHlink
+{79EAC9E0-BAF9-11CE-8C82-00AA004BA90B}=URLMoniker
+{00000303-0000-0000-C000-000000000046}=FileMoniker
+{00000304-0000-0000-C000-000000000046}=ItemMoniker
+{00000305-0000-0000-C000-000000000046}=AntiMoniker
+{00000309-0000-0000-C000-000000000046}=CompositeMoniker
+
+flagslist=STDHLINK-FLAGS
+  0x00000001=has-target
+  0x00000002=!relative!absolute
+  0x00000004=display-specified
+  0x00000008=has-location
+  0x00000010=has-display
+  0x00000020=has-guid
+  0x00000040=has-creation-time
+  0x00000080=has-frame
+  0x00000100=!as-guid!as-string
+  0x00000200=has-abs-from-rel
+end
+
+flagslist=STDHLINK-URL-FLAGS
+  0x00000001=allow-relative
+  0x00000002=wildcard-scheme
+  0x00000004=implicit-file-scheme
+  0x00000008=no-fragment
+  0x00000010=no-canonicalize
+  0x00000020=canonicalize
+  0x00000040=dos-path
+  0x00000080=decode-extra-info
+  0x00000100=no-decode-extra-info
+  0x00000200=crack-unknown-schemes
+  0x00000400=no-crack-unknown-schemes
+  0x00000800=preprocess-html
+  0x00001000=no-preprocess-html
+  0x00002000=registry-settings
+  0x00004000=no-registry-settings
+  0x00008000=no-encode-forbidden-chars
+end
+
+# OLE name lists =============================================================
+
+{F29F85E0-4FF9-1068-AB91-08002B27B3D9}=GlobalDocProp
+{D5CDD502-2E9C-101B-9397-08002B2CF9AE}=BuiltinDocProp
+{D5CDD505-2E9C-101B-9397-08002B2CF9AE}=CustomDocProp
+
+constlist=OLEPROP-BYTE-ORDER
+  0xFEFF=big-endian
+  0xFFFE=little-endian
+end
+
+shortlist=OLEPROP-OSTYPE,0,dos,mac,win32,unix
+
+multilist=OLEPROP-BASEIDS
+  quote-names=1
+  default=
+  0=dictionary,codepage
+end
+
+multilist=OLEPROP-GLOBALIDS
+  include=OLEPROP-BASEIDS
+  2=title,subject,author,keywords,comments,template,last-author,rev-number
+  10=edit-time,last-printed,create-time,last-saved,page-count,word-count,char-count,thumbnail,appname,security
+end
+
+multilist=OLEPROP-BUILTINIDS
+  include=OLEPROP-BASEIDS
+  2=category,pres-target,byte-count,line-count,para-count,slide-count,note-count,hidden-slide-count
+  10=clips,scale-crop,heading-pairs,part-titles,manager,company,links-uptodate
+end
+
+multilist=OLEPROP-TYPE-SIMPLE
+  0=empty,null,int16,int32,float,double,currency,date,string8,dispatch
+  10=error,bool,variant,unknown,decimal,int8,uint8,uint16,uint32
+  20=int64,uint64,int,uint,void,hresult,ptr,savearray,c-array,userdef
+  30=string8,string16,,,,,record,intptr,uintptr
+  64=time-stamp,blob,stream,storage,stream-obj,storage-obj
+  70=blob-obj,clip-fmt,guid,vers-stream
+  0x0FFF=str8-blob
+end
+
+combilist=OLEPROP-TYPE
+  0x0FFF=int32,dec,base-type,OLEPROP-TYPE-SIMPLE
+  0x1000=vector
+  0x2000=array
+  0x4000=byref
+end
+
+# OCX name lists =============================================================
+
+{0713E8D2-850A-101B-AFC0-4210102A8DA7}=COMCTL.ProgCtrl.1
+
+combilist=OCX-COLOR
+  0xFF000000=uint8,dec,type,OCX-COLORTYPE
+  0x00FFFFFF=uint32,hex,value
+end
+
+constlist=OCX-COLORTYPE
+  0x00=default
+  0x01=palette
+  0x02=rgb
+  0x80=system-color
+end
+
+multilist=OCX-SYSTEMCOLOR
+  0x00=scrollbar,desktop,active-title,inactive-title,menubar,window-back,window-frame,menu-text
+  0x08=window-text,active-title-text,active-border,inactive-border,app-workspace,highlight,highlight-text,button-face
+  0x10=button-shadow,disabled-text,button-text,inactive-title-text,button-highlight,button-dark-shadow,button-light-shadow,tooltip-text
+  0x18=tooltip-back
+end
+
+combilist=OCX-STRINGLEN
+  0x80000000=!unicode!compressed
+  0x7FFFFFFF=int32,dec,buffer-size
+end
+
+combilist=OCX-ARRAYSTRINGLEN
+  0x80000000=!unicode!compressed
+  0x7FFFFFFF=int32,dec,len
+end
+
+combilist=OCX-FLAGS
+  0x00000001=reserved-1
+  0x00000002=enabled
+  0x00000004=locked
+  0x00000008=opaque
+  0x00000010=reserved-2
+  0x00000400=column-heads
+  0x00000800=entire-rows
+  0x00001000=existing-entries-only
+  0x00002000=caption-left
+  0x00004000=editable
+  0x00078000=uint8,dec,ime-mode,OCX-IMEMODE
+  0x00080000=drag-enabled
+  0x00100000=enter-as-newline
+  0x00200000=keep-selection
+  0x00400000=tab-as-character
+  0x00800000=word-wrap
+  0x02000000=borders-suppressed
+  0x04000000=select-line
+  0x08000000=single-char-select
+  0x10000000=auto-size
+  0x20000000=hide-selection
+  0x40000000=maxlength-autotab
+  0x80000000=multi-line
+end
+
+multilist=OCX-IMEMODE
+  0=no-control,on,off,disabled
+  4=hiragana,fillwidth-katakana,halfwidth-katakana
+  7=fullwidth-alpha,halfwidth-alpha
+  9=fullwidth-hangul,halfwidth-hangul
+  11=fullwidth-hanzi,halfwidth-hanzi
+end
+
+multilist=OCX-MOUSEPTR
+  0=default,arrow,cross,i-beam
+  6=size-diag-down,size-vert,size-diag-up,size-hor
+  10=up-arrow,hour-glass,no-drop,app-starting,help,size-all
+  99=custom
+end
+
+combilist=OCX-IMAGEPOS
+  0x0000FFFF=uint16,dec,image,OCX-POS
+  0xFFFF0000=uint16,dec,label,OCX-POS
+end
+
+unitconverter=OCX-CONV-MS,1,ms
+
+shortlist=OCX-ENABLED,0,disabled,enabled
+shortlist=OCX-BORDERSTYLE,0,none,single
+shortlist=OCX-SPECIALEFFECT,0,flat,raised,sunken,etched,,,bump
+shortlist=OCX-ORIENTATION,-1,auto,vertical,horizontal
+shortlist=OCX-POS,0,top-left,top,top-right,left,center,right,bottom-left,bottom,bottom-right
+shortlist=OCX-IMAGEALIGN,0,lop-left,top-right,center,bottom-left,bottom-right
+shortlist=OCX-IMAGESIZEMODE,0,clip,stretch,,stretch-ratio
+
+# CFontNew -------------------------------------------------------------------
+
+{AFC20920-DA4E-11CE-B94300AA006887B4}=CFontNew
+
+flagslist=OCX-CFONTNEW-PROPERTIES
+  0x0001=font-name
+  0x0002=flags
+  0x0004=font-size
+  0x0008=font-offset
+  0x0010=charset
+  0x0020=pitch-family
+  0x0040=alignment
+  0x0080=font-weight
+end
+
+flagslist=OCX-CFONTNEW-FLAGS
+  0x0001=bold
+  0x0002=italic
+  0x0004=underline
+  0x0008=strikeout
+  0x2000=sunken
+end
+
+shortlist=OCX-CFONTNEW-ALIGNMENT,1,left,right,center
+
+# column info ----------------------------------------------------------------
+
+flagslist=OCX-COLUMNINFO-PROPERTIES
+  0x00000001=column-width
+end
+
+# command button -------------------------------------------------------------
+
+{D7053240-CE69-11CD-A777-00DD01143C57}=Forms.CommandButton.1
+
+flagslist=OCX-COMMANDBUTTON-PROPERTIES
+  0x00000001=text-color
+  0x00000002=fill-color
+  0x00000004=flags
+  0x00000008=caption
+  0x00000010=image-pos
+  0x00000020=size
+  0x00000040=mouse-ptr
+  0x00000080=image
+  0x00000100=accelerator
+  0x00000200=no-take-focus
+  0x00000400=mouse-icon
+end
+
+# toggle button, check box, option button, text box, list box, combo box -----
+
+{8BD21D10-EC42-11CE-9E0D-00AA006002F3}=Forms.TextBox.1
+{8BD21D20-EC42-11CE-9E0D-00AA006002F3}=Forms.ListBox.1
+{8BD21D30-EC42-11CE-9E0D-00AA006002F3}=Forms.ComboBox.1
+{8BD21D40-EC42-11CE-9E0D-00AA006002F3}=Forms.CheckBox.1
+{8BD21D50-EC42-11CE-9E0D-00AA006002F3}=Forms.OptionButton.1
+{8BD21D60-EC42-11CE-9E0D-00AA006002F3}=Forms.ToggleButton.1
+{00024512-0000-0000-C000-000000000046}=RefEdit.Ctrl
+
+flagslist=OCX-MORPH-PROPERTIES
+  0x0000000000000001=flags
+  0x0000000000000002=fill-color
+  0x0000000000000004=text-color
+  0x0000000000000008=max-length
+  0x0000000000000010=border-style
+  0x0000000000000020=scrollbars
+  0x0000000000000040=control-type
+  0x0000000000000080=mouse-ptr
+  0x0000000000000100=size
+  0x0000000000000200=password-char
+  0x0000000000000400=list-width
+  0x0000000000000800=bound-column
+  0x0000000000001000=text-column
+  0x0000000000002000=column-count
+  0x0000000000004000=list-rowcount
+  0x0000000000008000=column-info-count
+  0x0000000000010000=match-entry-mode
+  0x0000000000020000=list-style
+  0x0000000000040000=show-dropdown-mode
+  0x0000000000100000=dropdown-style
+  0x0000000000200000=selection-type
+  0x0000000000400000=value
+  0x0000000000800000=caption
+  0x0000000001000000=image-pos
+  0x0000000002000000=border-color
+  0x0000000004000000=special-effect
+  0x0000000008000000=mouse-icon
+  0x0000000010000000=image
+  0x0000000020000000=accelerator
+  0x0000000080000000=reserved
+  0x0000000100000000=groupname
+end
+
+shortlist=OCX-MORPH-SCROLLBARS,0,none,horizontal,vertical,both
+shortlist=OCX-MORPH-CONTROLTYPE,1,edit,listbox,combobox,checkbox,optionbutton,togglebutton,dropdown-listbox
+shortlist=OCX-MORPH-MATCHENTRYTYPE,0,first-letter,complete,none
+shortlist=OCX-MORPH-LISTSTYLE,0,plain,with-buttons
+shortlist=OCX-MORPH-SHOWDROPDOWNMODE,0,never,on-focus,always
+shortlist=OCX-MORPH-DROPDOWNSTYLE,0,no-symbol,arrow,ellipsis,underline
+shortlist=OCX-MORPH-SELECTIONTYPE,0,single,multi,range
+
+constlist=OCX-MORPH-BOUNDCOLUMN
+  default=
+  0=value-is-row-index
+end
+
+constlist=OCX-MORPH-TEXTCOLUMN
+  default=
+  -1=first-column-with-width
+  0=row-numbers
+end
+
+constlist=OCX-MORPH-COLUMNCOUNT
+  default=
+  -1=all-columns
+end
+
+# label ----------------------------------------------------------------------
+
+{978C9E23-D4B0-11CE-BF2D-00AA003F40D0}=Forms.Label.1
+
+flagslist=OCX-LABEL-PROPERTIES
+  0x00000001=text-color
+  0x00000002=fill-color
+  0x00000004=flags
+  0x00000008=caption
+  0x00000010=image-pos
+  0x00000020=size
+  0x00000040=mouse-ptr
+  0x00000080=border-color
+  0x00000100=border-style
+  0x00000200=special-effect
+  0x00000400=image
+  0x00000800=accelerator
+  0x00001000=mouse-icon
+end
+
+# image ----------------------------------------------------------------------
+
+{4C599241-6926-101B-9992-00000B65C6F9}=Forms.Image.1
+
+flagslist=OCX-IMAGE-PROPERTIES
+  0x00000004=auto-size
+  0x00000008=border-color
+  0x00000010=fill-color
+  0x00000020=border-style
+  0x00000040=mouse-ptr
+  0x00000080=image-size-mode
+  0x00000100=special-effect
+  0x00000200=size
+  0x00000400=image
+  0x00000800=image-align
+  0x00001000=image-tiling
+  0x00002000=flags
+  0x00004000=mouse-icon
+end
+
+# scroll bar -----------------------------------------------------------------
+
+{DFD181E0-5E2F-11CE-A449-00AA004A803D}=Forms.ScrollBar.1
+
+flagslist=OCX-SCROLLBAR-PROPERTIES
+  0x00000001=arrow-color
+  0x00000002=fill-color
+  0x00000004=flags
+  0x00000008=size
+  0x00000010=mouse-ptr
+  0x00000020=min
+  0x00000040=max
+  0x00000080=value
+  0x00000100=unused
+  0x00000200=prev-enabled
+  0x00000400=next-enabled
+  0x00000800=step
+  0x00001000=page-step
+  0x00002000=orientation
+  0x00004000=prop-thumb
+  0x00008000=delay
+  0x00010000=mouse-icon
+end
+
+shortlist=OCX-SCROLLBAR-PROPTHUMB,-1,proportional,fixed
+
+# spin button ----------------------------------------------------------------
+
+{79176FB0-B7F2-11CE-97EF-00AA006D2776}=Forms.SpinButton.1
+
+flagslist=OCX-SPINBUTTON-PROPERTIES
+  0x00000001=arrow-color
+  0x00000002=fill-color
+  0x00000004=flags
+  0x00000008=size
+  0x00000010=unused
+  0x00000020=min
+  0x00000040=max
+  0x00000080=value
+  0x00000100=prev-enabled
+  0x00000200=next-enabled
+  0x00000400=step
+  0x00000800=orientation
+  0x00001000=delay
+  0x00002000=mouse-icon
+  0x00004000=mouse-ptr
+end
+
+# tab strip ------------------------------------------------------------------
+
+{EAE50EB0-4A62-11CE-BED6-00AA00611080}=Forms.TabStrip.1
+
+flagslist=OCX-TABSTRIP-PROPERTIES
+  0x00000001=selected-tab
+  0x00000002=fill-color
+  0x00000004=text-color
+  0x00000010=size
+  0x00000020=tab-captions
+  0x00000040=mouse-ptr
+  0x00000100=tab-orientation
+  0x00000200=tab-style
+  0x00000400=multi-row
+  0x00000800=tab-fixed-width
+  0x00001000=tab-fixed-height
+  0x00002000=tooltips
+  0x00008000=tooltip-strings
+  0x00020000=tab-names
+  0x00040000=flags
+  0x00080000=new-version
+  0x00100000=tabs-allocated
+  0x00200000=tags
+  0x00400000=tab-flag-count
+  0x00800000=accelerators
+  0x01000000=mouse-icon
+end
+
+shortlist=OCX-TABSTRIP-ORIENTATION,0,top,bottom,left,right
+shortlist=OCX-TABSTRIP-TABSTYLE,0,tabs,buttons,none
+
+flagslist=OCX-TABSTRIP-FLAGS
+  0x00000001=visible
+  0x00000002=enabled
+end
+
+# frame ----------------------------------------------------------------------
+
+{6E182020-F460-11CE-9BCD-00AA00608E01}=Forms.Frame.1
+
+# page -----------------------------------------------------------------------
+
+flagslist=OCX-PAGE-PROPERTIES
+  0x00000002=transition-effect
+  0x00000004=transition-period
+end
+
+shortlist=OCX-PAGE-TRANSITIONEFFECT,0,none,cover-up,cover-right-up,cover-right,cover-right-down,cover-down,cover-left-down,cover-left,cover-left-up,push-up,push-right,push-down,push-left
+
+# multi page -----------------------------------------------------------------
+
+{46E31370-3F7A-11CE-BED6-00AA00611080}=Forms.MultiPage.1
+
+flagslist=OCX-MULTIPAGE-PROPERTIES
+  0x00000002=page-count
+  0x00000004=id
+  0x00000008=enabled
+end
+
+# form class info ------------------------------------------------------------
+
+flagslist=OCX-CLASSINFO-PROPERTIES
+  0x00000001=class-id
+  0x00000002=disp-event
+  0x00000008=default-prog
+  0x00000010=class-flags
+  0x00000020=method-count
+  0x00000040=dispatch-id-bind
+  0x00000080=get-bind-index
+  0x00000100=put-bind-index
+  0x00000200=bind-type
+  0x00000400=get-value-index
+  0x00000800=put-value-index
+  0x00001000=value-type
+  0x00002000=dispatch-id-rowset
+  0x00004000=set-rowset
+end
+
+combilist=OCX-CLASSINFO-FLAGS
+  0x0000FFFF=uint16,hex,classtable-flags,OCX-CLASSTABLE-CLASSFLAGS
+  0xFFFF0000=uint16,hex,var-flags,OCX-CLASSTABLE-VARFLAGS
+end
+
+flagslist=OCX-CLASSTABLE-CLASSFLAGS
+  0x0001=exclusive-value
+  0x0002=dual-interface
+  0x0004=no-aggregation
+end
+
+flagslist=OCX-CLASSTABLE-VARFLAGS
+  0x0001=read-only
+  0x0002=source
+  0x0004=bindable
+  0x0008=request-edit
+  0x0010=display-bind
+  0x0020=default-bind
+  0x0040=hidden
+  0x0080=restricted
+  0x0100=default-coll-elem
+  0x0200=ui-default
+  0x0400=non-browsable
+  0x0800=replaceable
+  0x1000=immediate-bind
+end
+
+# form site ------------------------------------------------------------------
+
+flagslist=OCX-FORMSITE-PROPERTIES
+  0x00000001=name
+  0x00000002=tag
+  0x00000004=id
+  0x00000008=help-context-id
+  0x00000010=flags
+  0x00000020=stream-size
+  0x00000040=tab-index
+  0x00000080=class-id-cache-index
+  0x00000100=pos
+  0x00000200=group-id
+  0x00000800=tool-tip
+  0x00001000=licence-key
+  0x00002000=control-source
+  0x00004000=row-source
+end
+
+flagslist=OCX-FORMSITE-FLAGS
+  0x00000001=tabstop
+  0x00000002=visible
+  0x00000004=default
+  0x00000008=cancel
+  0x00000010=!storage!obj-stream
+  0x00000020=auto-size
+  0x00000100=preserve-height
+  0x00000200=fit-to-parent
+  0x00002000=select-child
+  0x00040000=container
+end
+
+combilist=OCX-FORMSITE-CLASSIDCACHE
+  0x7FFF=uint16,dec,cache-idx,OCX-FORMSITE-CLASSIDCACHEINDEX
+  0x8000=!predefined-class-id!class-table-index
+end
+
+constlist=OCX-FORMSITE-CLASSIDCACHEINDEX
+  default=
+  0x7FFF=invalid
+end
+
+constlist=OCX-FORMSITE-CLASSNAMES
+  7=Forms.Form.1
+  12=Forms.Image.1
+  14=Forms.Frame.1
+  15=Internal.MorphData
+  16=Forms.SpinButton.1
+  17=Forms.CommandButton.1
+  18=Forms.TabStrip.1
+  21=Forms.Label.1
+  23=Forms.TextBox.1
+  24=Forms.ListBox.1
+  25=Forms.ComboBox.1
+  26=Forms.CheckBox.1
+  27=Forms.OptionButton.1
+  28=Forms.ToggleButton.1
+  47=Forms.ScrollBar.1
+  57=Forms.MultiPage.1
+end
+
+# form design extender  ------------------------------------------------------
+
+flagslist=OCX-FORMDESIGNEXT-PROPERTIES
+  0x00000001=flags
+  0x00000002=grid-x
+  0x00000004=grid-y
+  0x00000008=click-control-mode
+  0x00000010=dblclick-control-mode
+end
+
+flagslist=OCX-FORMDESIGNEXT-FLAGS
+  0x00000001=inherit-design-mode
+  0x00000002=design-mode
+  0x00000004=inherit-show-toolbox
+  0x00000008=show-toolbox
+  0x00000010=inherit-show-grid
+  0x00000020=show-grid
+  0x00000040=inherit-snap-to-grid
+  0x00000080=snap-to-grid
+  0x00000100=inherit-grid-x
+  0x00000200=inherit-grid-y
+  0x00000400=inherit-click-control-mode
+  0x00000800=inherit-dblclick-control-mode
+  0x00001000=inherit-show-invisible
+  0x00002000=show-invisible
+  0x00004000=inherit-show-tooltips
+  0x00008000=show-tooltips
+  0x00010000=inherit-immediate-layout
+  0x00020000=immediate-layout
+end
+
+shortlist=OCX-FORMDESIGNEXT-CLICKCTRLMODE,-2,inherit,default,insertion-point,select-then-insert
+shortlist=OCX-FORMDESIGNEXT-DBLCLICKCTRLMODE,-2,inherit,,select-text,edit-code,edit-properties
+
+# form -----------------------------------------------------------------------
+
+{C62A69F0-16DC-11CE-9E98-00AA00574A4F}=Forms.Form.1
+
+flagslist=OCX-FORM-PROPERTIES
+  0x00000002=fill-color
+  0x00000004=text-color
+  0x00000008=next-available-id
+  0x00000040=flags
+  0x00000080=border-style
+  0x00000100=mouse-ptr
+  0x00000200=scrollbars
+  0x00000400=display-size
+  0x00000800=logical-size
+  0x00001000=scroll-pos
+  0x00002000=group-count
+  0x00008000=mouse-icon
+  0x00010000=cycle
+  0x00020000=special-effect
+  0x00040000=border-color
+  0x00080000=caption
+  0x00100000=font
+  0x00200000=image
+  0x00400000=zoom
+  0x00800000=image-align
+  0x01000000=image-tiling
+  0x02000000=image-sizemode
+  0x04000000=shape-cookie
+  0x08000000=draw-buffer
+end
+
+flagslist=OCX-FORM-FLAGS
+  0x00000004=enabled
+  0x00004000=has-design-extender
+  0x00008000=!has-class-table!skip-class-table
+end
+
+flagslist=OCX-FORM-SCROLLBARS
+  0x01=horizontal
+  0x02=vertical
+  0x04=keep-horizontal
+  0x08=keep-vertical
+  0x10=vertical-left
+end
+
+shortlist=OCX-FORM-CYCLE,0,all-forms,,current-form
+
+combilist=OCX-FORM-SITE-TYPECOUNT
+  0x7F=uint8,dec,type-count
+  0x80=!type!count
+end
+
+# VBA name lists =============================================================
+
+multilist=VBA-DIR-RECORD-NAMES
+  0x0000=,PROJECTSYSKIND,PROJECTLCID,PROJECTCODEPAGE,PROJECTNAME,PROJECTDOCSTRING,PROJECTHELPFILEPATH,PROJECTHELPCONTEXT
+  0x0008=PROJECTLIBFLAGS,PROJECTVERSION,,,PROJECTCONSTANTS,REFERENCEREGISTERED,REFERENCEPROJECT,PROJECTMODULES
+  0x0010=PROJECTEND,,,PROJECTCOOKIE,PROJECTLCIDINVOKE,,REFERENCENAME,
+  0x0018=,MODULENAME,MODULESTREAMNAME,,MODULEDOCSTRING,,MODULEHELPCONTEXT,
+  0x0020=,PROCEDURALMODULE,DOCUMENTMODULE,,,MODULEREADONLY,,
+  0x0028=MODULEPRIVATE,,,MODULEEND,MODULECOOKIE,,,REFERENCECONTROL
+  0x0030=REFERENCEEXTENDED,MODULEOFFSET,MODULESTREAMNAMEUNICODE,REFERENCEORIGINAL,,,,
+  0x0038=,,,,PROJECTCONSTANTSUNICODE,PROJECTHELPFILEPATHUNICODE,REFERENCENAMEUNICODE,
+  0x0040=PROJECTDOCSTRINGUNICODE,,,,,,,MODULENAMEUNICODE
+  0x0048=MODULEDOCSTRINGUNICODE,,,,,,,
+end
+
+constlist=VBA-DIR-SIMPLE-RECORDS
+  0x0001=uint32,dec,platform,VBA-DIR-PROJECTSYSKIND-PLATFORM
+  0x0002=uint32,hex,lang-id
+  0x0007=uint32,dec,help-context-id
+  0x0008=uint32,hex,libflags
+  0x000F=uint16,dec,module-count
+  0x0013=int16,dec,cookie
+  0x0014=uint32,hex,lang-id
+  0x001E=uint32,dec,help-context-id
+  0x002C=int16,dec,cookie
+end
+
+shortlist=VBA-DIR-PROJECTSYSKIND-PLATFORM,0,16-bit-windows,32-bit-windows,macintosh
+
+# ============================================================================
+
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/olestoragedumperconfig.dat /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/olestoragedumperconfig.dat
--- oox/source/dump/olestoragedumperconfig.dat	2008-03-05 19:41:24.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/olestoragedumperconfig.dat	1970-01-01 01:00:00.000000000 +0100
@@ -1,56 +0,0 @@
-﻿
-# dumper settings ============================================================
-
-# Path to additional configuration data, relative to this file.
-include-config-file=dumperconfig.dat
-
-# name lists =================================================================
-
-F29F85E0-4FF9-1068-AB91-08002B27B3D9=GlobalDocProp
-D5CDD502-2E9C-101B-9397-08002B2CF9AE=BuiltinDocProp
-D5CDD505-2E9C-101B-9397-08002B2CF9AE=CustomDocProp
-
-constlist=OLEPROP-BYTE-ORDER
-  0xFEFF=big-endian
-  0xFFFE=little-endian
-end
-
-shortlist=OLEPROP-OSTYPE,0,dos,mac,win32,unix
-
-multilist=OLEPROP-BASEIDS
-  quote-names=1
-  default=
-  0=dictionary,codepage
-end
-
-multilist=OLEPROP-GLOBALIDS
-  include=OLEPROP-BASEIDS
-  2=title,subject,author,keywords,comments,template,last-author,rev-number
-  10=edit-time,last-printed,create-time,last-saved,page-count,word-count,char-count,thumbnail,appname,security
-end
-
-multilist=OLEPROP-BUILTINIDS
-  include=OLEPROP-BASEIDS
-  2=category,pres-target,byte-count,line-count,para-count,slide-count,note-count,hidden-slide-count
-  10=clips,scale-crop,heading-pairs,part-titles,manager,company,links-uptodate
-end
-
-multilist=OLEPROP-TYPE-SIMPLE
-  0=empty,null,int16,int32,float,double,fixed,date,string8,dispatch
-  10=error,bool,variant,unknown,decimal,int8,uint8,uint16,uint32
-  20=int64,uint64,int,uint,void,hresult,ptr,savearray,c-array,userdef
-  30=string8,string16
-  64=time-stamp,blob,stream,storage,stream-obj,storage-obj
-  70=blob-obj,clip-fmt,guid,vers-stream
-  0x0FFF=str8-blob
-end
-
-combilist=OLEPROP-TYPE
-  0x0FFF=int32,dec,base-type,OLEPROP-TYPE-SIMPLE
-  0x1000=vector
-  0x2000=array
-  0x4000=byref
-end
-
-# ============================================================================
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/olestoragedumper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/olestoragedumper.cxx
--- oox/source/dump/olestoragedumper.cxx	2008-04-10 17:39:43.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/olestoragedumper.cxx	1970-01-01 01:00:00.000000000 +0100
@@ -1,444 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: olestoragedumper.cxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "oox/dump/olestoragedumper.hxx"
-#include <osl/thread.h>
-#include <osl/file.hxx>
-#include <rtl/tencinfo.h>
-#include <com/sun/star/util/DateTime.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include "oox/helper/binaryoutputstream.hxx"
-#include "oox/core/filterbase.hxx"
-
-#if OOX_INCLUDE_DUMPER
-
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::rtl::OString;
-using ::rtl::OStringToOUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::util::DateTime;
-using ::com::sun::star::io::XInputStream;
-using ::com::sun::star::io::XOutputStream;
-
-namespace oox {
-namespace dump {
-
-// ============================================================================
-
-namespace {
-
-const sal_Int32 OLEPROP_ID_DICTIONARY   = 0;
-const sal_Int32 OLEPROP_ID_CODEPAGE     = 1;
-
-const sal_Int32 OLEPROP_TYPE_INT16      = 2;
-const sal_Int32 OLEPROP_TYPE_INT32      = 3;
-const sal_Int32 OLEPROP_TYPE_FLOAT      = 4;
-const sal_Int32 OLEPROP_TYPE_DOUBLE     = 5;
-const sal_Int32 OLEPROP_TYPE_DATE       = 7;
-const sal_Int32 OLEPROP_TYPE_STRING     = 8;
-const sal_Int32 OLEPROP_TYPE_STATUS     = 10;
-const sal_Int32 OLEPROP_TYPE_BOOL       = 11;
-const sal_Int32 OLEPROP_TYPE_VARIANT    = 12;
-const sal_Int32 OLEPROP_TYPE_INT8       = 16;
-const sal_Int32 OLEPROP_TYPE_UINT8      = 17;
-const sal_Int32 OLEPROP_TYPE_UINT16     = 18;
-const sal_Int32 OLEPROP_TYPE_UINT32     = 19;
-const sal_Int32 OLEPROP_TYPE_INT64      = 20;
-const sal_Int32 OLEPROP_TYPE_UINT64     = 21;
-const sal_Int32 OLEPROP_TYPE_STRING8    = 30;
-const sal_Int32 OLEPROP_TYPE_STRING16   = 31;
-const sal_Int32 OLEPROP_TYPE_FILETIME   = 64;
-const sal_Int32 OLEPROP_TYPE_BLOB       = 65;
-const sal_Int32 OLEPROP_TYPE_STREAM     = 66;
-const sal_Int32 OLEPROP_TYPE_STORAGE    = 67;
-const sal_Int32 OLEPROP_TYPE_CLIPFMT    = 71;
-
-const sal_uInt16 CODEPAGE_UNICODE       = 1200;
-
-} // namespace
-
-// ============================================================================
-
-OlePropertyStreamObject::OlePropertyStreamObject( const ObjectBase& rParent, const OUString& rOutFileName, BinaryInputStreamRef xStrm ) :
-    InputStreamObject( rParent, rOutFileName, xStrm )
-{
-}
-
-void OlePropertyStreamObject::implDump()
-{
-    Input& rIn = in();
-    Output& rOut = out();
-
-    OUStringVector aGuidVec;
-    ::std::vector< sal_uInt32 > aStartPosVec;
-
-    // dump header
-    writeEmptyItem( "HEADER" );
-    {
-        IndentGuard aIndGuard( rOut );
-        dumpHex< sal_uInt16 >( "byte-order", "OLEPROP-BYTE-ORDER" );
-        dumpDec< sal_uInt16 >( "version" );
-        dumpDec< sal_uInt16 >( "os-minor" );
-        dumpDec< sal_uInt16 >( "os-type", "OLEPROP-OSTYPE" );
-        dumpGuid( "guid" );
-        sal_Int32 nSectCount = dumpDec< sal_Int32 >( "section-count" );
-
-        // dump table of section positions
-        {
-            TableGuard aTabGuard( rOut, 15, 60 );
-            rOut.resetItemIndex();
-            for( sal_Int32 nSectIdx = 0; (nSectIdx < nSectCount) && rIn.isValidPos(); ++nSectIdx )
-            {
-                MultiItemsGuard aMultiGuard( rOut );
-                writeEmptyItem( "#section" );
-                aGuidVec.push_back( dumpGuid( "guid" ) );
-                aStartPosVec.push_back( dumpHex< sal_uInt32 >( "start-pos" ) );
-            }
-        }
-    }
-    rOut.emptyLine();
-
-    // dump sections
-    for( size_t nSectIdx = 0; (nSectIdx < aStartPosVec.size()) && rIn.isValidPos(); ++nSectIdx )
-        dumpSection( aGuidVec[ nSectIdx ], aStartPosVec[ nSectIdx ] );
-}
-
-void OlePropertyStreamObject::dumpSection( const OUString& rGuid, sal_uInt32 nStartPos )
-{
-    Input& rIn = in();
-    Output& rOut = out();
-
-    // property ID names
-    mxPropIds = cfg().createNameList< ConstList >( "OLEPROP-IDS" );
-    OUString aGuidName = cfg().getStringOption( rGuid, OUString() );
-    if( aGuidName.equalsAscii( "GlobalDocProp" ) )
-        mxPropIds->includeList( cfg().getNameList( "OLEPROP-GLOBALIDS" ) );
-    else if( aGuidName.equalsAscii( "BuiltinDocProp" ) )
-        mxPropIds->includeList( cfg().getNameList( "OLEPROP-BUILTINIDS" ) );
-    else
-        mxPropIds->includeList( cfg().getNameList( "OLEPROP-BASEIDS" ) );
-
-    // property ID/position map
-    typedef ::std::map< sal_Int32, sal_uInt32 > PropertyPosMap;
-    PropertyPosMap aPropMap;
-
-    // dump section header line
-    writeSectionHeader( rGuid, nStartPos );
-
-    // seek to section
-    IndentGuard aIndGuard( rOut );
-    if( startElement( nStartPos ) )
-    {
-        // dump section header
-        dumpDec< sal_Int32 >( "size" );
-        sal_Int32 nPropCount = dumpDec< sal_Int32 >( "property-count" );
-
-        // dump table of property positions
-        {
-            TableGuard aTabGuard( rOut, 15, 25 );
-            rOut.resetItemIndex();
-            for( sal_Int32 nPropIdx = 0; (nPropIdx < nPropCount) && rIn.isValidPos(); ++nPropIdx )
-            {
-                MultiItemsGuard aMultiGuard( rOut );
-                writeEmptyItem( "#property" );
-                sal_Int32 nPropId = dumpDec< sal_Int32 >( "id", mxPropIds );
-                sal_uInt32 nPropPos = nStartPos + dumpHex< sal_uInt32 >( "start-pos" );
-                aPropMap[ nPropId ] = nPropPos;
-            }
-        }
-    }
-    rOut.emptyLine();
-
-    // code page property
-    meTextEnc = osl_getThreadTextEncoding();
-    mbIsUnicode = false;
-    PropertyPosMap::iterator aCodePageIt = aPropMap.find( OLEPROP_ID_CODEPAGE );
-    if( aCodePageIt != aPropMap.end() )
-    {
-        dumpCodePageProperty( aCodePageIt->second );
-        aPropMap.erase( aCodePageIt );
-    }
-
-    // dictionary property
-    PropertyPosMap::iterator aDictIt = aPropMap.find( OLEPROP_ID_DICTIONARY );
-    if( aDictIt != aPropMap.end() )
-    {
-        dumpDictionaryProperty( aDictIt->second );
-        aPropMap.erase( aDictIt );
-    }
-
-    // other properties
-    for( PropertyPosMap::const_iterator aIt = aPropMap.begin(), aEnd = aPropMap.end(); aIt != aEnd; ++aIt )
-        dumpProperty( aIt->first, aIt->second );
-
-    // remove the user defined list of property ID names
-    cfg().eraseNameList( "OLEPROP-IDS" );
-}
-
-void OlePropertyStreamObject::dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos )
-{
-    writePropertyHeader( nPropId, nStartPos );
-    IndentGuard aIndGuard( out() );
-    if( startElement( nStartPos ) )
-        dumpPropertyContents( nPropId );
-    out().emptyLine();
-}
-
-void OlePropertyStreamObject::dumpCodePageProperty( sal_uInt32 nStartPos )
-{
-    writePropertyHeader( OLEPROP_ID_CODEPAGE, nStartPos );
-    IndentGuard aIndGuard( out() );
-    if( startElement( nStartPos ) )
-    {
-        sal_Int32 nType = dumpPropertyType();
-        if( nType == OLEPROP_TYPE_INT16 )
-        {
-            sal_uInt16 nCodePage = dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" );
-            rtl_TextEncoding nNewTextEnc = rtl_getTextEncodingFromWindowsCodePage( nCodePage );
-            if( nNewTextEnc != RTL_TEXTENCODING_DONTKNOW )
-                meTextEnc = nNewTextEnc;
-            mbIsUnicode = nCodePage == CODEPAGE_UNICODE;
-        }
-        else
-            dumpPropertyContents( OLEPROP_ID_CODEPAGE );
-    }
-    out().emptyLine();
-}
-
-void OlePropertyStreamObject::dumpDictionaryProperty( sal_uInt32 nStartPos )
-{
-    writePropertyHeader( OLEPROP_ID_DICTIONARY, nStartPos );
-    IndentGuard aIndGuard( out() );
-    if( startElement( nStartPos ) )
-    {
-        sal_Int32 nCount = dumpDec< sal_Int32 >( "count" );
-        for( sal_Int32 nIdx = 0; (nIdx < nCount) && in().isValidPos(); ++nIdx )
-        {
-            MultiItemsGuard aMultiGuard( out() );
-            TableGuard aTabGuard( out(), 10, 20 );
-            sal_Int32 nId = dumpDec< sal_Int32 >( "id" );
-            OUString aName = dumpString8( "name" );
-            if( mxPropIds.get() )
-                mxPropIds->setName( nId, aName );
-        }
-    }
-    out().emptyLine();
-}
-
-void OlePropertyStreamObject::dumpPropertyContents( sal_Int32 nPropId )
-{
-    sal_Int32 nType = dumpPropertyType();
-    if( getFlag< sal_Int32 >( nType, 0x1000 ) ) // vector
-    {
-        sal_Int32 nBaseType = nType & 0x0FFF;
-        sal_Int32 nElemCount = dumpDec< sal_Int32 >( "element-count" );
-        for( sal_Int32 nElemIdx = 0; (nElemIdx < nElemCount) && in().isValidPos(); ++nElemIdx )
-        {
-            out().resetItemIndex( nElemIdx );
-            writeEmptyItem( "#element" );
-            IndentGuard aIndGuard( out() );
-            dumpPropertyValue( nPropId, nBaseType );
-        }
-    }
-    else if( !getFlag< sal_Int32 >( nType, 0x7000 ) )
-    {
-        dumpPropertyValue( nPropId, nType );
-    }
-}
-
-void OlePropertyStreamObject::dumpPropertyValue( sal_Int32 nPropId, sal_Int32 nBaseType )
-{
-    switch( nBaseType )
-    {
-        case OLEPROP_TYPE_INT16:        dumpDec< sal_Int16 >( "value" );        break;
-        case OLEPROP_TYPE_INT32:        dumpDec< sal_Int32 >( "value" );        break;
-        case OLEPROP_TYPE_FLOAT:        dumpDec< float >( "value" );            break;
-        case OLEPROP_TYPE_DOUBLE:       dumpDec< double >( "value" );           break;
-        case OLEPROP_TYPE_DATE:         dumpDec< double >( "date" );            break;
-        case OLEPROP_TYPE_STRING:       dumpString8( "value" );                 break;
-        case OLEPROP_TYPE_STATUS:       dumpHex< sal_Int32 >( "status" );       break;
-        case OLEPROP_TYPE_BOOL:         dumpBool< sal_Int16 >( "value" );       break;
-        case OLEPROP_TYPE_VARIANT:      dumpPropertyContents( nPropId );        break;
-        case OLEPROP_TYPE_INT8:         dumpDec< sal_Int8 >( "value" );         break;
-        case OLEPROP_TYPE_UINT8:        dumpDec< sal_uInt8 >( "value" );        break;
-        case OLEPROP_TYPE_UINT16:       dumpDec< sal_uInt16 >( "value" );       break;
-        case OLEPROP_TYPE_UINT32:       dumpDec< sal_uInt32 >( "value" );       break;
-        case OLEPROP_TYPE_INT64:        dumpDec< sal_Int64 >( "value" );        break;
-        case OLEPROP_TYPE_UINT64:       dumpDec< sal_uInt64 >( "value" );       break;
-        case OLEPROP_TYPE_STRING8:      dumpString8( "value" );                 break;
-        case OLEPROP_TYPE_STRING16:     dumpString16( "value" );                break;
-        case OLEPROP_TYPE_FILETIME:     dumpFileTime( "file-time" );            break;
-        case OLEPROP_TYPE_BLOB:         dumpBlob( "data" );                     break;
-        case OLEPROP_TYPE_STREAM:       dumpString8( "stream-name" );           break;
-        case OLEPROP_TYPE_STORAGE:      dumpString8( "storage-name" );          break;
-        case OLEPROP_TYPE_CLIPFMT:      dumpBlob( "clip-data" );                break;
-    }
-}
-
-sal_Int32 OlePropertyStreamObject::dumpPropertyType()
-{
-    return dumpHex< sal_Int32 >( "type", "OLEPROP-TYPE" );
-}
-
-void OlePropertyStreamObject::dumpBlob( const sal_Char* pcName )
-{
-    sal_Int32 nSize = dumpDec< sal_Int32 >( "data-size" );
-    if( nSize > 0 )
-        dumpBinary( pcName, nSize );
-}
-
-OUString OlePropertyStreamObject::dumpString8( const sal_Char* pcName )
-{
-    sal_Int32 nLen = dumpDec< sal_Int32 >( "string-len" );
-    return mbIsUnicode ? dumpCharArray16( pcName, nLen ) : dumpCharArray8( pcName, nLen );
-}
-
-OUString OlePropertyStreamObject::dumpCharArray8( const sal_Char* pcName, sal_Int32 nCharCount )
-{
-    OUString aData;
-    size_t nLen = getLimitedValue< size_t, sal_Int32 >( nCharCount, 0, 1024 );
-    if( nLen > 0 )
-    {
-        ::std::vector< sal_Char > aBuffer( nLen + 1 );
-        in().read( &aBuffer.front(), nLen );
-        aBuffer[ nLen ] = 0;
-        aData = OStringToOUString( OString( &aBuffer.front() ), meTextEnc );
-    }
-    writeStringItem( pcName, aData );
-    return aData;
-}
-
-OUString OlePropertyStreamObject::dumpString16( const sal_Char* pcName )
-{
-    sal_Int32 nLen = dumpDec< sal_Int32 >( "string-len" );
-    return dumpCharArray16( pcName, nLen );
-}
-
-OUString OlePropertyStreamObject::dumpCharArray16( const sal_Char* pcName, sal_Int32 nCharCount )
-{
-    size_t nLen = getLimitedValue< size_t, sal_Int32 >( nCharCount, 0, 1024 );
-    ::std::vector< sal_Unicode > aBuffer;
-    aBuffer.reserve( nLen + 1 );
-    for( size_t nIdx = 0; nIdx < nLen; ++nIdx )
-        aBuffer.push_back( static_cast< sal_Unicode >( in().readValue< sal_uInt16 >() ) );
-    aBuffer.push_back( 0 );
-    OUString aData( &aBuffer.front() );
-    writeStringItem( pcName, aData );
-    if( nLen & 1 ) dumpUnused( 2 ); // always padding to 32bit
-    return aData;
-}
-
-DateTime OlePropertyStreamObject::dumpFileTime( const sal_Char* pcName )
-{
-    DateTime aDateTime;
-
-    ItemGuard aItem( out(), pcName );
-    sal_Int64 nFileTime = dumpDec< sal_Int64 >( 0 );
-    // file time is in 10^-7 seconds (100 nanoseconds), convert to 1/100 seconds
-    nFileTime /= 100000;
-    // entire days
-    sal_Int64 nDays = nFileTime / sal_Int64( 360000 * 24 );
-    // number of entire years
-    sal_Int64 nYears = (nDays - (nDays / (4 * 365)) + (nDays / (100 * 365)) - (nDays / (400 * 365))) / 365;
-    // remaining days in the year
-    sal_Int64 nDaysInYear = nDays - (nYears * 365 + nYears / 4 - nYears / 100 + nYears / 400);
-    // the year (file dates start from 1601-01-01)
-    aDateTime.Year = static_cast< sal_uInt16 >( 1601 + nYears );
-    // leap year?
-    bool bLeap = ((aDateTime.Year % 4 == 0) && (aDateTime.Year % 100 != 0)) || (aDateTime.Year % 400 == 0);
-    // static arrays with number of days in month
-    static const sal_Int64 spnDaysInMonth[]  = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-    static const sal_Int64 spnDaysInMonthL[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-    const sal_Int64* pnDaysInMonth = bLeap ? spnDaysInMonthL : spnDaysInMonth;
-    // the month
-    aDateTime.Month = 1;
-    while( nDaysInYear >= *pnDaysInMonth )
-    {
-        nDaysInYear -= *pnDaysInMonth++;
-        ++aDateTime.Month;
-    }
-    // the day
-    aDateTime.Day = static_cast< sal_uInt16 >( nDaysInYear + 1 );
-    // number of 1/100 seconds in the day
-    sal_Int64 nTimeInDay = nFileTime % sal_Int64( 360000 * 24 );
-    // 1/100 seconds
-    aDateTime.HundredthSeconds = static_cast< sal_uInt16 >( nTimeInDay % 100 );
-    nTimeInDay /= 100;
-    // seconds
-    aDateTime.Seconds = static_cast< sal_uInt16 >( nTimeInDay % 60 );
-    nTimeInDay /= 60;
-    // minutes
-    aDateTime.Minutes = static_cast< sal_uInt16 >( nTimeInDay % 60 );
-    nTimeInDay /= 60;
-    // hours
-    aDateTime.Hours = static_cast< sal_uInt16 >( nTimeInDay );
-
-//    aDateTime.convertToLocalTime();
-    writeDateTimeItem( 0, aDateTime );
-    return aDateTime;
-}
-
-bool OlePropertyStreamObject::startElement( sal_uInt32 nStartPos )
-{
-    sal_Int64 nStartPos64 = static_cast< sal_Int64>( nStartPos );
-    bool bPosOk = nStartPos64 < in().getSize();
-    if( bPosOk )
-        in().seek( nStartPos64 );
-    else
-        writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
-    return bPosOk;
-}
-
-void OlePropertyStreamObject::writeSectionHeader( const OUString& rGuid, sal_uInt32 nStartPos )
-{
-    MultiItemsGuard aMultiGuard( out() );
-    writeEmptyItem( "SECTION" );
-    writeGuidItem( "guid", rGuid );
-    writeHexItem( "pos", nStartPos );
-}
-
-void OlePropertyStreamObject::writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos )
-{
-    MultiItemsGuard aMultiGuard( out() );
-    writeEmptyItem( "PROPERTY" );
-    writeDecItem( "id", nPropId, mxPropIds );
-    writeHexItem( "pos", nStartPos );
-}
-
-// ============================================================================
-// ============================================================================
-
-} // namespace dump
-} // namespace oox
-
-#endif
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/pptxdumperconfig.dat /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/pptxdumperconfig.dat
--- oox/source/dump/pptxdumperconfig.dat	2008-03-05 19:41:56.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/pptxdumperconfig.dat	1970-01-01 01:00:00.000000000 +0100
@@ -1,19 +0,0 @@
-﻿
-# dumper settings ============================================================
-
-# Path to additional configuration data, relative to this file.
-include-config-file=dumperconfig.dat
-
-# Enable entire dumper (default=off). This option does not affect the option
-# 'enable-import'.
-#   0=off, 1=on
-enable-dumper=1
-
-# Enable import after dumping (default=on). Disabling this option allows
-# to dump a file without loading it. This option is independent from the
-# 'enable-dumper' option.
-#   0=off, 1=on
-enable-import=1
-
-# ============================================================================
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/pptxdumper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/pptxdumper.cxx
--- oox/source/dump/pptxdumper.cxx	2008-04-10 17:39:57.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/pptxdumper.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -29,10 +29,14 @@
  ************************************************************************/
 
 #include "oox/dump/pptxdumper.hxx"
+#include "oox/helper/zipstorage.hxx"
 
 #if OOX_INCLUDE_DUMPER
 
 using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::io::XInputStream;
 using ::oox::core::FilterBase;
 
 namespace oox {
@@ -43,26 +47,38 @@ namespace pptx {
 
 RootStorageObject::RootStorageObject( const DumperBase& rParent )
 {
-    RootStorageObjectBase::construct( rParent );
+    StorageObjectBase::construct( rParent );
 }
 
-void RootStorageObject::implDumpStream( BinaryInputStreamRef xStrm, const OUString& /*rStrgPath*/, const OUString& rStrmName, const OUString& rSystemFileName )
+void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& /*rStrgPath*/, const OUString& rStrmName, const OUString& rSysFileName )
 {
     OUString aExt = InputOutputHelper::getFileNameExtension( rStrmName );
     if( aExt.equalsIgnoreAsciiCaseAscii( "xml" ) ||
         aExt.equalsIgnoreAsciiCaseAscii( "vml" ) ||
         aExt.equalsIgnoreAsciiCaseAscii( "rels" ) )
     {
-        XmlStreamObject( *this, rSystemFileName, xStrm ).dump();
+        XmlStreamObject( *this, rxStrm, rSysFileName ).dump();
     }
 }
 
 // ============================================================================
 
+#define DUMP_PPTX_CONFIG_ENVVAR "OOO_PPTXDUMPER"
+
 Dumper::Dumper( const FilterBase& rFilter )
 {
-    ConfigRef xCfg( new Config( "OOO_PPTXDUMPER" ) );
-    DumperBase::construct( rFilter, xCfg );
+    ConfigRef xCfg( new Config( DUMP_PPTX_CONFIG_ENVVAR, rFilter ) );
+    DumperBase::construct( xCfg );
+}
+
+Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName )
+{
+    if( rxFactory.is() && rxInStrm.is() )
+    {
+        StorageRef xStrg( new ZipStorage( rxFactory, rxInStrm ) );
+        ConfigRef xCfg( new Config( DUMP_PPTX_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName ) );
+        DumperBase::construct( xCfg );
+    }
 }
 
 void Dumper::implDump()
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/pptxdumper.ini /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/pptxdumper.ini
--- oox/source/dump/pptxdumper.ini	1970-01-01 01:00:00.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/pptxdumper.ini	2008-09-30 16:51:36.000000000 +0200
@@ -0,0 +1,19 @@
+﻿
+# dumper settings ============================================================
+
+# Path to additional configuration data, relative to this file.
+include-config-file=dumperbase.ini
+
+# Enable entire dumper (default=off). This option does not affect the option
+# 'enable-import'.
+#   0=off, 1=on, missing: setting from dumperbase.ini
+# enable-dumper=1
+
+# Enable import after dumping (default=on). Disabling this option allows
+# to dump a file without loading it. This option is independent from the
+# 'enable-dumper' option.
+#   0=off, 1=on, missing: setting from dumperbase.ini
+# enable-import=1
+
+# ============================================================================
+
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/xlsbdumperconfig.dat /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/xlsbdumperconfig.dat
--- oox/source/dump/xlsbdumperconfig.dat	2008-03-05 19:42:34.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/xlsbdumperconfig.dat	1970-01-01 01:00:00.000000000 +0100
@@ -1,731 +0,0 @@
-﻿
-# dumper settings ============================================================
-
-# Path to additional configuration data, relative to this file.
-include-config-file=dumperconfig.dat
-
-# Enable entire dumper (default=off). This option does not affect the option
-# 'enable-import'.
-#   0=off, 1=on
-enable-dumper=1
-
-# Enable import after dumping (default=on). Disabling this option allows
-# to dump a file without loading it. This option is independent from the
-# 'enable-dumper' option.
-#   0=off, 1=on
-enable-import=1
-
-# XLSB record settings -------------------------------------------------------
-
-# Show total stream position of the record (default=on).
-#   0=off, 1=on
-show-record-pos=0
-
-# Show total record size in bytes (default=on).
-#   0=off, 1=on
-show-record-size=1
-
-# Show record identifier (default=on).
-#   0=off, 1=on
-show-record-id=1
-
-# Show record name, if known (default=on).
-#   0=off, 1=on
-show-record-name=1
-
-# Show record contents (default=on).
-#   0=off, 1=on
-show-record-body=1
-
-# common ---------------------------------------------------------------------
-
-unitconverter=CONV-TINT,/327.67,%
-unitconverter=CONV-COLWIDTH,/256,chars
-
-constlist=ERRORCODES
-  0x00=#NULL!
-  0x07=#DIV/0!
-  0x0F=#VALUE!
-  0x17=#REF!
-  0x1D=#NAME?
-  0x24=#NUM!
-  0x2A=#N/A
-end
-
-flagslist=STRING-FLAGS
-  0x01=rich-string
-  0x02=phonetic-text
-end
-
-combilist=CELL-XFID
-  0x00FFFFFF=int32,dec,xf-id
-  0x01000000=show-phonetic
-end
-
-combilist=PHONETIC-FLAGS
-  ignore=0x0030
-  0x0003=uint8,dec,type,PHONETICPR-TYPE
-  0x000C=uint8,dec,alignment,PHONETICPR-ALIGNMENT
-end
-
-shortlist=COLOR-TYPE,0,auto,indexed,rgb,theme
-
-combilist=COLOR-FLAGS
-  0x01=rgb-valid
-  0xFE=uint8,dec,type,COLOR-TYPE
-end
-
-multilist=PALETTE-COLORS
-  default=
-  0=ega-black,ega-white,ega-red,ega-green,ega-blue,ega-yellow,ega-magenta,ega-cyan
-  64=sys-window-text
-  65=sys-window-bg
-  67=sys-button-face
-  77=sys-window-text-chart
-  78=sys-window-bg-chart
-  79=auto-border-chart
-  80=sys-tooltip-bg
-  81=sys-tooltip-text
-end
-
-constlist=TEXTROTATION
-  default=
-  255=stacked
-end
-
-multilist=BORDERSTYLES
-  0=none,thin,medium,dash,dot
-  5=thick,double,hair,medium-dash,thin-dash-dot
-  10=medium-dash-dot,thin-dash-dot-dot,medium-dash-dot-dot,slant-dash-dot
-end
-
-multilist=FILLPATTERNS
-  0=no-fill,solid-fill,50%-grey,75%-grey,25%-grey
-  5=hor-stripe,ver-stripe,rev-diag-stripe,diag-stripe,diag-crosshatch
-  10=thick-diag-crosshatch,thin-hor-stripe,thin-ver-stripe,thin-rev-diag-stripe,thin-diag-stripe
-  15=thin-hor-crosshatch,thin-diag-crosshatch,12.5%-grey,6.25%-grey
-  40=gradient
-end
-
-# formulas -------------------------------------------------------------------
-
-flagslist=FORMULA-FLAGS
-  0x0002=recalc-always
-end
-
-multilist=BASETOKENS
-  0x00=,tExp,tTbl,tAdd,tSub,tMul,tDiv,tPower
-  0x08=tConcat,tLT,tLE,tEQ,tGE,tGT,tNE,tIsect
-  0x10=tList,tRange,tUplus,tUminus,tPercent,tParen,tMissArg,tStr
-  0x18=tTable,tAttr,,,tErr,tBool,tInt,tNum
-end
-
-constlist=TOKENCLASSES
-  0x20=R
-  0x40=V
-  0x60=A
-end
-
-multilist=CLASSTOKENS
-  0x00=tArray,tFunc,tFuncVar,tName,tRef,tArea,tMemArea,tMemErr
-  0x08=tMemNoMem,tMemFunc,tRefErr,tAreaErr,tRefN,tAreaN,tMemAreaN,tMemNoMemN
-  0x18=,tNameX,tRef3d,tArea3d,tRefErr3d,tAreaErr3d
-end
-
-combilist=FUNCID
-  0x7FFF=uint16,dec,func-id
-  0x8000=command
-end
-
-combilist=PARAMCOUNT-CMD
-  0x7F=uint8,dec,count
-  0x80=prompt
-end
-
-combilist=REFRELFLAGS
-  0x3FFF=uint16,dec,value
-  0x4000=col-rel
-  0x8000=row-rel
-end
-
-flagslist=TABLEFLAGS
-  0x0001=single-column
-  0x0002=column-range
-  0x0004=#all
-  0x0008=#headers
-  0x0010=#data
-  0x0020=#totals
-  0x0040=#this-row
-  0x0080=bracket-spaces
-  0x0100=sep-spaces
-  0x0200=single-row
-  0x0400=single-cell
-end
-
-flagslist=ATTRTYPES
-  0x01=volatile
-  0x02=if
-  0x04=choose
-  0x08=skip
-  0x10=sum
-  0x20=assign
-  0x40=space
-  0x80=iferror
-end
-
-shortlist=ATTRSPACETYPES,0,space-before-token,cr-before-token,space-before-open,cr-before-open,space-before-close,cr-before-close,leading-space
-
-shortlist=ARRAYVALUE-TYPE,0,number,string,boolean,,error
-
-# record names ---------------------------------------------------------------
-
-multilist=RECORD-NAMES
-  0x0000=ROW,CELL_BLANK,CELL_RK,CELL_ERROR,CELL_BOOL,CELL_DOUBLE,CELL_STRING,CELL_SI
-  0x0008=FORMULA_STRING,FORMULA_DOUBLE,FORMULA_BOOL,FORMULA_ERROR,MULTCELL_BLANK,MULTCELL_RK,MULTCELL_ERROR,MULTCELL_BOOL
-  0x0010=MULTCELL_DOUBLE,MULTCELL_STRING,MULTCELL_SI,SI,,,,
-
-  0x0020=,,,,,,,DEFINEDNAME
-  0x0028=BINARYINDEXROWS,,BINARYINDEXBLOCK,FONT,NUMFMT,FILL,BORDER,XF
-  0x0030=CELLSTYLE,,,,,,,
-  0x0038=,,,,COL,MULTCELL_RSTRING,CELL_RSTRING,CALCCHAINCELL
-  0x0040=DATAVALIDATION,,,,,,,
-
-  0x0080=FILEVERSION,WORKSHEET,WORKSHEET_END,WORKBOOK,WORKBOOK_END,SHEETVIEWS,SHEETVIEWS_END,BOOKVIEWS
-  0x0088=BOOKVIEWS_END,SHEETVIEW,SHEETVIEW_END,CHARTSHEETVIEWS,CHARTSHEETVIEWS_END,CHARTSHEETVIEW,CHARTSHEETVIEW_END,SHEETS
-  0x0090=SHEETS_END,SHEETDATA,SHEETDATA_END,SHEETPR,DIMENSION,,,PANE
-  0x0098=SELECTION,WORKBOOKPR,SMARTTAGPR,FILERECOVERYPR,SHEET,CALCPR,WORKBOOKVIEW,SST
-  0x00A0=SST_END,AUTOFILTER,AUTOFILTER_END,FILTERCOLUMN,FILTERCOLUMN_END,,,
-
-  0x00B0=,MERGECELLS,MERGECELLS_END,,,,,
-
-  0x0110=,,,,,BINARYINDEX_END,STYLESHEET,STYLESHEET_END
-
-  0x0150=,,,,,,,TABLE
-  0x0158=TABLE_END,TABLECOLUMNS,TABLECOLUMNS_END,TABLECOLUMN,TABLECOLUMN_END,,,CALCEDCOLUMNFMLA
-  0x0160=,EXTERNALREFS,EXTERNALREFS_END,EXTERNALREF,,EXTERNALSELF,EXTERNALSAME,EXTSHEETNAMES
-  0x0168=EXTERNALBOOK,,EXTERNALSHEETS,EXTSHEETDATA,EXTSHEETDATA_END,,EXTROW,EXTCELL_BLANK
-  0x0170=EXTCELL_DOUBLE,EXTCELL_BOOL,EXTCELL_ERROR,EXTCELL_STRING,,,,
-
-  0x0180=,,,,,,COLS,COLS_END
-  0x0188=ROWBREAKS,ROWBREAKS_END,COLBREAKS,COLBREAKS_END,BRK,CUSTOMWORKBOOKVIEW,,
-
-  0x01A0=,,,,,,CUSTOMSHEETVIEWS,CUSTOMSHEETVIEW
-  0x01A8=CUSTOMSHEETVIEW_END,CUSTOMSHEETVIEWS_END,ARRAY,SHAREDFMLA,DATATABLE,,,
-
-  0x01C8=,,,,,CONDFORMATTING,CONDFORMATTING_END,CFRULE
-  0x01D0=CFRULE_END,ICONSET,ICONSET_END,DATABAR,DATABAR_END,COLORSCALE,COLORSCALE_END,CFVO
-  0x01D8=,COLORS,COLORS_END,RGBCOLOR,PAGEMARGINS,PRINTOPTIONS,PAGESETUP,HEADERFOOTER
-  0x01E0=HEADERFOOTER_END,,,,,SHEETFORMATPR,,
-  0x01E8=,,,,,,HYPERLINK,
-
-  0x01F8=,DXFS,DXFS_END,DXF,TABLESTYLES,TABLESTYLES_END,,
-  0x0200=,TABLESTYLEINFO,VOLTYPES,VOLTYPES_END,VOLTYPE,VOLTYPE_END,VOLTYPEMAIN,VOLTYPEMAIN_END
-  0x0208=VOLTYPETP,VOLTYPETP_END,VOLTYPESTP,VOLTYPETR,,VOLTYPE_ERROR,,
-  0x0210=CALCCHAIN,CALCCHAIN_END,,,,,,SHEETPROTECTION
-  0x0218=,PHONETICPR,,,,,,
-  0x0220=,,,,,,DRAWING,LEGACYDRAWING
-
-  0x0230=,,PICTURE,,CFCOLOR,INDEXEDCOLORS,INDEXEDCOLORS_END,
-  0x0238=,MRUCOLORS,MRUCOLORS_END,,COLOR,DATAVALIDATIONS,DATAVALIDATIONS_END,
-  0x0240=,EXTERNALNAME,DDEITEMVALUES,DDEITEMVALUES_END,DDEITEM_DOUBLE,DDEITEM_ERROR,DDEITEM_STRING,DDEITEM_EMPTY
-  0x0248=DDEITEM_BOOL,EXTERNALNAMEREF,EXTERNALNAMEFLAGS,EXTERNALNAME_END,EXTERNALBOOK_END,,,
-
-  0x0258=,,,FILLS,FILLS_END,,,
-  0x0260=,,,FONTS,FONTS_END,BORDERS,BORDERS_END,NUMFMTS
-  0x0268=NUMFMTS_END,CELLXFS,CELLXFS_END,CELLSTYLES,CELLSTYLES_END,,,
-  0x0270=,,CELLSTYLEXFS,CELLSTYLEXFS_END
-  0x0278=,,,,,,,OLEOBJECT
-
-  0x0288=,,,CHARTSHEETPR,CHARTPAGESETUP,CUSTOMCHARTVIEWS,CUSTOMCHARTVIEWS_END,CUSTOMCHARTVIEW
-  0x0290=CUSTOMCHARTVIEW_END,,,,TABLEPARTS,TABLEPART,TABLEPARTS_END,SHEETCALCPR
-  0x0298=FUNCTIONGROUPS,FUNCTIONGROUP,FUNCTIONGROUPS_END,EXTERNALADDIN,,CHARTPROTECTION,,
-end
-
-# simple records -------------------------------------------------------------
-
-constlist=SIMPLE-RECORDS
-  0x0159=int32,dec,count
-  0x01DD=uint16,hex,flags,PRINTOPTIONS-FLAGS
-  0x01F9=int32,dec,count
-  0x0204=int32,dec,type,VOLTYPE-TYPE
-  0x020D=uint8,dec,error-code,ERRORCODES
-  0x0244=double,dec,value
-  0x0245=uint8,dec,error-code,ERRORCODES
-  0x0248=uint8,dec,value,BOOLEAN
-  0x025B=int32,dec,count
-  0x0263=int32,dec,count
-  0x0265=int32,dec,count
-  0x0267=int32,dec,count
-  0x0269=int32,dec,count
-  0x026B=int32,dec,count
-  0x0272=int32,dec,count
-  0x0294=int32,dec,count
-  0x0297=uint8,hex,flags,SHEETCALCPR-FLAGS
-  0x0298=uint8,dec,builtin-count
-end
-
-# ARRAY ----------------------------------------------------------------------
-
-flagslist=ARRAY-FLAGS
-  0x01=recalc-always
-end
-
-# BORDER ---------------------------------------------------------------------
-
-flagslist=BORDER-FLAGS
-  0x01=diag-tl-to-br
-  0x02=diag-bl-to-tr
-end
-
-# CALCPR ---------------------------------------------------------------------
-
-shortlist=CALCPR-CALCMODE,0,manual,auto,auto-no-tables
-
-flagslist=CALCPR-FLAGS
-  0x0001=calc-on-load
-  0x0002=a1
-  0x0004=iterate
-  0x0008=full-precision
-  0x0010=calc-complete
-  0x0020=calc-on-save
-  0x0040=concurrent
-  0x0080=manual-processors
-  0x0100=force-full-calc
-end
-
-# CELLSTYLE ------------------------------------------------------------------
-
-flagslist=CELLSTYLE-FLAGS
-  0x0001=builtin
-  0x0002=hidden
-  0x0004=custom
-end
-
-multilist=CELLSTYLE-BUILTIN
-  0=normal,rowlevel,collevel,comma,currency,percent,comma-0,currency-0,hyperlink,followed-hyperlink
-  10=note,warning-text,,,,title,heading-1,heading-2,heading-3,heading-4
-  20=input,output,calculation,check-cell,linked-cell,total,good,bad,neutral,accent1
-  30=20%-accent1,40%-accent1,60%-accent1,accent2,20%-accent2,40%-accent2,60%-accent2,accent3,20%-accent3,40%-accent3
-  40=60%-accent3,accent4,20%-accent4,40%-accent4,60%-accent4,accent5,20%-accent5,40%-accent5,60%-accent5,accent6
-  50=20%-accent6,40%-accent6,60%-accent6,explanatory-text
-end
-
-# CFRULE ---------------------------------------------------------------------
-
-shortlist=CFRULE-TYPE,1,cell-is,expression,color-scale,data-bar,top-ten,icon-set
-
-multilist=CFRULE-SUBTYPE
-  0=cell-is,expression,color-scale,data-bar,icon-set,top-ten,,unique-values,contains-text,contains-blanks
-  10=not-contains-blanks,contains-errors,not-contains-errors,,,today,tomorrow,yesterday,last-7-days,last-month
-  20=next-month,this-week,next-week,last-week,this-month,above-average,below-average,duplicate-values,,equal-above-average
-  30=equal-below-average
-end
-
-shortlist=CFRULE-CELL-OPERATOR,1,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
-shortlist=CFRULE-TEXT-OPERATOR,0,contains,not-contains,begins-with,ends-with
-shortlist=CFRULE-TIME-OPERATOR,0,today,yesterday,last-7-days,this-week,last-week,last-month,tomorrow,next-week,next-month,this-month
-shortlist=CFRULE-OTHER-OPERATOR,0,none
-
-flagslist=CFRULE-FLAGS
-  0x0001=table-row
-  0x0002=stop-if-true
-  0x0004=avove-average
-  0x0008=bottom
-  0x0010=percent
-end
-
-# CHARTPAGESETUP ------------------------------------------------------------------
-
-combilist=CHARTPAGESETUP-FLAGS
-  0x0001=landscape
-  0x0002=uninitialized
-  0x0004=black-and-white
-  0x0008=default-orientation
-  0x0010=use-first-page
-  0x0020=draft-quality
-end
-
-# CHARTSHEETPR ---------------------------------------------------------------
-
-flagslist=CHARTSHEETPR-FLAGS
-  0x0001=published
-end
-
-# CHARTSHEETVIEW -------------------------------------------------------------
-
-flagslist=CHARTSHEETVIEW-FLAGS
-  0x0001=selected
-  0x0002=zoom-to-fit
-end
-
-# COL ------------------------------------------------------------------------
-
-combilist=COL-FLAGS
-  0x0001=hidden
-  0x0002=custom-width
-  0x0004=best-fit
-  0x0008=show-phonetic
-  0x0700=uint8,dec,outline-level
-  0x1000=outline-collapsed
-end
-
-# DATATABLE ------------------------------------------------------------------
-
-flagslist=DATATABLE-FLAGS
-  0x01=row-table
-  0x02=table-2d
-  0x04=ref1-deleted
-  0x08=ref2-deleted
-  0x10=recalc-always
-end
-
-# DATAVALIDATION -------------------------------------------------------------
-
-combilist=DATAVALIDATION-FLAGS
-  0x0000000F=uint8,dec,type,DATAVALIDATION-TYPE
-  0x00000070=uint8,dec,error-style,DATAVALIDATION-ERRORSTYLE
-  0x00000080=string-list
-  0x00000100=ignore-empty
-  0x00000200=no-dropdown
-  0x00040000=show-input-box
-  0x00080000=show-error-box
-  0x00F00000=uint8,dec,operator,DATAVALIDATION-OPERATOR
-end
-
-shortlist=DATAVALIDATION-TYPE,0,any,whole,decimal,list,date,time,text-length,custom
-shortlist=DATAVALIDATION-OPERATOR,0,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
-shortlist=DATAVALIDATION-ERRORSTYLE,0,error,warning,info
-
-# DATAVALIDATIONS ------------------------------------------------------------
-
-combilist=DATAVALIDATIONS-FLAGS
-  0x0001=disable-prompts
-end
-
-# DEFINEDNAME ----------------------------------------------------------------
-
-combilist=DEFINEDNAME-FLAGS
-  0x00000001=hidden
-  0x00000002=function
-  0x00000004=command
-  0x00000008=macro
-  0x00000010=complex
-  0x00000020=built-in
-  0x00007FC0=int32,dec,func-group,DEFINEDNAME-FUNCGROUP
-  0x00008000=published
-  0x00010000=workbook-param
-end
-
-shortlist=DEFINEDNAME-FUNCGROUP,0,none,financial,date-time,math-trig,statistical,lookup-ref,database,text,logical,information,commands,customizing,macro-control,dde-external,user-definded
-
-constlist=DEFINEDNAME-SHEETID
-  default=
-  -1=global
-end
-
-# DXF ------------------------------------------------------------------------
-
-flagslist=DXF-FLAGS
-  0x00008000=border-outline
-end
-
-multilist=DXF-SUBREC
-  0=FILL-PATTERN,FILL-FGCOLOR,FILL-BGCOLOR,FILL-GRADIENT,FILL-STOP
-  5=FONT-COLOR,BORDER-TOP,BORDER-BOTTOM,BORDER-LEFT,BORDER-RIGHT
-  10=BORDER-DIAGONAL,BORDER-VERTICAL,BORDER-HORIZONTAL,BORDER-DIAGUP,BORDER-DIAGDOWN
-  15=ALIGN-HORIZONTAL,ALIGN-VERTICAL,ALIGN-ROTATION,ALIGN-INDENT,ALIGN-READINGORDER
-  20=ALIGN-WRAPTEXT,ALIGN-JUSTLASTLINE,ALIGN-SHRINKTOFIT,,FONT-NAME
-  25=FONT-WEIGHT,FONT-UNDERLINE,FONT-ESCAPEMENT,FONT-ITALIC,FONT-STRIKE
-  30=FONT-OUTLINE,FONT-SHADOW,FONT-CONDENSE,FONT-EXTEND,FONT-CHARSET
-  35=FONT-FAMILY,FONT-HEIGHT,FONT-SCHEME,NUMFMT-CODE,
-  40=,NUMFMT-ID,ALIGN-RELINDENT,PROT-LOCKED,PROT-HIDDEN
-end
-
-# EXTERNALBOOK ---------------------------------------------------------------
-
-shortlist=EXTERNALBOOK-TYPE,0,book,dde-link,ole-link
-
-# EXTERNALNAMEFLAGS ----------------------------------------------------------
-
-flagslist=EXTERNALNAMEFLAGS-FLAGS
-  0x0002=automatic
-  0x0004=pic-link
-  0x0008=dde-stddocumentname
-  0x0010=ole-link
-  0x0020=iconified
-end
-
-# EXTERNALSHEETS -------------------------------------------------------------
-
-constlist=EXTERNALSHEETS-ID
-  default=
-  -1=deleted
-  -2=special
-end
-
-# EXTSHEETDATA ---------------------------------------------------------------
-
-flagslist=EXTSHEETDATA-FLAGS
-  0x01=refresh-error
-end
-
-# FILL -----------------------------------------------------------------------
-
-shortlist=FILL-GRADIENTTYPE,0,linear,path
-
-# FONT -----------------------------------------------------------------------
-
-flagslist=FONT-FLAGS
-  0x0001=bold
-  0x0002=italic
-  0x0004=underline
-  0x0008=strikeout
-  0x0010=outline
-  0x0020=shadow
-  0x0040=condense
-  0x0080=extend
-end
-
-constlist=FONT-WEIGHT
-  400=normal
-  700=bold
-end
-
-multilist=FONT-UNDERLINE
-  0x00=none,single,double
-  0x21=single-acc,double-acc
-end
-
-shortlist=FONT-SCHEME,0,none,major,minor
-shortlist=FONT-ESCAPEMENT,0,none,superscript,subscript
-shortlist=FONT-FAMILY,0,none,roman,swiss,modern,script,decorative
-
-# HEADERFOOTER ---------------------------------------------------------------
-
-flagslist=HEADERFOOTER-FLAGS
-  0x0001=diff-odd-even
-  0x0002=diff-dirst
-  0x0004=scale-with-doc
-  0x0008=align-with-margins
-end
-
-# PAGESETUP ------------------------------------------------------------------
-
-multilist=PAGESETUP-PAPERSIZE
-  0=undefined,letter,letter-small,tabloid,ledger,legal,statement,executive,a3,a4
-  10=a4-small,a5,b4,b5,folio,quarto,10x14,11x17,note,envelope-9
-  20=envelope-10,envelope-11,envelope-12,envelope-14,c,d,e,envelope-dl,envelope-c5,envelope-c3
-  30=envelope-c4,envelope-c6,envelope-c65,envelope-b4,envelope-b5,envelope-b6,envelope-italy,envelope-monarch,envelope-6-3/4,us-standard-fanfold
-  40=german-standard-fanfold,german-legal-fanfold,b4,japanese-dbl-postcaed,9x11,10x11,15x11,,
-  50=envelope-invite,letter-extra,legal-extra,tabloid-extra,a4-extra,letter-transverse,a4-transverse,letter-extra-transverse,super-a-a4,super-b-a3,letter-plus
-  60=a4-plus,a5-transverse,jis-b5-transverse,a3-extra,a5-extra,b5-extra,a2,a3-transverse,a3-extra-transverse
-end
-
-constlist=PAGESETUP-SCALETOPAGES
-  default=
-  0=automatic
-end
-
-combilist=PAGESETUP-FLAGS
-  0x0001=print-in-rows
-  0x0002=landscape
-  0x0004=uninitialized
-  0x0008=black-and-white
-  0x0010=draft-quality
-  0x0020=print-notes
-  0x0040=default-orientation
-  0x0080=use-first-page
-  0x0100=print-notes-at-end
-  0x0600=uint8,dec,print-errors,PAGESETUP-PRINTERRORS
-end
-
-shortlist=PAGESETUP-PRINTERRORS,0,displayed,none,as-dashes,as-na
-
-unitconverter=PAGESETUP-DPI,1,dpi
-
-# PANE -----------------------------------------------------------------------
-
-shortlist=PANE-ID,0,bottom-right,top-right,bottom-left,top-left
-
-flagslist=PANE-FLAGS
-  0x01=frozen
-  0x02=remove-split-with-freeze
-end
-
-# PHONETICPR -----------------------------------------------------------------
-
-shortlist=PHONETICPR-TYPE,0,halfwidth-katakana,fullwidth-katakana,hiragana,no-conversion
-shortlist=PHONETICPR-ALIGNMENT,0,no-control,left,center,distributed
-
-# PRINTOPTIONS ---------------------------------------------------------------
-
-flagslist=PRINTOPTIONS-FLAGS
-  0x0001=horizontal-centered
-  0x0002=vertical-centered
-  0x0004=print-headings
-  0x0008=print-gridlines
-  0x0010=gridlines-set
-end
-
-# ROW ------------------------------------------------------------------------
-
-combilist=ROW-FLAGS1
-  0x0001=thick-top
-  0x0002=thick-bottom
-  0x0700=uint8,dec,outline-level
-  0x0800=outline-collapsed
-  0x1000=hidden
-  0x2000=custom-height
-  0x4000=custom-format
-end
-
-flagslist=ROW-FLAGS2
-  0x01=show-phonetic
-end
-
-# SHEET ----------------------------------------------------------------------
-
-shortlist=SHEET-STATE,0,visible,hidden,very-hidden
-
-# SHEETCALCPR ----------------------------------------------------------------
-
-flagslist=SHEETCALCPR-FLAGS
-  0x01=calc-on-load
-end
-
-# SHEETFORMATPR --------------------------------------------------------------
-
-flagslist=SHEETFORMATPR-FLAGS
-  0x0001=custom-row-height
-  0x0002=rows-hidden
-end
-
-# SHEETPR --------------------------------------------------------------------
-
-flagslist=SHEETPR-FLAGS1
-  0x0001=show-autopagebreaks
-  0x0008=published
-  0x0010=dialog-sheet
-  0x0020=outline-auto-style
-  0x0040=row-symbols-below
-  0x0080=column-symbols-right
-  0x0100=fit-to-pages
-  0x0400=show-outline-symbols
-  0x1000=is-row-synched
-  0x2000=is-col-synched
-  0x4000=lotus-formula-eval
-  0x8000=lotus-formula-entry
-end
-
-flagslist=SHEETPR-FLAGS2
-  0x01=is-filtered
-  0x02=eval-cond-formats
-end
-
-# SHEETVIEW ------------------------------------------------------------------
-
-flagslist=SHEETVIEW-FLAGS
-  0x0001=window-protected
-  0x0002=show-formulas
-  0x0004=show-gridlines
-  0x0008=show-headings
-  0x0010=show-zeros
-  0x0020=right-to-left
-  0x0040=selected
-  0x0080=show-ruler
-  0x0100=show-outline-symbols
-  0x0200=default-gridcolor
-  0x0400=show-whitespace
-end
-
-shortlist=SHEETVIEW-TYPE,0,normal,pagebreak-preview,page-layout
-
-# TABLE ----------------------------------------------------------------------
-
-shortlist=TABLE-TYPE,0,worksheet,,,query-table
-
-flagslist=TABLE-FLAGS
-  0x00000001=totals-row-shown
-  0x00000002=published
-  0x00000004=insert-row
-  0x00000008=insert-row-shift
-end
-
-# TABLESTYLEINFO -------------------------------------------------------------
-
-flagslist=TABLESTYLEINFO-FLAGS
-  0x0001=show-first-column
-  0x0002=show-last-column
-  0x0004=show-row-stripes
-  0x0008=show-column-stripes
-end
-
-# VOLTYPE --------------------------------------------------------------------
-
-shortlist=VOLTYPE-TYPE,0,realtime-data,olap-functions
-
-# WORKBBOKPR -----------------------------------------------------------------
-
-combilist=WORKBBOKPR-FLAGS
-  0x00000001=date-1904
-  0x00000004=hide-border-unsel-tables
-  0x00000008=filter-privacy
-  0x00000010=prompted-solutions
-  0x00000020=show-ink-annotation
-  0x00000040=backup-file
-  0x00000080=strip-extlink-values
-  0x00000300=uint8,dec,update-links,WORKBBOKPR-UPDATELINKS
-  0x00000400=hide-pivot-fieldlist
-  0x00000800=publish-items
-  0x00001000=check-compatibility
-  0x00006000=uint8,dec,show-objects,WORKBBOKPR-SHOWOBJECTS
-  0x00008000=show-pivotchart-filter
-  0x00010000=autocompress-pic
-  0x00020000=refresh-all-links
-end
-
-shortlist=WORKBBOKPR-UPDATELINKS,0,ask-user,never,always
-shortlist=WORKBBOKPR-SHOWOBJECTS,0,show,placeholder,hide
-
-# WORKBOOKVIEW ---------------------------------------------------------------
-
-flagslist=WORKBOOKVIEW-FLAGS
-  0x01=hidden
-  0x02=minimized
-  0x08=show-horizontal-scroll
-  0x10=show-vertical-scroll
-  0x20=show-tabbar
-  0x40=autofilter-date-grouping
-end
-
-# XF -------------------------------------------------------------------------
-
-shortlist=XF-HORALIGN,0,general,left,center,right,fill,block,center-across-sel,distribute
-shortlist=XF-VERALIGN,0,top,center,bottom,justify,distribute
-shortlist=XF-TEXTDIRECTION,0,context,left-to-right,right-to-left
-
-combilist=XF-ALIGNMENT
-  0x000000FF=uint8,dec,rotation,TEXTROTATION
-  0x0000FF00=uint8,dec,indent
-  0x00070000=uint8,dec,hor-align,XF-HORALIGN
-  0x00380000=uint8,dec,ver-align,XF-VERALIGN
-  0x00400000=text-wrap
-  0x00800000=justify-lastline
-  0x01000000=shrink-to-fit
-  0x0C000000=uint8,dec,text-dir,XF-TEXTDIRECTION
-  0x10000000=locked
-  0x20000000=formula-hidden
-  0x80000000=quote-prefix
-end
-
-flagslist=XF-USEDFLAGS
-  0x0001=format
-  0x0002=font
-  0x0004=alignment
-  0x0008=border
-  0x0010=fill
-  0x0020=protection
-end
-
-# ============================================================================
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/xlsbdumper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/xlsbdumper.cxx
--- oox/source/dump/xlsbdumper.cxx	2008-04-10 17:41:32.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/xlsbdumper.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -30,7 +30,10 @@
 
 #include "oox/dump/xlsbdumper.hxx"
 #include <com/sun/star/io/XTextInputStream.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include "oox/dump/biffdumper.hxx"
+#include "oox/dump/oledumper.hxx"
+#include "oox/helper/olestorage.hxx"
+#include "oox/helper/zipstorage.hxx"
 #include "oox/core/filterbase.hxx"
 #include "oox/xls/biffhelper.hxx"
 #include "oox/xls/formulabase.hxx"
@@ -41,8 +44,8 @@
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
 using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::sheet::XSpreadsheetDocument;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::io::XInputStream;
 using ::oox::core::FilterBase;
 
 using namespace ::oox::xls;
@@ -63,62 +66,9 @@ const sal_uInt8 OOBIN_TOK_ARRAY_STRING  
 const sal_uInt8 OOBIN_TOK_ARRAY_BOOL            = 2;
 const sal_uInt8 OOBIN_TOK_ARRAY_ERROR           = 4;
 
-} // namespace
-
-// ============================================================================
-
-RecordStreamInput::RecordStreamInput() :
-    mxStrm( new RecordInputStream( RecordDataSequence() ) )
-{
-}
+const sal_uInt16 OOBIN_OLEOBJECT_LINKED         = 0x0001;
 
-RecordStreamInput::~RecordStreamInput()
-{
-}
-
-bool RecordStreamInput::implIsValid() const
-{
-    return mxStrm.get() && Input::implIsValid();
-}
-
-void RecordStreamInput::createStream( const RecordDataSequence& rData )
-{
-    mxStrm.reset( new RecordInputStream( rData ) );
-}
-
-sal_Int64 RecordStreamInput::getSize() const
-{
-    return mxStrm->getRecSize();
-}
-
-sal_Int64 RecordStreamInput::tell() const
-{
-    return mxStrm->getRecPos();
-}
-
-void RecordStreamInput::seek( sal_Int64 nPos )
-{
-    mxStrm->seek( static_cast< sal_Int32 >( nPos ) );
-}
-
-void RecordStreamInput::skip( sal_Int32 nBytes )
-{
-    mxStrm->skip( nBytes );
-}
-
-sal_Int32 RecordStreamInput::read( void* pBuffer, sal_Int32 nSize )
-{
-    return mxStrm->read( pBuffer, nSize );
-}
-
-RecordStreamInput& RecordStreamInput::operator>>( sal_Int8& rnData )   { *mxStrm >> rnData; return *this; }
-RecordStreamInput& RecordStreamInput::operator>>( sal_uInt8& rnData )  { *mxStrm >> rnData; return *this; }
-RecordStreamInput& RecordStreamInput::operator>>( sal_Int16& rnData )  { *mxStrm >> rnData; return *this; }
-RecordStreamInput& RecordStreamInput::operator>>( sal_uInt16& rnData ) { *mxStrm >> rnData; return *this; }
-RecordStreamInput& RecordStreamInput::operator>>( sal_Int32& rnData )  { *mxStrm >> rnData; return *this; }
-RecordStreamInput& RecordStreamInput::operator>>( sal_uInt32& rnData ) { *mxStrm >> rnData; return *this; }
-RecordStreamInput& RecordStreamInput::operator>>( float& rfData )      { *mxStrm >> rfData; return *this; }
-RecordStreamInput& RecordStreamInput::operator>>( double& rfData )     { *mxStrm >> rfData; return *this; }
+} // namespace
 
 // ============================================================================
 
@@ -130,11 +80,12 @@ RecordObjectBase::~RecordObjectBase()
 {
 }
 
-void RecordObjectBase::construct( const OutputObjectBase& rParent )
+void RecordObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
 {
-    mxStrmIn.reset( new RecordStreamInput );
-    InputObjectBase::construct( rParent, mxStrmIn );
-    constructRecObjBase();
+    mxStrm.reset( new RecordInputStream( getRecordDataSequence() ) );
+    SequenceRecordObjectBase::construct( rParent, rxStrm, rSysFileName, mxStrm, "RECORD-NAMES", "SIMPLE-RECORDS" );
+    if( SequenceRecordObjectBase::implIsValid() )
+        mxErrCodes = cfg().getNameList( "ERRORCODES" );
 }
 
 void RecordObjectBase::construct( const RecordObjectBase& rParent )
@@ -142,14 +93,13 @@ void RecordObjectBase::construct( const 
     *this = rParent;
 }
 
-bool RecordObjectBase::implIsValid() const
+bool RecordObjectBase::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize )
 {
-    return isValid( mxStrmIn ) && InputObjectBase::implIsValid();
-}
-
-void RecordObjectBase::createRecordStream( const RecordDataSequence& rData )
-{
-    mxStrmIn->createStream( rData );
+    sal_Int32 nRecId = 0, nRecSize = 0;
+    bool bValid = readCompressedInt( rBaseStrm, nRecId ) && (nRecId >= 0) && readCompressedInt( rBaseStrm, nRecSize ) && (nRecSize >= 0);
+    ornRecId = nRecId;
+    ornRecSize = nRecSize;
+    return bValid;
 }
 
 OUString RecordObjectBase::getErrorName( sal_uInt8 nErrCode ) const
@@ -176,7 +126,7 @@ void RecordObjectBase::readRangeList( Ra
     if( nCount >= 0 )
     {
         orRanges.resize( getLimitedValue< size_t, sal_Int32 >( nCount, 0, SAL_MAX_UINT16 ) );
-        for( RangeList::iterator aIt = orRanges.begin(), aEnd = orRanges.end(); in().isValidPos() && (aIt != aEnd); ++aIt )
+        for( RangeList::iterator aIt = orRanges.begin(), aEnd = orRanges.end(); !in().isEof() && (aIt != aEnd); ++aIt )
             readRange( *aIt );
     }
     else
@@ -185,14 +135,14 @@ void RecordObjectBase::readRangeList( Ra
 
 // ----------------------------------------------------------------------------
 
-void RecordObjectBase::writeBooleanItem( const sal_Char* pcName, sal_uInt8 nBool )
+void RecordObjectBase::writeBooleanItem( const String& rName, sal_uInt8 nBool )
 {
-    writeDecItem( pcName, nBool, "BOOLEAN" );
+    writeDecItem( rName, nBool, "BOOLEAN" );
 }
 
-void RecordObjectBase::writeErrorCodeItem( const sal_Char* pcName, sal_uInt8 nErrCode )
+void RecordObjectBase::writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode )
 {
-    writeHexItem( pcName, nErrCode, mxErrCodes );
+    writeHexItem( rName, nErrCode, mxErrCodes );
 }
 
 void RecordObjectBase::writeFontPortions( const BinFontPortionList& rPortions )
@@ -230,35 +180,35 @@ void RecordObjectBase::writePhoneticPort
 
 // ----------------------------------------------------------------------------
 
-sal_uInt8 RecordObjectBase::dumpBoolean( const sal_Char* pcName )
+sal_uInt8 RecordObjectBase::dumpBoolean( const String& rName )
 {
     sal_uInt8 nBool;
     in() >> nBool;
-    writeBooleanItem( pcName ? pcName : "boolean", nBool );
+    writeBooleanItem( rName( "boolean" ), nBool );
     return nBool;
 }
 
-sal_uInt8 RecordObjectBase::dumpErrorCode( const sal_Char* pcName )
+sal_uInt8 RecordObjectBase::dumpErrorCode( const String& rName )
 {
     sal_uInt8 nErrCode;
     in() >> nErrCode;
-    writeErrorCodeItem( pcName ? pcName : "errorcode", nErrCode );
+    writeErrorCodeItem( rName( "error-code" ), nErrCode );
     return nErrCode;
 }
 
-OUString RecordObjectBase::dumpString( const sal_Char* pcName, bool bRich, bool b32BitLen )
+OUString RecordObjectBase::dumpString( const String& rName, bool bRich, bool b32BitLen )
 {
     sal_uInt8 nFlags = bRich ? dumpHex< sal_uInt8 >( "flags", "STRING-FLAGS" ) : 0;
 
-    OUString aString = getRecordStream().readString( b32BitLen );
-    writeStringItem( pcName ? pcName : "text", aString );
+    OUString aString = mxStrm->readString( b32BitLen );
+    writeStringItem( rName( "text" ), aString );
 
     // --- formatting ---
     if( getFlag( nFlags, OOBIN_STRINGFLAG_FONTS ) )
     {
         IndentGuard aIndGuard( out() );
         BinFontPortionList aPortions;
-        aPortions.importPortions( getRecordStream() );
+        aPortions.importPortions( *mxStrm );
         writeFontPortions( aPortions );
     }
 
@@ -268,7 +218,7 @@ OUString RecordObjectBase::dumpString( c
         IndentGuard aIndGuard( out() );
         dumpString( "phonetic-text" );
         BinPhoneticPortionList aPortions;
-        aPortions.importPortions( getRecordStream() );
+        aPortions.importPortions( *mxStrm );
         writePhoneticPortions( aPortions );
         dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
         dumpHex< sal_uInt16 >( "flags", "PHONETIC-FLAGS" );
@@ -277,10 +227,10 @@ OUString RecordObjectBase::dumpString( c
     return aString;
 }
 
-void RecordObjectBase::dumpColor( const sal_Char* pcName )
+void RecordObjectBase::dumpColor( const String& rName )
 {
     MultiItemsGuard aMultiGuard( out() );
-    writeEmptyItem( pcName ? pcName : "color" );
+    writeEmptyItem( rName( "color" ) );
     switch( extractValue< sal_uInt8 >( dumpDec< sal_uInt8 >( "flags", "COLOR-FLAGS" ), 1, 7 ) )
     {
         case 0:     dumpUnused( 1 );                                    break;
@@ -290,78 +240,93 @@ void RecordObjectBase::dumpColor( const 
         default:    dumpUnknown( 1 );
     }
     dumpDec< sal_Int16 >( "tint", "CONV-TINT" );
-    sal_uInt8 nR, nG, nB, nA;
-    in() >> nR >> nG >> nB >> nA;
-    writeColorItem( "rgb", (((((static_cast< sal_Int32 >( nA ) << 8) | nR) << 8) | nG) << 8) | nB );
+    dumpColorABGR();
 }
 
-sal_Int32 RecordObjectBase::dumpColIndex( const sal_Char* pcName )
+sal_Int32 RecordObjectBase::dumpColIndex( const String& rName )
 {
     sal_Int32 nCol;
     in() >> nCol;
-    writeColIndexItem( pcName ? pcName : "col-idx", nCol );
+    writeColIndexItem( rName( "col-idx" ), nCol );
     return nCol;
 }
 
-sal_Int32 RecordObjectBase::dumpRowIndex( const sal_Char* pcName )
+sal_Int32 RecordObjectBase::dumpRowIndex( const String& rName )
 {
     sal_Int32 nRow;
     in() >> nRow;
-    writeRowIndexItem( pcName ? pcName : "row-idx", nRow );
+    writeRowIndexItem( rName( "row-idx" ), nRow );
     return nRow;
 }
 
-sal_Int32 RecordObjectBase::dumpColRange( const sal_Char* pcName )
+sal_Int32 RecordObjectBase::dumpColRange( const String& rName )
 {
     sal_Int32 nCol1, nCol2;
     in() >> nCol1 >> nCol2;
-    writeColRangeItem( pcName ? pcName : "col-range", nCol1, nCol2 );
+    writeColRangeItem( rName( "col-range" ), nCol1, nCol2 );
     return nCol2 - nCol1 + 1;
 }
 
-sal_Int32 RecordObjectBase::dumpRowRange( const sal_Char* pcName )
+sal_Int32 RecordObjectBase::dumpRowRange( const String& rName )
 {
     sal_Int32 nRow1, nRow2;
     in() >> nRow1 >> nRow2;
-    writeRowRangeItem( pcName ? pcName : "row-range", nRow1, nRow2 );
+    writeRowRangeItem( rName( "row-range" ), nRow1, nRow2 );
     return nRow2 - nRow1 + 1;
 }
 
-Address RecordObjectBase::dumpAddress( const sal_Char* pcName )
+Address RecordObjectBase::dumpAddress( const String& rName )
 {
     Address aPos;
     readAddress( aPos );
-    writeAddressItem( pcName ? pcName : "addr", aPos );
+    writeAddressItem( rName( "addr" ), aPos );
     return aPos;
 }
 
-Range RecordObjectBase::dumpRange( const sal_Char* pcName )
+Range RecordObjectBase::dumpRange( const String& rName )
 {
     Range aRange;
     readRange( aRange );
-    writeRangeItem( pcName ? pcName : "range", aRange );
+    writeRangeItem( rName( "range" ), aRange );
     return aRange;
 }
 
-void RecordObjectBase::dumpRangeList( const sal_Char* pcName )
+void RecordObjectBase::dumpRangeList( const String& rName )
 {
     RangeList aRanges;
     readRangeList( aRanges );
-    writeRangeListItem( pcName ? pcName : "range-list", aRanges );
+    writeRangeListItem( rName( "range-list" ), aRanges );
 }
 
-// ----------------------------------------------------------------------------
+// private --------------------------------------------------------------------
 
-void RecordObjectBase::constructRecObjBase()
+bool RecordObjectBase::readCompressedInt( BinaryInputStream& rStrm, sal_Int32& ornValue )
 {
-    if( RecordObjectBase::implIsValid() )
-        mxErrCodes = cfg().getNameList( "ERRORCODES" );
+    ornValue = 0;
+    sal_uInt8 nByte;
+    rStrm >> nByte;
+    ornValue = nByte & 0x7F;
+    if( (nByte & 0x80) != 0 )
+    {
+        rStrm >> nByte;
+        ornValue |= sal_Int32( nByte & 0x7F ) << 7;
+        if( (nByte & 0x80) != 0 )
+        {
+            rStrm >> nByte;
+            ornValue |= sal_Int32( nByte & 0x7F ) << 14;
+            if( (nByte & 0x80) != 0 )
+            {
+                rStrm >> nByte;
+                ornValue |= sal_Int32( nByte & 0x7F ) << 21;
+            }
+        }
+    }
+    return !rStrm.isEof();
 }
 
 // ============================================================================
 
 FormulaObject::FormulaObject( const RecordObjectBase& rParent ) :
-    mpcName( 0 ),
     mnSize( 0 )
 {
     RecordObjectBase::construct( rParent );
@@ -372,28 +337,28 @@ FormulaObject::~FormulaObject()
 {
 }
 
-void FormulaObject::dumpCellFormula( const sal_Char* pcName )
+void FormulaObject::dumpCellFormula( const String& rName )
 {
-    dumpFormula( pcName, false );
+    dumpFormula( rName, false );
 }
 
-void FormulaObject::dumpNameFormula( const sal_Char* pcName )
+void FormulaObject::dumpNameFormula( const String& rName )
 {
-    dumpFormula( pcName, true );
+    dumpFormula( rName, true );
 }
 
 void FormulaObject::implDump()
 {
     {
         MultiItemsGuard aMultiGuard( out() );
-        writeEmptyItem( mpcName );
+        writeEmptyItem( maName );
         writeDecItem( "formula-size", mnSize );
     }
     if( mnSize < 0 ) return;
 
-    Input& rIn = in();
-    sal_Int64 nStartPos = rIn.tell();
-    sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, rIn.getSize() );
+    BinaryInputStream& rStrm = in();
+    sal_Int64 nStartPos = rStrm.tell();
+    sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, rStrm.getLength() );
 
     bool bValid = mxTokens.get();
     mxStack.reset( new FormulaStack );
@@ -401,11 +366,11 @@ void FormulaObject::implDump()
     IndentGuard aIndGuard( out() );
     {
         TableGuard aTabGuard( out(), 8, 18 );
-        while( bValid && (rIn.tell() < nEndPos) )
+        while( bValid && (rStrm.tell() < nEndPos) )
         {
             MultiItemsGuard aMultiGuard( out() );
-            writeHexItem( 0, static_cast< sal_uInt16 >( rIn.tell() - nStartPos ) );
-            sal_uInt8 nTokenId = dumpHex< sal_uInt8 >( 0, mxTokens );
+            writeHexItem( EMPTY_STRING, static_cast< sal_uInt16 >( rStrm.tell() - nStartPos ) );
+            sal_uInt8 nTokenId = dumpHex< sal_uInt8 >( EMPTY_STRING, mxTokens );
             bValid = mxTokens->hasName( nTokenId );
             if( bValid )
             {
@@ -479,7 +444,7 @@ void FormulaObject::implDump()
         }
     }
 
-    if( nEndPos == rIn.tell() )
+    if( nEndPos == rStrm.tell() )
     {
         dumpAddTokenData();
         if( mnSize > 0 )
@@ -490,18 +455,17 @@ void FormulaObject::implDump()
     }
     else
     {
-        dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), static_cast< sal_Int32 >( nEndPos - rIn.tell() ), false );
+        dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), static_cast< sal_Int32 >( nEndPos - rStrm.tell() ), false );
         sal_Int32 nAddDataSize = dumpDec< sal_Int32 >( "add-data-size" );
         dumpBinary( "add-data", nAddDataSize, false );
     }
 
-    mpcName = 0;
     mnSize = 0;
 }
 
-void FormulaObject::dumpFormula( const sal_Char* pcName, bool bNameMode )
+void FormulaObject::dumpFormula( const String& rName, bool bNameMode )
 {
-    mpcName = pcName ? pcName : "formula";
+    maName = rName( "formula" );
     in() >> mnSize;
     mbNameMode = bNameMode;
     dump();
@@ -513,8 +477,7 @@ void FormulaObject::constructFmlaObj()
 {
     if( RecordObjectBase::implIsValid() )
     {
-        Reference< XSpreadsheetDocument > xDocument( getFilter().getModel(), UNO_QUERY );
-        mxFuncProv.reset( new FunctionProvider( xDocument, true ) );
+        mxFuncProv.reset( new FunctionProvider( FILTER_OOX, BIFF_UNKNOWN, true ) );
 
         Config& rCfg = cfg();
         mxClasses   = rCfg.getNameList( "TOKENCLASSES" );
@@ -590,7 +553,7 @@ OUString FormulaObject::createPlaceHolde
 OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo** oppFuncInfo )
 {
     ItemGuard aItemGuard( out(), "func-id" );
-    writeHexItem( 0, nFuncId, "FUNCID" );
+    writeHexItem( EMPTY_STRING, nFuncId, "FUNCID" );
     OUStringBuffer aBuffer;
     const FunctionInfo* pFuncInfo = mxFuncProv->getFuncInfoFromOobFuncId( nFuncId );
     if( pFuncInfo )
@@ -603,23 +566,25 @@ OUString FormulaObject::writeFuncIdItem(
     }
     OUString aFuncName = aBuffer.makeStringAndClear();
     aItemGuard.cont();
+    out().writeChar( OOX_DUMP_STRQUOTE );
     out().writeString( aFuncName );
+    out().writeChar( OOX_DUMP_STRQUOTE );
     if( oppFuncInfo ) *oppFuncInfo = pFuncInfo;
     return aFuncName;
 }
 
-sal_Int32 FormulaObject::dumpTokenCol( const sal_Char* pcName, bool& rbRelC, bool& rbRelR )
+sal_Int32 FormulaObject::dumpTokenCol( const String& rName, bool& rbRelC, bool& rbRelR )
 {
-    sal_uInt16 nCol = dumpHex< sal_uInt16 >( pcName, mxRelFlags );
+    sal_uInt16 nCol = dumpHex< sal_uInt16 >( rName, mxRelFlags );
     rbRelC = getFlag( nCol, OOBIN_TOK_REF_COLREL );
     rbRelR = getFlag( nCol, OOBIN_TOK_REF_ROWREL );
     nCol &= OOBIN_TOK_REF_COLMASK;
     return nCol;
 }
 
-sal_Int32 FormulaObject::dumpTokenRow( const sal_Char* pcName )
+sal_Int32 FormulaObject::dumpTokenRow( const String& rName )
 {
-    return dumpDec< sal_Int32 >( pcName );
+    return dumpDec< sal_Int32 >( rName );
 }
 
 TokenAddress FormulaObject::dumpTokenAddress( bool bNameMode )
@@ -772,22 +737,22 @@ void FormulaObject::dumpMemAreaToken( co
         maAddData.push_back( ADDDATA_MEMAREA );
 }
 
-void FormulaObject::dumpExpToken( const StringWrapper& rName )
+void FormulaObject::dumpExpToken( const String& rName )
 {
     Address aPos;
     dumpRowIndex( "base-row" );
-    OUStringBuffer aOp( rName.getString() );
+    OUStringBuffer aOp( rName );
     StringHelper::appendIndex( aOp, createPlaceHolder() + out().getLastItemValue() );
     mxStack->pushOperand( aOp.makeStringAndClear() );
     maAddData.push_back( ADDDATA_EXP );
 }
 
-void FormulaObject::dumpUnaryOpToken( const StringWrapper& rLOp, const StringWrapper& rROp )
+void FormulaObject::dumpUnaryOpToken( const String& rLOp, const String& rROp )
 {
     mxStack->pushUnaryOp( rLOp, rROp );
 }
 
-void FormulaObject::dumpBinaryOpToken( const StringWrapper& rOp )
+void FormulaObject::dumpBinaryOpToken( const String& rOp )
 {
     mxStack->pushBinaryOp( rOp );
 }
@@ -916,10 +881,10 @@ void FormulaObject::dumpAddTokenData()
 {
     Output& rOut = out();
     rOut.resetItemIndex();
-    Input& rIn = in();
-    sal_Int32 nAddDataSize = (in().getSize() - in().tell() >= 4) ? dumpDec< sal_Int32 >( "add-data-size" ) : 0;
-    sal_Int64 nEndPos = ::std::min< sal_Int64 >( rIn.tell() + nAddDataSize, rIn.getSize() );
-    for( AddDataTypeVec::const_iterator aIt = maAddData.begin(), aEnd = maAddData.end(); (aIt != aEnd) && rIn.isValidPos() && (rIn.tell() < nEndPos); ++aIt )
+    BinaryInputStream& rStrm = in();
+    sal_Int32 nAddDataSize = (in().getLength() - in().tell() >= 4) ? dumpDec< sal_Int32 >( "add-data-size" ) : 0;
+    sal_Int64 nEndPos = ::std::min< sal_Int64 >( rStrm.tell() + nAddDataSize, rStrm.getLength() );
+    for( AddDataTypeVec::const_iterator aIt = maAddData.begin(), aEnd = maAddData.end(); (aIt != aEnd) && !rStrm.isEof() && (rStrm.tell() < nEndPos); ++aIt )
     {
         AddDataType eType = *aIt;
 
@@ -1018,61 +983,21 @@ OUString FormulaObject::dumpaddDataArray
 
 // ============================================================================
 
-RecordObject::RecordObject( OutputObjectBase& rParent )
+RecordStreamObject::RecordStreamObject( ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
 {
-    RecordObjectBase::construct( rParent );
+    RecordObjectBase::construct( rParent, rxStrm, rSysFileName );
     if( RecordObjectBase::implIsValid() )
-    {
         mxFmlaObj.reset( new FormulaObject( *this ) );
-        mxSimpleRecs = cfg().getNameList( "SIMPLE-RECORDS" );
-    }
 }
 
-void RecordObject::dumpRecord( const RecordDataSequence& rData, sal_Int32 nRecId )
-{
-    createRecordStream( rData );
-    mnRecId = nRecId;
-    dump();
-}
-
-bool RecordObject::implIsValid() const
+bool RecordStreamObject::implIsValid() const
 {
     return isValid( mxFmlaObj ) && RecordObjectBase::implIsValid();
 }
 
-void RecordObject::implDump()
-{
-    if( cfg().hasName( mxSimpleRecs, mnRecId ) )
-        dumpSimpleRecord( cfg().getName( mxSimpleRecs, mnRecId ) );
-    else
-        dumpRecordBody();
-
-    // remaining undumped data
-    RecordInputStream& rStrm = getRecordStream();
-    if( rStrm.getRecPos() == 0 )
-        dumpRawBinary( rStrm.getRecSize(), false );
-    else
-        dumpRemaining( rStrm.getRecLeft() );
-    if( !rStrm.isValid() )
-        writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
-}
-
-void RecordObject::dumpCellHeader( bool bWithColumn )
-{
-    if( bWithColumn ) dumpColIndex();
-    dumpHex< sal_uInt32 >( "xf-id", "CELL-XFID" );
-}
-
-void RecordObject::dumpSimpleRecord( const OUString& rRecData )
-{
-    ItemFormat aItemFmt;
-    aItemFmt.parse( rRecData );
-    dumpItem( aItemFmt );
-}
-
-void RecordObject::dumpRecordBody()
+void RecordStreamObject::implDumpRecordBody()
 {
-    switch( mnRecId )
+    switch( getRecId() )
     {
         case OOBIN_ID_ARRAY:
             dumpRange( "array-range" );
@@ -1212,11 +1137,11 @@ void RecordObject::dumpRecordBody()
             dumpDec< sal_Int32 >( "formula2-size" );
             dumpDec< sal_Int32 >( "formula3-size" );
             dumpString( "text" );
-            if( in().getSize() - in().tell() >= 8 )
+            if( in().getLength() - in().tell() >= 8 )
                 mxFmlaObj->dumpNameFormula( "formula1" );
-            if( in().getSize() - in().tell() >= 8 )
+            if( in().getLength() - in().tell() >= 8 )
                 mxFmlaObj->dumpNameFormula( "formula2" );
-            if( in().getSize() - in().tell() >= 8 )
+            if( in().getLength() - in().tell() >= 8 )
                 mxFmlaObj->dumpNameFormula( "formula3" );
         }
         break;
@@ -1272,6 +1197,12 @@ void RecordObject::dumpRecordBody()
             dumpRangeList();
         break;
 
+        case OOBIN_ID_CONTROL:
+            dumpDec< sal_Int32 >( "shape-id" );
+            dumpString( "rel-id" );
+            dumpString( "name" );
+        break;
+
         case OOBIN_ID_DATATABLE:
             dumpRange( "table-range" );
             dumpAddress( "ref1" );
@@ -1309,15 +1240,15 @@ void RecordObject::dumpRecordBody()
 
         case OOBIN_ID_DEFINEDNAME:
             dumpHex< sal_uInt32 >( "flags", "DEFINEDNAME-FLAGS" );
-            dumpHex< sal_uInt8 >( "keyboard-shortcut" );
+            dumpChar( "accelerator", RTL_TEXTENCODING_ISO_8859_1 );
             dumpDec< sal_Int32 >( "sheet-id", "DEFINEDNAME-SHEETID" );
             dumpString( "name" );
             mxFmlaObj->dumpNameFormula();
             dumpString( "comment" );
-            if( in().getSize() - in().tell() >= 4 ) dumpString( "menu-text" );
-            if( in().getSize() - in().tell() >= 4 ) dumpString( "description-text" );
-            if( in().getSize() - in().tell() >= 4 ) dumpString( "help-text" );
-            if( in().getSize() - in().tell() >= 4 ) dumpString( "statusbar-text" );
+            if( in().getLength() - in().tell() >= 4 ) dumpString( "menu-text" );
+            if( in().getLength() - in().tell() >= 4 ) dumpString( "description-text" );
+            if( in().getLength() - in().tell() >= 4 ) dumpString( "help-text" );
+            if( in().getLength() - in().tell() >= 4 ) dumpString( "statusbar-text" );
         break;
 
         case OOBIN_ID_DIMENSION:
@@ -1330,7 +1261,7 @@ void RecordObject::dumpRecordBody()
 
         case OOBIN_ID_DXF:
             dumpHex< sal_uInt32 >( "flags", "DXF-FLAGS" );
-            for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); in().isValidPos() && (nIndex < nCount); ++nIndex )
+            for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !in().isEof() && (nIndex < nCount); ++nIndex )
             {
                 out().startMultiItems();
                 sal_Int64 nStartPos = in().tell();
@@ -1445,9 +1376,7 @@ void RecordObject::dumpRecordBody()
                         dumpBoolean( "value" );
                     break;
                 }
-                if( in().tell() < nEndPos )
-                    dumpRemaining( static_cast< sal_Int32 >( nEndPos - in().tell() ) );
-                in().seek( nEndPos );
+                dumpRemainingTo( nEndPos );
             }
         break;
 
@@ -1508,7 +1437,7 @@ void RecordObject::dumpRecordBody()
             sal_Int32 nCount = dumpDec< sal_Int32 >( "ref-count" );
             TableGuard aTabGuard( out(), 13, 17, 24 );
             out().resetItemIndex();
-            for( sal_Int32 nRefId = 0; in().isValidPos() && (nRefId < nCount); ++nRefId )
+            for( sal_Int32 nRefId = 0; !in().isEof() && (nRefId < nCount); ++nRefId )
             {
                 MultiItemsGuard aMultiGuard( out() );
                 writeEmptyItem( "#ref" );
@@ -1530,7 +1459,7 @@ void RecordObject::dumpRecordBody()
 
         case OOBIN_ID_EXTSHEETNAMES:
             out().resetItemIndex();
-            for( sal_Int32 nSheet = 0, nCount = dumpDec< sal_Int32 >( "sheet-count" ); in().isValidPos() && (nSheet < nCount); ++nSheet )
+            for( sal_Int32 nSheet = 0, nCount = dumpDec< sal_Int32 >( "sheet-count" ); !in().isEof() && (nSheet < nCount); ++nSheet )
                 dumpString( "#sheet-name" );
         break;
 
@@ -1545,7 +1474,7 @@ void RecordObject::dumpRecordBody()
             dumpDec< double >( "pos-top" );
             dumpDec< double >( "pos-bottom" );
             out().resetItemIndex();
-            for( sal_Int32 nStop = 0, nStopCount = dumpDec< sal_Int32 >( "stop-count" ); (nStop < nStopCount) && in().isValidPos(); ++nStop )
+            for( sal_Int32 nStop = 0, nStopCount = dumpDec< sal_Int32 >( "stop-count" ); (nStop < nStopCount) && !in().isEof(); ++nStop )
             {
                 writeEmptyItem( "#stop" );
                 IndentGuard aIndGuard( out() );
@@ -1626,6 +1555,10 @@ void RecordObject::dumpRecordBody()
             dumpString( "display" );
         break;
 
+        case OOBIN_ID_LEGACYDRAWING:
+            dumpString( "rel-id" );
+        break;
+
         case OOBIN_ID_MERGECELL:
             dumpRange();
         break;
@@ -1674,6 +1607,20 @@ void RecordObject::dumpRecordBody()
             dumpString( "format" );
         break;
 
+        case OOBIN_ID_OLEOBJECT:
+        {
+            dumpDec< sal_Int32 >( "aspect", "OLEOBJECT-ASPECT" );
+            dumpDec< sal_Int32 >( "update", "OLEOBJECT-UPDATE" );
+            dumpDec< sal_Int32 >( "shape-id" );
+            sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "OLEOBJECT-FLAGS" );
+            dumpString( "prog-id" );
+            if( getFlag( nFlags, OOBIN_OLEOBJECT_LINKED ) )
+                mxFmlaObj->dumpNameFormula( "link" );
+            else
+                dumpString( "rel-id" );
+        }
+        break;
+
         case OOBIN_ID_PAGEMARGINS:
             dumpDec< double >( "left-margin" );
             dumpDec< double >( "right-margin" );
@@ -1721,7 +1668,7 @@ void RecordObject::dumpRecordBody()
             dumpHex< sal_uInt16 >( "flags", "ROW-FLAGS1" );
             dumpHex< sal_uInt8 >( "flags", "ROW-FLAGS2" );
             out().resetItemIndex();
-            for( sal_Int32 nSpan = 0, nSpanCount = dumpDec< sal_Int32 >( "row-spans-count" ); in().isValidPos() && (nSpan < nSpanCount); ++nSpan )
+            for( sal_Int32 nSpan = 0, nSpanCount = dumpDec< sal_Int32 >( "row-spans-count" ); !in().isEof() && (nSpan < nSpanCount); ++nSpan )
                 dumpRowRange( "#row-spans" );
         break;
 
@@ -1881,112 +1828,63 @@ void RecordObject::dumpRecordBody()
     }
 }
 
-// ============================================================================
-
-RecordHeaderObject::RecordHeaderObject( const InputObjectBase& rParent )
-{
-    static const RecordHeaderConfigInfo saHeaderCfgInfo =
-    {
-        "REC",
-        "RECORD-NAMES",
-        "show-record-pos",
-        "show-record-size",
-        "show-record-id",
-        "show-record-name",
-        "show-record-body",
-    };
-    RecordHeaderBase< sal_Int32, sal_Int32 >::construct( rParent, saHeaderCfgInfo );
-}
-
-RecordHeaderObject::~RecordHeaderObject()
-{
-}
-
-bool RecordHeaderObject::implReadHeader( sal_Int64& ornRecPos, sal_Int32& ornRecId, sal_Int32& ornRecSize )
-{
-    bool bValidRec = readCompressedInt( ornRecPos, ornRecId ) && (ornRecId >= 0) && readCompressedInt( ornRecPos, ornRecSize ) && (ornRecSize >= 0);
-    if( bValidRec )
-    {
-        maData.realloc( ornRecSize );
-        bValidRec = (ornRecSize == 0) || (in().read( maData.getArray(), ornRecSize ) == ornRecSize);
-        ornRecPos += ornRecSize;
-    }
-    return bValidRec;
-}
-
-bool RecordHeaderObject::readByte( sal_Int64& ornRecPos, sal_uInt8& ornByte )
-{
-    ++ornRecPos;
-    return in().read( &ornByte, 1 ) == 1;
-}
-
-bool RecordHeaderObject::readCompressedInt( sal_Int64& ornRecPos, sal_Int32& ornValue )
-{
-    ornValue = 0;
-    sal_uInt8 nByte;
-    if( !readByte( ornRecPos, nByte ) ) return false;
-    ornValue = nByte & 0x7F;
-    if( (nByte & 0x80) == 0 ) return true;
-    if( !readByte( ornRecPos, nByte ) ) return false;
-    ornValue |= sal_Int32( nByte & 0x7F ) << 7;
-    if( (nByte & 0x80) == 0 ) return true;
-    if( !readByte( ornRecPos, nByte ) ) return false;
-    ornValue |= sal_Int32( nByte & 0x7F ) << 14;
-    if( (nByte & 0x80) == 0 ) return true;
-    if( !readByte( ornRecPos, nByte ) ) return false;
-    ornValue |= sal_Int32( nByte & 0x7F ) << 21;
-    return true;
-}
-
-// ============================================================================
-
-RecordStreamObject::RecordStreamObject( const ObjectBase& rParent, const OUString& rOutFileName, BinaryInputStreamRef xStrm )
-{
-    InputStreamObject::construct( rParent, rOutFileName, xStrm );
-    if( InputStreamObject::implIsValid() )
-    {
-        mxHdrObj.reset( new RecordHeaderObject( *this ) );
-        mxRecObj.reset( new RecordObject( *this ) );
-    }
-}
-
-bool RecordStreamObject::implIsValid() const
-{
-    return isValid( mxHdrObj ) && isValid( mxRecObj ) && InputStreamObject::implIsValid();
-}
-
-void RecordStreamObject::implDump()
+void RecordStreamObject::dumpCellHeader( bool bWithColumn )
 {
-    while( mxHdrObj->startNextRecord() )
-    {
-        if( mxHdrObj->isShowRecBody() )
-        {
-            IndentGuard aIndGuard( out() );
-            mxRecObj->dumpRecord( mxHdrObj->getRecordData(), mxHdrObj->getRecId() );
-        }
-        out().emptyLine();
-    }
+    if( bWithColumn ) dumpColIndex();
+    dumpHex< sal_uInt32 >( "xf-id", "CELL-XFID" );
 }
 
 // ============================================================================
 
 RootStorageObject::RootStorageObject( const DumperBase& rParent )
 {
-    RootStorageObjectBase::construct( rParent );
+    StorageObjectBase::construct( rParent );
 }
 
-void RootStorageObject::implDumpStream( BinaryInputStreamRef xStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSystemFileName )
+void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
 {
     OUString aExt = InputOutputHelper::getFileNameExtension( rStrmName );
-    if( aExt.equalsIgnoreAsciiCaseAscii( "xml" ) ||
+    Reference< XInputStream > xInStrm = InputOutputHelper::getXInputStream( *rxStrm );
+    if(
+        aExt.equalsIgnoreAsciiCaseAscii( "xlsb" ) ||
+        aExt.equalsIgnoreAsciiCaseAscii( "xlsm" ) ||
+        aExt.equalsIgnoreAsciiCaseAscii( "xlsx" ) ||
+        aExt.equalsIgnoreAsciiCaseAscii( "xltm" ) ||
+        aExt.equalsIgnoreAsciiCaseAscii( "xltx" ) )
+    {
+        Dumper( getFactory(), xInStrm, rSysFileName ).dump();
+    }
+    else if(
+        aExt.equalsIgnoreAsciiCaseAscii( "xla" ) ||
+        aExt.equalsIgnoreAsciiCaseAscii( "xlc" ) ||
+        aExt.equalsIgnoreAsciiCaseAscii( "xlm" ) ||
+        aExt.equalsIgnoreAsciiCaseAscii( "xls" ) ||
+        aExt.equalsIgnoreAsciiCaseAscii( "xlt" ) ||
+        aExt.equalsIgnoreAsciiCaseAscii( "xlw" ) )
+    {
+        ::oox::dump::biff::Dumper( getFactory(), xInStrm, rSysFileName ).dump();
+    }
+    else if(
+        aExt.equalsIgnoreAsciiCaseAscii( "xml" ) ||
         aExt.equalsIgnoreAsciiCaseAscii( "vml" ) ||
         aExt.equalsIgnoreAsciiCaseAscii( "rels" ) )
     {
-        XmlStreamObject( *this, rSystemFileName, xStrm ).dump();
+        XmlStreamObject( *this, rxStrm, rSysFileName ).dump();
     }
     else if( aExt.equalsIgnoreAsciiCaseAscii( "bin" ) )
     {
-        if( rStrgPath.equalsAscii( "xl" ) ||
+        if( rStrgPath.equalsAscii( "xl" ) && rStrmName.equalsAscii( "vbaProject.bin" ) )
+        {
+            StorageRef xStrg( new OleStorage( getFactory(), xInStrm, false ) );
+            VbaProjectStorageObject( *this, xStrg, rSysFileName ).dump();
+        }
+        else if( rStrgPath.equalsAscii( "xl/embeddings" ) )
+        {
+            StorageRef xStrg( new OleStorage( getFactory(), xInStrm, false ) );
+            OleStorageObject( *this, xStrg, rSysFileName ).dump();
+        }
+        else if(
+            rStrgPath.equalsAscii( "xl" ) ||
             rStrgPath.equalsAscii( "xl/chartsheets" ) ||
             rStrgPath.equalsAscii( "xl/dialogsheets" ) ||
             rStrgPath.equalsAscii( "xl/externalLinks" ) ||
@@ -1994,17 +1892,33 @@ void RootStorageObject::implDumpStream( 
             rStrgPath.equalsAscii( "xl/tables" ) ||
             rStrgPath.equalsAscii( "xl/worksheets" ) )
         {
-            RecordStreamObject( *this, rSystemFileName, xStrm ).dump();
+            RecordStreamObject( *this, rxStrm, rSysFileName ).dump();
+        }
+        else
+        {
+            BinaryStreamObject( *this, rxStrm, rSysFileName ).dump();
         }
     }
 }
 
 // ============================================================================
 
+#define DUMP_XLSB_CONFIG_ENVVAR "OOO_XLSBDUMPER"
+
 Dumper::Dumper( const FilterBase& rFilter )
 {
-    ConfigRef xCfg( new Config( "OOO_XLSBDUMPER" ) );
-    DumperBase::construct( rFilter, xCfg );
+    ConfigRef xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR, rFilter ) );
+    DumperBase::construct( xCfg );
+}
+
+Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName )
+{
+    if( rxFactory.is() && rxInStrm.is() )
+    {
+        StorageRef xStrg( new ZipStorage( rxFactory, rxInStrm ) );
+        ConfigRef xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName ) );
+        DumperBase::construct( xCfg );
+    }
 }
 
 void Dumper::implDump()
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/dump/xlsbdumper.ini /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/xlsbdumper.ini
--- oox/source/dump/xlsbdumper.ini	1970-01-01 01:00:00.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/dump/xlsbdumper.ini	2008-09-30 16:51:36.000000000 +0200
@@ -0,0 +1,716 @@
+﻿
+# dumper settings ============================================================
+
+# Path to additional configuration data, relative to this file.
+include-config-file=dumperbase.ini
+include-config-file=oledumper.ini
+
+# Enable entire dumper (default=off). This option does not affect the option
+# 'enable-import'.
+#   0=off, 1=on, missing: setting from dumperbase.ini
+# enable-dumper=1
+
+# Enable import after dumping (default=on). Disabling this option allows
+# to dump a file without loading it. This option is independent from the
+# 'enable-dumper' option.
+#   0=off, 1=on, missing: setting from dumperbase.ini
+# enable-import=1
+
+# name lists =================================================================
+
+# common ---------------------------------------------------------------------
+
+unitconverter=CONV-TINT,/327.67,%
+unitconverter=CONV-COLWIDTH,/256,chars
+
+constlist=ERRORCODES
+  0x00=#NULL!
+  0x07=#DIV/0!
+  0x0F=#VALUE!
+  0x17=#REF!
+  0x1D=#NAME?
+  0x24=#NUM!
+  0x2A=#N/A
+end
+
+flagslist=STRING-FLAGS
+  0x01=rich-string
+  0x02=phonetic-text
+end
+
+combilist=CELL-XFID
+  0x00FFFFFF=int32,dec,xf-id
+  0x01000000=show-phonetic
+end
+
+combilist=PHONETIC-FLAGS
+  ignore=0x0030
+  0x0003=uint8,dec,type,PHONETICPR-TYPE
+  0x000C=uint8,dec,alignment,PHONETICPR-ALIGNMENT
+end
+
+shortlist=COLOR-TYPE,0,auto,indexed,rgb,theme
+
+combilist=COLOR-FLAGS
+  0x01=rgb-valid
+  0xFE=uint8,dec,type,COLOR-TYPE
+end
+
+multilist=PALETTE-COLORS
+  default=
+  0=ega-black,ega-white,ega-red,ega-green,ega-blue,ega-yellow,ega-magenta,ega-cyan
+  64=sys-window-text
+  65=sys-window-bg
+  67=sys-button-face
+  77=sys-window-text-chart
+  78=sys-window-bg-chart
+  79=auto-border-chart
+  80=sys-tooltip-bg
+  81=sys-tooltip-text
+end
+
+constlist=TEXTROTATION
+  default=
+  255=stacked
+end
+
+multilist=BORDERSTYLES
+  0=none,thin,medium,dash,dot
+  5=thick,double,hair,medium-dash,thin-dash-dot
+  10=medium-dash-dot,thin-dash-dot-dot,medium-dash-dot-dot,slant-dash-dot
+end
+
+multilist=FILLPATTERNS
+  0=no-fill,solid-fill,50%-grey,75%-grey,25%-grey
+  5=hor-stripe,ver-stripe,rev-diag-stripe,diag-stripe,diag-crosshatch
+  10=thick-diag-crosshatch,thin-hor-stripe,thin-ver-stripe,thin-rev-diag-stripe,thin-diag-stripe
+  15=thin-hor-crosshatch,thin-diag-crosshatch,12.5%-grey,6.25%-grey
+  40=gradient
+end
+
+# formulas -------------------------------------------------------------------
+
+flagslist=FORMULA-FLAGS
+  0x0002=recalc-always
+end
+
+multilist=BASETOKENS
+  0x00=,tExp,tTbl,tAdd,tSub,tMul,tDiv,tPower
+  0x08=tConcat,tLT,tLE,tEQ,tGE,tGT,tNE,tIsect
+  0x10=tList,tRange,tUplus,tUminus,tPercent,tParen,tMissArg,tStr
+  0x18=tTable,tAttr,,,tErr,tBool,tInt,tNum
+end
+
+constlist=TOKENCLASSES
+  0x20=R
+  0x40=V
+  0x60=A
+end
+
+multilist=CLASSTOKENS
+  0x00=tArray,tFunc,tFuncVar,tName,tRef,tArea,tMemArea,tMemErr
+  0x08=tMemNoMem,tMemFunc,tRefErr,tAreaErr,tRefN,tAreaN,tMemAreaN,tMemNoMemN
+  0x18=,tNameX,tRef3d,tArea3d,tRefErr3d,tAreaErr3d
+end
+
+combilist=FUNCID
+  0x7FFF=uint16,dec,func-id
+  0x8000=command
+end
+
+combilist=PARAMCOUNT-CMD
+  0x7F=uint8,dec,count
+  0x80=prompt
+end
+
+combilist=REFRELFLAGS
+  0x3FFF=uint16,dec,value
+  0x4000=col-rel
+  0x8000=row-rel
+end
+
+flagslist=TABLEFLAGS
+  0x0001=single-column
+  0x0002=column-range
+  0x0004=#all
+  0x0008=#headers
+  0x0010=#data
+  0x0020=#totals
+  0x0040=#this-row
+  0x0080=bracket-spaces
+  0x0100=sep-spaces
+  0x0200=single-row
+  0x0400=single-cell
+end
+
+flagslist=ATTRTYPES
+  0x01=volatile
+  0x02=if
+  0x04=choose
+  0x08=skip
+  0x10=sum
+  0x20=assign
+  0x40=space
+  0x80=iferror
+end
+
+shortlist=ATTRSPACETYPES,0,space-before-token,cr-before-token,space-before-open,cr-before-open,space-before-close,cr-before-close,leading-space
+
+shortlist=ARRAYVALUE-TYPE,0,number,string,boolean,,error
+
+# record names ---------------------------------------------------------------
+
+multilist=RECORD-NAMES
+  0x0000=ROW,CELL_BLANK,CELL_RK,CELL_ERROR,CELL_BOOL,CELL_DOUBLE,CELL_STRING,CELL_SI
+  0x0008=FORMULA_STRING,FORMULA_DOUBLE,FORMULA_BOOL,FORMULA_ERROR,MULTCELL_BLANK,MULTCELL_RK,MULTCELL_ERROR,MULTCELL_BOOL
+  0x0010=MULTCELL_DOUBLE,MULTCELL_STRING,MULTCELL_SI,SI,,,,
+
+  0x0020=,,,,,,,DEFINEDNAME
+  0x0028=BINARYINDEXROWS,,BINARYINDEXBLOCK,FONT,NUMFMT,FILL,BORDER,XF
+  0x0030=CELLSTYLE,,,,,,,
+  0x0038=,,,,COL,MULTCELL_RSTRING,CELL_RSTRING,CALCCHAINCELL
+  0x0040=DATAVALIDATION,,,,,,,
+
+  0x0080=FILEVERSION,WORKSHEET,WORKSHEET_END,WORKBOOK,WORKBOOK_END,SHEETVIEWS,SHEETVIEWS_END,BOOKVIEWS
+  0x0088=BOOKVIEWS_END,SHEETVIEW,SHEETVIEW_END,CHARTSHEETVIEWS,CHARTSHEETVIEWS_END,CHARTSHEETVIEW,CHARTSHEETVIEW_END,SHEETS
+  0x0090=SHEETS_END,SHEETDATA,SHEETDATA_END,SHEETPR,DIMENSION,,,PANE
+  0x0098=SELECTION,WORKBOOKPR,SMARTTAGPR,FILERECOVERYPR,SHEET,CALCPR,WORKBOOKVIEW,SST
+  0x00A0=SST_END,AUTOFILTER,AUTOFILTER_END,FILTERCOLUMN,FILTERCOLUMN_END,,,
+
+  0x00B0=,MERGECELLS,MERGECELLS_END,,,,,
+
+  0x0110=,,,,,BINARYINDEX_END,STYLESHEET,STYLESHEET_END
+
+  0x0150=,,,,,,,TABLE
+  0x0158=TABLE_END,TABLECOLUMNS,TABLECOLUMNS_END,TABLECOLUMN,TABLECOLUMN_END,,,CALCEDCOLUMNFMLA
+  0x0160=,EXTERNALREFS,EXTERNALREFS_END,EXTERNALREF,,EXTERNALSELF,EXTERNALSAME,EXTSHEETNAMES
+  0x0168=EXTERNALBOOK,,EXTERNALSHEETS,EXTSHEETDATA,EXTSHEETDATA_END,,EXTROW,EXTCELL_BLANK
+  0x0170=EXTCELL_DOUBLE,EXTCELL_BOOL,EXTCELL_ERROR,EXTCELL_STRING,,,,
+
+  0x0180=,,,,,,COLS,COLS_END
+  0x0188=ROWBREAKS,ROWBREAKS_END,COLBREAKS,COLBREAKS_END,BRK,CUSTOMWORKBOOKVIEW,,
+
+  0x01A0=,,,,,,CUSTOMSHEETVIEWS,CUSTOMSHEETVIEW
+  0x01A8=CUSTOMSHEETVIEW_END,CUSTOMSHEETVIEWS_END,ARRAY,SHAREDFMLA,DATATABLE,,,
+
+  0x01C8=,,,,,CONDFORMATTING,CONDFORMATTING_END,CFRULE
+  0x01D0=CFRULE_END,ICONSET,ICONSET_END,DATABAR,DATABAR_END,COLORSCALE,COLORSCALE_END,CFVO
+  0x01D8=,COLORS,COLORS_END,RGBCOLOR,PAGEMARGINS,PRINTOPTIONS,PAGESETUP,HEADERFOOTER
+  0x01E0=HEADERFOOTER_END,,,,,SHEETFORMATPR,,
+  0x01E8=,,,,,,HYPERLINK,
+
+  0x01F8=,DXFS,DXFS_END,DXF,TABLESTYLES,TABLESTYLES_END,,
+  0x0200=,TABLESTYLEINFO,VOLTYPES,VOLTYPES_END,VOLTYPE,VOLTYPE_END,VOLTYPEMAIN,VOLTYPEMAIN_END
+  0x0208=VOLTYPETP,VOLTYPETP_END,VOLTYPESTP,VOLTYPETR,,VOLTYPE_ERROR,,
+  0x0210=CALCCHAIN,CALCCHAIN_END,,,,,,SHEETPROTECTION
+  0x0218=,PHONETICPR,,,,,,
+  0x0220=,,,,,,DRAWING,LEGACYDRAWING
+
+  0x0230=,,PICTURE,,CFCOLOR,INDEXEDCOLORS,INDEXEDCOLORS_END,
+  0x0238=,MRUCOLORS,MRUCOLORS_END,,COLOR,DATAVALIDATIONS,DATAVALIDATIONS_END,
+  0x0240=,EXTERNALNAME,DDEITEMVALUES,DDEITEMVALUES_END,DDEITEM_DOUBLE,DDEITEM_ERROR,DDEITEM_STRING,DDEITEM_EMPTY
+  0x0248=DDEITEM_BOOL,EXTERNALNAMEREF,EXTERNALNAMEFLAGS,EXTERNALNAME_END,EXTERNALBOOK_END,,,
+
+  0x0258=,,,FILLS,FILLS_END,,,
+  0x0260=,,,FONTS,FONTS_END,BORDERS,BORDERS_END,NUMFMTS
+  0x0268=NUMFMTS_END,CELLXFS,CELLXFS_END,CELLSTYLES,CELLSTYLES_END,,,
+  0x0270=,,CELLSTYLEXFS,CELLSTYLEXFS_END
+  0x0278=,,,,,,OLEOBJECTS,OLEOBJECT
+  0x0280=OLEOBJECTS_END,,,CONTROLS,CONTROL,CONTROLS_END,,
+  0x0288=,,,CHARTSHEETPR,CHARTPAGESETUP,CUSTOMCHARTVIEWS,CUSTOMCHARTVIEWS_END,CUSTOMCHARTVIEW
+  0x0290=CUSTOMCHARTVIEW_END,,,,TABLEPARTS,TABLEPART,TABLEPARTS_END,SHEETCALCPR
+  0x0298=FUNCTIONGROUPS,FUNCTIONGROUP,FUNCTIONGROUPS_END,EXTERNALADDIN,,CHARTPROTECTION,,
+end
+
+# simple records -------------------------------------------------------------
+
+constlist=SIMPLE-RECORDS
+  0x0159=int32,dec,count
+  0x01DD=uint16,hex,flags,PRINTOPTIONS-FLAGS
+  0x01F9=int32,dec,count
+  0x0204=int32,dec,type,VOLTYPE-TYPE
+  0x020D=uint8,dec,error-code,ERRORCODES
+  0x0244=double,dec,value
+  0x0245=uint8,dec,error-code,ERRORCODES
+  0x0248=uint8,dec,value,BOOLEAN
+  0x025B=int32,dec,count
+  0x0263=int32,dec,count
+  0x0265=int32,dec,count
+  0x0267=int32,dec,count
+  0x0269=int32,dec,count
+  0x026B=int32,dec,count
+  0x0272=int32,dec,count
+  0x0294=int32,dec,count
+  0x0297=uint8,hex,flags,SHEETCALCPR-FLAGS
+  0x0298=uint8,dec,builtin-count
+end
+
+# ARRAY ----------------------------------------------------------------------
+
+flagslist=ARRAY-FLAGS
+  0x01=recalc-always
+end
+
+# BORDER ---------------------------------------------------------------------
+
+flagslist=BORDER-FLAGS
+  0x01=diag-tl-to-br
+  0x02=diag-bl-to-tr
+end
+
+# CALCPR ---------------------------------------------------------------------
+
+shortlist=CALCPR-CALCMODE,0,manual,auto,auto-no-tables
+
+flagslist=CALCPR-FLAGS
+  0x0001=calc-on-load
+  0x0002=a1
+  0x0004=iterate
+  0x0008=full-precision
+  0x0010=calc-complete
+  0x0020=calc-on-save
+  0x0040=concurrent
+  0x0080=manual-processors
+  0x0100=force-full-calc
+end
+
+# CELLSTYLE ------------------------------------------------------------------
+
+flagslist=CELLSTYLE-FLAGS
+  0x0001=builtin
+  0x0002=hidden
+  0x0004=custom
+end
+
+multilist=CELLSTYLE-BUILTIN
+  0=normal,rowlevel,collevel,comma,currency,percent,comma-0,currency-0,hyperlink,followed-hyperlink
+  10=note,warning-text,,,,title,heading-1,heading-2,heading-3,heading-4
+  20=input,output,calculation,check-cell,linked-cell,total,good,bad,neutral,accent1
+  30=20%-accent1,40%-accent1,60%-accent1,accent2,20%-accent2,40%-accent2,60%-accent2,accent3,20%-accent3,40%-accent3
+  40=60%-accent3,accent4,20%-accent4,40%-accent4,60%-accent4,accent5,20%-accent5,40%-accent5,60%-accent5,accent6
+  50=20%-accent6,40%-accent6,60%-accent6,explanatory-text
+end
+
+# CFRULE ---------------------------------------------------------------------
+
+shortlist=CFRULE-TYPE,1,cell-is,expression,color-scale,data-bar,top-ten,icon-set
+
+multilist=CFRULE-SUBTYPE
+  0=cell-is,expression,color-scale,data-bar,icon-set,top-ten,,unique-values,contains-text,contains-blanks
+  10=not-contains-blanks,contains-errors,not-contains-errors,,,today,tomorrow,yesterday,last-7-days,last-month
+  20=next-month,this-week,next-week,last-week,this-month,above-average,below-average,duplicate-values,,equal-above-average
+  30=equal-below-average
+end
+
+shortlist=CFRULE-CELL-OPERATOR,1,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
+shortlist=CFRULE-TEXT-OPERATOR,0,contains,not-contains,begins-with,ends-with
+shortlist=CFRULE-TIME-OPERATOR,0,today,yesterday,last-7-days,this-week,last-week,last-month,tomorrow,next-week,next-month,this-month
+shortlist=CFRULE-OTHER-OPERATOR,0,none
+
+flagslist=CFRULE-FLAGS
+  0x0001=table-row
+  0x0002=stop-if-true
+  0x0004=avove-average
+  0x0008=bottom
+  0x0010=percent
+end
+
+# CHARTPAGESETUP ------------------------------------------------------------------
+
+combilist=CHARTPAGESETUP-FLAGS
+  0x0001=landscape
+  0x0002=uninitialized
+  0x0004=black-and-white
+  0x0008=default-orientation
+  0x0010=use-first-page
+  0x0020=draft-quality
+end
+
+# CHARTSHEETPR ---------------------------------------------------------------
+
+flagslist=CHARTSHEETPR-FLAGS
+  0x0001=published
+end
+
+# CHARTSHEETVIEW -------------------------------------------------------------
+
+flagslist=CHARTSHEETVIEW-FLAGS
+  0x0001=selected
+  0x0002=zoom-to-fit
+end
+
+# COL ------------------------------------------------------------------------
+
+combilist=COL-FLAGS
+  0x0001=hidden
+  0x0002=custom-width
+  0x0004=best-fit
+  0x0008=show-phonetic
+  0x0700=uint8,dec,outline-level
+  0x1000=outline-collapsed
+end
+
+# DATATABLE ------------------------------------------------------------------
+
+flagslist=DATATABLE-FLAGS
+  0x01=row-table
+  0x02=table-2d
+  0x04=ref1-deleted
+  0x08=ref2-deleted
+  0x10=recalc-always
+end
+
+# DATAVALIDATION -------------------------------------------------------------
+
+combilist=DATAVALIDATION-FLAGS
+  0x0000000F=uint8,dec,type,DATAVALIDATION-TYPE
+  0x00000070=uint8,dec,error-style,DATAVALIDATION-ERRORSTYLE
+  0x00000080=string-list
+  0x00000100=ignore-empty
+  0x00000200=no-dropdown
+  0x00040000=show-input-box
+  0x00080000=show-error-box
+  0x00F00000=uint8,dec,operator,DATAVALIDATION-OPERATOR
+end
+
+shortlist=DATAVALIDATION-TYPE,0,any,whole,decimal,list,date,time,text-length,custom
+shortlist=DATAVALIDATION-OPERATOR,0,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
+shortlist=DATAVALIDATION-ERRORSTYLE,0,error,warning,info
+
+# DATAVALIDATIONS ------------------------------------------------------------
+
+combilist=DATAVALIDATIONS-FLAGS
+  0x0001=disable-prompts
+end
+
+# DEFINEDNAME ----------------------------------------------------------------
+
+combilist=DEFINEDNAME-FLAGS
+  0x00000001=hidden
+  0x00000002=function
+  0x00000004=vba
+  0x00000008=macro
+  0x00000010=complex
+  0x00000020=built-in
+  0x00007FC0=int32,dec,func-group,DEFINEDNAME-FUNCGROUP
+  0x00008000=published
+  0x00010000=workbook-param
+end
+
+shortlist=DEFINEDNAME-FUNCGROUP,0,none,financial,date-time,math-trig,statistical,lookup-ref,database,text,logical,information,commands,customizing,macro-control,dde-external,user-definded
+
+constlist=DEFINEDNAME-SHEETID
+  default=
+  -1=global
+end
+
+# DXF ------------------------------------------------------------------------
+
+flagslist=DXF-FLAGS
+  0x00008000=border-outline
+end
+
+multilist=DXF-SUBREC
+  0=FILL-PATTERN,FILL-FGCOLOR,FILL-BGCOLOR,FILL-GRADIENT,FILL-STOP
+  5=FONT-COLOR,BORDER-TOP,BORDER-BOTTOM,BORDER-LEFT,BORDER-RIGHT
+  10=BORDER-DIAGONAL,BORDER-VERTICAL,BORDER-HORIZONTAL,BORDER-DIAGUP,BORDER-DIAGDOWN
+  15=ALIGN-HORIZONTAL,ALIGN-VERTICAL,ALIGN-ROTATION,ALIGN-INDENT,ALIGN-READINGORDER
+  20=ALIGN-WRAPTEXT,ALIGN-JUSTLASTLINE,ALIGN-SHRINKTOFIT,,FONT-NAME
+  25=FONT-WEIGHT,FONT-UNDERLINE,FONT-ESCAPEMENT,FONT-ITALIC,FONT-STRIKE
+  30=FONT-OUTLINE,FONT-SHADOW,FONT-CONDENSE,FONT-EXTEND,FONT-CHARSET
+  35=FONT-PITCHFAMILY,FONT-HEIGHT,FONT-SCHEME,NUMFMT-CODE,
+  40=,NUMFMT-ID,ALIGN-RELINDENT,PROT-LOCKED,PROT-HIDDEN
+end
+
+# EXTERNALBOOK ---------------------------------------------------------------
+
+shortlist=EXTERNALBOOK-TYPE,0,book,dde-link,ole-link
+
+# EXTERNALNAMEFLAGS ----------------------------------------------------------
+
+flagslist=EXTERNALNAMEFLAGS-FLAGS
+  0x0002=automatic
+  0x0004=pic-link
+  0x0008=dde-stddocumentname
+  0x0010=ole-link
+  0x0020=iconified
+end
+
+# EXTERNALSHEETS -------------------------------------------------------------
+
+constlist=EXTERNALSHEETS-ID
+  default=
+  -1=deleted
+  -2=special
+end
+
+# EXTSHEETDATA ---------------------------------------------------------------
+
+flagslist=EXTSHEETDATA-FLAGS
+  0x01=refresh-error
+end
+
+# FILL -----------------------------------------------------------------------
+
+shortlist=FILL-GRADIENTTYPE,0,linear,path
+
+# FONT -----------------------------------------------------------------------
+
+flagslist=FONT-FLAGS
+  0x0001=bold
+  0x0002=italic
+  0x0004=underline
+  0x0008=strikeout
+  0x0010=outline
+  0x0020=shadow
+  0x0040=condense
+  0x0080=extend
+end
+
+multilist=FONT-UNDERLINE
+  0x00=none,single,double
+  0x21=single-acc,double-acc
+end
+
+shortlist=FONT-SCHEME,0,none,major,minor
+shortlist=FONT-ESCAPEMENT,0,none,superscript,subscript
+
+# HEADERFOOTER ---------------------------------------------------------------
+
+flagslist=HEADERFOOTER-FLAGS
+  0x0001=diff-odd-even
+  0x0002=diff-dirst
+  0x0004=scale-with-doc
+  0x0008=align-with-margins
+end
+
+# OLEOBJECT ------------------------------------------------------------------
+
+shortlist=OLEOBJECT-ASPECT,1,content,,,icon
+shortlist=OLEOBJECT-UPDATE,0,na,automatic,,manual
+
+flagslist=OLEOBJECT-FLAGS
+  0x0001=linked
+  0x0002=auto-load
+end
+
+# PAGESETUP ------------------------------------------------------------------
+
+multilist=PAGESETUP-PAPERSIZE
+  0=undefined,letter,letter-small,tabloid,ledger,legal,statement,executive,a3,a4
+  10=a4-small,a5,b4,b5,folio,quarto,10x14,11x17,note,envelope-9
+  20=envelope-10,envelope-11,envelope-12,envelope-14,c,d,e,envelope-dl,envelope-c5,envelope-c3
+  30=envelope-c4,envelope-c6,envelope-c65,envelope-b4,envelope-b5,envelope-b6,envelope-italy,envelope-monarch,envelope-6-3/4,us-standard-fanfold
+  40=german-standard-fanfold,german-legal-fanfold,b4,japanese-dbl-postcaed,9x11,10x11,15x11,,
+  50=envelope-invite,letter-extra,legal-extra,tabloid-extra,a4-extra,letter-transverse,a4-transverse,letter-extra-transverse,super-a-a4,super-b-a3,letter-plus
+  60=a4-plus,a5-transverse,jis-b5-transverse,a3-extra,a5-extra,b5-extra,a2,a3-transverse,a3-extra-transverse
+end
+
+constlist=PAGESETUP-SCALETOPAGES
+  default=
+  0=automatic
+end
+
+combilist=PAGESETUP-FLAGS
+  0x0001=print-in-rows
+  0x0002=landscape
+  0x0004=uninitialized
+  0x0008=black-and-white
+  0x0010=draft-quality
+  0x0020=print-notes
+  0x0040=default-orientation
+  0x0080=use-first-page
+  0x0100=print-notes-at-end
+  0x0600=uint8,dec,print-errors,PAGESETUP-PRINTERRORS
+end
+
+shortlist=PAGESETUP-PRINTERRORS,0,displayed,none,as-dashes,as-na
+
+unitconverter=PAGESETUP-DPI,1,dpi
+
+# PANE -----------------------------------------------------------------------
+
+shortlist=PANE-ID,0,bottom-right,top-right,bottom-left,top-left
+
+flagslist=PANE-FLAGS
+  0x01=frozen
+  0x02=remove-split-with-freeze
+end
+
+# PHONETICPR -----------------------------------------------------------------
+
+shortlist=PHONETICPR-TYPE,0,halfwidth-katakana,fullwidth-katakana,hiragana,no-conversion
+shortlist=PHONETICPR-ALIGNMENT,0,no-control,left,center,distributed
+
+# PRINTOPTIONS ---------------------------------------------------------------
+
+flagslist=PRINTOPTIONS-FLAGS
+  0x0001=horizontal-centered
+  0x0002=vertical-centered
+  0x0004=print-headings
+  0x0008=print-gridlines
+  0x0010=gridlines-set
+end
+
+# ROW ------------------------------------------------------------------------
+
+combilist=ROW-FLAGS1
+  0x0001=thick-top
+  0x0002=thick-bottom
+  0x0700=uint8,dec,outline-level
+  0x0800=outline-collapsed
+  0x1000=hidden
+  0x2000=custom-height
+  0x4000=custom-format
+end
+
+flagslist=ROW-FLAGS2
+  0x01=show-phonetic
+end
+
+# SHEET ----------------------------------------------------------------------
+
+shortlist=SHEET-STATE,0,visible,hidden,very-hidden
+
+# SHEETCALCPR ----------------------------------------------------------------
+
+flagslist=SHEETCALCPR-FLAGS
+  0x01=calc-on-load
+end
+
+# SHEETFORMATPR --------------------------------------------------------------
+
+flagslist=SHEETFORMATPR-FLAGS
+  0x0001=custom-row-height
+  0x0002=rows-hidden
+end
+
+# SHEETPR --------------------------------------------------------------------
+
+flagslist=SHEETPR-FLAGS1
+  0x0001=show-autopagebreaks
+  0x0008=published
+  0x0010=dialog-sheet
+  0x0020=outline-auto-style
+  0x0040=row-symbols-below
+  0x0080=column-symbols-right
+  0x0100=fit-to-pages
+  0x0400=show-outline-symbols
+  0x1000=is-row-synched
+  0x2000=is-col-synched
+  0x4000=lotus-formula-eval
+  0x8000=lotus-formula-entry
+end
+
+flagslist=SHEETPR-FLAGS2
+  0x01=is-filtered
+  0x02=eval-cond-formats
+end
+
+# SHEETVIEW ------------------------------------------------------------------
+
+flagslist=SHEETVIEW-FLAGS
+  0x0001=window-protected
+  0x0002=show-formulas
+  0x0004=show-gridlines
+  0x0008=show-headings
+  0x0010=show-zeros
+  0x0020=right-to-left
+  0x0040=selected
+  0x0080=show-ruler
+  0x0100=show-outline-symbols
+  0x0200=default-gridcolor
+  0x0400=show-whitespace
+end
+
+shortlist=SHEETVIEW-TYPE,0,normal,pagebreak-preview,page-layout
+
+# TABLE ----------------------------------------------------------------------
+
+shortlist=TABLE-TYPE,0,worksheet,,,query-table
+
+flagslist=TABLE-FLAGS
+  0x00000001=totals-row-shown
+  0x00000002=published
+  0x00000004=insert-row
+  0x00000008=insert-row-shift
+end
+
+# TABLESTYLEINFO -------------------------------------------------------------
+
+flagslist=TABLESTYLEINFO-FLAGS
+  0x0001=show-first-column
+  0x0002=show-last-column
+  0x0004=show-row-stripes
+  0x0008=show-column-stripes
+end
+
+# VOLTYPE --------------------------------------------------------------------
+
+shortlist=VOLTYPE-TYPE,0,realtime-data,olap-functions
+
+# WORKBBOKPR -----------------------------------------------------------------
+
+combilist=WORKBBOKPR-FLAGS
+  0x00000001=date-1904
+  0x00000004=hide-border-unsel-tables
+  0x00000008=filter-privacy
+  0x00000010=prompted-solutions
+  0x00000020=show-ink-annotation
+  0x00000040=backup-file
+  0x00000080=strip-extlink-values
+  0x00000300=uint8,dec,update-links,WORKBBOKPR-UPDATELINKS
+  0x00000400=hide-pivot-fieldlist
+  0x00000800=publish-items
+  0x00001000=check-compatibility
+  0x00006000=uint8,dec,show-objects,WORKBBOKPR-SHOWOBJECTS
+  0x00008000=show-pivotchart-filter
+  0x00010000=autocompress-pic
+  0x00020000=refresh-all-links
+end
+
+shortlist=WORKBBOKPR-UPDATELINKS,0,ask-user,never,always
+shortlist=WORKBBOKPR-SHOWOBJECTS,0,show,placeholder,hide
+
+# WORKBOOKVIEW ---------------------------------------------------------------
+
+flagslist=WORKBOOKVIEW-FLAGS
+  0x01=hidden
+  0x02=minimized
+  0x08=show-horizontal-scroll
+  0x10=show-vertical-scroll
+  0x20=show-tabbar
+  0x40=autofilter-date-grouping
+end
+
+# XF -------------------------------------------------------------------------
+
+shortlist=XF-HORALIGN,0,general,left,center,right,fill,block,center-across-sel,distribute
+shortlist=XF-VERALIGN,0,top,center,bottom,justify,distribute
+shortlist=XF-TEXTDIRECTION,0,context,left-to-right,right-to-left
+
+combilist=XF-ALIGNMENT
+  0x000000FF=uint8,dec,rotation,TEXTROTATION
+  0x0000FF00=uint8,dec,indent
+  0x00070000=uint8,dec,hor-align,XF-HORALIGN
+  0x00380000=uint8,dec,ver-align,XF-VERALIGN
+  0x00400000=text-wrap
+  0x00800000=justify-lastline
+  0x01000000=shrink-to-fit
+  0x0C000000=uint8,dec,text-dir,XF-TEXTDIRECTION
+  0x10000000=locked
+  0x20000000=formula-hidden
+  0x80000000=quote-prefix
+end
+
+flagslist=XF-USEDFLAGS
+  0x0001=format
+  0x0002=font
+  0x0004=alignment
+  0x0008=border
+  0x0010=fill
+  0x0020=protection
+end
+
+# ============================================================================
+
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/helper/binaryinputstream.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/binaryinputstream.cxx
--- oox/source/helper/binaryinputstream.cxx	2008-04-10 17:42:05.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/binaryinputstream.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -29,77 +29,149 @@
  ************************************************************************/
 
 #include "oox/helper/binaryinputstream.hxx"
-#include <com/sun/star/io/XInputStream.hpp>
 #include <osl/diagnose.h>
 #include <string.h>
 
+using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
 using ::com::sun::star::uno::Exception;
 using ::com::sun::star::io::XInputStream;
+using ::com::sun::star::io::XSeekable;
 
 namespace oox {
 
+const sal_Int32 INPUTSTREAM_BUFFERSIZE      = 0x8000;
+
+// ============================================================================
+
+void BinaryInputStream::readAtom( void* opMem, sal_uInt8 nSize )
+{
+    readMemory( opMem, nSize );
+}
+
 // ============================================================================
 
-BinaryInputStream::BinaryInputStream( const Reference< XInputStream >& rxInStrm, bool bAutoClose ) :
-    BinaryStreamBase( rxInStrm ),
+BinaryXInputStream::BinaryXInputStream( const Reference< XInputStream >& rxInStrm, bool bAutoClose ) :
+    BinaryXSeekableStream( Reference< XSeekable >( rxInStrm, UNO_QUERY ) ),
+    maBuffer( INPUTSTREAM_BUFFERSIZE ),
     mxInStrm( rxInStrm ),
     mbAutoClose( bAutoClose )
 {
+    mbEof = !mxInStrm.is();
 }
 
-BinaryInputStream::~BinaryInputStream()
+BinaryXInputStream::~BinaryXInputStream()
 {
     if( mbAutoClose )
         close();
 }
 
-void BinaryInputStream::skip( sal_Int32 nBytes )
+sal_Int32 BinaryXInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes )
 {
-    try
+    sal_Int32 nRet = 0;
+    if( !mbEof && (nBytes > 0) ) try
     {
-        OSL_ENSURE( mxInStrm.is(), "BinaryInputStream::skip - invalid call" );
-        mxInStrm->skipBytes( nBytes );
+        OSL_ENSURE( mxInStrm.is(), "BinaryXInputStream::readData - invalid call" );
+        nRet = mxInStrm->readBytes( orData, nBytes );
+        mbEof = nRet != nBytes;
     }
     catch( Exception& )
     {
-        OSL_ENSURE( false, "BinaryInputStream::skip - exception caught" );
+        mbEof = true;
     }
+    return nRet;
 }
 
-sal_Int32 BinaryInputStream::read( Sequence< sal_Int8 >& orBuffer, sal_Int32 nBytes )
+sal_Int32 BinaryXInputStream::readMemory( void* opMem, sal_Int32 nBytes )
 {
     sal_Int32 nRet = 0;
-    try
+    if( !mbEof && (nBytes > 0) )
     {
-        OSL_ENSURE( mxInStrm.is(), "BinaryInputStream::read - invalid call" );
-        nRet = mxInStrm->readBytes( orBuffer, nBytes );
+        sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, INPUTSTREAM_BUFFERSIZE );
+        sal_uInt8* opnMem = reinterpret_cast< sal_uInt8* >( opMem );
+        while( !mbEof && (nBytes > 0) )
+        {
+            sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, nBufferSize );
+            sal_Int32 nBytesRead = readData( maBuffer, nReadSize );
+            if( nBytesRead > 0 )
+                memcpy( opnMem, maBuffer.getConstArray(), static_cast< size_t >( nBytesRead ) );
+            opnMem += nBytesRead;
+            nBytes -= nBytesRead;
+            nRet += nBytesRead;
     }
-    catch( Exception& )
-    {
-        OSL_ENSURE( false, "BinaryInputStream::read - stream read error" );
     }
     return nRet;
 }
 
-sal_Int32 BinaryInputStream::read( void* opBuffer, sal_Int32 nBytes )
+void BinaryXInputStream::skip( sal_Int32 nBytes )
 {
-    sal_Int32 nRet = read( maBuffer, nBytes );
-    if( nRet > 0 )
-        memcpy( opBuffer, maBuffer.getConstArray(), static_cast< size_t >( nRet ) );
-    return nRet;
+    if( !mbEof ) try
+    {
+        OSL_ENSURE( mxInStrm.is(), "BinaryXInputStream::skip - invalid call" );
+        mxInStrm->skipBytes( nBytes );
+    }
+    catch( Exception& )
+    {
+        mbEof = true;
+    }
 }
 
-void BinaryInputStream::close()
+void BinaryXInputStream::close()
 {
     if( mxInStrm.is() ) try
     {
         mxInStrm->closeInput();
+        mxInStrm.clear();
     }
     catch( Exception& )
     {
-        OSL_ENSURE( false, "BinaryInputStream::close - closing input stream failed" );
+        OSL_ENSURE( false, "BinaryXInputStream::close - closing input stream failed" );
+    }
+}
+
+// ============================================================================
+
+SequenceInputStream::SequenceInputStream( StreamDataSequence& rData ) :
+    SequenceSeekableStream( rData )
+{
+}
+
+sal_Int32 SequenceInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes )
+{
+    sal_Int32 nReadBytes = 0;
+    if( !mbEof )
+    {
+        nReadBytes = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, mrData.getLength() - mnPos );
+        orData.realloc( nReadBytes );
+        if( nReadBytes > 0 )
+            memcpy( orData.getArray(), mrData.getConstArray() + mnPos, static_cast< size_t >( nReadBytes ) );
+        mnPos += nReadBytes;
+        mbEof = nReadBytes < nBytes;
+    }
+    return nReadBytes;
+}
+
+sal_Int32 SequenceInputStream::readMemory( void* opMem, sal_Int32 nBytes )
+{
+    sal_Int32 nReadBytes = 0;
+    if( !mbEof )
+    {
+        nReadBytes = ::std::min< sal_Int32 >( nBytes, mrData.getLength() - mnPos );
+        if( nReadBytes > 0 )
+            memcpy( opMem, mrData.getConstArray() + mnPos, static_cast< size_t >( nReadBytes ) );
+        mnPos += nReadBytes;
+        mbEof = nReadBytes < nBytes;
+    }
+    return nReadBytes;
+}
+
+void SequenceInputStream::skip( sal_Int32 nBytes )
+{
+    if( !mbEof )
+    {
+        sal_Int32 nSkipBytes = ::std::min< sal_Int32 >( nBytes, mrData.getLength() - mnPos );
+        mnPos += nSkipBytes;
+        mbEof = nSkipBytes < nBytes;
     }
 }
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/helper/binaryoutputstream.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/binaryoutputstream.cxx
--- oox/source/helper/binaryoutputstream.cxx	2008-04-10 17:42:20.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/binaryoutputstream.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -30,75 +30,94 @@
 
 #include "oox/helper/binaryoutputstream.hxx"
 #include <osl/diagnose.h>
-#include <com/sun/star/io/XOutputStream.hpp>
 #include "oox/helper/binaryinputstream.hxx"
 #include <string.h>
 
+using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
 using ::com::sun::star::uno::Exception;
 using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XSeekable;
 
 namespace oox {
 
+const sal_Int32 OUTPUTSTREAM_BUFFERSIZE     = 0x8000;
+
+// ============================================================================
+
+void BinaryOutputStream::copyStream( BinaryInputStream& rInStrm, sal_Int64 nBytes )
+{
+    if( nBytes > 0 )
+    {
+        sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, OUTPUTSTREAM_BUFFERSIZE );
+        StreamDataSequence aBuffer( nBufferSize );
+        while( nBytes > 0 )
+        {
+            sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, nBufferSize );
+            sal_Int32 nBytesRead = rInStrm.readData( aBuffer, nReadSize );
+            writeData( aBuffer );
+            if( nReadSize == nBytesRead )
+                nBytes -= nReadSize;
+            else
+                nBytes = 0;
+        }
+    }
+}
+
+void BinaryOutputStream::writeAtom( const void* pMem, sal_uInt8 nSize )
+{
+    writeMemory( pMem, nSize );
+}
+
 // ============================================================================
 
-BinaryOutputStream::BinaryOutputStream( const Reference< XOutputStream >& rxOutStrm, bool bAutoClose ) :
-    BinaryStreamBase( rxOutStrm ),
+BinaryXOutputStream::BinaryXOutputStream( const Reference< XOutputStream >& rxOutStrm, bool bAutoClose ) :
+    BinaryXSeekableStream( Reference< XSeekable >( rxOutStrm, UNO_QUERY ) ),
+    maBuffer( OUTPUTSTREAM_BUFFERSIZE ),
     mxOutStrm( rxOutStrm ),
     mbAutoClose( bAutoClose )
 {
+    mbEof = !mxOutStrm.is();
 }
 
-BinaryOutputStream::~BinaryOutputStream()
+BinaryXOutputStream::~BinaryXOutputStream()
 {
     if( mbAutoClose )
         close();
 }
 
-void BinaryOutputStream::write( const Sequence< sal_Int8 >& rBuffer )
+void BinaryXOutputStream::writeData( const StreamDataSequence& rData )
 {
     try
     {
-        OSL_ENSURE( mxOutStrm.is(), "BinaryOutputStream::write - invalid call" );
-        mxOutStrm->writeBytes( rBuffer );
+        OSL_ENSURE( mxOutStrm.is(), "BinaryXOutputStream::writeData - invalid call" );
+        mxOutStrm->writeBytes( rData );
     }
     catch( Exception& )
     {
-        OSL_ENSURE( false, "BinaryOutputStream::write - stream read error" );
+        OSL_ENSURE( false, "BinaryXOutputStream::writeData - stream read error" );
     }
 }
 
-void BinaryOutputStream::write( const void* pBuffer, sal_Int32 nBytes )
+void BinaryXOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes )
 {
     if( nBytes > 0 )
     {
-        maBuffer.realloc( nBytes );
-        memcpy( maBuffer.getArray(), pBuffer, static_cast< size_t >( nBytes ) );
-        write( maBuffer );
-    }
-}
-
-void BinaryOutputStream::copy( BinaryInputStream& rInStrm, sal_Int64 nBytes )
-{
-    if( rInStrm.is() && (nBytes > 0) )
-    {
-        sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, 0x8000 );
-        Sequence< sal_Int8 > aBuffer( nBufferSize );
+        sal_Int32 nBufferSize = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, OUTPUTSTREAM_BUFFERSIZE );
+        const sal_uInt8* pnMem = reinterpret_cast< const sal_uInt8* >( pMem );
         while( nBytes > 0 )
         {
-            sal_Int32 nReadSize = getLimitedValue< sal_Int32, sal_Int64 >( nBytes, 0, nBufferSize );
-            sal_Int32 nBytesRead = rInStrm.read( aBuffer, nReadSize );
-            write( aBuffer );
-            if( nReadSize == nBytesRead )
-                nBytes -= nReadSize;
-            else
-                nBytes = 0;
+            sal_Int32 nWriteSize = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, nBufferSize );
+            maBuffer.realloc( nWriteSize );
+            memcpy( maBuffer.getArray(), pnMem, static_cast< size_t >( nWriteSize ) );
+            writeData( maBuffer );
+            pnMem += nWriteSize;
+            nBytes -= nWriteSize;
         }
     }
 }
 
-void BinaryOutputStream::close()
+void BinaryXOutputStream::close()
 {
     if( mxOutStrm.is() ) try
     {
@@ -107,7 +126,31 @@ void BinaryOutputStream::close()
     }
     catch( Exception& )
     {
-        OSL_ENSURE( false, "BinaryOutputStream::close - closing output stream failed" );
+        OSL_ENSURE( false, "BinaryXOutputStream::close - closing output stream failed" );
+    }
+}
+
+// ============================================================================
+
+SequenceOutputStream::SequenceOutputStream( StreamDataSequence& rData ) :
+    SequenceSeekableStream( rData )
+{
+}
+
+void SequenceOutputStream::writeData( const StreamDataSequence& rData )
+{
+    if( rData.hasElements() )
+        writeMemory( rData.getConstArray(), rData.getLength() );
+}
+
+void SequenceOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes )
+{
+    if( nBytes > 0 )
+    {
+        if( mrData.getLength() - mnPos < nBytes )
+            mrData.realloc( mnPos + nBytes );
+        memcpy( mrData.getArray() + mnPos, pMem, static_cast< size_t >( nBytes ) );
+        mnPos += nBytes;
     }
 }
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/helper/binarystreambase.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/binarystreambase.cxx
--- oox/source/helper/binarystreambase.cxx	2008-04-10 17:42:35.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/binarystreambase.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -31,7 +31,9 @@
 #include "oox/helper/binarystreambase.hxx"
 #include <osl/diagnose.h>
 
+using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::Exception;
+using ::com::sun::star::io::XSeekable;
 
 namespace oox {
 
@@ -41,43 +43,102 @@ BinaryStreamBase::~BinaryStreamBase()
 {
 }
 
+bool BinaryStreamBase::isSeekable() const
+{
+    return false;
+}
+
 sal_Int64 BinaryStreamBase::getLength() const
 {
-    try
+    return -1;
+}
+
+sal_Int64 BinaryStreamBase::tell() const
+{
+    return -1;
+}
+
+void BinaryStreamBase::seek( sal_Int64 )
     {
-        return mxSeekable.is() ? mxSeekable->getLength() : -1;
+}
+
+sal_Int64 BinaryStreamBase::getRemaining() const
+{
+    return isSeekable() ? ::std::max< sal_Int64 >( getLength() - tell(), 0 ) : -1;
+}
+
+// ============================================================================
+
+BinaryXSeekableStream::BinaryXSeekableStream( const Reference< XSeekable >& rxSeekable ) :
+    mxSeekable( rxSeekable )
+{
+}
+
+bool BinaryXSeekableStream::isSeekable() const
+{
+    return mxSeekable.is();
+}
+
+sal_Int64 BinaryXSeekableStream::getLength() const
+{
+    if( mxSeekable.is() ) try
+    {
+        return mxSeekable->getLength();
     }
     catch( Exception& )
     {
-        OSL_ENSURE( false, "BinaryStreamBase::getLength - exception caught" );
+        OSL_ENSURE( false, "BinaryXSeekableStream::getLength - exception caught" );
     }
     return -1;
 }
 
-sal_Int64 BinaryStreamBase::tell() const
+sal_Int64 BinaryXSeekableStream::tell() const
 {
-    try
+    if( mxSeekable.is() ) try
     {
-        return mxSeekable.is() ? mxSeekable->getPosition() : -1;
+        return mxSeekable->getPosition();
     }
     catch( Exception& )
     {
-        OSL_ENSURE( false, "BinaryStreamBase::tell - exception caught" );
+        OSL_ENSURE( false, "BinaryXSeekableStream::tell - exception caught" );
     }
     return -1;
 }
 
-void BinaryStreamBase::seek( sal_Int64 nPos )
+void BinaryXSeekableStream::seek( sal_Int64 nPos )
 {
-    try
+    if( mxSeekable.is() ) try
     {
-        if( mxSeekable.is() )
+        mbEof = false;
             mxSeekable->seek( nPos );
     }
     catch( Exception& )
     {
-        OSL_ENSURE( false, "BinaryStreamBase::seek - exception caught" );
+        mbEof = true;
+    }
+}
+
+// ============================================================================
+
+bool SequenceSeekableStream::isSeekable() const
+{
+    return true;
+}
+
+sal_Int64 SequenceSeekableStream::getLength() const
+{
+    return mrData.getLength();
     }
+
+sal_Int64 SequenceSeekableStream::tell() const
+{
+    return mnPos;
+}
+
+void SequenceSeekableStream::seek( sal_Int64 nPos )
+{
+    mnPos = getLimitedValue< sal_Int32, sal_Int64 >( nPos, 0, mrData.getLength() );
+    mbEof = mnPos < nPos;
 }
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/helper/containerhelper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/containerhelper.cxx
--- oox/source/helper/containerhelper.cxx	2008-07-22 16:00:42.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/containerhelper.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -33,7 +33,6 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/container/XIndexContainer.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
-#include <comphelper/processfactory.hxx>
 #include "oox/helper/helper.hxx"
 
 using ::rtl::OUString;
@@ -52,13 +51,12 @@ namespace oox {
 
 // ============================================================================
 
-Reference< XIndexContainer > ContainerHelper::createIndexContainer()
+Reference< XIndexContainer > ContainerHelper::createIndexContainer( const Reference< XMultiServiceFactory >& rxFactory )
 {
     Reference< XIndexContainer > xContainer;
-    try
+    if( rxFactory.is() ) try
     {
-        Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-        xContainer.set( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.document.IndexedPropertyValues" ) ), UNO_QUERY_THROW );
+        xContainer.set( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.document.IndexedPropertyValues" ) ), UNO_QUERY_THROW );
     }
     catch( Exception& )
     {
@@ -85,13 +83,12 @@ bool ContainerHelper::insertByIndex(
     return bRet;
 }
 
-Reference< XNameContainer > ContainerHelper::createNameContainer()
+Reference< XNameContainer > ContainerHelper::createNameContainer( const Reference< XMultiServiceFactory >& rxFactory )
 {
     Reference< XNameContainer > xContainer;
-    try
+    if( rxFactory.is() ) try
     {
-        Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-        xContainer.set( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.document.NamedPropertyValues" ) ), UNO_QUERY_THROW );
+        xContainer.set( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.document.NamedPropertyValues" ) ), UNO_QUERY_THROW );
     }
     catch( Exception& )
     {
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/helper/olestorage.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/olestorage.cxx
--- oox/source/helper/olestorage.cxx	2008-07-01 14:15:00.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/olestorage.cxx	2009-01-06 14:16:56.000000000 +0100
@@ -34,6 +34,7 @@
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XStream.hpp>
 #include "oox/helper/helper.hxx"
 
 using ::rtl::OUString;
@@ -49,6 +50,7 @@ using ::com::sun::star::beans::PropertyV
 using ::com::sun::star::embed::XStorage;
 using ::com::sun::star::io::XInputStream;
 using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
 
 namespace oox {
 
@@ -72,9 +74,9 @@ OleStorage::OleStorage(
 
 OleStorage::OleStorage(
         const Reference< XMultiServiceFactory >& rxFactory,
-        const Reference< XOutputStream >& rxOutStream,
+        const Reference< XStream >& rxStream,
         bool bBaseStreamAccess ) :
-    StorageBase( rxOutStream, bBaseStreamAccess )
+    StorageBase( rxStream, bBaseStreamAccess )
 {
     OSL_ENSURE( rxFactory.is(), "OleStorage::OleStorage - missing service factory" );
     (void)rxFactory;    // prevent compiler warning
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/helper/recordinputstream.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/recordinputstream.cxx
--- oox/source/helper/recordinputstream.cxx	2008-04-10 17:44:49.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/recordinputstream.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -38,36 +38,24 @@ namespace oox {
 
 // ============================================================================
 
-RecordInputStream::RecordInputStream( const RecordDataSequence& rData ) :
-    maData( rData ),
-    mnRecSize( rData.getLength() ),
-    mnRecPos( 0 ),
-    mbValid( true )
+RecordInputStream::RecordInputStream( StreamDataSequence& rData ) :
+    SequenceInputStream( rData )
 {
 }
 
-sal_Int32 RecordInputStream::read( void* opData, sal_Int32 nBytes )
-{
-    sal_Int32 nReadSize = ::std::min( nBytes, getRecLeft() );
-    OSL_ENSURE( !mbValid || (nReadSize == nBytes), "RecordInputStream::read - buffer overflow" );
-    mbValid = nReadSize == nBytes;
-    if( mbValid && opData && (nReadSize > 0) )
-        memcpy( opData, maData.getConstArray() + mnRecPos, nReadSize );
-    mnRecPos += nReadSize;
-    return nReadSize;
-}
-
 OUString RecordInputStream::readString( bool b32BitLen )
 {
     OUString aString;
+    if( !isEof() )
+    {
     sal_Int32 nCharCount = b32BitLen ? readValue< sal_Int32 >() : readValue< sal_Int16 >();
     // string length -1 is often used to indicate a missing string
-    OSL_ENSURE( !mbValid || (nCharCount >= -1), "RecordInputStream::readString - invalid string length" );
-    if( mbValid && (nCharCount >= 0) )
+        OSL_ENSURE( !isEof() && (nCharCount >= -1), "RecordInputStream::readString - invalid string length" );
+        if( !isEof() && (nCharCount > 0) )
     {
         ::std::vector< sal_Unicode > aBuffer;
         aBuffer.reserve( getLimitedValue< size_t, sal_Int32 >( nCharCount + 1, 0, 0xFFFF ) );
-        for( sal_Int32 nCharIdx = 0; mbValid && (nCharIdx < nCharCount); ++nCharIdx )
+            for( sal_Int32 nCharIdx = 0; !isEof() && (nCharIdx < nCharCount); ++nCharIdx )
         {
             sal_uInt16 nChar;
             readValue( nChar );
@@ -76,22 +64,8 @@ OUString RecordInputStream::readString( 
         aBuffer.push_back( 0 );
         aString = OUString( &aBuffer.front() );
     }
-    return aString;
 }
-
-void RecordInputStream::seek( sal_Int32 nRecPos )
-{
-    mnRecPos = getLimitedValue< sal_Int32, sal_Int32 >( nRecPos, 0, mnRecSize );
-    OSL_ENSURE( !mbValid || (nRecPos == mnRecPos), "RecordInputStream::seek - invalid position" );
-    mbValid = nRecPos == mnRecPos;
-}
-
-void RecordInputStream::skip( sal_Int32 nBytes )
-{
-    sal_Int32 nSkipSize = getLimitedValue< sal_Int32, sal_Int32 >( nBytes, 0, getRecLeft() );
-    OSL_ENSURE( !mbValid || (nSkipSize == nBytes), "RecordInputStream::skip - buffer overflow" );
-    mbValid = nSkipSize == nBytes;
-    mnRecPos += nSkipSize;
+    return aString;
 }
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/helper/storagebase.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/storagebase.cxx
--- oox/source/helper/storagebase.cxx	2008-04-10 17:45:03.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/storagebase.cxx	2009-01-06 14:16:56.000000000 +0100
@@ -29,14 +29,19 @@
  ************************************************************************/
 
 #include "oox/helper/storagebase.hxx"
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
 #include <rtl/ustrbuf.hxx>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
 using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::embed::XStorage;
+using ::com::sun::star::embed::XTransactedObject;
 using ::com::sun::star::io::XInputStream;
 using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
 
 namespace oox {
 
@@ -70,12 +75,12 @@ StorageBase::StorageBase( const Referenc
     OSL_ENSURE( mxInStream.is(), "StorageBase::StorageBase - missing base input stream" );
 }
 
-StorageBase::StorageBase( const Reference< XOutputStream >& rxOutStream, bool bBaseStreamAccess ) :
-    mxOutStream( rxOutStream ),
+StorageBase::StorageBase( const Reference< XStream >& rxStream, bool bBaseStreamAccess ) :
+    mxStream( rxStream ),
     mpParentStorage( 0 ),
     mbBaseStreamAccess( bBaseStreamAccess )
 {
-    OSL_ENSURE( mxOutStream.is(), "StorageBase::StorageBase - missing base output stream" );
+    OSL_ENSURE( mxStream.is(), "StorageBase::StorageBase - missing base output stream" );
 }
 
 StorageBase::StorageBase( const StorageBase& rParentStorage, const OUString& rStorageName ) :
@@ -178,7 +183,7 @@ Reference< XOutputStream > StorageBase::
     }
     else if( mbBaseStreamAccess )
     {
-        xOutStream = mxOutStream;
+        xOutStream = mxStream->getOutputStream();
     }
     return xOutStream;
 }
@@ -190,6 +195,17 @@ StorageRef StorageBase::getSubStorage( c
         (maSubStorages[ rElementName ] = implOpenSubStorage( rElementName, bCreate )) : aIt->second;
 }
 
+void StorageBase::commit()
+{
+    for( SubStorageMap::iterator aIt = maSubStorages.begin(); aIt != maSubStorages.end(); aIt ++ )
+        aIt->second->commit();
+
+    Reference< XTransactedObject > xTransactedObj( getXStorage(), UNO_QUERY );
+
+    if( xTransactedObj.is() )
+        xTransactedObj->commit();
+}
+
 // ============================================================================
 
 } // namespace oox
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/helper/zipstorage.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/zipstorage.cxx
--- oox/source/helper/zipstorage.cxx	2008-07-31 21:23:46.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/helper/zipstorage.cxx	2009-01-06 14:16:56.000000000 +0100
@@ -29,8 +29,10 @@
  ************************************************************************/
 
 #include "oox/helper/zipstorage.hxx"
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <comphelper/storagehelper.hxx>
@@ -46,6 +48,7 @@ using ::com::sun::star::lang::XMultiServ
 using ::com::sun::star::embed::XStorage;
 using ::com::sun::star::io::XInputStream;
 using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XStream;
 
 namespace oox {
 
@@ -69,12 +72,23 @@ ZipStorage::ZipStorage(
 
 ZipStorage::ZipStorage(
         const Reference< XMultiServiceFactory >& rxFactory,
-        const Reference< XOutputStream >& rxOutStream ) :
-    StorageBase( rxOutStream, false )
+        const Reference< XStream >& rxStream ) :
+    StorageBase( rxStream, false )
 {
     OSL_ENSURE( rxFactory.is(), "ZipStorage::ZipStorage - missing service factory" );
-    (void)rxFactory;   // prevent compiler warning
-    OSL_ENSURE( false, "ZipStorage::ZipStorage - not implemented" );
+    // create base storage object
+    try
+    {
+        mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OFOPXMLFormat" ) ),
+                                                                                rxStream,
+                                                                                com::sun::star::embed::ElementModes::READWRITE
+                                                                                | com::sun::star::embed::ElementModes::TRUNCATE,
+                                                                                rxFactory );
+    }
+    catch( Exception& )
+    {
+        OSL_ENSURE( false, "ZipStorage::ZipStorage - cannot open output storage" );
+    }
 }
 
 ZipStorage::ZipStorage( const ZipStorage& rParentStorage, const Reference< XStorage >& rxStorage, const OUString& rElementName ) :
@@ -114,10 +128,8 @@ void ZipStorage::implGetElementNames( ::
 
 StorageRef ZipStorage::implOpenSubStorage( const OUString& rElementName, bool bCreate )
 {
-    OSL_ENSURE( !bCreate, "ZipStorage::implOpenSubStorage - creating new sub storages not implemented" );
-    (void)bCreate;  // prevent compiler warning
-
     Reference< XStorage > xSubXStorage;
+    bool bMissing = false;
     if( mxStorage.is() ) try
     {
         // XStorage::isStorageElement may throw various exceptions...
@@ -125,6 +137,20 @@ StorageRef ZipStorage::implOpenSubStorag
             xSubXStorage = mxStorage->openStorageElement(
                 rElementName, ::com::sun::star::embed::ElementModes::READ );
     }
+    catch( ::com::sun::star::container::NoSuchElementException& )
+    {
+        bMissing = true;
+    }
+    catch( Exception& )
+    {
+    }
+
+    if( bMissing && bCreate )
+        try
+        {
+            xSubXStorage = mxStorage->openStorageElement(
+                rElementName, ::com::sun::star::embed::ElementModes::READWRITE );
+        }
     catch( Exception& )
     {
     }
@@ -153,8 +179,7 @@ Reference< XOutputStream > ZipStorage::i
     Reference< XOutputStream > xOutStream;
     if( mxStorage.is() ) try
     {
-        (void)rElementName;
-        OSL_ENSURE( false, "ZipStorage::implOpenOutputStream - not implemented" );
+        xOutStream.set( mxStorage->openStreamElement( rElementName, ::com::sun::star::embed::ElementModes::READWRITE ), UNO_QUERY );
     }
     catch( Exception& )
     {
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/ole/makefile.mk /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ole/makefile.mk
--- oox/source/ole/makefile.mk	1970-01-01 01:00:00.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ole/makefile.mk	2008-09-30 16:51:36.000000000 +0200
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.2.1 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org.  If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=oox
+TARGET=ole
+AUTOSEG=true
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE :  settings.mk
+.INCLUDE: $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES =	\
+		$(SLO)$/vbainputstream.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE :  target.mk
+
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/ole/vbainputstream.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ole/vbainputstream.cxx
--- oox/source/ole/vbainputstream.cxx	1970-01-01 01:00:00.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ole/vbainputstream.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: vbainputstream.cxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/ole/vbainputstream.hxx"
+#include <osl/diagnose.h>
+
+namespace oox {
+namespace ole {
+
+namespace {
+
+const sal_uInt8 VBASTREAM_SIGNATURE         = 1;
+
+const sal_uInt16 VBACHUNK_SIGMASK           = 0x7000;
+const sal_uInt16 VBACHUNK_SIG               = 0x3000;
+const sal_uInt16 VBACHUNK_COMPRESSED        = 0x8000;
+const sal_uInt16 VBACHUNK_LENMASK           = 0x0FFF;
+
+} // namespace
+
+// ============================================================================
+
+VbaInputStream::VbaInputStream( BinaryInputStream& rInStrm ) :
+    mrInStrm( rInStrm ),
+    mnChunkPos( 0 )
+{
+    maChunk.reserve( 4096 );
+
+    sal_uInt8 nSig = mrInStrm.readuInt8();
+    OSL_ENSURE( nSig == VBASTREAM_SIGNATURE, "VbaInputStream::VbaInputStream - wrong signature" );
+    mbEof = nSig != VBASTREAM_SIGNATURE;
+}
+
+sal_Int32 VbaInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes )
+{
+    sal_Int32 nRet = 0;
+    if( !mbEof )
+    {
+        orData.realloc( ::std::max< sal_Int32 >( nBytes, 0 ) );
+        if( nBytes > 0 )
+        {
+            nRet = readMemory( orData.getArray(), nBytes );
+            if( nRet < nBytes )
+                orData.realloc( nRet );
+        }
+    }
+    return nRet;
+}
+
+sal_Int32 VbaInputStream::readMemory( void* opMem, sal_Int32 nBytes )
+{
+    sal_Int32 nRet = 0;
+    sal_uInt8* opnMem = reinterpret_cast< sal_uInt8* >( opMem );
+    while( (nBytes > 0) && updateChunk() )
+    {
+        sal_Int32 nChunkLeft = static_cast< sal_Int32 >( maChunk.size() - mnChunkPos );
+        sal_Int32 nReadBytes = ::std::min( nBytes, nChunkLeft );
+        memcpy( opnMem, &*(maChunk.begin() + mnChunkPos), nReadBytes );
+        opnMem += nReadBytes;
+        mnChunkPos += static_cast< size_t >( nReadBytes );
+        nBytes -= nReadBytes;
+        nRet += nReadBytes;
+    }
+    return nRet;
+}
+
+void VbaInputStream::skip( sal_Int32 nBytes )
+{
+    while( (nBytes > 0) && updateChunk() )
+    {
+        sal_Int32 nChunkLeft = static_cast< sal_Int32 >( maChunk.size() - mnChunkPos );
+        sal_Int32 nSkipBytes = ::std::min( nBytes, nChunkLeft );
+        mnChunkPos += static_cast< size_t >( nSkipBytes );
+        nBytes -= nSkipBytes;
+    }
+}
+
+// private --------------------------------------------------------------------
+
+bool VbaInputStream::updateChunk()
+{
+    if( mbEof || (mnChunkPos < maChunk.size()) ) return !mbEof;
+
+    // try to read next chunk header, this may trigger EOF
+    sal_uInt16 nHeader = mrInStrm.readuInt16();
+    mbEof = mrInStrm.isEof();
+    if( mbEof ) return false;
+
+    // check header signature
+    OSL_ENSURE( (nHeader & VBACHUNK_SIGMASK) == VBACHUNK_SIG, "VbaInputStream::readChunk - invalid chunk signature" );
+    mbEof = (nHeader & VBACHUNK_SIGMASK) != VBACHUNK_SIG;
+    if( mbEof ) return false;
+
+    // decode length of chunk data and compression flag
+    bool bCompressed = getFlag( nHeader, VBACHUNK_COMPRESSED );
+    sal_uInt16 nChunkLen = (nHeader & VBACHUNK_LENMASK) + 1;
+    OSL_ENSURE( bCompressed || (nChunkLen == 4096), "VbaInputStream::readChunk - invalid uncompressed chunk size" );
+    if( bCompressed )
+    {
+        maChunk.clear();
+        sal_uInt8 nBitCount = 4;
+        sal_uInt16 nChunkPos = 0;
+        while( !mbEof && !mrInStrm.isEof() && (nChunkPos < nChunkLen) )
+        {
+            sal_uInt8 nTokenFlags = mrInStrm.readuInt8();
+            ++nChunkPos;
+            for( int nBit = 0; !mbEof && !mrInStrm.isEof() && (nBit < 8) && (nChunkPos < nChunkLen); ++nBit, nTokenFlags >>= 1 )
+            {
+                if( nTokenFlags & 1 )
+                {
+                    sal_uInt16 nCopyToken = mrInStrm.readuInt16();
+                    nChunkPos = nChunkPos + 2;
+                    // update bit count used for offset/length in the token
+                    while( static_cast< size_t >( 1 << nBitCount ) < maChunk.size() ) ++nBitCount;
+                    // extract length from lower (16-nBitCount) bits, plus 3
+                    sal_uInt16 nLength = extractValue< sal_uInt16 >( nCopyToken, 0, 16 - nBitCount ) + 3;
+                    // extract offset from high nBitCount bits, plus 1
+                    sal_uInt16 nOffset = extractValue< sal_uInt16 >( nCopyToken, 16 - nBitCount, nBitCount ) + 1;
+                    mbEof = (nOffset > maChunk.size()) || (maChunk.size() + nLength > 4096);
+                    OSL_ENSURE( !mbEof, "VbaInputStream::readChunk - invalid offset or size in copy token" );
+                    if( !mbEof )
+                    {
+                        // append data to buffer
+                        maChunk.resize( maChunk.size() + nLength );
+                        sal_uInt8* pnTo = &*(maChunk.end() - nLength);
+                        const sal_uInt8* pnEnd = pnTo + nLength;
+                        const sal_uInt8* pnFrom = pnTo - nOffset;
+                        // offset may be less than length, effectively duplicating source data several times
+                        size_t nRunLen = ::std::min< size_t >( nLength, nOffset );
+                        while( pnTo < pnEnd )
+                        {
+                            size_t nStepLen = ::std::min< size_t >( nRunLen, pnEnd - pnTo );
+                            memcpy( pnTo, pnFrom, nStepLen );
+                            pnTo += nStepLen;
+                        }
+                    }
+                }
+                else
+                {
+                    maChunk.resize( maChunk.size() + 1 );
+                    mrInStrm >> maChunk.back();
+                    ++nChunkPos;
+                }
+            }
+        }
+    }
+    else
+    {
+        maChunk.resize( nChunkLen );
+        mrInStrm.readMemory( &maChunk.front(), nChunkLen );
+    }
+
+    mnChunkPos = 0;
+    return !mbEof;
+}
+
+// ============================================================================
+
+} // namespace ole
+} // namespace oox
+
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/ppt/commonbehaviorcontext.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/commonbehaviorcontext.cxx
--- oox/source/ppt/commonbehaviorcontext.cxx	2008-04-10 17:47:53.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/commonbehaviorcontext.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -30,7 +30,6 @@
 
 #include "comphelper/anytostring.hxx"
 #include "cppuhelper/exc_hlp.hxx"
-#include <comphelper/processfactory.hxx>
 #include <osl/diagnose.h>
 #include <rtl/ustrbuf.hxx>
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/ppt/pptimport.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/pptimport.cxx
--- oox/source/ppt/pptimport.cxx	2008-07-22 16:03:17.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/pptimport.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -72,7 +72,7 @@ bool PowerPointImport::importDocument() 
 {
     /*  to activate the PPTX dumper, define the environment variable
         OOO_PPTXDUMPER and insert the full path to the file
-        file:///<path-to-oox-module>/source/dump/pptxdumperconfig.dat. */
+        file:///<path-to-oox-module>/source/dump/pptxdumper.ini. */
     OOX_DUMP_FILE( ::oox::dump::pptx::Dumper );
 
     OUString aFragmentPath = getFragmentPathFromType( CREATE_OFFICEDOC_RELATIONSTYPE( "officeDocument" ) );
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/ppt/pptshapecontext.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/pptshapecontext.cxx
--- oox/source/ppt/pptshapecontext.cxx	2008-07-22 16:03:57.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/pptshapecontext.cxx	2009-03-19 14:28:41.000000000 +0100
@@ -85,6 +85,26 @@ oox::drawingml::ShapePtr findPlaceholder
 	return aShapePtr;
 }
 
+oox::drawingml::ShapePtr findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes )
+{
+	oox::drawingml::ShapePtr aShapePtr;
+	std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() );
+	while( aRevIter != rShapes.rend() )
+	{
+		if ( (*aRevIter)->getIndex() == nIdx )
+		{
+			aShapePtr = *aRevIter;
+			break;
+		}
+		std::vector< oox::drawingml::ShapePtr >& rChildren = (*aRevIter)->getChildren();
+		aShapePtr = findPlaceholderByIndex( nIdx, rChildren );
+		if ( aShapePtr.get() )
+		    break;
+		aRevIter++;
+	}
+	return aShapePtr;
+}
+
 // if nFirstPlaceholder can't be found, it will be searched for nSecondPlaceholder
 oox::drawingml::ShapePtr findPlaceholder( sal_Int32 nFirstPlaceholder, sal_Int32 nSecondPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes )
 {
@@ -109,14 +129,27 @@ Reference< XFastContextHandler > PPTShap
 	{
 		sal_Int32 nSubType( xAttribs->getOptionalValueToken( XML_type, XML_obj ) );
 		mpShapePtr->setSubType( nSubType );
-		mpShapePtr->setIndex( xAttribs->getOptionalValue( XML_idx ).toInt32() );
-		if ( nSubType )
+		OUString sIdx( xAttribs->getOptionalValue( XML_idx ) );
+		sal_Bool bHasIdx = sIdx.getLength() > 0;
+		sal_Int32 nIdx = sIdx.toInt32();
+		mpShapePtr->setIndex( nIdx );
+
+		if ( nSubType || bHasIdx )
 		{
 			PPTShape* pPPTShapePtr = dynamic_cast< PPTShape* >( mpShapePtr.get() );
 			if ( pPPTShapePtr )
 			{
 				oox::ppt::ShapeLocation eShapeLocation = pPPTShapePtr->getShapeLocation();
-				if ( ( eShapeLocation == Slide ) || ( eShapeLocation == Layout ) )
+				oox::drawingml::ShapePtr pPlaceholder;
+
+				if ( bHasIdx && eShapeLocation == Slide )
+				{
+				    // TODO: use id to shape map
+				    SlidePersistPtr pMasterPersist( mpSlidePersistPtr->getMasterPersist() );
+				    if ( pMasterPersist.get() )
+					pPlaceholder = findPlaceholderByIndex( nIdx, pMasterPersist->getShapes()->getChildren() );
+				}
+				if ( !pPlaceholder.get() && ( ( eShapeLocation == Slide ) || ( eShapeLocation == Layout ) ) )
 				{
 					// inheriting properties from placeholder objects by cloning shape
 
@@ -154,7 +187,6 @@ Reference< XFastContextHandler > PPTShap
 					}
 					if ( nFirstPlaceholder )
 					{
-						oox::drawingml::ShapePtr pPlaceholder;
 						if ( eShapeLocation == Layout )		// for layout objects the referenced object can be found within the same shape tree
                             pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, mpSlidePersistPtr->getShapes()->getChildren() );
 						else if ( eShapeLocation == Slide )	// normal slide shapes have to search within the corresponding master tree for referenced objects
@@ -163,6 +195,8 @@ Reference< XFastContextHandler > PPTShap
 							if ( pMasterPersist.get() )
                                 pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, pMasterPersist->getShapes()->getChildren() );
 						}
+					}
+				}
 						if ( pPlaceholder.get() )
 						{
 							mpShapePtr->applyShapeReference( *pPlaceholder.get() );
@@ -172,8 +206,6 @@ Reference< XFastContextHandler > PPTShap
 						}
 					}
 				}
-			}
-		}
 		break;
 	}
 	// nvSpPr CT_ShapeNonVisual end
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/ppt/presentationfragmenthandler.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/presentationfragmenthandler.cxx
--- oox/source/ppt/presentationfragmenthandler.cxx	2008-07-07 15:38:40.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/presentationfragmenthandler.cxx	2008-10-01 09:50:54.000000000 +0200
@@ -38,6 +38,7 @@
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/style/XStyle.hpp>
 #include <com/sun/star/presentation/XPresentationPage.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
 
 #include "oox/drawingml/theme.hxx"
 #include "oox/drawingml/drawingmltypes.hxx"
@@ -79,6 +80,11 @@ void PresentationFragmentHandler::startD
 
 void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeException)
 {
+	// todo: localized progress bar text
+	const Reference< task::XStatusIndicator >& rxStatusIndicator( getFilter().getStatusIndicator() );
+	if ( rxStatusIndicator.is() )
+		rxStatusIndicator->start( rtl::OUString(), 10000 );
+
 	try
 	{
         PowerPointImport& rFilter = dynamic_cast< PowerPointImport& >( getFilter() );
@@ -94,7 +100,6 @@ void PresentationFragmentHandler::endDoc
 	}
 
 #endif
-
         Reference< frame::XModel > xModel( rFilter.getModel() );
 		Reference< drawing::XDrawPage > xSlide;
 		sal_uInt32 nSlide;
@@ -105,6 +110,9 @@ void PresentationFragmentHandler::endDoc
 
 		for( nSlide = 0; nSlide < maSlidesVector.size(); nSlide++ )
 		{
+			if ( rxStatusIndicator.is() )
+				rxStatusIndicator->setValue( ( nSlide * 10000 ) / maSlidesVector.size() );
+
 			if( nSlide == 0 )
 				xDrawPages->getByIndex( 0 ) >>= xSlide;
 			else
@@ -232,6 +240,8 @@ void PresentationFragmentHandler::endDoc
 	}
 
 	// todo	error handling;
+	if ( rxStatusIndicator.is() )
+		rxStatusIndicator->end();
 }
 
 // CT_Presentation
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/ppt/slidepersist.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/slidepersist.cxx
--- oox/source/ppt/slidepersist.cxx	2008-07-22 16:05:22.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/slidepersist.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -163,7 +163,7 @@ void SlidePersist::createXShapes( const 
 			TimeNodePtr pNode(maTimeNodeList.front());
 			OSL_ENSURE( pNode, "pNode" );
 
-            pNode->setNode( rFilterBase.getModel(), xNode, pSlidePtr );
+            pNode->setNode( rFilterBase, xNode, pSlidePtr );
 		}
 	}
 }
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/ppt/timenode.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/timenode.cxx
--- oox/source/ppt/timenode.cxx	2008-07-22 16:06:27.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/timenode.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -32,8 +32,6 @@
 
 #include <boost/bind.hpp>
 
-#include <comphelper/processfactory.hxx>
-
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/container/XEnumerationAccess.hpp>
@@ -52,6 +50,7 @@
 #include <com/sun/star/presentation/EffectNodeType.hpp>
 
 #include "oox/helper/helper.hxx"
+#include "oox/core/xmlfilterbase.hxx"
 
 using ::rtl::OUString;
 using namespace ::oox::core;
@@ -216,13 +215,12 @@ namespace oox { namespace ppt {
 
 // END CUT&PASTE
 
-	void TimeNode::addNode( const Reference< XModel > &rxModel,
-													const Reference< XAnimationNode >& rxNode, const SlidePersistPtr & pSlide )
+    void TimeNode::addNode( const XmlFilterBase& rFilter, const Reference< XAnimationNode >& rxNode, const SlidePersistPtr & pSlide )
 	{
 		try {
 			OUString sServiceName = getServiceName( mnNodeType );
-			Reference< XAnimationNode > xNode = createAndInsert(sServiceName, rxModel, rxNode );
-			setNode( rxModel, xNode, pSlide );
+            Reference< XAnimationNode > xNode = createAndInsert( rFilter, sServiceName, rxNode );
+            setNode( rFilter, xNode, pSlide );
 		}
 		catch( const Exception& e )
 		{
@@ -231,8 +229,7 @@ namespace oox { namespace ppt {
 		}
 	}
 
-	void TimeNode::setNode( const Reference< XModel > &rxModel,
-							const Reference< XAnimationNode >& xNode, const SlidePersistPtr & pSlide )
+    void TimeNode::setNode( const XmlFilterBase& rFilter, const Reference< XAnimationNode >& xNode, const SlidePersistPtr & pSlide )
 	{
 		OSL_ENSURE( xNode.is(), "null node passed" );
 
@@ -549,7 +546,7 @@ namespace oox { namespace ppt {
 			}
 
             std::for_each( maChildren.begin(), maChildren.end(),
-						   boost::bind(&TimeNode::addNode, _1, rxModel, boost::ref(xNode),
+                           boost::bind(&TimeNode::addNode, _1, boost::cref(rFilter), boost::ref(xNode),
 									   boost::ref(pSlide) ) );
 
 			switch( mnNodeType )
@@ -583,12 +580,13 @@ namespace oox { namespace ppt {
 	}
 
 
-    Reference< XAnimationNode > TimeNode::createAndInsert( const OUString& rServiceName, const Reference< XModel > &/*rxModel*/,
+    Reference< XAnimationNode > TimeNode::createAndInsert(
+            const XmlFilterBase& rFilter,
+            const OUString& rServiceName,
 																							 const Reference< XAnimationNode >& rxNode )
 	{
 		try {
-			Reference< XAnimationNode > xNode ( ::comphelper::getProcessServiceFactory()->createInstance(rServiceName ),
-																					UNO_QUERY_THROW );
+            Reference< XAnimationNode > xNode ( rFilter.getGlobalFactory()->createInstance(rServiceName ), UNO_QUERY_THROW );
 			Reference< XTimeContainer > xParentContainer( rxNode, UNO_QUERY_THROW );
 
 			xParentContainer->appendChild( xNode );
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/ppt/timenodelistcontext.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/timenodelistcontext.cxx
--- oox/source/ppt/timenodelistcontext.cxx	2008-04-10 17:58:10.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/ppt/timenodelistcontext.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -32,7 +32,6 @@
 
 #include "comphelper/anytostring.hxx"
 #include "cppuhelper/exc_hlp.hxx"
-#include <comphelper/processfactory.hxx>
 #include <osl/diagnose.h>
 #include <rtl/math.hxx>
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/shape/FastTokenHandlerService.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/shape/FastTokenHandlerService.cxx
--- oox/source/shape/FastTokenHandlerService.cxx	2008-04-10 17:59:11.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/shape/FastTokenHandlerService.cxx	2009-01-06 14:16:56.000000000 +0100
@@ -70,6 +70,11 @@ uno::Sequence< ::rtl::OUString > SAL_CAL
     return mFastTokenHandler.getIdentifier(Token);
 }
 
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL FastTokenHandlerService::getUTF8Identifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException)
+{
+	return mFastTokenHandler.getUTF8Identifier(Token);
+}
+
 ::sal_Int32 SAL_CALL FastTokenHandlerService::getTokenFromUTF8(const ::com::sun::star::uno::Sequence< ::sal_Int8 > & Identifier) throw (::com::sun::star::uno::RuntimeException)
 {
     return mFastTokenHandler.getTokenFromUTF8(Identifier);
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/shape/FastTokenHandlerService.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/shape/FastTokenHandlerService.hxx
--- oox/source/shape/FastTokenHandlerService.hxx	2008-04-10 17:59:28.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/shape/FastTokenHandlerService.hxx	2009-01-06 14:16:56.000000000 +0100
@@ -60,6 +60,7 @@ public:
     // ::com::sun::star::xml::sax::XFastTokenHandler:
     virtual ::sal_Int32 SAL_CALL getToken(const ::rtl::OUString & Identifier) throw (css::uno::RuntimeException);
     virtual ::rtl::OUString SAL_CALL getIdentifier(::sal_Int32 Token) throw (css::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getUTF8Identifier( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException);
     virtual ::sal_Int32 SAL_CALL getTokenFromUTF8(const css::uno::Sequence< ::sal_Int8 > & Identifier) throw (css::uno::RuntimeException);
 
 private:
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/shape/ShapeContextHandler.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/shape/ShapeContextHandler.cxx
--- oox/source/shape/ShapeContextHandler.cxx	2008-07-01 14:20:08.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/shape/ShapeContextHandler.cxx	2009-02-16 16:17:05.000000000 +0100
@@ -39,7 +39,7 @@ using namespace drawingml;
 
 ShapeContextHandler::ShapeContextHandler
 (uno::Reference< uno::XComponentContext > const & context) :
-m_xContext(context)
+mnStartToken(0), m_xContext(context)
 {
     try
     {
@@ -57,16 +57,29 @@ ShapeContextHandler::~ShapeContextHandle
 }
 
 uno::Reference<xml::sax::XFastContextHandler> 
-ShapeContextHandler::getGraphicShapeContext()
+ShapeContextHandler::getGraphicShapeContext(::sal_Int32 Element )
 {
     if (! mxGraphicShapeContext.is())
     {
         FragmentHandlerRef rFragmentHandler
             (new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
         ShapePtr pMasterShape;
+        
+        switch (Element & 0xffff)
+        {
+            case XML_graphic:
+                mpShape.reset(new Shape("com.sun.star.drawing.OLE2Shape" ));
+                mxGraphicShapeContext.set
+                (new GraphicalObjectFrameContext(*rFragmentHandler, pMasterShape, mpShape));
+                break;
+            case XML_pic:
         mpShape.reset(new Shape("com.sun.star.drawing.GraphicObjectShape" ));
         mxGraphicShapeContext.set
             (new GraphicShapeContext(*rFragmentHandler, pMasterShape, mpShape));
+                break;
+            default:
+                break;
+        }
     }
 
     return mxGraphicShapeContext;
@@ -91,10 +104,16 @@ uno::Reference<xml::sax::XFastContextHan
 ShapeContextHandler::getContextHandler()
 {
     uno::Reference<xml::sax::XFastContextHandler> xResult;
-    if (mxDrawingFragmentHandler.is())
-        xResult.set(mxDrawingFragmentHandler);
-    else if (mxGraphicShapeContext.is())
-        xResult.set(mxGraphicShapeContext);
+    
+    switch (mnStartToken & NMSP_MASK)
+    {
+        case NMSP_VML:
+            xResult.set(getDrawingShapeContext());
+            break;
+        default:
+            xResult.set(getGraphicShapeContext(mnStartToken));
+            break;
+    }
 
     return xResult;
 }
@@ -159,17 +178,7 @@ ShapeContextHandler::createFastChildCont
     throw (uno::RuntimeException, xml::sax::SAXException)
 {
     uno::Reference< xml::sax::XFastContextHandler > xResult;
-    uno::Reference< xml::sax::XFastContextHandler > xContextHandler;
-
-    switch (Element & NMSP_MASK)
-    {
-    case NMSP_VML:
-        xContextHandler.set(getDrawingShapeContext());
-        break;
-    default:
-        xContextHandler.set(getGraphicShapeContext());
-        break;
-    }
+    uno::Reference< xml::sax::XFastContextHandler > xContextHandler(getContextHandler());
 
     if (xContextHandler.is())
         xResult.set(xContextHandler->createFastChildContext
@@ -287,6 +296,18 @@ void SAL_CALL ShapeContextHandler::setRe
     msRelationFragmentPath = the_value;
 }
 
+::sal_Int32 SAL_CALL ShapeContextHandler::getStartToken() throw (::com::sun::star::uno::RuntimeException)
+{
+    return mnStartToken;
+}
+
+void SAL_CALL ShapeContextHandler::setStartToken( ::sal_Int32 _starttoken ) throw (::com::sun::star::uno::RuntimeException)
+{
+    mnStartToken = _starttoken;
+    
+    
+}
+
 ::rtl::OUString ShapeContextHandler::getImplementationName()
     throw (css::uno::RuntimeException)
 {
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/shape/ShapeContextHandler.hxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/shape/ShapeContextHandler.hxx
--- oox/source/shape/ShapeContextHandler.hxx	2008-04-18 16:32:49.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/shape/ShapeContextHandler.hxx	2009-02-16 16:17:05.000000000 +0100
@@ -161,11 +161,15 @@ public:
     (const ::rtl::OUString & the_value)
         throw (css::uno::RuntimeException);
 
+    virtual ::sal_Int32 SAL_CALL getStartToken() throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL setStartToken( ::sal_Int32 _starttoken ) throw (::com::sun::star::uno::RuntimeException);
 
 private:
     ShapeContextHandler(ShapeContextHandler &); // not defined
     void operator =(ShapeContextHandler &); // not defined
 
+    ::sal_uInt32 mnStartToken;
+
     css::uno::Reference< css::uno::XComponentContext > m_xContext;
     drawingml::ShapePtr mpShape;
     vml::DrawingPtr mpDrawing;
@@ -181,7 +185,7 @@ private:
     css::uno::Reference<css::io::XInputStream> mxInputStream;
     ::rtl::OUString msRelationFragmentPath;
     
-    css::uno::Reference<XFastContextHandler> getGraphicShapeContext();
+    css::uno::Reference<XFastContextHandler> getGraphicShapeContext(::sal_Int32 Element);
     css::uno::Reference<XFastContextHandler> getDrawingShapeContext();
     css::uno::Reference<XFastContextHandler> getContextHandler();    
 };
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/token/tokenmap.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/token/tokenmap.cxx
--- oox/source/token/tokenmap.cxx	2008-04-10 18:01:29.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/token/tokenmap.cxx	2009-01-06 14:16:56.000000000 +0100
@@ -110,6 +110,16 @@ OUString FastTokenHandler::getIdentifier
 	return aTokens[nToken];
 }
 
+Sequence< sal_Int8 > FastTokenHandler::getUTF8Identifier( sal_Int32 nToken ) throw( RuntimeException )
+{
+    MutexGuard aGuard( lclGetTokenMutex() );
+
+	if( nToken >= XML_TOKEN_COUNT )
+		return Sequence< sal_Int8 >();
+
+	return Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8 *>(tokentowordlist[nToken]), strlen(tokentowordlist[nToken]));
+}
+
 sal_Int32 FastTokenHandler::getTokenFromUTF8( const Sequence< sal_Int8 >& rIdentifier ) throw( RuntimeException )
 {
     MutexGuard aGuard( lclGetTokenMutex() );
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/addressconverter.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/addressconverter.cxx
--- oox/source/xls/addressconverter.cxx	2008-04-10 18:02:56.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/addressconverter.cxx	2009-01-06 15:57:48.000000000 +0100
@@ -93,7 +93,7 @@ const sal_Unicode BIFF_URL_PARENT   = '\
 const sal_Unicode BIFF_URL_RAW      = '\x05';       /// Unencoded URL.
 const sal_Unicode BIFF_URL_INSTALL  = '\x06';       /// Application installation directory.
 const sal_Unicode BIFF_URL_INSTALL2 = '\x07';       /// Alternative application installation directory.
-const sal_Unicode BIFF_URL_ADDIN    = '\x08';       /// Add-in installation directory.
+const sal_Unicode BIFF_URL_LIBRARY  = '\x08';       /// Library directory in application installation.
 const sal_Unicode BIFF4_URL_SHEET   = '\x09';       /// BIFF4 internal sheet.
 const sal_Unicode BIFF_URL_UNC      = '@';          /// UNC path root.
 
@@ -201,7 +201,7 @@ BinRange BinRangeList::getEnclosingRange
 void BinRangeList::read( RecordInputStream& rStrm )
 {
     sal_Int32 nCount = rStrm.readInt32();
-    resize( getLimitedValue< size_t, sal_Int32 >( nCount, 0, rStrm.getRecLeft() / 16 ) );
+    resize( getLimitedValue< size_t, sal_Int64 >( nCount, 0, rStrm.getRemaining() / 16 ) );
     for( iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
         aIt->read( rStrm );
 }
@@ -209,7 +209,7 @@ void BinRangeList::read( RecordInputStre
 void BinRangeList::read( BiffInputStream& rStrm, bool bCol16Bit, bool bRow32Bit )
 {
     sal_uInt16 nCount = rStrm.readuInt16();
-    resize( getLimitedValue< size_t, sal_uInt32 >( nCount, 0, rStrm.getRecLeft() / lclGetBiffRangeSize( bCol16Bit, bRow32Bit ) ) );
+    resize( getLimitedValue< size_t, sal_Int64 >( nCount, 0, rStrm.getRemaining() / lclGetBiffRangeSize( bCol16Bit, bRow32Bit ) ) );
     for( iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
         aIt->read( rStrm, bCol16Bit, bRow32Bit );
 }
@@ -385,13 +385,13 @@ bool lclAppendUrlChar( OUStringBuffer& o
 
 } // namespace
 
-bool AddressConverter::parseBiffTargetUrl(
-        OUString& orClassName, OUString& orTargetUrl, OUString& orSheetName, bool& orbSameSheet,
-        const OUString& rBiffTargetUrl )
+BiffTargetType AddressConverter::parseBiffTargetUrl(
+        OUString& orClassName, OUString& orTargetUrl, OUString& orSheetName, const OUString& rBiffTargetUrl )
 {
     OUStringBuffer aTargetUrl;
     OUStringBuffer aSheetName;
-    orbSameSheet = false;
+    // default target type: some URL with/without sheet name, may be overridden below
+    BiffTargetType eTargetType = BIFF_TARGETTYPE_URL;
 
     enum
     {
@@ -419,8 +419,10 @@ bool AddressConverter::parseBiffTargetUr
             case STATE_START:
                 if( (cChar == mcUrlThisWorkbook) || (cChar == mcUrlThisSheet) || (cChar == mcUrlSameSheet) )
                 {
-                    if( pcChar + 1 < pcEnd ) eState = STATE_ERROR;
-                    orbSameSheet = cChar == mcUrlSameSheet;
+                    if( pcChar + 1 < pcEnd )
+                        eState = STATE_ERROR;
+                    if( cChar == mcUrlSameSheet )
+                        eTargetType = BIFF_TARGETTYPE_SAMESHEET;
                 }
                 else if( cChar == mcUrlExternal )
                     eState = (pcChar + 1 < pcEnd) ? STATE_ENCODED_PATH_START : STATE_ERROR;
@@ -446,8 +448,11 @@ bool AddressConverter::parseBiffTargetUr
                     eState = STATE_UNSUPPORTED;
                 else if( cChar == BIFF_URL_INSTALL2 )
                     eState = STATE_UNSUPPORTED;
-                else if( cChar == BIFF_URL_ADDIN )
-                    eState = STATE_UNSUPPORTED;
+                else if( cChar == BIFF_URL_LIBRARY )
+                {
+                    eState = STATE_ENCODED_PATH;
+                    eTargetType = BIFF_TARGETTYPE_LIBRARY;
+                }
                 else if( (getBiff() == BIFF4) && (cChar == BIFF4_URL_SHEET) )
                     eState = STATE_SHEETNAME;
                 else if( cChar == '[' )
@@ -496,6 +501,7 @@ bool AddressConverter::parseBiffTargetUr
                 {
                     orClassName = aTargetUrl.makeStringAndClear();
                     eState = STATE_DDE_OLE;
+                    eTargetType = BIFF_TARGETTYPE_DDE_OLE;
                 }
                 else if( cChar == '[' )
                     eState = STATE_FILENAME;
@@ -535,7 +541,8 @@ bool AddressConverter::parseBiffTargetUr
     OSL_ENSURE( (eState != STATE_ERROR) && (pcChar == pcEnd),
         OStringBuffer( "AddressConverter::parseBiffTargetUrl - parser error in target \"" ).
         append( OUStringToOString( rBiffTargetUrl, RTL_TEXTENCODING_UTF8 ) ).append( '"' ).getStr() );
-    return (eState != STATE_ERROR) && (eState != STATE_UNSUPPORTED) && (pcChar == pcEnd);
+    bool bParserOk = (eState != STATE_ERROR) && (eState != STATE_UNSUPPORTED) && (pcChar == pcEnd);
+    return bParserOk ? eTargetType : BIFF_TARGETTYPE_UNKNOWN;
 }
 
 // ----------------------------------------------------------------------------
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/autofiltercontext.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/autofiltercontext.cxx
--- oox/source/xls/autofiltercontext.cxx	2008-07-01 14:21:35.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/autofiltercontext.cxx	2009-03-23 21:12:46.000000000 +0100
@@ -29,11 +29,7 @@
  ************************************************************************/
 
 #include "oox/xls/autofiltercontext.hxx"
-#include "oox/helper/attributelist.hxx"
-#include "oox/helper/propertyset.hxx"
-#include "oox/xls/addressconverter.hxx"
 #include <rtl/ustrbuf.hxx>
-#include <comphelper/processfactory.hxx>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/table/XCellRange.hpp>
@@ -44,6 +40,10 @@
 #include <com/sun/star/sheet/FilterConnection.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/i18n/XLocaleData.hpp>
+#include "oox/helper/attributelist.hxx"
+#include "oox/helper/propertyset.hxx"
+#include "oox/core/filterbase.hxx"
+#include "oox/xls/addressconverter.hxx"
 
 #define DEBUG_OOX_AUTOFILTER 0
 
@@ -80,7 +80,6 @@ using ::com::sun::star::sheet::XDatabase
 using ::com::sun::star::sheet::XSheetFilterDescriptor;
 using ::com::sun::star::i18n::LocaleDataItem;
 using ::com::sun::star::i18n::XLocaleData;
-using ::com::sun::star::lang::XMultiServiceFactory;
 using ::com::sun::star::lang::Locale;
 
 namespace oox {
@@ -704,8 +703,7 @@ void OoxAutoFilterContext::importCustomF
         case XML_equal:
         case XML_notEqual:
         {
-            Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-            Reference< XLocaleData > xLocale( xFactory->createInstance(
+            Reference< XLocaleData > xLocale( getBaseFilter().getGlobalFactory()->createInstance(
                 CREATE_OUSTRING("com.sun.star.i18n.LocaleData") ), UNO_QUERY );
 
             if ( !xLocale.is() )
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/biffdetector.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/biffdetector.cxx
--- oox/source/xls/biffdetector.cxx	2008-04-10 18:03:43.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/biffdetector.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -85,7 +85,7 @@ BiffDetector::~BiffDetector()
 BiffType BiffDetector::detectStreamBiffVersion( BinaryInputStream& rInStream )
 {
     BiffType eBiff = BIFF_UNKNOWN;
-    if( rInStream.is() && rInStream.isSeekable() && (rInStream.getLength() > 4) )
+    if( !rInStream.isEof() && rInStream.isSeekable() && (rInStream.getLength() > 4) )
     {
         sal_Int64 nOldPos = rInStream.tell();
         rInStream.seek( 0 );
@@ -146,11 +146,11 @@ BiffType BiffDetector::detectStorageBiff
         if( xStorage->isStorage() )
         {
             // try to open the "Book" stream
-            BinaryInputStream aBookStrm5( xStorage->openInputStream( saBookName ), true );
+            BinaryXInputStream aBookStrm5( xStorage->openInputStream( saBookName ), true );
             BiffType eBookStrm5Biff = detectStreamBiffVersion( aBookStrm5 );
 
             // try to open the "Workbook" stream
-            BinaryInputStream aBookStrm8( xStorage->openInputStream( saWorkbookName ), true );
+            BinaryXInputStream aBookStrm8( xStorage->openInputStream( saWorkbookName ), true );
             BiffType eBookStrm8Biff = detectStreamBiffVersion( aBookStrm8 );
 
             // decide which stream to use
@@ -172,7 +172,7 @@ BiffType BiffDetector::detectStorageBiff
         else
         {
             // no storage, try plain input stream from medium (even for BIFF5+)
-            BinaryInputStream aStrm( xStorage->openInputStream( OUString() ), false );
+            BinaryXInputStream aStrm( xStorage->openInputStream( OUString() ), false );
             eBiff = detectStreamBiffVersion( aStrm );
             orWorkbookStreamName = OUString();
         }
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/bifffragmenthandler.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/bifffragmenthandler.cxx
--- oox/source/xls/bifffragmenthandler.cxx	2008-04-10 18:04:00.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/bifffragmenthandler.cxx	1970-01-01 01:00:00.000000000 +0100
@@ -1,165 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: bifffragmenthandler.cxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "oox/xls/bifffragmenthandler.hxx"
-#include "oox/xls/biffhelper.hxx"
-#include "oox/xls/biffinputstream.hxx"
-
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-namespace {
-
-const sal_uInt16 BIFF_BOF_GLOBALS           = 0x0005;   /// BIFF5-BIFF8 workbook globals.
-const sal_uInt16 BIFF_BOF_MODULE            = 0x0006;   /// BIFF5-BIFF8 Visual Basic module.
-const sal_uInt16 BIFF_BOF_SHEET             = 0x0010;   /// BIFF2-BIFF8 worksheet/dialog sheet.
-const sal_uInt16 BIFF_BOF_CHART             = 0x0020;   /// BIFF2-BIFF8 chart sheet.
-const sal_uInt16 BIFF_BOF_MACRO             = 0x0040;   /// BIFF4-BIFF8 macro sheet.
-const sal_uInt16 BIFF_BOF_WORKSPACE         = 0x0100;   /// BIFF3-BIFF8 workspace.
-
-} // namespace
-
-// ============================================================================
-
-BiffFragmentHandler::~BiffFragmentHandler()
-{
-}
-
-bool BiffFragmentHandler::importFragment( BiffInputStream& rStrm )
-{
-    // default implementation: skip the entire fragment
-    return skipFragment( rStrm );
-}
-
-bool BiffFragmentHandler::isBofRecord( sal_uInt16 nRecId )
-{
-    return (nRecId == BIFF2_ID_BOF) || (nRecId == BIFF3_ID_BOF) || (nRecId == BIFF4_ID_BOF) || (nRecId == BIFF5_ID_BOF);
-}
-
-BiffFragmentType BiffFragmentHandler::startFragment( BiffInputStream& rStrm, BiffType eBiff )
-{
-    BiffFragmentType eFragment = BIFF_FRAGMENT_UNKNOWN;
-    if( rStrm.startNextRecord() )
-    {
-        /*  #i23425# Don't rely on BOF record ID to read BOF contents, but on
-            the detected BIFF version. */
-        if( isBofRecord( rStrm.getRecId() ) )
-        {
-            // BOF is always written unencrypted
-            rStrm.enableDecoder( false );
-            sal_uInt16 nType = rStrm.skip( 2 ).readuInt16();
-
-            // decide which fragment types are valid for current BIFF version
-            switch( eBiff )
-            {
-                case BIFF2: switch( nType )
-                {
-                    case BIFF_BOF_CHART:    eFragment = BIFF_FRAGMENT_EMPTYSHEET;   break;
-                    case BIFF_BOF_MACRO:    eFragment = BIFF_FRAGMENT_MACROSHEET;   break;
-                    // #i51490# Excel interprets invalid types as worksheet
-                    default:                eFragment = BIFF_FRAGMENT_WORKSHEET;
-                }
-                break;
-
-                case BIFF3: switch( nType )
-                {
-                    case BIFF_BOF_CHART:    eFragment = BIFF_FRAGMENT_EMPTYSHEET;   break;
-                    case BIFF_BOF_MACRO:    eFragment = BIFF_FRAGMENT_MACROSHEET;   break;
-                    case BIFF_BOF_WORKSPACE:eFragment = BIFF_FRAGMENT_UNKNOWN;      break;
-                    // #i51490# Excel interprets invalid types as worksheet
-                    default:                eFragment = BIFF_FRAGMENT_WORKSHEET;
-                };
-                break;
-
-                case BIFF4: switch( nType )
-                {
-                    case BIFF_BOF_CHART:    eFragment = BIFF_FRAGMENT_EMPTYSHEET;   break;
-                    case BIFF_BOF_MACRO:    eFragment = BIFF_FRAGMENT_MACROSHEET;   break;
-                    case BIFF_BOF_WORKSPACE:eFragment = BIFF_FRAGMENT_WORKSPACE;    break;
-                    // #i51490# Excel interprets invalid types as worksheet
-                    default:                eFragment = BIFF_FRAGMENT_WORKSHEET;
-                };
-                break;
-
-                case BIFF5:
-                case BIFF8: switch( nType )
-                {
-                    case BIFF_BOF_GLOBALS:  eFragment = BIFF_FRAGMENT_GLOBALS;      break;
-                    case BIFF_BOF_CHART:    eFragment = BIFF_FRAGMENT_CHARTSHEET;   break;
-                    case BIFF_BOF_MACRO:    eFragment = BIFF_FRAGMENT_MACROSHEET;   break;
-                    case BIFF_BOF_MODULE:   eFragment = BIFF_FRAGMENT_MODULESHEET;  break;
-                    case BIFF_BOF_WORKSPACE:eFragment = BIFF_FRAGMENT_UNKNOWN;      break;
-                    // #i51490# Excel interprets invalid types as worksheet
-                    default:                eFragment = BIFF_FRAGMENT_WORKSHEET;
-                };
-                break;
-
-                case BIFF_UNKNOWN: break;
-            }
-        }
-    }
-    return eFragment;
-}
-
-bool BiffFragmentHandler::skipFragment( BiffInputStream& rStrm )
-{
-    while( rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) )
-        if( isBofRecord( rStrm.getRecId() ) )
-            skipFragment( rStrm );
-    return rStrm.isValid() && (rStrm.getRecId() == BIFF_ID_EOF);
-}
-
-// ============================================================================
-
-BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelper ) :
-    WorkbookHelper( rHelper )
-{
-}
-
-// ============================================================================
-
-BiffWorksheetFragmentBase::BiffWorksheetFragmentBase( const WorkbookHelper& rHelper,
-        ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
-    WorksheetHelperRoot( rHelper, xProgressBar, eSheetType, nSheet )
-{
-}
-
-BiffWorksheetFragmentBase::BiffWorksheetFragmentBase( const WorksheetHelper& rHelper ) :
-    WorksheetHelperRoot( rHelper )
-{
-}
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/biffhelper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/biffhelper.cxx
--- oox/source/xls/biffhelper.cxx	2008-04-10 18:04:18.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/biffhelper.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -81,15 +81,13 @@ bool operator<( const BiffGuid& rGuid1, 
 
 BiffInputStream& operator>>( BiffInputStream& rStrm, BiffGuid& rGuid )
 {
-    rStrm.read( rGuid.mpnData, 16 );     // mpnData always in little endian
+    rStrm.readMemory( rGuid.mpnData, 16 );  // mpnData always in little endian
     return rStrm;
 }
 
 BiffOutputStream& operator<<( BiffOutputStream& rStrm, const BiffGuid& rGuid )
 {
-    rStrm.setPortionSize( 16 );
-    rStrm.write( rGuid.mpnData, 16 );    // mpnData already in little endian
-    rStrm.setPortionSize( 0 );
+    rStrm.writeBlock( rGuid.mpnData, 16 ); // mpnData already in little endian
     return rStrm;
 }
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/biffinputstream.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/biffinputstream.cxx
--- oox/source/xls/biffinputstream.cxx	2008-04-10 18:04:34.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/biffinputstream.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -31,7 +31,6 @@
 #include "oox/xls/biffinputstream.hxx"
 #include <algorithm>
 #include <rtl/ustrbuf.hxx>
-#include "oox/helper/binaryinputstream.hxx"
 
 using ::rtl::OString;
 using ::rtl::OStringToOUString;
@@ -96,7 +95,7 @@ bool BiffInputRecordBuffer::startRecord(
         mrInStrm >> mnRecId >> mnRecSize;
         mnBodyPos = mrInStrm.tell();
         mnNextHeaderPos = mnBodyPos + mnRecSize;
-        mbValidHeader = mnNextHeaderPos <= mrInStrm.getLength();
+        mbValidHeader = !mrInStrm.isEof() && (mnNextHeaderPos <= mrInStrm.getLength());
     }
     if( !mbValidHeader )
     {
@@ -134,7 +133,7 @@ void BiffInputRecordBuffer::read( void* 
     mnRecPos = mnRecPos + nBytes;
 }
 
-inline void BiffInputRecordBuffer::skip( sal_uInt16 nBytes )
+void BiffInputRecordBuffer::skip( sal_uInt16 nBytes )
 {
     OSL_ENSURE( nBytes > 0, "BiffInputRecordBuffer::skip - nothing to skip" );
     OSL_ENSURE( nBytes <= getRecLeft(), "BiffInputRecordBuffer::skip - buffer overflow" );
@@ -149,7 +148,7 @@ void BiffInputRecordBuffer::updateBuffer
         mrInStrm.seek( mnBodyPos );
         maOriginalData.resize( mnRecSize );
         if( mnRecSize > 0 )
-            mrInStrm.read( &maOriginalData.front(), static_cast< sal_Int32 >( mnRecSize ) );
+            mrInStrm.readMemory( &maOriginalData.front(), static_cast< sal_Int32 >( mnRecSize ) );
         mnBufferBodyPos = mnBodyPos;
         updateDecoded();
     }
@@ -178,13 +177,9 @@ BiffInputStream::BiffInputStream( Binary
     mnComplRecSize( 0 ),
     mbHasComplRec( false ),
     mbCont( bContLookup ),
-    mbNulChars( false ),
-    mbValid( false )
-{
-}
-
-BiffInputStream::~BiffInputStream()
+    mbNulChars( false )
 {
+    mbEof = true;   // EOF will be true if stream is not inside a record
 }
 
 // record control -------------------------------------------------------------
@@ -252,64 +247,87 @@ void BiffInputStream::enableDecoder( boo
 
 // stream/record state and info -----------------------------------------------
 
-sal_uInt32 BiffInputStream::getRecPos() const
+sal_uInt16 BiffInputStream::getNextRecId()
 {
-    return mbValid ? (mnCurrRecSize - maRecBuffer.getRecLeft()) : BIFF_REC_SEEK_TO_END;
+    sal_uInt16 nRecId = BIFF_ID_UNKNOWN;
+    if( isInRecord() )
+    {
+        sal_Int64 nCurrPos = tell();            // save current position in record
+        while( jumpToNextContinue() ) {}        // skip following CONTINUE records
+        if( maRecBuffer.startNextRecord() )     // read header of next record
+            nRecId = maRecBuffer.getRecId();
+        seek( nCurrPos );                       // restore position, seek() resets old mbValid state
+    }
+    return nRecId;
 }
 
-sal_uInt32 BiffInputStream::getRecSize()
-{
-    if( !mbHasComplRec )
+// BinaryStreamBase interface (seeking) ---------------------------------------
+
+bool BiffInputStream::isSeekable() const
     {
-        sal_uInt32 nCurrPos = getRecPos();      // save current position in record
-        while( jumpToNextContinue() );          // jumpToNextContinue() adds up mnCurrRecSize
-        mnComplRecSize = mnCurrRecSize;
-        mbHasComplRec = true;
-        seek( nCurrPos );                       // restore position, seek() resets old mbValid state
+    return true;
     }
-    return mnComplRecSize;
+
+sal_Int64 BiffInputStream::tell() const
+{
+    return mbEof ? -1 : (mnCurrRecSize - maRecBuffer.getRecLeft());
 }
 
-sal_uInt32 BiffInputStream::getRecLeft()
+sal_Int64 BiffInputStream::getLength() const
 {
-    return mbValid ? (getRecSize() - getRecPos()) : 0;
+    if( !mbHasComplRec )
+        const_cast< BiffInputStream* >( this )->calcRecordLength();
+    return mnComplRecSize;
 }
 
-sal_uInt16 BiffInputStream::getNextRecId()
+void BiffInputStream::seek( sal_Int64 nRecPos )
 {
-    sal_uInt16 nRecId = BIFF_ID_UNKNOWN;
     if( isInRecord() )
     {
-        sal_uInt32 nCurrPos = getRecPos();      // save current position in record
-        while( jumpToNextContinue() );          // skip following CONTINUE records
-        if( maRecBuffer.startNextRecord() )     // read header of next record
-            nRecId = maRecBuffer.getRecId();
-        seek( nCurrPos );                       // restore position, seek() resets old mbValid state
+        if( mbEof || (nRecPos < tell()) )
+            restartRecord( false );
+        if( !mbEof && (nRecPos > tell()) )
+            skip( static_cast< sal_Int32 >( nRecPos - tell() ) );
     }
-    return nRecId;
 }
 
-sal_Int64 BiffInputStream::getCoreStreamPos() const
+sal_Int64 BiffInputStream::tellBase() const
 {
-    return maRecBuffer.getCoreStream().tell();
+    return maRecBuffer.getBaseStream().tell();
 }
 
-sal_Int64 BiffInputStream::getCoreStreamSize() const
+sal_Int64 BiffInputStream::getBaseLength() const
 {
-    return maRecBuffer.getCoreStream().getLength();
+    return maRecBuffer.getBaseStream().getLength();
 }
 
-// stream read access ---------------------------------------------------------
+// BinaryInputStream interface (stream read access) ---------------------------
 
-sal_uInt32 BiffInputStream::read( void* opData, sal_uInt32 nBytes )
+sal_Int32 BiffInputStream::readData( StreamDataSequence& orData, sal_Int32 nBytes )
 {
-    sal_uInt32 nRet = 0;
-    if( mbValid && opData && (nBytes > 0) )
+    sal_Int32 nRet = 0;
+    if( !mbEof )
     {
-        sal_uInt8* pnBuffer = reinterpret_cast< sal_uInt8* >( opData );
-        sal_uInt32 nBytesLeft = nBytes;
+        orData.realloc( ::std::max< sal_Int32 >( nBytes, 0 ) );
+        if( nBytes > 0 )
+        {
+            nRet = readMemory( orData.getArray(), nBytes );
+            if( nRet < nBytes )
+                orData.realloc( nRet );
+        }
+    }
+    return nRet;
+}
+
+sal_Int32 BiffInputStream::readMemory( void* opMem, sal_Int32 nBytes )
+{
+    sal_Int32 nRet = 0;
+    if( !mbEof && opMem && (nBytes > 0) )
+    {
+        sal_uInt8* pnBuffer = reinterpret_cast< sal_uInt8* >( opMem );
+        sal_Int32 nBytesLeft = nBytes;
 
-        while( mbValid && (nBytesLeft > 0) )
+        while( !mbEof && (nBytesLeft > 0) )
         {
             sal_uInt16 nReadSize = getMaxRawReadSize( nBytesLeft );
             // check nReadSize, stream may already be located at end of a raw record
@@ -322,30 +340,16 @@ sal_uInt32 BiffInputStream::read( void* 
             }
             if( nBytesLeft > 0 )
                 jumpToNextContinue();
-            OSL_ENSURE( mbValid, "BiffInputStream::read - record overread" );
+            OSL_ENSURE( !mbEof, "BiffInputStream::readMemory - record overread" );
         }
     }
     return nRet;
 }
 
-// seeking --------------------------------------------------------------------
-
-BiffInputStream& BiffInputStream::seek( sal_uInt32 nRecPos )
-{
-    if( isInRecord() )
-    {
-        if( !mbValid || (nRecPos < getRecPos()) )
-            restartRecord( false );
-        if( mbValid && (nRecPos > getRecPos()) )
-            skip( nRecPos - getRecPos() );
-    }
-    return *this;
-}
-
-BiffInputStream& BiffInputStream::skip( sal_uInt32 nBytes )
+void BiffInputStream::skip( sal_Int32 nBytes )
 {
-    sal_uInt32 nBytesLeft = nBytes;
-    while( mbValid && (nBytesLeft > 0) )
+    sal_Int32 nBytesLeft = nBytes;
+    while( !mbEof && (nBytesLeft > 0) )
     {
         sal_uInt16 nSkipSize = getMaxRawReadSize( nBytesLeft );
         // check nSkipSize, stream may already be located at end of a raw record
@@ -356,9 +360,8 @@ BiffInputStream& BiffInputStream::skip( 
         }
         if( nBytesLeft > 0 )
             jumpToNextContinue();
-        OSL_ENSURE( mbValid, "BiffInputStream::skip - record overread" );
+        OSL_ENSURE( !mbEof, "BiffInputStream::skip - record overread" );
     }
-    return *this;
 }
 
 // byte strings ---------------------------------------------------------------
@@ -369,10 +372,9 @@ OString BiffInputStream::readCharArray( 
         return OString();
 
     ::std::vector< sal_Char > aBuffer( static_cast< size_t >( nChars ) );
-    size_t nCharsRead = static_cast< size_t >( read( &aBuffer.front(), nChars ) );
-    aBuffer.resize( nCharsRead );
+    size_t nCharsRead = static_cast< size_t >( readMemory( &aBuffer.front(), nChars ) );
     if( !mbNulChars )
-        ::std::replace( aBuffer.begin(), aBuffer.end(), '\0', '?' );
+        ::std::replace( aBuffer.begin(), aBuffer.begin() + nCharsRead, '\0', '?' );
     return OString( &aBuffer.front(), nCharsRead );
 }
 
@@ -399,6 +401,14 @@ void BiffInputStream::skipByteString( bo
 
 // Unicode strings ------------------------------------------------------------
 
+OUString BiffInputStream::readNulUnicodeArray()
+{
+    OUStringBuffer aBuffer;
+    for( sal_uInt16 nChar = readuInt16(); !mbEof && (nChar > 0); readValue( nChar ) )
+        aBuffer.append( static_cast< sal_Unicode >( nChar ) );
+    return aBuffer.makeStringAndClear();
+}
+
 OUString BiffInputStream::readUnicodeArray( sal_uInt16 nChars )
 {
     OUStringBuffer aBuffer;
@@ -414,7 +424,7 @@ OUString BiffInputStream::readUniStringC
     /*  This function has to react on CONTINUE records to read the repeated
         flags field, so readUnicodeArray() cannot be used here. */
     sal_uInt16 nCharsLeft = nChars;
-    while( mbValid && (nCharsLeft > 0) )
+    while( !mbEof && (nCharsLeft > 0) )
     {
         sal_uInt16 nPortionCount = 0;
         if( b16Bit )
@@ -443,7 +453,7 @@ OUString BiffInputStream::readUniStringC
 OUString BiffInputStream::readUniString( sal_uInt16 nChars )
 {
     bool b16Bit;
-    sal_uInt32 nAddSize;
+    sal_Int32 nAddSize;
     readUniStringHeader( b16Bit, nAddSize );
     OUString aString = readUniStringChars( nChars, b16Bit );
     skip( nAddSize );
@@ -458,7 +468,7 @@ OUString BiffInputStream::readUniString(
 void BiffInputStream::skipUniStringChars( sal_uInt16 nChars, bool b16Bit )
 {
     sal_uInt16 nCharsLeft = nChars;
-    while( mbValid && (nCharsLeft > 0) )
+    while( !mbEof && (nCharsLeft > 0) )
     {
         sal_uInt16 nPortionCount;
         if( b16Bit )
@@ -484,7 +494,7 @@ void BiffInputStream::skipUniStringChars
 void BiffInputStream::skipUniString( sal_uInt16 nChars )
 {
     bool b16Bit;
-    sal_uInt32 nAddSize;
+    sal_Int32 nAddSize;
     readUniStringHeader( b16Bit, nAddSize );
     skipUniStringChars( nChars, b16Bit );
     skip( nAddSize );
@@ -497,6 +507,13 @@ void BiffInputStream::skipUniString()
 
 // private --------------------------------------------------------------------
 
+void BiffInputStream::readAtom( void* opMem, sal_uInt8 nSize )
+{
+    // byte swapping is done in calling BinaryInputStream::readValue() template function
+    if( ensureRawReadSize( nSize ) )
+        maRecBuffer.read( opMem, nSize );
+}
+
 void BiffInputStream::setupRecord()
 {
     // initialize class members
@@ -505,8 +522,8 @@ void BiffInputStream::setupRecord()
     mnAltContId = BIFF_ID_UNKNOWN;
     mnCurrRecSize = mnComplRecSize = maRecBuffer.getRecSize();
     mbHasComplRec = !mbCont;
-    mbValid = isInRecord();
     mbNulChars = false;
+    mbEof = !isInRecord();
     // enable decoder in new record
     enableDecoder( true );
 }
@@ -522,7 +539,7 @@ void BiffInputStream::restartRecord( boo
             mnComplRecSize = mnCurrRecSize;
             mbHasComplRec = !mbCont;
         }
-        mbValid = true;
+        mbEof = false;
     }
 }
 
@@ -532,7 +549,7 @@ void BiffInputStream::rewindToRecord( sa
     {
         maRecBuffer.restartAt( nRecHandle );
         mnRecHandle = -1;
-        mbValid = false;
+        mbEof = true;   // as long as the record is not started
     }
 }
 
@@ -543,17 +560,17 @@ bool BiffInputStream::isContinueId( sal_
 
 bool BiffInputStream::jumpToNextContinue()
 {
-    mbValid = mbValid && mbCont && isContinueId( maRecBuffer.getNextRecId() ) && maRecBuffer.startNextRecord();
-    if( mbValid )
+    mbEof = mbEof || !mbCont || !isContinueId( maRecBuffer.getNextRecId() ) || !maRecBuffer.startNextRecord();
+    if( !mbEof )
         mnCurrRecSize += maRecBuffer.getRecSize();
-    return mbValid;
+    return !mbEof;
 }
 
 bool BiffInputStream::jumpToNextStringContinue( bool& rb16Bit )
 {
     OSL_ENSURE( maRecBuffer.getRecLeft() == 0, "BiffInputStream::jumpToNextStringContinue - unexpected garbage" );
 
-    if( mbCont && (getRecLeft() > 0) )
+    if( mbCont && (getRemaining() > 0) )
     {
         jumpToNextContinue();
     }
@@ -562,8 +579,8 @@ bool BiffInputStream::jumpToNextStringCo
         /*  CONTINUE handling is off, but we have started reading in a CONTINUE
             record -> start next CONTINUE for TXO import. We really start a new
             record here - no chance to return to string origin. */
-        mbValid = mbValid && (maRecBuffer.getNextRecId() == BIFF_ID_CONT) && maRecBuffer.startNextRecord();
-        if( mbValid )
+        mbEof = mbEof || (maRecBuffer.getNextRecId() != BIFF_ID_CONT) || !maRecBuffer.startNextRecord();
+        if( !mbEof )
             setupRecord();
     }
 
@@ -571,44 +588,53 @@ bool BiffInputStream::jumpToNextStringCo
     sal_uInt8 nFlags;
     readValue( nFlags );
     rb16Bit = getFlag( nFlags, BIFF_STRF_16BIT );
-    return mbValid;
+    return !mbEof;
+}
+
+void BiffInputStream::calcRecordLength()
+{
+    sal_Int64 nCurrPos = tell();            // save current position in record
+    while( jumpToNextContinue() ) {}        // jumpToNextContinue() adds up mnCurrRecSize
+    mnComplRecSize = mnCurrRecSize;
+    mbHasComplRec = true;
+    seek( nCurrPos );                       // restore position, seek() resets old mbValid state
 }
 
 bool BiffInputStream::ensureRawReadSize( sal_uInt16 nBytes )
 {
-    if( mbValid && (nBytes > 0) )
+    if( !mbEof && (nBytes > 0) )
     {
-        while( mbValid && (maRecBuffer.getRecLeft() == 0) ) jumpToNextContinue();
-        mbValid = mbValid && (nBytes <= maRecBuffer.getRecLeft());
-        OSL_ENSURE( mbValid, "BiffInputStream::ensureRawReadSize - record overread" );
+        while( !mbEof && (maRecBuffer.getRecLeft() == 0) ) jumpToNextContinue();
+        mbEof = mbEof || (nBytes > maRecBuffer.getRecLeft());
+        OSL_ENSURE( !mbEof, "BiffInputStream::ensureRawReadSize - record overread" );
     }
-    return mbValid;
+    return !mbEof;
 }
 
-sal_uInt16 BiffInputStream::getMaxRawReadSize( sal_uInt32 nBytes ) const
+sal_uInt16 BiffInputStream::getMaxRawReadSize( sal_Int32 nBytes ) const
 {
-    return static_cast< sal_uInt16 >( ::std::min< sal_uInt32 >( nBytes, maRecBuffer.getRecLeft() ) );
+    return getLimitedValue< sal_uInt16, sal_Int32 >( nBytes, 0, maRecBuffer.getRecLeft() );
 }
 
 void BiffInputStream::appendUnicodeArray( OUStringBuffer& orBuffer, sal_uInt16 nChars, bool b16Bit )
 {
     orBuffer.ensureCapacity( orBuffer.getLength() + nChars );
     sal_uInt16 nChar;
-    for( sal_uInt16 nCharIdx = 0; mbValid && (nCharIdx < nChars); ++nCharIdx )
+    for( sal_uInt16 nCharIdx = 0; !mbEof && (nCharIdx < nChars); ++nCharIdx )
     {
         if( b16Bit ) readValue( nChar ); else nChar = readuInt8();
         orBuffer.append( static_cast< sal_Unicode >( (!mbNulChars && (nChar == 0)) ? '?' : nChar ) );
     }
 }
 
-void BiffInputStream::readUniStringHeader( bool& orb16Bit, sal_uInt32& ornAddSize )
+void BiffInputStream::readUniStringHeader( bool& orb16Bit, sal_Int32& ornAddSize )
 {
     sal_uInt8 nFlags = readuInt8();
     OSL_ENSURE( !getFlag( nFlags, BIFF_STRF_UNKNOWN ), "BiffInputStream::readUniStringHeader - unknown flags" );
     orb16Bit = getFlag( nFlags, BIFF_STRF_16BIT );
     sal_uInt16 nFontCount = getFlag( nFlags, BIFF_STRF_RICH ) ? readuInt16() : 0;
-    sal_uInt32 nPhoneticSize = getFlag( nFlags, BIFF_STRF_PHONETIC ) ? readuInt32() : 0;
-    ornAddSize = 4 * nFontCount + nPhoneticSize;
+    sal_Int32 nPhoneticSize = getFlag( nFlags, BIFF_STRF_PHONETIC ) ? readInt32() : 0;
+    ornAddSize = 4 * nFontCount + ::std::max< sal_Int32 >( 0, nPhoneticSize );
 }
 
 // ============================================================================
@@ -616,7 +642,7 @@ void BiffInputStream::readUniStringHeade
 BiffInputStreamPos::BiffInputStreamPos( BiffInputStream& rStrm ) :
     mrStrm( rStrm ),
     mnRecHandle( rStrm.getRecHandle() ),
-    mnRecPos( rStrm.getRecPos() )
+    mnRecPos( rStrm.tell() )
 {
 }
 
@@ -625,17 +651,17 @@ bool BiffInputStreamPos::restorePosition
     bool bValidRec = mrStrm.startRecordByHandle( mnRecHandle );
     if( bValidRec )
         mrStrm.seek( mnRecPos );
-    return bValidRec && mrStrm.isValid();
+    return bValidRec && !mrStrm.isEof();
 }
 
 // ============================================================================
 
-BiffInputStreamGuard::BiffInputStreamGuard( BiffInputStream& rStrm ) :
+BiffInputStreamPosGuard::BiffInputStreamPosGuard( BiffInputStream& rStrm ) :
     BiffInputStreamPos( rStrm )
 {
 }
 
-BiffInputStreamGuard::~BiffInputStreamGuard()
+BiffInputStreamPosGuard::~BiffInputStreamPosGuard()
 {
     restorePosition();
 }
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/biffoutputstream.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/biffoutputstream.cxx
--- oox/source/xls/biffoutputstream.cxx	2008-04-10 18:04:51.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/biffoutputstream.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -29,7 +29,6 @@
  ************************************************************************/
 
 #include "oox/xls/biffoutputstream.hxx"
-#include "oox/helper/binaryoutputstream.hxx"
 
 namespace oox {
 namespace xls {
@@ -63,7 +62,7 @@ void BiffOutputRecordBuffer::endRecord()
     mrOutStrm.seekToEnd();
     mrOutStrm << mnRecId << nRecSize;
     if( nRecSize > 0 )
-        mrOutStrm.write( &maData.front(), nRecSize );
+        mrOutStrm.writeMemory( &maData.front(), nRecSize );
     mbInRec = false;
 }
 
@@ -95,10 +94,6 @@ BiffOutputStream::BiffOutputStream( Bina
 {
 }
 
-BiffOutputStream::~BiffOutputStream()
-{
-}
-
 // record control -------------------------------------------------------------
 
 void BiffOutputStream::startRecord( sal_uInt16 nRecId )
@@ -109,25 +104,43 @@ void BiffOutputStream::startRecord( sal_
 
 void BiffOutputStream::endRecord()
 {
+    setPortionSize( 0 );
     maRecBuffer.endRecord();
 }
 
 void BiffOutputStream::setPortionSize( sal_uInt16 nSize )
 {
+    OSL_ENSURE( mnPortionPos == 0, "BiffOutputStream::setPortionSize - block operation inside portion" );
     mnPortionSize = nSize;
     mnPortionPos = 0;
 }
 
-// stream/record state and info -----------------------------------------------
+// BinaryStreamBase interface (seeking) ---------------------------------------
 
-// stream write access --------------------------------------------------------
+sal_Int64 BiffOutputStream::tellBase() const
+{
+    return maRecBuffer.getBaseStream().tell();
+}
 
-void BiffOutputStream::write( const void* pData, sal_uInt32 nBytes )
+sal_Int64 BiffOutputStream::getBaseLength() const
 {
-    if( pData && (nBytes > 0) )
+    return maRecBuffer.getBaseStream().getLength();
+}
+
+// BinaryOutputStream interface (stream write access) -------------------------
+
+void BiffOutputStream::writeData( const StreamDataSequence& rData )
     {
-        const sal_uInt8* pnBuffer = reinterpret_cast< const sal_uInt8* >( pData );
-        sal_uInt32 nBytesLeft = nBytes;
+    if( rData.hasElements() )
+        writeMemory( rData.getConstArray(), rData.getLength() );
+}
+
+void BiffOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes )
+{
+    if( pMem && (nBytes > 0) )
+    {
+        const sal_uInt8* pnBuffer = reinterpret_cast< const sal_uInt8* >( pMem );
+        sal_Int32 nBytesLeft = nBytes;
         while( nBytesLeft > 0 )
         {
             sal_uInt16 nBlockSize = prepareRawBlock( nBytesLeft );
@@ -138,9 +151,9 @@ void BiffOutputStream::write( const void
     }
 }
 
-void BiffOutputStream::fill( sal_uInt8 nValue, sal_uInt32 nBytes )
+void BiffOutputStream::fill( sal_uInt8 nValue, sal_Int32 nBytes )
 {
-    sal_uInt32 nBytesLeft = nBytes;
+    sal_Int32 nBytesLeft = nBytes;
     while( nBytesLeft > 0 )
     {
         sal_uInt16 nBlockSize = prepareRawBlock( nBytesLeft );
@@ -149,8 +162,20 @@ void BiffOutputStream::fill( sal_uInt8 n
     }
 }
 
+void BiffOutputStream::writeBlock( const void* pMem, sal_uInt16 nBytes )
+{
+    ensureRawBlock( nBytes );
+    maRecBuffer.write( pMem, nBytes );
+}
+
 // private --------------------------------------------------------------------
 
+void BiffOutputStream::writeAtom( const void* pMem, sal_uInt8 nSize )
+{
+    // byte swapping is done in calling BinaryOutputStream::writeValue() template function
+    writeBlock( pMem, nSize );
+}
+
 void BiffOutputStream::ensureRawBlock( sal_uInt16 nSize )
 {
     if( (maRecBuffer.getRecLeft() < nSize) ||
@@ -161,12 +186,12 @@ void BiffOutputStream::ensureRawBlock( s
     }
     if( mnPortionSize > 0 )
     {
-        OSL_ENSURE( mnPortionPos + nSize <= mnPortionSize, "BiffOutputStreamI::ensureRawBlock - portion overflow" );
+        OSL_ENSURE( mnPortionPos + nSize <= mnPortionSize, "BiffOutputStream::ensureRawBlock - portion overflow" );
         mnPortionPos = (mnPortionPos + nSize) % mnPortionSize;  // prevent compiler warning, do not use operator+=, operator%=
     }
 }
 
-sal_uInt16 BiffOutputStream::prepareRawBlock( sal_uInt32 nTotalSize )
+sal_uInt16 BiffOutputStream::prepareRawBlock( sal_Int32 nTotalSize )
 {
     sal_uInt16 nRecLeft = maRecBuffer.getRecLeft();
     if( mnPortionSize > 0 )
@@ -175,7 +200,7 @@ sal_uInt16 BiffOutputStream::prepareRawB
         OSL_ENSURE( nTotalSize % mnPortionSize == 0, "BiffOutputStream::prepareRawBlock - portion size does not match block size" );
         nRecLeft = (nRecLeft / mnPortionSize) * mnPortionSize;
     }
-    sal_uInt16 nSize = getLimitedValue< sal_uInt16, sal_uInt32 >( nTotalSize, 0, nRecLeft );
+    sal_uInt16 nSize = getLimitedValue< sal_uInt16, sal_Int32 >( nTotalSize, 0, nRecLeft );
     ensureRawBlock( nSize );
     return nSize;
 }
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/chartsheetfragment.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/chartsheetfragment.cxx
--- oox/source/xls/chartsheetfragment.cxx	2008-07-01 14:22:03.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/chartsheetfragment.cxx	2009-03-19 14:28:43.000000000 +0100
@@ -68,6 +68,8 @@ ContextWrapper OoxChartsheetFragment::on
                     (nElement == XLS_TOKEN( headerFooter )) ||
                     (nElement == XLS_TOKEN( picture )) ||
                     (nElement == XLS_TOKEN( drawing ));
+        case XLS_TOKEN( sheetPr ):
+            return  (nElement == XLS_TOKEN( tabColor ));
         case XLS_TOKEN( sheetViews ):
             return  (nElement == XLS_TOKEN( sheetView ));
         case XLS_TOKEN( headerFooter ):
@@ -86,6 +88,7 @@ void OoxChartsheetFragment::onStartEleme
     switch( getCurrentElement() )
     {
         case XLS_TOKEN( sheetPr ):          getWorksheetSettings().importChartSheetPr( rAttribs );              break;
+        case XLS_TOKEN( tabColor ):         getSheetViewSettings().importTabColor( rAttribs );                  break;
         case XLS_TOKEN( sheetProtection ):  getWorksheetSettings().importChartProtection( rAttribs );           break;
         case XLS_TOKEN( sheetView ):        getSheetViewSettings().importChartSheetView( rAttribs );            break;
         case XLS_TOKEN( pageMargins ):      getPageSettings().importPageMargins( rAttribs );                    break;
@@ -190,12 +193,13 @@ void OoxChartsheetFragment::importDrawin
 
 // ============================================================================
 
-BiffChartsheetFragment::BiffChartsheetFragment( const WorkbookHelper& rHelper, ISegmentProgressBarRef xProgressBar, sal_Int32 nSheet ) :
-    BiffWorksheetFragmentBase( rHelper, xProgressBar, SHEETTYPE_CHARTSHEET, nSheet )
+BiffChartsheetFragment::BiffChartsheetFragment( const BiffWorkbookFragmentBase& rParent,
+        ISegmentProgressBarRef xProgressBar, sal_Int32 nSheet ) :
+    BiffWorksheetFragmentBase( rParent, xProgressBar, SHEETTYPE_CHARTSHEET, nSheet )
 {
 }
 
-bool BiffChartsheetFragment::importFragment( BiffInputStream& rStrm )
+bool BiffChartsheetFragment::importFragment()
 {
     // initial processing in base class WorksheetHelper
     initializeWorksheetImport();
@@ -205,76 +209,79 @@ bool BiffChartsheetFragment::importFragm
     PageSettings& rPageSett           = getPageSettings();
 
     // process all record in this sheet fragment
-    while( rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) )
+    while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
     {
-        sal_uInt16 nRecId = rStrm.getRecId();
-
-        if( isBofRecord( nRecId ) )
+        if( isBofRecord() )
         {
             // skip unknown embedded fragments (BOF/EOF blocks)
-            skipFragment( rStrm );
+            skipFragment();
         }
-        else switch( nRecId )
+        else
+        {
+            sal_uInt16 nRecId = mrStrm.getRecId();
+            switch( nRecId )
         {
             // records in all BIFF versions
-            case BIFF_ID_BOTTOMMARGIN:  rPageSett.importBottomMargin( rStrm );  break;
-            case BIFF_ID_FOOTER:        rPageSett.importFooter( rStrm );        break;
-            case BIFF_ID_HEADER:        rPageSett.importHeader( rStrm );        break;
-            case BIFF_ID_LEFTMARGIN:    rPageSett.importLeftMargin( rStrm );    break;
-            case BIFF_ID_PASSWORD:      rWorksheetSett.importPassword( rStrm ); break;
-            case BIFF_ID_PROTECT:       rWorksheetSett.importProtect( rStrm );  break;
-            case BIFF_ID_RIGHTMARGIN:   rPageSett.importRightMargin( rStrm );   break;
-            case BIFF_ID_TOPMARGIN:     rPageSett.importTopMargin( rStrm );     break;
+                case BIFF_ID_BOTTOMMARGIN:  rPageSett.importBottomMargin( mrStrm );     break;
+                case BIFF_ID_CHBEGIN:       skipRecordBlock( BIFF_ID_CHEND );           break;
+                case BIFF_ID_FOOTER:        rPageSett.importFooter( mrStrm );           break;
+                case BIFF_ID_HEADER:        rPageSett.importHeader( mrStrm );           break;
+                case BIFF_ID_LEFTMARGIN:    rPageSett.importLeftMargin( mrStrm );       break;
+                case BIFF_ID_PASSWORD:      rWorksheetSett.importPassword( mrStrm );    break;
+                case BIFF_ID_PROTECT:       rWorksheetSett.importProtect( mrStrm );     break;
+                case BIFF_ID_RIGHTMARGIN:   rPageSett.importRightMargin( mrStrm );      break;
+                case BIFF_ID_TOPMARGIN:     rPageSett.importTopMargin( mrStrm );        break;
 
             // BIFF specific records
             default: switch( getBiff() )
             {
                 case BIFF2: switch( nRecId )
                 {
-                    case BIFF2_ID_WINDOW2:      rSheetViewSett.importWindow2( rStrm );  break;
+                        case BIFF2_ID_WINDOW2:      rSheetViewSett.importWindow2( mrStrm );  break;
                 }
                 break;
 
                 case BIFF3: switch( nRecId )
                 {
-                    case BIFF_ID_HCENTER:       rPageSett.importHorCenter( rStrm );             break;
-                    case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm );    break;
-                    case BIFF_ID_VCENTER:       rPageSett.importVerCenter( rStrm );             break;
-                    case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( rStrm );          break;
+                        case BIFF_ID_HCENTER:       rPageSett.importHorCenter( mrStrm );            break;
+                        case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm );   break;
+                        case BIFF_ID_VCENTER:       rPageSett.importVerCenter( mrStrm );            break;
+                        case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( mrStrm );         break;
 
                 }
                 break;
 
                 case BIFF4: switch( nRecId )
                 {
-                    case BIFF_ID_HCENTER:       rPageSett.importHorCenter( rStrm );             break;
-                    case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm );    break;
-                    case BIFF_ID_PAGESETUP:     rPageSett.importPageSetup( rStrm );             break;
-                    case BIFF_ID_VCENTER:       rPageSett.importVerCenter( rStrm );             break;
-                    case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( rStrm );          break;
+                        case BIFF_ID_HCENTER:       rPageSett.importHorCenter( mrStrm );            break;
+                        case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm );   break;
+                        case BIFF_ID_PAGESETUP:     rPageSett.importPageSetup( mrStrm );            break;
+                        case BIFF_ID_VCENTER:       rPageSett.importVerCenter( mrStrm );            break;
+                        case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( mrStrm );         break;
                 }
                 break;
 
                 case BIFF5: switch( nRecId )
                 {
-                    case BIFF_ID_HCENTER:       rPageSett.importHorCenter( rStrm );             break;
-                    case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm );    break;
-                    case BIFF_ID_PAGESETUP:     rPageSett.importPageSetup( rStrm );             break;
-                    case BIFF_ID_SCENPROTECT:   rWorksheetSett.importScenProtect( rStrm );      break;
-                    case BIFF_ID_SCL:           rSheetViewSett.importScl( rStrm );              break;
-                    case BIFF_ID_VCENTER:       rPageSett.importVerCenter( rStrm );             break;
-                    case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( rStrm );          break;
+                        case BIFF_ID_HCENTER:       rPageSett.importHorCenter( mrStrm );            break;
+                        case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm );   break;
+                        case BIFF_ID_PAGESETUP:     rPageSett.importPageSetup( mrStrm );            break;
+                        case BIFF_ID_SCENPROTECT:   rWorksheetSett.importScenProtect( mrStrm );     break;
+                        case BIFF_ID_SCL:           rSheetViewSett.importScl( mrStrm );             break;
+                        case BIFF_ID_VCENTER:       rPageSett.importVerCenter( mrStrm );            break;
+                        case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( mrStrm );         break;
                 }
                 break;
 
                 case BIFF8: switch( nRecId )
                 {
-                    case BIFF_ID_HCENTER:       rPageSett.importHorCenter( rStrm );             break;
-                    case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm );    break;
-                    case BIFF_ID_PICTURE:       rPageSett.importPicture( rStrm );               break;
-                    case BIFF_ID_PAGESETUP:     rPageSett.importPageSetup( rStrm );             break;
-                    case BIFF_ID_VCENTER:       rPageSett.importVerCenter( rStrm );             break;
-                    case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( rStrm );          break;
+                        case BIFF_ID_HCENTER:       rPageSett.importHorCenter( mrStrm );            break;
+                        case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm );   break;
+                        case BIFF_ID_PICTURE:       rPageSett.importPicture( mrStrm );              break;
+                        case BIFF_ID_PAGESETUP:     rPageSett.importPageSetup( mrStrm );            break;
+                        case BIFF_ID_SCL:           rSheetViewSett.importScl( mrStrm );             break;
+                        case BIFF_ID_VCENTER:       rPageSett.importVerCenter( mrStrm );            break;
+                        case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( mrStrm );         break;
                 }
                 break;
 
@@ -282,10 +289,11 @@ bool BiffChartsheetFragment::importFragm
             }
         }
     }
+    }
 
     // final processing in base class WorksheetHelper
     finalizeWorksheetImport();
-    return rStrm.getRecId() == BIFF_ID_EOF;
+    return mrStrm.getRecId() == BIFF_ID_EOF;
 }
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/condformatbuffer.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/condformatbuffer.cxx
--- oox/source/xls/condformatbuffer.cxx	2008-07-22 16:10:11.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/condformatbuffer.cxx	2009-03-25 12:15:34.000000000 +0100
@@ -49,7 +49,6 @@
 #include "oox/xls/addressconverter.hxx"
 #include "oox/xls/biffinputstream.hxx"
 #include "oox/xls/stylesbuffer.hxx"
-#include "oox/xls/validationpropertyhelper.hxx"
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -187,6 +186,8 @@ CondFormatRule::CondFormatRule( const Co
     mrCondFormat( rCondFormat )
 {
 }
+#define OUSTRING_CSTR( str ) \
+    rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr()
 
 void CondFormatRule::importCfRule( const AttributeList& rAttribs )
 {
@@ -194,6 +195,8 @@ void CondFormatRule::importCfRule( const
     maOoxData.mnPriority     = rAttribs.getInteger( XML_priority, -1 );
     maOoxData.mnType         = rAttribs.getToken( XML_type, XML_TOKEN_INVALID );
     maOoxData.mnOperator     = rAttribs.getToken( XML_operator, XML_TOKEN_INVALID );
+    OSL_TRACE ("%s: operator: %s -> %d", __PRETTY_FUNCTION__, OUSTRING_CSTR (rAttribs.getString ( XML_operator, OUString ())), maOoxData.mnOperator);
+
     maOoxData.mnTimePeriod   = rAttribs.getToken( XML_timePeriod, XML_TOKEN_INVALID );
     maOoxData.mnRank         = rAttribs.getInteger( XML_rank, 0 );
     maOoxData.mnStdDev       = rAttribs.getInteger( XML_stdDev, 0 );
@@ -210,6 +213,7 @@ void CondFormatRule::appendFormula( cons
     TokensFormulaContext aContext( true, false );
     aContext.setBaseAddress( mrCondFormat.getRanges().getBaseAddress() );
     getFormulaParser().importFormula( aContext, rFormula );
+    OSL_TRACE ("%s: formula: %s", __PRETTY_FUNCTION__, OUSTRING_CSTR (rFormula));
     maOoxData.maFormulas.push_back( aContext );
 }
 
@@ -227,8 +231,8 @@ void CondFormatRule::importCfRule( Recor
 
     // first formula
     OSL_ENSURE( (nFmla1Size >= 0) || ((nFmla2Size == 0) && (nFmla3Size == 0)), "CondFormatRule::importCfRule - missing first formula" );
-    OSL_ENSURE( (nFmla1Size > 0) == (rStrm.getRecLeft() >= 8), "CondFormatRule::importCfRule - formula size mismatch" );
-    if( rStrm.getRecLeft() >= 8 )
+    OSL_ENSURE( (nFmla1Size > 0) == (rStrm.getRemaining() >= 8), "CondFormatRule::importCfRule - formula size mismatch" );
+    if( rStrm.getRemaining() >= 8 )
     {
         TokensFormulaContext aContext( true, false );
         aContext.setBaseAddress( mrCondFormat.getRanges().getBaseAddress() );
@@ -237,15 +241,15 @@ void CondFormatRule::importCfRule( Recor
 
         // second formula
         OSL_ENSURE( (nFmla2Size >= 0) || (nFmla3Size == 0), "CondFormatRule::importCfRule - missing second formula" );
-        OSL_ENSURE( (nFmla2Size > 0) == (rStrm.getRecLeft() >= 8), "CondFormatRule::importCfRule - formula size mismatch" );
-        if( rStrm.getRecLeft() >= 8 )
+        OSL_ENSURE( (nFmla2Size > 0) == (rStrm.getRemaining() >= 8), "CondFormatRule::importCfRule - formula size mismatch" );
+        if( rStrm.getRemaining() >= 8 )
         {
             getFormulaParser().importFormula( aContext, rStrm );
             maOoxData.maFormulas.push_back( aContext );
 
             // third formula
-            OSL_ENSURE( (nFmla3Size > 0) == (rStrm.getRecLeft() >= 8), "CondFormatRule::importCfRule - formula size mismatch" );
-            if( rStrm.getRecLeft() >= 8 )
+            OSL_ENSURE( (nFmla3Size > 0) == (rStrm.getRemaining() >= 8), "CondFormatRule::importCfRule - formula size mismatch" );
+            if( rStrm.getRemaining() >= 8 )
             {
                 getFormulaParser().importFormula( aContext, rStrm );
                 maOoxData.maFormulas.push_back( aContext );
@@ -469,7 +473,7 @@ void CondFormatRule::finalizeImport( con
     switch( maOoxData.mnType )
     {
         case XML_cellIs:
-            eOperator = ValidationPropertyHelper::convertToApiOperator( maOoxData.mnOperator );
+            eOperator = CondFormatBuffer::convertToApiOperator( maOoxData.mnOperator );
         break;
         case XML_expression:
             eOperator = ::com::sun::star::sheet::ConditionOperator_FORMULA;
@@ -753,6 +757,23 @@ void CondFormatBuffer::finalizeImport()
     maCondFormats.forEachMem( &CondFormat::finalizeImport );
 }
 
+ConditionOperator CondFormatBuffer::convertToApiOperator( sal_Int32 nToken )
+{
+    using namespace ::com::sun::star::sheet;
+    switch( nToken )
+    {
+        case XML_between:               return ConditionOperator_BETWEEN;
+        case XML_equal:                 return ConditionOperator_EQUAL;
+        case XML_greaterThan:           return ConditionOperator_GREATER;
+        case XML_greaterThanOrEqual:    return ConditionOperator_GREATER_EQUAL;
+        case XML_lessThan:              return ConditionOperator_LESS;
+        case XML_lessThanOrEqual:       return ConditionOperator_LESS_EQUAL;
+        case XML_notBetween:            return ConditionOperator_NOT_BETWEEN;
+        case XML_notEqual:              return ConditionOperator_NOT_EQUAL;
+    }
+    return ConditionOperator_NONE;
+}
+
 // private --------------------------------------------------------------------
 
 CondFormatRef CondFormatBuffer::createCondFormat()
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/defnamesbuffer.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/defnamesbuffer.cxx
--- oox/source/xls/defnamesbuffer.cxx	2008-07-01 14:22:55.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/defnamesbuffer.cxx	2009-01-06 15:57:48.000000000 +0100
@@ -30,14 +30,12 @@
 
 #include "oox/xls/defnamesbuffer.hxx"
 #include <rtl/ustrbuf.hxx>
-#include <com/sun/star/sheet/XNamedRanges.hpp>
-#include <com/sun/star/sheet/XNamedRange.hpp>
-#include <com/sun/star/sheet/XFormulaTokens.hpp>
-#include <com/sun/star/sheet/XPrintAreas.hpp>
-#include <com/sun/star/sheet/ReferenceFlags.hpp>
-#include <com/sun/star/sheet/SingleReference.hpp>
 #include <com/sun/star/sheet/ComplexReference.hpp>
 #include <com/sun/star/sheet/NamedRangeFlag.hpp>
+#include <com/sun/star/sheet/ReferenceFlags.hpp>
+#include <com/sun/star/sheet/SingleReference.hpp>
+#include <com/sun/star/sheet/XFormulaTokens.hpp>
+#include <com/sun/star/sheet/XPrintAreas.hpp>
 #include "oox/helper/attributelist.hxx"
 #include "oox/helper/propertyset.hxx"
 #include "oox/xls/addressconverter.hxx"
@@ -49,17 +47,10 @@ using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
 using ::com::sun::star::uno::Any;
 using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Exception;
 using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::container::XNameAccess;
 using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::sheet::SingleReference;
 using ::com::sun::star::sheet::ComplexReference;
-using ::com::sun::star::sheet::XNamedRanges;
-using ::com::sun::star::sheet::XNamedRange;
+using ::com::sun::star::sheet::SingleReference;
 using ::com::sun::star::sheet::XFormulaTokens;
 using ::com::sun::star::sheet::XPrintAreas;
 using namespace ::com::sun::star::sheet::ReferenceFlags;
@@ -151,11 +142,18 @@ DefinedNameBase::DefinedNameBase( const 
     maOoxData.mnSheet = nLocalSheet;
 }
 
+const OUString& DefinedNameBase::getUpcaseOoxName() const
+{
+    if( maUpOoxName.getLength() == 0 )
+        maUpOoxName = maOoxData.maName.toAsciiUpperCase();
+    return maUpOoxName;
+}
+
 Any DefinedNameBase::getReference( const CellAddress& rBaseAddress ) const
 {
     if( maRefAny.hasValue() && (maOoxData.maName.getLength() >= 2) && (maOoxData.maName[ 0 ] == '\x01') )
     {
-        sal_Unicode cFlagsChar = maOoxData.maName.toAsciiUpperCase()[ 1 ];
+        sal_Unicode cFlagsChar = getUpcaseOoxName()[ 1 ];
         if( ('A' <= cFlagsChar) && (cFlagsChar <= 'P') )
         {
             sal_uInt16 nFlags = static_cast< sal_uInt16 >( cFlagsChar - 'A' );
@@ -342,16 +340,16 @@ void DefinedName::importDefinedName( Rec
         maOoxData.mbHidden = false;
 
     // store token array data
-    sal_Int32 nRecPos = rStrm.getRecPos();
+    sal_Int64 nRecPos = rStrm.tell();
     sal_Int32 nFmlaSize = rStrm.readInt32();
     rStrm.skip( nFmlaSize );
     sal_Int32 nAddDataSize = rStrm.readInt32();
-    if( rStrm.isValid() && (nFmlaSize > 0) && (nAddDataSize >= 0) && (rStrm.getRecLeft() >= nAddDataSize) )
+    if( !rStrm.isEof() && (nFmlaSize > 0) && (nAddDataSize >= 0) && (rStrm.getRemaining() >= nAddDataSize) )
     {
         sal_Int32 nTotalSize = 8 + nFmlaSize + nAddDataSize;
-        mxFormula.reset( new RecordDataSequence( nTotalSize ) );
+        mxFormula.reset( new StreamDataSequence );
         rStrm.seek( nRecPos );
-        rStrm.read( mxFormula->getArray(), nTotalSize );
+        rStrm.readData( *mxFormula, nTotalSize );
     }
 }
 
@@ -384,11 +382,13 @@ void DefinedName::importDefinedName( Bif
         break;
         case BIFF5:
             rStrm >> nFlags >> nShortCut >> nNameLen >> mnFmlaSize >> nRefId >> nTabId;
-            maOoxData.maName = rStrm.skip( 4 ).readCharArray( nNameLen, getTextEncoding() );
+            rStrm.skip( 4 );
+            maOoxData.maName = rStrm.readCharArray( nNameLen, getTextEncoding() );
         break;
         case BIFF8:
             rStrm >> nFlags >> nShortCut >> nNameLen >> mnFmlaSize >> nRefId >> nTabId;
-            maOoxData.maName = rStrm.skip( 4 ).readUniString( nNameLen );
+            rStrm.skip( 4 );
+            maOoxData.maName = rStrm.readUniString( nNameLen );
         break;
         case BIFF_UNKNOWN: break;
     }
@@ -434,7 +434,8 @@ void DefinedName::importDefinedName( Bif
                         maOoxData.mnSheet = pExtLink->getSheetIndex();
         break;
         case BIFF8:
-            // one-based sheet index
+            // convert one-based sheet index to zero-based
+            OSL_ENSURE( nTabId >= 0, "DefinedName::importDefinedName - invalid local sheet index" );
             if( nTabId != BIFF_DEFNAME_GLOBAL )
                 maOoxData.mnSheet = nTabId - 1;
         break;
@@ -475,9 +476,10 @@ void DefinedName::createNameObject()
     }
 
     // create the name and insert it into the document, maFinalName will be changed to the resulting name
-    mxNamedRange = getDefinedNames().createDefinedName( maFinalName, nNameFlags );
+    mxNamedRange = createNamedRangeObject( maFinalName, nNameFlags );
     // index of this defined name used in formula token arrays
-    mnTokenIndex = getDefinedNames().getTokenIndex( mxNamedRange );
+    PropertySet aPropSet( mxNamedRange );
+    aPropSet.getProperty( mnTokenIndex, CREATE_OUSTRING( "TokenIndex" ) );
 }
 
 void DefinedName::convertFormula()
@@ -571,7 +573,7 @@ void DefinedName::implImportBiffFormula(
 {
     OSL_ENSURE( mxBiffStrm.get(), "DefinedName::importBiffFormula - missing BIFF stream" );
     BiffInputStream& rStrm = mxBiffStrm->getStream();
-    BiffInputStreamGuard aStrmGuard( rStrm );
+    BiffInputStreamPosGuard aStrmGuard( rStrm );
     if( mxBiffStrm->restorePosition() )
         importBiffFormula( rContext, rStrm, &mnFmlaSize );
 }
@@ -580,40 +582,10 @@ void DefinedName::implImportBiffFormula(
 
 DefinedNamesBuffer::DefinedNamesBuffer( const WorkbookHelper& rHelper ) :
     WorkbookHelper( rHelper ),
-    maTokenIndexProp( CREATE_OUSTRING( "TokenIndex" ) ),
     mnLocalSheet( -1 )
 {
 }
 
-Reference< XNamedRange > DefinedNamesBuffer::createDefinedName( OUString& orName, sal_Int32 nNameFlags ) const
-{
-    // find an unused name
-    Reference< XNamedRanges > xNamedRanges = getNamedRanges();
-    Reference< XNameAccess > xNameAccess( xNamedRanges, UNO_QUERY );
-    if( xNameAccess.is() )
-        orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' );
-
-    // create the name and insert it into the Calc document
-    Reference< XNamedRange > xNamedRange;
-    if( xNamedRanges.is() && (orName.getLength() > 0) ) try
-    {
-        xNamedRanges->addNewByName( orName, OUString(), CellAddress( 0, 0, 0 ), nNameFlags );
-        xNamedRange.set( xNamedRanges->getByName( orName ), UNO_QUERY );
-    }
-    catch( Exception& )
-    {
-        OSL_ENSURE( false, "DefinedNamesBuffer::createDefinedName - cannot create defined name" );
-    }
-    return xNamedRange;
-}
-
-sal_Int32 DefinedNamesBuffer::getTokenIndex( const Reference< XNamedRange >& rxNamedRange ) const
-{
-    PropertySet aPropSet( rxNamedRange );
-    sal_Int32 nIndex = -1;
-    return aPropSet.getProperty( nIndex, maTokenIndexProp ) ? nIndex : -1;
-}
-
 void DefinedNamesBuffer::setLocalSheetIndex( sal_Int32 nLocalSheet )
 {
     mnLocalSheet = nLocalSheet;
@@ -638,8 +610,16 @@ void DefinedNamesBuffer::importDefinedNa
 
 void DefinedNamesBuffer::finalizeImport()
 {
-    /*  First insert all names without formula definition into the document. */
-    maDefNames.forEachMem( &DefinedName::createNameObject );
+    // first insert all names without formula definition into the document
+    for( DefNameVector::iterator aIt = maDefNames.begin(), aEnd = maDefNames.end(); aIt != aEnd; ++aIt )
+    {
+        DefinedNameRef xDefName = *aIt;
+        xDefName->createNameObject();
+        sal_Int32 nTokenIndex = xDefName->getTokenIndex();
+        if( nTokenIndex >= 0 )
+            maDefNameMap[ nTokenIndex ] = xDefName;
+    }
+
     /*  Now convert all name formulas, so that the formula parser can find all
         names in case of circular dependencies. */
     maDefNames.forEachMem( &DefinedName::convertFormula );
@@ -650,11 +630,16 @@ DefinedNameRef DefinedNamesBuffer::getBy
     return maDefNames.get( nIndex );
 }
 
+DefinedNameRef DefinedNamesBuffer::getByTokenIndex( sal_Int32 nIndex ) const
+{
+    return maDefNameMap.get( nIndex );
+}
+
 DefinedNameRef DefinedNamesBuffer::getByOoxName( const OUString& rOoxName, sal_Int32 nSheet ) const
 {
     DefinedNameRef xGlobalName;   // a found global name
     DefinedNameRef xLocalName;    // a found local name
-    for( DefNameVec::const_iterator aIt = maDefNames.begin(), aEnd = maDefNames.end(); (aIt != aEnd) && !xLocalName; ++aIt )
+    for( DefNameVector::const_iterator aIt = maDefNames.begin(), aEnd = maDefNames.end(); (aIt != aEnd) && !xLocalName; ++aIt )
     {
         DefinedNameRef xCurrName = *aIt;
         if( xCurrName->getOoxName() == rOoxName )
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/drawingfragment.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/drawingfragment.cxx
--- oox/source/xls/drawingfragment.cxx	2008-04-18 22:06:48.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/drawingfragment.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -443,7 +443,7 @@ void OoxDrawingFragment::onEndElement( c
             {
                 Rectangle aLoc = mxAnchor->calcEmuLocation( maEmuSheetSize );
                 if( (aLoc.X >= 0) && (aLoc.Y >= 0) && (aLoc.Width >= 0) && (aLoc.Height >= 0) )
-                    mxShape->addShape( getOoxFilter(), getTheme().getCoreThemePtr(), mxDrawPage, &aLoc );
+                    mxShape->addShape( getOoxFilter(), getThemeRef(), mxDrawPage, &aLoc );
             }
             mxShape.reset();
             mxAnchor.reset();
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/excelchartconverter.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/excelchartconverter.cxx
--- oox/source/xls/excelchartconverter.cxx	2008-07-22 16:10:57.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/excelchartconverter.cxx	2009-03-20 10:28:22.000000000 +0100
@@ -93,10 +93,8 @@ Reference< XDataSequence > ExcelChartCon
             aContext.setBaseAddress( CellAddress( getCurrentSheetIndex(), 0, 0 ) );
             rParser.importFormula( aContext, rDataSeq.maFormula );
 
-            // create a range list from the token sequence
-            ApiCellRangeList aRanges;
-            rParser.extractCellRangeList( aRanges, aContext.getTokens() );
-            aRangeRep = rParser.generateApiRangeListString( aRanges );
+            // create a range representation string from the token sequence.
+            aRangeRep = rParser.printFormulaTokens(aContext.getTokens());
         }
         else if( !rDataSeq.maData.empty() )
         {
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/excelfilter.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/excelfilter.cxx
--- oox/source/xls/excelfilter.cxx	2008-07-22 16:11:13.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/excelfilter.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -39,6 +39,7 @@
 #include "oox/dump/xlsbdumper.hxx"
 
 using ::rtl::OUString;
+using ::com::sun::star::uno::Any;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::Sequence;
 using ::com::sun::star::uno::Exception;
@@ -92,7 +93,7 @@ bool ExcelFilter::importDocument() throw
 {
     /*  to activate the XLSX/XLSB dumper, define the environment variable
         OOO_XLSBDUMPER and insert the full path to the file
-        file:///<path-to-oox-module>/source/dump/xlsbdumperconfig.dat. */
+        file:///<path-to-oox-module>/source/dump/xlsbdumper.ini. */
     OOX_DUMP_FILE( ::oox::dump::xlsb::Dumper );
 
     bool bRet = false;
@@ -117,7 +118,7 @@ bool ExcelFilter::exportDocument() throw
 
 const ::oox::drawingml::Theme* ExcelFilter::getCurrentTheme() const
 {
-    return mpHelper->getTheme().getCoreThemePtr().get();
+    return &mpHelper->getTheme();
 }
 
 sal_Int32 ExcelFilter::getSchemeClr( sal_Int32 nColorSchemeToken ) const
@@ -182,25 +183,33 @@ bool ExcelBiffFilter::importDocument() t
 {
     /*  to activate the BIFF dumper, define the environment variable
         OOO_BIFFDUMPER and insert the full path to the file
-        file:///<path-to-oox-module>/source/dump/biffdumperconfig.dat. */
+        file:///<path-to-oox-module>/source/dump/biffdumper.ini. */
     OOX_DUMP_FILE( ::oox::dump::biff::Dumper );
 
+    /*  A boolean argument passed through XInitialisation decides whether to
+        use the BIFF file dumper implemented in this filter only, or to really
+        import/export the document. */
+    const Sequence< Any >& rArgs = getArguments();
+    bool bDumperOnly = false;
+    if( (rArgs.getLength() >= 2) && (rArgs[ 1 ] >>= bDumperOnly) && bDumperOnly )
+        return true;
+
     bool bRet = false;
 
     // detect BIFF version and workbook stream name
     OUString aWorkbookName;
     BiffType eBiff = BiffDetector::detectStorageBiffVersion( aWorkbookName, getStorage() );
-    BinaryInputStream aInStrm( getStorage()->openInputStream( aWorkbookName ), aWorkbookName.getLength() > 0 );
-    OSL_ENSURE( (eBiff != BIFF_UNKNOWN) && aInStrm.is(), "ExcelBiffFilter::ExcelBiffFilter - invalid file format" );
+    BinaryXInputStream aInStrm( getStorage()->openInputStream( aWorkbookName ), aWorkbookName.getLength() > 0 );
+    OSL_ENSURE( (eBiff != BIFF_UNKNOWN) && !aInStrm.isEof(), "ExcelBiffFilter::ExcelBiffFilter - invalid file format" );
 
-    if( (eBiff != BIFF_UNKNOWN) && aInStrm.is() )
+    if( (eBiff != BIFF_UNKNOWN) && !aInStrm.isEof() )
     {
         WorkbookHelperRoot aHelper( *this, eBiff );
         if( aHelper.isValid() )
         {
-            BiffWorkbookFragment aFragment( aHelper );
             BiffInputStream aBiffStream( aInStrm );
-            bRet = aFragment.importFragment( aBiffStream );
+            BiffWorkbookFragment aFragment( aHelper, aBiffStream );
+            bRet = aFragment.importFragment();
         }
     }
     return bRet;
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/excelhandlers.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/excelhandlers.cxx
--- oox/source/xls/excelhandlers.cxx	2008-04-10 18:07:11.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/excelhandlers.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -29,19 +29,20 @@
  ************************************************************************/
 
 #include "oox/xls/excelhandlers.hxx"
+#include "oox/xls/biffinputstream.hxx"
 
 using ::rtl::OUString;
-using ::oox::core::FragmentHandler2;
 using ::oox::core::XmlFilterBase;
 
 namespace oox {
 namespace xls {
 
 // ============================================================================
+// ============================================================================
 
 OoxWorkbookFragmentBase::OoxWorkbookFragmentBase(
         const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
-    FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
+    OoxFragmentHandler( rHelper.getOoxFilter(), rFragmentPath ),
     WorkbookHelper( rHelper )
 {
 }
@@ -50,20 +51,183 @@ OoxWorkbookFragmentBase::OoxWorkbookFrag
 
 OoxWorksheetFragmentBase::OoxWorksheetFragmentBase( const WorkbookHelper& rHelper,
         const OUString& rFragmentPath, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
-    FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
+    OoxFragmentHandler( rHelper.getOoxFilter(), rFragmentPath ),
     WorksheetHelperRoot( rHelper, xProgressBar, eSheetType, nSheet )
 {
 }
 
 OoxWorksheetFragmentBase::OoxWorksheetFragmentBase(
         const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
-    FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
+    OoxFragmentHandler( rHelper.getOoxFilter(), rFragmentPath ),
+    WorksheetHelperRoot( rHelper )
+{
+}
+
+// ============================================================================
+// ============================================================================
+
+namespace {
+
+const sal_uInt16 BIFF_BOF_GLOBALS           = 0x0005;   /// BIFF5-BIFF8 workbook globals.
+const sal_uInt16 BIFF_BOF_MODULE            = 0x0006;   /// BIFF5-BIFF8 Visual Basic module.
+const sal_uInt16 BIFF_BOF_SHEET             = 0x0010;   /// BIFF2-BIFF8 worksheet/dialog sheet.
+const sal_uInt16 BIFF_BOF_CHART             = 0x0020;   /// BIFF2-BIFF8 chart sheet.
+const sal_uInt16 BIFF_BOF_MACRO             = 0x0040;   /// BIFF4-BIFF8 macro sheet.
+const sal_uInt16 BIFF_BOF_WORKSPACE         = 0x0100;   /// BIFF3-BIFF8 workspace.
+
+} // namespace
+
+// ============================================================================
+
+BiffHandlerBase::~BiffHandlerBase()
+{
+}
+
+bool BiffHandlerBase::skipRecordBlock( sal_uInt16 nEndRecId )
+{
+    sal_uInt16 nStartRecId = mrStrm.getRecId();
+    while( mrStrm.startNextRecord() && (mrStrm.getRecId() != nEndRecId) )
+        if( mrStrm.getRecId() == nStartRecId )
+            skipRecordBlock( nEndRecId );
+    return !mrStrm.isEof() && (mrStrm.getRecId() == nEndRecId);
+}
+
+bool BiffHandlerBase::isBofRecord() const
+{
+    return
+        (mrStrm.getRecId() == BIFF2_ID_BOF) ||
+        (mrStrm.getRecId() == BIFF3_ID_BOF) ||
+        (mrStrm.getRecId() == BIFF4_ID_BOF) ||
+        (mrStrm.getRecId() == BIFF5_ID_BOF);
+}
+
+// ============================================================================
+
+BiffContextHandler::BiffContextHandler( const BiffHandlerBase& rParent ) :
+    BiffHandlerBase( rParent )
+{
+}
+
+// ============================================================================
+
+BiffFragmentHandler::BiffFragmentHandler( BiffInputStream& rStrm ) :
+    BiffHandlerBase( rStrm )
+{
+}
+
+BiffFragmentType BiffFragmentHandler::startFragment( BiffType eBiff )
+{
+    BiffFragmentType eFragment = BIFF_FRAGMENT_UNKNOWN;
+    if( mrStrm.startNextRecord() )
+    {
+        /*  #i23425# Don't rely on BOF record ID to read BOF contents, but on
+            the detected BIFF version. */
+        if( isBofRecord() )
+        {
+            // BOF is always written unencrypted
+            mrStrm.enableDecoder( false );
+            mrStrm.skip( 2 );
+            sal_uInt16 nType = mrStrm.readuInt16();
+
+            // decide which fragment types are valid for current BIFF version
+            switch( eBiff )
+            {
+                case BIFF2: switch( nType )
+                {
+                    case BIFF_BOF_CHART:    eFragment = BIFF_FRAGMENT_EMPTYSHEET;   break;
+                    case BIFF_BOF_MACRO:    eFragment = BIFF_FRAGMENT_MACROSHEET;   break;
+                    // #i51490# Excel interprets invalid types as worksheet
+                    default:                eFragment = BIFF_FRAGMENT_WORKSHEET;
+                }
+                break;
+
+                case BIFF3: switch( nType )
+                {
+                    case BIFF_BOF_CHART:    eFragment = BIFF_FRAGMENT_EMPTYSHEET;   break;
+                    case BIFF_BOF_MACRO:    eFragment = BIFF_FRAGMENT_MACROSHEET;   break;
+                    case BIFF_BOF_WORKSPACE:eFragment = BIFF_FRAGMENT_UNKNOWN;      break;
+                    // #i51490# Excel interprets invalid types as worksheet
+                    default:                eFragment = BIFF_FRAGMENT_WORKSHEET;
+                };
+                break;
+
+                case BIFF4: switch( nType )
+                {
+                    case BIFF_BOF_CHART:    eFragment = BIFF_FRAGMENT_EMPTYSHEET;   break;
+                    case BIFF_BOF_MACRO:    eFragment = BIFF_FRAGMENT_MACROSHEET;   break;
+                    case BIFF_BOF_WORKSPACE:eFragment = BIFF_FRAGMENT_WORKSPACE;    break;
+                    // #i51490# Excel interprets invalid types as worksheet
+                    default:                eFragment = BIFF_FRAGMENT_WORKSHEET;
+                };
+                break;
+
+                case BIFF5:
+                case BIFF8: switch( nType )
+                {
+                    case BIFF_BOF_GLOBALS:  eFragment = BIFF_FRAGMENT_GLOBALS;      break;
+                    case BIFF_BOF_CHART:    eFragment = BIFF_FRAGMENT_CHARTSHEET;   break;
+                    case BIFF_BOF_MACRO:    eFragment = BIFF_FRAGMENT_MACROSHEET;   break;
+                    case BIFF_BOF_MODULE:   eFragment = BIFF_FRAGMENT_MODULESHEET;  break;
+                    case BIFF_BOF_WORKSPACE:eFragment = BIFF_FRAGMENT_UNKNOWN;      break;
+                    // #i51490# Excel interprets invalid types as worksheet
+                    default:                eFragment = BIFF_FRAGMENT_WORKSHEET;
+                };
+                break;
+
+                case BIFF_UNKNOWN: break;
+            }
+        }
+    }
+    return eFragment;
+}
+
+bool BiffFragmentHandler::skipFragment()
+{
+    while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
+        if( isBofRecord() )
+            skipFragment();
+    return !mrStrm.isEof() && (mrStrm.getRecId() == BIFF_ID_EOF);
+}
+
+// ============================================================================
+
+BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelper, BiffInputStream& rStrm ) :
+    BiffFragmentHandler( rStrm ),
+    WorkbookHelper( rHelper )
+{
+}
+
+// ============================================================================
+
+BiffWorksheetFragmentBase::BiffWorksheetFragmentBase( const BiffWorkbookFragmentBase& rParent,
+        ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
+    BiffFragmentHandler( rParent ),
+    WorksheetHelperRoot( rParent, xProgressBar, eSheetType, nSheet )
+{
+}
+
+BiffWorksheetFragmentBase::BiffWorksheetFragmentBase( const WorksheetHelper& rHelper, BiffInputStream& rStrm ) :
+    BiffFragmentHandler( rStrm ),
     WorksheetHelperRoot( rHelper )
 {
 }
 
 // ============================================================================
 
+BiffSkipWorksheetFragment::BiffSkipWorksheetFragment(
+        const BiffWorkbookFragmentBase& rParent, ISegmentProgressBarRef xProgressBar, sal_Int32 nSheet ) :
+    BiffWorksheetFragmentBase( rParent, xProgressBar, SHEETTYPE_EMPTYSHEET, nSheet )
+{
+}
+
+bool BiffSkipWorksheetFragment::importFragment()
+{
+    return skipFragment();
+}
+
+// ============================================================================
+// ============================================================================
+
 } // namespace xls
 } // namespace oox
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/externallinkbuffer.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/externallinkbuffer.cxx
--- oox/source/xls/externallinkbuffer.cxx	2008-07-01 14:23:45.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/externallinkbuffer.cxx	2009-01-06 15:57:48.000000000 +0100
@@ -30,9 +30,13 @@
 
 #include "oox/xls/externallinkbuffer.hxx"
 #include <rtl/strbuf.hxx>
+#include <com/sun/star/sheet/DDELinkInfo.hpp>
+#include <com/sun/star/sheet/ExternalLinkType.hpp>
 #include <com/sun/star/sheet/XDDELinks.hpp>
 #include <com/sun/star/sheet/XDDELink.hpp>
 #include <com/sun/star/sheet/XDDELinkResults.hpp>
+#include <com/sun/star/sheet/XExternalDocLink.hpp>
+#include <com/sun/star/sheet/XExternalDocLinks.hpp>
 #include "oox/helper/attributelist.hxx"
 #include "oox/core/filterbase.hxx"
 #include "oox/xls/addressconverter.hxx"
@@ -47,11 +51,18 @@ using ::rtl::OStringToOUString;
 using ::rtl::OUString;
 using ::com::sun::star::uno::Any;
 using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
 using ::com::sun::star::uno::Exception;
 using ::com::sun::star::uno::UNO_QUERY_THROW;
 using ::com::sun::star::table::CellAddress;
+using ::com::sun::star::sheet::DDEItemInfo;
+using ::com::sun::star::sheet::DDELinkInfo;
+using ::com::sun::star::sheet::ExternalLinkInfo;
 using ::com::sun::star::sheet::XDDELinks;
 using ::com::sun::star::sheet::XDDELinkResults;
+using ::com::sun::star::sheet::XExternalDocLinks;
+using ::com::sun::star::sheet::XExternalSheetCache;
+using ::oox::core::Relation;
 using ::oox::core::Relations;
 
 namespace oox {
@@ -107,7 +118,7 @@ void ExternalName::importDefinedName( co
     maOoxData.maName = rAttribs.getString( XML_name, OUString() );
     OSL_ENSURE( maOoxData.maName.getLength() > 0, "ExternalName::importDefinedName - empty name" );
     // zero-based index into sheet list of externalBook
-    maOoxData.mnSheet = mrParentLink.getSheetIndex( rAttribs.getInteger( XML_sheetId, -1 ) );
+    maOoxData.mnSheet = rAttribs.getInteger( XML_sheetId, -1 );
 }
 
 void ExternalName::importDdeItem( const AttributeList& rAttribs )
@@ -146,8 +157,8 @@ void ExternalName::importExternalNameFla
     sal_uInt16 nFlags;
     sal_Int32 nSheetId;
     rStrm >> nFlags >> nSheetId;
-    // one-based index into sheet list of EXTSHEETNAMES
-    maOoxData.mnSheet = mrParentLink.getSheetIndex( nSheetId - 1 );
+    // index into sheet list of EXTSHEETNAMES (one-based in OOBIN)
+    maOoxData.mnSheet = nSheetId - 1;
     // no flag for built-in names, as in OOX...
     maOoxExtNameData.mbNotify     = getFlag( nFlags, OOBIN_EXTNAME_AUTOMATIC );
     maOoxExtNameData.mbPreferPic  = getFlag( nFlags, OOBIN_EXTNAME_PREFERPIC );
@@ -155,7 +166,7 @@ void ExternalName::importExternalNameFla
     maOoxExtNameData.mbOleObj     = getFlag( nFlags, OOBIN_EXTNAME_OLEOBJECT );
     maOoxExtNameData.mbIconified  = getFlag( nFlags, OOBIN_EXTNAME_ICONIFIED );
     OSL_ENSURE( (mrParentLink.getLinkType() == LINKTYPE_OLE) == maOoxExtNameData.mbOleObj,
-        "ExternalName::importExternalNameFlags - wrong flags in external name" );
+        "ExternalName::importExternalNameFlags - wrong OLE flag in external name" );
 }
 
 void ExternalName::importDdeItemValues( RecordInputStream& rStrm )
@@ -208,29 +219,17 @@ void ExternalName::importExternalName( B
             }
             else
             {
-                // get sheet index for sheet-local names
-                sal_Int16 nRefId = rStrm.skip( 2 ).readuInt16();
-                switch( getBiff() )
-                {
-                    case BIFF2:
-                    case BIFF3:
-                    case BIFF4:
-                    break;
-                    case BIFF5:
-                        // resolve nRefId to sheet index, zero is global name
-                        if( nRefId > 0 )
-                            if( const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId ).get() )
-                                if( pExtLink->getLinkType() == LINKTYPE_EXTERNAL )
-                                    maOoxData.mnSheet = pExtLink->getSheetIndex();
-                    break;
-                    case BIFF8:
-                        // one-based index into sheet list of EXTERNALBOOK record, zero is global name
-                        if( nRefId > 0 )
-                            maOoxData.mnSheet = mrParentLink.getSheetIndex( nRefId - 1 );
-                    break;
-                    case BIFF_UNKNOWN:
-                    break;
-                }
+                /*  Import the reference ID for names that are sheet-local in
+                    the external document. This index will be resolved later to
+                    the index of the external sheet cache which is able to
+                    provide the name of the sheet related to this defined name.
+                    - BIFF5: one-based index to EXTERNSHEET record containing
+                        the document and sheet name
+                    - BIFF8: one-based index into EXTERNALBOOK sheet name list
+                    The value zero means this external name is a global name.
+                 */
+                rStrm.skip( 2 );
+                maOoxData.mnSheet = rStrm.readuInt16();
             }
         }
     }
@@ -245,7 +244,7 @@ void ExternalName::importExternalName( B
         case LINKTYPE_INTERNAL:
         case LINKTYPE_EXTERNAL:
             // cell references that are stored in hidden external names (seen in BIFF3-BIFF4)
-            if( (getBiff() <= BIFF4) && (maOoxData.maName.getLength() > 0) && (maOoxData.maName[ 0 ] == '\x01') && (rStrm.getRecLeft() > 2) )
+            if( (getBiff() <= BIFF4) && (maOoxData.maName.getLength() > 0) && (maOoxData.maName[ 0 ] == '\x01') && (rStrm.getRemaining() > 2) )
             {
                 TokensFormulaContext aContext( true, true );
                 importBiffFormula( aContext, rStrm );
@@ -257,7 +256,7 @@ void ExternalName::importExternalName( B
         case LINKTYPE_OLE:
         case LINKTYPE_MAYBE_DDE_OLE:
             // DDE/OLE link results
-            if( rStrm.getRecLeft() > 3 )
+            if( rStrm.getRemaining() > 3 )
             {
                 bool bBiff8 = getBiff() == BIFF8;
                 sal_Int32 nCols = rStrm.readuInt8();
@@ -266,7 +265,7 @@ void ExternalName::importExternalName( B
                 setResultSize( nCols, nRows );
 
                 bool bLoop = true;
-                while( bLoop && rStrm.isValid() && (maCurrIt != maResults.end()) )
+                while( bLoop && !rStrm.isEof() && (maCurrIt != maResults.end()) )
                 {
                     switch( rStrm.readuInt8() )
                     {
@@ -292,7 +291,7 @@ void ExternalName::importExternalName( B
                             bLoop = false;
                     }
                 }
-                OSL_ENSURE( bLoop && rStrm.isValid() && (maCurrIt == maResults.end()),
+                OSL_ENSURE( bLoop && !rStrm.isEof() && (maCurrIt == maResults.end()),
                     "ExternalName::importExternalName - stream error in result set" );
             }
         break;
@@ -301,6 +300,55 @@ void ExternalName::importExternalName( B
     }
 }
 
+sal_Int32 ExternalName::getSheetCacheIndex() const
+{
+    OSL_ENSURE( mrParentLink.getLinkType() == LINKTYPE_DDE, "ExternalName::getSheetCacheIndex - unexpected link type" );
+    sal_Int32 nCacheIdx = -1;
+    switch( getFilterType() )
+    {
+        case FILTER_OOX:
+            // OOXML/OOBIN: zero-based index into sheet list, -1 means global name
+            if( maOoxData.mnSheet >= 0 )
+                nCacheIdx = mrParentLink.getSheetIndex( maOoxData.mnSheet );
+        break;
+        case FILTER_BIFF:
+            switch( getBiff() )
+            {
+                case BIFF2:
+                case BIFF3:
+                case BIFF4:
+                break;
+                case BIFF5:
+                    if( maOoxData.mnSheet > 0 )
+                        if( const ExternalLink* pExtLink = getExternalLinks().getExternalLink( maOoxData.mnSheet ).get() )
+                            if( pExtLink->getLinkType() == LINKTYPE_EXTERNAL )
+                                nCacheIdx = pExtLink->getSheetIndex();
+                break;
+                case BIFF8:
+                    if( maOoxData.mnSheet > 0 )
+                        nCacheIdx = mrParentLink.getSheetIndex( maOoxData.mnSheet - 1 );
+                break;
+                case BIFF_UNKNOWN:
+                break;
+            }
+        break;
+        case FILTER_UNKNOWN:
+        break;
+    }
+    return nCacheIdx;
+}
+
+bool ExternalName::getDdeItemInfo( DDEItemInfo& orItemInfo ) const
+{
+    if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && (maOoxData.maName.getLength() > 0) )
+    {
+        orItemInfo.Item = maOoxData.maName;
+        orItemInfo.Results = ContainerHelper::matrixToSequenceSequence( maResults );
+        return true;
+    }
+    return false;
+}
+
 bool ExternalName::getDdeLinkData( OUString& orDdeServer, OUString& orDdeTopic, OUString& orDdeItem )
 {
     if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && (maOoxData.maName.getLength() > 0) )
@@ -348,9 +396,48 @@ void ExternalName::setResultSize( sal_In
 
 // ============================================================================
 
+void LinkSheetRange::setDeleted()
+{
+    meType = LINKSHEETRANGE_INTERNAL;
+    mnDocLink = mnFirst = mnLast = -1;
+}
+
+void LinkSheetRange::setSameSheet()
+{
+    meType = LINKSHEETRANGE_SAMESHEET;
+    mnDocLink = -1;
+    mnFirst = mnLast = 0;
+}
+
+void LinkSheetRange::setRange( sal_Int32 nFirst, sal_Int32 nLast )
+{
+    meType = LINKSHEETRANGE_INTERNAL;
+    mnDocLink = -1;
+    mnFirst = ::std::min( nFirst, nLast );
+    mnLast = ::std::max( nFirst, nLast );
+}
+
+void LinkSheetRange::setExternalRange( sal_Int32 nDocLink, sal_Int32 nFirst, sal_Int32 nLast )
+{
+    if( nDocLink < 0 )
+    {
+        setDeleted();
+    }
+    else
+    {
+        meType = LINKSHEETRANGE_EXTERNAL;
+        mnDocLink = nDocLink;
+        mnFirst = ::std::min( nFirst, nLast );
+        mnLast = ::std::max( nFirst, nLast );
+    }
+}
+
+// ============================================================================
+
 ExternalLink::ExternalLink( const WorkbookHelper& rHelper ) :
     WorkbookHelper( rHelper ),
-    meLinkType( LINKTYPE_UNKNOWN )
+    meLinkType( LINKTYPE_UNKNOWN ),
+    meFuncLibType( FUNCLIB_UNKNOWN )
 {
 }
 
@@ -361,16 +448,12 @@ void ExternalLink::importExternalReferen
 
 void ExternalLink::importExternalBook( const Relations& rRelations, const AttributeList& rAttribs )
 {
-    OUString aTargetUrl = rRelations.getTargetFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
-    setExternalTargetUrl( aTargetUrl );
+    parseExternalReference( rRelations, rAttribs.getString( R_TOKEN( id ), OUString() ) );
 }
 
 void ExternalLink::importSheetName( const AttributeList& rAttribs )
 {
-    OUString aSheetName = rAttribs.getString( XML_val, OUString() );
-    OSL_ENSURE( aSheetName.getLength() > 0, "ExternalLink::importSheetName - empty sheet name" );
-    if( meLinkType == LINKTYPE_EXTERNAL )
-        maSheetIndexes.push_back( getWorksheets().insertExternalSheet( maTargetUrl, aSheetName ) );
+    insertExternalSheet( rAttribs.getString( XML_val, OUString() ) );
 }
 
 void ExternalLink::importDefinedName( const AttributeList& rAttribs )
@@ -431,10 +514,7 @@ void ExternalLink::importExternalBook( c
     switch( rStrm.readuInt16() )
     {
         case OOBIN_EXTERNALBOOK_BOOK:
-        {
-            OUString aTargetUrl = rRelations.getTargetFromRelId( rStrm.readString() );
-            setExternalTargetUrl( aTargetUrl );
-        }
+            parseExternalReference( rRelations, rStrm.readString() );
         break;
         case OOBIN_EXTERNALBOOK_DDE:
         {
@@ -457,18 +537,12 @@ void ExternalLink::importExternalBook( c
 
 void ExternalLink::importExtSheetNames( RecordInputStream& rStrm )
 {
-    // load external sheet names and create the linked sheets in the Calc document
-    OSL_ENSURE( meLinkType == LINKTYPE_EXTERNAL, "ExternalLink::importExtSheetNames - invalid link type" );
-    if( meLinkType == LINKTYPE_EXTERNAL )
-    {
-        WorksheetBuffer& rWorksheets = getWorksheets();
-        for( sal_Int32 nSheet = 0, nCount = rStrm.readInt32(); rStrm.isValid() && (nSheet < nCount); ++nSheet )
-        {
-            OUString aSheetName = rStrm.readString();
-            OSL_ENSURE( aSheetName.getLength() > 0, "ExternalLink::importExtSheetNames - empty sheet name" );
-            maSheetIndexes.push_back( rWorksheets.insertExternalSheet( maTargetUrl, aSheetName ) );
-        }
-    }
+    // load external sheet names and create the sheet caches in the Calc document
+    OSL_ENSURE( (meLinkType == LINKTYPE_EXTERNAL) || (meLinkType == LINKTYPE_LIBRARY),
+        "ExternalLink::importExtSheetNames - invalid link type" );
+    if( meLinkType == LINKTYPE_EXTERNAL )   // ignore sheets of external libraries
+        for( sal_Int32 nSheet = 0, nCount = rStrm.readInt32(); !rStrm.isEof() && (nSheet < nCount); ++nSheet )
+            insertExternalSheet( rStrm.readString() );
 }
 
 ExternalNameRef ExternalLink::importExternalName( RecordInputStream& rStrm )
@@ -492,10 +566,10 @@ void ExternalLink::importExternSheet( Bi
     switch( meLinkType )
     {
         case LINKTYPE_INTERNAL:
-            maSheetIndexes.push_back( getWorksheets().getFinalSheetIndex( aSheetName ) );
+            maIndexes.push_back( getWorksheets().getFinalSheetIndex( aSheetName ) );
         break;
         case LINKTYPE_EXTERNAL:
-            maSheetIndexes.push_back( getWorksheets().insertExternalSheet( maTargetUrl, aSheetName ) );
+            insertExternalSheet( aSheetName );
         break;
         default:;
     }
@@ -506,7 +580,7 @@ void ExternalLink::importExternalBook( B
     OUString aTarget;
     sal_uInt16 nSheetCount;
     rStrm >> nSheetCount;
-    if( rStrm.getRecLeft() == 2 )
+    if( rStrm.getRemaining() == 2 )
     {
         if( rStrm.readuInt8() == 1 )
         {
@@ -515,7 +589,7 @@ void ExternalLink::importExternalBook( B
                 aTarget = OStringToOUString( OString( cChar ), getTextEncoding() );
         }
     }
-    else if( rStrm.getRecLeft() >= 3 )
+    else if( rStrm.getRemaining() >= 3 )
     {
         // NUL characters may occur
         rStrm.enableNulChars( true );
@@ -528,17 +602,10 @@ void ExternalLink::importExternalBook( B
     OSL_ENSURE( aDummySheetName.getLength() == 0, "ExternalLink::importExternalBook - sheet name in encoded URL" );
     (void)aDummySheetName;  // prevent compiler warning
 
-    // load external sheet names and create the linked sheets in the Calc document
+    // load external sheet names and create the sheet caches in the Calc document
     if( meLinkType == LINKTYPE_EXTERNAL )
-    {
-        WorksheetBuffer& rWorksheets = getWorksheets();
-        for( sal_uInt16 nSheet = 0; rStrm.isValid() && (nSheet < nSheetCount); ++nSheet )
-        {
-            OUString aSheetName = rStrm.readUniString();
-            OSL_ENSURE( aSheetName.getLength() > 0, "ExternalLink::importExternalBook - empty sheet name" );
-            maSheetIndexes.push_back( rWorksheets.insertExternalSheet( maTargetUrl, aSheetName ) );
-        }
-    }
+        for( sal_uInt16 nSheet = 0; !rStrm.isEof() && (nSheet < nSheetCount); ++nSheet )
+            insertExternalSheet( rStrm.readUniString() );
 }
 
 void ExternalLink::importExternalName( BiffInputStream& rStrm )
@@ -561,12 +628,47 @@ void ExternalLink::importExternalName( B
     }
 }
 
+ExternalLinkInfo ExternalLink::getLinkInfo() const
+{
+    ExternalLinkInfo aLinkInfo;
+    switch( meLinkType )
+    {
+        case LINKTYPE_EXTERNAL:
+            aLinkInfo.Type = ::com::sun::star::sheet::ExternalLinkType::DOCUMENT;
+            aLinkInfo.Data <<= maTargetUrl;
+        break;
+        case LINKTYPE_DDE:
+        {
+            aLinkInfo.Type = ::com::sun::star::sheet::ExternalLinkType::DDE;
+            DDELinkInfo aDdeLinkInfo;
+            aDdeLinkInfo.Service = maClassName;
+            aDdeLinkInfo.Topic = maTargetUrl;
+            ::std::vector< DDEItemInfo > aItemInfos;
+            DDEItemInfo aItemInfo;
+            for( ExternalNameVector::const_iterator aIt = maExtNames.begin(), aEnd = maExtNames.end(); aIt != aEnd; ++aIt )
+                if( (*aIt)->getDdeItemInfo( aItemInfo ) )
+                    aItemInfos.push_back( aItemInfo );
+            aDdeLinkInfo.Items = ContainerHelper::vectorToSequence( aItemInfos );
+            aLinkInfo.Data <<= aDdeLinkInfo;
+        }
+        break;
+        default:
+            aLinkInfo.Type = ::com::sun::star::sheet::ExternalLinkType::UNKNOWN;
+    }
+    return aLinkInfo;
+}
+
+FunctionLibraryType ExternalLink::getFuncLibraryType() const
+{
+    return (meLinkType == LINKTYPE_LIBRARY) ? meFuncLibType : FUNCLIB_UNKNOWN;
+}
+
 sal_Int32 ExternalLink::getSheetIndex( sal_Int32 nTabId ) const
 {
     OSL_ENSURE( (nTabId == 0) || (getFilterType() == FILTER_OOX) || (getBiff() == BIFF8),
         "ExternalLink::getSheetIndex - invalid sheet index" );
-    return ((0 <= nTabId) && (static_cast< size_t >( nTabId ) < maSheetIndexes.size())) ?
-        maSheetIndexes[ static_cast< size_t >( nTabId ) ] : -1;
+    return ((0 <= nTabId) && (static_cast< size_t >( nTabId ) < maIndexes.size())) ?
+        maIndexes[ static_cast< size_t >( nTabId ) ] : -1;
 }
 
 void ExternalLink::getSheetRange( LinkSheetRange& orSheetRange, sal_Int32 nTabId1, sal_Int32 nTabId2 ) const
@@ -574,7 +676,7 @@ void ExternalLink::getSheetRange( LinkSh
     switch( meLinkType )
     {
         case LINKTYPE_SAME:
-            orSheetRange.setRelative();
+            orSheetRange.setSameSheet();
         break;
 
         case LINKTYPE_SELF:
@@ -582,11 +684,14 @@ void ExternalLink::getSheetRange( LinkSh
             orSheetRange.setRange( nTabId1, nTabId2 );
         break;
 
-        case LINKTYPE_EXTERNAL: switch( getFilterType() )
+        case LINKTYPE_EXTERNAL:
+        {
+            sal_Int32 nDocLinkIndex = mxDocLink.is() ? mxDocLink->getTokenIndex() : -1;
+            switch( getFilterType() )
         {
             case FILTER_OOX:
                 // OOBIN: passed indexes point into sheet list of EXTSHEETLIST
-                orSheetRange.setRange( getSheetIndex( nTabId1 ), getSheetIndex( nTabId2 ) );
+                    orSheetRange.setExternalRange( nDocLinkIndex, getSheetIndex( nTabId1 ), getSheetIndex( nTabId2 ) );
             break;
             case FILTER_BIFF:
                 switch( getBiff() )
@@ -594,23 +699,24 @@ void ExternalLink::getSheetRange( LinkSh
                     case BIFF2:
                     case BIFF3:
                     case BIFF4:
-                        orSheetRange.setRange( getSheetIndex( nTabId1 ), getSheetIndex( nTabId2 ) );
+                            orSheetRange.setExternalRange( nDocLinkIndex, getSheetIndex( nTabId1 ), getSheetIndex( nTabId2 ) );
                     break;
                     case BIFF5:
                         // BIFF5: first sheet from this external link, last sheet is passed in nTabId2
                         if( const ExternalLink* pExtLink2 = getExternalLinks().getExternalLink( nTabId2 ).get() )
                             if( (pExtLink2->getLinkType() == LINKTYPE_EXTERNAL) && (maTargetUrl == pExtLink2->getTargetUrl()) )
-                                orSheetRange.setRange( getSheetIndex(), pExtLink2->getSheetIndex() );
+                                    orSheetRange.setExternalRange( nDocLinkIndex, getSheetIndex(), pExtLink2->getSheetIndex() );
                     break;
                     case BIFF8:
                         // BIFF8: passed indexes point into sheet list of EXTERNALBOOK
-                        orSheetRange.setRange( getSheetIndex( nTabId1 ), getSheetIndex( nTabId2 ) );
+                            orSheetRange.setExternalRange( nDocLinkIndex, getSheetIndex( nTabId1 ), getSheetIndex( nTabId2 ) );
                     break;
                     case BIFF_UNKNOWN: break;
                 }
             break;
             case FILTER_UNKNOWN: break;
         }
+        }
         break;
 
         default:
@@ -619,6 +725,21 @@ void ExternalLink::getSheetRange( LinkSh
     }
 }
 
+Reference< XExternalSheetCache > ExternalLink::getExternalSheetCache( sal_Int32 nTabId )
+{
+    if( mxDocLink.is() && (0 <= nTabId) && (static_cast< size_t >( nTabId ) < maIndexes.size()) ) try
+    {
+        sal_Int32 nCacheId = maIndexes[ static_cast< size_t >( nTabId ) ];
+        // existing mxDocLink implies that this is an external link
+        Reference< XExternalSheetCache > xSheetCache( mxDocLink->getByIndex( nCacheId ), UNO_QUERY_THROW );
+        return xSheetCache;
+    }
+    catch( Exception& )
+    {
+    }
+    return 0;
+}
+
 ExternalNameRef ExternalLink::getNameByIndex( sal_Int32 nIndex ) const
 {
     return maExtNames.get( nIndex );
@@ -626,11 +747,33 @@ ExternalNameRef ExternalLink::getNameByI
 
 // private --------------------------------------------------------------------
 
-void ExternalLink::setExternalTargetUrl( const OUString& rTargetUrl )
+#define OOX_TARGETTYPE_EXTLINK      CREATE_OFFICEDOC_RELATIONSTYPE( "externalLinkPath" )
+#define OOX_TARGETTYPE_LIBRARY      CREATE_MSOFFICE_RELATIONSTYPE( "xlExternalLinkPath/xlLibrary" )
+
+void ExternalLink::setExternalTargetUrl( const OUString& rTargetUrl, const OUString& rTargetType )
+{
+    meLinkType = LINKTYPE_UNKNOWN;
+    if( rTargetType == OOX_TARGETTYPE_EXTLINK )
 {
     maTargetUrl = getBaseFilter().getAbsoluteUrl( rTargetUrl );
-    meLinkType = (maTargetUrl.getLength() > 0) ? LINKTYPE_EXTERNAL : LINKTYPE_UNKNOWN;
-    OSL_ENSURE( meLinkType == LINKTYPE_EXTERNAL, "ExternalLink::setExternalTargetUrl - empty target URL" );
+        if( maTargetUrl.getLength() > 0 )
+            meLinkType = LINKTYPE_EXTERNAL;
+    }
+    else if( rTargetType == OOX_TARGETTYPE_LIBRARY )
+    {
+        meLinkType = LINKTYPE_LIBRARY;
+        if( rTargetUrl.equalsIgnoreAsciiCaseAscii( "EUROTOOL.XLA" ) || rTargetUrl.equalsIgnoreAsciiCaseAscii( "EUROTOOL.XLAM" ) )
+            meFuncLibType = FUNCLIB_EUROTOOL;
+    }
+    OSL_ENSURE( meLinkType != LINKTYPE_UNKNOWN, "ExternalLink::setExternalTargetUrl - empty target URL or unknown target type" );
+
+    // create the external document link API object that will contain the sheet caches
+    if( meLinkType == LINKTYPE_EXTERNAL )
+    {
+        Reference< XExternalDocLinks > xDocLinks = getExternalDocLinks();
+        if( xDocLinks.is() )
+            mxDocLink = xDocLinks->addDocLink( maTargetUrl );
+    }
 }
 
 void ExternalLink::setDdeOleTargetUrl( const OUString& rClassName, const OUString& rTargetUrl, ExternalLinkType eLinkType )
@@ -641,38 +784,66 @@ void ExternalLink::setDdeOleTargetUrl( c
     OSL_ENSURE( meLinkType == eLinkType, "ExternalLink::setDdeOleTargetUrl - missing classname or target" );
 }
 
+void ExternalLink::parseExternalReference( const Relations& rRelations, const OUString& rRelId )
+{
+    if( const Relation* pRelation = rRelations.getRelationFromRelId( rRelId ) )
+        setExternalTargetUrl( pRelation->maTarget, pRelation->maType );
+}
+
 OUString ExternalLink::parseBiffTargetUrl( const OUString& rBiffTargetUrl )
 {
-    OUString aClassName, aTargetUrl, aSheetName;
-    bool bSameSheet = false;
     meLinkType = LINKTYPE_UNKNOWN;
-    if( getAddressConverter().parseBiffTargetUrl( aClassName, aTargetUrl, aSheetName, bSameSheet, rBiffTargetUrl ) )
+
+    OUString aClassName, aTargetUrl, aSheetName;
+    switch( getAddressConverter().parseBiffTargetUrl( aClassName, aTargetUrl, aSheetName, rBiffTargetUrl ) )
     {
-        if( aClassName.getLength() > 0 )
+        case BIFF_TARGETTYPE_URL:
+            if( aTargetUrl.getLength() == 0 )
         {
-            setDdeOleTargetUrl( aClassName, aTargetUrl, LINKTYPE_MAYBE_DDE_OLE );
-        }
-        else if( aTargetUrl.getLength() == 0 )
-        {
-            meLinkType = (aSheetName.getLength() > 0) ? LINKTYPE_INTERNAL : (bSameSheet ? LINKTYPE_SAME : LINKTYPE_SELF);
+                meLinkType = (aSheetName.getLength() > 0) ? LINKTYPE_INTERNAL : LINKTYPE_SELF;
         }
         else if( (aTargetUrl.getLength() == 1) && (aTargetUrl[ 0 ] == ':') )
         {
             if( getBiff() >= BIFF4 )
                 meLinkType = LINKTYPE_ANALYSIS;
         }
-        else if( (aTargetUrl.getLength() == 1) && (aTargetUrl[ 0 ] == ' ') )
+            else if( (aTargetUrl.getLength() > 1) || (aTargetUrl[ 0 ] != ' ') )
         {
-            meLinkType = LINKTYPE_UNKNOWN;
-        }
-        else
-        {
-            setExternalTargetUrl( aTargetUrl );
+                setExternalTargetUrl( aTargetUrl, OOX_TARGETTYPE_EXTLINK );
         }
+        break;
+
+        case BIFF_TARGETTYPE_SAMESHEET:
+            OSL_ENSURE( (aTargetUrl.getLength() == 0) && (aSheetName.getLength() == 0), "ExternalLink::parseBiffTargetUrl - unexpected target or sheet name" );
+            meLinkType = LINKTYPE_SAME;
+        break;
+
+        case BIFF_TARGETTYPE_LIBRARY:
+            OSL_ENSURE( aSheetName.getLength() == 0, "ExternalLink::parseBiffTargetUrl - unexpected sheet name" );
+            setExternalTargetUrl( aTargetUrl, OOX_TARGETTYPE_LIBRARY );
+        break;
+
+        case BIFF_TARGETTYPE_DDE_OLE:
+            setDdeOleTargetUrl( aClassName, aTargetUrl, LINKTYPE_MAYBE_DDE_OLE );
+        break;
+
+        case BIFF_TARGETTYPE_UNKNOWN:
+        break;
     }
     return aSheetName;
 }
 
+void ExternalLink::insertExternalSheet( const OUString& rSheetName )
+{
+    OSL_ENSURE( rSheetName.getLength() > 0, "ExternalLink::insertExternalSheet - empty sheet name" );
+    if( mxDocLink.is() )
+    {
+        Reference< XExternalSheetCache > xSheetCache = mxDocLink->addSheetCache( rSheetName );
+        sal_Int32 nCacheIdx = xSheetCache.is() ? xSheetCache->getTokenIndex() : -1;
+        maIndexes.push_back( nCacheIdx );
+    }
+}
+
 ExternalNameRef ExternalLink::createExternalName()
 {
     ExternalNameRef xExtName( new ExternalName( *this, getSheetIndex() ) );
@@ -713,6 +884,7 @@ ExternalLinkRef ExternalLinkBuffer::impo
 {
     ExternalLinkRef xExtLink = createExternalLink();
     xExtLink->importExternalReference( rAttribs );
+    maExtLinks.push_back( xExtLink );
     return xExtLink;
 }
 
@@ -721,6 +893,7 @@ ExternalLinkRef ExternalLinkBuffer::impo
     mbUseRefSheets = true;
     ExternalLinkRef xExtLink = createExternalLink();
     xExtLink->importExternalRef( rStrm );
+    maExtLinks.push_back( xExtLink );
     return xExtLink;
 }
 
@@ -750,9 +923,9 @@ void ExternalLinkBuffer::importExternalS
     maRefSheets.clear();
     sal_Int32 nRefCount;
     rStrm >> nRefCount;
-    size_t nMaxCount = getLimitedValue< size_t, sal_Int32 >( nRefCount, 0, rStrm.getRecLeft() / 12 );
+    size_t nMaxCount = getLimitedValue< size_t, sal_Int64 >( nRefCount, 0, rStrm.getRemaining() / 12 );
     maRefSheets.reserve( nMaxCount );
-    for( size_t nRefId = 0; rStrm.isValid() && (nRefId < nMaxCount); ++nRefId )
+    for( size_t nRefId = 0; !rStrm.isEof() && (nRefId < nMaxCount); ++nRefId )
     {
         OoxRefSheets aRefSheets;
         aRefSheets.readOobData( rStrm );
@@ -777,8 +950,8 @@ ExternalLinkRef ExternalLinkBuffer::impo
 
 void ExternalLinkBuffer::importExternalName( BiffInputStream& rStrm )
 {
-    if( !maExtLinks.empty() )
-        maExtLinks.back()->importExternalName( rStrm );
+    if( !maLinks.empty() )
+        maLinks.back()->importExternalName( rStrm );
 }
 
 void ExternalLinkBuffer::importExternSheet8( BiffInputStream& rStrm )
@@ -789,7 +962,7 @@ void ExternalLinkBuffer::importExternShe
     sal_uInt16 nRefCount;
     rStrm >> nRefCount;
     maRefSheets.reserve( nRefCount );
-    for( sal_uInt16 nRefId = 0; rStrm.isValid() && (nRefId < nRefCount); ++nRefId )
+    for( sal_uInt16 nRefId = 0; !rStrm.isEof() && (nRefId < nRefCount); ++nRefId )
     {
         OoxRefSheets aRefSheets;
         aRefSheets.readBiff8Data( rStrm );
@@ -797,6 +970,16 @@ void ExternalLinkBuffer::importExternShe
     }
 }
 
+Sequence< ExternalLinkInfo > ExternalLinkBuffer::getLinkInfos() const
+{
+    ::std::vector< ExternalLinkInfo > aLinkInfos;
+    // dummy entry for index 0
+    aLinkInfos.push_back( ExternalLinkInfo( ::com::sun::star::sheet::ExternalLinkType::UNKNOWN, Any() ) );
+    for( ExternalLinkVec::const_iterator aIt = maExtLinks.begin(), aEnd = maExtLinks.end(); aIt != aEnd; ++aIt )
+        aLinkInfos.push_back( (*aIt)->getLinkInfo() );
+    return ContainerHelper::vectorToSequence( aLinkInfos );
+}
+
 ExternalLinkRef ExternalLinkBuffer::getExternalLink( sal_Int32 nRefId ) const
 {
     ExternalLinkRef xExtLink;
@@ -805,10 +988,10 @@ ExternalLinkRef ExternalLinkBuffer::getE
         case FILTER_OOX:
             // OOXML: one-based index
             if( !mbUseRefSheets )
-                xExtLink = maExtLinks.get( nRefId - 1 );
+                xExtLink = maLinks.get( nRefId - 1 );
             // OOBIN: zero-based index into ref-sheets list
             else if( const OoxRefSheets* pRefSheets = getRefSheets( nRefId ) )
-                xExtLink = maExtLinks.get( pRefSheets->mnExtRefId );
+                xExtLink = maLinks.get( pRefSheets->mnExtRefId );
         break;
         case FILTER_BIFF:
             switch( getBiff() )
@@ -817,26 +1000,26 @@ ExternalLinkRef ExternalLinkBuffer::getE
                 case BIFF3:
                 case BIFF4:
                     // one-based index to EXTERNSHEET records
-                    xExtLink = maExtLinks.get( nRefId - 1 );
+                    xExtLink = maLinks.get( nRefId - 1 );
                 break;
                 case BIFF5:
                     if( nRefId < 0 )
                     {
                         // internal links in formula tokens have negative index
-                        xExtLink = maExtLinks.get( -nRefId - 1 );
+                        xExtLink = maLinks.get( -nRefId - 1 );
                         if( xExtLink.get() && !xExtLink->isInternalLink() )
                             xExtLink.reset();
                     }
                     else
                     {
                         // one-based index to EXTERNSHEET records
-                        xExtLink = maExtLinks.get( nRefId - 1 );
+                        xExtLink = maLinks.get( nRefId - 1 );
                     }
                 break;
                 case BIFF8:
                     // zero-based index into REF list in EXTERNSHEET record
                     if( const OoxRefSheets* pRefSheets = getRefSheets( nRefId ) )
-                        xExtLink = maExtLinks.get( pRefSheets->mnExtRefId );
+                        xExtLink = maLinks.get( pRefSheets->mnExtRefId );
                 break;
                 case BIFF_UNKNOWN: break;
             }
@@ -870,7 +1053,7 @@ LinkSheetRange ExternalLinkBuffer::getSh
 ExternalLinkRef ExternalLinkBuffer::createExternalLink()
 {
     ExternalLinkRef xExtLink( new ExternalLink( *this ) );
-    maExtLinks.push_back( xExtLink );
+    maLinks.push_back( xExtLink );
     return xExtLink;
 }
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/externallinkfragment.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/externallinkfragment.cxx
--- oox/source/xls/externallinkfragment.cxx	2008-04-10 18:08:46.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/externallinkfragment.cxx	2008-12-12 11:38:47.000000000 +0100
@@ -29,6 +29,7 @@
  ************************************************************************/
 
 #include "oox/xls/externallinkfragment.hxx"
+#include <com/sun/star/sheet/XExternalSheetCache.hpp>
 #include "oox/helper/attributelist.hxx"
 #include "oox/xls/biffinputstream.hxx"
 #include "oox/xls/defnamesbuffer.hxx"
@@ -36,7 +37,11 @@
 #include "oox/xls/unitconverter.hxx"
 
 using ::rtl::OUString;
+using ::com::sun::star::uno::Any;
 using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::table::CellAddress;
+using ::com::sun::star::sheet::XExternalSheetCache;
 using ::oox::core::RecordInfo;
 using ::oox::core::Relation;
 
@@ -45,6 +50,146 @@ namespace xls {
 
 // ============================================================================
 
+OoxExternalSheetDataContext::OoxExternalSheetDataContext(
+        OoxWorkbookFragmentBase& rFragment, const Reference< XExternalSheetCache >& rxSheetCache ) :
+    OoxWorkbookContextBase( rFragment ),
+    mxSheetCache( rxSheetCache )
+{
+    OSL_ENSURE( mxSheetCache.is(), "OoxExternalSheetDataContext::OoxExternalSheetDataContext - missing sheet cache" );
+}
+
+// oox.core.ContextHandler2Helper interface -----------------------------------
+
+ContextWrapper OoxExternalSheetDataContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+{
+    switch( getCurrentElement() )
+    {
+        case XLS_TOKEN( sheetData ):
+            return  (nElement == XLS_TOKEN( row ));
+        case XLS_TOKEN( row ):
+            return  (nElement == XLS_TOKEN( cell ));
+        case XLS_TOKEN( cell ):
+            return  (nElement == XLS_TOKEN( v ));
+    }
+    return false;
+}
+
+void OoxExternalSheetDataContext::onStartElement( const AttributeList& rAttribs )
+{
+    switch( getCurrentElement() )
+    {
+        case XLS_TOKEN( cell ):
+            importCell( rAttribs );
+        break;
+    }
+}
+
+void OoxExternalSheetDataContext::onEndElement( const OUString& rChars )
+{
+    switch( getCurrentElement() )
+    {
+        case XLS_TOKEN( v ):
+            switch( mnCurrType )
+            {
+                case XML_b:
+                case XML_n:
+                    setCellValue( Any( rChars.toDouble() ) );
+                break;
+                case XML_e:
+                    setCellValue( Any( BiffHelper::calcDoubleFromError( getUnitConverter().calcBiffErrorCode( rChars ) ) ) );
+                break;
+                case XML_str:
+                    setCellValue( Any( rChars ) );
+                break;
+            }
+            mnCurrType = XML_TOKEN_INVALID;
+        break;
+    }
+}
+
+ContextWrapper OoxExternalSheetDataContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+{
+    switch( getCurrentElement() )
+    {
+        case OOBIN_ID_EXTSHEETDATA:
+            return  (nRecId == OOBIN_ID_EXTROW);
+        case OOBIN_ID_EXTROW:
+            return  (nRecId == OOBIN_ID_EXTCELL_BLANK) ||
+                    (nRecId == OOBIN_ID_EXTCELL_BOOL) ||
+                    (nRecId == OOBIN_ID_EXTCELL_DOUBLE) ||
+                    (nRecId == OOBIN_ID_EXTCELL_ERROR) ||
+                    (nRecId == OOBIN_ID_EXTCELL_STRING);
+    }
+    return false;
+}
+
+void OoxExternalSheetDataContext::onStartRecord( RecordInputStream& rStrm )
+{
+    switch( getCurrentElement() )
+    {
+        case OOBIN_ID_EXTCELL_BLANK:    importExtCellBlank( rStrm );        break;
+        case OOBIN_ID_EXTCELL_BOOL:     importExtCellBool( rStrm );         break;
+        case OOBIN_ID_EXTCELL_DOUBLE:   importExtCellDouble( rStrm );       break;
+        case OOBIN_ID_EXTCELL_ERROR:    importExtCellError( rStrm );        break;
+        case OOBIN_ID_EXTCELL_STRING:   importExtCellString( rStrm );       break;
+        case OOBIN_ID_EXTROW:           maCurrPos.Row = rStrm.readInt32();  break;
+    }
+}
+
+// private --------------------------------------------------------------------
+
+void OoxExternalSheetDataContext::importCell( const AttributeList& rAttribs )
+{
+    if( getAddressConverter().convertToCellAddress( maCurrPos, rAttribs.getString( XML_r, OUString() ), 0, false ) )
+        mnCurrType = rAttribs.getToken( XML_t, XML_n );
+    else
+        mnCurrType = XML_TOKEN_INVALID;
+}
+
+void OoxExternalSheetDataContext::importExtCellBlank( RecordInputStream& rStrm )
+{
+    maCurrPos.Column = rStrm.readInt32();
+    setCellValue( Any( OUString() ) );
+}
+
+void OoxExternalSheetDataContext::importExtCellBool( RecordInputStream& rStrm )
+{
+    maCurrPos.Column = rStrm.readInt32();
+    double fValue = (rStrm.readuInt8() == 0) ? 0.0 : 1.0;
+    setCellValue( Any( fValue ) );
+}
+
+void OoxExternalSheetDataContext::importExtCellDouble( RecordInputStream& rStrm )
+{
+    maCurrPos.Column = rStrm.readInt32();
+    setCellValue( Any( rStrm.readDouble() ) );
+}
+
+void OoxExternalSheetDataContext::importExtCellError( RecordInputStream& rStrm )
+{
+    maCurrPos.Column = rStrm.readInt32();
+    setCellValue( Any( BiffHelper::calcDoubleFromError( rStrm.readuInt8() ) ) );
+}
+
+void OoxExternalSheetDataContext::importExtCellString( RecordInputStream& rStrm )
+{
+    maCurrPos.Column = rStrm.readInt32();
+    setCellValue( Any( rStrm.readString() ) );
+}
+
+void OoxExternalSheetDataContext::setCellValue( const Any& rValue )
+{
+    if( mxSheetCache.is() && getAddressConverter().checkCellAddress( maCurrPos, false ) ) try
+    {
+        mxSheetCache->setCellValue( maCurrPos.Column, maCurrPos.Row, rValue );
+    }
+    catch( Exception& )
+    {
+    }
+}
+
+// ============================================================================
+
 OoxExternalLinkFragment::OoxExternalLinkFragment( const WorkbookHelper& rHelper,
         const OUString& rFragmentPath, ExternalLink& rExtLink ) :
     OoxWorkbookFragmentBase( rHelper, rFragmentPath ),
@@ -75,7 +220,7 @@ ContextWrapper OoxExternalLinkFragment::
             return  (nElement == XLS_TOKEN( definedName ));
         case XLS_TOKEN( sheetDataSet ):
             if( (nElement == XLS_TOKEN( sheetData )) && (mrExtLink.getLinkType() == LINKTYPE_EXTERNAL) )
-                return createSheetDataContext( rAttribs.getInteger( XML_sheetId, -1 ) ).get();
+                return createSheetDataContext( rAttribs.getInteger( XML_sheetId, -1 ) );
         break;
         case XLS_TOKEN( ddeLink ):
             return  (nElement == XLS_TOKEN( ddeItems ));
@@ -148,7 +293,7 @@ ContextWrapper OoxExternalLinkFragment::
             return  (nRecId == OOBIN_ID_EXTERNALBOOK);
         case OOBIN_ID_EXTERNALBOOK:
             if( (nRecId == OOBIN_ID_EXTSHEETDATA) && (mrExtLink.getLinkType() == LINKTYPE_EXTERNAL) )
-                return createSheetDataContext( rStrm.readInt32() ).get();
+                return createSheetDataContext( rStrm.readInt32() );
             return  (nRecId == OOBIN_ID_EXTSHEETNAMES) ||
                     (nRecId == OOBIN_ID_EXTERNALNAME);
         case OOBIN_ID_EXTERNALNAME:
@@ -179,14 +324,9 @@ void OoxExternalLinkFragment::onStartRec
     }
 }
 
-::rtl::Reference< OoxExternalSheetDataContext > OoxExternalLinkFragment::createSheetDataContext( sal_Int32 nSheetId )
+ContextWrapper OoxExternalLinkFragment::createSheetDataContext( sal_Int32 nSheetId )
 {
-    sal_Int32 nSheet = mrExtLink.getSheetIndex( nSheetId );
-    ::rtl::Reference< OoxExternalSheetDataContext > xContext(
-        new OoxExternalSheetDataContext( *this, SHEETTYPE_WORKSHEET, nSheet ) );
-    if( xContext->isValidSheet() )
-        return xContext;
-    return 0;
+    return new OoxExternalSheetDataContext( *this, mrExtLink.getExternalSheetCache( nSheetId ) );
 }
 
 // oox.core.FragmentHandler2 interface ----------------------------------------
@@ -207,8 +347,8 @@ const RecordInfo* OoxExternalLinkFragmen
 
 // ============================================================================
 
-BiffExternalLinkFragment::BiffExternalLinkFragment( const WorkbookHelper& rHelper, bool bImportDefNames ) :
-    BiffWorkbookFragmentBase( rHelper ),
+BiffExternalLinkFragment::BiffExternalLinkFragment( const BiffWorkbookFragmentBase& rParent, bool bImportDefNames ) :
+    BiffWorkbookFragmentBase( rParent ),
     mbImportDefNames( bImportDefNames )
 {
 }
@@ -217,66 +357,66 @@ BiffExternalLinkFragment::~BiffExternalL
 {
 }
 
-bool BiffExternalLinkFragment::importFragment( BiffInputStream& rStrm )
+bool BiffExternalLinkFragment::importFragment()
 {
     // process all record in this sheet fragment
-    while( rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) )
+    while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
     {
-        if( isBofRecord( rStrm.getRecId() ) )
-            skipFragment( rStrm );  // skip unknown embedded fragments
+        if( isBofRecord() )
+            skipFragment();  // skip unknown embedded fragments
         else
-            importRecord( rStrm );
+            importRecord();
     }
-    return rStrm.isValid() && (rStrm.getRecId() == BIFF_ID_EOF);
+    return !mrStrm.isEof() && (mrStrm.getRecId() == BIFF_ID_EOF);
 }
 
-void BiffExternalLinkFragment::importRecord( BiffInputStream& rStrm )
+void BiffExternalLinkFragment::importRecord()
 {
-    sal_uInt16 nRecId = rStrm.getRecId();
+    sal_uInt16 nRecId = mrStrm.getRecId();
     switch( getBiff() )
     {
         case BIFF2: switch( nRecId )
         {
-            case BIFF2_ID_EXTERNALNAME: importExternalName( rStrm );    break;
-            case BIFF_ID_EXTERNSHEET:   importExternSheet( rStrm );     break;
-            case BIFF2_ID_DEFINEDNAME:  importDefinedName( rStrm );     break;
+            case BIFF2_ID_EXTERNALNAME: importExternalName();   break;
+            case BIFF_ID_EXTERNSHEET:   importExternSheet();    break;
+            case BIFF2_ID_DEFINEDNAME:  importDefinedName();    break;
         }
         break;
         case BIFF3: switch( nRecId )
         {
-            case BIFF_ID_CRN:           importCrn( rStrm );             break;
-            case BIFF3_ID_EXTERNALNAME: importExternalName( rStrm );    break;
-            case BIFF_ID_EXTERNSHEET:   importExternSheet( rStrm );     break;
-            case BIFF3_ID_DEFINEDNAME:  importDefinedName( rStrm );     break;
-            case BIFF_ID_XCT:           importXct( rStrm );             break;
+            case BIFF_ID_CRN:           importCrn();            break;
+            case BIFF3_ID_EXTERNALNAME: importExternalName();   break;
+            case BIFF_ID_EXTERNSHEET:   importExternSheet();    break;
+            case BIFF3_ID_DEFINEDNAME:  importDefinedName();    break;
+            case BIFF_ID_XCT:           importXct();            break;
         }
         break;
         case BIFF4: switch( nRecId )
         {
-            case BIFF_ID_CRN:           importCrn( rStrm );             break;
-            case BIFF3_ID_EXTERNALNAME: importExternalName( rStrm );    break;
-            case BIFF_ID_EXTERNSHEET:   importExternSheet( rStrm );     break;
-            case BIFF3_ID_DEFINEDNAME:  importDefinedName( rStrm );     break;
-            case BIFF_ID_XCT:           importXct( rStrm );             break;
+            case BIFF_ID_CRN:           importCrn();            break;
+            case BIFF3_ID_EXTERNALNAME: importExternalName();   break;
+            case BIFF_ID_EXTERNSHEET:   importExternSheet();    break;
+            case BIFF3_ID_DEFINEDNAME:  importDefinedName();    break;
+            case BIFF_ID_XCT:           importXct();            break;
         }
         break;
         case BIFF5: switch( nRecId )
         {
-            case BIFF_ID_CRN:           importCrn( rStrm );             break;
-            case BIFF5_ID_EXTERNALNAME: importExternalName( rStrm );    break;
-            case BIFF_ID_EXTERNSHEET:   importExternSheet( rStrm );     break;
-            case BIFF5_ID_DEFINEDNAME:  importDefinedName( rStrm );     break;
-            case BIFF_ID_XCT:           importXct( rStrm );             break;
+            case BIFF_ID_CRN:           importCrn();            break;
+            case BIFF5_ID_EXTERNALNAME: importExternalName();   break;
+            case BIFF_ID_EXTERNSHEET:   importExternSheet();    break;
+            case BIFF5_ID_DEFINEDNAME:  importDefinedName();    break;
+            case BIFF_ID_XCT:           importXct();            break;
         }
         break;
         case BIFF8: switch( nRecId )
         {
-            case BIFF_ID_CRN:           importCrn( rStrm );             break;
-            case BIFF_ID_EXTERNALBOOK:  importExternalBook( rStrm );    break;
-            case BIFF5_ID_EXTERNALNAME: importExternalName( rStrm );    break;
-            case BIFF_ID_EXTERNSHEET:   importExternSheet( rStrm );     break;
-            case BIFF5_ID_DEFINEDNAME:  importDefinedName( rStrm );     break;
-            case BIFF_ID_XCT:           importXct( rStrm );             break;
+            case BIFF_ID_CRN:           importCrn();            break;
+            case BIFF_ID_EXTERNALBOOK:  importExternalBook();   break;
+            case BIFF5_ID_EXTERNALNAME: importExternalName();   break;
+            case BIFF_ID_EXTERNSHEET:   importExternSheet();    break;
+            case BIFF5_ID_DEFINEDNAME:  importDefinedName();    break;
+            case BIFF_ID_XCT:           importXct();            break;
         }
         break;
         case BIFF_UNKNOWN: break;
@@ -290,33 +430,32 @@ void BiffExternalLinkFragment::finalizeI
 
 // private --------------------------------------------------------------------
 
-void BiffExternalLinkFragment::importExternSheet( BiffInputStream& rStrm )
+void BiffExternalLinkFragment::importExternSheet()
 {
-    mxContext.reset();
+    mxSheetCache.clear();
     if( getBiff() == BIFF8 )
-        getExternalLinks().importExternSheet8( rStrm );
+        getExternalLinks().importExternSheet8( mrStrm );
     else
-        mxExtLink = getExternalLinks().importExternSheet( rStrm );
+        mxExtLink = getExternalLinks().importExternSheet( mrStrm );
 }
 
-void BiffExternalLinkFragment::importExternalBook( BiffInputStream& rStrm )
+void BiffExternalLinkFragment::importExternalBook()
 {
-    mxContext.reset();
-    mxExtLink = getExternalLinks().importExternalBook( rStrm );
+    mxSheetCache.clear();
+    mxExtLink = getExternalLinks().importExternalBook( mrStrm );
 }
 
-void BiffExternalLinkFragment::importExternalName( BiffInputStream& rStrm )
+void BiffExternalLinkFragment::importExternalName()
 {
     if( mxExtLink.get() )
-        mxExtLink->importExternalName( rStrm );
+        mxExtLink->importExternalName( mrStrm );
 }
 
-void BiffExternalLinkFragment::importXct( BiffInputStream& rStrm )
+void BiffExternalLinkFragment::importXct()
 {
-    mxContext.reset();
+    mxSheetCache.clear();
     if( mxExtLink.get() && (mxExtLink->getLinkType() == LINKTYPE_EXTERNAL) )
     {
-        sal_Int32 nSheet = -1;
         switch( getBiff() )
         {
             case BIFF2:
@@ -324,32 +463,76 @@ void BiffExternalLinkFragment::importXct
             case BIFF3:
             case BIFF4:
             case BIFF5:
-                nSheet = mxExtLink->getSheetIndex();
+                mxSheetCache = mxExtLink->getExternalSheetCache( 0 );
             break;
             case BIFF8:
-                rStrm.skip( 2 );
-                nSheet = mxExtLink->getSheetIndex( rStrm.readInt16() );
+                mrStrm.skip( 2 );
+                mxSheetCache = mxExtLink->getExternalSheetCache( mrStrm.readInt16() );
             break;
             case BIFF_UNKNOWN: break;
         }
-
-        // create a sheet data context to import the CRN records and set the cached cell values
-        mxContext.reset( new BiffExternalSheetDataContext( *this, SHEETTYPE_WORKSHEET, nSheet ) );
-        if( !mxContext->isValidSheet() )
-            mxContext.reset();
     }
 }
 
-void BiffExternalLinkFragment::importCrn( BiffInputStream& rStrm )
+void BiffExternalLinkFragment::importCrn()
 {
-    if( mxContext.get() )
-        mxContext->importCrn( rStrm );
+    if( !mxSheetCache.is() ) return;
+
+    sal_uInt8 nCol2, nCol1;
+    sal_uInt16 nRow;
+    mrStrm >> nCol2 >> nCol1 >> nRow;
+    bool bLoop = true;
+    for( BinAddress aBinAddr( nCol1, nRow ); bLoop && !mrStrm.isEof() && (aBinAddr.mnCol <= nCol2); ++aBinAddr.mnCol )
+    {
+        switch( mrStrm.readuInt8() )
+        {
+            case BIFF_DATATYPE_EMPTY:
+                mrStrm.skip( 8 );
+                setCellValue( aBinAddr, Any( OUString() ) );
+            break;
+            case BIFF_DATATYPE_DOUBLE:
+                setCellValue( aBinAddr, Any( mrStrm.readDouble() ) );
+            break;
+            case BIFF_DATATYPE_STRING:
+            {
+                OUString aText = (getBiff() == BIFF8) ? mrStrm.readUniString() : mrStrm.readByteString( false, getTextEncoding() );
+                setCellValue( aBinAddr, Any( aText ) );
+            }
+            break;
+            case BIFF_DATATYPE_BOOL:
+            {
+                double fValue = (mrStrm.readuInt8() == 0) ? 0.0 : 1.0;
+                setCellValue( aBinAddr, Any( fValue ) );
+                mrStrm.skip( 7 );
+            }
+            break;
+            case BIFF_DATATYPE_ERROR:
+                setCellValue( aBinAddr, Any( BiffHelper::calcDoubleFromError( mrStrm.readuInt8() ) ) );
+                mrStrm.skip( 7 );
+            break;
+            default:
+                OSL_ENSURE( false, "BiffExternalLinkFragment::importCrn - unknown data type" );
+                bLoop = false;
+        }
+    }
 }
 
-void BiffExternalLinkFragment::importDefinedName( BiffInputStream& rStrm )
+void BiffExternalLinkFragment::importDefinedName()
 {
     if( mbImportDefNames )
-        getDefinedNames().importDefinedName( rStrm );
+        getDefinedNames().importDefinedName( mrStrm );
+}
+
+void BiffExternalLinkFragment::setCellValue( const BinAddress& rBinAddr, const Any& rValue )
+{
+    CellAddress aCellPos;
+    if( mxSheetCache.is() && getAddressConverter().convertToCellAddress( aCellPos, rBinAddr, 0, false ) ) try
+    {
+        mxSheetCache->setCellValue( aCellPos.Column, aCellPos.Row, rValue );
+    }
+    catch( Exception& )
+    {
+    }
 }
 
 // ============================================================================
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/formulabase.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/formulabase.cxx
--- oox/source/xls/formulabase.cxx	2008-07-22 16:13:08.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/formulabase.cxx	2009-01-06 15:57:48.000000000 +0100
@@ -42,7 +42,6 @@
 #include <com/sun/star/sheet/FormulaMapGroupSpecialOffset.hpp>
 #include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
 #include <com/sun/star/sheet/XFormulaTokens.hpp>
-#include "oox/helper/containerhelper.hxx"
 #include "oox/helper/propertyset.hxx"
 #include "oox/helper/recordinputstream.hxx"
 #include "oox/core/filterbase.hxx"
@@ -172,17 +171,73 @@ void BinComplexRef2d::readBiff8Data( Bif
     maRef2.setBiff8Data( nCol2, nRow2, bRelativeAsOffset );
 }
 
+// token vector, sequence =====================================================
+
+ApiTokenVector::ApiTokenVector()
+{
+}
+
+Any& ApiTokenVector::append( sal_Int32 nOpCode )
+{
+    resize( size() + 1 );
+    back().OpCode = nOpCode;
+    return back().Data;
+}
+
+// token sequence iterator ====================================================
+
+ApiTokenIterator::ApiTokenIterator( const ApiTokenSequence& rTokens, sal_Int32 nSpacesOpCode, bool bSkipSpaces ) :
+    mpToken( rTokens.getConstArray() ),
+    mpTokenEnd( rTokens.getConstArray() + rTokens.getLength() ),
+    mnSpacesOpCode( nSpacesOpCode ),
+    mbSkipSpaces( bSkipSpaces )
+{
+    skipSpaces();
+}
+
+ApiTokenIterator::ApiTokenIterator( const ApiTokenIterator& rIter, bool bSkipSpaces ) :
+    mpToken( rIter.mpToken ),
+    mpTokenEnd( rIter.mpTokenEnd ),
+    mnSpacesOpCode( rIter.mnSpacesOpCode ),
+    mbSkipSpaces( bSkipSpaces )
+{
+    skipSpaces();
+}
+
+ApiTokenIterator& ApiTokenIterator::operator++()
+{
+    if( is() )
+    {
+        ++mpToken;
+        skipSpaces();
+    }
+    return *this;
+}
+
+void ApiTokenIterator::skipSpaces()
+{
+    if( mbSkipSpaces )
+        while( is() && (mpToken->OpCode == mnSpacesOpCode) )
+            ++mpToken;
+}
+
 // function data ==============================================================
 
 namespace {
 
 const size_t FUNCINFO_CLASSCOUNT            = 5;        /// Number of token class entries.
 
-const sal_uInt8 FUNCFLAG_VOLATILE           = 0x01;     /// Result is volatile (e.g. NOW() function).
-const sal_uInt8 FUNCFLAG_IMPORTONLY         = 0x02;     /// Only used in import filter.
-const sal_uInt8 FUNCFLAG_EXPORTONLY         = 0x04;     /// Only used in export filter.
-const sal_uInt8 FUNCFLAG_MACROCALL          = 0x08;     /// Function is simulated by macro call in Excel.
-const sal_uInt8 FUNCFLAG_EXTERNAL           = 0x10;     /// Function is external in Calc.
+const sal_uInt16 FUNCFLAG_VOLATILE          = 0x0001;   /// Result is volatile (e.g. NOW() function).
+const sal_uInt16 FUNCFLAG_IMPORTONLY        = 0x0002;   /// Only used in import filter.
+const sal_uInt16 FUNCFLAG_EXPORTONLY        = 0x0004;   /// Only used in export filter.
+const sal_uInt16 FUNCFLAG_MACROCALL         = 0x0008;   /// Function is simulated by macro call in Excel.
+const sal_uInt16 FUNCFLAG_EXTERNAL          = 0x0010;   /// Function is external in Calc.
+const sal_uInt16 FUNCFLAG_MACROFUNC         = 0x0020;   /// Function is a macro-sheet function.
+const sal_uInt16 FUNCFLAG_MACROCMD          = 0x0040;   /// Function is a macro-sheet command.
+const sal_uInt16 FUNCFLAG_ALWAYSVAR         = 0x0080;   /// Function is always represented by a tFuncVar token.
+
+const sal_uInt16 FUNCFLAG_FUNCLIBMASK       = 0xF000;   /// Mask for function library bits.
+const sal_uInt16 FUNCFLAG_EUROTOOL          = 0x1000;   /// Function is part of the EuroTool add-in.
 
 typedef ::boost::shared_ptr< FunctionInfo > FunctionInfoRef;
 
@@ -196,7 +251,7 @@ struct FunctionData
     sal_uInt8           mnMaxParamCount;    /// Maximum number of parameters.
     sal_uInt8           mnRetClass;         /// BIFF token class of the return value.
     sal_uInt8           mpnParamClass[ FUNCINFO_CLASSCOUNT ]; /// Expected BIFF token classes of parameters.
-    sal_uInt8           mnFlags;            /// Additional flags.
+    sal_uInt16          mnFlags;            /// Additional flags.
 
     inline bool         isSupported( bool bImportFilter ) const;
 };
@@ -277,6 +332,7 @@ static const FunctionData saFuncTableBif
     { "TREND",                  "TREND",            50,     50,     1,  3,  A, { R, R, R, C, I }, 0 },
     { "LOGEST",                 "LOGEST",           51,     51,     1,  2,  A, { R, R, C, C, I }, 0 },
     { "GROWTH",                 "GROWTH",           52,     52,     1,  3,  A, { R, R, R, C, I }, 0 },
+    { 0,                        "RETURN",               55,     55,     0,  1,  R, { R }, FUNCFLAG_MACROFUNC },
     { "PV",                     "PV",               56,     56,     3,  5,  V, { V }, 0 },
     { "FV",                     "FV",               57,     57,     3,  5,  V, { V }, 0 },
     { "NPER",                   "NPER",             58,     58,     3,  5,  V, { V }, 0 },
@@ -300,9 +356,11 @@ static const FunctionData saFuncTableBif
     { "ROWS",                   "ROWS",             76,     76,     1,  1,  V, { R }, 0 },
     { "COLUMNS",                "COLUMNS",          77,     77,     1,  1,  V, { R }, 0 },
     { "OFFSET",                 "OFFSET",           78,     78,     3,  5,  R, { R, V }, FUNCFLAG_VOLATILE },
+    { 0,                        "ABSREF",               79,     79,     2,  2,  R, { V, R }, FUNCFLAG_MACROFUNC },
     { "SEARCH",                 "SEARCH",           82,     82,     2,  3,  V, { V }, 0 },
     { "TRANSPOSE",              "TRANSPOSE",        83,     83,     1,  1,  A, { A }, 0 },
     { "TYPE",                   "TYPE",             86,     86,     1,  1,  V, { V }, 0 },
+    { 0,                        "ACTIVE.CELL",          94,     94,     0,  0,  R, {}, FUNCFLAG_MACROFUNC },
     { "ATAN2",                  "ATAN2",            97,     97,     2,  2,  V, { V }, 0 },
     { "ASIN",                   "ASIN",             98,     98,     1,  1,  V, { V }, 0 },
     { "ACOS",                   "ACOS",             99,     99,     1,  1,  V, { V }, 0 },
@@ -336,6 +394,9 @@ static const FunctionData saFuncTableBif
     { "SYD",                    "SYD",              143,    143,    4,  4,  V, { V }, 0 },
     { "DDB",                    "DDB",              144,    144,    4,  5,  V, { V }, 0 },
     { "INDIRECT",               "INDIRECT",         148,    148,    1,  2,  R, { V }, FUNCFLAG_VOLATILE },
+    { 0,                        "ADD.BAR",              151,    151,    0,  0,  V, {}, FUNCFLAG_MACROFUNC | FUNCFLAG_ALWAYSVAR },
+    { 0,                        "ADD.MENU",             152,    152,    2,  2,  V, { V, R }, FUNCFLAG_MACROFUNC | FUNCFLAG_ALWAYSVAR },
+    { 0,                        "ADD.COMMAND",          153,    153,    3,  3,  V, { V, R }, FUNCFLAG_MACROFUNC | FUNCFLAG_ALWAYSVAR },
     { "CLEAN",                  "CLEAN",            162,    162,    1,  1,  V, { V }, 0 },
     { "MDETERM",                "MDETERM",          163,    163,    1,  1,  V, { A }, 0 },
     { "MINVERSE",               "MINVERSE",         164,    164,    1,  1,  A, { A }, 0 },
@@ -354,16 +415,27 @@ static const FunctionData saFuncTableBif
     { "TRUNC",                  "TRUNC",            197,    197,    1,  1,  V, { V, C, I }, 0 },
     { "ISLOGICAL",              "ISLOGICAL",        198,    198,    1,  1,  V, { V }, 0 },
     { "DCOUNTA",                "DCOUNTA",          199,    199,    3,  3,  V, { R }, 0 },
-    { 0,                        0,                  255,    255,    1,  MX, R, { ER, R }, FUNCFLAG_IMPORTONLY }  // EXTERNAL
+    { 0,                        "EXTERN.CALL",          255,    255,    1,  MX, R, { ER, R }, FUNCFLAG_IMPORTONLY },
+
+    // *** macro sheet commands ***
+
+    { 0,                        "A1.R1C1",              30,     30,     0,  1,  V, { V }, FUNCFLAG_MACROCMD },
+    { 0,                        "ADD.ARROW",            81,     81,     0,  0,  V, {}, FUNCFLAG_MACROCMD },
+    { 0,                        "ACTIVATE",             103,    103,    0,  2,  V, { V }, FUNCFLAG_MACROCMD },
+    { 0,                        "ACTIVATE.NEXT",        104,    104,    0,  0,  V, {}, FUNCFLAG_MACROCMD },
+    { 0,                        "ACTIVATE.PREV",        105,    105,    0,  0,  V, {}, FUNCFLAG_MACROCMD }
 };
 
 /** Functions new in BIFF3. */
 static const FunctionData saFuncTableBiff3[] =
 {
-    { "LINEST",                 "LINEST",           49,     49,     1,  4,  A, { R, R, V, V }, 0 },  // BIFF2: 1-2, BIFF3: 1-4,
+    { "LINEST",                 "LINEST",               49,     49,     1,  4,  A, { R, R, V, V }, 0 },             // BIFF2: 1-2, BIFF3: 1-4
     { "TREND",                  "TREND",            50,     50,     1,  4,  A, { R, R, R, V }, 0 },  // BIFF2: 1-3, BIFF3: 1-4
-    { "LOGEST",                 "LOGEST",           51,     51,     1,  4,  A, { R, R, V, V }, 0 },  // BIFF2: 1-2, BIFF3: 1-4,
+    { "LOGEST",                 "LOGEST",               51,     51,     1,  4,  A, { R, R, V, V }, 0 },             // BIFF2: 1-2, BIFF3: 1-4
     { "GROWTH",                 "GROWTH",           52,     52,     1,  4,  A, { R, R, R, V }, 0 },  // BIFF2: 1-3, BIFF3: 1-4
+    { 0,                        "ADD.BAR",              151,    151,    0,  1,  V, { V }, FUNCFLAG_MACROFUNC },     // BIFF2: 0,   BIFF3: 0-1
+    { 0,                        "ADD.MENU",             152,    152,    2,  3,  V, { V, R }, FUNCFLAG_MACROFUNC },  // BIFF2: 2,   BIFF3: 2-3
+    { 0,                        "ADD.COMMAND",          153,    153,    3,  4,  V, { V, R }, FUNCFLAG_MACROFUNC },  // BIFF2: 3,   BIFF3: 3-4
     { "TRUNC",                  "TRUNC",            197,    197,    1,  2,  V, { V }, 0 },           // BIFF2: 1,   BIFF3: 1-2
     { "DOLLAR",                 "USDOLLAR",         204,    204,    1,  2,  V, { V }, FUNCFLAG_IMPORTONLY },
     { 0/*"FIND"*/,              "FINDB",            205,    205,    2,  3,  V, { V }, 0 },
@@ -562,8 +634,12 @@ static const FunctionData saFuncTableBif
     { "GCD",                    "GCD",              473,    NOID,   1,  MX, V, { R }, FUNCFLAG_EXTERNAL },       // Calc: builtin and add-in
     { "MULTINOMIAL",            "MULTINOMIAL",      474,    NOID,   1,  MX, V, { R }, FUNCFLAG_EXTERNAL },
     { "LCM",                    "LCM",              475,    NOID,   1,  MX, V, { R }, FUNCFLAG_EXTERNAL },       // Calc: builtin and add-in
-    { "FVSCHEDULE",             "FVSCHEDULE",       476,    NOID,   2,  2,  V, { V, A }, FUNCFLAG_EXTERNAL }
-//    { "EUROCONVERT",            "EUROCONVERT",      NOID,   NOID,   3,  5,  V, { V }, FUNCFLAG_EXTERNAL },       // Euro conversion add-in
+    { "FVSCHEDULE",             "FVSCHEDULE",           476,    NOID,   2,  2,  V, { V, A }, FUNCFLAG_EXTERNAL },
+
+    // *** macro sheet commands ***
+
+    { 0,                        "ACTIVATE.NEXT",        104,    104,    0,  1,  V, { V }, FUNCFLAG_MACROCMD },      // BIFF2-3: 0, BIFF4: 0-1
+    { 0,                        "ACTIVATE.PREV",        105,    105,    0,  1,  V, { V }, FUNCFLAG_MACROCMD }       // BIFF2-3: 0, BIFF4: 0-1
 };
 
 /** Functions new in BIFF5/BIFF7. */
@@ -572,8 +648,10 @@ static const FunctionData saFuncTableBif
     { "WEEKDAY",                "WEEKDAY",          70,     70,     1,  2,  V, { V }, 0 },               // BIFF2-4: 1, BIFF5: 1-2
     { "HLOOKUP",                "HLOOKUP",          101,    101,    3,  4,  V, { V, R, R, V }, 0 },      // BIFF2-4: 3, BIFF5: 3-4
     { "VLOOKUP",                "VLOOKUP",          102,    102,    3,  4,  V, { V, R, R, V }, 0 },      // BIFF2-4: 3, BIFF5: 3-4
+    { 0,                        "ADD.MENU",             152,    152,    2,  4,  V, { V, R, R, V }, FUNCFLAG_MACROFUNC },    // BIFF3-4: 2-3, BIFF5: 2-4
+    { 0,                        "ADD.COMMAND",          153,    153,    3,  5,  V, { V, R, R, R, V }, FUNCFLAG_MACROFUNC }, // BIFF3-4: 3-4, BIFF5: 3-5
     { "DAYS360",                "DAYS360",          220,    220,    2,  3,  V, { V }, 0 },               // BIFF3-4: 2, BIFF5: 2-3
-    { 0,                        0,                  255,    255,    1,  MX, R, { ER, R }, FUNCFLAG_EXPORTONLY }, // MACRO or EXTERNAL
+    { 0,                        "EXTERN.CALL",          255,    255,    1,  MX, R, { ER, R }, FUNCFLAG_EXPORTONLY },        // MACRO or EXTERNAL
     { "CONCATENATE",            "CONCATENATE",      336,    336,    0,  MX, V, { V }, 0 },
     { "POWER",                  "POWER",            337,    337,    2,  2,  V, { V }, 0 },
     { "RADIANS",                "RADIANS",          342,    342,    1,  1,  V, { V }, 0 },
@@ -586,7 +664,17 @@ static const FunctionData saFuncTableBif
     { 0,                        "DATEDIF",          351,    351,    3,  3,  V, { V }, FUNCFLAG_IMPORTONLY },   // not supported in Calc
     { 0,                        "DATESTRING",       352,    352,    1,  1,  V, { V }, FUNCFLAG_IMPORTONLY },   // not supported in Calc, missing in OOX spec
     { 0,                        "NUMBERSTRING",     353,    353,    2,  2,  V, { V }, FUNCFLAG_IMPORTONLY },   // not supported in Calc, missing in OOX spec
-    { "ROMAN",                  "ROMAN",            354,    354,    1,  2,  V, { V }, 0 }
+    { "ROMAN",                  "ROMAN",                354,    354,    1,  2,  V, { V }, 0 },
+
+    // *** EuroTool add-in ***
+
+    { "EUROCONVERT",            "EUROCONVERT",          NOID,   NOID,   3,  5,  V, { V }, FUNCFLAG_EUROTOOL },
+
+    // *** macro sheet commands ***
+
+    { 0,                        "ADD.CHART.AUTOFORMAT", 390,    390,    0,  2,  V, { V }, FUNCFLAG_MACROCMD },
+    { 0,                        "ADD.LIST.ITEM",        451,    451,    0,  2,  V, { V }, FUNCFLAG_MACROCMD },
+    { 0,                        "ACTIVE.CELL.FONT",     476,    476,    0,  14, V, { V }, FUNCFLAG_MACROCMD }
 };
 
 /** Functions new in BIFF8. */
@@ -701,133 +789,259 @@ FuncInfoParamClassIterator& FuncInfoPara
     return *this;
 }
 
-// function provider implementation ===========================================
+// function provider ==========================================================
 
-class FunctionProviderImpl
+FunctionProvider::FunctionProvider( FilterType eFilter, BiffType eBiff, bool bImportFilter ) :
+    mxFuncs( new FuncVector ),
+    mxOdfFuncs( new FuncNameMap ),
+    mxOoxFuncs( new FuncNameMap ),
+    mxOobFuncs( new FuncIdMap ),
+    mxBiffFuncs( new FuncIdMap ),
+    mxMacroFuncs( new FuncNameMap )
+{
+    OSL_ENSURE( bImportFilter, "FunctionProvider::FunctionProvider - need special handling for macro call functions" );
+    sal_uInt8 nMaxParam = 0;
+    switch( eFilter )
 {
-public:
-    explicit            FunctionProviderImpl(
-                            ApiOpCodes& rOpCodes,
-                            const Reference< XSpreadsheetDocument >& rxDocument,
-                            bool bImportFilter );
-
-    explicit            FunctionProviderImpl(
-                            ApiOpCodes& rOpCodes,
-                            const Reference< XSpreadsheetDocument >& rxDocument,
-                            BiffType eBiff,
-                            bool bImportFilter );
-
-    const FunctionInfo* getFuncInfoFromApiToken( const ApiToken& rToken ) const;
-    const FunctionInfo* getFuncInfoFromOoxFuncName( const OUString& rFuncName ) const;
-    const FunctionInfo* getFuncInfoFromOobFuncId( sal_uInt16 nFuncId ) const;
-    const FunctionInfo* getFuncInfoFromBiffFuncId( sal_uInt16 nFuncId ) const;
-    const FunctionInfo* getFuncInfoFromExternCallName( const OUString& rExtCallName ) const;
-
-    Sequence< FormulaOpCodeMapEntry > getOoxParserMap() const;
-
-private:
-    typedef ::std::map< OUString, FormulaToken >    FormulaTokenMap;
-    typedef Sequence< FormulaOpCodeMapEntry >       OpCodeEntrySequence;
-    typedef ::std::vector< FormulaOpCodeMapEntry >  OpCodeEntryVector;
-
-    static bool         fillEntrySeq( OpCodeEntrySequence& orEntrySeq, const Reference< XFormulaOpCodeMapper >& rxMapper, sal_Int32 nMapGroup );
-    static bool         fillTokenMap( FormulaTokenMap& orTokenMap, OpCodeEntrySequence& orEntrySeq, const Reference< XFormulaOpCodeMapper >& rxMapper, sal_Int32 nMapGroup );
-
-    static bool         initOpCode( sal_Int32& ornOpCode, const OpCodeEntrySequence& rEntrySeq, sal_Int32 nSpecialId );
-    static bool         initOpCode( OpCodeEntryVector& orParserMap, sal_Int32& ornOpCode, const FormulaTokenMap& rTokenMap, const OUString& rOdfName, const OUString& rOoxName );
-    static bool         initOpCode( OpCodeEntryVector& orParserMap, sal_Int32& ornOpCode, const FormulaTokenMap& rTokenMap, const sal_Char* pcOdfName, const sal_Char* pcOoxName );
-    static bool         initOpCode( OpCodeEntryVector& orParserMap, sal_Int32& ornOpCode, const FormulaTokenMap& rTokenMap, sal_Unicode cOdfName, sal_Unicode cOoxName );
-
-    void                construct( const Reference< XSpreadsheetDocument >& rxDocument, bool bImportFilter );
-    void                construct( const Reference< XSpreadsheetDocument >& rxDocument, BiffType eBiff, bool bImportFilter );
-
-    bool                initFuncNames( const OpCodeEntrySequence& rEntrySeq );
-    void                initOpCodes( const Reference< XSpreadsheetDocument >& rxDocument );
-
-    void                initFuncOpCode( FunctionInfo& orFuncInfo, const FormulaTokenMap& rFuncTokens );
-    void                initFuncMaps( const FunctionData* pBeg, const FunctionData* pEnd );
-
-private:
-    typedef RefMap< sal_Int32, FunctionInfo >   OpCodeFuncMap;
-    typedef RefMap< OUString, FunctionInfo >    FuncNameMap;
-    typedef RefMap< sal_uInt16, FunctionInfo >  FuncIdMap;
-
-    ApiOpCodes&         mrOpCodes;          /// All needed API op-codes.
-    FormulaTokenMap     maIntFuncTokens;    /// Internal functions keyed by ODFF name.
-    FormulaTokenMap     maExtFuncTokens;    /// External functions keyed by ODFF name.
-    OpCodeFuncMap       maOpCodeFuncs;      /// Maps API op-codes to function data.
-    FuncNameMap         maOoxFuncs;         /// Maps OOXML function names to function data.
-    FuncNameMap         maExtProgFuncs;     /// Maps programmatical API function names to function data.
-    FuncIdMap           maOobFuncs;         /// Maps OOBIN function indexes to function data.
-    FuncIdMap           maBiffFuncs;        /// Maps BIFF function indexes to function data.
-    FuncNameMap         maMacroFuncs;       /// Maps BIFF macro function names to function data.
-    OpCodeEntryVector   maParserMap;        /// OOXML token mapping for formula parser service.
-    sal_uInt8           mnMaxParam;         /// Maximum parameter count for current file type.
-    bool                mbImportFilter;     /// True = import filter, false = export filter.
-};
+        case FILTER_OOX:
+            nMaxParam = OOX_MAX_PARAMCOUNT;
+            eBiff = BIFF8;  // insert all BIFF function tables, then the OOX table
+        break;
+        case FILTER_BIFF:
+            nMaxParam = BIFF_MAX_PARAMCOUNT;
+        break;
+        case FILTER_UNKNOWN:
+            OSL_ENSURE( false, "FunctionProvider::FunctionProvider - invalid filter type" );
+        break;
+    }
+    OSL_ENSURE( eBiff != BIFF_UNKNOWN, "FunctionProvider::FunctionProvider - invalid BIFF type" );
 
-// ----------------------------------------------------------------------------
+    /*  Add functions supported in the current BIFF version only. Function
+        tables from later BIFF versions may overwrite single functions from
+        earlier tables. */
+    if( eBiff >= BIFF2 )
+        initFuncs( saFuncTableBiff2, STATIC_ARRAY_END( saFuncTableBiff2 ), nMaxParam, bImportFilter );
+    if( eBiff >= BIFF3 )
+        initFuncs( saFuncTableBiff3, STATIC_ARRAY_END( saFuncTableBiff3 ), nMaxParam, bImportFilter );
+    if( eBiff >= BIFF4 )
+        initFuncs( saFuncTableBiff4, STATIC_ARRAY_END( saFuncTableBiff4 ), nMaxParam, bImportFilter );
+    if( eBiff >= BIFF5 )
+        initFuncs( saFuncTableBiff5, STATIC_ARRAY_END( saFuncTableBiff5 ), nMaxParam, bImportFilter );
+    if( eBiff >= BIFF8 )
+        initFuncs( saFuncTableBiff8, STATIC_ARRAY_END( saFuncTableBiff8 ), nMaxParam, bImportFilter );
+    if( eFilter == FILTER_OOX )
+        initFuncs( saFuncTableOox, STATIC_ARRAY_END( saFuncTableOox ), nMaxParam, bImportFilter );
+}
 
-FunctionProviderImpl::FunctionProviderImpl( ApiOpCodes& rOpCodes,
-        const Reference< XSpreadsheetDocument >& rxDocument, bool bImportFilter ) :
-    mrOpCodes( rOpCodes ),
-    mnMaxParam( OOX_MAX_PARAMCOUNT )
+FunctionProvider::~FunctionProvider()
 {
-    construct( rxDocument, bImportFilter );
 }
 
-FunctionProviderImpl::FunctionProviderImpl( ApiOpCodes& rOpCodes,
-        const Reference< XSpreadsheetDocument >& rxDocument, BiffType eBiff, bool bImportFilter ) :
-    mrOpCodes( rOpCodes ),
-    mnMaxParam( BIFF_MAX_PARAMCOUNT )
+const FunctionInfo* FunctionProvider::getFuncInfoFromOdfFuncName( const OUString& rFuncName ) const
 {
-    construct( rxDocument, eBiff, bImportFilter );
+    return mxOdfFuncs->get( rFuncName ).get();
 }
 
-const FunctionInfo* FunctionProviderImpl::getFuncInfoFromApiToken( const ApiToken& rToken ) const
+const FunctionInfo* FunctionProvider::getFuncInfoFromOoxFuncName( const OUString& rFuncName ) const
 {
-    const FunctionInfo* pFuncInfo = 0;
-    if( (rToken.OpCode == mrOpCodes.OPCODE_EXTERNAL) && rToken.Data.hasValue() )
+    return mxOoxFuncs->get( rFuncName ).get();
+}
+
+const FunctionInfo* FunctionProvider::getFuncInfoFromOobFuncId( sal_uInt16 nFuncId ) const
     {
-        OUString aProgFuncName;
-        if( rToken.Data >>= aProgFuncName )
-            pFuncInfo = maExtProgFuncs.get( aProgFuncName ).get();
+    return mxOobFuncs->get( nFuncId ).get();
     }
-    else
+
+const FunctionInfo* FunctionProvider::getFuncInfoFromBiffFuncId( sal_uInt16 nFuncId ) const
     {
-        pFuncInfo = maOpCodeFuncs.get( rToken.OpCode ).get();
+    return mxBiffFuncs->get( nFuncId ).get();
     }
-    return pFuncInfo;
+
+const FunctionInfo* FunctionProvider::getFuncInfoFromMacroName( const OUString& rFuncName ) const
+{
+    return mxMacroFuncs->get( rFuncName ).get();
 }
 
-const FunctionInfo* FunctionProviderImpl::getFuncInfoFromOoxFuncName( const OUString& rFuncName ) const
+// private --------------------------------------------------------------------
+
+void FunctionProvider::initFunc( const FunctionData& rFuncData, sal_uInt8 nMaxParam )
 {
-    return maOoxFuncs.get( rFuncName ).get();
+    // create a function info object
+    FunctionInfoRef xFuncInfo( new FunctionInfo );
+    if( rFuncData.mpcOdfFuncName )
+        xFuncInfo->maOdfFuncName = OUString::createFromAscii( rFuncData.mpcOdfFuncName );
+    if( rFuncData.mpcOoxFuncName )
+        xFuncInfo->maOoxFuncName = OUString::createFromAscii( rFuncData.mpcOoxFuncName );
+    if( getFlag( rFuncData.mnFlags, FUNCFLAG_MACROCALL ) )
+        xFuncInfo->maBiffMacroName = CREATE_OUSTRING( "_xlfn." ) + xFuncInfo->maOoxFuncName;
+    switch( rFuncData.mnFlags & FUNCFLAG_FUNCLIBMASK )
+    {
+        case FUNCFLAG_EUROTOOL: xFuncInfo->meFuncLibType = FUNCLIB_EUROTOOL;    break;
+        default:                xFuncInfo->meFuncLibType = FUNCLIB_UNKNOWN;
+    }
+    xFuncInfo->mnApiOpCode = -1;
+    xFuncInfo->mnOobFuncId = rFuncData.mnOobFuncId;
+    xFuncInfo->mnBiffFuncId = rFuncData.mnBiffFuncId;
+    xFuncInfo->mnMinParamCount = rFuncData.mnMinParamCount;
+    xFuncInfo->mnMaxParamCount = (rFuncData.mnMaxParamCount == MX) ? nMaxParam : rFuncData.mnMaxParamCount;
+    xFuncInfo->mnRetClass = rFuncData.mnRetClass;
+    xFuncInfo->mpnParamClass = rFuncData.mpnParamClass;
+    xFuncInfo->mbVolatile = getFlag( rFuncData.mnFlags, FUNCFLAG_VOLATILE );
+    xFuncInfo->mbExternal = getFlag( rFuncData.mnFlags, FUNCFLAG_EXTERNAL );
+    bool bMacroCmd = getFlag( rFuncData.mnFlags, FUNCFLAG_MACROCMD );
+    xFuncInfo->mbMacroFunc = bMacroCmd || getFlag( rFuncData.mnFlags, FUNCFLAG_MACROFUNC );
+    xFuncInfo->mbVarParam = bMacroCmd || (rFuncData.mnMinParamCount != rFuncData.mnMaxParamCount) || getFlag( rFuncData.mnFlags, FUNCFLAG_ALWAYSVAR );
+
+    setFlag( xFuncInfo->mnOobFuncId, BIFF_TOK_FUNCVAR_CMD, bMacroCmd );
+    setFlag( xFuncInfo->mnBiffFuncId, BIFF_TOK_FUNCVAR_CMD, bMacroCmd );
+
+    // insert the function info into the member maps
+    mxFuncs->push_back( xFuncInfo );
+    if( xFuncInfo->maOdfFuncName.getLength() > 0 )
+        (*mxOdfFuncs)[ xFuncInfo->maOdfFuncName ] = xFuncInfo;
+    if( xFuncInfo->maOoxFuncName.getLength() > 0 )
+        (*mxOoxFuncs)[ xFuncInfo->maOoxFuncName ] = xFuncInfo;
+    if( xFuncInfo->mnOobFuncId != NOID )
+        (*mxOobFuncs)[ xFuncInfo->mnOobFuncId ] = xFuncInfo;
+    if( xFuncInfo->mnBiffFuncId != NOID )
+        (*mxBiffFuncs)[ xFuncInfo->mnBiffFuncId ] = xFuncInfo;
+    if( xFuncInfo->maBiffMacroName.getLength() > 0 )
+        (*mxMacroFuncs)[ xFuncInfo->maBiffMacroName ] = xFuncInfo;
 }
 
-const FunctionInfo* FunctionProviderImpl::getFuncInfoFromOobFuncId( sal_uInt16 nFuncId ) const
+void FunctionProvider::initFuncs( const FunctionData* pBeg, const FunctionData* pEnd, sal_uInt8 nMaxParam, bool bImportFilter )
+{
+    for( const FunctionData* pIt = pBeg; pIt != pEnd; ++pIt )
+        if( pIt->isSupported( bImportFilter ) )
+            initFunc( *pIt, nMaxParam );
+}
+
+// op-code and function provider ==============================================
+
+OpCodeProvider::OpCodeProvider( const WorkbookHelper& rHelper ) :
+    FunctionProvider( rHelper.getFilterType(), rHelper.getBiff(), rHelper.getBaseFilter().isImportFilter() ),
+    WorkbookHelper( rHelper ),
+    mxOpCodeFuncs( new OpCodeFuncMap ),
+    mxExtProgFuncs( new FuncNameMap ),
+    mxParserMap( new OpCodeEntryVector )
+{
+    try
+    {
+        Reference< XMultiServiceFactory > xFactory( getDocument(), UNO_QUERY_THROW );
+        Reference< XFormulaOpCodeMapper > xMapper( xFactory->createInstance(
+            CREATE_OUSTRING( "com.sun.star.sheet.FormulaOpCodeMapper" ) ), UNO_QUERY_THROW );
+
+        // op-codes provided as attributes
+        OPCODE_UNKNOWN = xMapper->getOpCodeUnknown();
+        OPCODE_EXTERNAL = xMapper->getOpCodeExternal();
+
+        using namespace ::com::sun::star::sheet::FormulaMapGroup;
+        using namespace ::com::sun::star::sheet::FormulaMapGroupSpecialOffset;
+
+        OpCodeEntrySequence aEntrySeq;
+        ApiTokenMap aTokenMap, aExtFuncTokenMap;
+        bool bIsValid =
+            // special
+            fillEntrySeq( aEntrySeq, xMapper, SPECIAL ) &&
+            initOpCode( OPCODE_PUSH,          aEntrySeq, PUSH ) &&
+            initOpCode( OPCODE_MISSING,       aEntrySeq, MISSING ) &&
+            initOpCode( OPCODE_SPACES,        aEntrySeq, SPACES ) &&
+            initOpCode( OPCODE_NAME,          aEntrySeq, NAME ) &&
+            initOpCode( OPCODE_DBAREA,        aEntrySeq, DB_AREA ) &&
+            initOpCode( OPCODE_NLR,           aEntrySeq, COL_ROW_NAME ) &&
+            initOpCode( OPCODE_MACRO,         aEntrySeq, MACRO ) &&
+            initOpCode( OPCODE_BAD,           aEntrySeq, BAD ) &&
+            initOpCode( OPCODE_NONAME,        aEntrySeq, NO_NAME ) &&
+            // separators
+            fillTokenMap( aTokenMap, aEntrySeq, xMapper, SEPARATORS ) &&
+            initOpCode( OPCODE_OPEN,          aTokenMap, API_TOKEN_OPEN,  '('  ) &&
+            initOpCode( OPCODE_CLOSE,         aTokenMap, API_TOKEN_CLOSE, ')'  ) &&
+            initOpCode( OPCODE_SEP,           aTokenMap, API_TOKEN_SEP,   ','  ) &&
+            // array separators
+            fillTokenMap( aTokenMap, aEntrySeq, xMapper, ARRAY_SEPARATORS ) &&
+            initOpCode( OPCODE_ARRAY_OPEN,    aTokenMap, API_TOKEN_ARRAY_OPEN,   '{'  ) &&
+            initOpCode( OPCODE_ARRAY_CLOSE,   aTokenMap, API_TOKEN_ARRAY_CLOSE,  '}'  ) &&
+            initOpCode( OPCODE_ARRAY_ROWSEP,  aTokenMap, API_TOKEN_ARRAY_ROWSEP, ';'  ) &&
+            initOpCode( OPCODE_ARRAY_COLSEP,  aTokenMap, API_TOKEN_ARRAY_COLSEP, ','  ) &&
+            // unary operators
+            fillTokenMap( aTokenMap, aEntrySeq, xMapper, UNARY_OPERATORS ) &&
+            initOpCode( OPCODE_PLUS_SIGN,     aTokenMap, '+',  '\0' ) && // same op-code as OPCODE_ADD
+            initOpCode( OPCODE_MINUS_SIGN,    aTokenMap, '-',  '-'  ) &&
+            initOpCode( OPCODE_PERCENT,       aTokenMap, '%',  '%'  ) &&
+            // binary operators
+            fillTokenMap( aTokenMap, aEntrySeq, xMapper, BINARY_OPERATORS ) &&
+            initOpCode( OPCODE_ADD,           aTokenMap, '+',  '+'  ) &&
+            initOpCode( OPCODE_SUB,           aTokenMap, '-',  '-'  ) &&
+            initOpCode( OPCODE_MULT,          aTokenMap, '*',  '*'  ) &&
+            initOpCode( OPCODE_DIV,           aTokenMap, '/',  '/'  ) &&
+            initOpCode( OPCODE_POWER,         aTokenMap, '^',  '^'  ) &&
+            initOpCode( OPCODE_CONCAT,        aTokenMap, '&',  '&'  ) &&
+            initOpCode( OPCODE_EQUAL,         aTokenMap, '=',  '='  ) &&
+            initOpCode( OPCODE_NOT_EQUAL,     aTokenMap, "<>", "<>" ) &&
+            initOpCode( OPCODE_LESS,          aTokenMap, '<',  '<'  ) &&
+            initOpCode( OPCODE_LESS_EQUAL,    aTokenMap, "<=", "<=" ) &&
+            initOpCode( OPCODE_GREATER,       aTokenMap, '>',  '>'  ) &&
+            initOpCode( OPCODE_GREATER_EQUAL, aTokenMap, ">=", ">=" ) &&
+            initOpCode( OPCODE_INTERSECT,     aTokenMap, '!',  ' '  ) &&
+            initOpCode( OPCODE_LIST,          aTokenMap, '~',  ','  ) &&
+            initOpCode( OPCODE_RANGE,         aTokenMap, ':',  ':'  ) &&
+            // functions
+            fillFuncTokenMaps( aTokenMap, aExtFuncTokenMap, aEntrySeq, xMapper ) &&
+            initFuncOpCodes( aTokenMap, aExtFuncTokenMap ) &&
+            initOpCode( OPCODE_DDE,           aTokenMap, "DDE", 0 );
+
+        OSL_ENSURE( bIsValid, "OpCodeProvider::OpCodeProvider - opcodes not initialized" );
+        (void)bIsValid;
+
+        // OPCODE_PLUS_SIGN and OPCODE_ADD should be equal, otherwise "+" has to be passed above
+        OSL_ENSURE( OPCODE_PLUS_SIGN == OPCODE_ADD, "OpCodeProvider::OpCodeProvider - need opcode mapping for OPCODE_PLUS_SIGN" );
+    }
+    catch( Exception& )
 {
-    return maOobFuncs.get( nFuncId ).get();
+        OSL_ENSURE( false, "OpCodeProvider::OpCodeProvider - cannot receive formula opcode mapper" );
+    }
 }
 
-const FunctionInfo* FunctionProviderImpl::getFuncInfoFromBiffFuncId( sal_uInt16 nFuncId ) const
+OpCodeProvider::~OpCodeProvider()
 {
-    return maBiffFuncs.get( nFuncId ).get();
 }
 
-const FunctionInfo* FunctionProviderImpl::getFuncInfoFromExternCallName( const OUString& rExtCallName ) const
+const FunctionInfo* OpCodeProvider::getFuncInfoFromApiToken( const ApiToken& rToken ) const
 {
-    return maMacroFuncs.get( rExtCallName ).get();
+    const FunctionInfo* pFuncInfo = 0;
+    if( (rToken.OpCode == OPCODE_EXTERNAL) && rToken.Data.hasValue() )
+    {
+        OUString aProgFuncName;
+        if( rToken.Data >>= aProgFuncName )
+            pFuncInfo = mxExtProgFuncs->get( aProgFuncName ).get();
+    }
+    else if( (rToken.OpCode == OPCODE_MACRO) && rToken.Data.hasValue() )
+    {
+        OUString aMacroName;
+        if( rToken.Data >>= aMacroName )
+            pFuncInfo = getFuncInfoFromMacroName( aMacroName );
+    }
+    else if( (rToken.OpCode == OPCODE_BAD) && rToken.Data.hasValue() )
+    {
+        OUString aOoxFuncName;
+        if( rToken.Data >>= aOoxFuncName )
+            pFuncInfo = getFuncInfoFromOoxFuncName( aOoxFuncName );
+    }
+    else
+    {
+        pFuncInfo = mxOpCodeFuncs->get( rToken.OpCode ).get();
+    }
+    return pFuncInfo;
 }
 
-Sequence< FormulaOpCodeMapEntry > FunctionProviderImpl::getOoxParserMap() const
+Sequence< FormulaOpCodeMapEntry > OpCodeProvider::getOoxParserMap() const
 {
-    return ContainerHelper::vectorToSequence( maParserMap );
+    return ContainerHelper::vectorToSequence( *mxParserMap );
 }
 
 // private --------------------------------------------------------------------
 
-bool FunctionProviderImpl::fillEntrySeq( OpCodeEntrySequence& orEntrySeq,
+bool OpCodeProvider::fillEntrySeq( OpCodeEntrySequence& orEntrySeq,
         const Reference< XFormulaOpCodeMapper >& rxMapper, sal_Int32 nMapGroup )
 {
     try
@@ -841,7 +1055,7 @@ bool FunctionProviderImpl::fillEntrySeq(
     return false;
 }
 
-bool FunctionProviderImpl::fillTokenMap( FormulaTokenMap& orTokenMap, OpCodeEntrySequence& orEntrySeq,
+bool OpCodeProvider::fillTokenMap( ApiTokenMap& orTokenMap, OpCodeEntrySequence& orEntrySeq,
         const Reference< XFormulaOpCodeMapper >& rxMapper, sal_Int32 nMapGroup )
 {
     orTokenMap.clear();
@@ -852,11 +1066,24 @@ bool FunctionProviderImpl::fillTokenMap(
         for( ; pEntry != pEntryEnd; ++pEntry )
             orTokenMap[ pEntry->Name ] = pEntry->Token;
     }
-    return !orTokenMap.empty();
+    return orEntrySeq.hasElements();
+}
+
+bool OpCodeProvider::fillFuncTokenMaps( ApiTokenMap& orIntFuncTokenMap, ApiTokenMap& orExtFuncTokenMap, OpCodeEntrySequence& orEntrySeq, const Reference< XFormulaOpCodeMapper >& rxMapper ) const
+{
+    orIntFuncTokenMap.clear();
+    orExtFuncTokenMap.clear();
+    if( fillEntrySeq( orEntrySeq, rxMapper, ::com::sun::star::sheet::FormulaMapGroup::FUNCTIONS ) )
+    {
+        const FormulaOpCodeMapEntry* pEntry = orEntrySeq.getConstArray();
+        const FormulaOpCodeMapEntry* pEntryEnd = pEntry + orEntrySeq.getLength();
+        for( ; pEntry != pEntryEnd; ++pEntry )
+            ((pEntry->Token.OpCode == OPCODE_EXTERNAL) ? orExtFuncTokenMap : orIntFuncTokenMap)[ pEntry->Name ] = pEntry->Token;
+    }
+    return orEntrySeq.hasElements();
 }
 
-bool FunctionProviderImpl::initOpCode( sal_Int32& ornOpCode,
-        const OpCodeEntrySequence& rEntrySeq, sal_Int32 nSpecialId )
+bool OpCodeProvider::initOpCode( sal_Int32& ornOpCode, const OpCodeEntrySequence& rEntrySeq, sal_Int32 nSpecialId )
 {
     if( (0 <= nSpecialId) && (nSpecialId < rEntrySeq.getLength()) )
     {
@@ -864,15 +1091,14 @@ bool FunctionProviderImpl::initOpCode( s
         return true;
     }
     OSL_ENSURE( false,
-        OStringBuffer( "FunctionProviderImpl::initOpCode - opcode for special offset " ).
+        OStringBuffer( "OpCodeProvider::initOpCode - opcode for special offset " ).
         append( nSpecialId ).append( " not found" ).getStr() );
     return false;
 }
 
-bool FunctionProviderImpl::initOpCode( OpCodeEntryVector& orParserMap, sal_Int32& ornOpCode,
-        const FormulaTokenMap& rTokenMap, const OUString& rOdfName, const OUString& rOoxName )
+bool OpCodeProvider::initOpCode( sal_Int32& ornOpCode, const ApiTokenMap& rTokenMap, const OUString& rOdfName, const OUString& rOoxName )
 {
-    FormulaTokenMap::const_iterator aIt = rTokenMap.find( rOdfName );
+    ApiTokenMap::const_iterator aIt = rTokenMap.find( rOdfName );
     if( aIt != rTokenMap.end() )
     {
         ornOpCode = aIt->second.OpCode;
@@ -881,347 +1107,106 @@ bool FunctionProviderImpl::initOpCode( O
             FormulaOpCodeMapEntry aEntry;
             aEntry.Name = rOoxName;
             aEntry.Token.OpCode = ornOpCode;
-            orParserMap.push_back( aEntry );
+            mxParserMap->push_back( aEntry );
         }
         return true;
     }
     OSL_ENSURE( false,
-        OStringBuffer( "FunctionProviderImpl::initOpCode - opcode for \"" ).
+        OStringBuffer( "OpCodeProvider::initOpCode - opcode for \"" ).
         append( OUStringToOString( rOdfName, RTL_TEXTENCODING_ASCII_US ) ).
         append( "\" not found" ).getStr() );
     return false;
 }
 
-bool FunctionProviderImpl::initOpCode( OpCodeEntryVector& orParserMap, sal_Int32& ornOpCode,
-        const FormulaTokenMap& rTokenMap, const sal_Char* pcOdfName, const sal_Char* pcOoxName )
+bool OpCodeProvider::initOpCode( sal_Int32& ornOpCode, const ApiTokenMap& rTokenMap, const sal_Char* pcOdfName, const sal_Char* pcOoxName )
 {
     OUString aOoxName;
     if( pcOoxName ) aOoxName = OUString::createFromAscii( pcOoxName );
-    return initOpCode( orParserMap, ornOpCode, rTokenMap, OUString::createFromAscii( pcOdfName ), aOoxName );
+    return initOpCode( ornOpCode, rTokenMap, OUString::createFromAscii( pcOdfName ), aOoxName );
 }
 
-bool FunctionProviderImpl::initOpCode( OpCodeEntryVector& orParserMap, sal_Int32& ornOpCode,
-        const FormulaTokenMap& rTokenMap, sal_Unicode cOdfName, sal_Unicode cOoxName )
+bool OpCodeProvider::initOpCode( sal_Int32& ornOpCode, const ApiTokenMap& rTokenMap, sal_Unicode cOdfName, sal_Unicode cOoxName )
 {
     OUString aOoxName;
     if( cOoxName ) aOoxName = OUString( cOoxName );
-    return initOpCode( orParserMap, ornOpCode, rTokenMap, OUString( cOdfName ), aOoxName );
-}
-
-void FunctionProviderImpl::construct(
-        const Reference< XSpreadsheetDocument >& rxDocument, bool bImportFilter )
-{
-    construct( rxDocument, BIFF8, bImportFilter );
-    // additional functions for OOX
-    initFuncMaps( saFuncTableOox, STATIC_ARRAY_END( saFuncTableOox ) );
-}
-
-void FunctionProviderImpl::construct(
-        const Reference< XSpreadsheetDocument >& rxDocument, BiffType eBiff, bool bImportFilter )
-{
-    mbImportFilter = bImportFilter;
-    OSL_ENSURE( mbImportFilter, "FunctionProviderImpl::construct - need special handling for macro call functions" );
-
-    // operator op-codes, special op-codes, function op-codes
-    initOpCodes( rxDocument );
-
-    /*  Add functions supported in the current BIFF version only.
-        Function tables from later BIFF versions may overwrite single
-        functions from earlier tables. */
-    if( eBiff >= BIFF2 )
-        initFuncMaps( saFuncTableBiff2, STATIC_ARRAY_END( saFuncTableBiff2 ) );
-    if( eBiff >= BIFF3 )
-        initFuncMaps( saFuncTableBiff3, STATIC_ARRAY_END( saFuncTableBiff3 ) );
-    if( eBiff >= BIFF4 )
-        initFuncMaps( saFuncTableBiff4, STATIC_ARRAY_END( saFuncTableBiff4 ) );
-    if( eBiff >= BIFF5 )
-        initFuncMaps( saFuncTableBiff5, STATIC_ARRAY_END( saFuncTableBiff5 ) );
-    if( eBiff >= BIFF8 )
-        initFuncMaps( saFuncTableBiff8, STATIC_ARRAY_END( saFuncTableBiff8 ) );
-}
-
-bool FunctionProviderImpl::initFuncNames( const OpCodeEntrySequence& rEntrySeq )
-{
-    const FormulaOpCodeMapEntry* pEntry = rEntrySeq.getConstArray();
-    const FormulaOpCodeMapEntry* pEntryEnd = pEntry + rEntrySeq.getLength();
-    for( ; pEntry != pEntryEnd; ++pEntry )
-    {
-        if( pEntry->Token.OpCode == mrOpCodes.OPCODE_EXTERNAL )
-            maExtFuncTokens[ pEntry->Name ] = pEntry->Token;
-        else
-            maIntFuncTokens[ pEntry->Name ] = pEntry->Token;
-    }
-    return true;
+    return initOpCode( ornOpCode, rTokenMap, OUString( cOdfName ), aOoxName );
 }
 
-void FunctionProviderImpl::initOpCodes( const Reference< XSpreadsheetDocument >& rxDocument )
+bool OpCodeProvider::initFuncOpCode( FunctionInfo& orFuncInfo, const ApiTokenMap& rFuncTokenMap )
 {
     bool bIsValid = false;
-    try
+    if( orFuncInfo.maOdfFuncName.getLength() > 0 )
     {
-        Reference< XMultiServiceFactory > xFactory( rxDocument, UNO_QUERY_THROW );
-        Reference< XFormulaOpCodeMapper > xMapper( xFactory->createInstance(
-            CREATE_OUSTRING( "com.sun.star.sheet.FormulaOpCodeMapper" ) ), UNO_QUERY_THROW );
-
-        // op-codes provided as attributes
-        mrOpCodes.OPCODE_EXTERNAL = xMapper->getOpCodeExternal();
-        mrOpCodes.OPCODE_UNKNOWN = xMapper->getOpCodeUnknown();
-
-        using namespace ::com::sun::star::sheet::FormulaMapGroup;
-        using namespace ::com::sun::star::sheet::FormulaMapGroupSpecialOffset;
-
-        OpCodeEntrySequence aEntrySeq;
-        FormulaTokenMap aTokenMap;
-        bIsValid =
-            // special
-            fillEntrySeq( aEntrySeq, xMapper, SPECIAL ) &&
-            initOpCode( mrOpCodes.OPCODE_PUSH,    aEntrySeq, PUSH ) &&
-            initOpCode( mrOpCodes.OPCODE_MISSING, aEntrySeq, MISSING ) &&
-            initOpCode( mrOpCodes.OPCODE_SPACES,  aEntrySeq, SPACES ) &&
-            initOpCode( mrOpCodes.OPCODE_NAME,    aEntrySeq, NAME ) &&
-            initOpCode( mrOpCodes.OPCODE_DBAREA,  aEntrySeq, DB_AREA ) &&
-            initOpCode( mrOpCodes.OPCODE_NLR,     aEntrySeq, COL_ROW_NAME ) &&
-            initOpCode( mrOpCodes.OPCODE_MACRO,   aEntrySeq, MACRO ) &&
-            initOpCode( mrOpCodes.OPCODE_BAD,     aEntrySeq, BAD ) &&
-            initOpCode( mrOpCodes.OPCODE_NONAME,  aEntrySeq, NO_NAME ) &&
-            // separators
-            fillTokenMap( aTokenMap, aEntrySeq, xMapper, SEPARATORS ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_OPEN,  aTokenMap, API_TOKEN_OPEN,  '('  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_CLOSE, aTokenMap, API_TOKEN_CLOSE, ')'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_SEP,   aTokenMap, API_TOKEN_SEP,   ','  ) &&
-            // array separators
-            fillTokenMap( aTokenMap, aEntrySeq, xMapper, ARRAY_SEPARATORS ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_ARRAY_OPEN,    aTokenMap, API_TOKEN_ARRAY_OPEN,   '{'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_ARRAY_CLOSE,   aTokenMap, API_TOKEN_ARRAY_CLOSE,  '}'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_ARRAY_ROWSEP,  aTokenMap, API_TOKEN_ARRAY_ROWSEP, ';'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_ARRAY_COLSEP,  aTokenMap, API_TOKEN_ARRAY_COLSEP, ','  ) &&
-            // unary operators
-            fillTokenMap( aTokenMap, aEntrySeq, xMapper, UNARY_OPERATORS ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_PLUS_SIGN,     aTokenMap, '+',  '\0' ) && // same op-code as OPCODE_ADD
-            initOpCode( maParserMap, mrOpCodes.OPCODE_MINUS_SIGN,    aTokenMap, '-',  '-'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_PERCENT,       aTokenMap, '%',  '%'  ) &&
-            // binary operators
-            fillTokenMap( aTokenMap, aEntrySeq, xMapper, BINARY_OPERATORS ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_ADD,           aTokenMap, '+',  '+'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_SUB,           aTokenMap, '-',  '-'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_MULT,          aTokenMap, '*',  '*'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_DIV,           aTokenMap, '/',  '/'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_POWER,         aTokenMap, '^',  '^'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_CONCAT,        aTokenMap, '&',  '&'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_EQUAL,         aTokenMap, '=',  '='  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_NOT_EQUAL,     aTokenMap, "<>", "<>" ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_LESS,          aTokenMap, '<',  '<'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_LESS_EQUAL,    aTokenMap, "<=", "<=" ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_GREATER,       aTokenMap, '>',  '>'  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_GREATER_EQUAL, aTokenMap, ">=", ">=" ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_INTERSECT,     aTokenMap, '!',  ' '  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_LIST,          aTokenMap, '~',  ','  ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_RANGE,         aTokenMap, ':',  ':'  ) &&
-            // functions
-            fillTokenMap( aTokenMap, aEntrySeq, xMapper, FUNCTIONS ) &&
-            initFuncNames( aEntrySeq ) &&
-            initOpCode( maParserMap, mrOpCodes.OPCODE_DDE, aTokenMap, "DDE", 0 );
-
-        // OPCODE_PLUS_SIGN and OPCODE_ADD should be equal, otherwise "+" has to be passed above
-        OSL_ENSURE( mrOpCodes.OPCODE_PLUS_SIGN == mrOpCodes.OPCODE_ADD,
-            "FunctionProviderImpl::initOpCodes - need opcode mapping for OPCODE_PLUS_SIGN" );
-        // OPCODE_LIST not supported in Calc core
-        mrOpCodes.OPCODE_LIST = mrOpCodes.OPCODE_SEP;
-    }
-    catch( Exception& )
-    {
-    }
-    OSL_ENSURE( bIsValid, "FunctionProviderImpl::initOpCodes - opcodes not initialized" );
-}
-
-void FunctionProviderImpl::initFuncOpCode( FunctionInfo& orFuncInfo, const FormulaTokenMap& rFuncTokens )
-{
-    bool bRet = false;
-    if( orFuncInfo.mnOobFuncId == OOBIN_FUNC_EXTERNCALL )
-    {
-        orFuncInfo.mnApiOpCode = mrOpCodes.OPCODE_EXTERNAL;
-        bRet = true;
-    }
-    else if( orFuncInfo.maOdfFuncName.getLength() > 0 )
-    {
-        FormulaTokenMap::const_iterator aIt = rFuncTokens.find( orFuncInfo.maOdfFuncName );
-        if( aIt != rFuncTokens.end() )
+        ApiTokenMap::const_iterator aIt = rFuncTokenMap.find( orFuncInfo.maOdfFuncName );
+        if( aIt != rFuncTokenMap.end() )
         {
             orFuncInfo.mnApiOpCode = aIt->second.OpCode;
-            OSL_ENSURE( orFuncInfo.mnApiOpCode != mrOpCodes.OPCODE_NONAME,
-                OStringBuffer( "FunctionProviderImpl::initFuncOpCode - no valid op-code for \"" ).
+            bIsValid =
+                (orFuncInfo.mnApiOpCode >= 0) &&
+                (orFuncInfo.mnApiOpCode != OPCODE_UNKNOWN) &&
+                (orFuncInfo.mnApiOpCode != OPCODE_NONAME) &&
+                (orFuncInfo.maOoxFuncName.getLength() > 0);
+            OSL_ENSURE( bIsValid,
+                OStringBuffer( "OpCodeProvider::initFuncOpCode - no valid opcode or missing OOX function name for ODF function \"" ).
                 append( OUStringToOString( orFuncInfo.maOdfFuncName, RTL_TEXTENCODING_ASCII_US ) ).
                 append( '"' ).getStr() );
-            OSL_ENSURE( orFuncInfo.maOoxFuncName.getLength() > 0,
-                OStringBuffer( "FunctionProviderImpl::initFuncOpCode - no valid OOX function name for \"" ).
+
+            if( bIsValid && (orFuncInfo.mnApiOpCode == OPCODE_EXTERNAL) )
+            {
+                bIsValid = (aIt->second.Data >>= orFuncInfo.maExtProgName) && (orFuncInfo.maExtProgName.getLength() > 0);
+                OSL_ENSURE( bIsValid,
+                    OStringBuffer( "OpCodeProvider::initFuncOpCode - no programmatical name for external function \"" ).
                 append( OUStringToOString( orFuncInfo.maOdfFuncName, RTL_TEXTENCODING_ASCII_US ) ).
                 append( '"' ).getStr() );
-            bRet = (orFuncInfo.mnApiOpCode != mrOpCodes.OPCODE_EXTERNAL) ||
-                ((aIt->second.Data >>= orFuncInfo.maExtProgName) && (orFuncInfo.maExtProgName.getLength() > 0));
-            if( bRet )
+            }
+
+            if( bIsValid )
             {
                 // create the parser map entry
                 FormulaOpCodeMapEntry aEntry;
                 aEntry.Name = orFuncInfo.maOoxFuncName;
                 aEntry.Token = aIt->second;
-                maParserMap.push_back( aEntry );
+                mxParserMap->push_back( aEntry );
             }
         }
-        OSL_ENSURE( bRet,
-            OStringBuffer( "FunctionProviderImpl::initFuncOpCode - opcode or external name for \"" ).
-            append( OUStringToOString( orFuncInfo.maOdfFuncName, RTL_TEXTENCODING_ASCII_US ) ).
-            append( "\" not found" ).getStr() );
     }
-    if( !bRet || (orFuncInfo.mnApiOpCode == mrOpCodes.OPCODE_UNKNOWN) )
-        orFuncInfo.mnApiOpCode = mrOpCodes.OPCODE_NONAME;
-}
-
-void FunctionProviderImpl::initFuncMaps( const FunctionData* pBeg, const FunctionData* pEnd )
-{
-    for( const FunctionData* pIt = pBeg; pIt != pEnd; ++pIt )
-    {
-        if( pIt->isSupported( mbImportFilter ) )
-        {
-            // create a function info object
-            FunctionInfoRef xFuncInfo( new FunctionInfo );
-            if( pIt->mpcOdfFuncName )
-                xFuncInfo->maOdfFuncName = OUString::createFromAscii( pIt->mpcOdfFuncName );
-            if( pIt->mpcOoxFuncName )
-                xFuncInfo->maOoxFuncName = OUString::createFromAscii( pIt->mpcOoxFuncName );
-            if( getFlag( pIt->mnFlags, FUNCFLAG_MACROCALL ) )
-                xFuncInfo->maExternCallName = CREATE_OUSTRING( "_xlfn." ) + xFuncInfo->maOoxFuncName;
-            else if( getFlag( pIt->mnFlags, FUNCFLAG_EXTERNAL ) )
-                xFuncInfo->maExternCallName = xFuncInfo->maOoxFuncName;
-            xFuncInfo->mnOobFuncId = pIt->mnOobFuncId;
-            xFuncInfo->mnBiffFuncId = pIt->mnBiffFuncId;
-            xFuncInfo->mnMinParamCount = pIt->mnMinParamCount;
-            xFuncInfo->mnMaxParamCount = (pIt->mnMaxParamCount == MX) ? mnMaxParam : pIt->mnMaxParamCount;
-            xFuncInfo->mnRetClass = pIt->mnRetClass;
-            xFuncInfo->mpnParamClass = pIt->mpnParamClass;
-            xFuncInfo->mbVolatile = getFlag( pIt->mnFlags, FUNCFLAG_VOLATILE );
-
-            // get API opcode from BIFF function index or function name
-            initFuncOpCode( *xFuncInfo, getFlag( pIt->mnFlags, FUNCFLAG_EXTERNAL ) ? maExtFuncTokens : maIntFuncTokens );
-
-            // insert the function info into the maps
-            if( xFuncInfo->mnApiOpCode != mrOpCodes.OPCODE_NONAME )
+    else if( orFuncInfo.mnBiffFuncId == BIFF_FUNC_EXTERNCALL )
             {
-                if( (xFuncInfo->mnApiOpCode == mrOpCodes.OPCODE_EXTERNAL) && (xFuncInfo->maExtProgName.getLength() > 0) )
-                    maExtProgFuncs[ xFuncInfo->maExtProgName ] = xFuncInfo;
-                else
-                    maOpCodeFuncs[ xFuncInfo->mnApiOpCode ] = xFuncInfo;
+        orFuncInfo.mnApiOpCode = OPCODE_EXTERNAL;
+        bIsValid = true;
             }
-            if( xFuncInfo->maOoxFuncName.getLength() > 0 )
-                maOoxFuncs[ xFuncInfo->maOoxFuncName ] = xFuncInfo;
-            if( xFuncInfo->mnOobFuncId != NOID )
-                maOobFuncs[ xFuncInfo->mnOobFuncId ] = xFuncInfo;
-            if( xFuncInfo->mnBiffFuncId != NOID )
-                maBiffFuncs[ xFuncInfo->mnBiffFuncId ] = xFuncInfo;
-            if( xFuncInfo->maExternCallName.getLength() > 0 )
-                maMacroFuncs[ xFuncInfo->maExternCallName ] = xFuncInfo;
-        }
-    }
-}
-
-// function provider ==========================================================
-
-FunctionProvider::FunctionProvider( const WorkbookHelper& rHelper )
-{
-    bool bImportFilter = rHelper.getBaseFilter().isImportFilter();
-    switch( rHelper.getFilterType() )
-    {
-        case FILTER_OOX:
-            mxImpl.reset( new FunctionProviderImpl( *this, rHelper.getDocument(), bImportFilter ) );
-        break;
-        case FILTER_BIFF:
-            mxImpl.reset( new FunctionProviderImpl( *this, rHelper.getDocument(), rHelper.getBiff(), bImportFilter ) );
-        break;
-        case FILTER_UNKNOWN: break;
-    }
-}
-
-FunctionProvider::FunctionProvider( const Reference< XSpreadsheetDocument >& rxDocument, bool bImportFilter )
-{
-    mxImpl.reset( new FunctionProviderImpl( *this, rxDocument, bImportFilter ) );
-}
-
-FunctionProvider::FunctionProvider( const Reference< XSpreadsheetDocument >& rxDocument, BiffType eBiff, bool bImportFilter )
-{
-    mxImpl.reset( new FunctionProviderImpl( *this, rxDocument, eBiff, bImportFilter ) );
-}
-
-FunctionProvider::~FunctionProvider()
-{
-}
-
-const FunctionInfo* FunctionProvider::getFuncInfoFromApiToken( const ApiToken& rToken ) const
-{
-    return mxImpl->getFuncInfoFromApiToken( rToken );
-}
-
-const FunctionInfo* FunctionProvider::getFuncInfoFromOoxFuncName( const OUString& rFuncName ) const
-{
-    return mxImpl->getFuncInfoFromOoxFuncName( rFuncName );
-}
-
-const FunctionInfo* FunctionProvider::getFuncInfoFromOobFuncId( sal_uInt16 nFuncId ) const
-{
-    return mxImpl->getFuncInfoFromOobFuncId( nFuncId );
-}
-
-const FunctionInfo* FunctionProvider::getFuncInfoFromBiffFuncId( sal_uInt16 nFuncId ) const
+    else if( orFuncInfo.maOoxFuncName.getLength() > 0 )
 {
-    return mxImpl->getFuncInfoFromBiffFuncId( nFuncId );
+        orFuncInfo.mnApiOpCode = OPCODE_BAD;
+        bIsValid = true;
 }
 
-const FunctionInfo* FunctionProvider::getFuncInfoFromExternCallName( const OUString& rExtCallName ) const
-{
-    return mxImpl->getFuncInfoFromExternCallName( rExtCallName );
+    if( !bIsValid || (orFuncInfo.mnApiOpCode == OPCODE_UNKNOWN) || (orFuncInfo.mnApiOpCode < 0) )
+        orFuncInfo.mnApiOpCode = OPCODE_NONAME;
+    return bIsValid;
 }
 
-Sequence< FormulaOpCodeMapEntry > FunctionProvider::getOoxParserMap() const
+bool OpCodeProvider::initFuncOpCodes( const ApiTokenMap& rIntFuncTokenMap, const ApiTokenMap& rExtFuncTokenMap )
 {
-    return mxImpl->getOoxParserMap();
-}
-
-// token sequence iterator ====================================================
-
-ApiTokenIterator::ApiTokenIterator( const ApiTokenSequence& rTokens, sal_Int32 nSpacesOpCode, bool bSkipSpaces ) :
-    mpToken( rTokens.getConstArray() ),
-    mpTokenEnd( rTokens.getConstArray() + rTokens.getLength() ),
-    mnSpacesOpCode( nSpacesOpCode ),
-    mbSkipSpaces( bSkipSpaces )
-{
-    skipSpaces();
-}
-
-ApiTokenIterator::ApiTokenIterator( const ApiTokenIterator& rIter, bool bSkipSpaces ) :
-    mpToken( rIter.mpToken ),
-    mpTokenEnd( rIter.mpTokenEnd ),
-    mnSpacesOpCode( rIter.mnSpacesOpCode ),
-    mbSkipSpaces( bSkipSpaces )
+    bool bIsValid = true;
+    for( FuncVector::const_iterator aIt = getFuncs().begin(), aEnd = getFuncs().end(); aIt != aEnd; ++aIt )
 {
-    skipSpaces();
-}
-
-ApiTokenIterator& ApiTokenIterator::operator++()
-{
-    if( is() )
+        FunctionInfoRef xFuncInfo = *aIt;
+        // set API opcode from ODF function name
+        bIsValid &= initFuncOpCode( *xFuncInfo, xFuncInfo->mbExternal ? rExtFuncTokenMap : rIntFuncTokenMap );
+        // insert the function info into the maps
+        if( xFuncInfo->mnApiOpCode != OPCODE_NONAME )
     {
-        ++mpToken;
-        skipSpaces();
+            if( (xFuncInfo->mnApiOpCode == OPCODE_EXTERNAL) && (xFuncInfo->maExtProgName.getLength() > 0) )
+                (*mxExtProgFuncs)[ xFuncInfo->maExtProgName ] = xFuncInfo;
+            else
+                (*mxOpCodeFuncs)[ xFuncInfo->mnApiOpCode ] = xFuncInfo;
     }
-    return *this;
 }
-
-void ApiTokenIterator::skipSpaces()
-{
-    if( mbSkipSpaces )
-        while( is() && (mpToken->OpCode == mnSpacesOpCode) )
-            ++mpToken;
+    return bIsValid;
 }
 
-// formual contexts ===========================================================
+// formula contexts ===========================================================
 
 FormulaContext::FormulaContext( bool bRelativeAsOffset, bool b2dRefsAs3dRefs ) :
     maBaseAddress( 0, 0, 0 ),
@@ -1332,8 +1317,7 @@ TokenToRangeListState lclProcessClose( s
 // ----------------------------------------------------------------------------
 
 FormulaProcessorBase::FormulaProcessorBase( const WorkbookHelper& rHelper ) :
-    WorkbookHelper( rHelper ),
-    maFuncProv( rHelper ),
+    OpCodeProvider( rHelper ),
     maAbsNameProp( CREATE_OUSTRING( "AbsoluteName" ) )
 {
 }
@@ -1478,8 +1462,8 @@ OUString FormulaProcessorBase::generateA
 
 Any FormulaProcessorBase::extractReference( const ApiTokenSequence& rTokens ) const
 {
-    ApiTokenIterator aTokenIt( rTokens, maFuncProv.OPCODE_SPACES, true );
-    if( aTokenIt.is() && (aTokenIt->OpCode == maFuncProv.OPCODE_PUSH) )
+    ApiTokenIterator aTokenIt( rTokens, OPCODE_SPACES, true );
+    if( aTokenIt.is() && (aTokenIt->OpCode == OPCODE_PUSH) )
     {
         Any aRefAny = aTokenIt->Data;
         if( !(++aTokenIt).is() && (aRefAny.has< SingleReference >() || aRefAny.has< ComplexReference >()) )
@@ -1494,33 +1478,33 @@ void FormulaProcessorBase::extractCellRa
     orRanges.clear();
     TokenToRangeListState eState = STATE_OPEN;
     sal_Int32 nParenLevel = 0;
-    for( ApiTokenIterator aIt( rTokens, maFuncProv.OPCODE_SPACES, true ); aIt.is() && (eState != STATE_ERROR); ++aIt )
+    for( ApiTokenIterator aIt( rTokens, OPCODE_SPACES, true ); aIt.is() && (eState != STATE_ERROR); ++aIt )
     {
         sal_Int32 nOpCode = aIt->OpCode;
         switch( eState )
         {
             case STATE_REF:
-                     if( nOpCode == maFuncProv.OPCODE_LIST )    eState = STATE_SEP;
-                else if( nOpCode == maFuncProv.OPCODE_CLOSE )   eState = lclProcessClose( nParenLevel );
+                     if( nOpCode == OPCODE_LIST )  eState = STATE_SEP;
+                else if( nOpCode == OPCODE_CLOSE ) eState = lclProcessClose( nParenLevel );
                 else                                            eState = STATE_ERROR;
             break;
             case STATE_SEP:
-                     if( nOpCode == maFuncProv.OPCODE_PUSH )    eState = lclProcessRef( orRanges, aIt->Data, nFilterBySheet );
-                else if( nOpCode == maFuncProv.OPCODE_LIST )    eState = STATE_SEP;
-                else if( nOpCode == maFuncProv.OPCODE_OPEN )    eState = lclProcessOpen( nParenLevel );
-                else if( nOpCode == maFuncProv.OPCODE_CLOSE )   eState = lclProcessClose( nParenLevel );
+                     if( nOpCode == OPCODE_PUSH )  eState = lclProcessRef( orRanges, aIt->Data, nFilterBySheet );
+                else if( nOpCode == OPCODE_LIST )  eState = STATE_SEP;
+                else if( nOpCode == OPCODE_OPEN )  eState = lclProcessOpen( nParenLevel );
+                else if( nOpCode == OPCODE_CLOSE ) eState = lclProcessClose( nParenLevel );
                 else                                            eState = STATE_ERROR;
             break;
             case STATE_OPEN:
-                     if( nOpCode == maFuncProv.OPCODE_PUSH )    eState = lclProcessRef( orRanges, aIt->Data, nFilterBySheet );
-                else if( nOpCode == maFuncProv.OPCODE_LIST )    eState = STATE_SEP;
-                else if( nOpCode == maFuncProv.OPCODE_OPEN )    eState = lclProcessOpen( nParenLevel );
-                else if( nOpCode == maFuncProv.OPCODE_CLOSE )   eState = lclProcessClose( nParenLevel );
+                     if( nOpCode == OPCODE_PUSH )  eState = lclProcessRef( orRanges, aIt->Data, nFilterBySheet );
+                else if( nOpCode == OPCODE_LIST )  eState = STATE_SEP;
+                else if( nOpCode == OPCODE_OPEN )  eState = lclProcessOpen( nParenLevel );
+                else if( nOpCode == OPCODE_CLOSE ) eState = lclProcessClose( nParenLevel );
                 else                                            eState = STATE_ERROR;
             break;
             case STATE_CLOSE:
-                     if( nOpCode == maFuncProv.OPCODE_LIST )    eState = STATE_SEP;
-                else if( nOpCode == maFuncProv.OPCODE_CLOSE )   eState = lclProcessClose( nParenLevel );
+                     if( nOpCode == OPCODE_LIST )  eState = STATE_SEP;
+                else if( nOpCode == OPCODE_CLOSE ) eState = lclProcessClose( nParenLevel );
                 else                                            eState = STATE_ERROR;
             break;
             default:;
@@ -1535,8 +1519,8 @@ void FormulaProcessorBase::extractCellRa
 
 bool FormulaProcessorBase::extractString( OUString& orString, const ApiTokenSequence& rTokens ) const
 {
-    ApiTokenIterator aTokenIt( rTokens, maFuncProv.OPCODE_SPACES, true );
-    return aTokenIt.is() && (aTokenIt->OpCode == maFuncProv.OPCODE_PUSH) && (aTokenIt->Data >>= orString) && !(++aTokenIt).is();
+    ApiTokenIterator aTokenIt( rTokens, OPCODE_SPACES, true );
+    return aTokenIt.is() && (aTokenIt->OpCode == OPCODE_PUSH) && (aTokenIt->Data >>= orString) && !(++aTokenIt).is();
 }
 
 void FormulaProcessorBase::convertStringToStringList(
@@ -1558,8 +1542,8 @@ void FormulaProcessorBase::convertString
                 aEntry = aEntry.copy( nStart );
             }
             if( !aNewTokens.empty() )
-                aNewTokens.push_back( ApiToken( maFuncProv.OPCODE_SEP, Any() ) );
-            aNewTokens.push_back( ApiToken( maFuncProv.OPCODE_PUSH, Any( aEntry ) ) );
+                aNewTokens.push_back( ApiToken( OPCODE_SEP, Any() ) );
+            aNewTokens.push_back( ApiToken( OPCODE_PUSH, Any( aEntry ) ) );
         }
         orTokens = ContainerHelper::vectorToSequence( aNewTokens );
     }
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/formulaparser.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/formulaparser.cxx
--- oox/source/xls/formulaparser.cxx	2008-04-18 16:40:26.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/formulaparser.cxx	2009-03-20 13:21:12.000000000 +0100
@@ -30,12 +30,13 @@
 
 #include "oox/xls/formulaparser.hxx"
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sheet/AddressConvention.hpp>
+#include <com/sun/star/sheet/ComplexReference.hpp>
+#include <com/sun/star/sheet/ExternalReference.hpp>
 #include <com/sun/star/sheet/FormulaToken.hpp>
 #include <com/sun/star/sheet/ReferenceFlags.hpp>
 #include <com/sun/star/sheet/SingleReference.hpp>
-#include <com/sun/star/sheet/ComplexReference.hpp>
 #include <com/sun/star/sheet/XFormulaParser.hpp>
-#include <com/sun/star/sheet/AddressConvention.hpp>
 #include "oox/helper/containerhelper.hxx"
 #include "oox/helper/propertyset.hxx"
 #include "oox/helper/recordinputstream.hxx"
@@ -56,8 +57,9 @@ using ::com::sun::star::uno::UNO_QUERY_T
 using ::com::sun::star::lang::XMultiServiceFactory;
 using ::com::sun::star::table::CellAddress;
 using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::sheet::SingleReference;
 using ::com::sun::star::sheet::ComplexReference;
+using ::com::sun::star::sheet::ExternalReference;
+using ::com::sun::star::sheet::SingleReference;
 using ::com::sun::star::sheet::XFormulaParser;
 using namespace ::com::sun::star::sheet::ReferenceFlags;
 
@@ -66,12 +68,12 @@ namespace xls {
 
 // parser implementation base =================================================
 
-class FormulaParserImpl : public WorkbookHelper
+class FormulaParserImpl : public OpCodeProvider
 {
 public:
-    explicit            FormulaParserImpl(
-                            const WorkbookHelper& rHelper,
-                            const FunctionProvider& rFuncProv );
+    explicit            FormulaParserImpl( const OpCodeProvider& rOpCodeProv );
+
+    virtual ::rtl::OUString printFormulaTokens( const ApiTokenSequence& rTokens );
 
     /** Converts an XML formula string. */
     virtual void        importOoxFormula(
@@ -95,6 +97,9 @@ public:
                             const ApiTokenSequence& rTokens );
 
 protected:
+    typedef ::std::pair< sal_Int32, bool >  WhiteSpace;
+    typedef ::std::vector< WhiteSpace >     WhiteSpaceVec;
+
     /** Sets the current formula context used for import. */
     inline FormulaContext& getFormulaContext() const { return *mpContext; }
 
@@ -111,15 +116,16 @@ protected:
     // token array ------------------------------------------------------------
 
     bool                resetSpaces();
-    inline void         incLeadingSpaces( sal_Int32 nSpaces ) { mnLeadingSpaces += nSpaces; }
-    inline void         incOpeningSpaces( sal_Int32 nSpaces ) { mnOpeningSpaces += nSpaces; }
-    inline void         incClosingSpaces( sal_Int32 nSpaces ) { mnClosingSpaces += nSpaces; }
+    static void         appendSpaces( WhiteSpaceVec& orSpaces, sal_Int32 nCount, bool bLineFeed );
+    void                appendLeadingSpaces( sal_Int32 nCount, bool bLineFeed );
+    void                appendOpeningSpaces( sal_Int32 nCount, bool bLineFeed );
+    void                appendClosingSpaces( sal_Int32 nCount, bool bLineFeed );
 
     size_t              getFormulaSize() const;
     Any&                appendRawToken( sal_Int32 nOpCode );
     Any&                insertRawToken( sal_Int32 nOpCode, size_t nIndexFromEnd );
-    size_t              appendSpacesToken( sal_Int32 nSpaces );
-    size_t              insertSpacesToken( sal_Int32 nSpaces, size_t nIndexFromEnd );
+    size_t              appendWhiteSpaceTokens( const WhiteSpaceVec* pSpaces );
+    size_t              insertWhiteSpaceTokens( const WhiteSpaceVec* pSpaces, size_t nIndexFromEnd );
 
     size_t              getOperandSize( size_t nOpCountFromEnd, size_t nOpIndex ) const;
     void                pushOperandSize( size_t nSize );
@@ -129,20 +135,20 @@ protected:
     void                removeOperand( size_t nOpCountFromEnd, size_t nOpIndex );
     void                removeLastOperands( size_t nOpCountFromEnd );
 
-    bool                pushOperandToken( sal_Int32 nOpCode, sal_Int32 nSpaces );
-    bool                pushAnyOperandToken( const Any& rAny, sal_Int32 nOpCode, sal_Int32 nSpaces );
+    bool                pushOperandToken( sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces = 0 );
+    bool                pushAnyOperandToken( const Any& rAny, sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces = 0 );
     template< typename Type >
-    bool                pushValueOperandToken( const Type& rValue, sal_Int32 nOpCode, sal_Int32 nSpaces );
+    bool                pushValueOperandToken( const Type& rValue, sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces = 0 );
     template< typename Type >
-    inline bool         pushValueOperandToken( const Type& rValue, sal_Int32 nSpaces )
-                            { return pushValueOperandToken( rValue, mrFuncProv.OPCODE_PUSH, nSpaces ); }
-    bool                pushParenthesesOperandToken( sal_Int32 nOpeningSpaces, sal_Int32 nClosingSpaces );
-    bool                pushUnaryPreOperatorToken( sal_Int32 nOpCode, sal_Int32 nSpaces );
-    bool                pushUnaryPostOperatorToken( sal_Int32 nOpCode, sal_Int32 nSpaces );
-    bool                pushBinaryOperatorToken( sal_Int32 nOpCode, sal_Int32 nSpaces );
-    bool                pushParenthesesOperatorToken( sal_Int32 nOpeningSpaces, sal_Int32 nClosingSpaces );
-    bool                pushFunctionOperatorToken( sal_Int32 nOpCode, size_t nParamCount, sal_Int32 nLeadingSpaces, sal_Int32 nClosingSpaces );
-    bool                pushFunctionOperatorToken( const FunctionInfo& rFuncInfo, size_t nParamCount, sal_Int32 nLeadingSpaces, sal_Int32 nClosingSpaces );
+    inline bool         pushValueOperandToken( const Type& rValue, const WhiteSpaceVec* pSpaces = 0 )
+                            { return pushValueOperandToken( rValue, OPCODE_PUSH, pSpaces ); }
+    bool                pushParenthesesOperandToken( const WhiteSpaceVec* pOpeningSpaces = 0, const WhiteSpaceVec* pClosingSpaces = 0 );
+    bool                pushUnaryPreOperatorToken( sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces = 0 );
+    bool                pushUnaryPostOperatorToken( sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces = 0 );
+    bool                pushBinaryOperatorToken( sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces = 0 );
+    bool                pushParenthesesOperatorToken( const WhiteSpaceVec* pOpeningSpaces = 0, const WhiteSpaceVec* pClosingSpaces = 0 );
+    bool                pushFunctionOperatorToken( sal_Int32 nOpCode, size_t nParamCount, const WhiteSpaceVec* pLeadingSpaces = 0, const WhiteSpaceVec* pClosingSpaces = 0 );
+    bool                pushFunctionOperatorToken( const FunctionInfo& rFuncInfo, size_t nParamCount, const WhiteSpaceVec* pLeadingSpaces = 0, const WhiteSpaceVec* pClosingSpaces = 0 );
 
     bool                pushOperand( sal_Int32 nOpCode );
     bool                pushAnyOperand( const Any& rAny, sal_Int32 nOpCode );
@@ -150,20 +156,24 @@ protected:
     bool                pushValueOperand( const Type& rValue, sal_Int32 nOpCode );
     template< typename Type >
     inline bool         pushValueOperand( const Type& rValue )
-                            { return pushValueOperand( rValue, mrFuncProv.OPCODE_PUSH ); }
+                            { return pushValueOperand( rValue, OPCODE_PUSH ); }
     bool                pushBoolOperand( bool bValue );
     bool                pushErrorOperand( double fEncodedError );
+    bool                pushBiffBoolOperand( sal_uInt8 nValue );
     bool                pushBiffErrorOperand( sal_uInt8 nErrorCode );
     bool                pushParenthesesOperand();
     bool                pushReferenceOperand( const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset );
     bool                pushReferenceOperand( const BinComplexRef2d& rRef, bool bDeleted, bool bRelativeAsOffset );
+    template< typename Type >
+    bool                pushReferenceOperand( const LinkSheetRange& rSheetRange, const Type& rApiRef );
     bool                pushReferenceOperand( const LinkSheetRange& rSheetRange, const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset );
     bool                pushReferenceOperand( const LinkSheetRange& rSheetRange, const BinComplexRef2d& rRef, bool bDeleted, bool bRelativeAsOffset );
     bool                pushNlrOperand( const BinSingleRef2d& rRef );
-    bool                pushEmbeddedRefOperand( const DefinedNameBase& rName );
+    bool                pushEmbeddedRefOperand( const DefinedNameBase& rName, bool bPushBadToken );
     bool                pushDefinedNameOperand( const DefinedNameRef& rxDefName );
+    bool                pushExternalFuncOperand( const FunctionInfo& rFuncInfo );
     bool                pushDdeLinkOperand( const OUString& rDdeServer, const OUString& rDdeTopic, const OUString& rDdeItem );
-    bool                pushExternalNameOperand( const ExternalNameRef& rxExtName, ExternalLinkType eLinkType );
+    bool                pushExternalNameOperand( const ExternalNameRef& rxExtName, const ExternalLink& rExtLink );
 
     bool                pushUnaryPreOperator( sal_Int32 nOpCode );
     bool                pushUnaryPostOperator( sal_Int32 nOpCode );
@@ -176,13 +186,13 @@ private:
     // reference conversion ---------------------------------------------------
 
     void                initReference2d( SingleReference& orApiRef ) const;
-    void                initReference3d( SingleReference& orApiRef, sal_Int32 nSheet, bool bRelSheet ) const;
+    void                initReference3d( SingleReference& orApiRef, sal_Int32 nSheet, bool bSameSheet ) const;
     void                convertColRow( SingleReference& orApiRef, const BinSingleRef2d& rRef, bool bRelativeAsOffset ) const;
     void                convertReference( SingleReference& orApiRef, const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset ) const;
     void                convertReference( ComplexReference& orApiRef, const BinSingleRef2d& rRef1, const BinSingleRef2d& rRef2, bool bDeleted, bool bRelativeAsOffset ) const;
     void                convertReference2d( SingleReference& orApiRef, const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset ) const;
     void                convertReference2d( ComplexReference& orApiRef, const BinSingleRef2d& rRef1, const BinSingleRef2d& rRef2, bool bDeleted, bool bRelativeAsOffset ) const;
-    void                convertReference3d( SingleReference& orApiRef, sal_Int32 nSheet, bool bRelSheet, const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset ) const;
+    void                convertReference3d( SingleReference& orApiRef, sal_Int32 nSheet, bool bSameSheet, const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset ) const;
     void                convertReference3d( ComplexReference& orApiRef, const LinkSheetRange& rSheetRange, const BinSingleRef2d& rRef1, const BinSingleRef2d& rRef2, bool bDeleted, bool bRelativeAsOffset ) const;
 
     // finalize token sequence ------------------------------------------------
@@ -192,51 +202,58 @@ private:
     void                processTokens( const ApiToken* pToken, const ApiToken* pTokenEnd );
     const ApiToken*     processParameters( const FunctionInfo& rFuncInfo, const ApiToken* pToken, const ApiToken* pTokenEnd );
 
+    const FunctionInfo* getFuncInfoFromLibFuncName( const ApiToken& rToken ) const;
     bool                isEmptyParameter( const ApiToken* pToken, const ApiToken* pTokenEnd ) const;
-    OUString            getExternCallParameter( const ApiToken* pToken, const ApiToken* pTokenEnd ) const;
+    const ApiToken*     getExternCallToken( const ApiToken* pToken, const ApiToken* pTokenEnd ) const;
+    const FunctionInfo* convertExternCallParam( ApiToken& orFuncToken, const ApiToken& rECToken ) const;
     const ApiToken*     skipParentheses( const ApiToken* pToken, const ApiToken* pTokenEnd ) const;
     const ApiToken*     findParameters( ParameterPosVector& rParams, const ApiToken* pToken, const ApiToken* pTokenEnd ) const;
     void                appendCalcOnlyParameter( const FunctionInfo& rFuncInfo, size_t nParam );
     void                appendRequiredParameters( const FunctionInfo& rFuncInfo, size_t nParamCount );
 
     void                appendFinalToken( const ApiToken& rToken );
-    Any&                appendFinalToken( sal_Int32 nOpCode );
 
 protected:
-    const FunctionProvider& mrFuncProv;             /// Function info provider.
     const sal_Int32     mnMaxApiCol;                /// Maximum column index in own document.
     const sal_Int32     mnMaxApiRow;                /// Maximum row index in own document.
     const sal_Int32     mnMaxXlsCol;                /// Maximum column index in imported document.
     const sal_Int32     mnMaxXlsRow;                /// Maximum row index in imported document.
 
 private:
-    typedef ::std::vector< ApiToken >   ApiTokenVector;
     typedef ::std::vector< size_t >     SizeTypeVector;
 
     ApiTokenVector      maTokenStorage;             /// Raw unordered token storage.
     SizeTypeVector      maTokenIndexes;             /// Indexes into maTokenStorage.
     SizeTypeVector      maOperandSizeStack;         /// Stack with token sizes per operand.
+    WhiteSpaceVec       maLeadingSpaces;            /// List of whitespaces before next token.
+    WhiteSpaceVec       maOpeningSpaces;            /// List of whitespaces before opening parenthesis.
+    WhiteSpaceVec       maClosingSpaces;            /// List of whitespaces before closing parenthesis.
     FormulaContext*     mpContext;                  /// Current formula context.
-    sal_Int32           mnLeadingSpaces;            /// Current number of spaces before next token.
-    sal_Int32           mnOpeningSpaces;            /// Current number of spaces before opening parenthesis.
-    sal_Int32           mnClosingSpaces;            /// Current number of spaces before closing parenthesis.
 };
 
 // ----------------------------------------------------------------------------
 
-FormulaParserImpl::FormulaParserImpl( const WorkbookHelper& rHelper, const FunctionProvider& rFuncProv ) :
-    WorkbookHelper( rHelper ),
-    mrFuncProv( rFuncProv ),
-    mnMaxApiCol( rHelper.getAddressConverter().getMaxApiAddress().Column ),
-    mnMaxApiRow( rHelper.getAddressConverter().getMaxApiAddress().Row ),
-    mnMaxXlsCol( rHelper.getAddressConverter().getMaxXlsAddress().Column ),
-    mnMaxXlsRow( rHelper.getAddressConverter().getMaxXlsAddress().Row ),
+FormulaParserImpl::FormulaParserImpl( const OpCodeProvider& rOpCodeProv ) :
+    OpCodeProvider( rOpCodeProv ),
+    mnMaxApiCol( rOpCodeProv.getAddressConverter().getMaxApiAddress().Column ),
+    mnMaxApiRow( rOpCodeProv.getAddressConverter().getMaxApiAddress().Row ),
+    mnMaxXlsCol( rOpCodeProv.getAddressConverter().getMaxXlsAddress().Column ),
+    mnMaxXlsRow( rOpCodeProv.getAddressConverter().getMaxXlsAddress().Row ),
     mpContext( 0 )
 {
+    // reserve enough space to make resize(), push_back() etc. cheap
     maTokenStorage.reserve( 0x2000 );
     maTokenIndexes.reserve( 0x2000 );
     maOperandSizeStack.reserve( 256 );
-    resetSpaces();
+    maLeadingSpaces.reserve( 256 );
+    maOpeningSpaces.reserve( 256 );
+    maClosingSpaces.reserve( 256 );
+}
+
+OUString FormulaParserImpl::printFormulaTokens( const ApiTokenSequence& )
+{
+    // not implemented...
+    return OUString();
 }
 
 void FormulaParserImpl::importOoxFormula( FormulaContext&, const OUString& )
@@ -300,51 +317,65 @@ void FormulaParserImpl::setSharedFormula
 
 bool FormulaParserImpl::resetSpaces()
 {
-    mnLeadingSpaces = mnOpeningSpaces = mnClosingSpaces = 0;
+    maLeadingSpaces.clear();
+    maOpeningSpaces.clear();
+    maClosingSpaces.clear();
     return true;
 }
 
-size_t FormulaParserImpl::getFormulaSize() const
+void FormulaParserImpl::appendSpaces( WhiteSpaceVec& orSpaces, sal_Int32 nCount, bool bLineFeed )
 {
-    return maTokenIndexes.size();
+    OSL_ENSURE( nCount >= 0, "FormulaParserImpl::appendSpaces - negative count" );
+    if( nCount > 0 )
+        orSpaces.push_back( WhiteSpace( nCount, bLineFeed ) );
 }
 
-Any& FormulaParserImpl::appendRawToken( sal_Int32 nOpCode )
+void FormulaParserImpl::appendLeadingSpaces( sal_Int32 nCount, bool bLineFeed )
 {
-    size_t nTokenIndex = maTokenStorage.size();
-    maTokenStorage.resize( nTokenIndex + 1 );
-    maTokenStorage.back().OpCode = nOpCode;
-    maTokenIndexes.push_back( nTokenIndex );
-    return maTokenStorage.back().Data;
+    appendSpaces( maLeadingSpaces, nCount, bLineFeed );
 }
 
-Any& FormulaParserImpl::insertRawToken( sal_Int32 nOpCode, size_t nIndexFromEnd )
+void FormulaParserImpl::appendOpeningSpaces( sal_Int32 nCount, bool bLineFeed )
 {
-    size_t nTokenIndex = maTokenStorage.size();
-    maTokenStorage.resize( nTokenIndex + 1 );
-    maTokenStorage.back().OpCode = nOpCode;
-    maTokenIndexes.insert( maTokenIndexes.end() - nIndexFromEnd, nTokenIndex );
-    return maTokenStorage.back().Data;
+    appendSpaces( maOpeningSpaces, nCount, bLineFeed );
 }
 
-size_t FormulaParserImpl::appendSpacesToken( sal_Int32 nSpaces )
+void FormulaParserImpl::appendClosingSpaces( sal_Int32 nCount, bool bLineFeed )
 {
-    if( nSpaces > 0 )
+    appendSpaces( maClosingSpaces, nCount, bLineFeed );
+}
+
+size_t FormulaParserImpl::getFormulaSize() const
     {
-        appendRawToken( mrFuncProv.OPCODE_SPACES ) <<= nSpaces;
-        return 1;
+    return maTokenIndexes.size();
     }
-    return 0;
+
+Any& FormulaParserImpl::appendRawToken( sal_Int32 nOpCode )
+{
+    maTokenIndexes.push_back( maTokenStorage.size() );
+    return maTokenStorage.append( nOpCode );
 }
 
-size_t FormulaParserImpl::insertSpacesToken( sal_Int32 nSpaces, size_t nIndexFromEnd )
+Any& FormulaParserImpl::insertRawToken( sal_Int32 nOpCode, size_t nIndexFromEnd )
 {
-    if( nSpaces > 0 )
+    maTokenIndexes.insert( maTokenIndexes.end() - nIndexFromEnd, maTokenStorage.size() );
+    return maTokenStorage.append( nOpCode );
+}
+
+size_t FormulaParserImpl::appendWhiteSpaceTokens( const WhiteSpaceVec* pSpaces )
     {
-        insertRawToken( mrFuncProv.OPCODE_SPACES, nIndexFromEnd ) <<= nSpaces;
-        return 1;
+    if( pSpaces && !pSpaces->empty() )
+        for( WhiteSpaceVec::const_iterator aIt = pSpaces->begin(), aEnd = pSpaces->end(); aIt != aEnd; ++aIt )
+            appendRawToken( OPCODE_SPACES ) <<= aIt->first;
+    return pSpaces ? pSpaces->size() : 0;
     }
-    return 0;
+
+size_t FormulaParserImpl::insertWhiteSpaceTokens( const WhiteSpaceVec* pSpaces, size_t nIndexFromEnd )
+{
+    if( pSpaces && !pSpaces->empty() )
+        for( WhiteSpaceVec::const_iterator aIt = pSpaces->begin(), aEnd = pSpaces->end(); aIt != aEnd; ++aIt )
+            insertRawToken( OPCODE_SPACES, nIndexFromEnd ) <<= aIt->first;
+    return pSpaces ? pSpaces->size() : 0;
 }
 
 size_t FormulaParserImpl::getOperandSize( size_t nOpCountFromEnd, size_t nOpIndex ) const
@@ -397,97 +428,97 @@ void FormulaParserImpl::removeLastOperan
         removeOperand( 1, 0 );
 }
 
-bool FormulaParserImpl::pushOperandToken( sal_Int32 nOpCode, sal_Int32 nSpaces )
+bool FormulaParserImpl::pushOperandToken( sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces )
 {
-    size_t nSpacesSize = appendSpacesToken( nSpaces );
+    size_t nSpacesSize = appendWhiteSpaceTokens( pSpaces );
     appendRawToken( nOpCode );
     pushOperandSize( nSpacesSize + 1 );
     return true;
 }
 
-bool FormulaParserImpl::pushAnyOperandToken( const Any& rAny, sal_Int32 nOpCode, sal_Int32 nSpaces )
+bool FormulaParserImpl::pushAnyOperandToken( const Any& rAny, sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces )
 {
-    size_t nSpacesSize = appendSpacesToken( nSpaces );
+    size_t nSpacesSize = appendWhiteSpaceTokens( pSpaces );
     appendRawToken( nOpCode ) = rAny;
     pushOperandSize( nSpacesSize + 1 );
     return true;
 }
 
 template< typename Type >
-bool FormulaParserImpl::pushValueOperandToken( const Type& rValue, sal_Int32 nOpCode, sal_Int32 nSpaces )
+bool FormulaParserImpl::pushValueOperandToken( const Type& rValue, sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces )
 {
-    size_t nSpacesSize = appendSpacesToken( nSpaces );
+    size_t nSpacesSize = appendWhiteSpaceTokens( pSpaces );
     appendRawToken( nOpCode ) <<= rValue;
     pushOperandSize( nSpacesSize + 1 );
     return true;
 }
 
-bool FormulaParserImpl::pushParenthesesOperandToken( sal_Int32 nOpeningSpaces, sal_Int32 nClosingSpaces )
+bool FormulaParserImpl::pushParenthesesOperandToken( const WhiteSpaceVec* pOpeningSpaces, const WhiteSpaceVec* pClosingSpaces )
 {
-    size_t nSpacesSize = appendSpacesToken( nOpeningSpaces );
-    appendRawToken( mrFuncProv.OPCODE_OPEN );
-    nSpacesSize += appendSpacesToken( nClosingSpaces );
-    appendRawToken( mrFuncProv.OPCODE_CLOSE );
+    size_t nSpacesSize = appendWhiteSpaceTokens( pOpeningSpaces );
+    appendRawToken( OPCODE_OPEN );
+    nSpacesSize += appendWhiteSpaceTokens( pClosingSpaces );
+    appendRawToken( OPCODE_CLOSE );
     pushOperandSize( nSpacesSize + 2 );
     return true;
 }
 
-bool FormulaParserImpl::pushUnaryPreOperatorToken( sal_Int32 nOpCode, sal_Int32 nSpaces )
+bool FormulaParserImpl::pushUnaryPreOperatorToken( sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces )
 {
     bool bOk = maOperandSizeStack.size() >= 1;
     if( bOk )
     {
         size_t nOpSize = popOperandSize();
-        size_t nSpacesSize = insertSpacesToken( nSpaces, nOpSize );
+        size_t nSpacesSize = insertWhiteSpaceTokens( pSpaces, nOpSize );
         insertRawToken( nOpCode, nOpSize );
         pushOperandSize( nOpSize + nSpacesSize + 1 );
     }
     return bOk;
 }
 
-bool FormulaParserImpl::pushUnaryPostOperatorToken( sal_Int32 nOpCode, sal_Int32 nSpaces )
+bool FormulaParserImpl::pushUnaryPostOperatorToken( sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces )
 {
     bool bOk = maOperandSizeStack.size() >= 1;
     if( bOk )
     {
         size_t nOpSize = popOperandSize();
-        size_t nSpacesSize = appendSpacesToken( nSpaces );
+        size_t nSpacesSize = appendWhiteSpaceTokens( pSpaces );
         appendRawToken( nOpCode );
         pushOperandSize( nOpSize + nSpacesSize + 1 );
     }
     return bOk;
 }
 
-bool FormulaParserImpl::pushBinaryOperatorToken( sal_Int32 nOpCode, sal_Int32 nSpaces )
+bool FormulaParserImpl::pushBinaryOperatorToken( sal_Int32 nOpCode, const WhiteSpaceVec* pSpaces )
 {
     bool bOk = maOperandSizeStack.size() >= 2;
     if( bOk )
     {
         size_t nOp2Size = popOperandSize();
         size_t nOp1Size = popOperandSize();
-        size_t nSpacesSize = insertSpacesToken( nSpaces, nOp2Size );
+        size_t nSpacesSize = insertWhiteSpaceTokens( pSpaces, nOp2Size );
         insertRawToken( nOpCode, nOp2Size );
         pushOperandSize( nOp1Size + nSpacesSize + 1 + nOp2Size );
     }
     return bOk;
 }
 
-bool FormulaParserImpl::pushParenthesesOperatorToken( sal_Int32 nOpeningSpaces, sal_Int32 nClosingSpaces )
+bool FormulaParserImpl::pushParenthesesOperatorToken( const WhiteSpaceVec* pOpeningSpaces, const WhiteSpaceVec* pClosingSpaces )
 {
     bool bOk = maOperandSizeStack.size() >= 1;
     if( bOk )
     {
         size_t nOpSize = popOperandSize();
-        size_t nSpacesSize = insertSpacesToken( nOpeningSpaces, nOpSize );
-        insertRawToken( mrFuncProv.OPCODE_OPEN, nOpSize );
-        nSpacesSize += appendSpacesToken( nClosingSpaces );
-        appendRawToken( mrFuncProv.OPCODE_CLOSE );
+        size_t nSpacesSize = insertWhiteSpaceTokens( pOpeningSpaces, nOpSize );
+        insertRawToken( OPCODE_OPEN, nOpSize );
+        nSpacesSize += appendWhiteSpaceTokens( pClosingSpaces );
+        appendRawToken( OPCODE_CLOSE );
         pushOperandSize( nOpSize + nSpacesSize + 2 );
     }
     return bOk;
 }
 
-bool FormulaParserImpl::pushFunctionOperatorToken( sal_Int32 nOpCode, size_t nParamCount, sal_Int32 nLeadingSpaces, sal_Int32 nClosingSpaces )
+bool FormulaParserImpl::pushFunctionOperatorToken( sal_Int32 nOpCode, size_t nParamCount, const WhiteSpaceVec* pLeadingSpaces, const WhiteSpaceVec* pClosingSpaces )
 {
     /*  #i70925# if there are not enough tokens available on token stack, do
         not exit with error, but reduce parameter count. */
@@ -496,42 +527,48 @@ bool FormulaParserImpl::pushFunctionOper
     // convert all parameters on stack to a single operand separated with OPCODE_SEP
     bool bOk = true;
     for( size_t nParam = 1; bOk && (nParam < nParamCount); ++nParam )
-        bOk = pushBinaryOperatorToken( mrFuncProv.OPCODE_SEP, 0 );
+        bOk = pushBinaryOperatorToken( OPCODE_SEP );
 
     // add function parentheses and function name
     return bOk &&
-        ((nParamCount > 0) ? pushParenthesesOperatorToken( 0, nClosingSpaces ) : pushParenthesesOperandToken( 0, nClosingSpaces )) &&
-        pushUnaryPreOperatorToken( nOpCode, nLeadingSpaces );
+        ((nParamCount > 0) ? pushParenthesesOperatorToken( 0, pClosingSpaces ) : pushParenthesesOperandToken( 0, pClosingSpaces )) &&
+        pushUnaryPreOperatorToken( nOpCode, pLeadingSpaces );
 }
 
-bool FormulaParserImpl::pushFunctionOperatorToken( const FunctionInfo& rFuncInfo, size_t nParamCount, sal_Int32 nLeadingSpaces, sal_Int32 nClosingSpaces )
+bool FormulaParserImpl::pushFunctionOperatorToken( const FunctionInfo& rFuncInfo, size_t nParamCount, const WhiteSpaceVec* pLeadingSpaces, const WhiteSpaceVec* pClosingSpaces )
 {
-    bool bOk = pushFunctionOperatorToken( rFuncInfo.mnApiOpCode, nParamCount, nLeadingSpaces, nClosingSpaces );
-    // try to create an external add-in call for the passed built-in function
-    if( bOk && (rFuncInfo.maExtProgName.getLength() > 0) )
+    bool bOk = pushFunctionOperatorToken( rFuncInfo.mnApiOpCode, nParamCount, pLeadingSpaces, pClosingSpaces );
+    if( bOk )
+    {
+       // create an external add-in call for the passed built-in function
+        if( (rFuncInfo.mnApiOpCode == OPCODE_EXTERNAL) && (rFuncInfo.maExtProgName.getLength() > 0) )
         getOperandToken( 1, 0, 0 ).Data <<= rFuncInfo.maExtProgName;
+        // create a bad token with unsupported function name
+        else if( (rFuncInfo.mnApiOpCode == OPCODE_BAD) && (rFuncInfo.maOoxFuncName.getLength() > 0) )
+            getOperandToken( 1, 0, 0 ).Data <<= rFuncInfo.maOoxFuncName;
+    }
     return bOk;
 }
 
 bool FormulaParserImpl::pushOperand( sal_Int32 nOpCode )
 {
-    return pushOperandToken( nOpCode, mnLeadingSpaces ) && resetSpaces();
+    return pushOperandToken( nOpCode, &maLeadingSpaces ) && resetSpaces();
 }
 
 bool FormulaParserImpl::pushAnyOperand( const Any& rAny, sal_Int32 nOpCode )
 {
-    return pushAnyOperandToken( rAny, nOpCode, mnLeadingSpaces ) && resetSpaces();
+    return pushAnyOperandToken( rAny, nOpCode, &maLeadingSpaces ) && resetSpaces();
 }
 
 template< typename Type >
 bool FormulaParserImpl::pushValueOperand( const Type& rValue, sal_Int32 nOpCode )
 {
-    return pushValueOperandToken( rValue, nOpCode, mnLeadingSpaces ) && resetSpaces();
+    return pushValueOperandToken( rValue, nOpCode, &maLeadingSpaces ) && resetSpaces();
 }
 
 bool FormulaParserImpl::pushBoolOperand( bool bValue )
 {
-    if( const FunctionInfo* pFuncInfo = mrFuncProv.getFuncInfoFromOobFuncId( bValue ? OOBIN_FUNC_TRUE : OOBIN_FUNC_FALSE ) )
+    if( const FunctionInfo* pFuncInfo = getFuncInfoFromOobFuncId( bValue ? OOBIN_FUNC_TRUE : OOBIN_FUNC_FALSE ) )
         return pushFunctionOperator( pFuncInfo->mnApiOpCode, 0 );
     return pushValueOperand< double >( bValue ? 1.0 : 0.0 );
 }
@@ -540,17 +577,22 @@ bool FormulaParserImpl::pushErrorOperand
 {
     // HACK: enclose all error codes into an 1x1 matrix
     // start token array with opening brace and leading spaces
-    pushOperand( mrFuncProv.OPCODE_ARRAY_OPEN );
+    pushOperand( OPCODE_ARRAY_OPEN );
     size_t nOpSize = popOperandSize();
     size_t nOldArraySize = maTokenIndexes.size();
     // push a double containing the Calc error code
-    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= fEncodedError;
+    appendRawToken( OPCODE_PUSH ) <<= fEncodedError;
     // close token array and set resulting operand size
-    appendRawToken( mrFuncProv.OPCODE_ARRAY_CLOSE );
+    appendRawToken( OPCODE_ARRAY_CLOSE );
     pushOperandSize( nOpSize + maTokenIndexes.size() - nOldArraySize );
     return true;
 }
 
+bool FormulaParserImpl::pushBiffBoolOperand( sal_uInt8 nValue )
+{
+    return pushBoolOperand( nValue != BIFF_TOK_BOOL_FALSE );
+}
+
 bool FormulaParserImpl::pushBiffErrorOperand( sal_uInt8 nErrorCode )
 {
     return pushErrorOperand( BiffHelper::calcDoubleFromError( nErrorCode ) );
@@ -558,7 +600,7 @@ bool FormulaParserImpl::pushBiffErrorOpe
 
 bool FormulaParserImpl::pushParenthesesOperand()
 {
-    return pushParenthesesOperandToken( mnOpeningSpaces, mnClosingSpaces ) && resetSpaces();
+    return pushParenthesesOperandToken( &maOpeningSpaces, &maClosingSpaces ) && resetSpaces();
 }
 
 bool FormulaParserImpl::pushReferenceOperand( const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset )
@@ -575,6 +617,19 @@ bool FormulaParserImpl::pushReferenceOpe
     return pushValueOperand( aApiRef );
 }
 
+template< typename Type >
+bool FormulaParserImpl::pushReferenceOperand( const LinkSheetRange& rSheetRange, const Type& rApiRef )
+{
+    if( rSheetRange.isExternal() )
+    {
+        ExternalReference aApiExtRef;
+        aApiExtRef.Index = rSheetRange.getDocLinkIndex();
+        aApiExtRef.Reference <<= rApiRef;
+        return pushValueOperand( aApiExtRef );
+    }
+    return pushValueOperand( rApiRef );
+}
+
 bool FormulaParserImpl::pushReferenceOperand( const LinkSheetRange& rSheetRange, const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset )
 {
     if( rSheetRange.is3dRange() )
@@ -582,66 +637,83 @@ bool FormulaParserImpl::pushReferenceOpe
         // single-cell-range over several sheets, needs to create a ComplexReference
         ComplexReference aApiRef;
         convertReference3d( aApiRef, rSheetRange, rRef, rRef, bDeleted, bRelativeAsOffset );
-        return pushValueOperand( aApiRef );
+        return pushReferenceOperand( rSheetRange, aApiRef );
     }
     SingleReference aApiRef;
-    convertReference3d( aApiRef, rSheetRange.mnFirst, rSheetRange.mbRel, rRef, bDeleted, bRelativeAsOffset );
-    return pushValueOperand( aApiRef );
+    convertReference3d( aApiRef, rSheetRange.getFirstSheet(), rSheetRange.isSameSheet(), rRef, bDeleted, bRelativeAsOffset );
+    return pushReferenceOperand( rSheetRange, aApiRef );
 }
 
 bool FormulaParserImpl::pushReferenceOperand( const LinkSheetRange& rSheetRange, const BinComplexRef2d& rRef, bool bDeleted, bool bRelativeAsOffset )
 {
     ComplexReference aApiRef;
     convertReference3d( aApiRef, rSheetRange, rRef.maRef1, rRef.maRef2, bDeleted, bRelativeAsOffset );
-    return pushValueOperand( aApiRef );
+    return pushReferenceOperand( rSheetRange, aApiRef );
 }
 
 bool FormulaParserImpl::pushNlrOperand( const BinSingleRef2d& rRef )
 {
     SingleReference aApiRef;
     convertReference2d( aApiRef, rRef, false, false );
-    return pushValueOperand( aApiRef, mrFuncProv.OPCODE_NLR );
+    return pushValueOperand( aApiRef, OPCODE_NLR );
 }
 
-bool FormulaParserImpl::pushEmbeddedRefOperand( const DefinedNameBase& rName )
+bool FormulaParserImpl::pushEmbeddedRefOperand( const DefinedNameBase& rName, bool bPushBadToken )
 {
     Any aRefAny = rName.getReference( mpContext->getBaseAddress() );
-    return aRefAny.hasValue() ? pushAnyOperand( aRefAny, mrFuncProv.OPCODE_PUSH ) : pushBiffErrorOperand( BIFF_ERR_NAME );
+    if( aRefAny.hasValue() )
+        return pushAnyOperand( aRefAny, OPCODE_PUSH );
+    if( bPushBadToken && (rName.getOoxName().getLength() > 0) && (rName.getOoxName()[ 0 ] >= ' ') )
+        return pushValueOperand( rName.getOoxName(), OPCODE_BAD );
+    return pushBiffErrorOperand( BIFF_ERR_NAME );
 }
 
 bool FormulaParserImpl::pushDefinedNameOperand( const DefinedNameRef& rxDefName )
 {
-    if( !rxDefName )
+    if( !rxDefName || (rxDefName->getOoxName().getLength() == 0) )
         return pushBiffErrorOperand( BIFF_ERR_NAME );
-    if( rxDefName->isMacroFunc( false ) )
-        return pushValueOperand( rxDefName->getOoxName(), mrFuncProv.OPCODE_MACRO );
+    if( rxDefName->isMacroFunction() )
+        return pushValueOperand( rxDefName->getOoxName(), OPCODE_MACRO );
     if( rxDefName->getTokenIndex() >= 0 )
-        return pushValueOperand( rxDefName->getTokenIndex(), mrFuncProv.OPCODE_NAME );
-    return pushEmbeddedRefOperand( *rxDefName );
+        return pushValueOperand( rxDefName->getTokenIndex(), OPCODE_NAME );
+    return pushEmbeddedRefOperand( *rxDefName, true );
+}
+
+bool FormulaParserImpl::pushExternalFuncOperand( const FunctionInfo& rFuncInfo )
+{
+    return (rFuncInfo.mnApiOpCode == OPCODE_EXTERNAL) ?
+        pushValueOperand( rFuncInfo.maExtProgName, OPCODE_EXTERNAL ) :
+        pushOperand( rFuncInfo.mnApiOpCode );
 }
 
 bool FormulaParserImpl::pushDdeLinkOperand( const OUString& rDdeServer, const OUString& rDdeTopic, const OUString& rDdeItem )
 {
     // create the function call DDE("server";"topic";"item")
     return
-        pushValueOperandToken( rDdeServer, 0 ) &&
-        pushValueOperandToken( rDdeTopic, 0 ) &&
-        pushValueOperandToken( rDdeItem, 0 ) &&
-        pushFunctionOperator( mrFuncProv.OPCODE_DDE, 3 );
+        pushValueOperandToken( rDdeServer ) &&
+        pushValueOperandToken( rDdeTopic ) &&
+        pushValueOperandToken( rDdeItem ) &&
+        pushFunctionOperator( OPCODE_DDE, 3 );
 }
 
-bool FormulaParserImpl::pushExternalNameOperand( const ExternalNameRef& rxExtName, ExternalLinkType eLinkType )
+bool FormulaParserImpl::pushExternalNameOperand( const ExternalNameRef& rxExtName, const ExternalLink& rExtLink )
 {
-    if( rxExtName.get() ) switch( eLinkType )
+    if( rxExtName.get() ) switch( rExtLink.getLinkType() )
     {
         case LINKTYPE_INTERNAL:
         case LINKTYPE_EXTERNAL:
-            return pushEmbeddedRefOperand( *rxExtName );
+            return pushEmbeddedRefOperand( *rxExtName, false );
 
         case LINKTYPE_ANALYSIS:
-            if( const FunctionInfo* pFuncInfo = mrFuncProv.getFuncInfoFromOoxFuncName( rxExtName->getOoxName() ) )
-                if( pFuncInfo->maExternCallName.getLength() > 0 )
-                    return pushValueOperand( pFuncInfo->maExternCallName, mrFuncProv.OPCODE_MACRO );
+            // TODO: need support for localized addin function names
+            if( const FunctionInfo* pFuncInfo = getFuncInfoFromOoxFuncName( rxExtName->getUpcaseOoxName() ) )
+                return pushExternalFuncOperand( *pFuncInfo );
+        break;
+
+        case LINKTYPE_LIBRARY:
+            if( const FunctionInfo* pFuncInfo = getFuncInfoFromOoxFuncName( rxExtName->getUpcaseOoxName() ) )
+                if( (pFuncInfo->meFuncLibType != FUNCLIB_UNKNOWN) && (pFuncInfo->meFuncLibType == rExtLink.getFuncLibraryType()) )
+                    return pushExternalFuncOperand( *pFuncInfo );
         break;
 
         case LINKTYPE_DDE:
@@ -653,39 +725,39 @@ bool FormulaParserImpl::pushExternalName
         break;
 
         default:
-            OSL_ENSURE( eLinkType != LINKTYPE_SELF, "FormulaParserImpl::pushExternalNameOperand - invalid call" );
+            OSL_ENSURE( rExtLink.getLinkType() != LINKTYPE_SELF, "FormulaParserImpl::pushExternalNameOperand - invalid call" );
     }
     return pushBiffErrorOperand( BIFF_ERR_NAME );
 }
 
 bool FormulaParserImpl::pushUnaryPreOperator( sal_Int32 nOpCode )
 {
-    return pushUnaryPreOperatorToken( nOpCode, mnLeadingSpaces ) && resetSpaces();
+    return pushUnaryPreOperatorToken( nOpCode, &maLeadingSpaces ) && resetSpaces();
 }
 
 bool FormulaParserImpl::pushUnaryPostOperator( sal_Int32 nOpCode )
 {
-    return pushUnaryPostOperatorToken( nOpCode, mnLeadingSpaces ) && resetSpaces();
+    return pushUnaryPostOperatorToken( nOpCode, &maLeadingSpaces ) && resetSpaces();
 }
 
 bool FormulaParserImpl::pushBinaryOperator( sal_Int32 nOpCode )
 {
-    return pushBinaryOperatorToken( nOpCode, mnLeadingSpaces ) && resetSpaces();
+    return pushBinaryOperatorToken( nOpCode, &maLeadingSpaces ) && resetSpaces();
 }
 
 bool FormulaParserImpl::pushParenthesesOperator()
 {
-    return pushParenthesesOperatorToken( mnOpeningSpaces, mnClosingSpaces ) && resetSpaces();
+    return pushParenthesesOperatorToken( &maOpeningSpaces, &maClosingSpaces ) && resetSpaces();
 }
 
 bool FormulaParserImpl::pushFunctionOperator( sal_Int32 nOpCode, size_t nParamCount )
 {
-    return pushFunctionOperatorToken( nOpCode, nParamCount, mnLeadingSpaces, mnClosingSpaces ) && resetSpaces();
+    return pushFunctionOperatorToken( nOpCode, nParamCount, &maLeadingSpaces, &maClosingSpaces ) && resetSpaces();
 }
 
 bool FormulaParserImpl::pushFunctionOperator( const FunctionInfo& rFuncInfo, size_t nParamCount )
 {
-    return pushFunctionOperatorToken( rFuncInfo, nParamCount, mnLeadingSpaces, mnClosingSpaces ) && resetSpaces();
+    return pushFunctionOperatorToken( rFuncInfo, nParamCount, &maLeadingSpaces, &maClosingSpaces ) && resetSpaces();
 }
 
 // reference conversion -------------------------------------------------------
@@ -705,7 +777,7 @@ void FormulaParserImpl::initReference2d(
     }
 }
 
-void FormulaParserImpl::initReference3d( SingleReference& orApiRef, sal_Int32 nSheet, bool bRelSheet ) const
+void FormulaParserImpl::initReference3d( SingleReference& orApiRef, sal_Int32 nSheet, bool bSameSheet ) const
 {
     orApiRef.Flags = SHEET_3D;
     if( nSheet < 0 )
@@ -713,7 +785,7 @@ void FormulaParserImpl::initReference3d(
         orApiRef.Sheet = 0;
         orApiRef.Flags |= SHEET_DELETED;
     }
-    else if( bRelSheet )
+    else if( bSameSheet )
     {
         OSL_ENSURE( nSheet == 0, "FormulaParserImpl::initReference3d - invalid sheet index" );
         orApiRef.Flags |= SHEET_RELATIVE;
@@ -779,16 +851,17 @@ void FormulaParserImpl::convertReference
     setFlag( orApiRef.Reference2.Flags, SHEET_3D, false );
 }
 
-void FormulaParserImpl::convertReference3d( SingleReference& orApiRef, sal_Int32 nSheet, bool bRelSheet, const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset ) const
+void FormulaParserImpl::convertReference3d( SingleReference& orApiRef, sal_Int32 nSheet, bool bSameSheet, const BinSingleRef2d& rRef, bool bDeleted, bool bRelativeAsOffset ) const
 {
-    initReference3d( orApiRef, nSheet, bRelSheet );
+    initReference3d( orApiRef, nSheet, bSameSheet );
     convertReference( orApiRef, rRef, bDeleted, bRelativeAsOffset );
 }
 
 void FormulaParserImpl::convertReference3d( ComplexReference& orApiRef, const LinkSheetRange& rSheetRange, const BinSingleRef2d& rRef1, const BinSingleRef2d& rRef2, bool bDeleted, bool bRelativeAsOffset ) const
 {
-    initReference3d( orApiRef.Reference1, rSheetRange.mnFirst, rSheetRange.mbRel );
-    initReference3d( orApiRef.Reference2, rSheetRange.mnLast, rSheetRange.mbRel );
+    bool bSameSheet = rSheetRange.isSameSheet();
+    initReference3d( orApiRef.Reference1, rSheetRange.getFirstSheet(), bSameSheet );
+    initReference3d( orApiRef.Reference2, rSheetRange.getLastSheet(), bSameSheet );
     convertReference( orApiRef, rRef1, rRef2, bDeleted, bRelativeAsOffset );
     // remove sheet name from second part of reference
     setFlag( orApiRef.Reference2.Flags, SHEET_3D, rSheetRange.is3dRange() );
@@ -802,26 +875,74 @@ void FormulaParserImpl::processTokens( c
     {
         // push the current token into the vector
         appendFinalToken( *pToken );
-        // try to process a function, otherwise go to next token
-        if( const FunctionInfo* pFuncInfo = mrFuncProv.getFuncInfoFromApiToken( *pToken ) )
+        const FunctionInfo* pFuncInfo;
+        // try to process a function
+        if( (pFuncInfo = getFuncInfoFromApiToken( *pToken )) != 0 )
+        {
             pToken = processParameters( *pFuncInfo, pToken + 1, pTokenEnd );
+        }
+        // try to process a function from an external library
+        else if( (pFuncInfo = getFuncInfoFromLibFuncName( *pToken )) != 0 )
+        {
+            ApiToken& rFuncToken = maTokenStorage.back();
+            rFuncToken.OpCode = pFuncInfo->mnApiOpCode;
+            if( (rFuncToken.OpCode == OPCODE_EXTERNAL) && (pFuncInfo->maExtProgName.getLength() > 0) )
+                rFuncToken.Data <<= pFuncInfo->maExtProgName;
+            else
+                rFuncToken.Data.clear();    // clear string from OPCODE_BAD
+            pToken = processParameters( *pFuncInfo, pToken + 1, pTokenEnd );
+        }
+        // otherwise, go to next token
         else
+        {
             ++pToken;
     }
 }
+}
+
+namespace {
+
+bool lclTokenHasChar( const ApiToken& rToken, sal_Int32 nOpCode, sal_Unicode cChar )
+{
+    return (rToken.OpCode == nOpCode) && rToken.Data.has< OUString >() && (rToken.Data.get< OUString >() == OUString( cChar ));
+}
+
+bool lclTokenHasDouble( const ApiToken& rToken, sal_Int32 nOpCode )
+{
+    return (rToken.OpCode == nOpCode) && rToken.Data.has< double >();
+}
+
+} // namespace
 
 const ApiToken* FormulaParserImpl::processParameters(
         const FunctionInfo& rFuncInfo, const ApiToken* pToken, const ApiToken* pTokenEnd )
 {
+    /*  OOXML import of library functions pushes the external reference "[n]!"
+        as BAD/PUSH/BAD/BAD tokens in front of the function name. Try to find
+        and remove them here. TODO: This will change with CWS mooxlsc, there,
+        the reference ID and function name are passed together in a BAD token,
+        see getFuncInfoFromLibFuncName(). */
+    if( (rFuncInfo.meFuncLibType != FUNCLIB_UNKNOWN) && (maTokenStorage.size() >= 5) )
+    {
+        sal_Size nSize = maTokenStorage.size();
+        if( lclTokenHasChar(   maTokenStorage[ nSize - 5 ], OPCODE_BAD, '[' ) &&
+            lclTokenHasDouble( maTokenStorage[ nSize - 4 ], OPCODE_PUSH     ) &&
+            lclTokenHasChar(   maTokenStorage[ nSize - 3 ], OPCODE_BAD, ']' ) &&
+            lclTokenHasChar(   maTokenStorage[ nSize - 2 ], OPCODE_BAD, '!' ) )
+        {
+            maTokenStorage.erase( maTokenStorage.end() - 5, maTokenStorage.end() - 1 );
+        }
+    }
+
     // remember position of the token containing the function op-code
     size_t nFuncNameIdx = maTokenStorage.size() - 1;
 
     // process a function, if an OPCODE_OPEN token is following
-    OSL_ENSURE( (pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_OPEN), "FormulaParserImpl::processParameters - OPCODE_OPEN expected" );
-    if( (pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_OPEN) )
+    OSL_ENSURE( (pToken < pTokenEnd) && (pToken->OpCode == OPCODE_OPEN), "FormulaParserImpl::processParameters - OPCODE_OPEN expected" );
+    if( (pToken < pTokenEnd) && (pToken->OpCode == OPCODE_OPEN) )
     {
         // append the OPCODE_OPEN token to the vector
-        appendFinalToken( mrFuncProv.OPCODE_OPEN );
+        maTokenStorage.append( OPCODE_OPEN );
 
         // store positions of OPCODE_OPEN, parameter separators, and OPCODE_CLOSE
         ParameterPosVector aParams;
@@ -841,17 +962,16 @@ const ApiToken* FormulaParserImpl::proce
             ParameterPosVector::const_iterator aPosIt = aParams.begin();
 
             // preprocess add-ins, first parameter is reference to function name
-            if( rFuncInfo.mnOobFuncId == OOBIN_FUNC_EXTERNCALL )
+            if( rFuncInfo.mnBiffFuncId == BIFF_FUNC_EXTERNCALL )
             {
-                OUString aName = getExternCallParameter( *aPosIt + 1, *(aPosIt + 1) );
-                if( const FunctionInfo* pExtFuncInfo = mrFuncProv.getFuncInfoFromExternCallName( aName ) )
+                maTokenStorage[ nFuncNameIdx ].OpCode = OPCODE_NONAME;
+                // try to initialize function token from first parameter
+                if( const ApiToken* pECToken = getExternCallToken( *aPosIt + 1, *(aPosIt + 1) ) )
+                    if( const FunctionInfo* pECFuncInfo = convertExternCallParam( maTokenStorage[ nFuncNameIdx ], *pECToken ) )
+                        pRealFuncInfo = pECFuncInfo;
+                // on success, ignore first parameter
+                if( maTokenStorage[ nFuncNameIdx ].OpCode != OPCODE_NONAME )
                 {
-                    maTokenStorage[ nFuncNameIdx ].OpCode = pExtFuncInfo->mnApiOpCode;
-                    // insert programmatic add-in function name
-                    if( pExtFuncInfo->mnApiOpCode == mrFuncProv.OPCODE_EXTERNAL )
-                        maTokenStorage[ nFuncNameIdx ].Data <<= pExtFuncInfo->maExtProgName;
-                    // prepare for following parameters
-                    pRealFuncInfo = pExtFuncInfo;
                     --nParamCount;
                     ++aPosIt;
                 }
@@ -879,7 +999,7 @@ const ApiToken* FormulaParserImpl::proce
                     // replace empty second and third parameter in IF function with zeros
                     if( (pRealFuncInfo->mnOobFuncId == OOBIN_FUNC_IF) && ((nParam == 1) || (nParam == 2)) && bIsEmpty )
                     {
-                        appendFinalToken( mrFuncProv.OPCODE_PUSH ) <<= static_cast< double >( 0.0 );
+                        maTokenStorage.append< double >( OPCODE_PUSH, 0.0 );
                         bIsEmpty = false;
                     }
                     else
@@ -888,7 +1008,7 @@ const ApiToken* FormulaParserImpl::proce
                         processTokens( pParamBegin, pParamEnd );
                     }
                     // append parameter separator token
-                    appendFinalToken( mrFuncProv.OPCODE_SEP );
+                    maTokenStorage.append( OPCODE_SEP );
                 }
 
                 /*  #84453# Update size of new token sequence with valid parameters
@@ -911,57 +1031,115 @@ const ApiToken* FormulaParserImpl::proce
             appendRequiredParameters( *pRealFuncInfo, nLastValidCount );
 
             // remove last parameter separator token
-            if( maTokenStorage.back().OpCode == mrFuncProv.OPCODE_SEP )
+            if( maTokenStorage.back().OpCode == OPCODE_SEP )
                 maTokenStorage.pop_back();
         }
 
         /*  Append the OPCODE_CLOSE token to the vector, but only if there is
             no OPCODE_BAD token at the end, this token already contains the
             trailing closing parentheses. */
-        if( (pTokenEnd - 1)->OpCode != mrFuncProv.OPCODE_BAD )
-            appendFinalToken( mrFuncProv.OPCODE_CLOSE );
+        if( (pTokenEnd - 1)->OpCode != OPCODE_BAD )
+            maTokenStorage.append( OPCODE_CLOSE );
     }
 
     /*  Replace OPCODE_EXTERNAL with OPCODE_NONAME to get #NAME! error in cell,
         if no matching add-in function was found. */
     ApiToken& rFuncNameToken = maTokenStorage[ nFuncNameIdx ];
-    if( (rFuncNameToken.OpCode == mrFuncProv.OPCODE_EXTERNAL) && !rFuncNameToken.Data.hasValue() )
-        rFuncNameToken.OpCode = mrFuncProv.OPCODE_NONAME;
+    if( (rFuncNameToken.OpCode == OPCODE_EXTERNAL) && !rFuncNameToken.Data.hasValue() )
+        rFuncNameToken.OpCode = OPCODE_NONAME;
 
     return pToken;
 }
 
+const FunctionInfo* FormulaParserImpl::getFuncInfoFromLibFuncName( const ApiToken& rToken ) const
+{
+    // try to parse calls to library functions
+    if( (rToken.OpCode == OPCODE_BAD) && rToken.Data.has< OUString >() )
+    {
+        // format of the function call is "[n]!funcname", n being the link to the library
+        OUString aString = rToken.Data.get< OUString >();
+        sal_Int32 nBracketOpen = aString.indexOf( '[' );
+        sal_Int32 nBracketClose = aString.indexOf( ']' );
+        sal_Int32 nExclamation = aString.indexOf( '!' );
+        if( (0 == nBracketOpen) && (nBracketOpen + 1 < nBracketClose) && (nBracketClose + 1 == nExclamation) && (nExclamation + 1 < aString.getLength()) )
+        {
+            sal_Int32 nRefId = aString.copy( nBracketOpen + 1, nBracketClose - nBracketOpen - 1 ).toInt32();
+            const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId ).get();
+            if( pExtLink && (pExtLink->getLinkType() == LINKTYPE_LIBRARY) )
+                if( const FunctionInfo* pFuncInfo = getFuncInfoFromOoxFuncName( aString.copy( nExclamation + 1 ).toAsciiUpperCase() ) )
+                    if( (pFuncInfo->meFuncLibType != FUNCLIB_UNKNOWN) && (pFuncInfo->meFuncLibType == pExtLink->getFuncLibraryType()) )
+                        return pFuncInfo;
+        }
+    }
+    return 0;
+}
+
 bool FormulaParserImpl::isEmptyParameter( const ApiToken* pToken, const ApiToken* pTokenEnd ) const
 {
-    while( (pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_SPACES) ) ++pToken;
-    if( (pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_MISSING) ) ++pToken;
-    while( (pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_SPACES) ) ++pToken;
+    while( (pToken < pTokenEnd) && (pToken->OpCode == OPCODE_SPACES) ) ++pToken;
+    if( (pToken < pTokenEnd) && (pToken->OpCode == OPCODE_MISSING) ) ++pToken;
+    while( (pToken < pTokenEnd) && (pToken->OpCode == OPCODE_SPACES) ) ++pToken;
     return pToken == pTokenEnd;
 }
 
-OUString FormulaParserImpl::getExternCallParameter( const ApiToken* pToken, const ApiToken* pTokenEnd ) const
+const ApiToken* FormulaParserImpl::getExternCallToken( const ApiToken* pToken, const ApiToken* pTokenEnd ) const
+{
+    const ApiToken* pECToken = 0;
+    while( (pToken < pTokenEnd) && (pToken->OpCode == OPCODE_SPACES) ) ++pToken;
+    if( pToken < pTokenEnd ) pECToken = pToken++;
+    while( (pToken < pTokenEnd) && (pToken->OpCode == OPCODE_SPACES) ) ++pToken;
+    return (pToken == pTokenEnd) ? pECToken : 0;
+}
+
+const FunctionInfo* FormulaParserImpl::convertExternCallParam( ApiToken& orFuncToken, const ApiToken& rECToken ) const
+{
+    if( const FunctionInfo* pFuncInfo = getFuncInfoFromApiToken( rECToken ) )
+    {
+        orFuncToken.OpCode = pFuncInfo->mnApiOpCode;
+        // programmatic add-in function name
+        if( (pFuncInfo->mnApiOpCode == OPCODE_EXTERNAL) && (pFuncInfo->maExtProgName.getLength() > 0) )
+            orFuncToken.Data <<= pFuncInfo->maExtProgName;
+        // name of unsupported function, convert to OPCODE_BAD to preserve the name
+        else if( (pFuncInfo->mnApiOpCode == OPCODE_BAD) && (pFuncInfo->maOoxFuncName.getLength() > 0) )
+            orFuncToken.Data <<= pFuncInfo->maOoxFuncName;
+        return pFuncInfo;
+    }
+
+    if( (rECToken.OpCode == OPCODE_MACRO) || (rECToken.OpCode == OPCODE_BAD) )
+    {
+        // macro call or unknown function name, move data to function token
+        orFuncToken = rECToken;
+    }
+    else if( rECToken.OpCode == OPCODE_NAME )
+    {
+        // defined name used as function call, convert to OPCODE_BAD to preserve the name
+        sal_Int32 nTokenIndex = 0;
+        if( rECToken.Data >>= nTokenIndex )
 {
-    OUString aExtCallName;
-    while( (pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_SPACES) ) ++pToken;
-    if( (pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_MACRO) ) (pToken++)->Data >>= aExtCallName;
-    while( (pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_SPACES) ) ++pToken;
-    return (pToken == pTokenEnd) ? aExtCallName : OUString();
+            if( const DefinedName* pDefName = getDefinedNames().getByTokenIndex( nTokenIndex ).get() )
+            {
+                orFuncToken.OpCode = OPCODE_BAD;
+                orFuncToken.Data <<= pDefName->getDocName();
+            }
+        }
+    }
+    return 0;
 }
 
 const ApiToken* FormulaParserImpl::skipParentheses( const ApiToken* pToken, const ApiToken* pTokenEnd ) const
 {
     // skip tokens between OPCODE_OPEN and OPCODE_CLOSE
-    OSL_ENSURE( (pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_OPEN), "skipParentheses - OPCODE_OPEN expected" );
+    OSL_ENSURE( (pToken < pTokenEnd) && (pToken->OpCode == OPCODE_OPEN), "skipParentheses - OPCODE_OPEN expected" );
     ++pToken;
-    while( (pToken < pTokenEnd) && (pToken->OpCode != mrFuncProv.OPCODE_CLOSE) )
+    while( (pToken < pTokenEnd) && (pToken->OpCode != OPCODE_CLOSE) )
     {
-        if( pToken->OpCode == mrFuncProv.OPCODE_OPEN )
+        if( pToken->OpCode == OPCODE_OPEN )
             pToken = skipParentheses( pToken, pTokenEnd );
         else
             ++pToken;
     }
     // skip the OPCODE_CLOSE token
-    OSL_ENSURE( ((pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_CLOSE)) || ((pTokenEnd - 1)->OpCode == mrFuncProv.OPCODE_BAD), "skipParentheses - OPCODE_CLOSE expected" );
+    OSL_ENSURE( ((pToken < pTokenEnd) && (pToken->OpCode == OPCODE_CLOSE)) || ((pTokenEnd - 1)->OpCode == OPCODE_BAD), "skipParentheses - OPCODE_CLOSE expected" );
     return (pToken < pTokenEnd) ? (pToken + 1) : pTokenEnd;
 }
 
@@ -969,22 +1147,22 @@ const ApiToken* FormulaParserImpl::findP
         const ApiToken* pToken, const ApiToken* pTokenEnd ) const
 {
     // push position of OPCODE_OPEN
-    OSL_ENSURE( (pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_OPEN), "FormulaParserImpl::findParameters - OPCODE_OPEN expected" );
+    OSL_ENSURE( (pToken < pTokenEnd) && (pToken->OpCode == OPCODE_OPEN), "FormulaParserImpl::findParameters - OPCODE_OPEN expected" );
     rParams.push_back( pToken++ );
 
     // find positions of parameter separators
-    while( (pToken < pTokenEnd) && (pToken->OpCode != mrFuncProv.OPCODE_CLOSE) )
+    while( (pToken < pTokenEnd) && (pToken->OpCode != OPCODE_CLOSE) )
     {
-        if( pToken->OpCode == mrFuncProv.OPCODE_OPEN )
+        if( pToken->OpCode == OPCODE_OPEN )
             pToken = skipParentheses( pToken, pTokenEnd );
-        else if( pToken->OpCode == mrFuncProv.OPCODE_SEP )
+        else if( pToken->OpCode == OPCODE_SEP )
             rParams.push_back( pToken++ );
         else
             ++pToken;
     }
 
     // push position of OPCODE_CLOSE
-    OSL_ENSURE( ((pToken < pTokenEnd) && (pToken->OpCode == mrFuncProv.OPCODE_CLOSE)) || ((pTokenEnd - 1)->OpCode == mrFuncProv.OPCODE_BAD), "FormulaParserImpl::findParameters - OPCODE_CLOSE expected" );
+    OSL_ENSURE( ((pToken < pTokenEnd) && (pToken->OpCode == OPCODE_CLOSE)) || ((pTokenEnd - 1)->OpCode == OPCODE_BAD), "FormulaParserImpl::findParameters - OPCODE_CLOSE expected" );
     rParams.push_back( pToken );
     return (pToken < pTokenEnd) ? (pToken + 1) : pTokenEnd;
 }
@@ -997,8 +1175,8 @@ void FormulaParserImpl::appendCalcOnlyPa
         case OOBIN_FUNC_FLOOR:
         case OOBIN_FUNC_CEILING:
             OSL_ENSURE( nParam == 2, "FormulaParserImpl::appendCalcOnlyParameter - unexpected parameter index" );
-            appendFinalToken( mrFuncProv.OPCODE_PUSH ) <<= static_cast< double >( 1.0 );
-            appendFinalToken( mrFuncProv.OPCODE_SEP );
+            maTokenStorage.append< double >( OPCODE_PUSH, 1.0 );
+            maTokenStorage.append( OPCODE_SEP );
         break;
     }
 }
@@ -1010,8 +1188,8 @@ void FormulaParserImpl::appendRequiredPa
         case OOBIN_FUNC_WEEKNUM:
             if( nParamCount == 1 )
             {
-                appendFinalToken( mrFuncProv.OPCODE_PUSH ) <<= static_cast< double >( 1.0 );
-                appendFinalToken( mrFuncProv.OPCODE_SEP );
+                maTokenStorage.append< double >( OPCODE_PUSH, 1.0 );
+                maTokenStorage.append( OPCODE_SEP );
             }
         break;
     }
@@ -1019,31 +1197,22 @@ void FormulaParserImpl::appendRequiredPa
 
 void FormulaParserImpl::appendFinalToken( const ApiToken& rToken )
 {
-    if( (rToken.OpCode == mrFuncProv.OPCODE_MACRO) && !rToken.Data.hasValue() )
+    if( (rToken.OpCode == OPCODE_MACRO) && !rToken.Data.hasValue() )
     {
-        appendFinalToken( mrFuncProv.OPCODE_ARRAY_OPEN );
-        appendFinalToken( mrFuncProv.OPCODE_PUSH ) <<= BiffHelper::calcDoubleFromError( BIFF_ERR_NAME );
-        appendFinalToken( mrFuncProv.OPCODE_ARRAY_CLOSE );
+        maTokenStorage.append( OPCODE_ARRAY_OPEN );
+        maTokenStorage.append( OPCODE_PUSH, BiffHelper::calcDoubleFromError( BIFF_ERR_NAME ) );
+        maTokenStorage.append( OPCODE_ARRAY_CLOSE );
     }
     else
         maTokenStorage.push_back( rToken );
 }
 
-Any& FormulaParserImpl::appendFinalToken( sal_Int32 nOpCode )
-{
-    maTokenStorage.resize( maTokenStorage.size() + 1 );
-    maTokenStorage.back().OpCode = nOpCode;
-    return maTokenStorage.back().Data;
-}
-
 // OOX parser implementation ==================================================
 
 class OoxFormulaParserImpl : public FormulaParserImpl
 {
 public:
-    explicit            OoxFormulaParserImpl(
-                            const WorkbookHelper& rHelper,
-                            const FunctionProvider& rFuncProv );
+    explicit            OoxFormulaParserImpl( const OpCodeProvider& rOpCodeProv );
 
     virtual void        importOoxFormula(
                             FormulaContext& rContext,
@@ -1053,6 +1222,8 @@ public:
                             FormulaContext& rContext,
                             RecordInputStream& rStrm );
 
+    virtual OUString    printFormulaTokens( const ApiTokenSequence& rTokens );
+
 private:
     // import token contents and create API formula token ---------------------
 
@@ -1088,15 +1259,17 @@ private:
     Reference< XFormulaParser > mxParser;
     PropertySet         maParserProps;
     const OUString      maRefPosProp;
-    sal_Int32           mnAddDataPos;               /// Current stream position for additional data (tExp, tArray, tMemArea).
+    sal_Int64           mnAddDataPos;       /// Current stream position for additional data (tExp, tArray, tMemArea).
+    bool                mbNeedExtRefs;      /// True = parser needs initialization of external reference info.
 };
 
 // ----------------------------------------------------------------------------
 
-OoxFormulaParserImpl::OoxFormulaParserImpl( const WorkbookHelper& rHelper, const FunctionProvider& rFuncProv ) :
-    FormulaParserImpl( rHelper, rFuncProv ),
+OoxFormulaParserImpl::OoxFormulaParserImpl( const OpCodeProvider& rOpCodeProv ) :
+    FormulaParserImpl( rOpCodeProv ),
     maRefPosProp( CREATE_OUSTRING( "ReferencePosition" ) ),
-    mnAddDataPos( 0 )
+    mnAddDataPos( 0 ),
+    mbNeedExtRefs( true )
 {
     try
     {
@@ -1109,9 +1282,9 @@ OoxFormulaParserImpl::OoxFormulaParserIm
     OSL_ENSURE( mxParser.is(), "OoxFormulaParserImpl::OoxFormulaParserImpl - cannot create formula parser" );
     maParserProps.set( mxParser );
     maParserProps.setProperty( CREATE_OUSTRING( "CompileEnglish" ), true );
-    maParserProps.setProperty( CREATE_OUSTRING( "FormulaConvention" ), ::com::sun::star::sheet::AddressConvention::XL_A1 );
+    maParserProps.setProperty( CREATE_OUSTRING( "FormulaConvention" ), ::com::sun::star::sheet::AddressConvention::XL_OOX );
     maParserProps.setProperty( CREATE_OUSTRING( "IgnoreLeadingSpaces" ), false );
-    maParserProps.setProperty( CREATE_OUSTRING( "OpCodeMap" ), mrFuncProv.getOoxParserMap() );
+    maParserProps.setProperty( CREATE_OUSTRING( "OpCodeMap" ), getOoxParserMap() );
 }
 
 void OoxFormulaParserImpl::importOoxFormula(
@@ -1119,8 +1292,13 @@ void OoxFormulaParserImpl::importOoxForm
 {
     if( mxParser.is() )
     {
+        if( mbNeedExtRefs )
+        {
+            maParserProps.setProperty( CREATE_OUSTRING( "ExternalLinks" ), getExternalLinks().getLinkInfos() );
+            mbNeedExtRefs = false;
+        }
+        maParserProps.setProperty( maRefPosProp, rContext.getBaseAddress() );
         initializeImport( rContext );
-        maParserProps.setProperty( maRefPosProp, getFormulaContext().getBaseAddress() );
         finalizeImport( mxParser->parseFormula( rFormulaString ) );
     }
 }
@@ -1130,19 +1308,19 @@ void OoxFormulaParserImpl::importOobForm
     initializeImport( rContext );
 
     sal_Int32 nFmlaSize = rStrm.readInt32();
-    sal_Int32 nFmlaPos = rStrm.getRecPos();
-    sal_Int32 nFmlaEndPos = nFmlaPos + nFmlaSize;
+    sal_Int64 nFmlaPos = rStrm.tell();
+    sal_Int64 nFmlaEndPos = nFmlaPos + nFmlaSize;
 
     rStrm.seek( nFmlaEndPos );
     sal_Int32 nAddDataSize = rStrm.readInt32();
-    mnAddDataPos = rStrm.getRecPos();
-    sal_Int32 nAddDataEndPos = mnAddDataPos + nAddDataSize;
+    mnAddDataPos = rStrm.tell();
+    sal_Int64 nAddDataEndPos = mnAddDataPos + nAddDataSize;
     rStrm.seek( nFmlaPos );
 
     bool bOk = (nFmlaSize >= 0) && (nAddDataSize >= 0);
     bool bRelativeAsOffset = getFormulaContext().isRelativeAsOffset();
 
-    while( bOk && rStrm.isValid() && (rStrm.getRecPos() < nFmlaEndPos) )
+    while( bOk && !rStrm.isEof() && (rStrm.tell() < nFmlaEndPos) )
     {
         sal_uInt8 nTokenId;
         rStrm >> nTokenId;
@@ -1155,31 +1333,31 @@ void OoxFormulaParserImpl::importOobForm
             switch( nBaseId )
             {
                 case BIFF_TOKID_EXP:        bOk = importExpToken( rStrm );                                      break;
-                case BIFF_TOKID_ADD:        bOk = pushBinaryOperator( mrFuncProv.OPCODE_ADD );                  break;
-                case BIFF_TOKID_SUB:        bOk = pushBinaryOperator( mrFuncProv.OPCODE_SUB );                  break;
-                case BIFF_TOKID_MUL:        bOk = pushBinaryOperator( mrFuncProv.OPCODE_MULT );                 break;
-                case BIFF_TOKID_DIV:        bOk = pushBinaryOperator( mrFuncProv.OPCODE_DIV );                  break;
-                case BIFF_TOKID_POWER:      bOk = pushBinaryOperator( mrFuncProv.OPCODE_POWER );                break;
-                case BIFF_TOKID_CONCAT:     bOk = pushBinaryOperator( mrFuncProv.OPCODE_CONCAT );               break;
-                case BIFF_TOKID_LT:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_LESS );                 break;
-                case BIFF_TOKID_LE:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_LESS_EQUAL );           break;
-                case BIFF_TOKID_EQ:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_EQUAL );                break;
-                case BIFF_TOKID_GE:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_GREATER_EQUAL );        break;
-                case BIFF_TOKID_GT:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_GREATER );              break;
-                case BIFF_TOKID_NE:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_NOT_EQUAL );            break;
-                case BIFF_TOKID_ISECT:      bOk = pushBinaryOperator( mrFuncProv.OPCODE_INTERSECT );            break;
-                case BIFF_TOKID_LIST:       bOk = pushBinaryOperator( mrFuncProv.OPCODE_LIST );                 break;
-                case BIFF_TOKID_RANGE:      bOk = pushBinaryOperator( mrFuncProv.OPCODE_RANGE );                break;
-                case BIFF_TOKID_UPLUS:      bOk = pushUnaryPreOperator( mrFuncProv.OPCODE_PLUS_SIGN );          break;
-                case BIFF_TOKID_UMINUS:     bOk = pushUnaryPreOperator( mrFuncProv.OPCODE_MINUS_SIGN );         break;
-                case BIFF_TOKID_PERCENT:    bOk = pushUnaryPostOperator( mrFuncProv.OPCODE_PERCENT );           break;
+                case BIFF_TOKID_ADD:        bOk = pushBinaryOperator( OPCODE_ADD );                 break;
+                case BIFF_TOKID_SUB:        bOk = pushBinaryOperator( OPCODE_SUB );                 break;
+                case BIFF_TOKID_MUL:        bOk = pushBinaryOperator( OPCODE_MULT );                break;
+                case BIFF_TOKID_DIV:        bOk = pushBinaryOperator( OPCODE_DIV );                 break;
+                case BIFF_TOKID_POWER:      bOk = pushBinaryOperator( OPCODE_POWER );               break;
+                case BIFF_TOKID_CONCAT:     bOk = pushBinaryOperator( OPCODE_CONCAT );              break;
+                case BIFF_TOKID_LT:         bOk = pushBinaryOperator( OPCODE_LESS );                break;
+                case BIFF_TOKID_LE:         bOk = pushBinaryOperator( OPCODE_LESS_EQUAL );          break;
+                case BIFF_TOKID_EQ:         bOk = pushBinaryOperator( OPCODE_EQUAL );               break;
+                case BIFF_TOKID_GE:         bOk = pushBinaryOperator( OPCODE_GREATER_EQUAL );       break;
+                case BIFF_TOKID_GT:         bOk = pushBinaryOperator( OPCODE_GREATER );             break;
+                case BIFF_TOKID_NE:         bOk = pushBinaryOperator( OPCODE_NOT_EQUAL );           break;
+                case BIFF_TOKID_ISECT:      bOk = pushBinaryOperator( OPCODE_INTERSECT );           break;
+                case BIFF_TOKID_LIST:       bOk = pushBinaryOperator( OPCODE_LIST );                break;
+                case BIFF_TOKID_RANGE:      bOk = pushBinaryOperator( OPCODE_RANGE );               break;
+                case BIFF_TOKID_UPLUS:      bOk = pushUnaryPreOperator( OPCODE_PLUS_SIGN );         break;
+                case BIFF_TOKID_UMINUS:     bOk = pushUnaryPreOperator( OPCODE_MINUS_SIGN );        break;
+                case BIFF_TOKID_PERCENT:    bOk = pushUnaryPostOperator( OPCODE_PERCENT );          break;
                 case BIFF_TOKID_PAREN:      bOk = pushParenthesesOperator();                                    break;
-                case BIFF_TOKID_MISSARG:    bOk = pushOperand( mrFuncProv.OPCODE_MISSING );                     break;
+                case BIFF_TOKID_MISSARG:    bOk = pushOperand( OPCODE_MISSING );                    break;
                 case BIFF_TOKID_STR:        bOk = pushValueOperand( rStrm.readString( false ) );                break;
                 case BIFF_TOKID_NLR:        bOk = importTableToken( rStrm );                                    break;
                 case BIFF_TOKID_ATTR:       bOk = importAttrToken( rStrm );                                     break;
                 case BIFF_TOKID_ERR:        bOk = pushBiffErrorOperand( rStrm.readuInt8() );                    break;
-                case BIFF_TOKID_BOOL:       bOk = pushBoolOperand( rStrm.readuInt8() != BIFF_TOK_BOOL_FALSE );  break;
+                case BIFF_TOKID_BOOL:       bOk = pushBiffBoolOperand( rStrm.readuInt8() );         break;
                 case BIFF_TOKID_INT:        bOk = pushValueOperand< double >( rStrm.readuInt16() );             break;
                 case BIFF_TOKID_NUM:        bOk = pushValueOperand( rStrm.readDouble() );                       break;
                 default:                    bOk = false;
@@ -1217,7 +1395,7 @@ void OoxFormulaParserImpl::importOobForm
     }
 
     // build and finalize the token sequence
-    if( bOk && (rStrm.getRecPos() == nFmlaEndPos) && (mnAddDataPos == nAddDataEndPos) )
+    if( bOk && (rStrm.tell() == nFmlaEndPos) && (mnAddDataPos == nAddDataEndPos) )
         finalizeImport();
 
     // seek behind token array
@@ -1225,6 +1403,17 @@ void OoxFormulaParserImpl::importOobForm
         rStrm.seek( nAddDataEndPos );
 }
 
+OUString OoxFormulaParserImpl::printFormulaTokens( ApiTokenSequence const& rTokens )
+{
+    sal_Int16 saveFC;
+    OUString const FormulaConvention = CREATE_OUSTRING( "FormulaConvention" );
+    maParserProps.getProperty( saveFC, FormulaConvention );
+    maParserProps.setProperty( FormulaConvention, ::com::sun::star::sheet::AddressConvention::OOO );
+    OUString oooTokens = mxParser->printFormula( rTokens );
+    maParserProps.setProperty( FormulaConvention, saveFC );
+    return oooTokens;
+}
+
 // import token contents and create API formula token -------------------------
 
 bool OoxFormulaParserImpl::importAttrToken( RecordInputStream& rStrm )
@@ -1267,16 +1456,22 @@ bool OoxFormulaParserImpl::importSpaceTo
     switch( nType )
     {
         case BIFF_TOK_ATTR_SPACE_SP:
+            appendLeadingSpaces( nCount, false );
+        break;
         case BIFF_TOK_ATTR_SPACE_BR:
-            incLeadingSpaces( nCount );
+            appendLeadingSpaces( nCount, true );
         break;
         case BIFF_TOK_ATTR_SPACE_SP_OPEN:
+            appendOpeningSpaces( nCount, false );
+        break;
         case BIFF_TOK_ATTR_SPACE_BR_OPEN:
-            incOpeningSpaces( nCount );
+            appendOpeningSpaces( nCount, true );
         break;
         case BIFF_TOK_ATTR_SPACE_SP_CLOSE:
+            appendClosingSpaces( nCount, false );
+        break;
         case BIFF_TOK_ATTR_SPACE_BR_CLOSE:
-            incClosingSpaces( nCount );
+            appendClosingSpaces( nCount, true );
         break;
     }
     return true;
@@ -1376,31 +1571,31 @@ bool OoxFormulaParserImpl::importTableTo
         {
             // push single database area token, if table token refers to entire table
             if( (nStartCol == 0) && (nEndCol + 1 == nWidth) && (nStartRow == 0) && (nEndRow + 1 == nHeight) )
-                return pushValueOperand( nTokenIndex, mrFuncProv.OPCODE_DBAREA );
+                return pushValueOperand( nTokenIndex, OPCODE_DBAREA );
             // create an OFFSET function call to refer to a subrange of the table
-            const FunctionInfo* pRowsInfo = mrFuncProv.getFuncInfoFromOobFuncId( OOBIN_FUNC_ROWS );
-            const FunctionInfo* pColumnsInfo = mrFuncProv.getFuncInfoFromOobFuncId( OOBIN_FUNC_COLUMNS );
+            const FunctionInfo* pRowsInfo = getFuncInfoFromOobFuncId( OOBIN_FUNC_ROWS );
+            const FunctionInfo* pColumnsInfo = getFuncInfoFromOobFuncId( OOBIN_FUNC_COLUMNS );
             return
                 pRowsInfo && pColumnsInfo &&
-                pushValueOperandToken( nTokenIndex, mrFuncProv.OPCODE_DBAREA, 0 ) &&
+                pushValueOperandToken( nTokenIndex, OPCODE_DBAREA ) &&
                 (bFixedStartRow ?
-                    pushValueOperandToken< double >( nStartRow, 0 ) :
-                    (pushValueOperandToken( nTokenIndex, mrFuncProv.OPCODE_DBAREA, 0 ) &&
-                     pushFunctionOperatorToken( *pRowsInfo, 1, 0, 0 ) &&
-                     pushValueOperandToken< double >( nHeight - nStartRow, 0 ) &&
-                     pushBinaryOperatorToken( mrFuncProv.OPCODE_SUB, 0 ))) &&
-                pushValueOperandToken< double >( nStartCol, 0 ) &&
+                    pushValueOperandToken< double >( nStartRow ) :
+                    (pushValueOperandToken( nTokenIndex, OPCODE_DBAREA ) &&
+                     pushFunctionOperatorToken( *pRowsInfo, 1 ) &&
+                     pushValueOperandToken< double >( nHeight - nStartRow ) &&
+                     pushBinaryOperatorToken( OPCODE_SUB ))) &&
+                pushValueOperandToken< double >( nStartCol ) &&
                 (bFixedHeight ?
-                    pushValueOperandToken< double >( nEndRow - nStartRow + 1, 0 ) :
-                    (pushValueOperandToken( nTokenIndex, mrFuncProv.OPCODE_DBAREA, 0 ) &&
-                     pushFunctionOperatorToken( *pRowsInfo, 1, 0, 0 ) &&
+                    pushValueOperandToken< double >( nEndRow - nStartRow + 1 ) :
+                    (pushValueOperandToken( nTokenIndex, OPCODE_DBAREA ) &&
+                     pushFunctionOperatorToken( *pRowsInfo, 1 ) &&
                      (((nStartRow == 0) && (nEndRow + 1 == nHeight)) ||
-                      (pushValueOperandToken< double >( nHeight - (nEndRow - nStartRow + 1), 0 ) &&
-                       pushBinaryOperatorToken( mrFuncProv.OPCODE_SUB, 0 ))))) &&
+                      (pushValueOperandToken< double >( nHeight - (nEndRow - nStartRow + 1) ) &&
+                       pushBinaryOperatorToken( OPCODE_SUB ))))) &&
                 (((nStartCol == 0) && (nEndCol + 1 == nWidth)) ?
-                    (pushValueOperandToken( nTokenIndex, mrFuncProv.OPCODE_DBAREA, 0 ) &&
-                     pushFunctionOperatorToken( *pColumnsInfo, 1, 0, 0 )) :
-                    pushValueOperandToken< double >( nEndCol - nStartCol + 1, 0 )) &&
+                    (pushValueOperandToken( nTokenIndex, OPCODE_DBAREA ) &&
+                     pushFunctionOperatorToken( *pColumnsInfo, 1 )) :
+                    pushValueOperandToken< double >( nEndCol - nStartCol + 1 )) &&
                 pushOobFunction( OOBIN_FUNC_OFFSET, 5 );
         }
     }
@@ -1412,7 +1607,7 @@ bool OoxFormulaParserImpl::importArrayTo
     rStrm.skip( 14 );
 
     // start token array with opening brace and leading spaces
-    pushOperand( mrFuncProv.OPCODE_ARRAY_OPEN );
+    pushOperand( OPCODE_ARRAY_OPEN );
     size_t nOpSize = popOperandSize();
     size_t nOldArraySize = getFormulaSize();
 
@@ -1423,39 +1618,39 @@ bool OoxFormulaParserImpl::importArrayTo
     OSL_ENSURE( (nCols > 0) && (nRows > 0), "OoxFormulaParserImpl::importArrayToken - empty array" );
 
     // read array values and build token array
-    for( sal_Int32 nRow = 0; rStrm.isValid() && (nRow < nRows); ++nRow )
+    for( sal_Int32 nRow = 0; !rStrm.isEof() && (nRow < nRows); ++nRow )
     {
         if( nRow > 0 )
-            appendRawToken( mrFuncProv.OPCODE_ARRAY_ROWSEP );
-        for( sal_Int32 nCol = 0; rStrm.isValid() && (nCol < nCols); ++nCol )
+            appendRawToken( OPCODE_ARRAY_ROWSEP );
+        for( sal_Int32 nCol = 0; !rStrm.isEof() && (nCol < nCols); ++nCol )
         {
             if( nCol > 0 )
-                appendRawToken( mrFuncProv.OPCODE_ARRAY_COLSEP );
+                appendRawToken( OPCODE_ARRAY_COLSEP );
             switch( rStrm.readuInt8() )
             {
                 case OOBIN_TOK_ARRAY_DOUBLE:
-                    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= rStrm.readDouble();
+                    appendRawToken( OPCODE_PUSH ) <<= rStrm.readDouble();
                 break;
                 case OOBIN_TOK_ARRAY_STRING:
-                    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= rStrm.readString( false );
+                    appendRawToken( OPCODE_PUSH ) <<= rStrm.readString( false );
                 break;
                 case OOBIN_TOK_ARRAY_BOOL:
-                    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= static_cast< double >( (rStrm.readuInt8() == 0) ? 0.0 : 1.0 );
+                    appendRawToken( OPCODE_PUSH ) <<= static_cast< double >( (rStrm.readuInt8() == BIFF_TOK_BOOL_FALSE) ? 0.0 : 1.0 );
                 break;
                 case OOBIN_TOK_ARRAY_ERROR:
-                    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= BiffHelper::calcDoubleFromError( rStrm.readuInt8() );
+                    appendRawToken( OPCODE_PUSH ) <<= BiffHelper::calcDoubleFromError( rStrm.readuInt8() );
                     rStrm.skip( 3 );
                 break;
                 default:
                     OSL_ENSURE( false, "OoxFormulaParserImpl::importArrayToken - unknown data type" );
-                    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= BiffHelper::calcDoubleFromError( BIFF_ERR_NA );
+                    appendRawToken( OPCODE_PUSH ) <<= BiffHelper::calcDoubleFromError( BIFF_ERR_NA );
             }
         }
     }
     swapStreamPosition( rStrm );
 
     // close token array and set resulting operand size
-    appendRawToken( mrFuncProv.OPCODE_ARRAY_CLOSE );
+    appendRawToken( OPCODE_ARRAY_CLOSE );
     pushOperandSize( nOpSize + getFormulaSize() - nOldArraySize );
     return true;
 }
@@ -1550,7 +1745,7 @@ LinkSheetRange OoxFormulaParserImpl::rea
 
 void OoxFormulaParserImpl::swapStreamPosition( RecordInputStream& rStrm )
 {
-    sal_Int32 nRecPos = rStrm.getRecPos();
+    sal_Int64 nRecPos = rStrm.tell();
     rStrm.seek( mnAddDataPos );
     mnAddDataPos = nRecPos;
 }
@@ -1578,26 +1773,26 @@ bool OoxFormulaParserImpl::pushOobExtNam
             return pushOobName( nNameId );
             // external name indexes are one-based in OOBIN
         ExternalNameRef xExtName = pExtLink->getNameByIndex( nNameId - 1 );
-        return pushExternalNameOperand( xExtName, pExtLink->getLinkType() );
+        return pushExternalNameOperand( xExtName, *pExtLink );
     }
     return pushBiffErrorOperand( BIFF_ERR_NAME );
 }
 
 bool OoxFormulaParserImpl::pushOobFunction( sal_uInt16 nFuncId )
 {
-    if( const FunctionInfo* pFuncInfo = mrFuncProv.getFuncInfoFromOobFuncId( nFuncId ) )
+    if( const FunctionInfo* pFuncInfo = getFuncInfoFromOobFuncId( nFuncId ) )
         if( pFuncInfo->mnMinParamCount == pFuncInfo->mnMaxParamCount )
             return pushFunctionOperator( *pFuncInfo, pFuncInfo->mnMinParamCount );
-    return pushFunctionOperator( mrFuncProv.OPCODE_NONAME, 0 );
+    return pushFunctionOperator( OPCODE_NONAME, 0 );
 }
 
 bool OoxFormulaParserImpl::pushOobFunction( sal_uInt16 nFuncId, sal_uInt8 nParamCount )
 {
     if( getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD ) )
         nParamCount &= BIFF_TOK_FUNCVAR_COUNTMASK;
-    if( const FunctionInfo* pFuncInfo = mrFuncProv.getFuncInfoFromOobFuncId( nFuncId ) )
+    if( const FunctionInfo* pFuncInfo = getFuncInfoFromOobFuncId( nFuncId ) )
         return pushFunctionOperator( *pFuncInfo, nParamCount );
-    return pushFunctionOperator( mrFuncProv.OPCODE_NONAME, nParamCount );
+    return pushFunctionOperator( OPCODE_NONAME, nParamCount );
 }
 
 // BIFF parser implementation =================================================
@@ -1653,9 +1848,7 @@ bool lclIsValidNlrRange( const BiffNlr& 
 class BiffFormulaParserImpl : public FormulaParserImpl
 {
 public:
-    explicit            BiffFormulaParserImpl(
-                            const WorkbookHelper& rHelper,
-                            const FunctionProvider& rFuncProv );
+    explicit            BiffFormulaParserImpl( const OpCodeProvider& rOpCodeProv );
 
     virtual void        importBiffFormula(
                             FormulaContext& rContext,
@@ -1744,7 +1937,7 @@ private:
     ImportTokenFunc     mpImportFuncVarToken;       /// Pointer to tFuncVar import function (function with variable parameter count).
     ImportTokenFunc     mpImportFuncCEToken;        /// Pointer to tFuncCE import function (command macro call).
     ImportTokenFunc     mpImportExpToken;           /// Pointer to tExp import function (array/shared formula).
-    sal_uInt32          mnAddDataPos;               /// Current stream position for additional data (tArray, tMemArea, tNlr).
+    sal_Int64           mnAddDataPos;               /// Current stream position for additional data (tArray, tMemArea, tNlr).
     sal_Int32           mnCurrRefId;                /// Current ref-id from tSheet token (BIFF2-BIFF4 only).
     sal_uInt16          mnAttrDataSize;             /// Size of one tAttr data element.
     sal_uInt16          mnArraySize;                /// Size of tArray data.
@@ -1756,8 +1949,8 @@ private:
 
 // ----------------------------------------------------------------------------
 
-BiffFormulaParserImpl::BiffFormulaParserImpl( const WorkbookHelper& rHelper, const FunctionProvider& rFuncProv ) :
-    FormulaParserImpl( rHelper, rFuncProv ),
+BiffFormulaParserImpl::BiffFormulaParserImpl( const OpCodeProvider& rOpCodeProv ) :
+    FormulaParserImpl( rOpCodeProv ),
     mnAddDataPos( 0 ),
     mnCurrRefId( 0 )
 {
@@ -1884,11 +2077,11 @@ void BiffFormulaParserImpl::importBiffFo
     mnCurrRefId = 0;
 
     sal_uInt16 nFmlaSize = pnFmlaSize ? *pnFmlaSize : ((getBiff() == BIFF2) ? rStrm.readuInt8() : rStrm.readuInt16());
-    sal_uInt32 nEndPos = mnAddDataPos = rStrm.getRecPos() + nFmlaSize;
+    sal_Int64 nEndPos = mnAddDataPos = rStrm.tell() + nFmlaSize;
     bool bRelativeAsOffset = getFormulaContext().isRelativeAsOffset();
 
     bool bOk = true;
-    while( bOk && rStrm.isValid() && (rStrm.getRecPos() < nEndPos) )
+    while( bOk && !rStrm.isEof() && (rStrm.tell() < nEndPos) )
     {
         sal_uInt8 nTokenId;
         rStrm >> nTokenId;
@@ -1902,33 +2095,33 @@ void BiffFormulaParserImpl::importBiffFo
             {
                 case BIFF_TOKID_EXP:        bOk = (this->*mpImportExpToken)( rStrm );                           break;
                 case BIFF_TOKID_TBL:        bOk = false; /* multiple op. will be set externally */              break;
-                case BIFF_TOKID_ADD:        bOk = pushBinaryOperator( mrFuncProv.OPCODE_ADD );                  break;
-                case BIFF_TOKID_SUB:        bOk = pushBinaryOperator( mrFuncProv.OPCODE_SUB );                  break;
-                case BIFF_TOKID_MUL:        bOk = pushBinaryOperator( mrFuncProv.OPCODE_MULT );                 break;
-                case BIFF_TOKID_DIV:        bOk = pushBinaryOperator( mrFuncProv.OPCODE_DIV );                  break;
-                case BIFF_TOKID_POWER:      bOk = pushBinaryOperator( mrFuncProv.OPCODE_POWER );                break;
-                case BIFF_TOKID_CONCAT:     bOk = pushBinaryOperator( mrFuncProv.OPCODE_CONCAT );               break;
-                case BIFF_TOKID_LT:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_LESS );                 break;
-                case BIFF_TOKID_LE:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_LESS_EQUAL );           break;
-                case BIFF_TOKID_EQ:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_EQUAL );                break;
-                case BIFF_TOKID_GE:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_GREATER_EQUAL );        break;
-                case BIFF_TOKID_GT:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_GREATER );              break;
-                case BIFF_TOKID_NE:         bOk = pushBinaryOperator( mrFuncProv.OPCODE_NOT_EQUAL );            break;
-                case BIFF_TOKID_ISECT:      bOk = pushBinaryOperator( mrFuncProv.OPCODE_INTERSECT );            break;
-                case BIFF_TOKID_LIST:       bOk = pushBinaryOperator( mrFuncProv.OPCODE_LIST );                 break;
-                case BIFF_TOKID_RANGE:      bOk = pushBinaryOperator( mrFuncProv.OPCODE_RANGE );                break;
-                case BIFF_TOKID_UPLUS:      bOk = pushUnaryPreOperator( mrFuncProv.OPCODE_PLUS_SIGN );          break;
-                case BIFF_TOKID_UMINUS:     bOk = pushUnaryPreOperator( mrFuncProv.OPCODE_MINUS_SIGN );         break;
-                case BIFF_TOKID_PERCENT:    bOk = pushUnaryPostOperator( mrFuncProv.OPCODE_PERCENT );           break;
+                case BIFF_TOKID_ADD:        bOk = pushBinaryOperator( OPCODE_ADD );                 break;
+                case BIFF_TOKID_SUB:        bOk = pushBinaryOperator( OPCODE_SUB );                 break;
+                case BIFF_TOKID_MUL:        bOk = pushBinaryOperator( OPCODE_MULT );                break;
+                case BIFF_TOKID_DIV:        bOk = pushBinaryOperator( OPCODE_DIV );                 break;
+                case BIFF_TOKID_POWER:      bOk = pushBinaryOperator( OPCODE_POWER );               break;
+                case BIFF_TOKID_CONCAT:     bOk = pushBinaryOperator( OPCODE_CONCAT );              break;
+                case BIFF_TOKID_LT:         bOk = pushBinaryOperator( OPCODE_LESS );                break;
+                case BIFF_TOKID_LE:         bOk = pushBinaryOperator( OPCODE_LESS_EQUAL );          break;
+                case BIFF_TOKID_EQ:         bOk = pushBinaryOperator( OPCODE_EQUAL );               break;
+                case BIFF_TOKID_GE:         bOk = pushBinaryOperator( OPCODE_GREATER_EQUAL );       break;
+                case BIFF_TOKID_GT:         bOk = pushBinaryOperator( OPCODE_GREATER );             break;
+                case BIFF_TOKID_NE:         bOk = pushBinaryOperator( OPCODE_NOT_EQUAL );           break;
+                case BIFF_TOKID_ISECT:      bOk = pushBinaryOperator( OPCODE_INTERSECT );           break;
+                case BIFF_TOKID_LIST:       bOk = pushBinaryOperator( OPCODE_LIST );                break;
+                case BIFF_TOKID_RANGE:      bOk = pushBinaryOperator( OPCODE_RANGE );               break;
+                case BIFF_TOKID_UPLUS:      bOk = pushUnaryPreOperator( OPCODE_PLUS_SIGN );         break;
+                case BIFF_TOKID_UMINUS:     bOk = pushUnaryPreOperator( OPCODE_MINUS_SIGN );        break;
+                case BIFF_TOKID_PERCENT:    bOk = pushUnaryPostOperator( OPCODE_PERCENT );          break;
                 case BIFF_TOKID_PAREN:      bOk = pushParenthesesOperator();                                    break;
-                case BIFF_TOKID_MISSARG:    bOk = pushOperand( mrFuncProv.OPCODE_MISSING );                     break;
+                case BIFF_TOKID_MISSARG:    bOk = pushOperand( OPCODE_MISSING );                    break;
                 case BIFF_TOKID_STR:        bOk = (this->*mpImportStrToken)( rStrm );                           break;
                 case BIFF_TOKID_NLR:        bOk = (this->*mpImportNlrToken)( rStrm );                           break;
                 case BIFF_TOKID_ATTR:       bOk = importAttrToken( rStrm );                                     break;
                 case BIFF_TOKID_SHEET:      bOk = (this->*mpImportSheetToken)( rStrm );                         break;
                 case BIFF_TOKID_ENDSHEET:   bOk = (this->*mpImportEndSheetToken)( rStrm );                      break;
                 case BIFF_TOKID_ERR:        bOk = pushBiffErrorOperand( rStrm.readuInt8() );                    break;
-                case BIFF_TOKID_BOOL:       bOk = pushBoolOperand( rStrm.readuInt8() != BIFF_TOK_BOOL_FALSE );  break;
+                case BIFF_TOKID_BOOL:       bOk = pushBiffBoolOperand( rStrm.readuInt8() );         break;
                 case BIFF_TOKID_INT:        bOk = pushValueOperand< double >( rStrm.readuInt16() );             break;
                 case BIFF_TOKID_NUM:        bOk = pushValueOperand( rStrm.readDouble() );                       break;
                 default:                    bOk = false;
@@ -1967,7 +2160,7 @@ void BiffFormulaParserImpl::importBiffFo
     }
 
     // build and finalize the token sequence
-    if( bOk && (rStrm.getRecPos() == nEndPos) )
+    if( bOk && (rStrm.tell() == nEndPos) )
         finalizeImport();
 
     // seek behind additional token data of tArray, tMemArea, tNlr tokens
@@ -2042,16 +2235,22 @@ bool BiffFormulaParserImpl::importSpaceT
     switch( nType )
     {
         case BIFF_TOK_ATTR_SPACE_SP:
+            appendLeadingSpaces( nCount, false );
+        break;
         case BIFF_TOK_ATTR_SPACE_BR:
-            incLeadingSpaces( nCount );
+            appendLeadingSpaces( nCount, true );
         break;
         case BIFF_TOK_ATTR_SPACE_SP_OPEN:
+            appendOpeningSpaces( nCount, false );
+        break;
         case BIFF_TOK_ATTR_SPACE_BR_OPEN:
-            incOpeningSpaces( nCount );
+            appendOpeningSpaces( nCount, true );
         break;
         case BIFF_TOK_ATTR_SPACE_SP_CLOSE:
+            appendClosingSpaces( nCount, false );
+        break;
         case BIFF_TOK_ATTR_SPACE_BR_CLOSE:
-            incClosingSpaces( nCount );
+            appendClosingSpaces( nCount, true );
         break;
     }
     return true;
@@ -2115,7 +2314,7 @@ bool BiffFormulaParserImpl::importArrayT
     rStrm.skip( mnArraySize );
 
     // start token array with opening brace and leading spaces
-    pushOperand( mrFuncProv.OPCODE_ARRAY_OPEN );
+    pushOperand( OPCODE_ARRAY_OPEN );
     size_t nOpSize = popOperandSize();
     size_t nOldArraySize = getFormulaSize();
     bool bBiff8 = getBiff() == BIFF8;
@@ -2128,46 +2327,46 @@ bool BiffFormulaParserImpl::importArrayT
     OSL_ENSURE( (nCols > 0) && (nRows > 0), "BiffFormulaParserImpl::importArrayToken - empty array" );
 
     // read array values and build token array
-    for( sal_uInt16 nRow = 0; rStrm.isValid() && (nRow < nRows); ++nRow )
+    for( sal_uInt16 nRow = 0; !rStrm.isEof() && (nRow < nRows); ++nRow )
     {
         if( nRow > 0 )
-            appendRawToken( mrFuncProv.OPCODE_ARRAY_ROWSEP );
-        for( sal_uInt16 nCol = 0; rStrm.isValid() && (nCol < nCols); ++nCol )
+            appendRawToken( OPCODE_ARRAY_ROWSEP );
+        for( sal_uInt16 nCol = 0; !rStrm.isEof() && (nCol < nCols); ++nCol )
         {
             if( nCol > 0 )
-                appendRawToken( mrFuncProv.OPCODE_ARRAY_COLSEP );
+                appendRawToken( OPCODE_ARRAY_COLSEP );
             switch( rStrm.readuInt8() )
             {
                 case BIFF_DATATYPE_EMPTY:
-                    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= OUString();
+                    appendRawToken( OPCODE_PUSH ) <<= OUString();
                     rStrm.skip( 8 );
                 break;
                 case BIFF_DATATYPE_DOUBLE:
-                    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= rStrm.readDouble();
+                    appendRawToken( OPCODE_PUSH ) <<= rStrm.readDouble();
                 break;
                 case BIFF_DATATYPE_STRING:
-                    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= bBiff8 ?
+                    appendRawToken( OPCODE_PUSH ) <<= bBiff8 ?
                         rStrm.readUniString() :
                         rStrm.readByteString( false, getTextEncoding() );
                 break;
                 case BIFF_DATATYPE_BOOL:
-                    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= static_cast< double >( (rStrm.readuInt8() == 0) ? 0.0 : 1.0 );
+                    appendRawToken( OPCODE_PUSH ) <<= static_cast< double >( (rStrm.readuInt8() == BIFF_TOK_BOOL_FALSE) ? 0.0 : 1.0 );
                     rStrm.skip( 7 );
                 break;
                 case BIFF_DATATYPE_ERROR:
-                    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= BiffHelper::calcDoubleFromError( rStrm.readuInt8() );
+                    appendRawToken( OPCODE_PUSH ) <<= BiffHelper::calcDoubleFromError( rStrm.readuInt8() );
                     rStrm.skip( 7 );
                 break;
                 default:
                     OSL_ENSURE( false, "BiffFormulaParserImpl::importArrayToken - unknown data type" );
-                    appendRawToken( mrFuncProv.OPCODE_PUSH ) <<= BiffHelper::calcDoubleFromError( BIFF_ERR_NA );
+                    appendRawToken( OPCODE_PUSH ) <<= BiffHelper::calcDoubleFromError( BIFF_ERR_NA );
             }
         }
     }
     swapStreamPosition( rStrm );
 
     // close token array and set resulting operand size
-    appendRawToken( mrFuncProv.OPCODE_ARRAY_CLOSE );
+    appendRawToken( OPCODE_ARRAY_CLOSE );
     pushOperandSize( nOpSize + getFormulaSize() - nOldArraySize );
     return true;
 }
@@ -2377,7 +2576,7 @@ LinkSheetRange BiffFormulaParserImpl::re
 
 void BiffFormulaParserImpl::swapStreamPosition( BiffInputStream& rStrm )
 {
-    sal_uInt32 nRecPos = rStrm.getRecPos();
+    sal_Int64 nRecPos = rStrm.tell();
     rStrm.seek( mnAddDataPos );
     mnAddDataPos = nRecPos;
 }
@@ -2385,7 +2584,7 @@ void BiffFormulaParserImpl::swapStreamPo
 void BiffFormulaParserImpl::skipMemAreaAddData( BiffInputStream& rStrm )
 {
     swapStreamPosition( rStrm );
-    sal_uInt32 nCount = rStrm.readuInt16();
+    sal_Int32 nCount = rStrm.readuInt16();
     rStrm.skip( ((getBiff() == BIFF8) ? 8 : 6) * nCount );
     swapStreamPosition( rStrm );
 }
@@ -2404,7 +2603,7 @@ bool BiffFormulaParserImpl::readNlrSRang
     rStrm >> nCount;
     bool bRel = getFlag( nCount, BIFF_TOK_NLR_ADDREL );
     nCount &= BIFF_TOK_NLR_ADDMASK;
-    sal_uInt32 nEndPos = rStrm.getRecPos() + 4 * nCount;
+    sal_Int64 nEndPos = rStrm.tell() + 4 * nCount;
     // read list of cell addresses
     bool bValid = false;
     if( nCount >= 2 )
@@ -2419,7 +2618,7 @@ bool BiffFormulaParserImpl::readNlrSRang
         {
             aAddr1 = aAddr2;
             rStrm >> aAddr2;
-            bValid = rStrm.isValid() && lclIsValidNlrStack( aAddr1, aAddr2, orbIsRow );
+            bValid = !rStrm.isEof() && lclIsValidNlrStack( aAddr1, aAddr2, orbIsRow );
         }
         // check that last imported position (aAddr2) is not at the end of the sheet
         bValid = bValid && (orbIsRow ? (aAddr2.mnCol < mnMaxApiCol) : (aAddr2.mnRow < mnMaxApiRow));
@@ -2511,26 +2710,26 @@ bool BiffFormulaParserImpl::pushBiffExtN
             return pushBiffName( nNameId );
         // external name indexes are one-based in BIFF
         ExternalNameRef xExtName = pExtLink->getNameByIndex( static_cast< sal_Int32 >( nNameId ) - 1 );
-        return pushExternalNameOperand( xExtName, pExtLink->getLinkType() );
+        return pushExternalNameOperand( xExtName, *pExtLink );
     }
     return pushBiffErrorOperand( BIFF_ERR_NAME );
 }
 
 bool BiffFormulaParserImpl::pushBiffFunction( sal_uInt16 nFuncId )
 {
-    if( const FunctionInfo* pFuncInfo = mrFuncProv.getFuncInfoFromBiffFuncId( nFuncId ) )
+    if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiffFuncId( nFuncId ) )
         if( pFuncInfo->mnMinParamCount == pFuncInfo->mnMaxParamCount )
             return pushFunctionOperator( *pFuncInfo, pFuncInfo->mnMinParamCount );
-    return pushFunctionOperator( mrFuncProv.OPCODE_NONAME, 0 );
+    return pushFunctionOperator( OPCODE_NONAME, 0 );
 }
 
 bool BiffFormulaParserImpl::pushBiffFunction( sal_uInt16 nFuncId, sal_uInt8 nParamCount )
 {
     if( getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD ) )
         nParamCount &= BIFF_TOK_FUNCVAR_COUNTMASK;
-    if( const FunctionInfo* pFuncInfo = mrFuncProv.getFuncInfoFromBiffFuncId( nFuncId ) )
+    if( const FunctionInfo* pFuncInfo = getFuncInfoFromBiffFuncId( nFuncId ) )
         return pushFunctionOperator( *pFuncInfo, nParamCount );
-    return pushFunctionOperator( mrFuncProv.OPCODE_NONAME, nParamCount );
+    return pushFunctionOperator( OPCODE_NONAME, nParamCount );
 }
 
 // ============================================================================
@@ -2540,8 +2739,8 @@ FormulaParser::FormulaParser( const Work
 {
     switch( getFilterType() )
     {
-        case FILTER_OOX:    mxImpl.reset( new OoxFormulaParserImpl( rHelper, maFuncProv ) );    break;
-        case FILTER_BIFF:   mxImpl.reset( new BiffFormulaParserImpl( rHelper, maFuncProv ) );   break;
+        case FILTER_OOX:    mxImpl.reset( new OoxFormulaParserImpl( *this ) );  break;
+        case FILTER_BIFF:   mxImpl.reset( new BiffFormulaParserImpl( *this ) ); break;
         case FILTER_UNKNOWN: break;
     }
 }
@@ -2569,10 +2768,10 @@ void FormulaParser::convertErrorToFormul
 {
     ApiTokenSequence aTokens( 3 );
     // HACK: enclose all error codes into an 1x1 matrix
-    aTokens[ 0 ].OpCode = maFuncProv.OPCODE_ARRAY_OPEN;
-    aTokens[ 1 ].OpCode = maFuncProv.OPCODE_PUSH;
+    aTokens[ 0 ].OpCode = OPCODE_ARRAY_OPEN;
+    aTokens[ 1 ].OpCode = OPCODE_PUSH;
     aTokens[ 1 ].Data <<= BiffHelper::calcDoubleFromError( nErrorCode );
-    aTokens[ 2 ].OpCode = maFuncProv.OPCODE_ARRAY_CLOSE;
+    aTokens[ 2 ].OpCode = OPCODE_ARRAY_CLOSE;
     mxImpl->setFormula( rContext, aTokens );
 }
 
@@ -2581,7 +2780,7 @@ void FormulaParser::convertNameToFormula
     if( nTokenIndex >= 0 )
     {
         ApiTokenSequence aTokens( 1 );
-        aTokens[ 0 ].OpCode = maFuncProv.OPCODE_NAME;
+        aTokens[ 0 ].OpCode = OPCODE_NAME;
         aTokens[ 0 ].Data <<= nTokenIndex;
         mxImpl->setFormula( rContext, aTokens );
     }
@@ -2589,6 +2788,29 @@ void FormulaParser::convertNameToFormula
         convertErrorToFormula( rContext, BIFF_ERR_REF );
 }
 
+void FormulaParser::convertNumberToHyperlink( FormulaContext& rContext, const OUString& rUrl, double fValue ) const
+{
+    OSL_ENSURE( rUrl.getLength() > 0, "FormulaParser::convertNumberToHyperlink - missing URL" );
+    if( const FunctionInfo* pFuncInfo = getFuncInfoFromOobFuncId( OOBIN_FUNC_HYPERLINK ) )
+    {
+        ApiTokenSequence aTokens( 6 );
+        aTokens[ 0 ].OpCode = pFuncInfo->mnApiOpCode;
+        aTokens[ 1 ].OpCode = OPCODE_OPEN;
+        aTokens[ 2 ].OpCode = OPCODE_PUSH;
+        aTokens[ 2 ].Data <<= rUrl;
+        aTokens[ 3 ].OpCode = OPCODE_SEP;
+        aTokens[ 4 ].OpCode = OPCODE_PUSH;
+        aTokens[ 4 ].Data <<= fValue;
+        aTokens[ 5 ].OpCode = OPCODE_CLOSE;
+        mxImpl->setFormula( rContext, aTokens );
+    }
+}
+
+OUString FormulaParser::printFormulaTokens( const ApiTokenSequence& rTokens )
+{
+    return mxImpl->printFormulaTokens(rTokens);
+}
+
 // ============================================================================
 
 } // namespace xls
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/makefile.mk /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/makefile.mk
--- oox/source/xls/makefile.mk	2008-04-18 16:41:29.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/makefile.mk	2009-03-25 12:15:34.000000000 +0100
@@ -49,7 +49,6 @@ SLOFILES =										\
 		$(SLO)$/autofiltercontext.obj			\
 		$(SLO)$/biffcodec.obj					\
 		$(SLO)$/biffdetector.obj				\
-		$(SLO)$/bifffragmenthandler.obj			\
 		$(SLO)$/biffhelper.obj					\
 		$(SLO)$/biffinputstream.obj				\
 		$(SLO)$/biffoutputstream.obj			\
@@ -87,7 +86,6 @@ SLOFILES =										\
 		$(SLO)$/tablefragment.obj				\
 		$(SLO)$/themebuffer.obj					\
 		$(SLO)$/unitconverter.obj				\
-		$(SLO)$/validationpropertyhelper.obj	\
 		$(SLO)$/viewsettings.obj				\
 		$(SLO)$/webquerybuffer.obj				\
 		$(SLO)$/workbookfragment.obj			\
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/numberformatsbuffer.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/numberformatsbuffer.cxx
--- oox/source/xls/numberformatsbuffer.cxx	2008-07-22 16:14:57.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/numberformatsbuffer.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -39,9 +39,9 @@
 #include <rtl/string.hxx>
 #include <rtl/strbuf.hxx>
 #include <rtl/ustrbuf.hxx>
-#include <comphelper/processfactory.hxx>
 #include "oox/helper/attributelist.hxx"
 #include "oox/helper/recordinputstream.hxx"
+#include "oox/core/filterbase.hxx"
 #include "oox/xls/biffinputstream.hxx"
 
 using ::rtl::OString;
@@ -1950,10 +1950,8 @@ NumberFormatsBuffer::NumberFormatsBuffer
     // get the current locale
     try
     {
-        Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-        Reference< XMultiServiceFactory > xConfigProv(
-            xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ),
-            UNO_QUERY_THROW );
+        Reference< XMultiServiceFactory > xConfigProv( getBaseFilter().getGlobalFactory()->createInstance(
+            CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ), UNO_QUERY_THROW );
 
         // try user-defined locale setting
         Sequence< Any > aArgs( 1 );
@@ -2016,8 +2014,8 @@ void NumberFormatsBuffer::importFormat( 
             aFmtCode = rStrm.readByteString( false, getTextEncoding() );
         break;
         case BIFF4:
-            // in BIFF4 the index field exists, but is undefined
-            aFmtCode = rStrm.skip( 2 ).readByteString( false, getTextEncoding() );
+            rStrm.skip( 2 );    // in BIFF4 the index field exists, but is undefined
+            aFmtCode = rStrm.readByteString( false, getTextEncoding() );
         break;
         case BIFF5:
             mnNextBiffIndex = rStrm.readuInt16();
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/pagesettings.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/pagesettings.cxx
--- oox/source/xls/pagesettings.cxx	2008-07-01 14:24:57.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/pagesettings.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -376,7 +376,7 @@ void PageSettings::importPrintGridLines(
 
 void PageSettings::importHeader( BiffInputStream& rStrm )
 {
-    if( rStrm.getRecLeft() > 0 )
+    if( rStrm.getRemaining() > 0 )
         maOoxData.maOddHeader = (getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteString( false, getTextEncoding() );
     else
         maOoxData.maOddHeader = OUString();
@@ -384,7 +384,7 @@ void PageSettings::importHeader( BiffInp
 
 void PageSettings::importFooter( BiffInputStream& rStrm )
 {
-    if( rStrm.getRecLeft() > 0 )
+    if( rStrm.getRemaining() > 0 )
         maOoxData.maOddFooter = (getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteString( false, getTextEncoding() );
     else
         maOoxData.maOddFooter = OUString();
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/pivottablebuffer.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/pivottablebuffer.cxx
--- oox/source/xls/pivottablebuffer.cxx	2008-04-10 18:14:06.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/pivottablebuffer.cxx	2008-12-12 11:38:47.000000000 +0100
@@ -253,7 +253,7 @@ void PivotTableBuffer::writePivotTable( 
 bool PivotTableBuffer::getSourceRange( const OUString& aSheetName, const OUString& aRefName,
                                        CellRangeAddress& rRange ) const
 {
-    sal_Int32 nCount = getWorksheets().getInternalSheetCount();
+    sal_Int32 nCount = getWorksheets().getSheetCount();
     for ( sal_Int32 nSheet = 0; nSheet < nCount; ++nSheet )
     {
         Reference< XNamed > xNamed( getSheet( nSheet ), UNO_QUERY );
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/richstring.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/richstring.cxx
--- oox/source/xls/richstring.cxx	2008-04-10 18:14:58.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/richstring.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -112,17 +112,23 @@ void BinFontPortionData::read( RecordInp
     mnFontId = rStrm.readuInt16();
 }
 
-void BinFontPortionData::read( BiffInputStream& rStrm, bool b16Bit )
+void BinFontPortionData::read( BiffInputStream& rStrm, BiffFontPortionMode eMode )
 {
-    if( b16Bit )
-    {
-        mnPos = rStrm.readuInt16();
-        mnFontId = rStrm.readuInt16();
-    }
-    else
+    switch( eMode )
     {
+        case BIFF_FONTPORTION_8BIT:
         mnPos = rStrm.readuInt8();
         mnFontId = rStrm.readuInt8();
+        break;
+        case BIFF_FONTPORTION_16BIT:
+            mnPos = rStrm.readuInt16();
+            mnFontId = rStrm.readuInt16();
+        break;
+        case BIFF_FONTPORTION_OBJ:
+            mnPos = rStrm.readuInt16();
+            mnFontId = rStrm.readuInt16();
+            rStrm.skip( 4 );
+        break;
     }
 }
 
@@ -144,11 +150,11 @@ void BinFontPortionList::importPortions(
     clear();
     if( nCount > 0 )
     {
-        reserve( getLimitedValue< size_t, sal_Int32 >( nCount, 0, rStrm.getRecLeft() / 4 ) );
+        reserve( getLimitedValue< size_t, sal_Int64 >( nCount, 0, rStrm.getRemaining() / 4 ) );
         /*  #i33341# real life -- same character index may occur several times
             -> use appendPortion() to validate string position. */
         BinFontPortionData aPortion;
-        for( sal_Int32 nIndex = 0; rStrm.isValid() && (nIndex < nCount); ++nIndex )
+        for( sal_Int32 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
         {
             aPortion.read( rStrm );
             appendPortion( aPortion );
@@ -156,16 +162,16 @@ void BinFontPortionList::importPortions(
     }
 }
 
-void BinFontPortionList::importPortions( BiffInputStream& rStrm, sal_uInt16 nCount, bool b16Bit )
+void BinFontPortionList::importPortions( BiffInputStream& rStrm, sal_uInt16 nCount, BiffFontPortionMode eMode )
 {
     clear();
     reserve( nCount );
     /*  #i33341# real life -- same character index may occur several times
         -> use appendPortion() to validate string position. */
     BinFontPortionData aPortion;
-    for( sal_uInt16 nIndex = 0; rStrm.isValid() && (nIndex < nCount); ++nIndex )
+    for( sal_uInt16 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
     {
-        aPortion.read( rStrm, b16Bit );
+        aPortion.read( rStrm, eMode );
         appendPortion( aPortion );
     }
 }
@@ -173,7 +179,7 @@ void BinFontPortionList::importPortions(
 void BinFontPortionList::importPortions( BiffInputStream& rStrm, bool b16Bit )
 {
     sal_uInt16 nCount = b16Bit ? rStrm.readuInt16() : rStrm.readuInt8();
-    importPortions( rStrm, nCount, b16Bit );
+    importPortions( rStrm, nCount, b16Bit ? BIFF_FONTPORTION_16BIT : BIFF_FONTPORTION_8BIT );
 }
 
 // ============================================================================
@@ -309,9 +315,9 @@ void BinPhoneticPortionList::importPorti
     clear();
     if( nCount > 0 )
     {
-        reserve( getLimitedValue< size_t, sal_Int32 >( nCount, 0, rStrm.getRecLeft() / 6 ) );
+        reserve( getLimitedValue< size_t, sal_Int64 >( nCount, 0, rStrm.getRemaining() / 6 ) );
         BinPhoneticPortionData aPortion;
-        for( sal_Int32 nIndex = 0; rStrm.isValid() && (nIndex < nCount); ++nIndex )
+        for( sal_Int32 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
         {
             aPortion.read( rStrm );
             appendPortion( aPortion );
@@ -319,7 +325,7 @@ void BinPhoneticPortionList::importPorti
     }
 }
 
-OUString BinPhoneticPortionList::importPortions( BiffInputStream& rStrm, sal_uInt32 nPhoneticSize )
+OUString BinPhoneticPortionList::importPortions( BiffInputStream& rStrm, sal_Int32 nPhoneticSize )
 {
     OUString aPhoneticText;
     sal_uInt16 nPortionCount, nTextLen1, nTextLen2;
@@ -327,7 +333,7 @@ OUString BinPhoneticPortionList::importP
     OSL_ENSURE( nTextLen1 == nTextLen2, "BinPhoneticPortionList::importPortions - wrong phonetic text length" );
     if( (nTextLen1 == nTextLen2) && (nTextLen1 > 0) )
     {
-        sal_uInt32 nMinSize = static_cast< sal_uInt32 >( 2 * nTextLen1 + 6 * nPortionCount + 14 );
+        sal_Int32 nMinSize = 2 * nTextLen1 + 6 * nPortionCount + 14;
         OSL_ENSURE( nMinSize <= nPhoneticSize, "BinPhoneticPortionList::importPortions - wrong size of phonetic data" );
         if( nMinSize <= nPhoneticSize )
         {
@@ -380,7 +386,7 @@ void RichString::importString( RecordInp
     sal_uInt8 nFlags = bRich ? rStrm.readuInt8() : 0;
     OUString aBaseText = rStrm.readString();
 
-    if( rStrm.isValid() && getFlag( nFlags, OOBIN_STRINGFLAG_FONTS ) )
+    if( !rStrm.isEof() && getFlag( nFlags, OOBIN_STRINGFLAG_FONTS ) )
     {
         BinFontPortionList aPortions;
         aPortions.importPortions( rStrm );
@@ -391,7 +397,7 @@ void RichString::importString( RecordInp
         createPortion()->setText( aBaseText );
     }
 
-    if( rStrm.isValid() && getFlag( nFlags, OOBIN_STRINGFLAG_PHONETICS ) )
+    if( !rStrm.isEof() && getFlag( nFlags, OOBIN_STRINGFLAG_PHONETICS ) )
     {
         OUString aPhoneticText = rStrm.readString();
         BinPhoneticPortionList aPortions;
@@ -409,7 +415,7 @@ void RichString::importByteString( BiffI
 
     OString aBaseText = rStrm.readByteString( !b8BitLength );
 
-    if( rStrm.isValid() && getFlag( nFlags, BIFF_STR_EXTRAFONTS ) )
+    if( !rStrm.isEof() && getFlag( nFlags, BIFF_STR_EXTRAFONTS ) )
     {
         BinFontPortionList aPortions;
         aPortions.importPortions( rStrm, false );
@@ -436,17 +442,17 @@ void RichString::importUniString( BiffIn
     bool bFonts    = getFlag( nFlagField, BIFF_STRF_RICH );
     bool bPhonetic = getFlag( nFlagField, BIFF_STRF_PHONETIC );
     sal_uInt16 nFontCount = bFonts ? rStrm.readuInt16() : 0;
-    sal_uInt32 nPhoneticSize = bPhonetic ? rStrm.readuInt32() : 0;
+    sal_Int32 nPhoneticSize = bPhonetic ? rStrm.readInt32() : 0;
 
     // --- character array ---
     OUString aBaseText = rStrm.readUniStringChars( nChars, b16Bit );
 
     // --- formatting ---
     // #122185# bRich flag may be set, but format runs may be missing
-    if( rStrm.isValid() && (nFontCount > 0) )
+    if( !rStrm.isEof() && (nFontCount > 0) )
     {
         BinFontPortionList aPortions;
-        aPortions.importPortions( rStrm, nFontCount, true );
+        aPortions.importPortions( rStrm, nFontCount, BIFF_FONTPORTION_16BIT );
         createFontPortions( aBaseText, aPortions );
     }
     else
@@ -456,16 +462,16 @@ void RichString::importUniString( BiffIn
 
     // --- Asian phonetic information ---
     // #122185# bPhonetic flag may be set, but phonetic info may be missing
-    if( rStrm.isValid() && (nPhoneticSize > 0) )
+    if( !rStrm.isEof() && (nPhoneticSize > 0) )
     {
-        sal_uInt32 nPhoneticEnd = rStrm.getRecPos() + nPhoneticSize;
+        sal_Int64 nPhoneticEnd = rStrm.tell() + nPhoneticSize;
         OSL_ENSURE( nPhoneticSize > 14, "RichString::importUniString - wrong size of phonetic data" );
         if( nPhoneticSize > 14 )
         {
             sal_uInt16 nId, nSize;
             rStrm >> nId >> nSize;
             OSL_ENSURE( nId == 1, "RichString::importUniString - unknown phonetic data identifier" );
-            sal_uInt32 nMinSize = static_cast< sal_uInt32 >( nSize + 4 );
+            sal_Int32 nMinSize = nSize + 4;
             OSL_ENSURE( nMinSize <= nPhoneticSize, "RichString::importUniString - wrong size of phonetic data" );
             if( (nId == 1) && (nMinSize <= nPhoneticSize) )
             {
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/sharedformulabuffer.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/sharedformulabuffer.cxx
--- oox/source/xls/sharedformulabuffer.cxx	2008-04-10 18:15:32.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/sharedformulabuffer.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -35,7 +35,6 @@
 #include "oox/helper/recordinputstream.hxx"
 #include "oox/xls/addressconverter.hxx"
 #include "oox/xls/biffinputstream.hxx"
-#include "oox/xls/defnamesbuffer.hxx"
 #include "oox/xls/formulaparser.hxx"
 
 using ::rtl::OUString;
@@ -184,11 +183,11 @@ Reference< XNamedRange > SharedFormulaBu
         append( static_cast< sal_Int32 >( getSheetIndex() + 1 ) ).
         append( sal_Unicode( '_' ) ).append( rMapKey.mnRow ).
         append( sal_Unicode( '_' ) ).append( rMapKey.mnCol ).makeStringAndClear();
-    Reference< XNamedRange > xNamedRange = getDefinedNames().createDefinedName( aName );
+    Reference< XNamedRange > xNamedRange = createNamedRangeObject( aName );
     PropertySet aNameProps( xNamedRange );
     aNameProps.setProperty( maIsSharedProp, true );
-    sal_Int32 nTokenIndex = getDefinedNames().getTokenIndex( xNamedRange );
-    if( nTokenIndex >= 0 )
+    sal_Int32 nTokenIndex = -1;
+    if( aNameProps.getProperty( nTokenIndex, CREATE_OUSTRING( "TokenIndex" ) ) && (nTokenIndex >= 0) )
         maIndexMap[ rMapKey ] = nTokenIndex;
     return xNamedRange;
 }
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/sharedstringsbuffer.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/sharedstringsbuffer.cxx
--- oox/source/xls/sharedstringsbuffer.cxx	2008-04-10 18:15:48.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/sharedstringsbuffer.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -53,12 +53,13 @@ RichStringRef SharedStringsBuffer::creat
 
 void SharedStringsBuffer::importSst( BiffInputStream& rStrm )
 {
-    sal_Int32 nStringCount = rStrm.skip( 4 ).readInt32();
+    rStrm.skip( 4 );
+    sal_Int32 nStringCount = rStrm.readInt32();
     if( nStringCount > 0 )
     {
         maStrings.clear();
         maStrings.reserve( static_cast< size_t >( nStringCount ) );
-        for( ; rStrm.isValid() && (nStringCount > 0); --nStringCount )
+        for( ; !rStrm.isEof() && (nStringCount > 0); --nStringCount )
         {
             RichStringRef xString( new RichString( *this ) );
             maStrings.push_back( xString );
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/sheetdatacontext.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/sheetdatacontext.cxx
--- oox/source/xls/sheetdatacontext.cxx	2008-07-01 14:26:30.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/sheetdatacontext.cxx	2008-12-12 11:38:47.000000000 +0100
@@ -109,7 +109,7 @@ const sal_uInt32 BIFF_ROW_THICKTOP      
 const sal_uInt32 BIFF_ROW_THICKBOTTOM       = 0x20000000;
 const sal_uInt32 BIFF_ROW_SHOWPHONETIC      = 0x40000000;
 
-const sal_Int32 BIFF_XF_EXTENDED_IDS        = 63;
+const sal_Int32 BIFF2_XF_EXTENDED_IDS       = 63;
 const sal_uInt8 BIFF2_XF_MASK               = 0x3F;
 
 // ----------------------------------------------------------------------------
@@ -622,139 +622,8 @@ void OoxSheetDataContext::importDataTabl
 
 // ============================================================================
 
-OoxExternalSheetDataContext::OoxExternalSheetDataContext(
-        OoxWorkbookFragmentBase& rFragment, WorksheetType eSheetType, sal_Int32 nSheet ) :
-    OoxWorksheetContextBase( rFragment, ISegmentProgressBarRef(), eSheetType, nSheet )
-{
-}
-
-// oox.core.ContextHandler2Helper interface -----------------------------------
-
-ContextWrapper OoxExternalSheetDataContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
-{
-    switch( getCurrentElement() )
-    {
-        case XLS_TOKEN( sheetData ):
-            return  (nElement == XLS_TOKEN( row ));
-        case XLS_TOKEN( row ):
-            return  (nElement == XLS_TOKEN( cell ));
-        case XLS_TOKEN( cell ):
-            return  (nElement == XLS_TOKEN( v )) && maCurrCell.mxCell.is();
-    }
-    return false;
-}
-
-void OoxExternalSheetDataContext::onStartElement( const AttributeList& rAttribs )
-{
-    switch( getCurrentElement() )
-    {
-        case XLS_TOKEN( cell ):
-            importCell( rAttribs );
-        break;
-    }
-}
-
-void OoxExternalSheetDataContext::onEndElement( const OUString& rChars )
-{
-    switch( getCurrentElement() )
-    {
-        case XLS_TOKEN( v ):
-            maCurrCell.maValueStr = rChars;
-            maCurrCell.mbHasValueStr = true;
-        break;
-
-        case XLS_TOKEN( cell ):
-            if( maCurrCell.mxCell.is() )
-                setOoxCell( maCurrCell, true );
-        break;
-    }
-}
-
-ContextWrapper OoxExternalSheetDataContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
-{
-    switch( getCurrentElement() )
-    {
-        case OOBIN_ID_EXTSHEETDATA:
-            return  (nRecId == OOBIN_ID_EXTROW);
-        case OOBIN_ID_EXTROW:
-            return  (nRecId == OOBIN_ID_EXTCELL_BLANK) ||
-                    (nRecId == OOBIN_ID_EXTCELL_BOOL) ||
-                    (nRecId == OOBIN_ID_EXTCELL_DOUBLE) ||
-                    (nRecId == OOBIN_ID_EXTCELL_ERROR) ||
-                    (nRecId == OOBIN_ID_EXTCELL_STRING);
-    }
-    return false;
-}
-
-void OoxExternalSheetDataContext::onStartRecord( RecordInputStream& rStrm )
-{
-    switch( getCurrentElement() )
-    {
-        case OOBIN_ID_EXTCELL_BLANK:    importExtCellBlank( rStrm );    break;
-        case OOBIN_ID_EXTCELL_BOOL:     importExtCellBool( rStrm );     break;
-        case OOBIN_ID_EXTCELL_DOUBLE:   importExtCellDouble( rStrm );   break;
-        case OOBIN_ID_EXTCELL_ERROR:    importExtCellError( rStrm );    break;
-        case OOBIN_ID_EXTCELL_STRING:   importExtCellString( rStrm );   break;
-        case OOBIN_ID_EXTROW:           rStrm >> maCurrPos.mnRow;       break;
-    }
-}
-
-// private --------------------------------------------------------------------
-
-void OoxExternalSheetDataContext::importCell( const AttributeList& rAttribs )
-{
-    maCurrCell.reset();
-    maCurrCell.mxCell = getCell( rAttribs.getString( XML_r, OUString() ), &maCurrCell.maAddress );
-    maCurrCell.mnCellType = rAttribs.getToken( XML_t, XML_n );
-}
-
-void OoxExternalSheetDataContext::importCellHeader( RecordInputStream& rStrm )
-{
-    maCurrCell.reset();
-    rStrm >> maCurrPos.mnCol;
-    maCurrCell.mxCell = getCell( maCurrPos, &maCurrCell.maAddress );
-}
-
-void OoxExternalSheetDataContext::importExtCellBlank( RecordInputStream& rStrm )
-{
-    importCellHeader( rStrm );
-    if( maCurrCell.mxCell.is() )
-        setEmptyStringCell( maCurrCell.mxCell );
-}
-
-void OoxExternalSheetDataContext::importExtCellBool( RecordInputStream& rStrm )
-{
-    importCellHeader( rStrm );
-    if( maCurrCell.mxCell.is() )
-        setBooleanCell( maCurrCell.mxCell, rStrm.readuInt8() != 0 );
-}
-
-void OoxExternalSheetDataContext::importExtCellDouble( RecordInputStream& rStrm )
-{
-    importCellHeader( rStrm );
-    if( maCurrCell.mxCell.is() )
-        maCurrCell.mxCell->setValue( rStrm.readDouble() );
-}
-
-void OoxExternalSheetDataContext::importExtCellError( RecordInputStream& rStrm )
-{
-    importCellHeader( rStrm );
-    if( maCurrCell.mxCell.is() )
-        setErrorCell( maCurrCell.mxCell, rStrm.readuInt8() );
-}
-
-void OoxExternalSheetDataContext::importExtCellString( RecordInputStream& rStrm )
-{
-    importCellHeader( rStrm );
-    if( maCurrCell.mxCell.is() )
-        setStringCell( maCurrCell.mxCell, rStrm.readString(), true );
-}
-
-// ============================================================================
-// ============================================================================
-
-BiffSheetDataContext::BiffSheetDataContext( const WorksheetHelper& rHelper ) :
-    WorksheetHelper( rHelper ),
+BiffSheetDataContext::BiffSheetDataContext( const BiffWorksheetFragmentBase& rParent ) :
+    BiffWorksheetContextBase( rParent ),
     mnBiff2XfId( 0 )
 {
     mnArrayIgnoreSize = (getBiff() == BIFF2) ? 1 : ((getBiff() <= BIFF4) ? 2 : 6);
@@ -778,80 +647,80 @@ BiffSheetDataContext::BiffSheetDataConte
     }
 }
 
-void BiffSheetDataContext::importRecord( BiffInputStream& rStrm )
+void BiffSheetDataContext::importRecord()
 {
-    sal_uInt16 nRecId = rStrm.getRecId();
+    sal_uInt16 nRecId = mrStrm.getRecId();
     switch( nRecId )
     {
         // records in all BIFF versions
         case BIFF2_ID_ARRAY:        // #i72713#
-        case BIFF3_ID_ARRAY:        importArray( rStrm );       break;
+        case BIFF3_ID_ARRAY:        importArray();          break;
         case BIFF2_ID_BLANK:
-        case BIFF3_ID_BLANK:        importBlank( rStrm );       break;
+        case BIFF3_ID_BLANK:        importBlank();          break;
         case BIFF2_ID_BOOLERR:
-        case BIFF3_ID_BOOLERR:      importBoolErr( rStrm );     break;
-        case BIFF2_ID_INTEGER:      importInteger( rStrm );     break;
-        case BIFF_ID_IXFE:          rStrm >> mnBiff2XfId;       break;
+        case BIFF3_ID_BOOLERR:      importBoolErr();        break;
+        case BIFF2_ID_INTEGER:      importInteger();        break;
+        case BIFF_ID_IXFE:          mrStrm >> mnBiff2XfId;  break;
         case BIFF2_ID_LABEL:
-        case BIFF3_ID_LABEL:        importLabel( rStrm );       break;
+        case BIFF3_ID_LABEL:        importLabel();          break;
         case BIFF2_ID_NUMBER:
-        case BIFF3_ID_NUMBER:       importNumber( rStrm );      break;
-        case BIFF_ID_RK:            importRk( rStrm );          break;
+        case BIFF3_ID_NUMBER:       importNumber();         break;
+        case BIFF_ID_RK:            importRk();             break;
 
         // BIFF specific records
         default: switch( getBiff() )
         {
             case BIFF2: switch( nRecId )
             {
-                case BIFF2_ID_DATATABLE:    importDataTable( rStrm );   break;
-                case BIFF2_ID_DATATABLE2:   importDataTable( rStrm );   break;
-                case BIFF2_ID_FORMULA:      importFormula( rStrm );     break;
-                case BIFF2_ID_ROW:          importRow( rStrm );         break;
+                case BIFF2_ID_DATATABLE:    importDataTable();  break;
+                case BIFF2_ID_DATATABLE2:   importDataTable();  break;
+                case BIFF2_ID_FORMULA:      importFormula();    break;
+                case BIFF2_ID_ROW:          importRow();        break;
             }
             break;
 
             case BIFF3: switch( nRecId )
             {
-                case BIFF3_ID_DATATABLE:    importDataTable( rStrm );   break;
-                case BIFF3_ID_FORMULA:      importFormula( rStrm );     break;
-                case BIFF3_ID_ROW:          importRow( rStrm );         break;
+                case BIFF3_ID_DATATABLE:    importDataTable();  break;
+                case BIFF3_ID_FORMULA:      importFormula();    break;
+                case BIFF3_ID_ROW:          importRow();        break;
             }
             break;
 
             case BIFF4: switch( nRecId )
             {
-                case BIFF3_ID_DATATABLE:    importDataTable( rStrm );   break;
-                case BIFF4_ID_FORMULA:      importFormula( rStrm );     break;
-                case BIFF3_ID_ROW:          importRow( rStrm );         break;
+                case BIFF3_ID_DATATABLE:    importDataTable();  break;
+                case BIFF4_ID_FORMULA:      importFormula();    break;
+                case BIFF3_ID_ROW:          importRow();        break;
             }
             break;
 
             case BIFF5: switch( nRecId )
             {
-                case BIFF3_ID_DATATABLE:    importDataTable( rStrm );   break;
+                case BIFF3_ID_DATATABLE:    importDataTable();  break;
                 case BIFF3_ID_FORMULA:
                 case BIFF4_ID_FORMULA:
-                case BIFF5_ID_FORMULA:      importFormula( rStrm );     break;
-                case BIFF_ID_MULTBLANK:     importMultBlank( rStrm );   break;
-                case BIFF_ID_MULTRK:        importMultRk( rStrm );      break;
-                case BIFF3_ID_ROW:          importRow( rStrm );         break;
-                case BIFF_ID_RSTRING:       importLabel( rStrm );       break;
-                case BIFF_ID_SHAREDFMLA:    importSharedFmla( rStrm );  break;
+                case BIFF5_ID_FORMULA:      importFormula();    break;
+                case BIFF_ID_MULTBLANK:     importMultBlank();  break;
+                case BIFF_ID_MULTRK:        importMultRk();     break;
+                case BIFF3_ID_ROW:          importRow();        break;
+                case BIFF_ID_RSTRING:       importLabel();      break;
+                case BIFF_ID_SHAREDFMLA:    importSharedFmla(); break;
             }
             break;
 
             case BIFF8: switch( nRecId )
             {
-                case BIFF3_ID_DATATABLE:    importDataTable( rStrm );   break;
+                case BIFF3_ID_DATATABLE:    importDataTable();  break;
                 case BIFF3_ID_FORMULA:
                 case BIFF4_ID_FORMULA:
-                case BIFF5_ID_FORMULA:      importFormula( rStrm );     break;
-                case BIFF_ID_LABELSST:      importLabelSst( rStrm );    break;
-                case BIFF_ID_MULTBLANK:     importMultBlank( rStrm );   break;
-                case BIFF_ID_MULTRK:        importMultRk( rStrm );      break;
-                case BIFF3_ID_ROW:          importRow( rStrm );         break;
-                case BIFF_ID_RSTRING:       importLabel( rStrm );       break;
-                case BIFF_ID_SHAREDFMLA:    importSharedFmla( rStrm );  break;
+                case BIFF5_ID_FORMULA:      importFormula();    break;
+                case BIFF_ID_LABELSST:      importLabelSst();   break;
+                case BIFF_ID_MULTBLANK:     importMultBlank();  break;
+                case BIFF_ID_MULTRK:        importMultRk();     break;
+                case BIFF3_ID_ROW:          importRow();        break;
+                case BIFF_ID_RSTRING:       importLabel();      break;
+                case BIFF_ID_SHAREDFMLA:    importSharedFmla(); break;
             }
             break;
 
@@ -868,44 +737,44 @@ void BiffSheetDataContext::setCurrCell( 
     maCurrCell.mxCell = getCell( rAddr, &maCurrCell.maAddress );
 }
 
-void BiffSheetDataContext::importXfId( BiffInputStream& rStrm, bool bBiff2 )
+void BiffSheetDataContext::importXfId( bool bBiff2 )
 {
     if( bBiff2 )
     {
         sal_uInt8 nBiff2XfId;
-        rStrm >> nBiff2XfId;
-        rStrm.skip( 2 );
+        mrStrm >> nBiff2XfId;
+        mrStrm.skip( 2 );
         maCurrCell.mnXfId = nBiff2XfId & BIFF2_XF_MASK;
-        if( maCurrCell.mnXfId == BIFF_XF_EXTENDED_IDS )
+        if( maCurrCell.mnXfId == BIFF2_XF_EXTENDED_IDS )
             maCurrCell.mnXfId = mnBiff2XfId;
     }
     else
     {
-        maCurrCell.mnXfId = rStrm.readuInt16();
+        maCurrCell.mnXfId = mrStrm.readuInt16();
     }
 }
 
-void BiffSheetDataContext::importCellHeader( BiffInputStream& rStrm, bool bBiff2 )
+void BiffSheetDataContext::importCellHeader( bool bBiff2 )
 {
     BinAddress aAddr;
-    rStrm >> aAddr;
+    mrStrm >> aAddr;
     setCurrCell( aAddr );
-    importXfId( rStrm, bBiff2 );
+    importXfId( bBiff2 );
 }
 
-void BiffSheetDataContext::importBlank( BiffInputStream& rStrm )
+void BiffSheetDataContext::importBlank()
 {
-    importCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BLANK );
+    importCellHeader( mrStrm.getRecId() == BIFF2_ID_BLANK );
     setCellFormat( maCurrCell );
 }
 
-void BiffSheetDataContext::importBoolErr( BiffInputStream& rStrm )
+void BiffSheetDataContext::importBoolErr()
 {
-    importCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_BOOLERR );
+    importCellHeader( mrStrm.getRecId() == BIFF2_ID_BOOLERR );
     if( maCurrCell.mxCell.is() )
     {
         sal_uInt8 nValue, nType;
-        rStrm >> nValue >> nType;
+        mrStrm >> nValue >> nType;
         switch( nType )
         {
             case BIFF_BOOLERR_BOOL:
@@ -925,33 +794,33 @@ void BiffSheetDataContext::importBoolErr
     setCellFormat( maCurrCell );
 }
 
-void BiffSheetDataContext::importFormula( BiffInputStream& rStrm )
+void BiffSheetDataContext::importFormula()
 {
-    importCellHeader( rStrm, getBiff() == BIFF2 );
+    importCellHeader( getBiff() == BIFF2 );
     maCurrCell.mnCellType = XML_n;
     Reference< XFormulaTokens > xTokens( maCurrCell.mxCell, UNO_QUERY );
     if( xTokens.is() )
     {
-        rStrm.skip( mnFormulaIgnoreSize );
+        mrStrm.skip( mnFormulaIgnoreSize );
         ExtCellFormulaContext aContext( *this, xTokens, maCurrCell.maAddress );
-        getFormulaParser().importFormula( aContext, rStrm );
+        getFormulaParser().importFormula( aContext, mrStrm );
     }
     setCellFormat( maCurrCell );
 }
 
-void BiffSheetDataContext::importInteger( BiffInputStream& rStrm )
+void BiffSheetDataContext::importInteger()
 {
-    importCellHeader( rStrm, true );
+    importCellHeader( true );
     maCurrCell.mnCellType = XML_n;
     if( maCurrCell.mxCell.is() )
-        maCurrCell.mxCell->setValue( rStrm.readuInt16() );
+        maCurrCell.mxCell->setValue( mrStrm.readuInt16() );
     setCellFormat( maCurrCell );
 }
 
-void BiffSheetDataContext::importLabel( BiffInputStream& rStrm )
+void BiffSheetDataContext::importLabel()
 {
-    bool bBiff2Xf = rStrm.getRecId() == BIFF2_ID_LABEL;
-    importCellHeader( rStrm, bBiff2Xf );
+    bool bBiff2Xf = mrStrm.getRecId() == BIFF2_ID_LABEL;
+    importCellHeader( bBiff2Xf );
     maCurrCell.mnCellType = XML_inlineStr;
     Reference< XText > xText( maCurrCell.mxCell, UNO_QUERY );
     if( xText.is() )
@@ -966,7 +835,7 @@ void BiffSheetDataContext::importLabel( 
         RichString aString( *this );
         if( getBiff() == BIFF8 )
         {
-            aString.importUniString( rStrm );
+            aString.importUniString( mrStrm );
         }
         else
         {
@@ -975,8 +844,8 @@ void BiffSheetDataContext::importLabel( 
             if( const Font* pFont = getStyles().getFontFromCellXf( maCurrCell.mnXfId ).get() )
                 eTextEnc = pFont->getFontEncoding();
             BiffStringFlags nFlags = bBiff2Xf ? BIFF_STR_8BITLENGTH : BIFF_STR_DEFAULT;
-            setFlag( nFlags, BIFF_STR_EXTRAFONTS, rStrm.getRecId() == BIFF_ID_RSTRING );
-            aString.importByteString( rStrm, eTextEnc, nFlags );
+            setFlag( nFlags, BIFF_STR_EXTRAFONTS, mrStrm.getRecId() == BIFF_ID_RSTRING );
+            aString.importByteString( mrStrm, eTextEnc, nFlags );
         }
         aString.finalizeImport();
         aString.convert( xText, maCurrCell.mnXfId );
@@ -984,76 +853,81 @@ void BiffSheetDataContext::importLabel( 
     setCellFormat( maCurrCell );
 }
 
-void BiffSheetDataContext::importLabelSst( BiffInputStream& rStrm )
+void BiffSheetDataContext::importLabelSst()
 {
-    importCellHeader( rStrm, false );
+    importCellHeader( false );
     maCurrCell.mnCellType = XML_s;
     if( maCurrCell.mxCell.is() )
-        setSharedStringCell( maCurrCell.mxCell, rStrm.readInt32(), maCurrCell.mnXfId );
+        setSharedStringCell( maCurrCell.mxCell, mrStrm.readInt32(), maCurrCell.mnXfId );
     setCellFormat( maCurrCell );
 }
 
-void BiffSheetDataContext::importMultBlank( BiffInputStream& rStrm )
+void BiffSheetDataContext::importMultBlank()
 {
     BinAddress aAddr;
-    for( rStrm >> aAddr; rStrm.getRecLeft() > 2; ++aAddr.mnCol )
+    for( mrStrm >> aAddr; mrStrm.getRemaining() > 2; ++aAddr.mnCol )
     {
         setCurrCell( aAddr );
-        importXfId( rStrm, false );
+        importXfId( false );
         setCellFormat( maCurrCell );
     }
 }
 
-void BiffSheetDataContext::importMultRk( BiffInputStream& rStrm )
+void BiffSheetDataContext::importMultRk()
 {
     BinAddress aAddr;
-    for( rStrm >> aAddr; rStrm.getRecLeft() > 2; ++aAddr.mnCol )
+    for( mrStrm >> aAddr; mrStrm.getRemaining() > 2; ++aAddr.mnCol )
     {
         setCurrCell( aAddr );
         maCurrCell.mnCellType = XML_n;
-        importXfId( rStrm, false );
-        sal_Int32 nRkValue = rStrm.readInt32();
+        importXfId( false );
+        sal_Int32 nRkValue = mrStrm.readInt32();
         if( maCurrCell.mxCell.is() )
             maCurrCell.mxCell->setValue( BiffHelper::calcDoubleFromRk( nRkValue ) );
         setCellFormat( maCurrCell );
     }
 }
 
-void BiffSheetDataContext::importNumber( BiffInputStream& rStrm )
+void BiffSheetDataContext::importNumber()
 {
-    importCellHeader( rStrm, rStrm.getRecId() == BIFF2_ID_NUMBER );
+    importCellHeader( mrStrm.getRecId() == BIFF2_ID_NUMBER );
     maCurrCell.mnCellType = XML_n;
     if( maCurrCell.mxCell.is() )
-        maCurrCell.mxCell->setValue( rStrm.readDouble() );
+        maCurrCell.mxCell->setValue( mrStrm.readDouble() );
     setCellFormat( maCurrCell );
 }
 
-void BiffSheetDataContext::importRk( BiffInputStream& rStrm )
+void BiffSheetDataContext::importRk()
 {
-    importCellHeader( rStrm, false );
+    importCellHeader( false );
     maCurrCell.mnCellType = XML_n;
     if( maCurrCell.mxCell.is() )
-        maCurrCell.mxCell->setValue( BiffHelper::calcDoubleFromRk( rStrm.readInt32() ) );
+        maCurrCell.mxCell->setValue( BiffHelper::calcDoubleFromRk( mrStrm.readInt32() ) );
     setCellFormat( maCurrCell );
 }
 
-void BiffSheetDataContext::importRow( BiffInputStream& rStrm )
+void BiffSheetDataContext::importRow()
 {
     OoxRowData aData;
 
     sal_uInt16 nRow, nHeight;
-    rStrm >> nRow;
-    rStrm.skip( 4 );
-    rStrm >> nHeight;
+    mrStrm >> nRow;
+    mrStrm.skip( 4 );
+    mrStrm >> nHeight;
     if( getBiff() == BIFF2 )
     {
-        aData.mbCustomFormat = rStrm.skip( 2 ).readuInt8() == BIFF2_ROW_CUSTOMFORMAT;
+        mrStrm.skip( 2 );
+        aData.mbCustomFormat = mrStrm.readuInt8() == BIFF2_ROW_CUSTOMFORMAT;
         if( aData.mbCustomFormat )
-            aData.mnXfId = rStrm.skip( 5 ).readuInt16();
+        {
+            mrStrm.skip( 5 );
+            aData.mnXfId = mrStrm.readuInt16();
+        }
     }
     else
     {
-        sal_uInt32 nFlags = rStrm.skip( 4 ).readuInt32();
+        mrStrm.skip( 4 );
+        sal_uInt32 nFlags = mrStrm.readuInt32();
         aData.mnXfId = extractValue< sal_Int32 >( nFlags, 16, 12 );
         aData.mnLevel = extractValue< sal_Int32 >( nFlags, 0, 3 );
         aData.mbCustomFormat = getFlag( nFlags, BIFF_ROW_CUSTOMFORMAT );
@@ -1073,52 +947,52 @@ void BiffSheetDataContext::importRow( Bi
     setRowData( aData );
 }
 
-void BiffSheetDataContext::importArray( BiffInputStream& rStrm )
+void BiffSheetDataContext::importArray()
 {
     BinRange aRange;
-    aRange.read( rStrm, false );    // columns always 8-bit
+    aRange.read( mrStrm, false );    // columns always 8-bit
     CellRangeAddress aArrayRange;
     Reference< XCellRange > xRange = getCellRange( aRange, &aArrayRange );
     Reference< XArrayFormulaTokens > xTokens( xRange, UNO_QUERY );
     if( xRange.is() && xTokens.is() )
     {
-        rStrm.skip( mnArrayIgnoreSize );
+        mrStrm.skip( mnArrayIgnoreSize );
         ArrayFormulaContext aContext( xTokens, aArrayRange );
-        getFormulaParser().importFormula( aContext, rStrm );
+        getFormulaParser().importFormula( aContext, mrStrm );
     }
 }
 
-void BiffSheetDataContext::importSharedFmla( BiffInputStream& rStrm )
+void BiffSheetDataContext::importSharedFmla()
 {
-    getSharedFormulas().importSharedFmla( rStrm, maCurrCell.maAddress );
+    getSharedFormulas().importSharedFmla( mrStrm, maCurrCell.maAddress );
 }
 
-void BiffSheetDataContext::importDataTable( BiffInputStream& rStrm )
+void BiffSheetDataContext::importDataTable()
 {
     BinRange aRange;
-    aRange.read( rStrm, false );    // columns always 8-bit
+    aRange.read( mrStrm, false );    // columns always 8-bit
     CellRangeAddress aTableRange;
     if( getAddressConverter().convertToCellRange( aTableRange, aRange, getSheetIndex(), true ) )
     {
         OoxDataTableData aTableData;
         BinAddress aRef1, aRef2;
-        switch( rStrm.getRecId() )
+        switch( mrStrm.getRecId() )
         {
             case BIFF2_ID_DATATABLE:
-                rStrm.skip( 1 );
-                aTableData.mbRowTable = rStrm.readuInt8() != 0;
+                mrStrm.skip( 1 );
+                aTableData.mbRowTable = mrStrm.readuInt8() != 0;
                 aTableData.mb2dTable = false;
-                rStrm >> aRef1;
+                mrStrm >> aRef1;
             break;
             case BIFF2_ID_DATATABLE2:
-                rStrm.skip( 2 );
+                mrStrm.skip( 2 );
                 aTableData.mb2dTable = true;
-                rStrm >> aRef1 >> aRef2;
+                mrStrm >> aRef1 >> aRef2;
             break;
             case BIFF3_ID_DATATABLE:
             {
                 sal_uInt16 nFlags;
-                rStrm >> nFlags >> aRef1 >> aRef2;
+                mrStrm >> nFlags >> aRef1 >> aRef2;
                 aTableData.mbRowTable = getFlag( nFlags, BIFF_DATATABLE_ROW );
                 aTableData.mb2dTable = getFlag( nFlags, BIFF_DATATABLE_2D );
                 aTableData.mbRef1Deleted = getFlag( nFlags, BIFF_DATATABLE_REF1DEL );
@@ -1136,54 +1010,6 @@ void BiffSheetDataContext::importDataTab
 
 // ============================================================================
 
-BiffExternalSheetDataContext::BiffExternalSheetDataContext(
-        const WorkbookHelper& rHelper, WorksheetType eSheetType, sal_Int32 nSheet ) :
-    WorksheetHelperRoot( rHelper, ISegmentProgressBarRef(), eSheetType, nSheet )
-{
-}
-
-void BiffExternalSheetDataContext::importCrn( BiffInputStream& rStrm )
-{
-    sal_uInt8 nCol2, nCol1;
-    sal_uInt16 nRow;
-    rStrm >> nCol2 >> nCol1 >> nRow;
-    bool bLoop = true;
-    for( BinAddress aAddr( nCol1, nRow ); bLoop && rStrm.isValid() && (aAddr.mnCol <= nCol2); ++aAddr.mnCol )
-    {
-        Reference< XCell > xCell = getCell( aAddr );
-        bLoop = xCell.is();
-        if( bLoop ) switch( rStrm.readuInt8() )
-        {
-            case BIFF_DATATYPE_EMPTY:
-                rStrm.skip( 8 );
-                setEmptyStringCell( xCell );
-            break;
-            case BIFF_DATATYPE_DOUBLE:
-                xCell->setValue( rStrm.readDouble() );
-            break;
-            case BIFF_DATATYPE_STRING:
-            {
-                OUString aText = (getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteString( false, getTextEncoding() );
-                setStringCell( xCell, aText, true );
-            }
-            break;
-            case BIFF_DATATYPE_BOOL:
-                setBooleanCell( xCell, rStrm.readuInt8() != 0 );
-                rStrm.skip( 7 );
-            break;
-            case BIFF_DATATYPE_ERROR:
-                setErrorCell( xCell, rStrm.readuInt8() );
-                rStrm.skip( 7 );
-            break;
-            default:
-                OSL_ENSURE( false, "BiffExternalSheetDataContext::importCrn - unknown data type" );
-                bLoop = false;
-        }
-    }
-}
-
-// ============================================================================
-
 } // namespace xls
 } // namespace oox
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/stylesbuffer.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/stylesbuffer.cxx
--- oox/source/xls/stylesbuffer.cxx	2008-07-01 14:26:50.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/stylesbuffer.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -542,13 +542,12 @@ void ColorPalette::importPalette( BiffIn
 {
     sal_uInt16 nCount;
     rStrm >> nCount;
-    OSL_ENSURE( rStrm.getRecLeft() == static_cast< sal_uInt32 >( 4 * nCount ),
-        "ColorPalette::importPalette - wrong palette size" );
+    OSL_ENSURE( rStrm.getRemaining() == 4 * nCount, "ColorPalette::importPalette - wrong palette size" );
 
     // fill palette from BIFF_COLOR_USEROFFSET
     mnAppendIndex = BIFF_COLOR_USEROFFSET;
     Color aColor;
-    for( sal_uInt16 nIndex = 0; rStrm.isValid() && (nIndex < nCount); ++nIndex )
+    for( sal_uInt16 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
     {
         aColor.importColorRgb( rStrm );
         appendColor( aColor.getColor( *this ) );
@@ -592,6 +591,26 @@ void ColorPalette::appendColor( sal_Int3
 
 // ============================================================================
 
+namespace {
+
+void lclSetFontName( ApiScriptFontName& rFontName, const FontDescriptor& rFontDesc, bool bHasGlyphs )
+{
+    if( bHasGlyphs )
+    {
+        rFontName.maName = rFontDesc.Name;
+        rFontName.mnFamily = rFontDesc.Family;
+        rFontName.mnCharSet = rFontDesc.CharSet;
+    }
+    else
+    {
+        rFontName = ApiScriptFontName();
+    }
+}
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
 OoxFontData::OoxFontData() :
     mnScheme( XML_none ),
     mnFamily( OOX_FONTFAMILY_NONE ),
@@ -906,11 +925,11 @@ void Font::importCfRule( BiffInputStream
     sal_uInt16 nWeight, nEscapement;
     sal_uInt8 nUnderline;
 
-    OSL_ENSURE( rStrm.getRecLeft() >= 118, "Font::importCfRule - missing record data" );
-    sal_uInt32 nRecPos = rStrm.getRecPos();
+    OSL_ENSURE( rStrm.getRemaining() >= 118, "Font::importCfRule - missing record data" );
+    sal_Int64 nRecPos = rStrm.tell();
     maOoxData.maName = rStrm.readUniString( rStrm.readuInt8() );
     maUsedFlags.mbNameUsed = maOoxData.maName.getLength() > 0;
-    OSL_ENSURE( rStrm.isValid() && (rStrm.getRecPos() <= nRecPos + 64), "Font::importCfRule - font name too long" );
+    OSL_ENSURE( !rStrm.isEof() && (rStrm.tell() <= nRecPos + 64), "Font::importCfRule - font name too long" );
     rStrm.seek( nRecPos + 64 );
     rStrm >> nHeight >> nStyle >> nWeight >> nEscapement >> nUnderline;
     rStrm.skip( 3 );
@@ -1020,7 +1039,7 @@ void Font::finalizeImport()
             if( xFont.is() )
             {
                 // #91658# CJK fonts
-                maApiData.mbHasAsian =
+                bool bHasAsian =
                     xFont->hasGlyphs( OUString( sal_Unicode( 0x3041 ) ) ) ||    // 3040-309F: Hiragana
                     xFont->hasGlyphs( OUString( sal_Unicode( 0x30A1 ) ) ) ||    // 30A0-30FF: Katakana
                     xFont->hasGlyphs( OUString( sal_Unicode( 0x3111 ) ) ) ||    // 3100-312F: Bopomofo
@@ -1035,7 +1054,7 @@ void Font::finalizeImport()
                     xFont->hasGlyphs( OUString( sal_Unicode( 0xF901 ) ) ) ||    // F900-FAFF: CJK Compatibility Ideographs
                     xFont->hasGlyphs( OUString( sal_Unicode( 0xFF71 ) ) );      // FF00-FFEF: Halfwidth/Fullwidth Forms
                 // #113783# CTL fonts
-                maApiData.mbHasCmplx =
+                bool bHasCmplx =
                     xFont->hasGlyphs( OUString( sal_Unicode( 0x05D1 ) ) ) ||    // 0590-05FF: Hebrew
                     xFont->hasGlyphs( OUString( sal_Unicode( 0x0631 ) ) ) ||    // 0600-06FF: Arabic
                     xFont->hasGlyphs( OUString( sal_Unicode( 0x0721 ) ) ) ||    // 0700-074F: Syriac
@@ -1045,9 +1064,13 @@ void Font::finalizeImport()
                     xFont->hasGlyphs( OUString( sal_Unicode( 0xFB51 ) ) ) ||    // FB50-FDFF: Arabic Presentation Forms-A
                     xFont->hasGlyphs( OUString( sal_Unicode( 0xFE71 ) ) );      // FE70-FEFF: Arabic Presentation Forms-B
                 // Western fonts
-                maApiData.mbHasWstrn =
-                    (!maApiData.mbHasAsian && !maApiData.mbHasCmplx) ||
+                bool bHasLatin =
+                    (!bHasAsian && !bHasCmplx) ||
                     xFont->hasGlyphs( OUString( sal_Unicode( 'A' ) ) );
+
+                lclSetFontName( maApiData.maLatinFont, maApiData.maDesc, bHasLatin );
+                lclSetFontName( maApiData.maAsianFont, maApiData.maDesc, bHasAsian );
+                lclSetFontName( maApiData.maCmplxFont, maApiData.maDesc, bHasCmplx );
             }
         }
     }
@@ -1678,7 +1701,7 @@ void OoxGradientFillData::readGradientSt
     {
         rStrm >> aColor >> fPosition;
     }
-    if( rStrm.isValid() && (fPosition >= 0.0) )
+    if( !rStrm.isEof() && (fPosition >= 0.0) )
         maColors[ fPosition ] = aColor;
 }
 
@@ -1784,7 +1807,7 @@ void Fill::importFill( RecordInputStream
         rStrm.skip( 16 );
         mxOoxGradData->readGradient( rStrm );
         rStrm >> nStopCount;
-        for( sal_Int32 nStop = 0; (nStop < nStopCount) && rStrm.isValid(); ++nStop )
+        for( sal_Int32 nStop = 0; (nStop < nStopCount) && !rStrm.isEof(); ++nStop )
             mxOoxGradData->readGradientStop( rStrm, false );
     }
     else
@@ -2323,10 +2346,10 @@ void Dxf::importDxf( RecordInputStream& 
     sal_uInt16 nRecCount;
     rStrm.skip( 4 );    // flags
     rStrm >> nRecCount;
-    for( sal_uInt16 nRec = 0; rStrm.isValid() && (nRec < nRecCount); ++nRec )
+    for( sal_uInt16 nRec = 0; !rStrm.isEof() && (nRec < nRecCount); ++nRec )
     {
         sal_uInt16 nSubRecId, nSubRecSize;
-        sal_Int32 nRecEnd = rStrm.getRecPos();
+        sal_Int64 nRecEnd = rStrm.tell();
         rStrm >> nSubRecId >> nSubRecSize;
         nRecEnd += nSubRecSize;
         switch( nSubRecId )
@@ -2356,7 +2379,7 @@ void Dxf::importDxf( RecordInputStream& 
         }
         rStrm.seek( nRecEnd );
     }
-    OSL_ENSURE( rStrm.isValid() && (rStrm.getRecLeft() == 0), "Dxf::importDxf - unexpected remaining data" );
+    OSL_ENSURE( !rStrm.isEof() && (rStrm.getRemaining() == 0), "Dxf::importDxf - unexpected remaining data" );
     mxNumFmt = getStyles().createNumFmt( nNumFmtId, aFmtCode );
 }
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/stylespropertyhelper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/stylespropertyhelper.cxx
--- oox/source/xls/stylespropertyhelper.cxx	2008-04-10 18:17:56.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/stylespropertyhelper.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -41,6 +41,7 @@
 #include "oox/xls/stylesbuffer.hxx"
 
 using ::rtl::OUString;
+using ::com::sun::star::awt::FontDescriptor;
 
 namespace oox {
 namespace xls {
@@ -64,6 +65,14 @@ ApiFontUsedFlags::ApiFontUsedFlags( bool
 
 // ----------------------------------------------------------------------------
 
+ApiScriptFontName::ApiScriptFontName() :
+    mnFamily( ::com::sun::star::awt::FontFamily::DONTKNOW ),
+    mnCharSet( RTL_TEXTENCODING_DONTKNOW )
+{
+}
+
+// ----------------------------------------------------------------------------
+
 ApiFontData::ApiFontData() :
     maDesc(
         CREATE_OUSTRING( "Calibri" ),
@@ -86,10 +95,9 @@ ApiFontData::ApiFontData() :
     mnEscapement( API_ESCAPE_NONE ),
     mnEscapeHeight( API_ESCAPEHEIGHT_NONE ),
     mbOutline( false ),
-    mbShadow( false ),
-    mbHasWstrn( true ),
-    mbHasAsian( false )
+    mbShadow( false )
 {
+    maLatinFont.maName = maDesc.Name;
 }
 
 // ============================================================================
@@ -164,7 +172,7 @@ ApiSolidFillData::ApiSolidFillData() :
 namespace {
 
 /** Property names for Western font name settings. */
-const sal_Char* const sppcWstrnFontNameNames[] =
+const sal_Char* const sppcLatinFontNameNames[] =
 {
     "CharFontName",
     "CharFontFamily",
@@ -256,13 +264,19 @@ const sal_Char* const sppcSolidFillNames
     0
 };
 
+void lclWriteFontName( PropertySet& rPropSet, PropertySequence& rPropSeq, const ApiScriptFontName& rFontName )
+{
+    if( rFontName.maName.getLength() > 0 )
+        rPropSeq << rFontName.maName << rFontName.mnFamily << rFontName.mnCharSet >> rPropSet;
+}
+
 } // namespace
 
 // ----------------------------------------------------------------------------
 
 StylesPropertyHelper::StylesPropertyHelper( const WorkbookHelper& rHelper ) :
     WorkbookHelper( rHelper ),
-    maWstrnFontNameProps( sppcWstrnFontNameNames ),
+    maLatinFontNameProps( sppcLatinFontNameNames ),
     maAsianFontNameProps( sppcAsianFontNameNames ),
     maCmplxFontNameProps( sppcCmplxFontNameNames ),
     maFontHeightProps( sppcFontHeightNames ),
@@ -289,12 +303,9 @@ void StylesPropertyHelper::writeFontProp
     // font name properties
     if( rUsedFlags.mbNameUsed )
     {
-        if( rFontData.mbHasWstrn )
-            maWstrnFontNameProps << rFontData.maDesc.Name << rFontData.maDesc.Family << rFontData.maDesc.CharSet >> rPropSet;
-        if( rFontData.mbHasAsian )
-            maAsianFontNameProps << rFontData.maDesc.Name << rFontData.maDesc.Family << rFontData.maDesc.CharSet >> rPropSet;
-        if( rFontData.mbHasCmplx )
-            maCmplxFontNameProps << rFontData.maDesc.Name << rFontData.maDesc.Family << rFontData.maDesc.CharSet >> rPropSet;
+        lclWriteFontName( rPropSet, maLatinFontNameProps, rFontData.maLatinFont );
+        lclWriteFontName( rPropSet, maAsianFontNameProps, rFontData.maAsianFont );
+        lclWriteFontName( rPropSet, maCmplxFontNameProps, rFontData.maCmplxFont );
     }
     // font height
     if( rUsedFlags.mbHeightUsed )
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/tablefragment.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/tablefragment.cxx
--- oox/source/xls/tablefragment.cxx	2008-04-10 18:18:30.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/tablefragment.cxx	2009-03-23 21:51:37.000000000 +0100
@@ -30,6 +30,8 @@
 
 #include "oox/xls/tablefragment.hxx"
 
+#include <oox/xls/autofiltercontext.hxx>
+
 using ::rtl::OUString;
 using ::oox::core::RecordInfo;
 
@@ -51,6 +53,15 @@ ContextWrapper OoxTableFragment::onCreat
     {
         case XML_ROOT_CONTEXT:
             return  (nElement == XLS_TOKEN( table ));
+        case XLS_TOKEN( table ):
+            switch (nElement)
+            {
+                case XLS_TOKEN( autoFilter ):
+                {
+                    OSL_TRACE ("%s: AUTO FILTER: *********", __PRETTY_FUNCTION__);
+                    return new OoxAutoFilterContext( *this );
+                }
+            }
     }
     return false;
 }
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/themebuffer.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/themebuffer.cxx
--- oox/source/xls/themebuffer.cxx	2008-07-01 14:27:40.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/themebuffer.cxx	2008-09-30 16:51:36.000000000 +0200
@@ -34,8 +34,6 @@
 
 using ::oox::drawingml::ClrScheme;
 using ::oox::drawingml::Color;
-using ::oox::drawingml::Theme;
-using ::oox::drawingml::ThemePtr;
 
 namespace oox {
 namespace xls {
@@ -115,20 +113,10 @@ ThemeBuffer::~ThemeBuffer()
 {
 }
 
-Theme& ThemeBuffer::getOrCreateCoreTheme()
-{
-    if( !mxTheme )
-        mxTheme.reset( new Theme );
-    return *mxTheme;
-}
-
 sal_Int32 ThemeBuffer::getColorByToken( sal_Int32 nToken ) const
 {
     sal_Int32 nColor = 0;
-    if( mxTheme.get() )
-        if( mxTheme->getClrScheme().getColor( nToken, nColor ) )
-            return nColor;
-    return API_RGB_TRANSPARENT;
+    return getClrScheme().getColor( nToken, nColor ) ? nColor : API_RGB_TRANSPARENT;
 }
 
 sal_Int32 ThemeBuffer::getColorByIndex( sal_Int32 nIndex ) const
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/validationpropertyhelper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/validationpropertyhelper.cxx
--- oox/source/xls/validationpropertyhelper.cxx	2008-04-10 18:19:27.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/validationpropertyhelper.cxx	1970-01-01 01:00:00.000000000 +0100
@@ -1,170 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: validationpropertyhelper.cxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "oox/xls/validationpropertyhelper.hxx"
-#include <com/sun/star/sheet/ValidationType.hpp>
-#include <com/sun/star/sheet/ValidationAlertStyle.hpp>
-#include <com/sun/star/sheet/TableValidationVisibility.hpp>
-#include <com/sun/star/sheet/XSheetCondition.hpp>
-#include <com/sun/star/sheet/XMultiFormulaTokens.hpp>
-#include "oox/helper/propertyset.hxx"
-#include "oox/xls/excelhandlers.hxx"
-#include "oox/xls/worksheethelper.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::sheet::ValidationType;
-using ::com::sun::star::sheet::ValidationAlertStyle;
-using ::com::sun::star::sheet::ConditionOperator;
-using ::com::sun::star::sheet::XSheetCondition;
-using ::com::sun::star::sheet::XMultiFormulaTokens;
-
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-namespace {
-
-const sal_Char* const sppcPropNames[] =
-{
-    "Type",
-    "ShowInputMessage",
-    "InputTitle",
-    "InputMessage",
-    "ShowErrorMessage",
-    "ErrorTitle",
-    "ErrorMessage",
-    "ErrorAlertStyle",
-    "ShowList",
-    "IgnoreBlankCells",
-    0
-};
-
-} // namespace
-
-// ----------------------------------------------------------------------------
-
-ValidationPropertyHelper::ValidationPropertyHelper( const WorkbookHelper& rHelper ) :
-    WorkbookHelper( rHelper ),
-    maValProps( sppcPropNames ),
-    maValidationProp( CREATE_OUSTRING( "Validation" ) )
-{
-}
-
-void ValidationPropertyHelper::writeValidationProperties( PropertySet& rPropSet, const OoxValidationData& rValData )
-{
-    Reference< XPropertySet > xValidation;
-    if( rPropSet.getProperty( xValidation, maValidationProp ) && xValidation.is() )
-    {
-        PropertySet aValProps( xValidation );
-        namespace csss = ::com::sun::star::sheet;
-
-        // convert validation type to API enum
-        ValidationType eType = csss::ValidationType_ANY;
-        switch( rValData.mnType )
-        {
-            case XML_custom:        eType = csss::ValidationType_CUSTOM;    break;
-            case XML_date:          eType = csss::ValidationType_DATE;      break;
-            case XML_decimal:       eType = csss::ValidationType_DECIMAL;   break;
-            case XML_list:          eType = csss::ValidationType_LIST;      break;
-            case XML_none:          eType = csss::ValidationType_ANY;       break;
-            case XML_textLength:    eType = csss::ValidationType_TEXT_LEN;  break;
-            case XML_time:          eType = csss::ValidationType_TIME;      break;
-            case XML_whole:         eType = csss::ValidationType_WHOLE;     break;
-            default:    OSL_ENSURE( false, "ValidationPropertyHelper::writeValidationProperties - unknown validation type" );
-        }
-
-        // convert error alert style to API enum
-        ValidationAlertStyle nAlertStyle = csss::ValidationAlertStyle_STOP;
-        switch( rValData.mnErrorStyle )
-        {
-            case XML_information:   nAlertStyle = csss::ValidationAlertStyle_INFO;      break;
-            case XML_stop:          nAlertStyle = csss::ValidationAlertStyle_STOP;      break;
-            case XML_warning:       nAlertStyle = csss::ValidationAlertStyle_WARNING;   break;
-            default:    OSL_ENSURE( false, "ValidationPropertyHelper::writeValidationProperties - unknown error style" );
-        }
-
-        // convert dropdown style to API visibility constants
-        sal_Int16 nVisibility = rValData.mbNoDropDown ? csss::TableValidationVisibility::INVISIBLE : csss::TableValidationVisibility::UNSORTED;
-
-        // write all properties
-        maValProps
-            << eType
-            << rValData.mbShowInputMsg << rValData.maInputTitle << rValData.maInputMessage
-            << rValData.mbShowErrorMsg << rValData.maErrorTitle << rValData.maErrorMessage
-            << nAlertStyle << nVisibility << rValData.mbAllowBlank
-            >> aValProps;
-
-        try
-        {
-            // condition operator
-            Reference< XSheetCondition > xSheetCond( xValidation, UNO_QUERY_THROW );
-            xSheetCond->setOperator( convertToApiOperator( rValData.mnOperator ) );
-
-            // condition formulas
-            Reference< XMultiFormulaTokens > xTokens( xValidation, UNO_QUERY_THROW );
-            xTokens->setTokens( 0, rValData.maTokens1 );
-            xTokens->setTokens( 1, rValData.maTokens2 );
-        }
-        catch( Exception& )
-        {
-        }
-
-        // write back validation settings to cell range(s)
-        rPropSet.setProperty( maValidationProp, xValidation );
-    }
-}
-
-ConditionOperator ValidationPropertyHelper::convertToApiOperator( sal_Int32 nToken )
-{
-    using namespace ::com::sun::star::sheet;
-    switch( nToken )
-    {
-        case XML_between:               return ConditionOperator_BETWEEN;
-        case XML_equal:                 return ConditionOperator_EQUAL;
-        case XML_greaterThan:           return ConditionOperator_GREATER;
-        case XML_greaterThanOrEqual:    return ConditionOperator_GREATER_EQUAL;
-        case XML_lessThan:              return ConditionOperator_LESS;
-        case XML_lessThanOrEqual:       return ConditionOperator_LESS_EQUAL;
-        case XML_notBetween:            return ConditionOperator_NOT_BETWEEN;
-        case XML_notEqual:              return ConditionOperator_NOT_EQUAL;
-    }
-    return ConditionOperator_NONE;
-}
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
-
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/viewsettings.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/viewsettings.cxx
--- oox/source/xls/viewsettings.cxx	2008-07-22 16:18:28.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/viewsettings.cxx	2009-03-19 14:28:43.000000000 +0100
@@ -39,6 +39,7 @@
 #include "oox/helper/propertysequence.hxx"
 #include "oox/helper/propertyset.hxx"
 #include "oox/helper/recordinputstream.hxx"
+#include "oox/core/filterbase.hxx"
 #include "oox/xls/biffinputstream.hxx"
 #include "oox/xls/unitconverter.hxx"
 #include "oox/xls/workbooksettings.hxx"
@@ -155,9 +156,6 @@ const sal_Char* const sppcDocNames[] =
 const sal_Char* const sppcGlobalSheetNames[] =
 {
     "GridColor",
-    "ZoomType",
-    "ZoomValue",
-    "PageViewZoomValue",
     "ShowPageBreakPreview",
     "ShowFormulas",
     "ShowGrid",
@@ -182,6 +180,10 @@ const sal_Char* const sppcSheetNames[] =
     "PositionTop",
     "PositionRight",
     "PositionBottom",
+    "ZoomType",
+    "ZoomValue",
+    "PageViewZoomValue",
+    "TabColor",
     0
 };
 
@@ -294,6 +296,12 @@ void SheetViewSettings::importSheetView(
     rData.mbShowOutline     = rAttribs.getBool( XML_showOutlineSymbols, true );
 }
 
+void SheetViewSettings::importTabColor( const AttributeList& rAttribs )
+{
+    OoxSheetViewData& rData = maSheetDatas.empty() ? *createSheetViewData() : *maSheetDatas.back();
+    rData.maTabColor.importColor( rAttribs );
+}
+
 void SheetViewSettings::importPane( const AttributeList& rAttribs )
 {
     OSL_ENSURE( !maSheetDatas.empty(), "SheetViewSettings::importPane - missing view data" );
@@ -361,6 +369,12 @@ void SheetViewSettings::importSheetView(
     rData.mbShowOutline  = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWOUTLINE );
 }
 
+void SheetViewSettings::importTabColor( RecordInputStream& rStrm )
+{
+    OoxSheetViewData& rData = maSheetDatas.empty() ? *createSheetViewData() : *maSheetDatas.back();
+    rData.maTabColor.importColor( rStrm );
+}
+
 void SheetViewSettings::importPane( RecordInputStream& rStrm )
 {
     OSL_ENSURE( !maSheetDatas.empty(), "SheetViewSettings::importPane - missing view data" );
@@ -449,7 +463,7 @@ void SheetViewSettings::importWindow2( B
 
             rData.maGridColor.importColorId( rStrm );
             // zoom data not included in chart sheets
-            if( (getSheetType() != SHEETTYPE_CHARTSHEET) && (rStrm.getRecLeft() >= 6) )
+            if( (getSheetType() != SHEETTYPE_CHARTSHEET) && (rStrm.getRemaining() >= 6) )
             {
                 rStrm.skip( 2 );
                 sal_uInt16 nPageZoom, nNormalZoom;
@@ -520,15 +534,29 @@ void SheetViewSettings::importSelection(
 
 void SheetViewSettings::finalizeImport()
 {
-    // special handling for chart sheets
-    bool bChartSheet = getSheetType() == SHEETTYPE_CHARTSHEET;
-
     // force creation of sheet view data to get the Excel defaults
     OoxSheetViewDataRef xData = maSheetDatas.empty() ? createSheetViewData() : maSheetDatas.front();
 
+    // #i59590# #158194# special handling for chart sheets (Excel ignores some settings in chart sheets)
+    if( getSheetType() == SHEETTYPE_CHARTSHEET )
+    {
+        xData->maSelMap.clear();
+        xData->maFirstPos = xData->maSecondPos = CellAddress( getSheetIndex(), 0, 0 );
+        xData->mnViewType = XML_normal;
+        xData->mnActivePaneId = XML_topLeft;
+        xData->mnPaneState = XML_split;
+        xData->mfSplitX = xData->mfSplitY = 0.0;
+        xData->mbRightToLeft = false;
+        xData->mbDefGridColor = true;
+        xData->mbShowFormulas = false;
+        xData->mbShowGrid = true;
+        xData->mbShowHeadings = true;
+        xData->mbShowZeros = true;
+        xData->mbShowOutline = true;
+    }
+
     // mirrored sheet (this is not a view setting in Calc)
-    // #i59590# real life: Excel ignores mirror flag in chart sheets
-    if( !bChartSheet && xData->mbRightToLeft )
+    if( xData->mbRightToLeft )
     {
         PropertySet aPropSet( getXSpreadsheet() );
         aPropSet.setProperty( CREATE_OUSTRING( "TableLayout" ), ::com::sun::star::text::WritingMode2::RL_TB );
@@ -538,14 +566,9 @@ void SheetViewSettings::finalizeImport()
     bool bSelected = xData->mbSelected || (getSheetIndex() == getViewSettings().getActiveSheetIndex());
 
     // visible area and current cursor position (selection not supported via API)
-    CellAddress aFirstPos( getSheetIndex(), 0, 0 );
-    CellAddress aCursor( getSheetIndex(), 0, 0 );
-    if( !bChartSheet )
-    {
-        aFirstPos = xData->maFirstPos;
+    CellAddress aFirstPos = xData->maFirstPos;
         const OoxSheetSelectionData* pSelData = xData->getActiveSelectionData();
-        aCursor = pSelData ? pSelData->maActiveCell : xData->maFirstPos;
-    }
+    CellAddress aCursor = pSelData ? pSelData->maActiveCell : aFirstPos;
 
     // freeze/split position default
     sal_Int16 nHSplitMode = API_SPLITMODE_NONE;
@@ -555,8 +578,6 @@ void SheetViewSettings::finalizeImport()
     // active pane default
     sal_Int16 nActivePane = API_SPLITPANE_BOTTOMLEFT;
 
-    if( !bChartSheet )
-    {
         // freeze/split position
         if( (xData->mnPaneState == XML_frozen) || (xData->mnPaneState == XML_frozenSplit) )
         {
@@ -601,10 +622,9 @@ void SheetViewSettings::finalizeImport()
                 nActivePane = (nHSplitMode == API_SPLITMODE_NONE) ? API_SPLITPANE_BOTTOMLEFT : API_SPLITPANE_BOTTOMRIGHT;
             break;
         }
-    }
 
     // automatic grid color
-    if( bChartSheet || xData->mbDefGridColor )
+    if( xData->mbDefGridColor )
         xData->maGridColor.setAuto();
 
     // write the sheet view settings into the property sequence
@@ -622,11 +642,12 @@ void SheetViewSettings::finalizeImport()
         << aFirstPos.Row
         << xData->maSecondPos.Column
         << ((nVSplitPos > 0) ? xData->maSecondPos.Row : xData->maFirstPos.Row)
-        << xData->maGridColor.getColor( *this )
         << API_ZOOMTYPE_PERCENT
         << static_cast< sal_Int16 >( xData->getNormalZoom() )
         << static_cast< sal_Int16 >( xData->getPageBreakZoom() )
-        << (!bChartSheet && xData->isPageBreakPreview())
+        << xData->maTabColor.getColor( *this )
+        << xData->maGridColor.getColor( *this )
+        << xData->isPageBreakPreview()
         << xData->mbShowFormulas
         << xData->mbShowGrid
         << xData->mbShowHeadings
@@ -745,7 +766,7 @@ void ViewSettings::setSheetViewSettings(
 void ViewSettings::finalizeImport()
 {
     const WorksheetBuffer& rWorksheets = getWorksheets();
-    if( rWorksheets.getInternalSheetCount() <= 0 ) return;
+    if( rWorksheets.getSheetCount() <= 0 ) return;
 
     // force creation of workbook view data to get the Excel defaults
     const OoxWorkbookViewData& rData = maBookDatas.empty() ? createWorkbookViewData() : *maBookDatas.front();
@@ -754,7 +775,7 @@ void ViewSettings::finalizeImport()
     sal_Int16 nShowMode = getWorkbookSettings().getApiShowObjectMode();
 
     // view settings for all sheets
-    Reference< XNameContainer > xSheetsNC = ContainerHelper::createNameContainer();
+    Reference< XNameContainer > xSheetsNC = ContainerHelper::createNameContainer( getBaseFilter().getGlobalFactory() );
     if( !xSheetsNC.is() ) return;
     for( SheetPropertiesMap::const_iterator aIt = maSheetProps.begin(), aEnd = maSheetProps.end(); aIt != aEnd; ++aIt )
         ContainerHelper::insertByName( xSheetsNC, rWorksheets.getFinalSheetName( aIt->first ), aIt->second );
@@ -776,9 +797,6 @@ void ViewSettings::finalizeImport()
         << double( rData.mnTabBarWidth / 1000.0 )
         << nShowMode << nShowMode << nShowMode
         << rxActiveSheetData->maGridColor.getColor( *this )
-        << API_ZOOMTYPE_PERCENT
-        << static_cast< sal_Int16 >( rxActiveSheetData->getNormalZoom() )
-        << static_cast< sal_Int16 >( rxActiveSheetData->getPageBreakZoom() )
         << rxActiveSheetData->isPageBreakPreview()
         << rxActiveSheetData->mbShowFormulas
         << rxActiveSheetData->mbShowGrid
@@ -786,7 +804,7 @@ void ViewSettings::finalizeImport()
         << rxActiveSheetData->mbShowZeros
         << rxActiveSheetData->mbShowOutline;
 
-    Reference< XIndexContainer > xContainer = ContainerHelper::createIndexContainer();
+    Reference< XIndexContainer > xContainer = ContainerHelper::createIndexContainer( getBaseFilter().getGlobalFactory() );
     if( xContainer.is() ) try
     {
         xContainer->insertByIndex( 0, Any( aDocProps.createPropertySequence() ) );
@@ -802,7 +820,7 @@ void ViewSettings::finalizeImport()
 
 sal_Int32 ViewSettings::getActiveSheetIndex() const
 {
-    sal_Int32 nSheetCount = getLimitedValue< sal_Int32, sal_Int32 >( getWorksheets().getInternalSheetCount(), 1, SAL_MAX_INT32 );
+    sal_Int32 nSheetCount = getLimitedValue< sal_Int32, sal_Int32 >( getWorksheets().getSheetCount(), 1, SAL_MAX_INT32 );
     return maBookDatas.empty() ? 0 : getLimitedValue< sal_Int32, sal_Int32 >( maBookDatas.front()->mnActiveSheet, 0, nSheetCount - 1 );
 }
 
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/workbookfragment.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/workbookfragment.cxx
--- oox/source/xls/workbookfragment.cxx	2008-07-01 14:28:45.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/workbookfragment.cxx	2009-03-23 16:15:08.000000000 +0100
@@ -207,7 +207,7 @@ void OoxWorkbookFragment::finalizeImport
     // read the theme substream
     OUString aThemeFragmentPath = getFragmentPathFromType( CREATE_OFFICEDOC_RELATIONSTYPE( "theme" ) );
     if( aThemeFragmentPath.getLength() > 0 )
-        importOoxFragment( new ThemeFragmentHandler( getFilter(), aThemeFragmentPath, getTheme().getOrCreateCoreTheme() ) );
+        importOoxFragment( new ThemeFragmentHandler( getFilter(), aThemeFragmentPath, getTheme() ) );
     xGlobalSegment->setPosition( 0.25 );
 
     // read the styles substream (requires finalized theme buffer)
@@ -235,7 +235,7 @@ void OoxWorkbookFragment::finalizeImport
     typedef ::std::map< sal_Int32, FragmentHandlerRef > SheetFragmentMap;
     SheetFragmentMap aSheetFragments;
     WorksheetBuffer& rWorksheets = getWorksheets();
-    sal_Int32 nSheetCount = rWorksheets.getInternalSheetCount();
+    sal_Int32 nSheetCount = rWorksheets.getSheetCount();
     for( sal_Int32 nSheet = 0; nSheet < nSheetCount; ++nSheet )
     {
         if( const Relation* pRelation = getRelations().getRelationFromRelId( rWorksheets.getSheetRelId( nSheet ) ) )
@@ -258,8 +258,8 @@ void OoxWorkbookFragment::finalizeImport
                 {
                     xFragment.set( new OoxChartsheetFragment( *this, aFragmentPath, xSheetSegment, nSheet ) );
                 }
-                else if( (pRelation->maType == CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet" )) ||
-                         (pRelation->maType == CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/relationships/xlIntlMacrosheet" )) )
+                else if( (pRelation->maType == CREATE_MSOFFICE_RELATIONSTYPE( "xlMacrosheet" )) ||
+                         (pRelation->maType == CREATE_MSOFFICE_RELATIONSTYPE( "xlIntlMacrosheet" )) )
                 {
                     xFragment.set( new OoxWorksheetFragment( *this, aFragmentPath, xSheetSegment, SHEETTYPE_MACROSHEET, nSheet ) );
                 }
@@ -343,8 +343,8 @@ namespace {
 BiffDecoderRef lclImportFilePass_XOR( const WorkbookHelper& rHelper, BiffInputStream& rStrm )
 {
     BiffDecoderRef xDecoder;
-    OSL_ENSURE( rStrm.getRecLeft() == 4, "lclImportFilePass_XOR - wrong record size" );
-    if( rStrm.getRecLeft() == 4 )
+    OSL_ENSURE( rStrm.getRemaining() == 4, "lclImportFilePass_XOR - wrong record size" );
+    if( rStrm.getRemaining() == 4 )
     {
         sal_uInt16 nBaseKey, nHash;
         rStrm >> nBaseKey >> nHash;
@@ -356,15 +356,15 @@ BiffDecoderRef lclImportFilePass_XOR( co
 BiffDecoderRef lclImportFilePass_RCF( const WorkbookHelper& rHelper, BiffInputStream& rStrm )
 {
     BiffDecoderRef xDecoder;
-    OSL_ENSURE( rStrm.getRecLeft() == 48, "lclImportFilePass_RCF - wrong record size" );
-    if( rStrm.getRecLeft() == 48 )
+    OSL_ENSURE( rStrm.getRemaining() == 48, "lclImportFilePass_RCF - wrong record size" );
+    if( rStrm.getRemaining() == 48 )
     {
         sal_uInt8 pnDocId[ 16 ];
         sal_uInt8 pnSaltData[ 16 ];
         sal_uInt8 pnSaltHash[ 16 ];
-        rStrm.read( pnDocId, 16 );
-        rStrm.read( pnSaltData, 16 );
-        rStrm.read( pnSaltHash, 16 );
+        rStrm.readMemory( pnDocId, 16 );
+        rStrm.readMemory( pnSaltData, 16 );
+        rStrm.readMemory( pnSaltHash, 16 );
         xDecoder.reset( new BiffDecoder_RCF( rHelper, pnDocId, pnSaltData, pnSaltHash ) );
     }
     return xDecoder;
@@ -392,7 +392,8 @@ BiffDecoderRef lclImportFilePass8( const
         break;
 
         case BIFF_FILEPASS_BIFF8:
-            switch( rStrm.skip( 2 ).readuInt16() )
+            rStrm.skip( 2 );
+            switch( rStrm.readuInt16() )
             {
                 case BIFF_FILEPASS_BIFF8_RCF:
                     xDecoder = lclImportFilePass_RCF( rHelper, rStrm );
@@ -416,40 +417,40 @@ BiffDecoderRef lclImportFilePass8( const
 
 // ----------------------------------------------------------------------------
 
-BiffWorkbookFragment::BiffWorkbookFragment( const WorkbookHelper& rHelper ) :
-    BiffWorkbookFragmentBase( rHelper )
+BiffWorkbookFragment::BiffWorkbookFragment( const WorkbookHelper& rHelper, BiffInputStream& rStrm ) :
+    BiffWorkbookFragmentBase( rHelper, rStrm )
 {
 }
 
-bool BiffWorkbookFragment::importFragment( BiffInputStream& rStrm )
+bool BiffWorkbookFragment::importFragment()
 {
     bool bRet = false;
 
-    BiffFragmentType eFragment = startFragment( rStrm, getBiff() );
+    BiffFragmentType eFragment = startFragment( getBiff() );
     switch( eFragment )
     {
         case BIFF_FRAGMENT_GLOBALS:
         {
             // import workbook globals fragment and create sheets in document
             ISegmentProgressBarRef xGlobalsProgress = getProgressBar().createSegment( PROGRESS_LENGTH_GLOBALS );
-            bRet = importGlobalsFragment( rStrm, *xGlobalsProgress );
+            bRet = importGlobalsFragment( *xGlobalsProgress );
             // load sheet fragments (do not return false in bRet on missing/broken sheets)
             WorksheetBuffer& rWorksheets = getWorksheets();
             bool bNextSheet = bRet;
-            for( sal_Int32 nSheet = 0, nSheetCount = rWorksheets.getInternalSheetCount(); bNextSheet && (nSheet < nSheetCount); ++nSheet )
+            for( sal_Int32 nSheet = 0, nSheetCount = rWorksheets.getSheetCount(); bNextSheet && (nSheet < nSheetCount); ++nSheet )
             {
                 // try to start a new sheet fragment
                 double fSegmentLength = getProgressBar().getFreeLength() / (nSheetCount - nSheet);
                 ISegmentProgressBarRef xSheetProgress = getProgressBar().createSegment( fSegmentLength );
-                BiffFragmentType eSheetFragment = startFragment( rStrm, getBiff() );
-                bNextSheet = importSheetFragment( rStrm, *xSheetProgress, eSheetFragment, nSheet );
+                BiffFragmentType eSheetFragment = startFragment( getBiff() );
+                bNextSheet = importSheetFragment( *xSheetProgress, eSheetFragment, nSheet );
             }
         }
         break;
 
         case BIFF_FRAGMENT_WORKSPACE:
         {
-            bRet = importWorkspaceFragment( rStrm );
+            bRet = importWorkspaceFragment();
             // sheets are embedded in workspace fragment, nothing to do here
         }
         break;
@@ -462,7 +463,7 @@ bool BiffWorkbookFragment::importFragmen
                 - #i62752# possible in all BIFF versions
                 - do not return false in bRet on missing/broken sheets. */
             getWorksheets().initializeSingleSheet();
-            importSheetFragment( rStrm, getProgressBar(), eFragment, 0 );
+            importSheetFragment( getProgressBar(), eFragment, 0 );
             // success, even if stream is broken
             bRet = true;
         }
@@ -477,7 +478,7 @@ bool BiffWorkbookFragment::importFragmen
     return bRet;
 }
 
-bool BiffWorkbookFragment::importWorkspaceFragment( BiffInputStream& rStrm )
+bool BiffWorkbookFragment::importWorkspaceFragment()
 {
     // enable workbook mode, has not been set yet in BIFF4 workspace files
     setIsWorkbookFile();
@@ -488,35 +489,36 @@ bool BiffWorkbookFragment::importWorkspa
     // import the workspace globals
     ISegmentProgressBarRef xGlobalsProgress = getProgressBar().createSegment( PROGRESS_LENGTH_GLOBALS );
     bool bLoop = true;
-    while( bRet && bLoop && rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) )
+    while( bRet && bLoop && mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
     {
-        switch( rStrm.getRecId() )
+        switch( mrStrm.getRecId() )
         {
-            case BIFF_ID_SHEET:         rWorksheets.importSheet( rStrm );       break;
-            case BIFF_ID_CODEPAGE:      setCodePage( rStrm.readuInt16() );      break;
-            case BIFF_ID_FILEPASS:      bRet = importFilePass( rStrm );         break;
-            case BIFF_ID_SHEETHEADER:   rStrm.rewindRecord(); bLoop = false;    break;
+            case BIFF_ID_SHEET:         rWorksheets.importSheet( mrStrm );      break;
+            case BIFF_ID_CODEPAGE:      setCodePage( mrStrm.readuInt16() );     break;
+            case BIFF_ID_FILEPASS:      bRet = importFilePass();                break;
+            case BIFF_ID_SHEETHEADER:   mrStrm.rewindRecord(); bLoop = false;   break;
         }
     }
     xGlobalsProgress->setPosition( 1.0 );
 
     // load sheet fragments (do not return false in bRet on missing/broken sheets)
     bool bNextSheet = bRet;
-    for( sal_Int32 nSheet = 0, nSheetCount = rWorksheets.getInternalSheetCount(); bNextSheet && (nSheet < nSheetCount); ++nSheet )
+    for( sal_Int32 nSheet = 0, nSheetCount = rWorksheets.getSheetCount(); bNextSheet && (nSheet < nSheetCount); ++nSheet )
     {
         // try to start a new sheet fragment (with leading SHEETHEADER record)
-        bNextSheet = rStrm.startNextRecord() && (rStrm.getRecId() == BIFF_ID_SHEETHEADER);
+        bNextSheet = mrStrm.startNextRecord() && (mrStrm.getRecId() == BIFF_ID_SHEETHEADER);
         if( bNextSheet )
         {
             double fSegmentLength = getProgressBar().getFreeLength() / (nSheetCount - nSheet);
             ISegmentProgressBarRef xSheetProgress = getProgressBar().createSegment( fSegmentLength );
             /*  Read current sheet name (sheet substreams may not be in the
                 same order as SHEET records are). */
-            OUString aSheetName = rStrm.skip( 4 ).readByteString( false, getTextEncoding() );
+            mrStrm.skip( 4 );
+            OUString aSheetName = mrStrm.readByteString( false, getTextEncoding() );
             sal_Int32 nCurrSheet = rWorksheets.getFinalSheetIndex( aSheetName );
             // load the sheet fragment records
-            BiffFragmentType eSheetFragment = startFragment( rStrm, getBiff() );
-            bNextSheet = importSheetFragment( rStrm, *xSheetProgress, eSheetFragment, nCurrSheet );
+            BiffFragmentType eSheetFragment = startFragment( getBiff() );
+            bNextSheet = importSheetFragment( *xSheetProgress, eSheetFragment, nCurrSheet );
             // do not return false in bRet on missing/broken sheets
         }
     }
@@ -524,7 +526,7 @@ bool BiffWorkbookFragment::importWorkspa
     return bRet;
 }
 
-bool BiffWorkbookFragment::importGlobalsFragment( BiffInputStream& rStrm, ISegmentProgressBar& rProgressBar )
+bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgressBar )
 {
     WorkbookSettings& rWorkbookSett = getWorkbookSettings();
     ViewSettings& rViewSett = getViewSettings();
@@ -538,27 +540,27 @@ bool BiffWorkbookFragment::importGlobals
 
     bool bRet = true;
     bool bLoop = true;
-    while( bRet && bLoop && rStrm.startNextRecord() )
+    while( bRet && bLoop && mrStrm.startNextRecord() )
     {
-        sal_uInt16 nRecId = rStrm.getRecId();
+        sal_uInt16 nRecId = mrStrm.getRecId();
         bool bExtLinkRec = false;
 
         /*  #i56376# BIFF5-BIFF8: If an EOF record for globals is missing,
             simulate it. The issue is about a document where the sheet fragment
             starts directly after the EXTSST record, without terminating the
             globals fragment with an EOF record. */
-        if( isBofRecord( nRecId ) || (nRecId == BIFF_ID_EOF) )
+        if( isBofRecord() || (nRecId == BIFF_ID_EOF) )
         {
             bLoop = false;
         }
         else switch( nRecId )
         {
             // records in all BIFF versions
-            case BIFF_ID_CODEPAGE:      setCodePage( rStrm.readuInt16() );      break;
-            case BIFF_ID_DATEMODE:      rWorkbookSett.importDateMode( rStrm );  break;
-            case BIFF_ID_FILEPASS:      bRet = importFilePass( rStrm );         break;
-            case BIFF_ID_PRECISION:     rWorkbookSett.importPrecision( rStrm ); break;
-            case BIFF_ID_WINDOW1:       rViewSett.importWindow1( rStrm );       break;
+            case BIFF_ID_CODEPAGE:      setCodePage( mrStrm.readuInt16() );         break;
+            case BIFF_ID_DATEMODE:      rWorkbookSett.importDateMode( mrStrm );     break;
+            case BIFF_ID_FILEPASS:      bRet = importFilePass();                    break;
+            case BIFF_ID_PRECISION:     rWorkbookSett.importPrecision( mrStrm );    break;
+            case BIFF_ID_WINDOW1:       rViewSett.importWindow1( mrStrm );          break;
 
             // BIFF specific records
             default: switch( getBiff() )
@@ -568,10 +570,10 @@ bool BiffWorkbookFragment::importGlobals
                     case BIFF2_ID_DEFINEDNAME:  bExtLinkRec = true;                 break;
                     case BIFF2_ID_EXTERNALNAME: bExtLinkRec = true;                 break;
                     case BIFF_ID_EXTERNSHEET:   bExtLinkRec = true;                 break;
-                    case BIFF2_ID_FONT:         rStyles.importFont( rStrm );        break;
-                    case BIFF_ID_FONTCOLOR:     rStyles.importFontColor( rStrm );   break;
-                    case BIFF2_ID_FORMAT:       rStyles.importFormat( rStrm );      break;
-                    case BIFF2_ID_XF:           rStyles.importXf( rStrm );          break;
+                    case BIFF2_ID_FONT:         rStyles.importFont( mrStrm );       break;
+                    case BIFF_ID_FONTCOLOR:     rStyles.importFontColor( mrStrm );  break;
+                    case BIFF2_ID_FORMAT:       rStyles.importFormat( mrStrm );     break;
+                    case BIFF2_ID_XF:           rStyles.importXf( mrStrm );         break;
                 }
                 break;
 
@@ -581,13 +583,13 @@ bool BiffWorkbookFragment::importGlobals
                     case BIFF3_ID_DEFINEDNAME:  bExtLinkRec = true;                     break;
                     case BIFF3_ID_EXTERNALNAME: bExtLinkRec = true;                     break;
                     case BIFF_ID_EXTERNSHEET:   bExtLinkRec = true;                     break;
-                    case BIFF3_ID_FONT:         rStyles.importFont( rStrm );            break;
-                    case BIFF2_ID_FORMAT:       rStyles.importFormat( rStrm );          break;
-                    case BIFF_ID_HIDEOBJ:       rWorkbookSett.importHideObj( rStrm );   break;
-                    case BIFF_ID_PALETTE:       rStyles.importPalette( rStrm );         break;
-                    case BIFF_ID_STYLE:         rStyles.importStyle( rStrm );           break;
+                    case BIFF3_ID_FONT:         rStyles.importFont( mrStrm );           break;
+                    case BIFF2_ID_FORMAT:       rStyles.importFormat( mrStrm );         break;
+                    case BIFF_ID_HIDEOBJ:       rWorkbookSett.importHideObj( mrStrm );  break;
+                    case BIFF_ID_PALETTE:       rStyles.importPalette( mrStrm );        break;
+                    case BIFF_ID_STYLE:         rStyles.importStyle( mrStrm );          break;
                     case BIFF_ID_XCT:           bExtLinkRec = true;                     break;
-                    case BIFF3_ID_XF:           rStyles.importXf( rStrm );              break;
+                    case BIFF3_ID_XF:           rStyles.importXf( mrStrm );             break;
                 }
                 break;
 
@@ -597,53 +599,53 @@ bool BiffWorkbookFragment::importGlobals
                     case BIFF3_ID_DEFINEDNAME:  bExtLinkRec = true;                     break;
                     case BIFF3_ID_EXTERNALNAME: bExtLinkRec = true;                     break;
                     case BIFF_ID_EXTERNSHEET:   bExtLinkRec = true;                     break;
-                    case BIFF3_ID_FONT:         rStyles.importFont( rStrm );            break;
-                    case BIFF4_ID_FORMAT:       rStyles.importFormat( rStrm );          break;
-                    case BIFF_ID_HIDEOBJ:       rWorkbookSett.importHideObj( rStrm );   break;
-                    case BIFF_ID_PALETTE:       rStyles.importPalette( rStrm );         break;
-                    case BIFF_ID_STYLE:         rStyles.importStyle( rStrm );           break;
+                    case BIFF3_ID_FONT:         rStyles.importFont( mrStrm );           break;
+                    case BIFF4_ID_FORMAT:       rStyles.importFormat( mrStrm );         break;
+                    case BIFF_ID_HIDEOBJ:       rWorkbookSett.importHideObj( mrStrm );  break;
+                    case BIFF_ID_PALETTE:       rStyles.importPalette( mrStrm );        break;
+                    case BIFF_ID_STYLE:         rStyles.importStyle( mrStrm );          break;
                     case BIFF_ID_XCT:           bExtLinkRec = true;                     break;
-                    case BIFF4_ID_XF:           rStyles.importXf( rStrm );              break;
+                    case BIFF4_ID_XF:           rStyles.importXf( mrStrm );             break;
                 }
                 break;
 
                 case BIFF5: switch( nRecId )
                 {
-                    case BIFF_ID_BOOKBOOL:      rWorkbookSett.importBookBool( rStrm );  break;
+                    case BIFF_ID_BOOKBOOL:      rWorkbookSett.importBookBool( mrStrm ); break;
                     case BIFF_ID_CRN:           bExtLinkRec = true;                     break;
                     case BIFF5_ID_DEFINEDNAME:  bExtLinkRec = true;                     break;
                     case BIFF5_ID_EXTERNALNAME: bExtLinkRec = true;                     break;
                     case BIFF_ID_EXTERNSHEET:   bExtLinkRec = true;                     break;
-                    case BIFF5_ID_FONT:         rStyles.importFont( rStrm );            break;
-                    case BIFF4_ID_FORMAT:       rStyles.importFormat( rStrm );          break;
-                    case BIFF_ID_HIDEOBJ:       rWorkbookSett.importHideObj( rStrm );   break;
-                    case BIFF_ID_PALETTE:       rStyles.importPalette( rStrm );         break;
-                    case BIFF_ID_SHEET:         rWorksheets.importSheet( rStrm );       break;
-                    case BIFF_ID_STYLE:         rStyles.importStyle( rStrm );           break;
+                    case BIFF5_ID_FONT:         rStyles.importFont( mrStrm );           break;
+                    case BIFF4_ID_FORMAT:       rStyles.importFormat( mrStrm );         break;
+                    case BIFF_ID_HIDEOBJ:       rWorkbookSett.importHideObj( mrStrm );  break;
+                    case BIFF_ID_PALETTE:       rStyles.importPalette( mrStrm );        break;
+                    case BIFF_ID_SHEET:         rWorksheets.importSheet( mrStrm );      break;
+                    case BIFF_ID_STYLE:         rStyles.importStyle( mrStrm );          break;
                     case BIFF_ID_XCT:           bExtLinkRec = true;                     break;
-                    case BIFF5_ID_XF:           rStyles.importXf( rStrm );              break;
+                    case BIFF5_ID_XF:           rStyles.importXf( mrStrm );             break;
                 }
                 break;
 
                 case BIFF8: switch( nRecId )
                 {
-                    case BIFF_ID_BOOKBOOL:      rWorkbookSett.importBookBool( rStrm );  break;
-                    case BIFF_ID_CODENAME:      rWorkbookSett.importCodeName( rStrm );  break;
+                    case BIFF_ID_BOOKBOOL:      rWorkbookSett.importBookBool( mrStrm ); break;
+                    case BIFF_ID_CODENAME:      rWorkbookSett.importCodeName( mrStrm ); break;
                     case BIFF_ID_CRN:           bExtLinkRec = true;                     break;
                     case BIFF5_ID_DEFINEDNAME:  bExtLinkRec = true;                     break;
                     case BIFF_ID_EXTERNALBOOK:  bExtLinkRec = true;                     break;
                     case BIFF5_ID_EXTERNALNAME: bExtLinkRec = true;                     break;
                     case BIFF_ID_EXTERNSHEET:   bExtLinkRec = true;                     break;
-                    case BIFF5_ID_FONT:         rStyles.importFont( rStrm );            break;
-                    case BIFF4_ID_FORMAT:       rStyles.importFormat( rStrm );          break;
-                    case BIFF_ID_HIDEOBJ:       rWorkbookSett.importHideObj( rStrm );   break;
-                    case BIFF_ID_PALETTE:       rStyles.importPalette( rStrm );         break;
-                    case BIFF_ID_SHEET:         rWorksheets.importSheet( rStrm );       break;
-                    case BIFF_ID_SST:           rSharedStrings.importSst( rStrm );      break;
-                    case BIFF_ID_STYLE:         rStyles.importStyle( rStrm );           break;
-                    case BIFF_ID_USESELFS:      rWorkbookSett.importUsesElfs( rStrm );  break;
+                    case BIFF5_ID_FONT:         rStyles.importFont( mrStrm );           break;
+                    case BIFF4_ID_FORMAT:       rStyles.importFormat( mrStrm );         break;
+                    case BIFF_ID_HIDEOBJ:       rWorkbookSett.importHideObj( mrStrm );  break;
+                    case BIFF_ID_PALETTE:       rStyles.importPalette( mrStrm );        break;
+                    case BIFF_ID_SHEET:         rWorksheets.importSheet( mrStrm );      break;
+                    case BIFF_ID_SST:           rSharedStrings.importSst( mrStrm );     break;
+                    case BIFF_ID_STYLE:         rStyles.importStyle( mrStrm );          break;
+                    case BIFF_ID_USESELFS:      rWorkbookSett.importUsesElfs( mrStrm ); break;
                     case BIFF_ID_XCT:           bExtLinkRec = true;                     break;
-                    case BIFF5_ID_XF:           rStyles.importXf( rStrm );              break;
+                    case BIFF5_ID_XF:           rStyles.importXf( mrStrm );             break;
                 }
                 break;
 
@@ -652,7 +654,7 @@ bool BiffWorkbookFragment::importGlobals
         }
 
         if( bExtLinkRec )
-            aExtLinkRecs.push_back( rStrm.getRecHandle() );
+            aExtLinkRecs.push_back( mrStrm.getRecHandle() );
     }
 
     // finalize global buffers
@@ -666,48 +668,40 @@ bool BiffWorkbookFragment::importGlobals
     if( bRet && !aExtLinkRecs.empty() )
     {
         // remember current stream position (the EOF record)
-        sal_Int64 nEofHandle = rStrm.getRecHandle();
+        sal_Int64 nEofHandle = mrStrm.getRecHandle();
         // this fragment class implements import of external link records
         BiffExternalLinkFragment aLinkFragment( *this, true );
         // import all records by using their cached record handle
-        for( RecordHandleVec::const_iterator aIt = aExtLinkRecs.begin(), aEnd = aExtLinkRecs.end(); (aIt != aEnd) && rStrm.startRecordByHandle( *aIt ); ++aIt )
-            aLinkFragment.importRecord( rStrm );
+        for( RecordHandleVec::const_iterator aIt = aExtLinkRecs.begin(), aEnd = aExtLinkRecs.end(); (aIt != aEnd) && mrStrm.startRecordByHandle( *aIt ); ++aIt )
+            aLinkFragment.importRecord();
         // finalize global buffers
         aLinkFragment.finalizeImport();
         // seek back to the EOF record of the workbook globals fragment
-        bRet = rStrm.startRecordByHandle( nEofHandle );
+        bRet = mrStrm.startRecordByHandle( nEofHandle );
     }
 
     // #i56376# missing EOF - rewind before worksheet BOF record (see above)
-    if( bRet && isBofRecord( rStrm.getRecId() ) )
-        rStrm.rewindRecord();
+    if( bRet && isBofRecord() )
+        mrStrm.rewindRecord();
 
     rProgressBar.setPosition( 1.0 );
     return bRet;
 }
 
-bool BiffWorkbookFragment::importSheetFragment( BiffInputStream& rStrm, ISegmentProgressBar& rProgressBar, BiffFragmentType eFragment, sal_Int32 nSheet )
+bool BiffWorkbookFragment::importSheetFragment( ISegmentProgressBar& rProgressBar, BiffFragmentType eFragment, sal_Int32 nSheet )
 {
     // find the sheet type for this fragment
-    WorksheetType eSheetType = SHEETTYPE_WORKSHEET;
-    bool bSkipSheet = false;
+    WorksheetType eSheetType = SHEETTYPE_EMPTYSHEET;
     switch( eFragment )
     {
         case BIFF_FRAGMENT_WORKSHEET:   eSheetType = SHEETTYPE_WORKSHEET;   break;
         case BIFF_FRAGMENT_CHARTSHEET:  eSheetType = SHEETTYPE_CHARTSHEET;  break;
         case BIFF_FRAGMENT_MACROSHEET:  eSheetType = SHEETTYPE_MACROSHEET;  break;
         case BIFF_FRAGMENT_MODULESHEET: eSheetType = SHEETTYPE_MODULESHEET; break;
-        case BIFF_FRAGMENT_EMPTYSHEET:  bSkipSheet = true;                  break;
+        case BIFF_FRAGMENT_EMPTYSHEET:  eSheetType = SHEETTYPE_EMPTYSHEET;  break;
         default:                        return false;
     }
 
-    // skip this worksheet fragment (e.g. fragment type is BIFF_FRAGMENT_EMPTYSHEET)
-    if( bSkipSheet )
-    {
-        rProgressBar.setPosition( 1.0 );
-        return skipFragment( rStrm );
-    }
-
     /*  #i11183# Clear buffers that are used per-sheet, e.g. external links in
         BIFF4W and BIFF5 files, or defined names in BIFF4W files. */
     createBuffersPerSheet();
@@ -723,12 +717,12 @@ bool BiffWorkbookFragment::importSheetFr
             // set sheet index in defined names buffer to handle built-in names correctly
             getDefinedNames().setLocalSheetIndex( nSheet );
             // remember current record to seek back below
-            sal_Int64 nRecHandle = rStrm.getRecHandle();
+            sal_Int64 nRecHandle = mrStrm.getRecHandle();
             // import the global records
             ISegmentProgressBarRef xGlobalsProgress = rProgressBar.createSegment( PROGRESS_LENGTH_GLOBALS );
-            importGlobalsFragment( rStrm, *xGlobalsProgress );
+            importGlobalsFragment( *xGlobalsProgress );
             // rewind stream to fragment BOF record
-            rStrm.startRecordByHandle( nRecHandle );
+            mrStrm.startRecordByHandle( nRecHandle );
         }
         break;
 
@@ -736,11 +730,11 @@ bool BiffWorkbookFragment::importSheetFr
         case BIFF5:
         {
             // remember current record to seek back below
-            sal_Int64 nRecHandle = rStrm.getRecHandle();
+            sal_Int64 nRecHandle = mrStrm.getRecHandle();
             // fragment implementing import of external link records
-            BiffExternalLinkFragment( *this, false ).importFragment( rStrm );
+            BiffExternalLinkFragment( *this, false ).importFragment();
             // rewind stream to fragment BOF record
-            rStrm.startRecordByHandle( nRecHandle );
+            mrStrm.startRecordByHandle( nRecHandle );
         }
         break;
 
@@ -758,30 +752,31 @@ bool BiffWorkbookFragment::importSheetFr
     {
         case SHEETTYPE_WORKSHEET:
         case SHEETTYPE_MACROSHEET:
+        case SHEETTYPE_DIALOGSHEET:
             xFragment.reset( new BiffWorksheetFragment( *this, xSheetProgress, eSheetType, nSheet ) );
         break;
         case SHEETTYPE_CHARTSHEET:
             xFragment.reset( new BiffChartsheetFragment( *this, xSheetProgress, nSheet ) );
         break;
-        case SHEETTYPE_DIALOGSHEET:
         case SHEETTYPE_MODULESHEET:
-            xFragment.reset( new BiffWorksheetFragmentBase( *this, xSheetProgress, eSheetType, nSheet ) );
+        case SHEETTYPE_EMPTYSHEET:
+            xFragment.reset( new BiffSkipWorksheetFragment( *this, xSheetProgress, nSheet ) );
         break;
     }
     // load the sheet fragment records
-    return xFragment->isValidSheet() && xFragment->importFragment( rStrm );
+    return xFragment->isValidSheet() && xFragment->importFragment();
 }
 
-bool BiffWorkbookFragment::importFilePass( BiffInputStream& rStrm )
+bool BiffWorkbookFragment::importFilePass()
 {
-    rStrm.enableDecoder( false );
+    mrStrm.enableDecoder( false );
     BiffDecoderRef xDecoder = (getBiff() == BIFF8) ?
-        lclImportFilePass8( *this, rStrm ) : lclImportFilePass2( *this, rStrm );
+        lclImportFilePass8( *this, mrStrm ) : lclImportFilePass2( *this, mrStrm );
 
     // set decoder at import stream
-    rStrm.setDecoder( xDecoder );
+    mrStrm.setDecoder( xDecoder );
     //! TODO remember encryption state for export
-//    rStrm.GetRoot().GetExtDocOptions().GetDocSettings().mbEncrypted = true;
+//    mrStrm.GetRoot().GetExtDocOptions().GetDocSettings().mbEncrypted = true;
 
     return xDecoder.get() && xDecoder->isValid();
 }
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/workbookhelper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/workbookhelper.cxx
--- oox/source/xls/workbookhelper.cxx	2008-07-22 16:20:16.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/workbookhelper.cxx	2008-12-12 11:38:47.000000000 +0100
@@ -36,16 +36,20 @@
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/awt/XDevice.hpp>
 #include <com/sun/star/document/XActionLockable.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XNamedRange.hpp>
 #include <com/sun/star/sheet/XNamedRanges.hpp>
 #include <com/sun/star/sheet/XDatabaseRanges.hpp>
+#include <com/sun/star/sheet/XExternalDocLinks.hpp>
 #include <com/sun/star/style/XStyle.hpp>
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include "oox/helper/progressbar.hxx"
 #include "oox/helper/propertyset.hxx"
 #include "oox/core/binaryfilterbase.hxx"
 #include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/theme.hxx"
 #include "oox/xls/addressconverter.hxx"
 #include "oox/xls/defnamesbuffer.hxx"
 #include "oox/xls/excelchartconverter.hxx"
@@ -59,7 +63,6 @@
 #include "oox/xls/tablebuffer.hxx"
 #include "oox/xls/themebuffer.hxx"
 #include "oox/xls/unitconverter.hxx"
-#include "oox/xls/validationpropertyhelper.hxx"
 #include "oox/xls/viewsettings.hxx"
 #include "oox/xls/webquerybuffer.hxx"
 #include "oox/xls/workbooksettings.hxx"
@@ -78,16 +81,20 @@ using ::com::sun::star::container::XName
 using ::com::sun::star::lang::XMultiServiceFactory;
 using ::com::sun::star::awt::XDevice;
 using ::com::sun::star::document::XActionLockable;
+using ::com::sun::star::table::CellAddress;
 using ::com::sun::star::sheet::XSpreadsheetDocument;
 using ::com::sun::star::sheet::XSpreadsheet;
+using ::com::sun::star::sheet::XNamedRange;
 using ::com::sun::star::sheet::XNamedRanges;
 using ::com::sun::star::sheet::XDatabaseRanges;
+using ::com::sun::star::sheet::XExternalDocLinks;
 using ::com::sun::star::style::XStyle;
 using ::com::sun::star::style::XStyleFamiliesSupplier;
 using ::oox::core::BinaryFilterBase;
 using ::oox::core::FilterBase;
 using ::oox::core::FragmentHandler;
 using ::oox::core::XmlFilterBase;
+using ::oox::drawingml::Theme;
 
 // Set this define to 1 to show the load/save time of a document in an assertion.
 #define OOX_SHOW_LOADSAVE_TIME 0
@@ -174,14 +181,18 @@ public:
     Reference< XNamedRanges > getNamedRanges() const;
     /** Returns the container for database ranges from the Calc document. */
     Reference< XDatabaseRanges > getDatabaseRanges() const;
+    /** Returns the container for external documents from the Calc document. */
+    Reference< XExternalDocLinks > getExternalDocLinks() const;
     /** Returns the container for DDE links from the Calc document. */
     Reference< XNameAccess > getDdeLinks() const;
     /** Returns the cell or page styles container from the Calc document. */
     Reference< XNameContainer > getStyleFamily( bool bPageStyles ) const;
     /** Returns the specified cell or page style from the Calc document. */
     Reference< XStyle > getStyleObject( const OUString& rStyleName, bool bPageStyle ) const;
+    /** Creates and returns a defined name on-the-fly in the Calc document. */
+    Reference< XNamedRange > createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const;
     /** Creates a com.sun.star.style.Style object and returns its final name. */
-    Reference< XStyle > createStyleObject( OUString& orStyleName, bool bPageStyle, bool bRenameOldExisting );
+    Reference< XStyle > createStyleObject( OUString& orStyleName, bool bPageStyle, bool bRenameOldExisting ) const;
 
     // buffers ----------------------------------------------------------------
 
@@ -193,6 +204,8 @@ public:
     inline WorksheetBuffer& getWorksheets() const { return *mxWorksheets; }
     /** Returns the office theme object read from the theme substorage. */
     inline ThemeBuffer& getTheme() const { return *mxTheme; }
+    /** Returns the office theme object reference read from the theme substorage. */
+    inline ::boost::shared_ptr< Theme > getThemeRef() const { return mxTheme; }
     /** Returns all cell formatting objects read from the styles substream. */
     inline StylesBuffer& getStyles() const { return *mxStyles; }
     /** Returns the shared strings read from the shared strings substream. */
@@ -225,8 +238,6 @@ public:
     inline StylesPropertyHelper& getStylesPropertyHelper() const { return *mxStylesPropHlp; }
     /** Returns the converter for properties related to page/print settings. */
     inline PageSettingsPropertyHelper& getPageSettingsPropertyHelper() const { return *mxPageSettPropHlp; }
-    /** Returns the converter for properties related to data validation. */
-    inline ValidationPropertyHelper& getValidationPropertyHelper() const { return *mxValidationPropHlp; }
 
     // OOX specific -----------------------------------------------------------
 
@@ -265,7 +276,7 @@ private:
     typedef ::std::auto_ptr< WorkbookSettings >             WorkbookSettPtr;
     typedef ::std::auto_ptr< ViewSettings >                 ViewSettingsPtr;
     typedef ::std::auto_ptr< WorksheetBuffer >              WorksheetBfrPtr;
-    typedef ::std::auto_ptr< ThemeBuffer >                  ThemeBfrPtr;
+    typedef ::boost::shared_ptr< ThemeBuffer >              ThemeBfrRef;
     typedef ::std::auto_ptr< StylesBuffer >                 StylesBfrPtr;
     typedef ::std::auto_ptr< SharedStringsBuffer >          SharedStrBfrPtr;
     typedef ::std::auto_ptr< ExternalLinkBuffer >           ExtLinkBfrPtr;
@@ -278,12 +289,12 @@ private:
     typedef ::std::auto_ptr< ExcelChartConverter >          ExcelChartConvPtr;
     typedef ::std::auto_ptr< StylesPropertyHelper >         StylesPropHlpPtr;
     typedef ::std::auto_ptr< PageSettingsPropertyHelper >   PageSettPropHlpPtr;
-    typedef ::std::auto_ptr< ValidationPropertyHelper >     ValidationPropHlpPtr;
     typedef ::std::auto_ptr< FormulaParser >                FormulaParserPtr;
 
     OUString            maRefDeviceProp;        /// Property name for reference device.
     OUString            maNamedRangesProp;      /// Property name for defined names.
     OUString            maDatabaseRangesProp;   /// Property name for database ranges.
+    OUString            maExtDocLinksProp;      /// Property name for external links.
     OUString            maDdeLinksProp;         /// Property name for DDE links.
     OUString            maCellStylesProp;       /// Property name for cell styles.
     OUString            maPageStylesProp;       /// Property name for page styles.
@@ -300,7 +311,7 @@ private:
     WorkbookSettPtr     mxWorkbookSettings;     /// Global workbook settings.
     ViewSettingsPtr     mxViewSettings;         /// Workbook and sheet view settings.
     WorksheetBfrPtr     mxWorksheets;           /// Sheet info buffer.
-    ThemeBfrPtr         mxTheme;                /// Formatting theme from theme substream.
+    ThemeBfrRef         mxTheme;                /// Formatting theme from theme substream.
     StylesBfrPtr        mxStyles;               /// All cell style objects from styles substream.
     SharedStrBfrPtr     mxSharedStrings;        /// All strings from shared strings substream.
     ExtLinkBfrPtr       mxExtLinks;             /// All external links.
@@ -318,7 +329,6 @@ private:
     // property helpers
     StylesPropHlpPtr    mxStylesPropHlp;        /// Helper for all styles properties.
     PageSettPropHlpPtr  mxPageSettPropHlp;      /// Helper for page/print properties.
-    ValidationPropHlpPtr mxValidationPropHlp;   /// Helper for data validation properties.
 
     // OOX specific
     XmlFilterBase*      mpOoxFilter;            /// Base OOX filter object.
@@ -383,6 +393,14 @@ Reference< XDatabaseRanges > WorkbookDat
     return xDatabaseRanges;
 }
 
+Reference< XExternalDocLinks > WorkbookData::getExternalDocLinks() const
+{
+    PropertySet aPropSet( mxDoc );
+    Reference< XExternalDocLinks > xDocLinks;
+    aPropSet.getProperty( xDocLinks, maExtDocLinksProp );
+    return xDocLinks;
+}
+
 Reference< XNameAccess > WorkbookData::getDdeLinks() const
 {
     PropertySet aPropSet( mxDoc );
@@ -422,7 +440,29 @@ Reference< XStyle > WorkbookData::getSty
     return xStyle;
 }
 
-Reference< XStyle > WorkbookData::createStyleObject( OUString& orStyleName, bool bPageStyle, bool bRenameOldExisting )
+Reference< XNamedRange > WorkbookData::createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const
+{
+    // find an unused name
+    Reference< XNamedRanges > xNamedRanges = getNamedRanges();
+    Reference< XNameAccess > xNameAccess( xNamedRanges, UNO_QUERY );
+    if( xNameAccess.is() )
+        orName = ContainerHelper::getUnusedName( xNameAccess, orName, '_' );
+
+    // create the name and insert it into the Calc document
+    Reference< XNamedRange > xNamedRange;
+    if( xNamedRanges.is() && (orName.getLength() > 0) ) try
+    {
+        xNamedRanges->addNewByName( orName, OUString(), CellAddress( 0, 0, 0 ), nNameFlags );
+        xNamedRange.set( xNamedRanges->getByName( orName ), UNO_QUERY );
+    }
+    catch( Exception& )
+    {
+    }
+    OSL_ENSURE( xNamedRange.is(), "WorkbookData::createNamedRangeObject - cannot create defined name" );
+    return xNamedRange;
+}
+
+Reference< XStyle > WorkbookData::createStyleObject( OUString& orStyleName, bool bPageStyle, bool bRenameOldExisting ) const
 {
     Reference< XStyle > xStyle;
     Reference< XNameContainer > xStylesNC = getStyleFamily( bPageStyle );
@@ -515,6 +555,7 @@ void WorkbookData::initialize( bool bWor
     maRefDeviceProp = CREATE_OUSTRING( "ReferenceDevice" );
     maNamedRangesProp = CREATE_OUSTRING( "NamedRanges" );
     maDatabaseRangesProp = CREATE_OUSTRING( "DatabaseRanges" );
+    maExtDocLinksProp = CREATE_OUSTRING( "ExternalDocLinks" );
     maDdeLinksProp = CREATE_OUSTRING( "DDELinks" );
     maCellStylesProp = CREATE_OUSTRING( "CellStyles" );
     maPageStylesProp = CREATE_OUSTRING( "PageStyles" );
@@ -548,7 +589,6 @@ void WorkbookData::initialize( bool bWor
 
     mxStylesPropHlp.reset( new StylesPropertyHelper( *this ) );
     mxPageSettPropHlp.reset( new PageSettingsPropertyHelper( *this ) );
-    mxValidationPropHlp.reset( new ValidationPropertyHelper( *this ) );
 
     // set some document properties needed during import
     if( mrBaseFilter.isImportFilter() )
@@ -697,6 +737,11 @@ Reference< XDatabaseRanges > WorkbookHel
     return mrBookData.getDatabaseRanges();
 }
 
+Reference< XExternalDocLinks > WorkbookHelper::getExternalDocLinks() const
+{
+    return mrBookData.getExternalDocLinks();
+}
+
 Reference< XNameAccess > WorkbookHelper::getDdeLinks() const
 {
     return mrBookData.getDdeLinks();
@@ -712,7 +757,12 @@ Reference< XStyle > WorkbookHelper::getS
     return mrBookData.getStyleObject( rStyleName, bPageStyle );
 }
 
-Reference< XStyle > WorkbookHelper::createStyleObject( OUString& orStyleName, bool bPageStyle, bool bRenameOldExisting )
+Reference< XNamedRange > WorkbookHelper::createNamedRangeObject( OUString& orName, sal_Int32 nNameFlags ) const
+{
+    return mrBookData.createNamedRangeObject( orName, nNameFlags );
+}
+
+Reference< XStyle > WorkbookHelper::createStyleObject( OUString& orStyleName, bool bPageStyle, bool bRenameOldExisting ) const
 {
     return mrBookData.createStyleObject( orStyleName, bPageStyle, bRenameOldExisting );
 }
@@ -739,6 +789,11 @@ ThemeBuffer& WorkbookHelper::getTheme() 
     return mrBookData.getTheme();
 }
 
+::boost::shared_ptr< Theme > WorkbookHelper::getThemeRef() const
+{
+    return mrBookData.getThemeRef();
+}
+
 StylesBuffer& WorkbookHelper::getStyles() const
 {
     return mrBookData.getStyles();
@@ -808,11 +863,6 @@ PageSettingsPropertyHelper& WorkbookHelp
     return mrBookData.getPageSettingsPropertyHelper();
 }
 
-ValidationPropertyHelper& WorkbookHelper::getValidationPropertyHelper() const
-{
-    return mrBookData.getValidationPropertyHelper();
-}
-
 // OOX specific ---------------------------------------------------------------
 
 XmlFilterBase& WorkbookHelper::getOoxFilter() const
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/worksheetbuffer.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/worksheetbuffer.cxx
--- oox/source/xls/worksheetbuffer.cxx	2008-07-08 09:26:25.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/worksheetbuffer.cxx	2008-12-12 11:38:47.000000000 +0100
@@ -31,12 +31,11 @@
 #include "oox/xls/worksheetbuffer.hxx"
 #include <rtl/ustrbuf.hxx>
 #include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
 #include <com/sun/star/sheet/XExternalSheetName.hpp>
 #include <com/sun/star/sheet/XSheetLinkable.hpp>
-#include <comphelper/processfactory.hxx>
 #include "oox/helper/attributelist.hxx"
 #include "oox/helper/containerhelper.hxx"
 #include "oox/helper/propertyset.hxx"
@@ -49,17 +48,12 @@ using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::uno::UNO_QUERY_THROW;
 using ::com::sun::star::container::XIndexAccess;
 using ::com::sun::star::container::XNameAccess;
 using ::com::sun::star::container::XNamed;
-using ::com::sun::star::lang::XMultiServiceFactory;
 using ::com::sun::star::sheet::XSpreadsheetDocument;
 using ::com::sun::star::sheet::XSpreadsheets;
-using ::com::sun::star::sheet::XSpreadsheet;
-using ::com::sun::star::sheet::XExternalSheetName;
-using ::com::sun::star::sheet::XSheetLinkable;
 
 namespace oox {
 namespace xls {
@@ -93,8 +87,6 @@ WorksheetBuffer::WorksheetBuffer( const 
     WorkbookHelper( rHelper ),
     maIsVisibleProp( CREATE_OUSTRING( "IsVisible" ) )
 {
-    // character classification service for conversion to valid sheet names
-    Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
 }
 
 void WorksheetBuffer::initializeSingleSheet()
@@ -108,7 +100,7 @@ void WorksheetBuffer::initializeSingleSh
 void WorksheetBuffer::importSheet( const AttributeList& rAttribs )
 {
     OoxSheetInfo aSheetInfo;
-    aSheetInfo.maId = rAttribs.getString( R_TOKEN( id ), OUString() );
+    aSheetInfo.maRelId = rAttribs.getString( R_TOKEN( id ), OUString() );
     aSheetInfo.maName = rAttribs.getString( XML_name, OUString() );
     aSheetInfo.mnSheetId = rAttribs.getInteger( XML_sheetId, -1 );
     aSheetInfo.mnState = rAttribs.getToken( XML_state, XML_visible );
@@ -119,7 +111,7 @@ void WorksheetBuffer::importSheet( Recor
 {
     sal_Int32 nState;
     OoxSheetInfo aSheetInfo;
-    rStrm >> nState >> aSheetInfo.mnSheetId >> aSheetInfo.maId >> aSheetInfo.maName;
+    rStrm >> nState >> aSheetInfo.mnSheetId >> aSheetInfo.maRelId >> aSheetInfo.maName;
     static const sal_Int32 spnStates[] = { XML_visible, XML_hidden, XML_veryHidden };
     aSheetInfo.mnState = STATIC_ARRAY_SELECT( spnStates, nState, XML_visible );
     insertSheet( aSheetInfo );
@@ -143,42 +135,7 @@ void WorksheetBuffer::importSheet( BiffI
     insertSheet( aSheetInfo );
 }
 
-sal_Int32 WorksheetBuffer::insertExternalSheet( const OUString& rTargetUrl, const OUString& rSheetName )
-{
-    // try to find existing external sheet (needed for BIFF4W and BIFF5)
-    ExternalSheetName aExtSheet( rTargetUrl, rSheetName );
-    ExternalSheetMap::iterator aIt = maExternalSheets.find( aExtSheet );
-    if( aIt != maExternalSheets.end() )
-        return aIt->second;
-
-    // create a new external sheet
-    sal_Int16& rnSheet = maExternalSheets[ aExtSheet ];
-    rnSheet = getTotalSheetCount();
-    insertSheet( OUString(), rnSheet, false );
-
-    try
-    {
-        Reference< XSpreadsheet > xSheet = getSheet( rnSheet );
-        // use base file name as sheet name, if sheet name is missing (e.g. links to BIFF2-BIFF4 files)
-        OUString aSheetName = rSheetName;
-        if( aSheetName.getLength() == 0 )
-            aSheetName = lclGetBaseFileName( rTargetUrl );
-        // link the sheet
-        Reference< XSheetLinkable > xLinkable( xSheet, UNO_QUERY_THROW );
-        xLinkable->link( rTargetUrl, aSheetName, OUString(), OUString(), ::com::sun::star::sheet::SheetLinkMode_VALUE );
-        // set the special external sheet name
-        Reference< XExternalSheetName > xSheetName( xSheet, UNO_QUERY_THROW );
-        xSheetName->setExternalName( xLinkable->getLinkUrl(), xLinkable->getLinkSheetName() );
-    }
-    catch( Exception& )
-    {
-    }
-
-    // return sheet index
-    return rnSheet;
-}
-
-sal_Int32 WorksheetBuffer::getInternalSheetCount() const
+sal_Int32 WorksheetBuffer::getSheetCount() const
 {
     return static_cast< sal_Int32 >( maSheetInfos.size() );
 }
@@ -187,7 +144,7 @@ OUString WorksheetBuffer::getSheetRelId(
 {
     OUString aRelId;
     if( const OoxSheetInfo* pInfo = getSheetInfo( nSheet ) )
-        aRelId = pInfo->maId;
+        aRelId = pInfo->maRelId;
     return aRelId;
 }
 
@@ -219,20 +176,6 @@ sal_Int32 WorksheetBuffer::getFinalSheet
 
 // private --------------------------------------------------------------------
 
-sal_Int16 WorksheetBuffer::getTotalSheetCount() const
-{
-    try
-    {
-        Reference< XIndexAccess > xSheetsIA( getDocument()->getSheets(), UNO_QUERY_THROW );
-        return static_cast< sal_Int16 >( xSheetsIA->getCount() );
-    }
-    catch( Exception& )
-    {
-        OSL_ENSURE( false, "WorksheetBuffer::getTotalSheetCount - cannot get sheet count" );
-    }
-    return 1;
-}
-
 const OoxSheetInfo* WorksheetBuffer::getSheetInfo( sal_Int32 nSheet ) const
 {
     return ((0 <= nSheet) && (static_cast< size_t >( nSheet ) < maSheetInfos.size())) ?
@@ -279,7 +222,6 @@ OUString WorksheetBuffer::insertSheet( c
 
 void WorksheetBuffer::insertSheet( const OoxSheetInfo& rSheetInfo )
 {
-    OSL_ENSURE( maExternalSheets.empty(), "WorksheetBuffer::insertSheet - external sheets exist already" );
     sal_Int16 nSheet = static_cast< sal_Int16 >( maSheetInfos.size() );
     maSheetInfos.push_back( rSheetInfo );
     maSheetInfos.back().maFinalName = insertSheet( rSheetInfo.maName, nSheet, rSheetInfo.mnState == XML_visible );
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/worksheetfragment.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/worksheetfragment.cxx
--- oox/source/xls/worksheetfragment.cxx	2008-07-01 14:29:43.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/worksheetfragment.cxx	2009-03-24 15:05:56.000000000 +0100
@@ -81,12 +81,21 @@ const sal_uInt32 BIFF_DATAVAL_NODROPDOWN
 const sal_uInt32 BIFF_DATAVAL_SHOWINPUT     = 0x00040000;
 const sal_uInt32 BIFF_DATAVAL_SHOWERROR     = 0x00080000;
 
-const sal_uInt32 BIFF_HYPERLINK_TARGET      = 0x00000001;   /// File name or URL.
-const sal_uInt32 BIFF_HYPERLINK_ABS         = 0x00000002;   /// Absolute path.
-const sal_uInt32 BIFF_HYPERLINK_DISPLAY     = 0x00000014;   /// Display string.
-const sal_uInt32 BIFF_HYPERLINK_LOC         = 0x00000008;   /// Target location.
-const sal_uInt32 BIFF_HYPERLINK_FRAME       = 0x00000080;   /// Target frame.
-const sal_uInt32 BIFF_HYPERLINK_UNC         = 0x00000100;   /// UNC path.
+const sal_uInt32 OLE_HYPERLINK_HASTARGET    = 0x00000001;   /// Has hyperlink moniker.
+const sal_uInt32 OLE_HYPERLINK_ABSOLUTE     = 0x00000002;   /// Absolute path.
+const sal_uInt32 OLE_HYPERLINK_HASLOCATION  = 0x00000008;   /// Has target location.
+const sal_uInt32 OLE_HYPERLINK_HASDISPLAY   = 0x00000010;   /// Has display string.
+const sal_uInt32 OLE_HYPERLINK_HASGUID      = 0x00000020;   /// Has identification GUID.
+const sal_uInt32 OLE_HYPERLINK_HASTIME      = 0x00000040;   /// Has creation time.
+const sal_uInt32 OLE_HYPERLINK_HASFRAME     = 0x00000080;   /// Has frame.
+const sal_uInt32 OLE_HYPERLINK_ASSTRING     = 0x00000100;   /// Hyperlink as simple string.
+
+const sal_Int32 OOBIN_OLEOBJECT_CONTENT     = 1;
+const sal_Int32 OOBIN_OLEOBJECT_ICON        = 4;
+const sal_Int32 OOBIN_OLEOBJECT_ALWAYS      = 1;
+const sal_Int32 OOBIN_OLEOBJECT_ONCALL      = 3;
+const sal_uInt16 OOBIN_OLEOBJECT_AUTOLOAD   = 0x0001;
+const sal_uInt16 OOBIN_OLEOBJECT_LINKED     = 0x0002;
 
 } // namespace
 
@@ -113,13 +122,15 @@ ContextWrapper OoxWorksheetFragment::onC
             case SHEETTYPE_WORKSHEET:   return  (nElement == XLS_TOKEN( worksheet ));
             case SHEETTYPE_CHARTSHEET:  return  false;
             case SHEETTYPE_MACROSHEET:  return  (nElement == XM_TOKEN( macrosheet ));
-            case SHEETTYPE_DIALOGSHEET: return  false;
+            case SHEETTYPE_DIALOGSHEET: return  (nElement == XLS_TOKEN( dialogsheet ));
             case SHEETTYPE_MODULESHEET: return  false;
+            case SHEETTYPE_EMPTYSHEET:  return  false;
         }
         break;
 
         case XLS_TOKEN( worksheet ):
         case XM_TOKEN( macrosheet ):
+        case XLS_TOKEN( dialogsheet ):
             switch( nElement )
             {
                 case XLS_TOKEN( sheetData ):
@@ -146,7 +157,10 @@ ContextWrapper OoxWorksheetFragment::onC
                     (nElement == XLS_TOKEN( picture )) ||
                     (nElement == XLS_TOKEN( rowBreaks )) ||
                     (nElement == XLS_TOKEN( colBreaks )) ||
-                    (nElement == XLS_TOKEN( drawing ));
+                    (nElement == XLS_TOKEN( drawing )) ||
+                    (nElement == XLS_TOKEN( legacyDrawing )) ||
+                    (nElement == XLS_TOKEN( oleObjects )) ||
+                    (nElement == XLS_TOKEN( controls ));
 
         case XLS_TOKEN( sheetPr ):
             return  (nElement == XLS_TOKEN( tabColor )) ||
@@ -184,6 +198,11 @@ ContextWrapper OoxWorksheetFragment::onC
         case XLS_TOKEN( rowBreaks ):
         case XLS_TOKEN( colBreaks ):
             return  (nElement == XLS_TOKEN( brk ));
+
+        case XLS_TOKEN( oleObjects ):
+            return  (nElement == XLS_TOKEN( oleObject ));
+        case XLS_TOKEN( controls ):
+            return  (nElement == XLS_TOKEN( control ));
     }
     return false;
 }
@@ -193,7 +212,7 @@ void OoxWorksheetFragment::onStartElemen
     switch( getCurrentElement() )
     {
         case XLS_TOKEN( sheetPr ):          getWorksheetSettings().importSheetPr( rAttribs );               break;
-        case XLS_TOKEN( tabColor ):         getWorksheetSettings().importTabColor( rAttribs );              break;
+        case XLS_TOKEN( tabColor ):         getSheetViewSettings().importTabColor( rAttribs );              break;
         case XLS_TOKEN( outlinePr ):        getWorksheetSettings().importOutlinePr( rAttribs );             break;
         case XLS_TOKEN( pageSetUpPr ):      importPageSetUpPr( rAttribs );                                  break;
         case XLS_TOKEN( dimension ):        importDimension( rAttribs );                                    break;
@@ -214,6 +233,9 @@ void OoxWorksheetFragment::onStartElemen
         case XLS_TOKEN( picture ):          getPageSettings().importPicture( getRelations(), rAttribs );    break;
         case XLS_TOKEN( brk ):              importBrk( rAttribs );                                          break;
         case XLS_TOKEN( drawing ):          importDrawing( rAttribs );                                      break;
+        case XLS_TOKEN( legacyDrawing ):    importLegacyDrawing( rAttribs );                                break;
+        case XLS_TOKEN( oleObject ):        importOleObject( rAttribs );                                    break;
+        case XLS_TOKEN( control ):          importControl( rAttribs );                                      break;
     }
 }
 
@@ -295,7 +317,10 @@ ContextWrapper OoxWorksheetFragment::onC
                     (nRecId == OOBIN_ID_COLBREAKS) ||
                     (nRecId == OOBIN_ID_SHEETPROTECTION) ||
                     (nRecId == OOBIN_ID_PHONETICPR) ||
-                    (nRecId == OOBIN_ID_DRAWING);
+                    (nRecId == OOBIN_ID_DRAWING) ||
+                    (nRecId == OOBIN_ID_LEGACYDRAWING) ||
+                    (nRecId == OOBIN_ID_OLEOBJECTS) ||
+                    (nRecId == OOBIN_ID_CONTROLS);
         case OOBIN_ID_SHEETVIEWS:
             return  (nRecId == OOBIN_ID_SHEETVIEW);
         case OOBIN_ID_SHEETVIEW:
@@ -310,6 +335,10 @@ ContextWrapper OoxWorksheetFragment::onC
         case OOBIN_ID_ROWBREAKS:
         case OOBIN_ID_COLBREAKS:
             return  (nRecId == OOBIN_ID_BRK);
+        case OOBIN_ID_OLEOBJECTS:
+            return  (nRecId == OOBIN_ID_OLEOBJECT);
+        case OOBIN_ID_CONTROLS:
+            return  (nRecId == OOBIN_ID_CONTROL);
     }
     return false;
 }
@@ -337,6 +366,9 @@ void OoxWorksheetFragment::onStartRecord
         case OOBIN_ID_PICTURE:          getPageSettings().importPicture( getRelations(), rStrm );   break;
         case OOBIN_ID_BRK:              importBrk( rStrm );                                         break;
         case OOBIN_ID_DRAWING:          importDrawing( rStrm );                                     break;
+        case OOBIN_ID_LEGACYDRAWING:    importLegacyDrawing( rStrm );                               break;
+        case OOBIN_ID_OLEOBJECT:        importOleObject( rStrm );                                   break;
+        case OOBIN_ID_CONTROL:          importControl( rStrm );                                     break;
     }
 }
 
@@ -351,6 +383,7 @@ const RecordInfo* OoxWorksheetFragment::
         { OOBIN_ID_COLORSCALE,          OOBIN_ID_COLORSCALE + 1         },
         { OOBIN_ID_COLS,                OOBIN_ID_COLS + 1               },
         { OOBIN_ID_CONDFORMATTING,      OOBIN_ID_CONDFORMATTING + 1     },
+        { OOBIN_ID_CONTROLS,            OOBIN_ID_CONTROLS + 2           },
         { OOBIN_ID_CUSTOMSHEETVIEW,     OOBIN_ID_CUSTOMSHEETVIEW + 1    },
         { OOBIN_ID_CUSTOMSHEETVIEWS,    OOBIN_ID_CUSTOMSHEETVIEWS + 3   },
         { OOBIN_ID_DATABAR,             OOBIN_ID_DATABAR + 1            },
@@ -358,6 +391,7 @@ const RecordInfo* OoxWorksheetFragment::
         { OOBIN_ID_HEADERFOOTER,        OOBIN_ID_HEADERFOOTER + 1       },
         { OOBIN_ID_ICONSET,             OOBIN_ID_ICONSET + 1            },
         { OOBIN_ID_MERGECELLS,          OOBIN_ID_MERGECELLS + 1         },
+        { OOBIN_ID_OLEOBJECTS,          OOBIN_ID_OLEOBJECTS + 2         },
         { OOBIN_ID_ROW,                 -1                              },
         { OOBIN_ID_ROWBREAKS,           OOBIN_ID_ROWBREAKS + 1          },
         { OOBIN_ID_SHEETDATA,           OOBIN_ID_SHEETDATA + 1          },
@@ -495,6 +529,37 @@ void OoxWorksheetFragment::importDrawing
     setDrawingPath( getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ) );
 }
 
+void OoxWorksheetFragment::importLegacyDrawing( const AttributeList& rAttribs )
+{
+    setVmlDrawingPath( getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ) );
+}
+
+void OoxWorksheetFragment::importOleObject( const AttributeList& rAttribs )
+{
+    OoxOleObjectData aData;
+    aData.maProgId = rAttribs.getString( XML_progId, OUString() );
+    OSL_ENSURE( rAttribs.hasAttribute( XML_link ) != rAttribs.hasAttribute( R_TOKEN( id ) ),
+        "OoxWorksheetFragment::importOleObject - either linked or embedded" );
+    if( rAttribs.hasAttribute( XML_link ) )
+        (void)0;
+    if( rAttribs.hasAttribute( R_TOKEN( id ) ) )
+        aData.maStoragePath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
+    aData.mnAspect = rAttribs.getToken( XML_dvAspect, XML_DVASPECT_CONTENT );
+    aData.mnUpdateMode = rAttribs.getToken( XML_oleUpdate, XML_OLEUPDATE_ALWAYS );
+    aData.mnShapeId = rAttribs.getInteger( XML_shapeId, 0 );
+    aData.mbAutoLoad = rAttribs.getBool( XML_autoLoad, false );
+    setOleObject( aData );
+}
+
+void OoxWorksheetFragment::importControl( const AttributeList& rAttribs )
+{
+    OoxFormControlData aData;
+    aData.maStoragePath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
+    aData.maName = rAttribs.getString( XML_name, OUString() );
+    aData.mnShapeId = rAttribs.getInteger( XML_shapeId, 0 );
+    setFormControl( aData );
+}
+
 void OoxWorksheetFragment::importDimension( RecordInputStream& rStrm )
 {
     BinRange aBinRange;
@@ -621,14 +686,44 @@ void OoxWorksheetFragment::importDrawing
     setDrawingPath( getFragmentPathFromRelId( rStrm.readString() ) );
 }
 
+void OoxWorksheetFragment::importLegacyDrawing( RecordInputStream& rStrm )
+{
+    setVmlDrawingPath( getFragmentPathFromRelId( rStrm.readString() ) );
+}
+
+void OoxWorksheetFragment::importOleObject( RecordInputStream& rStrm )
+{
+    OoxOleObjectData aData;
+    sal_Int32 nAspect, nUpdateMode;
+    sal_uInt16 nFlags;
+    rStrm >> nAspect >> nUpdateMode >> aData.mnShapeId >> nFlags >> aData.maProgId;
+    if( getFlag( nFlags, OOBIN_OLEOBJECT_LINKED ) )
+        (void)0;
+    else
+        aData.maStoragePath = getFragmentPathFromRelId( rStrm.readString() );
+    aData.mnAspect = (nAspect == OOBIN_OLEOBJECT_ICON) ? XML_DVASPECT_ICON : XML_DVASPECT_CONTENT;
+    aData.mnUpdateMode = (nUpdateMode == OOBIN_OLEOBJECT_ONCALL) ? XML_OLEUPDATE_ONCALL : XML_OLEUPDATE_ALWAYS;
+    aData.mbAutoLoad = getFlag( nFlags, OOBIN_OLEOBJECT_AUTOLOAD );
+    setOleObject( aData );
+}
+
+void OoxWorksheetFragment::importControl( RecordInputStream& rStrm )
+{
+    OoxFormControlData aData;
+    rStrm >> aData.mnShapeId;
+    aData.maStoragePath = getFragmentPathFromRelId( rStrm.readString() );
+    rStrm >> aData.maName;
+    setFormControl( aData );
+}
+
 // ============================================================================
 
-BiffWorksheetFragment::BiffWorksheetFragment( const WorkbookHelper& rHelper, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
-    BiffWorksheetFragmentBase( rHelper, xProgressBar, eSheetType, nSheet )
+BiffWorksheetFragment::BiffWorksheetFragment( const BiffWorkbookFragmentBase& rParent, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
+    BiffWorksheetFragmentBase( rParent, xProgressBar, eSheetType, nSheet )
 {
 }
 
-bool BiffWorksheetFragment::importFragment( BiffInputStream& rStrm )
+bool BiffWorksheetFragment::importFragment()
 {
     // initial processing in base class WorksheetHelper
     initializeWorksheetImport();
@@ -643,133 +738,132 @@ bool BiffWorksheetFragment::importFragme
     PageSettings& rPageSett           = getPageSettings();
 
     // process all record in this sheet fragment
-    while( rStrm.startNextRecord() && (rStrm.getRecId() != BIFF_ID_EOF) )
+    while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
     {
-        sal_uInt16 nRecId = rStrm.getRecId();
-
-        if( isBofRecord( nRecId ) )
+        if( isBofRecord() )
         {
             // skip unknown embedded fragments (BOF/EOF blocks)
-            skipFragment( rStrm );
+            skipFragment();
         }
         else
         {
-            // cache core stream position to detect if record is already processed
-            sal_Int64 nStrmPos = rStrm.getCoreStreamPos();
+            // cache base stream position to detect if record is already processed
+            sal_Int64 nStrmPos = mrStrm.tellBase();
+            sal_uInt16 nRecId = mrStrm.getRecId();
 
             switch( nRecId )
             {
                 // records in all BIFF versions
-                case BIFF_ID_BOTTOMMARGIN:      rPageSett.importBottomMargin( rStrm );      break;
-                case BIFF_ID_CALCCOUNT:         rWorkbookSett.importCalcCount( rStrm );     break;
-                case BIFF_ID_CALCMODE:          rWorkbookSett.importCalcMode( rStrm );      break;
-                case BIFF_ID_DEFCOLWIDTH:       importDefColWidth( rStrm );                 break;
-                case BIFF_ID_DELTA:             rWorkbookSett.importDelta( rStrm );         break;
-                case BIFF2_ID_DIMENSION:        importDimension( rStrm );                   break;
-                case BIFF3_ID_DIMENSION:        importDimension( rStrm );                   break;
-                case BIFF_ID_FOOTER:            rPageSett.importFooter( rStrm );            break;
-                case BIFF_ID_HEADER:            rPageSett.importHeader( rStrm );            break;
-                case BIFF_ID_HORPAGEBREAKS:     importPageBreaks( rStrm, true );            break;
-                case BIFF_ID_ITERATION:         rWorkbookSett.importIteration( rStrm );     break;
-                case BIFF_ID_LEFTMARGIN:        rPageSett.importLeftMargin( rStrm );        break;
-                case BIFF_ID_PANE:              rSheetViewSett.importPane( rStrm );         break;
-                case BIFF_ID_PASSWORD:          rWorksheetSett.importPassword( rStrm );     break;
-                case BIFF_ID_PRINTGRIDLINES:    rPageSett.importPrintGridLines( rStrm );    break;
-                case BIFF_ID_PRINTHEADERS:      rPageSett.importPrintHeaders( rStrm );      break;
-                case BIFF_ID_PROTECT:           rWorksheetSett.importProtect( rStrm );      break;
-                case BIFF_ID_REFMODE:           rWorkbookSett.importRefMode( rStrm );       break;
-                case BIFF_ID_RIGHTMARGIN:       rPageSett.importRightMargin( rStrm );       break;
-                case BIFF_ID_SELECTION:         rSheetViewSett.importSelection( rStrm );    break;
-                case BIFF_ID_TOPMARGIN:         rPageSett.importTopMargin( rStrm );         break;
-                case BIFF_ID_VERPAGEBREAKS:     importPageBreaks( rStrm, false );           break;
+                case BIFF_ID_BOTTOMMARGIN:      rPageSett.importBottomMargin( mrStrm );     break;
+                case BIFF_ID_CALCCOUNT:         rWorkbookSett.importCalcCount( mrStrm );    break;
+                case BIFF_ID_CALCMODE:          rWorkbookSett.importCalcMode( mrStrm );     break;
+                case BIFF_ID_DEFCOLWIDTH:       importDefColWidth();                        break;
+                case BIFF_ID_DELTA:             rWorkbookSett.importDelta( mrStrm );        break;
+                case BIFF2_ID_DIMENSION:        importDimension();                          break;
+                case BIFF3_ID_DIMENSION:        importDimension();                          break;
+                case BIFF_ID_FOOTER:            rPageSett.importFooter( mrStrm );           break;
+                case BIFF_ID_HEADER:            rPageSett.importHeader( mrStrm );           break;
+                case BIFF_ID_HORPAGEBREAKS:     importPageBreaks( true );                   break;
+                case BIFF_ID_ITERATION:         rWorkbookSett.importIteration( mrStrm );    break;
+                case BIFF_ID_LEFTMARGIN:        rPageSett.importLeftMargin( mrStrm );       break;
+                case BIFF_ID_PANE:              rSheetViewSett.importPane( mrStrm );        break;
+                case BIFF_ID_PASSWORD:          rWorksheetSett.importPassword( mrStrm );    break;
+                case BIFF_ID_PRINTGRIDLINES:    rPageSett.importPrintGridLines( mrStrm );   break;
+                case BIFF_ID_PRINTHEADERS:      rPageSett.importPrintHeaders( mrStrm );     break;
+                case BIFF_ID_PROTECT:           rWorksheetSett.importProtect( mrStrm );     break;
+                case BIFF_ID_REFMODE:           rWorkbookSett.importRefMode( mrStrm );      break;
+                case BIFF_ID_RIGHTMARGIN:       rPageSett.importRightMargin( mrStrm );      break;
+                case BIFF_ID_SELECTION:         rSheetViewSett.importSelection( mrStrm );   break;
+                case BIFF_ID_TOPMARGIN:         rPageSett.importTopMargin( mrStrm );        break;
+                case BIFF_ID_VERPAGEBREAKS:     importPageBreaks( false );                  break;
 
                 // BIFF specific records
                 default: switch( getBiff() )
                 {
                     case BIFF2: switch( nRecId )
                     {
-                        case BIFF_ID_COLUMNDEFAULT: importColumnDefault( rStrm );           break;
-                        case BIFF_ID_COLWIDTH:      importColWidth( rStrm );                break;
-                        case BIFF2_ID_DEFROWHEIGHT: importDefRowHeight( rStrm );            break;
-                        case BIFF2_ID_WINDOW2:      rSheetViewSett.importWindow2( rStrm );  break;
+                        case BIFF_ID_COLUMNDEFAULT: importColumnDefault();                  break;
+                        case BIFF_ID_COLWIDTH:      importColWidth();                       break;
+                        case BIFF2_ID_DEFROWHEIGHT: importDefRowHeight();                   break;
+                        case BIFF2_ID_WINDOW2:      rSheetViewSett.importWindow2( mrStrm ); break;
                     }
                     break;
 
                     case BIFF3: switch( nRecId )
                     {
-                        case BIFF_ID_COLINFO:       importColInfo( rStrm );                         break;
-                        case BIFF_ID_DEFCOLWIDTH:   importDefColWidth( rStrm );                     break;
-                        case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight( rStrm );                    break;
-                        case BIFF_ID_HCENTER:       rPageSett.importHorCenter( rStrm );             break;
-                        case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm );    break;
-                        case BIFF_ID_SAVERECALC:    rWorkbookSett.importSaveRecalc( rStrm );        break;
-                        case BIFF_ID_SHEETPR:       rWorksheetSett.importSheetPr( rStrm );          break;
-                        case BIFF_ID_UNCALCED:      rWorkbookSett.importUncalced( rStrm );          break;
-                        case BIFF_ID_VCENTER:       rPageSett.importVerCenter( rStrm );             break;
-                        case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( rStrm );          break;
+                        case BIFF_ID_COLINFO:       importColInfo();                                break;
+                        case BIFF_ID_DEFCOLWIDTH:   importDefColWidth();                            break;
+                        case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight();                           break;
+                        case BIFF_ID_HCENTER:       rPageSett.importHorCenter( mrStrm );            break;
+                        case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm );   break;
+                        case BIFF_ID_SAVERECALC:    rWorkbookSett.importSaveRecalc( mrStrm );       break;
+                        case BIFF_ID_SHEETPR:       rWorksheetSett.importSheetPr( mrStrm );         break;
+                        case BIFF_ID_UNCALCED:      rWorkbookSett.importUncalced( mrStrm );         break;
+                        case BIFF_ID_VCENTER:       rPageSett.importVerCenter( mrStrm );            break;
+                        case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( mrStrm );         break;
 
                     }
                     break;
 
                     case BIFF4: switch( nRecId )
                     {
-                        case BIFF_ID_COLINFO:       importColInfo( rStrm );                         break;
-                        case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight( rStrm );                    break;
-                        case BIFF_ID_HCENTER:       rPageSett.importHorCenter( rStrm );             break;
-                        case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm );    break;
-                        case BIFF_ID_PAGESETUP:     rPageSett.importPageSetup( rStrm );             break;
-                        case BIFF_ID_SAVERECALC:    rWorkbookSett.importSaveRecalc( rStrm );        break;
-                        case BIFF_ID_SHEETPR:       rWorksheetSett.importSheetPr( rStrm );          break;
-                        case BIFF_ID_STANDARDWIDTH: importStandardWidth( rStrm );                   break;
-                        case BIFF_ID_UNCALCED:      rWorkbookSett.importUncalced( rStrm );          break;
-                        case BIFF_ID_VCENTER:       rPageSett.importVerCenter( rStrm );             break;
-                        case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( rStrm );          break;
+                        case BIFF_ID_COLINFO:       importColInfo();                                break;
+                        case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight();                           break;
+                        case BIFF_ID_HCENTER:       rPageSett.importHorCenter( mrStrm );            break;
+                        case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm );   break;
+                        case BIFF_ID_PAGESETUP:     rPageSett.importPageSetup( mrStrm );            break;
+                        case BIFF_ID_SAVERECALC:    rWorkbookSett.importSaveRecalc( mrStrm );       break;
+                        case BIFF_ID_SHEETPR:       rWorksheetSett.importSheetPr( mrStrm );         break;
+                        case BIFF_ID_STANDARDWIDTH: importStandardWidth();                          break;
+                        case BIFF_ID_UNCALCED:      rWorkbookSett.importUncalced( mrStrm );         break;
+                        case BIFF_ID_VCENTER:       rPageSett.importVerCenter( mrStrm );            break;
+                        case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( mrStrm );         break;
                     }
                     break;
 
                     case BIFF5: switch( nRecId )
                     {
-                        case BIFF_ID_COLINFO:       importColInfo( rStrm );                         break;
-                        case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight( rStrm );                    break;
-                        case BIFF_ID_HCENTER:       rPageSett.importHorCenter( rStrm );             break;
-                        case BIFF_ID_MERGEDCELLS:   importMergedCells( rStrm );                     break;  // #i62300# also in BIFF5
-                        case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( rStrm );    break;
-                        case BIFF_ID_PAGESETUP:     rPageSett.importPageSetup( rStrm );             break;
-                        case BIFF_ID_SAVERECALC:    rWorkbookSett.importSaveRecalc( rStrm );        break;
-                        case BIFF_ID_SCENPROTECT:   rWorksheetSett.importScenProtect( rStrm );      break;
-                        case BIFF_ID_SCL:           rSheetViewSett.importScl( rStrm );              break;
-                        case BIFF_ID_SHEETPR:       rWorksheetSett.importSheetPr( rStrm );          break;
-                        case BIFF_ID_STANDARDWIDTH: importStandardWidth( rStrm );                   break;
-                        case BIFF_ID_UNCALCED:      rWorkbookSett.importUncalced( rStrm );          break;
-                        case BIFF_ID_VCENTER:       rPageSett.importVerCenter( rStrm );             break;
-                        case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( rStrm );          break;
+                        case BIFF_ID_COLINFO:       importColInfo();                                break;
+                        case BIFF3_ID_DEFROWHEIGHT: importDefRowHeight();                           break;
+                        case BIFF_ID_HCENTER:       rPageSett.importHorCenter( mrStrm );            break;
+                        case BIFF_ID_MERGEDCELLS:   importMergedCells();                            break;  // #i62300# also in BIFF5
+                        case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm );   break;
+                        case BIFF_ID_PAGESETUP:     rPageSett.importPageSetup( mrStrm );            break;
+                        case BIFF_ID_SAVERECALC:    rWorkbookSett.importSaveRecalc( mrStrm );       break;
+                        case BIFF_ID_SCENPROTECT:   rWorksheetSett.importScenProtect( mrStrm );     break;
+                        case BIFF_ID_SCL:           rSheetViewSett.importScl( mrStrm );             break;
+                        case BIFF_ID_SHEETPR:       rWorksheetSett.importSheetPr( mrStrm );         break;
+                        case BIFF_ID_STANDARDWIDTH: importStandardWidth();                          break;
+                        case BIFF_ID_UNCALCED:      rWorkbookSett.importUncalced( mrStrm );         break;
+                        case BIFF_ID_VCENTER:       rPageSett.importVerCenter( mrStrm );            break;
+                        case BIFF3_ID_WINDOW2:      rSheetViewSett.importWindow2( mrStrm );         break;
                     }
                     break;
 
                     case BIFF8: switch( nRecId )
                     {
-                        case BIFF_ID_CFHEADER:          rCondFormats.importCfHeader( rStrm );           break;
-                        case BIFF_ID_COLINFO:           importColInfo( rStrm );                         break;
-                        case BIFF_ID_DATAVALIDATION:    importDataValidation( rStrm );                  break;
-                        case BIFF_ID_DATAVALIDATIONS:   importDataValidations( rStrm );                 break;
-                        case BIFF3_ID_DEFROWHEIGHT:     importDefRowHeight( rStrm );                    break;
-                        case BIFF_ID_HCENTER:           rPageSett.importHorCenter( rStrm );             break;
-                        case BIFF_ID_HYPERLINK:         importHyperlink( rStrm );                       break;
-                        case BIFF_ID_LABELRANGES:       importLabelRanges( rStrm );                     break;
-                        case BIFF_ID_MERGEDCELLS:       importMergedCells( rStrm );                     break;
-                        case BIFF_ID_OBJECTPROTECT:     rWorksheetSett.importObjectProtect( rStrm );    break;
-                        case BIFF_ID_PICTURE:           rPageSett.importPicture( rStrm );               break;
-                        case BIFF_ID_SAVERECALC:        rWorkbookSett.importSaveRecalc( rStrm );        break;
-                        case BIFF_ID_SCENPROTECT:       rWorksheetSett.importScenProtect( rStrm );      break;
-                        case BIFF_ID_SCL:               rSheetViewSett.importScl( rStrm );              break;
-                        case BIFF_ID_SHEETPR:           rWorksheetSett.importSheetPr( rStrm );          break;
-                        case BIFF_ID_SHEETPROTECTION:   rWorksheetSett.importSheetProtection( rStrm );  break;
-                        case BIFF_ID_PAGESETUP:         rPageSett.importPageSetup( rStrm );             break;
-                        case BIFF_ID_PHONETICPR:        rWorksheetSett.importPhoneticPr( rStrm );       break;
-                        case BIFF_ID_STANDARDWIDTH:     importStandardWidth( rStrm );                   break;
-                        case BIFF_ID_UNCALCED:          rWorkbookSett.importUncalced( rStrm );          break;
-                        case BIFF_ID_VCENTER:           rPageSett.importVerCenter( rStrm );             break;
-                        case BIFF3_ID_WINDOW2:          rSheetViewSett.importWindow2( rStrm );          break;
+                        case BIFF_ID_CFHEADER:          rCondFormats.importCfHeader( mrStrm );          break;
+                        case BIFF_ID_COLINFO:           importColInfo();                                break;
+                        case BIFF_ID_DATAVALIDATION:    importDataValidation();                         break;
+                        case BIFF_ID_DATAVALIDATIONS:   importDataValidations();                        break;
+                        case BIFF3_ID_DEFROWHEIGHT:     importDefRowHeight();                           break;
+                        case BIFF_ID_HCENTER:           rPageSett.importHorCenter( mrStrm );            break;
+                        case BIFF_ID_HYPERLINK:         importHyperlink();                              break;
+                        case BIFF_ID_LABELRANGES:       importLabelRanges();                            break;
+                        case BIFF_ID_MERGEDCELLS:       importMergedCells();                            break;
+                        case BIFF_ID_OBJECTPROTECT:     rWorksheetSett.importObjectProtect( mrStrm );   break;
+                        case BIFF_ID_PICTURE:           rPageSett.importPicture( mrStrm );              break;
+                        case BIFF_ID_SAVERECALC:        rWorkbookSett.importSaveRecalc( mrStrm );       break;
+                        case BIFF_ID_SCENPROTECT:       rWorksheetSett.importScenProtect( mrStrm );     break;
+                        case BIFF_ID_SCL:               rSheetViewSett.importScl( mrStrm );             break;
+                        case BIFF_ID_SHEETPR:           rWorksheetSett.importSheetPr( mrStrm );         break;
+                        case BIFF_ID_SHEETPROTECTION:   rWorksheetSett.importSheetProtection( mrStrm ); break;
+                        case BIFF_ID_PAGESETUP:         rPageSett.importPageSetup( mrStrm );            break;
+                        case BIFF_ID_PHONETICPR:        rWorksheetSett.importPhoneticPr( mrStrm );      break;
+                        case BIFF_ID_STANDARDWIDTH:     importStandardWidth();                          break;
+                        case BIFF_ID_UNCALCED:          rWorkbookSett.importUncalced( mrStrm );         break;
+                        case BIFF_ID_VCENTER:           rPageSett.importVerCenter( mrStrm );            break;
+                        case BIFF3_ID_WINDOW2:          rSheetViewSett.importWindow2( mrStrm );         break;
                     }
                     break;
 
@@ -778,22 +872,22 @@ bool BiffWorksheetFragment::importFragme
             }
 
             // record not processed, try cell records
-            if( rStrm.getCoreStreamPos() == nStrmPos )
-                aSheetData.importRecord( rStrm );
+            if( mrStrm.tellBase() == nStrmPos )
+                aSheetData.importRecord();
         }
     }
 
     // final processing in base class WorksheetHelper
     finalizeWorksheetImport();
-    return rStrm.getRecId() == BIFF_ID_EOF;
+    return mrStrm.getRecId() == BIFF_ID_EOF;
 }
 
 // private --------------------------------------------------------------------
 
-void BiffWorksheetFragment::importColInfo( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importColInfo()
 {
     sal_uInt16 nFirstCol, nLastCol, nWidth, nXfId, nFlags;
-    rStrm >> nFirstCol >> nLastCol >> nWidth >> nXfId >> nFlags;
+    mrStrm >> nFirstCol >> nLastCol >> nWidth >> nXfId >> nFlags;
 
     OoxColumnData aData;
     // column indexes are 0-based in BIFF, but OoxColumnData expects 1-based
@@ -810,18 +904,18 @@ void BiffWorksheetFragment::importColInf
     setColumnData( aData );
 }
 
-void BiffWorksheetFragment::importColumnDefault( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importColumnDefault()
 {
     sal_uInt16 nFirstCol, nLastCol, nXfId;
-    rStrm >> nFirstCol >> nLastCol >> nXfId;
+    mrStrm >> nFirstCol >> nLastCol >> nXfId;
     convertColumnFormat( nFirstCol, nLastCol, nXfId );
 }
 
-void BiffWorksheetFragment::importColWidth( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importColWidth()
 {
     sal_uInt8 nFirstCol, nLastCol;
     sal_uInt16 nWidth;
-    rStrm >> nFirstCol >> nLastCol >> nWidth;
+    mrStrm >> nFirstCol >> nLastCol >> nWidth;
 
     OoxColumnData aData;
     // column indexes are 0-based in BIFF, but OoxColumnData expects 1-based
@@ -833,20 +927,20 @@ void BiffWorksheetFragment::importColWid
     setColumnData( aData );
 }
 
-void BiffWorksheetFragment::importDefColWidth( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importDefColWidth()
 {
     /*  Stored as entire number of characters without padding pixels, which
         will be added in setBaseColumnWidth(). Call has no effect, if a
         width has already been set from the STANDARDWIDTH record. */
-    setBaseColumnWidth( rStrm.readuInt16() );
+    setBaseColumnWidth( mrStrm.readuInt16() );
 }
 
-void BiffWorksheetFragment::importDefRowHeight( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importDefRowHeight()
 {
     sal_uInt16 nFlags = BIFF_DEFROW_CUSTOMHEIGHT, nHeight;
     if( getBiff() != BIFF2 )
-        rStrm >> nFlags;
-    rStrm >> nHeight;
+        mrStrm >> nFlags;
+    mrStrm >> nHeight;
     if( getBiff() == BIFF2 )
         nHeight &= BIFF2_DEFROW_MASK;
     // row height is in twips in BIFF, convert to points
@@ -858,11 +952,11 @@ void BiffWorksheetFragment::importDefRow
         getFlag( nFlags, BIFF_DEFROW_THICKBOTTOM ) );
 }
 
-void BiffWorksheetFragment::importDataValidations( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importDataValidations()
 {
     sal_Int32 nObjId;
-    rStrm.skip( 10 );
-    rStrm >> nObjId;
+    mrStrm.skip( 10 );
+    mrStrm >> nObjId;
     //! TODO: invalidate object id in drawing object manager
 }
 
@@ -893,13 +987,13 @@ ApiTokenSequence lclReadDataValFormula( 
 
 } // namespace
 
-void BiffWorksheetFragment::importDataValidation( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importDataValidation()
 {
     OoxValidationData aData;
 
     // flags
     sal_uInt32 nFlags;
-    rStrm >> nFlags;
+    mrStrm >> nFlags;
     aData.setBinType( extractValue< sal_uInt8 >( nFlags, 0, 4 ) );
     aData.setBinOperator( extractValue< sal_uInt8 >( nFlags, 20, 4 ) );
     aData.setBinErrorStyle( extractValue< sal_uInt8 >( nFlags, 4, 3 ) );
@@ -909,32 +1003,32 @@ void BiffWorksheetFragment::importDataVa
     aData.mbShowErrorMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWERROR );
 
     // message strings
-    aData.maInputTitle   = lclReadDataValMessage( rStrm );
-    aData.maErrorTitle   = lclReadDataValMessage( rStrm );
-    aData.maInputMessage = lclReadDataValMessage( rStrm );
-    aData.maErrorMessage = lclReadDataValMessage( rStrm );
+    aData.maInputTitle   = lclReadDataValMessage( mrStrm );
+    aData.maErrorTitle   = lclReadDataValMessage( mrStrm );
+    aData.maInputMessage = lclReadDataValMessage( mrStrm );
+    aData.maErrorMessage = lclReadDataValMessage( mrStrm );
 
     // condition formula(s)
     FormulaParser& rParser = getFormulaParser();
-    aData.maTokens1 = lclReadDataValFormula( rStrm, rParser );
-    aData.maTokens2 = lclReadDataValFormula( rStrm, rParser );
+    aData.maTokens1 = lclReadDataValFormula( mrStrm, rParser );
+    aData.maTokens2 = lclReadDataValFormula( mrStrm, rParser );
     // process string list of a list validation (convert to list of string tokens)
     if( (aData.mnType == XML_list) && getFlag( nFlags, BIFF_DATAVAL_STRINGLIST ) )
         rParser.convertStringToStringList( aData.maTokens1, '\0', true );
 
     // cell range list
     BinRangeList aRanges;
-    rStrm >> aRanges;
+    mrStrm >> aRanges;
     getAddressConverter().convertToCellRangeList( aData.maRanges, aRanges, getSheetIndex(), true );
 
     // set validation data
     setValidation( aData );
 }
 
-void BiffWorksheetFragment::importDimension( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importDimension()
 {
     BinRange aBinRange;
-    aBinRange.read( rStrm, true, (rStrm.getRecId() == BIFF3_ID_DIMENSION) && (getBiff() == BIFF8) );
+    aBinRange.read( mrStrm, true, (mrStrm.getRecId() == BIFF3_ID_DIMENSION) && (getBiff() == BIFF8) );
     // first unused row/column index in BIFF, not last used
     if( aBinRange.maFirst.mnCol < aBinRange.maLast.mnCol ) --aBinRange.maLast.mnCol;
     if( aBinRange.maFirst.mnRow < aBinRange.maLast.mnRow ) --aBinRange.maLast.mnRow;
@@ -944,56 +1038,37 @@ void BiffWorksheetFragment::importDimens
     setDimension( aRange );
 }
 
-namespace {
-
-OUString lclReadHyperlinkString( BiffInputStream& rStrm, sal_Int32 nChars, rtl_TextEncoding eTextEnc, bool bUnicode )
+OUString BiffWorksheetFragment::readHyperlinkString( rtl_TextEncoding eTextEnc, bool bUnicode )
 {
     OUString aRet;
+    sal_Int32 nChars = mrStrm.readInt32();
     if( nChars > 0 )
     {
         sal_uInt16 nReadChars = getLimitedValue< sal_uInt16, sal_Int32 >( nChars, 0, SAL_MAX_UINT16 );
-        // strings are NUL terminated with trailing garbage
-        rStrm.enableNulChars( true );
+        // strings are NUL terminated
+        mrStrm.enableNulChars( true );
         aRet = bUnicode ?
-            rStrm.readUnicodeArray( nReadChars ) :
-            rStrm.readCharArray( nReadChars, eTextEnc );
-        rStrm.enableNulChars( false );
-        // remove trailing garbage
+            mrStrm.readUnicodeArray( nReadChars ) :
+            mrStrm.readCharArray( nReadChars, eTextEnc );
+        mrStrm.enableNulChars( false );
+        // remove trailing NUL and possible other garbage
         sal_Int32 nNulPos = aRet.indexOf( '\0' );
         if( nNulPos >= 0 )
             aRet = aRet.copy( 0, nNulPos );
         // skip remaining chars
         sal_uInt32 nSkip = static_cast< sal_uInt32 >( nChars - nReadChars );
-        rStrm.skip( bUnicode ? (nSkip * 2) : nSkip );
+        mrStrm.skip( (bUnicode ? 2 : 1) * nSkip );
     }
     return aRet;
 }
 
-OUString lclReadHyperlinkString( BiffInputStream& rStrm, rtl_TextEncoding eTextEnc, bool bUnicode )
-{
-    return lclReadHyperlinkString( rStrm, rStrm.readInt32(), eTextEnc, bUnicode );
-}
-
-void lclSkipHyperlinkString( BiffInputStream& rStrm, sal_Int32 nChars, bool bUnicode )
-{
-    if( nChars > 0 )
-        rStrm.skip( static_cast< sal_uInt32 >( bUnicode ? (nChars * 2) : nChars ) );
-}
-
-void lclSkipHyperlinkString( BiffInputStream& rStrm, bool bUnicode )
-{
-    lclSkipHyperlinkString( rStrm, rStrm.readInt32(), bUnicode );
-}
-
-} // namespace
-
-void BiffWorksheetFragment::importHyperlink( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importHyperlink()
 {
     OoxHyperlinkData aData;
 
     // read cell range for the hyperlink
     BinRange aBiffRange;
-    rStrm >> aBiffRange;
+    mrStrm >> aBiffRange;
     // #i80006# Excel silently ignores invalid hi-byte of column index (TODO: everywhere?)
     aBiffRange.maFirst.mnCol &= 0xFF;
     aBiffRange.maLast.mnCol &= 0xFF;
@@ -1001,78 +1076,79 @@ void BiffWorksheetFragment::importHyperl
         return;
 
     BiffGuid aGuid;
-    sal_uInt32 nId, nFlags;
-    rStrm >> aGuid >> nId >> nFlags;
+    sal_uInt32 nVersion, nFlags;
+    mrStrm >> aGuid >> nVersion >> nFlags;
 
     OSL_ENSURE( aGuid == BiffHelper::maGuidStdHlink, "BiffWorksheetFragment::importHyperlink - unexpected header GUID" );
-    OSL_ENSURE( nId == 2, "BiffWorksheetFragment::importHyperlink - unexpected header identifier" );
-    if( !(aGuid == BiffHelper::maGuidStdHlink) )
+    OSL_ENSURE( nVersion == 2, "BiffWorksheetFragment::importHyperlink - unexpected header version" );
+    if( !(aGuid == BiffHelper::maGuidStdHlink) || (nVersion != 2) )
         return;
 
     // display string
-    if( getFlag( nFlags, BIFF_HYPERLINK_DISPLAY ) )
-        aData.maDisplay = lclReadHyperlinkString( rStrm, getTextEncoding(), true );
-    // target frame (ignore) !TODO: DISPLAY/FRAME - right order? (never seen them together)
-    if( getFlag( nFlags, BIFF_HYPERLINK_FRAME ) )
-        lclSkipHyperlinkString( rStrm, true );
+    if( getFlag( nFlags, OLE_HYPERLINK_HASDISPLAY ) )
+        aData.maDisplay = readHyperlinkString( getTextEncoding(), true );
+    // frame string
+    if( getFlag( nFlags, OLE_HYPERLINK_HASFRAME ) )
+        aData.maFrame = readHyperlinkString( getTextEncoding(), true );
 
     // target
-    if( getFlag( nFlags, BIFF_HYPERLINK_TARGET ) )
+    if( getFlag( nFlags, OLE_HYPERLINK_HASTARGET ) )
     {
-        if( getFlag( nFlags, BIFF_HYPERLINK_UNC ) )
+        if( getFlag( nFlags, OLE_HYPERLINK_ASSTRING ) )
         {
-            // UNC path
-            OSL_ENSURE( getFlag( nFlags, BIFF_HYPERLINK_ABS ), "BiffWorksheetFragment::importHyperlink - UNC link not absolute" );
-            aData.maTarget = lclReadHyperlinkString( rStrm, getTextEncoding(), true );
+            OSL_ENSURE( getFlag( nFlags, OLE_HYPERLINK_ABSOLUTE ), "BiffWorksheetFragment::importHyperlink - link not absolute" );
+            aData.maTarget = readHyperlinkString( getTextEncoding(), true );
         }
-        else
+        else // hyperlink moniker
         {
-            rStrm >> aGuid;
+            mrStrm >> aGuid;
             if( aGuid == BiffHelper::maGuidFileMoniker )
             {
                 // file name, maybe relative and with directory up-count
                 sal_Int16 nUpLevels;
-                rStrm >> nUpLevels;
-                OSL_ENSURE( (nUpLevels == 0) || !getFlag( nFlags, BIFF_HYPERLINK_ABS ), "BiffWorksheetFragment::importHyperlink - absolute filename with upcount" );
-                OUString aShortName = lclReadHyperlinkString( rStrm, getTextEncoding(), false );
-                if( rStrm.skip( 24 ).readInt32() > 0 )
-                {
-                    sal_Int32 nStrLen = rStrm.readInt32() / 2;  // byte count to char count
-                    rStrm.skip( 2 );
-                    aData.maTarget = lclReadHyperlinkString( rStrm, nStrLen, getTextEncoding(), true );
+                mrStrm >> nUpLevels;
+                OSL_ENSURE( (nUpLevels == 0) || !getFlag( nFlags, OLE_HYPERLINK_ABSOLUTE ), "BiffWorksheetFragment::importHyperlink - absolute filename with upcount" );
+                aData.maTarget = readHyperlinkString( getTextEncoding(), false );
+                mrStrm.skip( 24 );
+                sal_Int32 nBytes = mrStrm.readInt32();
+                if( nBytes > 0 )
+                {
+                    sal_Int64 nEndPos = mrStrm.tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+                    sal_uInt16 nChars = getLimitedValue< sal_uInt16, sal_Int32 >( mrStrm.readInt32() / 2, 0, SAL_MAX_UINT16 );
+                    mrStrm.skip( 2 );   // key value
+                    aData.maTarget = mrStrm.readUnicodeArray( nChars ); // NOT null terminated
+                    mrStrm.seek( nEndPos );
                 }
-                if( aData.maTarget.getLength() == 0 )
-                    aData.maTarget = aShortName;
-                if( !getFlag( nFlags, BIFF_HYPERLINK_ABS ) )
+                if( !getFlag( nFlags, OLE_HYPERLINK_ABSOLUTE ) )
                     for( sal_Int16 nLevel = 0; nLevel < nUpLevels; ++nLevel )
                         aData.maTarget = CREATE_OUSTRING( "../" ) + aData.maTarget;
             }
             else if( aGuid == BiffHelper::maGuidUrlMoniker )
             {
                 // URL, maybe relative and with leading '../'
-                sal_Int32 nStrLen = rStrm.readInt32() / 2;  // byte count to char count
-                aData.maTarget = lclReadHyperlinkString( rStrm, nStrLen, getTextEncoding(), true );
+                sal_Int32 nBytes = mrStrm.readInt32();
+                sal_Int64 nEndPos = mrStrm.tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+                aData.maTarget = mrStrm.readNulUnicodeArray();
+                mrStrm.seek( nEndPos );
             }
             else
             {
-                OSL_ENSURE( false, "BiffWorksheetFragment::importHyperlink - unknown content GUID" );
+                OSL_ENSURE( false, "BiffWorksheetFragment::importHyperlink - unsupported hyperlink moniker" );
                 return;
             }
         }
     }
 
     // target location
-    if( getFlag( nFlags, BIFF_HYPERLINK_LOC ) )
-        aData.maLocation = lclReadHyperlinkString( rStrm, getTextEncoding(), true );
-
-    OSL_ENSURE( rStrm.getRecLeft() == 0, "BiffWorksheetFragment::importHyperlink - unknown record data" );
+    if( getFlag( nFlags, OLE_HYPERLINK_HASLOCATION ) )
+        aData.maLocation = readHyperlinkString( getTextEncoding(), true );
 
     // try to read the SCREENTIP record
-    if( (rStrm.getNextRecId() == BIFF_ID_SCREENTIP) && rStrm.startNextRecord() )
+    if( (mrStrm.getNextRecId() == BIFF_ID_SCREENTIP) && mrStrm.startNextRecord() )
     {
-        rStrm.skip( 2 );      // repeated record id
+        mrStrm.skip( 2 );      // repeated record id
         // the cell range, again
-        rStrm >> aBiffRange;
+        mrStrm >> aBiffRange;
         CellRangeAddress aRange;
         if( getAddressConverter().convertToCellRange( aRange, aBiffRange, getSheetIndex(), true ) &&
             (aRange.StartColumn == aData.maRange.StartColumn) &&
@@ -1082,7 +1158,7 @@ void BiffWorksheetFragment::importHyperl
         {
             /*  This time, we have no string length, no flag field, and a
                 null-terminated 16-bit character array. */
-            aData.maTooltip = rStrm.readUnicodeArray( static_cast< sal_uInt16 >( rStrm.getRecLeft() / 2 ) );
+            aData.maTooltip = mrStrm.readNulUnicodeArray();
         }
     }
 
@@ -1090,47 +1166,47 @@ void BiffWorksheetFragment::importHyperl
     setHyperlink( aData );
 }
 
-void BiffWorksheetFragment::importLabelRanges( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importLabelRanges()
 {
     BinRangeList aBiffRowRanges, aBiffColRanges;
-    rStrm >> aBiffRowRanges >> aBiffColRanges;
+    mrStrm >> aBiffRowRanges >> aBiffColRanges;
     ApiCellRangeList aColRanges, aRowRanges;
     getAddressConverter().convertToCellRangeList( aColRanges, aBiffColRanges, getSheetIndex(), true );
     getAddressConverter().convertToCellRangeList( aRowRanges, aBiffRowRanges, getSheetIndex(), true );
     setLabelRanges( aColRanges, aRowRanges );
 }
 
-void BiffWorksheetFragment::importMergedCells( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importMergedCells()
 {
     BinRangeList aBiffRanges;
-    rStrm >> aBiffRanges;
+    mrStrm >> aBiffRanges;
     ApiCellRangeList aRanges;
     getAddressConverter().convertToCellRangeList( aRanges, aBiffRanges, getSheetIndex(), true );
     for( ApiCellRangeList::const_iterator aIt = aRanges.begin(), aEnd = aRanges.end(); aIt != aEnd; ++aIt )
         setMergedRange( *aIt );
 }
 
-void BiffWorksheetFragment::importPageBreaks( BiffInputStream& rStrm, bool bRowBreak )
+void BiffWorksheetFragment::importPageBreaks( bool bRowBreak )
 {
     OoxPageBreakData aData;
     aData.mbManual = true;              // only manual breaks stored in BIFF
     bool bBiff8 = getBiff() == BIFF8;   // skip start/end columns or rows in BIFF8
 
     sal_uInt16 nCount;
-    rStrm >> nCount;
-    for( sal_uInt16 nIndex = 0; rStrm.isValid() && (nIndex < nCount); ++nIndex )
+    mrStrm >> nCount;
+    for( sal_uInt16 nIndex = 0; !mrStrm.isEof() && (nIndex < nCount); ++nIndex )
     {
-        aData.mnColRow = rStrm.readuInt16();
+        aData.mnColRow = mrStrm.readuInt16();
         setPageBreak( aData, bRowBreak );
         if( bBiff8 )
-            rStrm.skip( 4 );
+            mrStrm.skip( 4 );
     }
 }
 
-void BiffWorksheetFragment::importStandardWidth( BiffInputStream& rStrm )
+void BiffWorksheetFragment::importStandardWidth()
 {
     sal_uInt16 nWidth;
-    rStrm >> nWidth;
+    mrStrm >> nWidth;
     // width is stored as 1/256th of a character in BIFF, convert to entire character
     double fWidth = static_cast< double >( nWidth ) / 256.0;
     // set as default width, will override the width from DEFCOLWIDTH record
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/worksheethelper.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/worksheethelper.cxx
--- oox/source/xls/worksheethelper.cxx	2008-04-18 16:49:01.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/worksheethelper.cxx	2009-03-25 12:15:34.000000000 +0100
@@ -29,6 +29,7 @@
  ************************************************************************/
 
 #include "oox/xls/worksheethelper.hxx"
+#include <algorithm>
 #include <utility>
 #include <list>
 #include <rtl/ustrbuf.hxx>
@@ -37,11 +38,16 @@
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/util/XMergeable.hpp>
 #include <com/sun/star/table/XColumnRowRange.hpp>
+#include <com/sun/star/sheet/TableValidationVisibility.hpp>
+#include <com/sun/star/sheet/ValidationType.hpp>
+#include <com/sun/star/sheet/ValidationAlertStyle.hpp>
 #include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
+#include <com/sun/star/sheet/XSheetCondition.hpp>
 #include <com/sun/star/sheet/XCellAddressable.hpp>
 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
 #include <com/sun/star/sheet/XFormulaTokens.hpp>
+#include <com/sun/star/sheet/XMultiFormulaTokens.hpp>
 #include <com/sun/star/sheet/XSheetOutline.hpp>
 #include <com/sun/star/sheet/XMultipleOperation.hpp>
 #include <com/sun/star/sheet/XLabelRanges.hpp>
@@ -59,7 +65,6 @@
 #include "oox/xls/sharedstringsbuffer.hxx"
 #include "oox/xls/stylesbuffer.hxx"
 #include "oox/xls/unitconverter.hxx"
-#include "oox/xls/validationpropertyhelper.hxx"
 #include "oox/xls/viewsettings.hxx"
 #include "oox/xls/worksheetbuffer.hxx"
 #include "oox/xls/worksheetsettings.hxx"
@@ -71,26 +76,32 @@ using ::com::sun::star::uno::Exception;
 using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::uno::UNO_QUERY_THROW;
 using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::beans::XPropertySet;
 using ::com::sun::star::util::XMergeable;
 using ::com::sun::star::awt::Point;
 using ::com::sun::star::awt::Size;
+using ::com::sun::star::table::BorderLine;
 using ::com::sun::star::table::CellAddress;
 using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::table::BorderLine;
+using ::com::sun::star::table::XCell;
+using ::com::sun::star::table::XCellRange;
 using ::com::sun::star::table::XColumnRowRange;
 using ::com::sun::star::table::XTableColumns;
 using ::com::sun::star::table::XTableRows;
-using ::com::sun::star::table::XCell;
-using ::com::sun::star::table::XCellRange;
-using ::com::sun::star::sheet::XSpreadsheet;
-using ::com::sun::star::sheet::XSheetCellRanges;
-using ::com::sun::star::sheet::XSheetCellRangeContainer;
+using ::com::sun::star::sheet::ConditionOperator;
+using ::com::sun::star::sheet::ValidationType;
+using ::com::sun::star::sheet::ValidationAlertStyle;
 using ::com::sun::star::sheet::XCellAddressable;
 using ::com::sun::star::sheet::XCellRangeAddressable;
 using ::com::sun::star::sheet::XFormulaTokens;
-using ::com::sun::star::sheet::XSheetOutline;
-using ::com::sun::star::sheet::XMultipleOperation;
 using ::com::sun::star::sheet::XLabelRanges;
+using ::com::sun::star::sheet::XMultiFormulaTokens;
+using ::com::sun::star::sheet::XMultipleOperation;
+using ::com::sun::star::sheet::XSheetCellRangeContainer;
+using ::com::sun::star::sheet::XSheetCellRanges;
+using ::com::sun::star::sheet::XSheetCondition;
+using ::com::sun::star::sheet::XSheetOutline;
+using ::com::sun::star::sheet::XSpreadsheet;
 using ::com::sun::star::text::XText;
 using ::com::sun::star::text::XTextContent;
 using ::com::sun::star::text::XTextRange;
@@ -112,6 +123,78 @@ void lclUpdateProgressBar( ISegmentProgr
     }
 }
 
+// ----------------------------------------------------------------------------
+
+struct ValueRange
+{
+    sal_Int32           mnFirst;
+    sal_Int32           mnLast;
+
+    inline explicit     ValueRange( sal_Int32 nValue ) : mnFirst( nValue ), mnLast( nValue ) {}
+    inline explicit     ValueRange( sal_Int32 nFirst, sal_Int32 nLast ) : mnFirst( nFirst ), mnLast( nLast ) {}
+};
+
+typedef ::std::vector< ValueRange > ValueRangeVector;
+
+// ----------------------------------------------------------------------------
+
+struct ValueRangeComp
+{
+    inline bool         operator()( const ValueRange& rRange, sal_Int32 nValue ) const { return rRange.mnLast < nValue; }
+};
+
+typedef ::std::vector< ValueRange > ValueRangeVector;
+
+// ----------------------------------------------------------------------------
+
+class ValueRangeSet
+{
+public:
+    inline explicit     ValueRangeSet() {}
+
+    void                insert( sal_Int32 nValue );
+    void                intersect( ValueRangeVector& orRanges, sal_Int32 nFirst, sal_Int32 nLast ) const;
+
+private:
+    ValueRangeVector    maData;
+};
+
+void ValueRangeSet::insert( sal_Int32 nValue )
+{
+    // find the first range that contains nValue or that follows nValue
+    ValueRangeVector::iterator aBeg = maData.begin();
+    ValueRangeVector::iterator aEnd = maData.end();
+    ValueRangeVector::iterator aNext = ::std::lower_bound( aBeg, aEnd, nValue, ValueRangeComp() );
+
+    // nothing to do if found range contains nValue
+    if( (aNext == aEnd) || (nValue < aNext->mnFirst) )
+    {
+        ValueRangeVector::iterator aPrev = (aNext == aBeg) ? aEnd : (aNext - 1);
+        bool bJoinPrev = (aPrev != aEnd) && (aPrev->mnLast + 1 == nValue);
+        bool bJoinNext = (aNext != aEnd) && (aNext->mnFirst - 1 == nValue);
+        if( bJoinPrev && bJoinNext )
+        {
+            aPrev->mnLast = aNext->mnLast;
+            maData.erase( aNext );
+        }
+        else if( bJoinPrev )
+            ++aPrev->mnLast;
+        else if( bJoinNext )
+            --aNext->mnFirst;
+        else
+            maData.insert( aNext, ValueRange( nValue ) );
+    }
+}
+
+void ValueRangeSet::intersect( ValueRangeVector& orRanges, sal_Int32 nFirst, sal_Int32 nLast ) const
+{
+    orRanges.clear();
+    // find the range that contains nFirst or the first range that follows nFirst
+    ValueRangeVector::const_iterator aIt = ::std::lower_bound( maData.begin(), maData.end(), nFirst, ValueRangeComp() );
+    for( ValueRangeVector::const_iterator aEnd = maData.end(); (aIt != aEnd) && (aIt->mnFirst <= nLast); ++aIt )
+        orRanges.push_back( ValueRange( ::std::max( aIt->mnFirst, nFirst ), ::std::min( aIt->mnLast, nLast ) ) );
+}
+
 } // namespace
 
 // ============================================================================
@@ -247,6 +330,23 @@ void OoxValidationData::setBinErrorStyle
     mnErrorStyle = STATIC_ARRAY_SELECT( spnErrorStyles, nErrorStyle, XML_stop );
 }
 
+// ----------------------------------------------------------------------------
+
+OoxOleObjectData::OoxOleObjectData() :
+    mnAspect( XML_DVASPECT_CONTENT ),
+    mnUpdateMode( XML_OLEUPDATE_ALWAYS ),
+    mnShapeId( 0 ),
+    mbAutoLoad( false )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+OoxFormControlData::OoxFormControlData() :
+    mnShapeId( 0 )
+{
+}
+
 // ============================================================================
 // ============================================================================
 
@@ -262,8 +362,6 @@ public:
     /** Returns true, if this helper refers to an existing Calc sheet. */
     inline bool         isValidSheet() const { return mxSheet.is(); }
 
-    /** Returns a cell formula simulating an empty string result. */
-    inline const OUString& getEmptyStringFormula() const { return maEmptyStrFormula; }
     /** Returns a cell formula simulating the passed boolean value. */
     const OUString&     getBooleanFormula( bool bValue ) const;
 
@@ -326,6 +424,12 @@ public:
     void                setValidation( const OoxValidationData& rValData );
     /** Sets the path to the DrawingML fragment of this sheet. */
     void                setDrawingPath( const OUString& rDrawingPath );
+    /** Sets the path to the legacy VML drawing fragment of this sheet. */
+    void                setVmlDrawingPath( const OUString& rVmlDrawingPath );
+    /** Sets additional data for an OLE object. */
+    void                setOleObject( const OoxOleObjectData& rOleObjectData );
+    /** Sets additional data for an OCX form control. */
+    void                setFormControl( const OoxFormControlData& rFormControlData );
 
     /** Sets base width for all columns (without padding pixels). This value
         is only used, if base width has not been set with setDefaultColumnWidth(). */
@@ -361,6 +465,8 @@ private:
     typedef ::std::map< sal_Int32, OoxRowData >     OoxRowDataMap;
     typedef ::std::list< OoxHyperlinkData >         OoxHyperlinkList;
     typedef ::std::list< OoxValidationData >        OoxValidationList;
+    typedef ::std::map< sal_Int32, OoxOleObjectData >   OoxOleObjectDataMap;
+    typedef ::std::map< sal_Int32, OoxFormControlData > OoxFormControlDataMap;
 
     struct XfIdRange
     {
@@ -403,9 +509,9 @@ private:
     void                finalizeValidationRanges() const;
 
     /** Merges all cached merged ranges and updates right/bottom cell borders. */
-    void                finalizeMergedRanges() const;
+    void                finalizeMergedRanges();
     /** Merges the passed merged range and updates right/bottom cell borders. */
-    void                finalizeMergedRange( const CellRangeAddress& rRange ) const;
+    void                finalizeMergedRange( const CellRangeAddress& rRange );
 
     /** Imports the drawing layer of the sheet. */
     void                finalizeDrawing();
@@ -426,7 +532,6 @@ private:
     void                groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastColRow, bool bCollapsed, bool bRows );
 
 private:
-    const OUString      maEmptyStrFormula;  /// Replacement formula for empty string result.
     const OUString      maTrueFormula;      /// Replacement formula for TRUE boolean cells.
     const OUString      maFalseFormula;     /// Replacement formula for FALSE boolean cells.
     const OUString      maSheetCellRanges;  /// Service name for a SheetCellRanges object.
@@ -437,10 +542,12 @@ private:
     const OUString      maPositionProp;     /// Property name for cell position.
     const OUString      maSizeProp;         /// Property name for cell size.
     const OUString      maVisibleProp;      /// Property name for column/row visibility.
+    const OUString      maTextWrapProp;     /// Property name for automatic text wrap in cells.
     const OUString      maPageBreakProp;    /// Property name of a page break.
     const OUString      maUrlTextField;     /// Service name for a URL text field.
     const OUString      maUrlProp;          /// Property name for the URL string in a URL text field.
     const OUString      maReprProp;         /// Property name for the URL representation in a URL text field.
+    const OUString      maValidationProp;   /// Property name for data validation settings.
     const CellAddress&  mrMaxApiPos;        /// Reference to maximum Calc cell address from address converter.
     CellRangeAddress    maDimension;        /// Dimension (used) area of the sheet.
     OoxColumnData       maDefColData;       /// Default column formatting.
@@ -449,15 +556,19 @@ private:
     OoxRowDataMap       maRowDatas;         /// Row data sorted by row index.
     OoxHyperlinkList    maHyperlinks;       /// Cell ranges containing hyperlinks.
     OoxValidationList   maValidations;      /// Cell ranges containing data validation settings.
+    OoxOleObjectDataMap maOleObjects;       /// OLE object data, mapped to VML shape identifier.
+    OoxFormControlDataMap maFormControls;   /// OCX form control data, mapped to VML shape identifier.
     XfIdRangeMap        maXfIdRanges;       /// Collected XF identifiers for cell ranges.
     MergedRangeList     maMergedRanges;     /// Merged cell ranges.
     MergedRangeList     maCenterFillRanges; /// Merged cell ranges from 'center across' or 'fill' alignment.
+    ValueRangeSet       maManualRowHeights; /// Rows that need manual height independent from own settings.
     WorksheetSettings   maSheetSett;        /// Global settings for this sheet.
     SharedFormulaBuffer maSharedFmlas;      /// Buffer for shared formulas in this sheet.
     CondFormatBuffer    maCondFormats;      /// Buffer for conditional formattings.
     PageSettings        maPageSett;         /// Page/print settings for this sheet.
     SheetViewSettings   maSheetViewSett;    /// View settings for this sheet.
     OUString            maDrawingPath;      /// Path to DrawingML fragment.
+    OUString            maVmlDrawingPath;   /// Path to legacy VML drawing fragment.
     ISegmentProgressBarRef mxProgressBar;   /// Sheet progress bar.
     ISegmentProgressBarRef mxRowProgress;   /// Progress bar for row/cell processing.
     ISegmentProgressBarRef mxFinalProgress; /// Progress bar for finalization.
@@ -471,7 +582,6 @@ private:
 
 WorksheetData::WorksheetData( const WorkbookHelper& rHelper, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
     WorkbookHelper( rHelper ),
-    maEmptyStrFormula( CREATE_OUSTRING( "=\"\"" ) ),
     maTrueFormula( CREATE_OUSTRING( "=TRUE()" ) ),
     maFalseFormula( CREATE_OUSTRING( "=FALSE()" ) ),
     maSheetCellRanges( CREATE_OUSTRING( "com.sun.star.sheet.SheetCellRanges" ) ),
@@ -482,10 +592,12 @@ WorksheetData::WorksheetData( const Work
     maPositionProp( CREATE_OUSTRING( "Position" ) ),
     maSizeProp( CREATE_OUSTRING( "Size" ) ),
     maVisibleProp( CREATE_OUSTRING( "IsVisible" ) ),
+    maTextWrapProp( CREATE_OUSTRING( "IsTextWrapped" ) ),
     maPageBreakProp( CREATE_OUSTRING( "IsStartOfNewPage" ) ),
     maUrlTextField( CREATE_OUSTRING( "com.sun.star.text.TextField.URL" ) ),
     maUrlProp( CREATE_OUSTRING( "URL" ) ),
     maReprProp( CREATE_OUSTRING( "Representation" ) ),
+    maValidationProp( CREATE_OUSTRING( "Validation" ) ),
     mrMaxApiPos( rHelper.getAddressConverter().getMaxApiAddress() ),
     maSheetSett( *this ),
     maSharedFmlas( *this ),
@@ -663,7 +775,7 @@ void WorksheetData::setDimension( const 
 
 void WorksheetData::setCellFormat( const OoxCellData& rCellData )
 {
-    if( rCellData.mxCell.is() && (rCellData.mnXfId >= 0) || (rCellData.mnNumFmtId >= 0) )
+    if( rCellData.mxCell.is() && ((rCellData.mnXfId >= 0) || (rCellData.mnNumFmtId >= 0)) )
     {
         // try to merge existing ranges and to write some formatting properties
         if( !maXfIdRanges.empty() )
@@ -739,6 +851,23 @@ void WorksheetData::setDrawingPath( cons
     maDrawingPath = rDrawingPath;
 }
 
+void WorksheetData::setVmlDrawingPath( const OUString& rVmlDrawingPath )
+{
+    maVmlDrawingPath = rVmlDrawingPath;
+}
+
+void WorksheetData::setOleObject( const OoxOleObjectData& rOleObjectData )
+{
+    if( rOleObjectData.mnShapeId > 0 )
+        maOleObjects[ rOleObjectData.mnShapeId ] = rOleObjectData;
+}
+
+void WorksheetData::setFormControl( const OoxFormControlData& rFormControlData )
+{
+    if( rFormControlData.mnShapeId > 0 )
+        maFormControls[ rFormControlData.mnShapeId ] = rFormControlData;
+}
+
 void WorksheetData::setBaseColumnWidth( sal_Int32 nWidth )
 {
     // do not modify width, if setDefaultColumnWidth() has been used
@@ -838,16 +967,21 @@ void WorksheetData::initializeWorksheetI
 
 void WorksheetData::finalizeWorksheetImport()
 {
+    if( mxRowProgress.get() )
+        mxRowProgress->setPosition( 1.0 );
     finalizeXfIdRanges();
     finalizeHyperlinkRanges();
     finalizeValidationRanges();
     finalizeMergedRanges();
     maCondFormats.finalizeImport();
     maPageSett.finalizeImport();
+    maSheetSett.finalizeImport();
     maSheetViewSett.finalizeImport();
     convertColumns();
     convertRows();
     finalizeDrawing();
+    if( mxFinalProgress.get() )
+        mxFinalProgress->setPosition( 1.0 );
 
     // reset current sheet index in global data
     setCurrentSheetIndex( -1 );
@@ -1000,11 +1134,15 @@ void WorksheetData::finalizeHyperlinkRan
 
 void WorksheetData::finalizeHyperlink( const CellAddress& rAddress, const OUString& rUrl ) const
 {
-    Reference< XMultiServiceFactory > xFactory( getDocument(), UNO_QUERY );
     Reference< XCell > xCell = getCell( rAddress );
+    if( xCell.is() ) switch( xCell->getType() )
+    {
+        // #i54261# restrict creation of URL field to text cells
+        case ::com::sun::star::table::CellContentType_TEXT:
+        {
+            Reference< XMultiServiceFactory > xFactory( getDocument(), UNO_QUERY );
     Reference< XText > xText( xCell, UNO_QUERY );
-    // hyperlinks only supported in text cells
-    if( xFactory.is() && xCell.is() && (xCell->getType() == ::com::sun::star::table::CellContentType_TEXT) && xText.is() )
+            if( xFactory.is() && xText.is() )
     {
         // create a URL field object and set its properties
         Reference< XTextContent > xUrlField( xFactory->createInstance( maUrlTextField ), UNO_QUERY );
@@ -1029,18 +1167,104 @@ void WorksheetData::finalizeHyperlink( c
         }
     }
 }
+        break;
+
+        // fix for #i31050# disabled, HYPERLINK is not able to return numeric value (#i91351#)
+#if 0
+        // #i31050# replace number with HYPERLINK function
+        case ::com::sun::star::table::CellContentType_VALUE:
+        {
+            Reference< XFormulaTokens > xTokens( xCell, UNO_QUERY );
+            OSL_ENSURE( xTokens.is(), "WorksheetHelper::finalizeHyperlink - missing formula interface" );
+            if( xTokens.is() )
+            {
+                SimpleFormulaContext aContext( xTokens, false, false );
+                getFormulaParser().convertNumberToHyperlink( aContext, rUrl, xCell->getValue() );
+            }
+        }
+        break;
+#endif
+
+        default:;
+    }
+}
 
 void WorksheetData::finalizeValidationRanges() const
 {
-    ValidationPropertyHelper& rPropHelper = getValidationPropertyHelper();
     for( OoxValidationList::const_iterator aIt = maValidations.begin(), aEnd = maValidations.end(); aIt != aEnd; ++aIt )
     {
         PropertySet aPropSet( getCellRangeList( aIt->maRanges ) );
-        rPropHelper.writeValidationProperties( aPropSet, *aIt );
+
+        Reference< XPropertySet > xValidation;
+        if( aPropSet.getProperty( xValidation, maValidationProp ) && xValidation.is() )
+        {
+            PropertySet aValProps( xValidation );
+            namespace csss = ::com::sun::star::sheet;
+
+            // convert validation type to API enum
+            ValidationType eType = csss::ValidationType_ANY;
+            switch( aIt->mnType )
+            {
+                case XML_custom:        eType = csss::ValidationType_CUSTOM;    break;
+                case XML_date:          eType = csss::ValidationType_DATE;      break;
+                case XML_decimal:       eType = csss::ValidationType_DECIMAL;   break;
+                case XML_list:          eType = csss::ValidationType_LIST;      break;
+                case XML_none:          eType = csss::ValidationType_ANY;       break;
+                case XML_textLength:    eType = csss::ValidationType_TEXT_LEN;  break;
+                case XML_time:          eType = csss::ValidationType_TIME;      break;
+                case XML_whole:         eType = csss::ValidationType_WHOLE;     break;
+                default:    OSL_ENSURE( false, "WorksheetData::finalizeValidationRanges - unknown validation type" );
+            }
+            aValProps.setProperty( CREATE_OUSTRING( "Type" ), eType );
+
+            // convert error alert style to API enum
+            ValidationAlertStyle eAlertStyle = csss::ValidationAlertStyle_STOP;
+            switch( aIt->mnErrorStyle )
+            {
+                case XML_information:   eAlertStyle = csss::ValidationAlertStyle_INFO;      break;
+                case XML_stop:          eAlertStyle = csss::ValidationAlertStyle_STOP;      break;
+                case XML_warning:       eAlertStyle = csss::ValidationAlertStyle_WARNING;   break;
+                default:    OSL_ENSURE( false, "WorksheetData::finalizeValidationRanges - unknown error style" );
+            }
+            aValProps.setProperty( CREATE_OUSTRING( "ErrorAlertStyle" ), eAlertStyle );
+
+            // convert dropdown style to API visibility constants
+            sal_Int16 nVisibility = aIt->mbNoDropDown ? csss::TableValidationVisibility::INVISIBLE : csss::TableValidationVisibility::UNSORTED;
+            aValProps.setProperty( CREATE_OUSTRING( "ShowList" ), nVisibility );
+
+            // messages
+            aValProps.setProperty( CREATE_OUSTRING( "ShowInputMessage" ), aIt->mbShowInputMsg );
+            aValProps.setProperty( CREATE_OUSTRING( "InputTitle" ), aIt->maInputTitle );
+            aValProps.setProperty( CREATE_OUSTRING( "InputMessage" ), aIt->maInputMessage );
+            aValProps.setProperty( CREATE_OUSTRING( "ShowErrorMessage" ), aIt->mbShowErrorMsg );
+            aValProps.setProperty( CREATE_OUSTRING( "ErrorTitle" ), aIt->maErrorTitle );
+            aValProps.setProperty( CREATE_OUSTRING( "ErrorMessage" ), aIt->maErrorMessage );
+
+            // allow blank cells
+            aValProps.setProperty( CREATE_OUSTRING( "IgnoreBlankCells" ), aIt->mbAllowBlank );
+
+            try
+            {
+                // condition operator
+                Reference< XSheetCondition > xSheetCond( xValidation, UNO_QUERY_THROW );
+                xSheetCond->setOperator( CondFormatBuffer::convertToApiOperator( aIt->mnOperator ) );
+
+                // condition formulas
+                Reference< XMultiFormulaTokens > xTokens( xValidation, UNO_QUERY_THROW );
+                xTokens->setTokens( 0, aIt->maTokens1 );
+                xTokens->setTokens( 1, aIt->maTokens2 );
     }
+            catch( Exception& )
+            {
 }
 
-void WorksheetData::finalizeMergedRanges() const
+            // write back validation settings to cell range(s)
+            aPropSet.setProperty( maValidationProp, xValidation );
+        }
+    }
+}
+
+void WorksheetData::finalizeMergedRanges()
 {
     MergedRangeList::const_iterator aIt, aEnd;
     for( aIt = maMergedRanges.begin(), aEnd = maMergedRanges.end(); aIt != aEnd; ++aIt )
@@ -1049,7 +1273,7 @@ void WorksheetData::finalizeMergedRanges
         finalizeMergedRange( aIt->maRange );
 }
 
-void WorksheetData::finalizeMergedRange( const CellRangeAddress& rRange ) const
+void WorksheetData::finalizeMergedRange( const CellRangeAddress& rRange )
 {
     bool bMultiCol = rRange.StartColumn < rRange.EndColumn;
     bool bMultiRow = rRange.StartRow < rRange.EndRow;
@@ -1061,24 +1285,41 @@ void WorksheetData::finalizeMergedRange(
         xMerge->merge( sal_True );
 
         // if merging this range worked (no overlapping merged ranges), update cell borders
-        PropertySet aTopLeft( getCell( CellAddress( mnSheet, rRange.StartColumn, rRange.StartRow ) ) );
+        Reference< XCell > xTopLeft = getCell( CellAddress( mnSheet, rRange.StartColumn, rRange.StartRow ) );
+        if( xTopLeft.is() )
+        {
+            PropertySet aTopLeftProp( xTopLeft );
 
         // copy right border of top-right cell to right border of top-left cell
         if( bMultiCol )
         {
-            PropertySet aTopRight( getCell( CellAddress( mnSheet, rRange.EndColumn, rRange.StartRow ) ) );
+                PropertySet aTopRightProp( getCell( CellAddress( mnSheet, rRange.EndColumn, rRange.StartRow ) ) );
             BorderLine aLine;
-            if( aTopRight.getProperty( aLine, maRightBorderProp ) )
-                aTopLeft.setProperty( maRightBorderProp, aLine );
+                if( aTopRightProp.getProperty( aLine, maRightBorderProp ) )
+                    aTopLeftProp.setProperty( maRightBorderProp, aLine );
         }
 
         // copy bottom border of bottom-left cell to bottom border of top-left cell
         if( bMultiRow )
         {
-            PropertySet aBottomLeft( getCell( CellAddress( mnSheet, rRange.StartColumn, rRange.EndRow ) ) );
+                PropertySet aBottomLeftProp( getCell( CellAddress( mnSheet, rRange.StartColumn, rRange.EndRow ) ) );
             BorderLine aLine;
-            if( aBottomLeft.getProperty( aLine, maBottomBorderProp ) )
-                aTopLeft.setProperty( maBottomBorderProp, aLine );
+                if( aBottomLeftProp.getProperty( aLine, maBottomBorderProp ) )
+                    aTopLeftProp.setProperty( maBottomBorderProp, aLine );
+            }
+
+            // #i93609# merged range in a single row: test if manual row height is needed
+            if( !bMultiRow )
+            {
+                bool bTextWrap = aTopLeftProp.getBoolProperty( maTextWrapProp );
+                if( !bTextWrap && (xTopLeft->getType() == ::com::sun::star::table::CellContentType_TEXT) )
+                {
+                    Reference< XText > xText( xTopLeft, UNO_QUERY );
+                    bTextWrap = xText.is() && (xText->getString().indexOf( '\x0A' ) >= 0);
+                }
+                if( bTextWrap )
+                    maManualRowHeights.insert( rRange.StartRow );
+            }
         }
     }
     catch( Exception& )
@@ -1126,10 +1367,8 @@ void WorksheetData::convertColumns()
 void WorksheetData::convertColumns( OutlineLevelVec& orColLevels,
         sal_Int32 nFirstCol, sal_Int32 nLastCol, const OoxColumnData& rData )
 {
-    Reference< XTableColumns > xColumns = getColumns( nFirstCol, nLastCol );
-    if( xColumns.is() )
-    {
-        PropertySet aPropSet( xColumns );
+    PropertySet aPropSet( getColumns( nFirstCol, nLastCol ) );
+
         // column width: convert 'number of characters' to column width in 1/100 mm
         sal_Int32 nWidth = getUnitConverter().scaleToMm100( rData.mfWidth, UNIT_DIGIT );
         // macro sheets have double width
@@ -1137,10 +1376,11 @@ void WorksheetData::convertColumns( Outl
             nWidth *= 2;
         if( nWidth > 0 )
             aPropSet.setProperty( maWidthProp, nWidth );
+
         // hidden columns: TODO: #108683# hide columns later?
         if( rData.mbHidden )
             aPropSet.setProperty( maVisibleProp, false );
-    }
+
     // outline settings for this column range
     convertOutlines( orColLevels, nFirstCol, rData.mnLevel, rData.mbCollapsed, false );
 }
@@ -1177,23 +1417,30 @@ void WorksheetData::convertRows()
 void WorksheetData::convertRows( OutlineLevelVec& orRowLevels,
         sal_Int32 nFirstRow, sal_Int32 nLastRow, const OoxRowData& rData, double fDefHeight )
 {
-    Reference< XTableRows > xRows = getRows( nFirstRow, nLastRow );
-    if( xRows.is() )
-    {
-        PropertySet aPropSet( xRows );
-        /*  Row height:
-            -   convert points to row height in 1/100 mm
-            -   ignore rData.mbCustomHeight, Excel does not set optimal height
-                correctly, if a merged cell contains multi-line text.
-         */
+    // row height: convert points to row height in 1/100 mm
         double fHeight = (rData.mfHeight >= 0.0) ? rData.mfHeight : fDefHeight;
         sal_Int32 nHeight = getUnitConverter().scaleToMm100( fHeight, UNIT_POINT );
         if( nHeight > 0 )
+    {
+        ValueRangeVector aManualRows;
+        if( rData.mbCustomHeight )
+            aManualRows.push_back( ValueRange( nFirstRow, nLastRow ) );
+        else
+            maManualRowHeights.intersect( aManualRows, nFirstRow, nLastRow );
+        for( ValueRangeVector::const_iterator aIt = aManualRows.begin(), aEnd = aManualRows.end(); aIt != aEnd; ++aIt )
+        {
+            PropertySet aPropSet( getRows( aIt->mnFirst, aIt->mnLast ) );
             aPropSet.setProperty( maHeightProp, nHeight );
+        }
+    }
+
         // hidden rows: TODO: #108683# hide rows later?
         if( rData.mbHidden )
+    {
+        PropertySet aPropSet( getRows( nFirstRow, nLastRow ) );
             aPropSet.setProperty( maVisibleProp, false );
     }
+
     // outline settings for this row range
     convertOutlines( orRowLevels, nFirstRow, rData.mnLevel, rData.mbCollapsed, true );
 }
@@ -1433,26 +1680,13 @@ SheetViewSettings& WorksheetHelper::getS
     return mrSheetData.getSheetViewSettings();
 }
 
-void WorksheetHelper::setEmptyStringCell( const Reference< XCell >& rxCell ) const
-{
-    OSL_ENSURE( rxCell.is(), "WorksheetHelper::setEmptyStringCell - missing cell interface" );
-    rxCell->setFormula( mrSheetData.getEmptyStringFormula() );
-}
-
-void WorksheetHelper::setStringCell( const Reference< XCell >& rxCell, const OUString& rText, bool bEmptyStringAsFormula ) const
-{
-    if( bEmptyStringAsFormula && (rText.getLength() == 0) )
-    {
-        setEmptyStringCell( rxCell );
-    }
-    else
+void WorksheetHelper::setStringCell( const Reference< XCell >& rxCell, const OUString& rText ) const
     {
         OSL_ENSURE( rxCell.is(), "WorksheetHelper::setStringCell - missing cell interface" );
         Reference< XText > xText( rxCell, UNO_QUERY );
         if( xText.is() )
             xText->setString( rText );
     }
-}
 
 void WorksheetHelper::setSharedStringCell( const Reference< XCell >& rxCell, sal_Int32 nStringId, sal_Int32 nXfId ) const
 {
@@ -1474,7 +1708,7 @@ void WorksheetHelper::setErrorCell( cons
 void WorksheetHelper::setErrorCell( const Reference< XCell >& rxCell, sal_uInt8 nErrorCode ) const
 {
     Reference< XFormulaTokens > xTokens( rxCell, UNO_QUERY );
-    OSL_ENSURE( xTokens.is(), "WorksheetHelper::setErrorCell - missing cell interface" );
+    OSL_ENSURE( xTokens.is(), "WorksheetHelper::setErrorCell - missing formula interface" );
     if( xTokens.is() )
     {
         SimpleFormulaContext aContext( xTokens, false, false );
@@ -1482,7 +1716,7 @@ void WorksheetHelper::setErrorCell( cons
     }
 }
 
-void WorksheetHelper::setOoxCell( OoxCellData& orCellData, bool bEmptyStringAsFormula ) const
+void WorksheetHelper::setOoxCell( OoxCellData& orCellData ) const
 {
     OSL_ENSURE( orCellData.mxCell.is(), "WorksheetHelper::setCell - missing cell interface" );
     if( orCellData.mbHasValueStr ) switch( orCellData.mnCellType )
@@ -1499,7 +1733,7 @@ void WorksheetHelper::setOoxCell( OoxCel
             setErrorCell( orCellData.mxCell, orCellData.maValueStr );
         break;
         case XML_str:
-            setStringCell( orCellData.mxCell, orCellData.maValueStr, bEmptyStringAsFormula );
+            setStringCell( orCellData.mxCell, orCellData.maValueStr );
         break;
         case XML_s:
             setSharedStringCell( orCellData.mxCell, orCellData.maValueStr.toInt32(), orCellData.mnXfId );
@@ -1654,6 +1888,21 @@ void WorksheetHelper::setDrawingPath( co
     mrSheetData.setDrawingPath( rDrawingPath );
 }
 
+void WorksheetHelper::setVmlDrawingPath( const OUString& rVmlDrawingPath )
+{
+    mrSheetData.setVmlDrawingPath( rVmlDrawingPath );
+}
+
+void WorksheetHelper::setOleObject( const OoxOleObjectData& rOleObjectData )
+{
+    mrSheetData.setOleObject( rOleObjectData );
+}
+
+void WorksheetHelper::setFormControl( const OoxFormControlData& rFormControlData )
+{
+    mrSheetData.setFormControl( rFormControlData );
+}
+
 void WorksheetHelper::setBaseColumnWidth( sal_Int32 nWidth )
 {
     mrSheetData.setBaseColumnWidth( nWidth );
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/source/xls/worksheetsettings.cxx /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/worksheetsettings.cxx
--- oox/source/xls/worksheetsettings.cxx	2008-07-01 14:30:07.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/source/xls/worksheetsettings.cxx	2009-03-23 21:12:46.000000000 +0100
@@ -34,6 +34,7 @@
 #include "oox/helper/recordinputstream.hxx"
 #include "oox/xls/biffinputstream.hxx"
 #include "oox/xls/pagesettings.hxx"
+#include "oox/xls/viewsettings.hxx"
 #include "oox/xls/workbooksettings.hxx"
 
 using ::rtl::OUString;
@@ -138,11 +139,6 @@ void WorksheetSettings::importChartSheet
     maOoxSheetData.maCodeName = rAttribs.getString( XML_codeName, OUString() );
 }
 
-void WorksheetSettings::importTabColor( const AttributeList& rAttribs )
-{
-    maOoxSheetData.maTabColor.importColor( rAttribs );
-}
-
 void WorksheetSettings::importOutlinePr( const AttributeList& rAttribs )
 {
     maOoxSheetData.mbApplyStyles  = rAttribs.getBool( XML_applyStyles, false );
@@ -187,7 +183,8 @@ void WorksheetSettings::importSheetPr( R
 {
     sal_uInt16 nFlags1;
     sal_uInt8 nFlags2;
-    rStrm >> nFlags1 >> nFlags2 >> maOoxSheetData.maTabColor;
+    rStrm >> nFlags1 >> nFlags2;
+    getSheetViewSettings().importTabColor( rStrm );
     rStrm.skip( 8 );    // sync anchor cell
     rStrm >> maOoxSheetData.maCodeName;
     // sheet settings
@@ -204,7 +201,8 @@ void WorksheetSettings::importSheetPr( R
 void WorksheetSettings::importChartSheetPr( RecordInputStream& rStrm )
 {
     rStrm.skip( 2 );    // flags, contains only the 'published' flag
-    rStrm >> maOoxSheetData.maTabColor >> maOoxSheetData.maCodeName;
+    getSheetViewSettings().importTabColor( rStrm );
+    rStrm >> maOoxSheetData.maCodeName;
 }
 
 void WorksheetSettings::importSheetProtection( RecordInputStream& rStrm )
@@ -285,7 +283,8 @@ void WorksheetSettings::importPassword( 
 
 void WorksheetSettings::importSheetProtection( BiffInputStream& rStrm )
 {
-    sal_uInt16 nFlags = rStrm.skip( 19 ).readuInt16();
+    rStrm.skip( 19 );
+    sal_uInt16 nFlags = rStrm.readuInt16();
     // set flag means protection is disabled
     maOoxProtData.mbObjects          = !getFlag( nFlags, BIFF_SHEETPROT_OBJECTS );
     maOoxProtData.mbScenarios        = !getFlag( nFlags, BIFF_SHEETPROT_SCENARIOS );
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/util/makefile.mk /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/util/makefile.mk
--- oox/util/makefile.mk	2008-11-03 16:19:10.000000000 +0100
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/util/makefile.mk	2009-03-19 14:28:40.000000000 +0100
@@ -47,6 +47,7 @@ LIB1FILES=	\
 	$(SLB)$/token.lib\
     $(SLB)$/helper.lib\
     $(SLB)$/core.lib\
+    $(SLB)$/ole.lib\
     $(SLB)$/ppt.lib\
     $(SLB)$/xls.lib\
     $(SLB)$/vml.lib\
@@ -61,7 +62,7 @@ LIB1FILES=	\
 # --- Shared-Library -----------------------------------------------
 
 SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
-SHL1IMPLIB= i$(SHL1TARGET)
+SHL1IMPLIB= i$(TARGET)
 SHL1USE_EXPORTS=name
 
 SHL1STDLIBS= \
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/util/makefile.mk.orig /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/util/makefile.mk.orig
--- oox/util/makefile.mk.orig	2008-07-01 14:30:27.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/util/makefile.mk.orig	2009-01-06 14:16:56.000000000 +0100
@@ -47,6 +47,7 @@ LIB1FILES=	\
 	$(SLB)$/token.lib\
     $(SLB)$/helper.lib\
     $(SLB)$/core.lib\
+    $(SLB)$/ole.lib\
     $(SLB)$/ppt.lib\
     $(SLB)$/xls.lib\
     $(SLB)$/vml.lib\
@@ -61,7 +62,7 @@ LIB1FILES=	\
 # --- Shared-Library -----------------------------------------------
 
 SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
-SHL1IMPLIB= i$(SHL1TARGET)
+SHL1IMPLIB= i$(TARGET)
 SHL1USE_EXPORTS=name
 
 SHL1STDLIBS= \
diff -purN --exclude=unxlngx6.pro --exclude=CVS --exclude='*~' --exclude='*-' --exclude='*.txt' -w -I'$\(Revision\)' oox/util/makefile.pmk /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/util/makefile.pmk
--- oox/util/makefile.pmk	2008-04-10 18:22:33.000000000 +0200
+++ /home/janneke/vc/ooo310-m6/build/ooo310-m6/oox/util/makefile.pmk	2008-12-30 15:32:01.000000000 +0100
@@ -31,8 +31,4 @@
 
 # Reduction of exported symbols:
 CDEFS += -DOOX_DLLIMPLEMENTATION
-.IF "$(COMNAME)" == "gcc3" && "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
-CFLAGS += -fvisibility=hidden
-.ELIF "$(COMNAME)" == "sunpro5" && "$(CCNUMVER)" >= "00050005"
-CFLAGS += -xldscope=hidden
-.ENDIF
+VISIBILITY_HIDDEN=TRUE

