diff options
Diffstat (limited to 'oox/source/dump/biffdumper.cxx')
-rw-r--r-- | oox/source/dump/biffdumper.cxx | 255 |
1 files changed, 219 insertions, 36 deletions
diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx index b78c993a0968..4e9156b5cc03 100644 --- a/oox/source/dump/biffdumper.cxx +++ b/oox/source/dump/biffdumper.cxx @@ -29,8 +29,8 @@ #include <osl/thread.h> #include <rtl/tencinfo.h> -#include "oox/dump/oledumper.hxx" #include "oox/core/filterbase.hxx" +#include "oox/dump/oledumper.hxx" #include "oox/ole/olestorage.hxx" #include "oox/xls/biffdetector.hxx" #include "oox/xls/biffinputstream.hxx" @@ -38,23 +38,27 @@ #if OOX_INCLUDE_DUMPER -using ::rtl::OUString; -using ::rtl::OUStringBuffer; +namespace oox { +namespace dump { +namespace biff { + +// ============================================================================ + +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::util; +using namespace ::oox::xls; + +using ::comphelper::MediaDescriptor; +using ::oox::core::FilterBase; using ::rtl::OString; using ::rtl::OStringBuffer; using ::rtl::OStringToOUString; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::util::DateTime; -using ::com::sun::star::lang::XMultiServiceFactory; -using ::com::sun::star::io::XInputStream; -using ::comphelper::MediaDescriptor; -using ::oox::core::FilterBase; - -using namespace ::oox::xls; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; -namespace oox { -namespace dump { -namespace biff { +// ============================================================================ namespace { @@ -93,12 +97,7 @@ const sal_uInt16 BIFF_STYLE_BUILTIN = 0x8000; const sal_uInt16 BIFF_PT_NOSTRING = 0xFFFF; -} // namespace - -// ============================================================================ -// ============================================================================ - -namespace { +// ---------------------------------------------------------------------------- void lclDumpDffClientPos( const OutputRef& rxOut, const BinaryInputStreamRef& rxStrm, const String& rName, sal_uInt16 nSubScale ) { @@ -128,7 +127,8 @@ void lclDumpDffClientRect( const OutputRef& rxOut, const BinaryInputStreamRef& r } // namespace -// ---------------------------------------------------------------------------- +// ============================================================================ +// ============================================================================ BiffDffStreamObject::BiffDffStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm ) { @@ -537,6 +537,26 @@ OUString BiffObjectBase::dumpString( const String& rName, BiffStringFlags nByteF return (getBiff() == BIFF8) ? dumpUniString( rName, nUniFlags ) : dumpByteString( rName, nByteFlags, eDefaultTextEnc ); } +OUString BiffObjectBase::dumpSegmentedUniString( const String& rName ) +{ + sal_Int32 nLength = mxBiffStrm->readInt32(); + OUStringBuffer aBuffer; + while( !mxBiffStrm->isEof() && (aBuffer.getLength() < nLength) ) + aBuffer.append( mxBiffStrm->readUniString() ); + OUString aString = aBuffer.makeStringAndClear(); + writeStringItem( rName, aString ); + return aString; +} + +void BiffObjectBase::dumpSegmentedUniStringArray( const String& rName ) +{ + writeEmptyItem( rName ); + IndentGuard aIndGuard( mxOut ); + mxOut->resetItemIndex(); + for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "count" ); !mxBiffStrm->isEof() && (nIndex < nCount); ++nIndex ) + dumpSegmentedUniString( "#entry" ); +} + sal_uInt8 BiffObjectBase::dumpBoolean( const String& rName ) { sal_uInt8 nBool; @@ -2066,6 +2086,69 @@ void WorkbookStreamObject::implDumpRecordBody() dumpBool< sal_uInt32 >( "recommend-compress-pics" ); break; + case BIFF_ID_CONNECTION: + { + dumpFrHeader( true, false ); + sal_uInt16 nType = dumpDec< sal_uInt16 >( "data-source-type", "CONNECTION-SOURCETYPE" ); + sal_uInt16 nFlags1 = dumpHex< sal_uInt16 >( "flags", "CONNECTION-FLAGS" ); + dumpDec< sal_uInt16 >( "param-count" ); + dumpUnused( 2 ); + dumpHex< sal_uInt16 >( "querytable-flags", "QUERYTABLESETTINGS-FLAGS" ); + switch( nType ) + { + case 4: dumpHex< sal_uInt16 >( "html-flags", "QUERYTABLESETTINGS-HTML-FLAGS" ); break; + case 5: dumpHex< sal_uInt16 >( "oledb-flags", "QUERYTABLESETTINGS-OLEDB-FLAGS" ); break; + case 7: dumpHex< sal_uInt16 >( "ado-flags", "QUERYTABLESETTINGS-ADO-FLAGS" ); break; + default: dumpUnused( 2 ); + } + dumpDec< sal_uInt8 >( "edited-version" ); + dumpDec< sal_uInt8 >( "refreshed-version" ); + dumpDec< sal_uInt8 >( "min-refresh-version" ); + dumpDec< sal_uInt16 >( "refresh-interval", "QUERYTABLESETTINGS-INTERVAL" ); + dumpDec< sal_uInt16 >( "html-format", "QUERYTABLESETTINGS-HTMLFORMAT" ); + dumpDec< sal_Int32 >( "reconnect-type", "CONNECTION-RECONNECTTYPE" ); + dumpDec< sal_uInt8 >( "credentials", "CONNECTION-CREDENTIALS" ); + dumpUnused( 1 ); + dumpSegmentedUniString( "source-file" ); + dumpSegmentedUniString( "source-conn-file" ); + dumpSegmentedUniString( "name" ); + dumpSegmentedUniString( "description" ); + dumpSegmentedUniString( "sso-id" ); + if( nFlags1 & 0x0004 ) dumpSegmentedUniString( "table-names" ); + if( nFlags1 & 0x0010 ) + { + break; // TODO: parameter array structure + } + bool bEscape = false; + switch( nType ) + { + case 1: + dumpSegmentedUniString( "connection-string" ); + break; + case 4: + dumpSegmentedUniStringArray( "urls" ); + dumpSegmentedUniStringArray( "post-method" ); + break; + case 5: + bEscape = true; + break; + case 6: + bEscape = true; + break; + } + if( bEscape ) + break; + dumpSegmentedUniStringArray( "sql-command" ); + dumpSegmentedUniStringArray( "orig-sql-command" ); + dumpSegmentedUniStringArray( "webquery-dialog-url" ); + switch( dumpDec< sal_uInt8 >( "linked-object-type", "CONNECTION-LINKEDOBJECTTYPE" ) ) + { + case 1: dumpSegmentedUniString( "defined-name" ); break; + case 2: dumpHex< sal_uInt16 >( "cache-id" ); break; + } + } + break; + case BIFF_ID_CONT: if( (eBiff == BIFF8) && (getLastRecId() == BIFF_ID_OBJ) ) dumpEmbeddedDff(); @@ -2177,6 +2260,21 @@ void WorkbookStreamObject::implDumpRecordBody() dumpDec< sal_uInt16 >( "#cell-offset" ); break; + case BIFF_ID_DBQUERY: + if( eBiff == BIFF8 ) + { + if( (getLastRecId() != BIFF_ID_PCITEM_STRING) && (getLastRecId() != BIFF_ID_DBQUERY) ) + { + dumpHex< sal_uInt16 >( "flags", "DBQUERY-FLAGS" ); + dumpDec< sal_uInt16 >( "sql-param-count" ); + dumpDec< sal_uInt16 >( "command-count" ); + dumpDec< sal_uInt16 >( "post-method-count" ); + dumpDec< sal_uInt16 >( "server-sql-count" ); + dumpDec< sal_uInt16 >( "odbc-connection-count" ); + } + } + break; + case BIFF2_ID_DEFINEDNAME: case BIFF3_ID_DEFINEDNAME: { @@ -2335,6 +2433,19 @@ void WorkbookStreamObject::implDumpRecordBody() dumpString( "password-creator", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS ); break; + case BIFF_ID_FILTERCOLUMN: + { + dumpDec< sal_uInt16 >( "column-index" ); + dumpHex< sal_uInt16 >( "flags", "FILTERCOLUMN-FLAGS" ); + sal_uInt8 nStrLen1 = dumpFilterColumnOperator( "operator-1" ); + sal_uInt8 nStrLen2 = dumpFilterColumnOperator( "operator-2" ); + bool bBiff8 = eBiff == BIFF8; + rtl_TextEncoding eTextEnc = getBiffData().getTextEncoding(); + if( nStrLen1 > 0 ) writeStringItem( "string-1", bBiff8 ? rStrm.readUniStringBody( nStrLen1, true ) : rStrm.readCharArrayUC( nStrLen1, eTextEnc, true ) ); + if( nStrLen2 > 0 ) writeStringItem( "string-2", bBiff8 ? rStrm.readUniStringBody( nStrLen2, true ) : rStrm.readCharArrayUC( nStrLen2, eTextEnc, true ) ); + } + break; + case BIFF2_ID_FONT: case BIFF3_ID_FONT: dumpFontRec(); @@ -2715,6 +2826,58 @@ void WorkbookStreamObject::implDumpRecordBody() } break; + case BIFF_ID_QUERYTABLE: + dumpHex< sal_uInt16 >( "flags", "QUERYTABLE-FLAGS" ); + dumpDec< sal_uInt16 >( "autoformat-id" ); + dumpHex< sal_uInt16 >( "autoformat-flags", "QUERYTABLE-AUTOFORMAT-FLAGS" ); + dumpUnused( 4 ); + dumpUniString( "defined-name" ); + dumpUnused( 2 ); + break; + + case BIFF_ID_QUERYTABLEREFRESH: + { + dumpFrHeader( true, false ); + bool bPivot = dumpBool< sal_uInt16 >( "pivot-table" ); + dumpHex< sal_uInt16 >( "flags", "QUERYTABLEREFRESH-FLAGS" ); + dumpHex< sal_uInt32 >( bPivot ? "pivottable-flags" : "querytable-flags", bPivot ? "QUERYTABLEREFRESH-PTFLAGS" : "QUERYTABLEREFRESH-QTFLAGS" ); + dumpDec< sal_uInt8 >( "refreshed-version" ); + dumpDec< sal_uInt8 >( "min-refresh-version" ); + dumpUnused( 2 ); + dumpUniString( "table-name" ); + dumpUnused( 2 ); + } + break; + + case BIFF_ID_QUERYTABLESETTINGS: + { + dumpFrHeader( true, false ); + sal_uInt16 nType = dumpDec< sal_uInt16 >( "data-source-type", "CONNECTION-SOURCETYPE" ); + dumpHex< sal_uInt16 >( "flags-1", "QUERYTABLESETTINGS-FLAGS" ); + switch( nType ) + { + case 4: dumpHex< sal_uInt16 >( "html-flags", "QUERYTABLESETTINGS-HTML-FLAGS" ); break; + case 5: dumpHex< sal_uInt16 >( "oledb-flags", "QUERYTABLESETTINGS-OLEDB-FLAGS" ); break; + case 7: dumpHex< sal_uInt16 >( "ado-flags", "QUERYTABLESETTINGS-ADO-FLAGS" ); break; + default: dumpUnused( 2 ); + } + dumpHex< sal_uInt16 >( "ext-flags", "QUERYTABLESETTINGS-EXT-FLAGS" ); + dumpDec< sal_uInt8 >( "edited-version" ); + dumpDec< sal_uInt8 >( "refreshed-version" ); + dumpDec< sal_uInt8 >( "min-refresh-version" ); + dumpUnused( 3 ); + dumpDec< sal_uInt16 >( "oledb-count" ); + dumpDec< sal_uInt16 >( "future-data-size" ); + dumpDec< sal_uInt16 >( "refresh-interval", "QUERYTABLESETTINGS-INTERVAL" ); + dumpDec< sal_uInt16 >( "html-format", "QUERYTABLESETTINGS-HTMLFORMAT" ); + } + break; + + case BIFF_ID_QUERYTABLESTRING: + dumpFrHeader( true, false ); + dumpUniString( "connection-string" ); + break; + case BIFF_ID_RECALCID: dumpFrHeader( true, false ); dumpDec< sal_uInt32 >( "recalc-engine-id" ); @@ -2896,18 +3059,6 @@ void WorkbookStreamObject::implDumpRecordBody() dumpDxfProp(); break; - case BIFF_ID_SXEXT: - if( eBiff == BIFF8 ) - { - dumpHex< sal_uInt16 >( "flags", "SXEXT-FLAGS" ); - dumpDec< sal_uInt16 >( "param-string-count" ); - dumpDec< sal_uInt16 >( "sql-statement-string-count" ); - dumpDec< sal_uInt16 >( "webquery-postmethod-string-count" ); - dumpDec< sal_uInt16 >( "server-pagefields-string-count" ); - dumpDec< sal_uInt16 >( "odbc-connection-string-count" ); - } - break; - case BIFF_ID_TABLESTYLES: { dumpFrHeader( true, true ); @@ -3122,6 +3273,38 @@ void WorkbookStreamObject::dumpExtGradientHead() dumpDec< double >( "pos-bottom" ); } +sal_uInt8 WorkbookStreamObject::dumpFilterColumnOperator( const String& rName ) +{ + sal_uInt8 nStrLen = 0; + writeEmptyItem( rName ); + IndentGuard aIndGuard( mxOut ); + sal_uInt8 nType = dumpDec< sal_uInt8 >( "data-type", "FILTERCOLUMN-DATATYPE" ); + dumpDec< sal_uInt8 >( "operator", "FILTERCOLUMN-OPERATOR" ); + switch( nType ) + { + case 2: + dumpRk( "value" ); + dumpUnused( 4 ); + break; + case 4: + dumpDec< double >( "value" ); + break; + case 6: + dumpUnused( 4 ); + nStrLen = dumpDec< sal_uInt8 >( "length" ); + dumpBoolean( "simple" ); + dumpUnused( 2 ); + break; + case 8: + dumpBoolErr(); + dumpUnused( 6 ); + break; + default: + dumpUnused( 8 ); + } + return nStrLen; +} + OUString WorkbookStreamObject::dumpPivotString( const String& rName, sal_uInt16 nStrLen ) { OUString aString; @@ -3151,9 +3334,9 @@ void WorkbookStreamObject::dumpBoolErr() { MultiItemsGuard aMultiGuard( mxOut ); sal_uInt8 nValue = dumpHex< sal_uInt8 >( "value" ); - bool bErrCode = dumpBool< sal_uInt8 >( "is-errorcode" ); + bool bErrCode = dumpBool< sal_uInt8 >( "is-error-code" ); if( bErrCode ) - writeErrorCodeItem( "errorcode", nValue ); + writeErrorCodeItem( "error-code", nValue ); else writeBooleanItem( "boolean", nValue ); } @@ -4362,10 +4545,10 @@ void Dumper::implDump() } // ============================================================================ +// ============================================================================ } // namespace biff } // namespace dump } // namespace oox #endif - |