diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-22 10:06:26 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-22 10:06:26 +0000 |
commit | 7dd50f9ec124f2666dcfd1fd8bb02a1335a360ac (patch) | |
tree | 0aec8c1317128300fbf3c65695ceb294c5a5ecb7 /sc/source | |
parent | 19b299cdb52a2dd4138885cf3487b34b7600f9f9 (diff) |
CWS-TOOLING: integrate CWS dr67
2009-04-08 13:23:56 +0200 dr r270638 : #i100534# reverted
2009-04-08 10:14:55 +0200 dr r270621 : CWS-TOOLING: rebase CWS dr67 to trunk@270033 (milestone: DEV300:m45)
2009-04-07 21:06:33 +0200 dr r270610 : #i100534# sc does not link in debug mode
2009-03-12 11:20:09 +0100 dr r269375 : #i10000# wae
2009-03-11 19:43:55 +0100 dr r269351 : #i10000# adjust oox namespace ids according to oox/inc/oox/core/namespaces.hxx
2009-03-11 15:38:52 +0100 dr r269339 : CWS-TOOLING: rebase CWS dr67 to trunk@269297 (milestone: DEV300:m43)
2009-02-27 15:20:21 +0100 dr r268598 : CWS-TOOLING: rebase CWS dr67 to trunk@268395 (milestone: DEV300:m42)
2009-02-19 13:32:17 +0100 dr r268277 : moved hf parser into page settings
2009-02-19 12:25:15 +0100 dr r268272 : renamed some structs according to chart filter
2009-02-16 15:51:31 +0100 dr r267823 : #i97873# import autosort settings from BIFF8/OOBIN/OOXML
2009-02-06 17:09:29 +0100 dr r267477 : #i97873# minor changes
2009-02-06 16:38:56 +0100 dr r267473 : #i97873# import date grouping settings from BIFF5/BIFF8/OOBIN/OOXML
2009-02-06 16:38:11 +0100 dr r267472 : #i97873# check min/max/step of passed GroupInfo
2009-02-06 16:35:13 +0100 dr r267471 : #i97873# more doc for createDategroup()
2009-02-06 13:53:42 +0100 dr r267459 : #i97873# make XDataPilotGrouping::createDateGroup() implementation working and robust against wrong input data
2009-02-06 13:52:16 +0100 dr r267458 : #i97873# fix and extend IDL doc for datapilot grouping
2009-02-06 12:35:49 +0100 dr r267453 : fix other IDLC warnings in sheet module
2009-02-06 12:05:19 +0100 dr r267448 : #i97873# fix and extend IDL doc for datapilot grouping
2009-02-02 17:58:46 +0100 dr r267284 : #i10000# rebase errors
2009-02-02 17:52:21 +0100 dr r267282 : #i10000# rebase errors
2009-02-02 17:35:58 +0100 dr r267280 : #i10000# rebase errors
2009-02-02 15:58:04 +0100 dr r267274 : CWS-TOOLING: rebase CWS dr67 to trunk@267171 (milestone: DEV300:m41)
2009-02-02 09:16:32 +0100 dr r267247 : #i97873# typo
2009-01-30 17:09:09 +0100 dr r267215 : #i97873# import numeric grouping settings for datapilot fields from BIFF5/BIFF8/OOBIN/OOXML
2009-01-29 16:36:24 +0100 dr r267154 : #i97873# import datapilot discrete grouping from BIFF5/BIFF8/OOBIN/OOXLS
2009-01-29 16:33:37 +0100 dr r267152 : #i97873# do not kill _all_ the other group fields when writing back DataPilotField::GroupInfo property
2009-01-29 14:15:45 +0100 dr r267133 : #i93839# remove ScChengeTrack::Load and ::Store, adapt xls export filter
2009-01-28 13:30:37 +0100 dr r267056 : #i98397# enhance DataPilot API: allow to rename groups and items in a group field
2009-01-28 12:09:05 +0100 dr r267051 : #i98397# enhance DataPilot API: allow to rename groups and items in a group field
2009-01-27 16:13:58 +0100 dr r267005 : #i97873# minor changes in DataPilot API implementation as preparation for additional changes needed for OOX import filter
2009-01-27 10:08:01 +0100 dr r266961 : #i97873# changing orientation of a DP field moves it to last position in new dimension
2009-01-27 10:06:50 +0100 dr r266960 : #i97873# changing orientation of a DP field moves it to last position in new dimension
2009-01-23 12:52:31 +0100 dr r266808 : #i97873# DP documentation extended
2009-01-21 20:07:15 +0100 dr r266702 : #i97873# this trivial patch adds BIFF5/BIFF8 pivot table import to the oox filter
2009-01-20 16:06:23 +0100 dr r266592 : select BIFF filter via env.var
2009-01-16 18:51:01 +0100 dr r266452 : #i97873# import page fields
2009-01-16 15:05:36 +0100 dr r266420 : #i97873# field item settings (collapsed/hidden), settings of hidden fields
2009-01-15 16:01:17 +0100 dr r266377 : #i97873# import OOXML7/OOBIN7 autoshow settings
2009-01-14 15:24:27 +0100 dr r266310 : #i97873# import auto show settings generated by MSO2003
2009-01-14 12:29:44 +0100 dr r266281 : #i97873# set global dp settings
2009-01-13 15:04:30 +0100 dr r266229 : #i98029# SdrGroupObj does not remember predefined bounding rectangle anymore
2009-01-13 14:46:50 +0100 dr r266225 : #i98029# SdrGroupObj does not remember predefined bounding rectangle anymore
2009-01-12 15:04:22 +0100 dr r266161 : #i97873# remove misleading hasDataLayoutField()
2009-01-12 15:03:42 +0100 dr r266160 : #i97873# remove misleading hasDataLayoutField()
2009-01-12 14:57:33 +0100 dr r266159 : #i97900# reverted previous change, adjusted code to new EnableRTL() behaviour
2009-01-12 14:52:43 +0100 dr r266158 : #i97900# reverted previous change, adjusted code to new EnableRTL() behaviour
2009-01-09 16:34:55 +0100 dr r266098 : #i97900# RTL handling in TabBar changed with CWS rtlcontrols
2009-01-09 16:32:16 +0100 dr r266097 : #i97900# RTL handling in TabBar changed with CWS rtlcontrols
2009-01-09 12:02:39 +0100 dr r266072 : #i97623# RTL handling changed after CWS rtlcontrols
2009-01-09 09:48:53 +0100 dr r266050 : #i158444# SXLI must be filled completely before starting CONTINUE
2009-01-08 18:50:08 +0100 dr r266032 : #158444# allow to disable dump of record positions
2009-01-08 15:46:45 +0100 dr r266020 : #i97873# data layout field handling
2009-01-08 15:45:45 +0100 dr r266019 : #i97873# data layout field handling
2009-01-08 15:42:25 +0100 dr r266018 : #i97873# data layout field handling
2009-01-02 17:28:32 +0100 dr r265844 : #i10000# unxmacxi warning
2009-01-02 16:59:13 +0100 dr r265842 : #i10000# rebase corrections
2009-01-02 16:44:44 +0100 dr r265838 : #i10000# rebase corrections
2009-01-02 11:32:44 +0100 dr r265834 : CWS-TOOLING: rebase CWS dr67 to trunk@265758 (milestone: DEV300:m38)
2008-12-29 16:55:40 +0100 dr r265822 : more pivot table import, field layout settings
2008-12-29 14:27:35 +0100 dr r265817 : more pivot table import, additions for data field settings
2008-12-26 14:39:21 +0100 dr r265805 : updates
2008-12-19 16:31:39 +0100 dr r265734 : typo
2008-12-19 16:30:00 +0100 dr r265733 : add API for sequence of DP field subtotal functions
2008-12-19 16:29:43 +0100 dr r265732 : add API for sequence of DP field subtotal functions
2008-12-19 16:29:07 +0100 dr r265731 : add API for sequence of DP field subtotal functions
2008-12-18 18:07:58 +0100 dr r265710 : #i96758# try to cache row default formatting and apply it at row ranges instead of single rows
2008-12-18 16:00:25 +0100 dr r265698 : more additions to pivot import
2008-12-17 13:38:19 +0100 dr r265599 : do not assert HIDDEN orientation
2008-12-12 13:51:29 +0100 dr r265415 : minor typos
2008-12-12 10:15:04 +0100 dr r265394 : pivot cache import extended to XLSB, added creation of cache data for missing/external sheets
2008-12-04 13:16:16 +0100 dr r264837 : #i96860# remove old dumper files
2008-12-04 12:17:38 +0100 dr r264834 : #i96858# XTO broken, if textbox is empty but contains formatting
2008-12-04 12:16:38 +0100 dr r264833 : #i96858# XTO broken, if textbox is empty but contains formatting
2008-12-03 14:51:05 +0100 dr r264784 : #i10000# warnings
2008-12-03 14:32:46 +0100 dr r264778 : #i10000# warning
2008-12-03 11:28:38 +0100 dr r264758 : #i96758# ignore zero-sized objects
2008-12-03 10:09:34 +0100 dr r264748 : #i96758# change ::oox::Property(Set|Map) keys to sal_Int32 property identifiers, to save construction of property names
2008-12-01 16:09:02 +0100 dr r264615 : #i96758# headerdoc
2008-12-01 14:49:04 +0100 dr r264607 : #i96758# import performance of formatted documents
2008-11-26 17:08:15 +0100 dr r264424 : make it more simple
2008-11-26 16:31:41 +0100 dr r264419 : c:crossesAt is for crossing axis, not for own axis. This is different to BIFF
2008-11-26 13:55:55 +0100 dr r264382 : #i86346# import of MissingValueTreatment from XLSX
2008-11-26 12:49:38 +0100 dr r264370 : #i86346# import/export of MissingValueTreatment from/to XLS
2008-11-25 17:48:59 +0100 dr r264320 : update row height with single progress bar when using 'IsAdjustHeightEnabled' document property
2008-11-25 17:24:26 +0100 dr r264319 : #i96438# disable importing comment text until API is fixed
2008-11-25 17:11:30 +0100 dr r264318 : #i90124# set control tooltips, patch from npower
2008-11-25 15:09:28 +0100 dr r264309 : #i94028# #i94991# update drawing objects when changing row height
2008-11-24 15:21:35 +0100 dr r264224 : prevent ::rtl::OUString::copy assertion
2008-11-24 15:19:39 +0100 dr r264223 : #i95183# #158573# handle non-ascii characters in sheet names in OOXML import
2008-11-24 12:54:30 +0100 dr r264221 : #i94157# support ESC key to leave full-screen in page preview
2008-11-21 18:15:17 +0100 dr r264165 : #i90360# disable chart perspective if it is set to 0
2008-11-21 18:14:41 +0100 dr r264164 : #i90360# disable chart perspective if it is set to 0
2008-11-21 17:43:26 +0100 dr r264155 : #i96140# missing parenth
2008-11-21 17:36:35 +0100 dr r264154 : #i96438# first steps of note import
2008-11-20 15:15:03 +0100 dr r264059 : get rid of ContextWrapper
2008-11-18 11:39:52 +0100 dr r263755 : #i78476# moved to CWS dr67
Diffstat (limited to 'sc/source')
34 files changed, 1834 insertions, 12971 deletions
diff --git a/sc/source/core/data/dpdimsave.cxx b/sc/source/core/data/dpdimsave.cxx index 71c7bf273a98..7e1bc0389eaf 100644 --- a/sc/source/core/data/dpdimsave.cxx +++ b/sc/source/core/data/dpdimsave.cxx @@ -31,33 +31,25 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - - -// INCLUDE --------------------------------------------------------------- - #include "dpdimsave.hxx" #include "dpgroup.hxx" #include "dpobject.hxx" #include "document.hxx" +#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp> + #include <svtools/zforlist.hxx> #include <tools/debug.hxx> #include <rtl/math.hxx> #include <algorithm> -// ----------------------------------------------------------------------- +// ============================================================================ ScDPSaveGroupItem::ScDPSaveGroupItem( const String& rName ) : aGroupName( rName ) { } -ScDPSaveGroupItem::ScDPSaveGroupItem( const ScDPSaveGroupItem& r ) : - aGroupName( r.aGroupName ), - aElements( r.aElements ) -{ -} - ScDPSaveGroupItem::~ScDPSaveGroupItem() { } @@ -138,7 +130,7 @@ void ScDPSaveGroupItem::AddToData( ScDPGroupDimension& rDataDim, SvNumberFormatt rDataDim.AddItem( aGroup ); } -// ----------------------------------------------------------------------- +// ============================================================================ ScDPSaveGroupDimension::ScDPSaveGroupDimension( const String& rSource, const String& rName ) : aSourceDim( rSource ), @@ -147,12 +139,11 @@ ScDPSaveGroupDimension::ScDPSaveGroupDimension( const String& rSource, const Str { } -ScDPSaveGroupDimension::ScDPSaveGroupDimension( const ScDPSaveGroupDimension& r ) : - aSourceDim( r.aSourceDim ), - aGroupDimName( r.aGroupDimName ), - aGroups( r.aGroups ), - aDateInfo( r.aDateInfo ), - nDatePart( r.nDatePart ) +ScDPSaveGroupDimension::ScDPSaveGroupDimension( const String& rSource, const String& rName, const ScDPNumGroupInfo& rDateInfo, sal_Int32 nPart ) : + aSourceDim( rSource ), + aGroupDimName( rName ), + aDateInfo( rDateInfo ), + nDatePart( nPart ) { } @@ -307,7 +298,7 @@ void ScDPSaveGroupDimension::AddToData( ScDPGroupTableData& rData ) const } } -// ----------------------------------------------------------------------- +// ============================================================================ ScDPSaveNumGroupDimension::ScDPSaveNumGroupDimension( const String& rName, const ScDPNumGroupInfo& rInfo ) : aDimensionName( rName ), @@ -316,11 +307,10 @@ ScDPSaveNumGroupDimension::ScDPSaveNumGroupDimension( const String& rName, const { } -ScDPSaveNumGroupDimension::ScDPSaveNumGroupDimension( const ScDPSaveNumGroupDimension& r ) : - aDimensionName( r.aDimensionName ), - aGroupInfo( r.aGroupInfo ), - aDateInfo( r.aDateInfo ), - nDatePart( r.nDatePart ) +ScDPSaveNumGroupDimension::ScDPSaveNumGroupDimension( const String& rName, const ScDPNumGroupInfo& rDateInfo, sal_Int32 nPart ) : + aDimensionName( rName ), + aDateInfo( rDateInfo ), + nDatePart( nPart ) { } @@ -352,15 +342,29 @@ void ScDPSaveNumGroupDimension::SetDateInfo( const ScDPNumGroupInfo& rInfo, sal_ nDatePart = nPart; } -// ----------------------------------------------------------------------- +// ============================================================================ -ScDPDimensionSaveData::ScDPDimensionSaveData() +namespace { + +struct ScDPSaveGroupDimNameFunc { -} + String maDimName; + inline explicit ScDPSaveGroupDimNameFunc( const String& rDimName ) : maDimName( rDimName ) {} + inline bool operator()( const ScDPSaveGroupDimension& rGroupDim ) const { return rGroupDim.GetGroupDimName() == maDimName; } +}; + +struct ScDPSaveGroupSourceNameFunc +{ + String maSrcDimName; + inline explicit ScDPSaveGroupSourceNameFunc( const String& rSrcDimName ) : maSrcDimName( rSrcDimName ) {} + inline bool operator()( const ScDPSaveGroupDimension& rGroupDim ) const { return rGroupDim.GetSourceDimName() == maSrcDimName; } +}; + +} // namespace -ScDPDimensionSaveData::ScDPDimensionSaveData( const ScDPDimensionSaveData& r ) : - aGroupDimensions( r.aGroupDimensions ), - aNumGroupDimensions( r.aNumGroupDimensions ) +// ---------------------------------------------------------------------------- + +ScDPDimensionSaveData::ScDPDimensionSaveData() { } @@ -373,40 +377,52 @@ bool ScDPDimensionSaveData::operator==( const ScDPDimensionSaveData& ) const return false; } -void ScDPDimensionSaveData::AddGroupDimension( const ScDPSaveGroupDimension& rGroup ) +void ScDPDimensionSaveData::AddGroupDimension( const ScDPSaveGroupDimension& rGroupDim ) { - aGroupDimensions.push_back( rGroup ); + DBG_ASSERT( ::std::find_if( maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupDimNameFunc( rGroupDim.GetGroupDimName() ) ) == maGroupDims.end(), + "ScDPDimensionSaveData::AddGroupDimension - group dimension exists already" ); + // ReplaceGroupDimension() adds new or replaces existing + ReplaceGroupDimension( rGroupDim ); } -void ScDPDimensionSaveData::AddNumGroupDimension( const ScDPSaveNumGroupDimension& rGroup ) +void ScDPDimensionSaveData::ReplaceGroupDimension( const ScDPSaveGroupDimension& rGroupDim ) { - aNumGroupDimensions.push_back( rGroup ); + ScDPSaveGroupDimVec::iterator aIt = ::std::find_if( + maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupDimNameFunc( rGroupDim.GetGroupDimName() ) ); + if( aIt == maGroupDims.end() ) + maGroupDims.push_back( rGroupDim ); + else + *aIt = rGroupDim; } -void ScDPDimensionSaveData::RemoveGroupDimension( const String& rDimensionName ) +void ScDPDimensionSaveData::RemoveGroupDimension( const String& rGroupDimName ) { - for ( ScDPSaveGroupDimensionVec::iterator aIter(aGroupDimensions.begin()); - aIter != aGroupDimensions.end(); aIter++ ) - { - if ( aIter->GetGroupDimName() == rDimensionName ) //! ignore case - { - aGroupDimensions.erase( aIter ); // found -> remove - return; // don't have to look further - } - } + ScDPSaveGroupDimVec::iterator aIt = ::std::find_if( + maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupDimNameFunc( rGroupDimName ) ); + if( aIt != maGroupDims.end() ) + maGroupDims.erase( aIt ); } -void ScDPDimensionSaveData::RemoveNumGroupDimension( const String& rDimensionName ) +void ScDPDimensionSaveData::AddNumGroupDimension( const ScDPSaveNumGroupDimension& rGroupDim ) { - for ( ScDPSaveNumGroupDimensionVec::iterator aIter(aNumGroupDimensions.begin()); - aIter != aNumGroupDimensions.end(); aIter++ ) - { - if ( aIter->GetDimensionName() == rDimensionName ) //! ignore case - { - aNumGroupDimensions.erase( aIter ); // found -> remove - return; // don't have to look further - } - } + DBG_ASSERT( maNumGroupDims.count( rGroupDim.GetDimensionName() ) == 0, + "ScDPDimensionSaveData::AddNumGroupDimension - numeric group dimension exists already" ); + // ReplaceNumGroupDimension() adds new or replaces existing + ReplaceNumGroupDimension( rGroupDim ); +} + +void ScDPDimensionSaveData::ReplaceNumGroupDimension( const ScDPSaveNumGroupDimension& rGroupDim ) +{ + ScDPSaveNumGroupDimMap::iterator aIt = maNumGroupDims.find( rGroupDim.GetDimensionName() ); + if( aIt == maNumGroupDims.end() ) + maNumGroupDims.insert( ScDPSaveNumGroupDimMap::value_type( rGroupDim.GetDimensionName(), rGroupDim ) ); + else + aIt->second = rGroupDim; +} + +void ScDPDimensionSaveData::RemoveNumGroupDimension( const String& rGroupDimName ) +{ + maNumGroupDims.erase( rGroupDimName ); } void ScDPDimensionSaveData::WriteToData( ScDPGroupTableData& rData ) const @@ -414,92 +430,89 @@ void ScDPDimensionSaveData::WriteToData( ScDPGroupTableData& rData ) const // rData is assumed to be empty // AddToData also handles date grouping - for ( ScDPSaveGroupDimensionVec::const_iterator aIter(aGroupDimensions.begin()); - aIter != aGroupDimensions.end(); aIter++ ) - aIter->AddToData( rData ); + for( ScDPSaveGroupDimVec::const_iterator aIt = maGroupDims.begin(), aEnd = maGroupDims.end(); aIt != aEnd; ++aIt ) + aIt->AddToData( rData ); - for ( ScDPSaveNumGroupDimensionVec::const_iterator aNumIter(aNumGroupDimensions.begin()); - aNumIter != aNumGroupDimensions.end(); aNumIter++ ) - aNumIter->AddToData( rData ); + for( ScDPSaveNumGroupDimMap::const_iterator aIt = maNumGroupDims.begin(), aEnd = maNumGroupDims.end(); aIt != aEnd; ++aIt ) + aIt->second.AddToData( rData ); } -ScDPSaveGroupDimension* ScDPDimensionSaveData::GetGroupDimAccForBase( const String& rBaseName ) +const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetGroupDimForBase( const String& rBaseDimName ) const { - String aOrigBase( rBaseName ); // the original base dim in the case of nested group dims - - for ( ScDPSaveGroupDimensionVec::iterator aIter(aGroupDimensions.begin()); - aIter != aGroupDimensions.end(); aIter++ ) - { - if ( aIter->GetSourceDimName() == aOrigBase ) //! ignore case - { - return &*aIter; // return the first one directly - it's the immediate derivative - } - else if ( aIter->GetGroupDimName() == aOrigBase ) - { - // found the definition of rBaseName in the array - look for the next occurrence - // of this definitions's base + return const_cast< ScDPDimensionSaveData* >( this )->GetGroupDimAccForBase( rBaseDimName ); +} - aOrigBase = aIter->GetSourceDimName(); // and continue the loop - } - } +const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNamedGroupDim( const String& rGroupDimName ) const +{ + return const_cast< ScDPDimensionSaveData* >( this )->GetNamedGroupDimAcc( rGroupDimName ); +} - return NULL; // none +const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetFirstNamedGroupDim( const String& rBaseDimName ) const +{ + return const_cast< ScDPDimensionSaveData* >( this )->GetFirstNamedGroupDimAcc( rBaseDimName ); } -const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetGroupDimForBase( const String& rBaseName ) const +const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNextNamedGroupDim( const String& rGroupDimName ) const { - return const_cast< ScDPDimensionSaveData* >( this )->GetGroupDimAccForBase( rBaseName ); + return const_cast< ScDPDimensionSaveData* >( this )->GetNextNamedGroupDimAcc( rGroupDimName ); } -const ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNamedGroupDim( const String& rGroupDim ) const +const ScDPSaveNumGroupDimension* ScDPDimensionSaveData::GetNumGroupDim( const String& rGroupDimName ) const { - return const_cast< ScDPDimensionSaveData* >( this )->GetNamedGroupDimAcc( rGroupDim ); + return const_cast< ScDPDimensionSaveData* >( this )->GetNumGroupDimAcc( rGroupDimName ); } -const ScDPSaveNumGroupDimension* ScDPDimensionSaveData::GetNumGroupDim( const String& rName ) const +ScDPSaveGroupDimension* ScDPDimensionSaveData::GetGroupDimAccForBase( const String& rBaseDimName ) { - return const_cast< ScDPDimensionSaveData* >( this )->GetNumGroupDimAcc( rName ); + ScDPSaveGroupDimension* pGroupDim = GetFirstNamedGroupDimAcc( rBaseDimName ); + return pGroupDim ? pGroupDim : GetNextNamedGroupDimAcc( rBaseDimName ); } -ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNamedGroupDimAcc( const String& rGroupDim ) +ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNamedGroupDimAcc( const String& rGroupDimName ) { - for ( ScDPSaveGroupDimensionVec::iterator aIter(aGroupDimensions.begin()); - aIter != aGroupDimensions.end(); aIter++ ) - if ( aIter->GetGroupDimName() == rGroupDim ) //! ignore case - return &*aIter; // there should be only one - use it directly + ScDPSaveGroupDimVec::iterator aIt = ::std::find_if( + maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupDimNameFunc( rGroupDimName ) ); + return (aIt == maGroupDims.end()) ? 0 : &*aIt; +} - return NULL; // none +ScDPSaveGroupDimension* ScDPDimensionSaveData::GetFirstNamedGroupDimAcc( const String& rBaseDimName ) +{ + ScDPSaveGroupDimVec::iterator aIt = ::std::find_if( + maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupSourceNameFunc( rBaseDimName ) ); + return (aIt == maGroupDims.end()) ? 0 : &*aIt; } -ScDPSaveNumGroupDimension* ScDPDimensionSaveData::GetNumGroupDimAcc( const String& rName ) +ScDPSaveGroupDimension* ScDPDimensionSaveData::GetNextNamedGroupDimAcc( const String& rGroupDimName ) { - for ( ScDPSaveNumGroupDimensionVec::iterator aIter(aNumGroupDimensions.begin()); - aIter != aNumGroupDimensions.end(); aIter++ ) - if ( aIter->GetDimensionName() == rName ) //! ignore case - return &*aIter; // there should be only one - use it directly + // find the group dimension with the passed name + ScDPSaveGroupDimVec::iterator aIt = ::std::find_if( + maGroupDims.begin(), maGroupDims.end(), ScDPSaveGroupDimNameFunc( rGroupDimName ) ); + // find next group dimension based on the same source dimension name + if( aIt != maGroupDims.end() ) + aIt = ::std::find_if( aIt + 1, maGroupDims.end(), ScDPSaveGroupSourceNameFunc( aIt->GetSourceDimName() ) ); + return (aIt == maGroupDims.end()) ? 0 : &*aIt; +} - return NULL; // none +ScDPSaveNumGroupDimension* ScDPDimensionSaveData::GetNumGroupDimAcc( const String& rGroupDimName ) +{ + ScDPSaveNumGroupDimMap::iterator aIt = maNumGroupDims.find( rGroupDimName ); + return (aIt == maNumGroupDims.end()) ? 0 : &aIt->second; } bool ScDPDimensionSaveData::HasGroupDimensions() const { - return !aGroupDimensions.empty() || !aNumGroupDimensions.empty(); + return !maGroupDims.empty() || !maNumGroupDims.empty(); } sal_Int32 ScDPDimensionSaveData::CollectDateParts( const String& rBaseDimName ) const { sal_Int32 nParts = 0; - const ScDPSaveNumGroupDimension* pNumDim = GetNumGroupDim( rBaseDimName ); - if ( pNumDim ) + // start with part of numeric group + if( const ScDPSaveNumGroupDimension* pNumDim = GetNumGroupDim( rBaseDimName ) ) nParts |= pNumDim->GetDatePart(); - - for ( ScDPSaveGroupDimensionVec::const_iterator aIter(aGroupDimensions.begin()); - aIter != aGroupDimensions.end(); aIter++ ) - if ( aIter->GetSourceDimName() == rBaseDimName ) //! ignore case - { - nParts |= aIter->GetDatePart(); - // continue loop, collect parts from all matching group dimensions - } + // collect parts from all matching group dimensions + for( const ScDPSaveGroupDimension* pGroupDim = GetFirstNamedGroupDim( rBaseDimName ); pGroupDim; pGroupDim = GetNextNamedGroupDim( pGroupDim->GetGroupDimName() ) ) + nParts |= pGroupDim->GetDatePart(); return nParts; } @@ -523,9 +536,8 @@ String ScDPDimensionSaveData::CreateGroupDimName( const String& rSourceName, bool bExists = false; // look for existing group dimensions - for ( ScDPSaveGroupDimensionVec::const_iterator aIter(aGroupDimensions.begin()); - aIter != aGroupDimensions.end() && !bExists; aIter++ ) - if ( aIter->GetGroupDimName() == aDimName ) //! ignore case + for( ScDPSaveGroupDimVec::const_iterator aIt = maGroupDims.begin(), aEnd = maGroupDims.end(); (aIt != aEnd) && !bExists; ++aIt ) + if( aIt->GetGroupDimName() == aDimName ) //! ignore case bExists = true; // look for base dimensions that happen to have that name @@ -552,3 +564,24 @@ String ScDPDimensionSaveData::CreateGroupDimName( const String& rSourceName, return EMPTY_STRING; } +String ScDPDimensionSaveData::CreateDateGroupDimName( sal_Int32 nDatePart, const ScDPObject& rObject, bool bAllowSource, const ::std::vector< String >* pDeletedNames ) +{ + using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy; + String aPartName; + switch( nDatePart ) + { + //! use translated strings from globstr.src + case SECONDS: aPartName = String::CreateFromAscii( "Seconds" ); break; + case MINUTES: aPartName = String::CreateFromAscii( "Minutes" ); break; + case HOURS: aPartName = String::CreateFromAscii( "Hours" ); break; + case DAYS: aPartName = String::CreateFromAscii( "Days" ); break; + case MONTHS: aPartName = String::CreateFromAscii( "Months" ); break; + case QUARTERS: aPartName = String::CreateFromAscii( "Quarters" ); break; + case YEARS: aPartName = String::CreateFromAscii( "Years" ); break; + } + DBG_ASSERT( aPartName.Len() > 0, "ScDPDimensionSaveData::CreateDateGroupDimName - invalid date part" ); + return CreateGroupDimName( aPartName, rObject, bAllowSource, pDeletedNames ); +} + +// ============================================================================ + diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index 007ecb24af33..f4180312ce0d 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -832,8 +832,8 @@ ScDPSaveDimension* ScDPSaveData::GetNewDimensionByName(const String& rName) ScDPSaveDimension* ScDPSaveData::GetDataLayoutDimension() { - long nCount = aDimList.Count(); - for (long i=0; i<nCount; i++) + ULONG nCount = aDimList.Count(); + for (ULONG i=0; i<nCount; i++) { ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i); if ( pDim->IsDataLayout() ) diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index c6a48a8f1925..83c90a4bd946 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -288,6 +288,10 @@ void ScDPSource::SetOrientation(long nColumn, USHORT nNew) case sheet::DataPilotFieldOrientation_PAGE: nPageDims[nPageDimCount++] = nColumn; break; + case sheet::DataPilotFieldOrientation_HIDDEN: + /* Do not assert HIDDEN as it occurs e.g. while using the + csss.XDataPilotTables.createDataPilotDescriptor() function. */ + break; default: DBG_ERROR( "ScDPSource::SetOrientation: unexpected orientation" ); break; @@ -1974,13 +1978,16 @@ public: BOOL ScDPGlobalMembersOrder::operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 ) const { - ScDPMembers* pMembers = rLevel.GetMembersObject(); - ScDPMember* pMember1 = pMembers->getByIndex(nIndex1); - ScDPMember* pMember2 = pMembers->getByIndex(nIndex2); - - sal_Int32 nCompare = pMember1->Compare( *pMember2 ); - - return bAscending ? ( nCompare < 0 ) : ( nCompare > 0 ); + sal_Int32 nCompare = 0; + // seems that some ::std::sort() implementations pass the same index twice + if( nIndex1 != nIndex2 ) + { + ScDPMembers* pMembers = rLevel.GetMembersObject(); + ScDPMember* pMember1 = pMembers->getByIndex(nIndex1); + ScDPMember* pMember2 = pMembers->getByIndex(nIndex2); + nCompare = pMember1->Compare( *pMember2 ); + } + return bAscending ? (nCompare < 0) : (nCompare > 0); } // ----------------------------------------------------------------------- @@ -2037,7 +2044,7 @@ void ScDPLevel::EvaluateSortOrder() ScDPMembers* pLocalMembers = GetMembersObject(); long nCount = pLocalMembers->getCount(); - DBG_ASSERT( aGlobalOrder.empty(), "sort twice?" ); +// DBG_ASSERT( aGlobalOrder.empty(), "sort twice?" ); aGlobalOrder.resize( nCount ); for (long nPos=0; nPos<nCount; nPos++) aGlobalOrder[nPos] = nPos; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 6c1ecf660275..cc076dec2e86 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1971,7 +1971,7 @@ BOOL ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, USHORT nNewHeig long nNewPix = (long) ( nNewHeight * nPPTY ); - BOOL bSingle = FALSE; + BOOL bSingle = FALSE; // TRUE = process every row for its own ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer(); if (pDrawLayer) if (pDrawLayer->HasObjectsInRows( nTab, nStartRow, nEndRow )) @@ -1997,7 +1997,23 @@ BOOL ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, USHORT nNewHeig if (*aIter != nNewHeight) bChanged = (nNewPix != (long) (*aIter * nPPTY)); } while (!bChanged && aIter.NextRange()); - pRowHeight->SetValue( nStartRow, nEndRow, nNewHeight); + + /* #i94028# #i94991# If drawing objects are involved, each row + has to be changed for its own, because each call to + ScDrawLayer::HeightChanged expects correct row heights + above passed row in the document. Cannot use array iterator + because array changes in every cycle. */ + if( pDrawLayer ) + { + for( SCROW nRow = nStartRow; nRow <= nEndRow ; ++nRow ) + { + pDrawLayer->HeightChanged( nTab, nRow, + ((long) nNewHeight) - ((long) pRowHeight->GetValue( nRow ))); + pRowHeight->SetValue( nRow, nNewHeight ); + } + } + else + pRowHeight->SetValue( nStartRow, nEndRow, nNewHeight); } else { diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 1eb81b689ae7..8b13374fe501 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -729,7 +729,7 @@ lcl_ScRange_Parse_XL_A1( ScRange& r, const uno::Sequence< const sheet::ExternalLinkInfo > * pExternalLinks ) { const sal_Unicode* tmp1, *tmp2; - String aExternDocName, aStartTabName, aEndTabName; + String aExternDocName, aStartTabName, aEndTabName; // for external link table USHORT nFlags = SCA_VALID | SCA_VALID_TAB, nFlags2 = SCA_VALID_TAB; #if 0 diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 78b63c8c4622..8d69b86770b1 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -2938,262 +2938,6 @@ void lcl_EnsureSorting( ScStrCollection& rCollection ) } } - -BOOL ScChangeTrack::Load( SvStream& rStrm, USHORT nVer ) -{ - BOOL bOk = TRUE; - SetLoadSave( TRUE ); - - ScReadHeader aGlobalHdr( rStrm ); - - BYTE n8; - UINT16 n16; - UINT32 n32; - - rStrm >> n16; nLoadedFileFormatVersion = n16; - if ( (nLoadedFileFormatVersion & 0xFF00) > (SC_CHGTRACK_FILEFORMAT & 0xFF00) ) - { // inkompatible neuere Version - Clear(); - rStrm.SetError( SCWARN_IMPORT_INFOLOST ); - return FALSE; - } - - aUserCollection.Load( rStrm ); - - ULONG nCount, nLastAction, nGeneratedCount; - rStrm >> n32; nCount = n32; - rStrm >> n32; nActionMax = n32; - rStrm >> n32; nLastAction = n32; - - rStrm >> n32; nGeneratedCount = n32; - - // GeneratedDelContents laden - { - ScMultipleReadHeader aHdr( rStrm ); - for ( ULONG j = 0; j < nGeneratedCount && bOk; j++ ) - { - ScChangeActionContent* pAct; - - aHdr.StartEntry(); - - ScChangeActionType eType; - rStrm >> n8; eType = (ScChangeActionType) n8; - - switch ( eType ) - { - case SC_CAT_CONTENT : - pAct = new ScChangeActionContent( rStrm, aHdr, pDoc, nVer, this ); - break; - default: - DBG_ERROR( "ScChangeTrack::Load: unknown GeneratedType" ); - pAct = NULL; - bOk = FALSE; - } - - aHdr.EndEntry(); - - if ( pAct ) - { - pAct->SetType( eType ); - if ( pFirstGeneratedDelContent ) - pFirstGeneratedDelContent->pPrev = pAct; - pAct->pNext = pFirstGeneratedDelContent; - pFirstGeneratedDelContent = pAct; - aGeneratedTable.Insert( pAct->GetActionNumber(), pAct ); - } - } - rStrm >> n32; nGeneratedMin = n32; - } - - if ( bOk ) - bOk = ( nGeneratedCount == aGeneratedTable.Count() ); - DBG_ASSERT( bOk, "ScChangeTrack::Load: Generated failed" ); - - - // erste Runde: Actions laden - { - ScMultipleReadHeader aHdr( rStrm ); - for ( ULONG j = 0; j < nCount && bOk; j++ ) - { - ScChangeAction* pAct; - - aHdr.StartEntry(); - - USHORT nUserIndex; - rStrm >> n16; nUserIndex = n16; - - ScChangeActionType eType; - rStrm >> n8; eType = (ScChangeActionType) n8; - - switch ( eType ) - { - case SC_CAT_INSERT_COLS : - case SC_CAT_INSERT_ROWS : - case SC_CAT_INSERT_TABS : - pAct = new ScChangeActionIns( rStrm, aHdr, this ); - break; - case SC_CAT_DELETE_COLS : - case SC_CAT_DELETE_ROWS : - case SC_CAT_DELETE_TABS : - pAct = new ScChangeActionDel( rStrm, aHdr, pDoc, nVer, this ); - break; - case SC_CAT_MOVE : - pAct = new ScChangeActionMove( rStrm, aHdr, this ); - break; - case SC_CAT_CONTENT : - pAct = new ScChangeActionContent( rStrm, aHdr, pDoc, nVer, this ); - break; - case SC_CAT_REJECT : - pAct = new ScChangeActionReject( rStrm, aHdr, this ); - break; - default: - DBG_ERROR( "ScChangeTrack::Load: unknown ScChangeActionType" ); - pAct = NULL; - bOk = FALSE; - } - - aHdr.EndEntry(); - - if ( pAct ) - { - pAct->SetType( eType ); - if ( nUserIndex != 0xffff ) - { - StrData* pUser = (StrData*) aUserCollection.At( nUserIndex ); - if ( pUser ) - pAct->SetUser( pUser->GetString() ); - } - AppendLoaded( pAct ); - } - } - } - - if ( pLast ) - nMarkLastSaved = pLast->GetActionNumber(); - - if ( bOk ) - bOk = ( nMarkLastSaved == nLastAction && nCount == aTable.Count() ); - DBG_ASSERT( bOk, "ScChangeTrack::Load: failed" ); - - // zweite Runde: Links laden und alles verpointern - { - ScMultipleReadHeader aHdr( rStrm ); - for ( ScChangeAction* p = GetFirst(); p && bOk; p = p->GetNext() ) - { - aHdr.StartEntry(); - bOk = p->LoadLinks( rStrm, this ); - aHdr.EndEntry(); - } - } - - SetLoadSave( FALSE ); - - // versions between 583 and 633 had the sorting wrong -> correct (after loading the actions) - lcl_EnsureSorting( aUserCollection ); - - // den aktuellen User erst einfuegen, wenn die Actions bereits ihre User haben - SetUser( aUser ); - - if ( !bOk ) - { - Clear(); // eindeutiger Zustand - rStrm.SetError( SCWARN_IMPORT_INFOLOST ); - } - - return bOk; -} - - -BOOL ScChangeTrack::Store( SvStream& rStrm ) -{ - BOOL bOk = TRUE; - SetLoadSave( TRUE ); - - ScWriteHeader aGlobalHdr( rStrm ); - - rStrm << (UINT16) SC_CHGTRACK_FILEFORMAT; - - aUserCollection.Store( rStrm ); - - ULONG nCount = aTable.Count(); - ULONG nLastAction = ( pLast ? pLast->GetActionNumber() : 0 ); - ULONG nGeneratedCount = aGeneratedTable.Count(); - rStrm << (UINT32) nCount << (UINT32) nActionMax << (UINT32) nLastAction; - rStrm << (UINT32) nGeneratedCount; - - // GeneratedDelContents speichern - ULONG nSave = 0; - { - ScMultipleWriteHeader aHdr( rStrm ); - ULONG nNewGeneratedMin = SC_CHGTRACK_GENERATED_START; - for ( ScChangeAction* p = pFirstGeneratedDelContent; p && bOk; - p = p->GetNext() ) - { - ++nSave; - aHdr.StartEntry(); - rStrm << (BYTE) p->GetType(); - bOk = p->Store( rStrm, aHdr ); - aHdr.EndEntry(); - ULONG nAct = p->GetActionNumber(); - if ( nNewGeneratedMin > nAct ) - nNewGeneratedMin = nAct; - } - nGeneratedMin = nNewGeneratedMin; // evtl. unbenutzten Bereich freigeben - rStrm << (UINT32) nGeneratedMin; - } - - if ( bOk ) - bOk = ( nGeneratedCount == nSave ); - DBG_ASSERT( bOk, "ScChangeTrack::Store: failed" ); - - // erste Runde: Actions speichern - nSave = 0; - { - ScMultipleWriteHeader aHdr( rStrm ); - StrData* pUserSearch = new StrData( aUser ); - USHORT nUserIndex; - for ( ScChangeAction* p = GetFirst(); p && bOk; p = p->GetNext() ) - { - ++nSave; - aHdr.StartEntry(); - - pUserSearch->SetString( p->GetUser() ); - if ( aUserCollection.Search( pUserSearch, nUserIndex ) ) - rStrm << (UINT16) nUserIndex; - else - rStrm << (UINT16) 0xffff; - rStrm << (BYTE) p->GetType(); - - bOk = p->Store( rStrm, aHdr ); - - aHdr.EndEntry(); - } - delete pUserSearch; - } - - if ( pLast ) - nMarkLastSaved = pLast->GetActionNumber(); - - if ( bOk ) - bOk = ( nCount == nSave ); - DBG_ASSERT( bOk, "ScChangeTrack::Store: failed" ); - - // zweite Runde: Links speichern - { - ScMultipleWriteHeader aHdr( rStrm ); - for ( ScChangeAction* p = GetFirst(); p && bOk; p = p->GetNext() ) - { - aHdr.StartEntry(); - bOk = p->StoreLinks( rStrm ); - aHdr.EndEntry(); - } - } - - SetLoadSave( FALSE ); - return bOk; -} - - void ScChangeTrack::MasterLinks( ScChangeAction* pAppend ) { ScChangeActionType eType = pAppend->GetType(); diff --git a/sc/source/filter/excel/biffdump.cxx b/sc/source/filter/excel/biffdump.cxx deleted file mode 100644 index c3478cf8cb50..000000000000 --- a/sc/source/filter/excel/biffdump.cxx +++ /dev/null @@ -1,9864 +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: biffdump.cxx,v $ - * $Revision: 1.91 $ - * - * 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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sc.hxx" -#include "biffdump.hxx" - -#if EXC_INCL_DUMPER -#include <tools/stream.hxx> -#include <sfx2/docfile.hxx> -#include <sfx2/objsh.hxx> -#include <sot/storinfo.hxx> - -#include <string.h> -#include <stdlib.h> -#include <stdio.h> - -#include <rtl/math.hxx> -#include "document.hxx" -#include "global.hxx" -#include "fprogressbar.hxx" -#include "xlpivot.hxx" -#include "xicontent.hxx" -#include "imp_op.hxx" - -#define GETSTR(s) ByteString( s, RTL_TEXTENCODING_MS_1252 ) - -static const sal_Char* __pHexPrefix = "0x"; -static const sal_Char* __pBinPrefix = "0b"; -static const sal_Char* pU = "UNKNOWN "; - -const sal_Char* Biff8RecDumper::pLevelPreString = " "; -const sal_Char* Biff8RecDumper::pLevelPreStringNT = pLevelPreString + strlen( pLevelPreString ); -UINT32 Biff8RecDumper::nInstances = 0; -sal_Char* Biff8RecDumper::pBlankLine = NULL; -const UINT16 Biff8RecDumper::nLenBlankLine = 255; -const UINT16 Biff8RecDumper::nRecCnt = 0x2020; -UINT8* Biff8RecDumper::pCharType = NULL; -UINT8* Biff8RecDumper::pCharVal = NULL; - -static const UINT16 nLevelInc = 1; - -static UINT16 nXFCount = 0; - -static UINT16 nSXLISize[2] = {0, 0}; // array size for SXLI records [rows/cols] -static UINT16 nSXLIIndex = 0; // current index for SXLI records - -// ============================================================================ - -namespace { - -// decimal -------------------------------------------------------------------- - -inline void lclAppendDec( ByteString& rStr, sal_uInt8 nData ) -{ - rStr.Append( ByteString::CreateFromInt32( nData ) ); -} - -inline void lclAppendDec( ByteString& rStr, sal_Int8 nData ) -{ - rStr.Append( ByteString::CreateFromInt32( nData ) ); -} - -inline void lclAppendDec( ByteString& rStr, sal_uInt16 nData ) -{ - rStr.Append( ByteString::CreateFromInt32( nData ) ); -} - -inline void lclAppendDec( ByteString& rStr, sal_Int16 nData ) -{ - rStr.Append( ByteString::CreateFromInt32( nData ) ); -} - -inline void lclAppendDec( ByteString& rStr, sal_uInt32 nData ) -{ - rStr.Append( ByteString::CreateFromInt64( nData ) ); -} - -inline void lclAppendDec( ByteString& rStr, sal_Int32 nData ) -{ - rStr.Append( ByteString::CreateFromInt32( nData ) ); -} - -inline void lclAppendDec( ByteString& rStr, float fData ) -{ - rStr.Append( ByteString( ::rtl::math::doubleToString( fData, rtl_math_StringFormat_G, 15, '.', true ) ) ); -} - -inline void lclAppendDec( ByteString& rStr, double fData ) -{ - rStr.Append( ByteString( ::rtl::math::doubleToString( fData, rtl_math_StringFormat_G, 15, '.', true ) ) ); -} - -// hexadecimal ---------------------------------------------------------------- - -void lclAppendHex( ByteString& rStr, sal_uInt8 nData, bool bPrefix = true ) -{ - static const sal_Char spcHexDigits[] = "0123456789ABCDEF"; - static const ByteString saPrefix( "0x" ); - - if( bPrefix ) - rStr.Append( saPrefix ); - rStr.Append( spcHexDigits[ (nData >> 4) & 0x0F ] ).Append( spcHexDigits[ nData & 0x0F ] ); -} - -inline void lclAppendHex( ByteString& rStr, sal_Int8 nData, bool bPrefix = true ) -{ - lclAppendHex( rStr, static_cast< sal_uInt8 >( nData ), bPrefix ); -} - -void lclAppendHex( ByteString& rStr, sal_uInt16 nData, bool bPrefix = true ) -{ - lclAppendHex( rStr, static_cast< sal_uInt8 >( nData >> 8 ), bPrefix ); - lclAppendHex( rStr, static_cast< sal_uInt8 >( nData ), false ); -} - -inline void lclAppendHex( ByteString& rStr, sal_Int16 nData, bool bPrefix = true ) -{ - lclAppendHex( rStr, static_cast< sal_uInt16 >( nData ), bPrefix ); -} - -void lclAppendHex( ByteString& rStr, sal_uInt32 nData, bool bPrefix = true ) -{ - lclAppendHex( rStr, static_cast< sal_uInt16 >( nData >> 16 ), bPrefix ); - lclAppendHex( rStr, static_cast< sal_uInt16 >( nData ), false ); -} - -inline void lclAppendHex( ByteString& rStr, sal_Int32 nData, bool bPrefix = true ) -{ - lclAppendHex( rStr, static_cast< sal_uInt32 >( nData ), bPrefix ); -} - -inline void lclAppendHex( ByteString& rStr, double fData, bool bPrefix = true ) -{ - const sal_uInt32* pnData = reinterpret_cast< const sal_uInt32* >( &fData ); - lclAppendHex( rStr, pnData[ 0 ], bPrefix ); - lclAppendHex( rStr, pnData[ 1 ], false ); -} - -// others --------------------------------------------------------------------- - -void lclAppendGuid( ByteString& rStr, const XclGuid& rGuid ) -{ - lclAppendHex( rStr, SVBT32ToUInt32( rGuid.mpnData ), false ); - rStr.Append( '-' ); - lclAppendHex( rStr, SVBT16ToShort( rGuid.mpnData + 4 ), false ); - rStr.Append( '-' ); - lclAppendHex( rStr, SVBT16ToShort( rGuid.mpnData + 6 ), false ); - rStr.Append( '-' ); - lclAppendHex( rStr, rGuid.mpnData[ 8 ], false ); - lclAppendHex( rStr, rGuid.mpnData[ 9 ], false ); - rStr.Append( '-' ); - lclAppendHex( rStr, rGuid.mpnData[ 10 ], false ); - lclAppendHex( rStr, rGuid.mpnData[ 11 ], false ); - lclAppendHex( rStr, rGuid.mpnData[ 12 ], false ); - lclAppendHex( rStr, rGuid.mpnData[ 13 ], false ); - lclAppendHex( rStr, rGuid.mpnData[ 14 ], false ); - lclAppendHex( rStr, rGuid.mpnData[ 15 ], false ); -} - -} // namespace - -// ============================================================================ - -static void __AddHexNibble( ByteString& r, UINT8 nVal ) -{ - const sal_Char pH[] = "0123456789ABCDEF"; - - nVal &= 0x0F; - - r += pH[ nVal ]; -} - - -static void __AddPureHex( ByteString& r, UINT8 nVal ) -{ - __AddHexNibble( r, nVal >> 4 ); - __AddHexNibble( r, nVal ); -} - - -static void __AddHex( ByteString& r, UINT8 nVal ) -{ - r += __pHexPrefix; - __AddHexNibble( r, nVal >> 4 ); - __AddHexNibble( r, nVal ); -} - - -static void __AddPureHex( ByteString& r, UINT16 nVal ) -{ - __AddHexNibble( r, ( UINT8 ) ( nVal >> 12 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 8 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 4 ) ); - __AddHexNibble( r, ( UINT8 ) nVal ); -} - - -static void __AddHex( ByteString& r, UINT16 nVal ) -{ - r += __pHexPrefix; - __AddHexNibble( r, ( UINT8 ) ( nVal >> 12 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 8 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 4 ) ); - __AddHexNibble( r, ( UINT8 ) nVal ); -} - - -static void __AddPureHex( ByteString& r, UINT32 nVal ) -{ - __AddHexNibble( r, ( UINT8 ) ( nVal >> 28 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 24 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 20 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 16 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 12 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 8 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 4 ) ); - __AddHexNibble( r, ( UINT8 ) nVal ); -} - - -static void __AddHex( ByteString& r, UINT32 nVal ) -{ - r += __pHexPrefix; - __AddHexNibble( r, ( UINT8 ) ( nVal >> 28 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 24 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 20 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 16 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 12 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 8 ) ); - __AddHexNibble( r, ( UINT8 ) ( nVal >> 4 ) ); - __AddHexNibble( r, ( UINT8 ) nVal ); -} - - -static void __AddHex( ByteString& r, INT32 nVal ) -{ - __AddHex( r, (UINT32) nVal ); -} - - -static void __AddPureBinNibble( ByteString& r, UINT8 nVal ) -{ - nVal <<= 4; - for( int n = 4 ; n ; n-- ) - { - r += ( nVal & 0x80 )? "1" : "0"; - nVal <<= 1; - } -} - - -static void __AddPureBin( ByteString& r, UINT8 nVal ) -{ - __AddPureBinNibble( r, nVal >> 4 ); - r += " "; - __AddPureBinNibble( r, nVal ); -} - - -static void __AddPureBin( ByteString& r, UINT16 nVal ) -{ - const sal_Char* pIn = " "; - __AddPureBin( r, ( UINT8 ) ( nVal >> 8 ) ); - r += pIn; - __AddPureBin( r, ( UINT8 ) nVal ); -} - - -static void __AddPureBin( ByteString& r, UINT32 nVal ) -{ - const sal_Char* pIn = " "; - __AddPureBin( r, ( UINT8 ) ( nVal >> 24 ) ); - r += pIn; - __AddPureBin( r, ( UINT8 ) ( nVal >> 16 ) ); - r += pIn; - __AddPureBin( r, ( UINT8 ) ( nVal >> 8 ) ); - r += pIn; - __AddPureBin( r, ( UINT8 ) nVal ); -} - - -inline static void __AddDec( ByteString& r, UINT32 n ) -{ - sal_Char p[ 32 ]; - sprintf( p, "%u", n ); // #100211# - checked - r += p; -} - - -inline static void __AddDec( ByteString& r, UINT16 n ) -{ - __AddDec( r, ( UINT32 ) n ); -} - - -inline static void __AddDec( ByteString& r, UINT8 n ) -{ - __AddDec( r, ( UINT32 ) n ); -} - - -inline static void __AddDec( ByteString& r, INT32 n ) -{ - sal_Char p[ 32 ]; - sprintf( p, "%d", n ); // #100211# - checked - r += p; -} - - -inline static void __AddDec( ByteString& r, INT16 n ) -{ - __AddDec( r, ( INT32 ) n ); -} - -inline static void __AddDec( ByteString& r, sal_Int8 n ) -{ - __AddDec( r, ( INT32 ) n ); -} - - -static void __AddDec( ByteString& r, UINT32 nVal, UINT16 nNumOfDig, sal_Char c = ' ' ) -{ - ByteString t; - ByteString aVal; - __AddDec( aVal, nVal ); - if( nNumOfDig > (UINT16) aVal.Len() ) - t.Fill( nNumOfDig - (UINT16) aVal.Len(), c ); - r += t; - r += aVal; -} - - -inline static void __AddDec1616( ByteString& r, UINT32 n ) -{ - __AddDec( r, (UINT16)(n >> 16) ); - r += '.'; - __AddDec( r, (UINT16)(n & 0xFFFF) ); -} - - -static void __AddDouble( ByteString& r, const double f ) -{ - r += ByteString( ::rtl::math::doubleToString( f, rtl_math_StringFormat_G, 15, '.', TRUE ) ); -} - - -static inline void __AddRK( ByteString& rString, sal_Int32 nRKValue ) -{ - __AddDouble( rString, XclTools::GetDoubleFromRK( nRKValue ) ); -} - - -inline static void __Add16p16( ByteString& r, UINT32 n ) -{ - __AddDouble( r, double(n) / 65536.0 ); -} - - -static void lcl_AddRef( ByteString& rStr, sal_uInt16 nCol, sal_uInt16 nRow ) -{ - ScAddress aRef( static_cast< SCCOL >( nCol ), static_cast< SCROW >( nRow ), 0 ); - rStr.Append( GETSTR( aRef.GetColRowString() ) ); -} - - -static void lcl_AddRangeRef( ByteString& rStr, sal_uInt16 nCol1, sal_uInt16 nRow1, sal_uInt16 nCol2, sal_uInt16 nRow2 ) -{ - lcl_AddRef( rStr, nCol1, nRow1 ); - if( (nCol1 != nCol2) || (nRow1 != nRow2) ) - { - rStr.Append( ':' ); - lcl_AddRef( rStr, nCol2, nRow2 ); - } -} - - -static void __AddCellHead( ByteString& r, const UINT16 nC, const UINT16 nR, const UINT16 nXF ) -{ - lcl_AddRef( r, (UINT8) nC, nR ); - r += " (XF="; - __AddDec( r, nXF ); - r += ')'; -} - - -inline static void lcl_AddFlag( - ByteString& rString, bool bFlag, const sal_Char* pcTrue = "true", const sal_Char* pcFalse = "false" ) -{ - rString += (bFlag ? pcTrue : pcFalse); -} - -inline static void lcl_AddOnOff( ByteString& rString, bool bFlag ) -{ - lcl_AddFlag( rString, bFlag, "on", "off" ); -} - - -static void lcl_AddEnum( - ByteString& rString, long nValue, const sal_Char* const ppcEnums[], long nSize, - const sal_Char* pcDefault = 0, long nOffset = 0 ) -{ - nValue -= nOffset; - const sal_Char* pcText = "!unknown!"; - if( (0 <= nValue) && (nValue < nSize) && ppcEnums[ nValue ] ) - pcText = ppcEnums[ nValue ]; - else if( pcDefault ) - pcText = pcDefault; - if( *pcText ) // nonempty string - rString.Append( " (" ).Append( pcText ).Append( ')' ); -} - - -namespace { - -void lclDumpString( SvStream& rOutStrm, const ByteString& rData ) -{ - ByteString aOutStr; - xub_StrLen nIdx = 0; - for( ; (nIdx < rData.Len()) && (aOutStr.Len() < 80); ++nIdx ) - { - sal_Char cChar = rData.GetChar( nIdx ); - if( 32 <= cChar ) - aOutStr.Append( cChar ); - else - { - aOutStr.Append( '<' ); - __AddHex( aOutStr, static_cast< sal_uInt8 >( cChar ) ); - aOutStr.Append( '>' ); - } - } - rOutStrm << aOutStr.GetBuffer(); - if( nIdx < rData.Len() ) - rOutStrm << "<...>"; -} - -void lclDumpStringValue( SvStream& rOutStrm, const ByteString& rName, const ByteString& rData ) -{ - rOutStrm << rName.GetBuffer() << "='"; - lclDumpString( rOutStrm, rData ); - rOutStrm << '\''; -} - -void lclDumpString( SvStream& rOutStrm, const String& rData ) -{ - ByteString aOutStr; - xub_StrLen nIdx = 0; - for( ; (nIdx < rData.Len()) && (aOutStr.Len() < 80); ++nIdx ) - { - sal_Unicode cChar = rData.GetChar( nIdx ); - if( (32 <= cChar) && (cChar <= 255) ) - aOutStr.Append( static_cast< sal_Char >( cChar ) ); - else - { - aOutStr.Append( '<' ); - if( cChar < 256 ) - __AddHex( aOutStr, static_cast< sal_uInt8 >( cChar ) ); - else - __AddHex( aOutStr, static_cast< sal_uInt16 >( cChar ) ); - aOutStr.Append( '>' ); - } - } - rOutStrm << aOutStr.GetBuffer(); - if( nIdx < rData.Len() ) - rOutStrm << "<...>"; -} - -void lclDumpStringValue( SvStream& rOutStrm, const ByteString& rName, const String& rData ) -{ - rOutStrm << rName.GetBuffer() << "='"; - lclDumpString( rOutStrm, rData ); - rOutStrm << '\''; -} - -} // namespace - - -IdRangeList::~IdRangeList() -{ - Clear(); -} - - -void IdRangeList::Clear( void ) -{ - IdRange* p = ( IdRange* ) First(); - - while( p ) - { - delete p; - p = ( IdRange* ) Next(); - } - - List::Clear(); -} - -// ============================================================================ -// -// H E L P E R O B J E C T S -// -// ============================================================================ - -namespace { - -// ---------------------------------------------------------------------------- - -class XclDumpStreamHeader -{ -public: - explicit XclDumpStreamHeader( SvStream& rInStrm, SvStream& rOutStrm, const String& rStrmName, const String& rStrmPath ); - ~XclDumpStreamHeader(); - inline ULONG GetStreamLen() const { return mnStrmLen; } - -private: - SvStream& mrOutStrm; - String maStrmName; - String maStrmPath; - ByteString maSeparator; - ULONG mnStrmLen; -}; - -XclDumpStreamHeader::XclDumpStreamHeader( SvStream& rInStrm, SvStream& rOutStrm, const String& rStrmName, const String& rStrmPath ) : - mrOutStrm( rOutStrm ), - maStrmName( rStrmName ), - maStrmPath( rStrmPath ), - mnStrmLen( 0 ) -{ - maSeparator.Assign( '+' ).Expand( 78, '-' ); - - rInStrm.Seek( STREAM_SEEK_TO_END ); - mnStrmLen = rInStrm.Tell(); - rInStrm.Seek( STREAM_SEEK_TO_BEGIN ); - - ByteString aLine; - lclAppendDec( aLine, mnStrmLen ); - - mrOutStrm << maSeparator.GetBuffer() << "\n"; - mrOutStrm << "| STREAM-BEGIN\n"; - mrOutStrm << "| "; - lclDumpStringValue( mrOutStrm, "stream-name", maStrmName ); - mrOutStrm << "\n| "; - lclDumpStringValue( mrOutStrm, "stream-path", maStrmPath ); - mrOutStrm << "\n| stream-len=" << aLine.GetBuffer() << "\n"; - mrOutStrm << "|\n\n"; -} - -XclDumpStreamHeader::~XclDumpStreamHeader() -{ - mrOutStrm << "|\n"; - mrOutStrm << "| "; - lclDumpStringValue( mrOutStrm, "stream-name", maStrmName ); - mrOutStrm << "\n| "; - lclDumpStringValue( mrOutStrm, "stream-path", maStrmPath ); - mrOutStrm << "\n"; - mrOutStrm << "| STREAM-END\n"; - mrOutStrm << maSeparator.GetBuffer() << "\n\n"; -} - -// ---------------------------------------------------------------------------- - -class XclDumpStorageHeader -{ -public: - explicit XclDumpStorageHeader( SotStorage& rInStrg, SvStream& rOutStrm, const String& rStrgPath ); - ~XclDumpStorageHeader(); - -private: - SvStream& mrOutStrm; - String maStrgName; - String maStrgPath; - ByteString maSeparator; -}; - -XclDumpStorageHeader::XclDumpStorageHeader( SotStorage& rInStrg, SvStream& rOutStrm, const String& rStrgPath ) : - mrOutStrm( rOutStrm ), - maStrgName( rInStrg.GetName() ), - maStrgPath( rStrgPath ) -{ - maSeparator.Assign( "++" ).Expand( 78, '=' ); - - mrOutStrm << maSeparator.GetBuffer() << "\n"; - mrOutStrm << "|| STORAGE-BEGIN\n"; - mrOutStrm << "|| "; - lclDumpStringValue( mrOutStrm, "storage-name", maStrgName ); - mrOutStrm << "\n|| "; - lclDumpStringValue( mrOutStrm, "storage-path", maStrgPath ); - mrOutStrm << "\n"; - - SvStorageInfoList aInfoList; - rInStrg.FillInfoList( &aInfoList ); - ByteString aLine; - lclAppendDec( aLine, aInfoList.Count() ); - mrOutStrm << "|| directory-size=" << aLine.GetBuffer() << "\n"; - - for( ULONG nInfo = 0; nInfo < aInfoList.Count(); ++nInfo ) - { - SvStorageInfo& rInfo = aInfoList.GetObject( nInfo ); - mrOutStrm << "|| type="; - if( rInfo.IsStream() ) - mrOutStrm << "stream "; - else if( rInfo.IsStorage() ) - mrOutStrm << "storage "; - else - mrOutStrm << "unknown "; - lclDumpStringValue( mrOutStrm, "name", rInfo.GetName() ); - mrOutStrm << "\n"; - } - - mrOutStrm << "||\n\n"; -} - -XclDumpStorageHeader::~XclDumpStorageHeader() -{ - mrOutStrm << "||\n"; - mrOutStrm << "|| "; - lclDumpStringValue( mrOutStrm, "storage-name", maStrgName ); - mrOutStrm << "\n|| "; - lclDumpStringValue( mrOutStrm, "storage-path", maStrgPath ); - mrOutStrm << "\n"; - mrOutStrm << "|| STORAGE-END\n"; - mrOutStrm << maSeparator.GetBuffer() << "\n\n"; -} - -// ---------------------------------------------------------------------------- - -} - -// ============================================================================ -// -// ============================================================================ - -void Biff8RecDumper::Print( const ByteString& r ) -{ - DBG_ASSERT( pDumpStream, "-Biff8RecDumper::Print(): Stream is wech!" ); - *pDumpStream << '\n' << pLevelPre; - pDumpStream->Write( r.GetBuffer(), r.Len() ); -} - - -void Biff8RecDumper::Print( const sal_Char* p ) -{ - DBG_ASSERT( pDumpStream, "-Biff8RecDumper::Print(): Stream is wech!" ); - DBG_ASSERT( p, "-Biff8RecDumper::Print(): ByteString is wech!" ); - - *pDumpStream << '\n' << pLevelPre << p; -} - - -static const sal_Char* GetSeriesType( const UINT16 n ) -{ - const sal_Char* p; - - switch( n ) - { - case 0: p = "(date) "; break; - case 1: p = "(numeric) "; break; - case 2: p = "(sequence)"; break; - case 3: p = "(text) "; break; - default: p = "(unknown) "; - } - - return p; -} - - -static const sal_Char* GetLineType( const UINT16 n ) -{ - const sal_Char* p; - - switch( n ) - { - case 0: p = "solid"; break; - case 1: p = "dash"; break; - case 2: p = "dot"; break; - case 3: p = "dash-dot"; break; - case 4: p = "dash-dot-dot"; break; - case 5: p = "none"; break; - case 6: p = "dark gray pattern"; break; - case 7: p = "medium gray pattern"; break; - case 8: p = "light gray pattern"; break; - default: p = pU; - } - - return p; -} - - -static ByteString GetRGB( const UINT32 n ) -{ - ByteString s; - - s += "R"; - __AddDec( s, ( UINT8 ) n ); - s += " G"; - __AddDec( s, ( UINT8 ) ( n >> 8 ) ); - s += " B"; - __AddDec( s, ( UINT8 ) ( n >> 16 ) ); - - return s; -} - - -static void AddRef( ByteString& t, UINT16 nRow, UINT16 nC, BOOL bName, UINT16 nTab = 0xFFFF ) -{ - BOOL bColRel = ( nC & 0x4000 ) != 0; - BOOL bRowRel = ( nC & 0x8000 ) != 0; - UINT8 nCol = (UINT8) nC; - INT8 nRelCol = (INT8) nCol; - INT16 nRelRow = (INT16) nRow; - - if( nTab < 0xFFFF ) - { - t += "XTI("; - __AddDec( t, nTab ); - t += ")!"; - } - - if( bName ) - { - // dump relative: [Column|Row] - // [C-1,R-1] = one column left, one row up - // [C+1,R+1] = one column right, one row down - // [C,R] = same column/row - // [C=B,R=2] = absolute column B/row 2 - t += "[C"; - if( bColRel ) - { - if( nRelCol > 0 ) - t += '+'; - if( nRelCol != 0 ) - __AddDec( t, (INT16)nRelCol ); - } - else - { - t += '='; - t += GETSTR( ::ScScColToAlpha( nCol ) ); - } - - t += ",R"; - if( bRowRel ) - { - if( nRelRow > 0 ) - t += "+"; - if( nRelRow != 0 ) - __AddDec( t, nRelRow ); - } - else - { - t += '='; - __AddDec( t, (INT32)nRow + 1 ); - } - t += ']'; - } - else - { - if( !bColRel ) - t += '$'; - t += GETSTR( ::ScColToAlpha( nCol ) ); - if( !bRowRel ) - t += '$'; - __AddDec( t, (UINT16)(nRow + 1) ); - } -} - -static void AddRangeRef( ByteString& t, UINT16 nRow1, UINT16 nC1, UINT16 nRow2, UINT16 nC2, BOOL bName, UINT16 nTab = 0xFFFF ) -{ - AddRef( t, nRow1, nC1, bName, nTab ); - if( (nRow1 != nRow2) || (nC1 != nC2) ) - { - t += ':'; - AddRef( t, nRow2, nC2, bName ); - } -} - - - -static BOOL AddUNICODEString( ByteString& rStr, XclImpStream& rStrm, const BOOL b16BitLen = TRUE, UINT16 nLen = 0, ByteString* pRawName = 0 ) -{ - BOOL bRet = TRUE; - - if( !nLen ) - nLen = b16BitLen ? rStrm.ReaduInt16() : rStrm.ReaduInt8(); - UINT8 nGrbit = rStrm.ReaduInt8(); - - UINT32 nExtLen; - UINT16 nCrun; - bool b16Bit, bFarEast, bRichString; - rStrm.ReadUniStringExtHeader( b16Bit, bRichString, bFarEast, nCrun, nExtLen, nGrbit ); - - rStr += "(l="; - __AddDec( rStr, nLen ); - rStr += " f="; - __AddHex( rStr, nGrbit ); - rStr += " "; - rStr += b16Bit ? "16-Bit" : "8-Bit"; - - if( bRichString && bFarEast ) - rStr += " rich far-east"; - else if( bRichString && !bFarEast ) - rStr += " rich"; - else if ( !bRichString && bFarEast ) - rStr += " far-east"; - rStr += ") '"; - - ByteString aData( rStrm.ReadRawUniString( nLen, b16Bit ), RTL_TEXTENCODING_MS_1252 ); - if( pRawName ) *pRawName = aData; - - xub_StrLen nIndex = 0; - while( (nIndex < aData.Len()) && (nIndex < 255) ) - { - UINT8 nChar = (UINT8)aData.GetChar( nIndex ); - if( nChar < ' ' ) - { - ByteString aIns( '<' ); - __AddHex( aIns, nChar ); - aIns += '>'; - aData.Erase( nIndex, 1 ).Insert( aIns, nIndex ); - nIndex += 5; - } - nIndex++; - } - - rStr += aData.Copy( 0, 255 ); - rStr += '\''; - if( aData.Len() > 255 ) - rStr += "..."; - - if( nCrun ) - { - rStr += " + "; - __AddDec( rStr, nCrun ); - rStr += " format blocks ("; - nCrun *= 4; - __AddDec( rStr, nCrun ); - rStr += " bytes)"; - rStrm.Ignore( nCrun ); - } - if( nExtLen ) - { - rStr += " + "; - __AddDec( rStr, nExtLen ); - rStr += " byte extended:"; - for( sal_uInt32 nIdx = 0; rStrm.IsValid() && (nIdx < nExtLen); ++nIdx ) - { - rStr.Append( ' ' ); - __AddPureHex( rStr, rStrm.ReaduInt8() ); - } - } - - return bRet; -} - - -DUMP_ERR::~DUMP_ERR() -{ - if( pHint ) - delete pHint; -} - - - - -#define Read1(rIn) (rIn).ReaduInt8() -#define Read2(rIn) (rIn).ReaduInt16() -#define Read4(rIn) (rIn).ReaduInt32() -#define Read8(rIn) (rIn).ReadDouble() -#define LINESTART() {t.Erase();t+=pPre;} -#define IGNORE(n) rIn.Ignore(n) -#define ADDBIN(n) __AddBin( t, Read##n( rIn ) ) -#define ADDHEX(n) __AddHex( t, Read##n( rIn ) ) -#define ADDDEC(n) __AddDec( t, Read##n( rIn ) ) -#define ADDDOUBLE() __AddDouble( t, rIn.ReadDouble() ) -#define ADD16P16() __Add16p16( t, Read4( rIn ) ) -#define ADDTEXT(T) t += T -#define PRINT() Print( t ) -#define PreDump(LEN) {rIn.PushPosition();ContDump(LEN);rIn.PopPosition();} -#define ADDCELLHEAD() {UINT16 nR,nC,nX;rIn>>nR>>nC>>nX;__AddCellHead(t,nC,nR,nX);} -#define STARTFLAG() {ADDTEXT( "flags=" ); __AddHex( t, __nFlags ); ADDTEXT( " " );} -#define ADDFLAG(mask,text) {if( __nFlags & mask ) t.Append( ' ' ).Append( text );} -#define ADDRESERVED(mask) ADDFLAG(mask,"!RESERVED!") - - -UINT16 Biff8RecDumper::DumpXF( XclImpStream& rStrm, const sal_Char* pPre ) -{ - ByteString t; // "t" needed by macros - - sal_uInt32 nBorder1, nBorder2; - sal_uInt16 nFont, nNumFmt, nTypeProt, nAlign, nMiscAttrib, nArea, __nFlags, nTmp; - rStrm >> nFont >> nNumFmt >> nTypeProt >> nAlign >> nMiscAttrib >> nBorder1 >> nBorder2 >> nArea; - bool bCell = !::get_flag( nTypeProt, EXC_XF_STYLE ); - - // XF type/parent - LINESTART(); - ::extract_value( nTmp, nTypeProt, 4, 12 ); - ADDTEXT( "index=#" ); __AddDec( t, nXFCount++ ); - ADDTEXT( " type=" ); lcl_AddFlag( t, bCell, "cell", "style" ); - ADDTEXT( " parent-xf=#" ); __AddDec( t, nTmp ); - PRINT(); - - // attribute used flags - LINESTART(); - ::extract_value( __nFlags, nMiscAttrib, 10, 6 ); - if( !bCell ) __nFlags ^= 0x3F; // in style XFs a 0 means used - ADDTEXT( "used " ); STARTFLAG(); - ADDFLAG( EXC_XF_DIFF_VALFMT, "numfmt" ); - ADDFLAG( EXC_XF_DIFF_FONT, "font" ); - ADDFLAG( EXC_XF_DIFF_ALIGN, "align" ); - ADDFLAG( EXC_XF_DIFF_BORDER, "border" ); - ADDFLAG( EXC_XF_DIFF_AREA, "area" ); - ADDFLAG( EXC_XF_DIFF_PROT, "prot" ); - PRINT(); - - // cell protection/font/number format - LINESTART(); - ADDTEXT( "cell-lock=" ); lcl_AddOnOff( t, ::get_flag( nTypeProt, EXC_XF_LOCKED ) ); - ADDTEXT( " hidden=" ); lcl_AddOnOff( t, ::get_flag( nTypeProt, EXC_XF_HIDDEN ) ); - ADDTEXT( " font=" ); __AddDec( t, nFont ); - ADDTEXT( " num-fmt=" ); __AddDec( t, nNumFmt ); - PRINT(); - - // alignment - LINESTART(); - ::extract_value( nTmp, nAlign, 0, 3 ); - ADDTEXT( "hor-align=" ); __AddDec( t, nTmp ); - ADDTEXT( " (" ); - switch( nTmp ) - { - case EXC_XF_HOR_GENERAL: ADDTEXT( "general" ); break; - case EXC_XF_HOR_LEFT: ADDTEXT( "left" ); break; - case EXC_XF_HOR_CENTER: ADDTEXT( "center" ); break; - case EXC_XF_HOR_RIGHT: ADDTEXT( "right" ); break; - case EXC_XF_HOR_FILL: ADDTEXT( "fill" ); break; - case EXC_XF_HOR_JUSTIFY: ADDTEXT( "justify" ); break; - case EXC_XF_HOR_CENTER_AS: ADDTEXT( "center-as" ); break; - case EXC_XF_HOR_DISTRIB: ADDTEXT( "distrib" ); break; - default: ADDTEXT( "!unknown!" ); - }; - ::extract_value( nTmp, nAlign, 4, 3 ); - ADDTEXT( ") ver-align=" ); __AddDec( t, nTmp ); - ADDTEXT( " (" ); - switch( nTmp ) - { - case EXC_XF_VER_TOP: ADDTEXT( "top" ); break; - case EXC_XF_VER_CENTER: ADDTEXT( "center" ); break; - case EXC_XF_VER_BOTTOM: ADDTEXT( "bottom" ); break; - case EXC_XF_VER_JUSTIFY: ADDTEXT( "justify" ); break; - case EXC_XF_VER_DISTRIB: ADDTEXT( "distrib" ); break; - default: ADDTEXT( "!unknown!" ); - }; - ADDTEXT( ") text-wrap=" ); lcl_AddOnOff( t, ::get_flag( nAlign, EXC_XF_LINEBREAK ) ); - PRINT(); - - LINESTART(); - ::extract_value( nTmp, nAlign, 8, 8 ); - ADDTEXT( "rotation=" ); __AddDec( t, nTmp ); - ADDTEXT( " (" ); - if( nTmp < 91 ) - { __AddDec( t, nTmp ); ADDTEXT( "\xB0" ); } - else if( nTmp < 181 ) - { __AddDec( t, static_cast< sal_Int32 >( 90 - nTmp ) ); ADDTEXT( "\xB0" ); } - else if( nTmp == EXC_ROT_STACKED ) - { ADDTEXT( "stacked" ); } - else - { ADDTEXT( "!unknown!" ); } - ::extract_value( nTmp, nMiscAttrib, 0, 4 ); - ADDTEXT( ") indent=" ); __AddDec( t, nTmp ); - ADDTEXT( " shrink=" ); lcl_AddOnOff( t, ::get_flag( nMiscAttrib, EXC_XF8_SHRINK ) ); - ::extract_value( nTmp, nMiscAttrib, 6, 2 ); - ADDTEXT( " text-dir=" ); __AddDec( t, nTmp ); - ADDTEXT( " (" ); - switch( nTmp ) - { - case EXC_XF_TEXTDIR_CONTEXT: ADDTEXT( "context" ); break; - case EXC_XF_TEXTDIR_LTR: ADDTEXT( "ltr" ); break; - case EXC_XF_TEXTDIR_RTL: ADDTEXT( "rtl" ); break; - default: ADDTEXT( "!unknown!" ); - }; - ADDTEXT( ")" ); - PRINT(); - - // border/area - LINESTART(); - ::extract_value( nTmp, nBorder1, 0, 4 ); - ADDTEXT( "left-line=" ); __AddDec( t, nTmp ); - ::extract_value( nTmp, nBorder1, 16, 7 ); - ADDTEXT( " color=" ); __AddDec( t, nTmp ); - ::extract_value( nTmp, nBorder1, 4, 4 ); - ADDTEXT( " right-line =" ); __AddDec( t, nTmp ); - ::extract_value( nTmp, nBorder1, 23, 7 ); - ADDTEXT( " color=" ); __AddDec( t, nTmp ); - PRINT(); - LINESTART(); - ::extract_value( nTmp, nBorder1, 8, 4 ); - ADDTEXT( "top-line =" ); __AddDec( t, nTmp ); - ::extract_value( nTmp, nBorder2, 0, 7 ); - ADDTEXT( " color=" ); __AddDec( t, nTmp ); - ::extract_value( nTmp, nBorder1, 12, 4 ); - ADDTEXT( " bottom-line=" ); __AddDec( t, nTmp ); - ::extract_value( nTmp, nBorder2, 7, 7 ); - ADDTEXT( " color=" ); __AddDec( t, nTmp ); - PRINT(); - LINESTART(); - ::extract_value( nTmp, nBorder2, 21, 4 ); - ADDTEXT( "diag-line=" ); __AddDec( t, nTmp ); - ::extract_value( nTmp, nBorder2, 14, 7 ); - ADDTEXT( " color=" ); __AddDec( t, nTmp ); - ADDTEXT( " diag-tl-to-br=" ); lcl_AddOnOff( t, ::get_flag( nBorder1, 0x40000000UL ) ); - ADDTEXT( " diag-bl-to-tr=" ); lcl_AddOnOff( t, ::get_flag( nBorder1, 0x80000000UL ) ); - PRINT(); - LINESTART(); - ::extract_value( nTmp, nBorder2, 26, 6 ); - ADDTEXT( "area-pattern=" ); __AddDec( t, nTmp ); - ::extract_value( nTmp, nArea, 0, 7 ); - ADDTEXT( " fore-color=" ); __AddDec( t, nTmp ); - ::extract_value( nTmp, nArea, 7, 7 ); - ADDTEXT( " back-color=" ); __AddDec( t, nTmp ); - PRINT(); - - return 0; -} - -void Biff8RecDumper::DumpValidPassword( XclImpStream& rIn, const sal_Char* pPre ) -{ - ByteString t; - UINT16 nHash; - rIn >> nHash; - LINESTART(); - ADDTEXT( "hash=" ); - __AddHex( t, nHash ); - if( nHash ) - { - ByteString sPasswd; - ByteString sDummy; - UINT16 nLen = 9; - UINT16 nDummy; - UINT16 nNewChar; - - nHash ^= 0xCE4B; - nDummy = nHash; - ADDTEXT( " without-mask=" ); - __AddHex( t, nHash ); - while( !(nDummy & 0x8000) && nLen ) - { - nLen--; - nDummy <<= 1; - } - if( !nLen ) nLen = 2; - if( (nLen ^ nHash) & 0x0001 ) nLen++; - if( nLen == 9 ) - { - nLen = 10; - nHash ^= 0x8001; - } - nHash ^= nLen; - if( nLen < 9 ) nHash <<= (8 - nLen); - for( UINT16 iChar = nLen; iChar > 0; iChar-- ) - { - switch( iChar ) - { - case 10: - nNewChar = (nHash & 0xC000) | 0x0400; - nHash ^= nNewChar; - nNewChar >>= 2; - break; - case 9: - nNewChar = 0x4200; - nHash ^= nNewChar; - nNewChar >>= 1; - break; - case 1: - nNewChar = nHash & 0xFF00; - break; - default: - nNewChar = (nHash & 0xE000) ^ 0x2000; - if( !nNewChar ) nNewChar = (nHash & 0xF000) ^ 0x1800; - if( nNewChar == 0x6000 ) nNewChar = 0x6100; - nHash ^= nNewChar; - nHash <<= 1; - break; - } - nNewChar >>= 8; - nNewChar &= 0x00FF; - sDummy = sPasswd; - sPasswd = (sal_Char) nNewChar; - sPasswd += sDummy; - } - ADDTEXT( " valid-password='" ); - t += sPasswd; - ADDTEXT( "'" ); - } - PRINT(); -} - - -void __AddGUID( ByteString& rStr, XclImpStream& rIn ) -{ - UINT16 nIndex; - __AddPureHex( rStr, Read4( rIn ) ); - rStr += "-"; - __AddPureHex( rStr, Read2( rIn ) ); - rStr += "-"; - __AddPureHex( rStr, Read2( rIn ) ); - rStr += "-"; - // last 2 parts byte for byte - for( nIndex = 0; nIndex < 2; nIndex++ ) - __AddPureHex( rStr, Read1( rIn ) ); - rStr += "-"; - for( nIndex = 0; nIndex < 6; nIndex++ ) - __AddPureHex( rStr, Read1( rIn ) ); -} - - -void Biff8RecDumper::PreDumpDecrypted( ULONG nL ) -{ - if( !nL ) return; - - ByteString t; - const sal_Char* pPre = (pLevelPre > pLevelPreString) ? pLevelPre - 1 : pLevelPre; - - LINESTART(); - ADDTEXT( "*** encrypted ***" ); - PRINT(); - pIn->DisableDecryption(); - pIn->Seek( EXC_REC_SEEK_TO_BEGIN ); - ContDump( nL ); - - if( pIn->HasValidDecrypter() ) - { - LINESTART(); - ADDTEXT( "*** decrypted ***" ); - PRINT(); - pIn->EnableDecryption(); - pIn->Seek( EXC_REC_SEEK_TO_BEGIN ); - ContDump( nL ); - } -} - - -void Biff8RecDumper::RecDump( BOOL bSubStream ) -{ - const sal_Char* p; - BOOL bDec = FALSE; - ByteString aTmp; - UINT16 __nFlags; - const UINT16 nR = pIn->GetRecId(); - const ByteString* pName = GetName( nR ); - - // set CONTINUE handling mode - switch( nR ) - { - case 0x000A: // EOF - case 0x003C: // CONT - case 0x005D: // OBJ - case 0x00EC: // MSODRAWING - case 0x01B6: // TXO - pIn->ResetRecord( false ); - break; - case 0x1066: // CHGELFRAME - pIn->ResetRecord( bReadContRecs, 0x1066 ); - break; - default: - pIn->ResetRecord( bReadContRecs ); - } - const ULONG nL = pIn->GetRecSize(); - - switch( nR ) - { - case 0x0009: - case 0x0209: - case 0x0409: - case 0x0809: - nLevelCnt = 0; - break; - case 0x1033: - if( pName ) - aTmp = *pName; - else - aTmp = "BEGIN "; - bDec = ( pLevelPre + nLevelInc ) >= pLevelPreString; - nLevelCnt++; - aTmp.Append( ByteString::CreateFromInt32( nLevelCnt ) ); - pName = &aTmp; - break; - case 0x1034: - if( pName ) - aTmp = *pName; - else - aTmp = "END "; - if( ( pLevelPre + nLevelInc ) <= pLevelPreStringNT ) - pLevelPre += nLevelInc; - if( nLevelCnt ) - { - aTmp.Append( ByteString::CreateFromInt32( nLevelCnt ) ); - nLevelCnt--; - } - else - aTmp += "#LEVEL ERROR#"; - pName = &aTmp; - break; - } - - ByteString aT; - ByteString& t = aT; - const sal_Char* pPre = (pLevelPre > pLevelPreString) ? pLevelPre - 1 : pLevelPre; - - if( nR || nL ) // skip dummy-zero DIMENSIONS at eof - { - if( bBlankLine ) - *pDumpStream << '\n'; - - aT += pLevelPre; - __AddHex( aT, nR ); - - if( pName ) - { - aT += " ("; - aT += *pName; - aT += ") ["; - } - else - aT += " ["; - - if( bReadContRecs ) - __AddHex( aT, nL ); - else - __AddHex( aT, (UINT16)nL ); - aT += "]"; - if( !bSkipOffset ) - { - aT += " :"; - __AddHex( aT, UINT32(pIn->GetSvStreamPos() - 2 * sizeof(UINT16)) ); - aT += ':'; - } - - Print( aT ); - } - - if( HasModeNameOnly( nR ) ) - ; - else if( HasModeHex( nR ) || !bBIFF8 ) - { - if( bEncrypted ) - PreDumpDecrypted( nL ); - else - ContDump( nL ); - } - else if( nMaxBodyLines && nL ) - { - XclImpStream& rIn = *pIn; - - if( bEncrypted ) - { - PreDumpDecrypted( nL ); - LINESTART(); - ADDTEXT( "*** contents ***" ); - PRINT(); - pIn->Seek( EXC_REC_SEEK_TO_BEGIN ); - } - - LINESTART(); - - switch( nR ) - { - case 0x0000: // DIMENSIONS - used area - case 0x0200: - { - LINESTART(); - UINT32 nR1, nR2; - UINT16 nC1, nC2; - rIn >> nR1 >> nR2 >> nC1 >> nC2; - ADDTEXT( "first row: " ); __AddHex( t, nR1 ); - ADDTEXT( " last row+1: " ); __AddHex( t, nR2 ); - ADDTEXT( " first col: " ); __AddHex( t, nC1 ); - ADDTEXT( " last col+1: " ); __AddHex( t, nC2 ); - ADDTEXT( " (" ); lcl_AddRangeRef( t, nC1, (UINT16)nR1, nC2-1, (UINT16)nR2-1 ); - ADDTEXT( ")" ); - PRINT(); - } - break; - case 0x06: - { - ADDCELLHEAD(); - PRINT(); - LINESTART(); - ADDTEXT( "val = " ); - ADDDOUBLE(); - rIn >> __nFlags; - if( __nFlags ) - { - ADDTEXT( " " ); - STARTFLAG(); - ADDFLAG( 0x01, "fAlwaysCalc" ); - ADDFLAG( 0x02, "fCalcOnLoad" ); - ADDFLAG( 0x08, "fShrFmla" ); - } - PRINT(); - LINESTART(); - UINT16 n; - ADDTEXT( "chn = " ); - ADDHEX( 4 ); - rIn >> n; - ADDTEXT( " cce = " ); - __AddDec( t, n ); - PRINT(); - FormulaDump( n, FT_CellFormula ); - if( rIn.GetRecLeft() > 0 ) - { - LINESTART(); - ADDTEXT( "additional formula data" ); - PRINT(); - ContDump( rIn.GetRecLeft() ); - } - } - break; - case 0x0013: // PASSWORD - DumpValidPassword( rIn, pPre ); - break; - case 0x0014: // HEADER - case 0x0015: // FOOTER - if( rIn.GetRecLeft() ) - AddUNICODEString( t, rIn ); - PRINT(); - break; - case 0x17: - { - if( mnSubstream == EXC_BOF_WORKSPACE ) - { - ADDTEXT( "filename=" ); - AddUNICODEString( t, rIn ); - PRINT(); - } - else - { - UINT16 n; - rIn >> n; - ADDTEXT( "# of XTI: " ); - __AddDec( t, n ); - PRINT(); - UINT16 nSB, nF, nL; - while( n && rIn.IsValid() ) - { - LINESTART(); - rIn >> nSB >> nF >> nL; - ADDTEXT( "Supbook = " ); - __AddDec( t, nSB ); - ADDTEXT( " Tab = " ); - __AddDec( t, nF ); - ADDTEXT( " ... " ); - __AddDec( t, nL ); - PRINT(); - n--; - } - } - } - break; - case 0x0018: - case 0x0218: // NAME - { - sal_uInt8 nKey, nNameLen, nMenuLen, nDescrLen, nHelpLen, nStatusLen; - sal_uInt16 nFmlaSize, nRes, nTab; - - rIn >> __nFlags >> nKey >> nNameLen >> nFmlaSize >> nRes >> nTab >> nMenuLen >> nDescrLen >> nHelpLen >> nStatusLen; - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fHidden" ); - ADDFLAG( 0x0002, "fFunc" ); - ADDFLAG( 0x0004, "fVBProc" ); - ADDFLAG( 0x0008, "fProc" ); - ADDFLAG( 0x0010, "fCalcExp" ); - ADDFLAG( 0x0020, "fBuiltIn" ); - ADDFLAG( 0x1000, "fBig" ); - ADDRESERVED( 0xE000 ); - ADDTEXT( " func-group-idx=" ); - __AddDec( t, (UINT16)((__nFlags & 0x0FC0) >> 6) ); - ADDTEXT( " shortcut=" ); __AddHex( t, nKey ); - PRINT(); - - LINESTART(); - ADDTEXT( "fmla-size=" ); __AddDec( t, nFmlaSize ); - ADDTEXT( " reserved=" ); __AddHex( t, nRes ); - ADDTEXT( " tab=" ); __AddDec( t, nTab ); - if( !nTab ) ADDTEXT( " (global)" ); - PRINT(); - - LINESTART(); - sal_uInt16 nBuiltIn = 0; - bool bBuiltIn = (nNameLen == 1) && (__nFlags & 0x0020); - if( bBuiltIn ) - { - rIn.PushPosition(); - sal_uInt8 nStrFlags; - rIn >> nStrFlags; - nBuiltIn = (nStrFlags & 1) ? rIn.ReaduInt16() : rIn.ReaduInt8(); - rIn.PopPosition(); - } - ADDTEXT( "name=" ); - ByteString aName; - AddUNICODEString( t, rIn, false, nNameLen, &aName ); - if( bBuiltIn ) - { - static const sal_Char* const ppcNames[] = { - "Consolidate_Area", "Auto_Open", "Auto_Close", "Extract", "Database", - "Criteria", "Print_Area", "Print_Titles", "Recorder", "Data_Form", - "Auto_Activate", "Auto_Deactivate", "Sheet_Title", "_FilterDatabase" }; - lcl_AddEnum( t, nBuiltIn, ppcNames, STATIC_TABLE_SIZE( ppcNames ) ); - if( (0 <= nBuiltIn) && (nBuiltIn < STATIC_TABLE_SIZE( ppcNames )) ) - aName.Assign( ppcNames[ nBuiltIn ] ); - } - maNames.push_back( aName ); - PRINT(); - - if( nFmlaSize && (rIn.GetRecLeft() > 0) ) - { - LINESTART(); - ADDTEXT( "name-definition=" ); - PRINT(); - FormulaDump( nFmlaSize, FT_RangeName ); - } - if( nMenuLen ) - { - LINESTART(); - ADDTEXT( "menu-text=" ); - AddUNICODEString( t, rIn, false, nMenuLen ); - PRINT(); - } - if( nDescrLen ) - { - LINESTART(); - ADDTEXT( "descr-text=" ); - AddUNICODEString( t, rIn, false, nDescrLen ); - PRINT(); - } - if( nHelpLen ) - { - LINESTART(); - ADDTEXT( "help-text=" ); - AddUNICODEString( t, rIn, false, nHelpLen ); - PRINT(); - } - if( nStatusLen ) - { - LINESTART(); - ADDTEXT( "status-text=" ); - AddUNICODEString( t, rIn, false, nStatusLen ); - PRINT(); - } - } - break; - case 0x001D: // SELECTION - list of selections - { - ADDTEXT( "pane: " ); ADDDEC( 1 ); - ADDTEXT( " active cell: " ); - UINT16 nR, nC; - rIn >> nR >> nC; - lcl_AddRef( t, nC, nR ); - ADDTEXT( " active index: " ); ADDDEC( 2 ); - ADDTEXT( " ref count: " ); - UINT16 nCount; - rIn >> nCount; - __AddDec( t, nCount ); - PRINT(); - for( UINT16 nIndex = 0; nIndex < nCount && rIn.IsValid(); nIndex++ ) - { - LINESTART(); - UINT16 nR1, nR2; - UINT8 nC1, nC2; - rIn >> nR1 >> nR2 >> nC1 >> nC2; - ADDTEXT( "ref#" ); __AddDec( t, nIndex, 3 ); - ADDTEXT( ": " ); lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 ); - PRINT(); - } - } - break; - case 0x0023: // EXTERNNAME - { - PreDump( rIn.GetRecSize() ); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0001, "builtin" ); - ADDFLAG( 0x0002, "automatic" ); - ADDFLAG( 0x0004, "wantcliprepr" ); - ADDFLAG( 0x0008, "DDEstddocname" ); - ADDFLAG( 0x0010, "OLE" ); - ADDRESERVED( 0x8000 ); - sal_uInt16 nClip = (__nFlags & 0x7FE0) >> 5; - ADDTEXT( " clip-format=" ); __AddHex( t, nClip ); - PRINT(); LINESTART(); - bool bFormula = false, bArray = false; - if( (__nFlags & 0x0001) || !(__nFlags & 0x7FFE) ) - { - ADDTEXT( "type=external name" ); - ADDTEXT( " table=" ); ADDDEC( 2 ); - ADDTEXT( " reserved=" ); ADDHEX( 2 ); - bFormula = true; - } - else if( __nFlags & 0x0010 ) - { - ADDTEXT( "type=OLE" ); - ADDTEXT( " stream-id=" ); ADDHEX( 4 ); - } - else - { - ADDTEXT( "type=DDE" ); - ADDTEXT( " reserved=" ); ADDHEX( 4 ); - bArray = true; - } - PRINT(); LINESTART(); - ADDTEXT( "name=" ); AddUNICODEString( t, rIn, FALSE ); - PRINT(); - if( rIn.GetRecLeft() > 0 ) - { - LINESTART(); - if( bFormula ) - { - sal_uInt16 nSize = rIn.ReaduInt16(); - ADDTEXT( "formula (size=" ); __AddDec( t, nSize ); - ADDTEXT( "):" ); - PRINT(); - FormulaDump( nSize, FT_RangeName ); - } - else if( bArray && (rIn.GetRecLeft() >= 3) ) - { - LINESTART(); - ADDTEXT( "constant array width=" ); ADDDEC( 1 ); - ADDTEXT( " height=" ); ADDDEC( 2 ); - PRINT(); - while( rIn.GetRecLeft() > 0 ) - { - sal_uInt8 nType = rIn.ReaduInt8(); - LINESTART(); - ADDTEXT( "type=" ); __AddHex( t, nType ); - ADDTEXT( " (" ); - switch( nType ) - { - case 0x00: - ADDTEXT( "empty) reserved=" ); ADDHEX( 4 ); - ADDTEXT( " " ); ADDHEX( 4 ); - break; - case 0x01: - ADDTEXT( "double) value=" ); ADDDOUBLE(); - break; - case 0x02: - ADDTEXT( "string) text=" ); AddUNICODEString( t, rIn ); - break; - case 0x04: - ADDTEXT( "bool) value=" ); lcl_AddFlag( t, rIn.ReaduInt8() ); - ADDTEXT( " reserved=" ); ADDHEX( 1 ); - ADDTEXT( " " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 4 ); - break; - case 0x10: - ADDTEXT( "error) code=" ); ADDHEX( 1 ); - ADDTEXT( " reserved=" ); ADDHEX( 1 ); - ADDTEXT( " " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 4 ); - break; - default: - ADDTEXT( "!unknown!)" ); - rIn.Ignore( 8 ); - } - PRINT(); - } - } - if( rIn.GetRecLeft() > 0 ) - { - LINESTART(); - ADDTEXT( "additional data:" ); - PRINT(); - ContDump( rIn.GetRecLeft() ); - } - } - } - break; - case 0x0026: - case 0x0027: - case 0x0028: - case 0x0029: - LINESTART(); - ADDDOUBLE(); - PRINT(); - break; - case 0x002F: // FILEPASS - { - LINESTART(); - sal_uInt16 nType; - rIn >> nType; - ADDTEXT( "encrypt-type=" ); __AddHex( t, nType ); - ADDTEXT( " (" ); - switch( nType ) - { - case 0x0000: - { - ADDTEXT( "BIFF2-BIFF7 XOR) key=" ); - ADDHEX( 2 ); - ADDTEXT( " hash=" ); - ADDHEX( 2 ); - PRINT(); - } - break; - - case 0x0001: - { - ADDTEXT( "BIFF8 standard/strong)" ); - PRINT(); - LINESTART(); - ADDTEXT( "reserved=" ); ADDHEX( 2 ); - sal_uInt16 nMode; - rIn >> nMode; - ADDTEXT( " mode=" ); __AddHex( t, nMode ); - ADDTEXT( " (" ); - switch( nMode ) - { - case 0x0001: - { - ADDTEXT( "BIFF8 standard)" ); - PRINT(); - LINESTART(); - ADDTEXT( "document-id=..." ); - PRINT(); - ContDump( 16 ); - LINESTART(); - ADDTEXT( "salt-data=..." ); - PRINT(); - ContDump( 16 ); - LINESTART(); - ADDTEXT( "salt-hash=..." ); - PRINT(); - ContDump( 16 ); - } - break; - case 0x0002: - { - ADDTEXT( "BIFF8X strong) flags=" ); - ADDHEX( 4 ); - PRINT(); - LINESTART(); - ADDTEXT( "info-size=" ); ADDHEX( 4 ); - ADDTEXT( " flags=" ); ADDHEX( 4 ); - ADDTEXT( " unknown=" ); ADDHEX( 4 ); - PRINT(); - LINESTART(); - ADDTEXT( "stream-crypt-id=" ); ADDHEX( 4 ); - ADDTEXT( " hash-algo-id=" ); ADDHEX( 4 ); - ADDTEXT( " hash-key-len=" ); ADDDEC( 4 ); - PRINT(); - LINESTART(); - ADDTEXT( "crypt-prov-type=" ); ADDHEX( 4 ); - ADDTEXT( " unknown=" ); ADDHEX( 4 ); - ADDTEXT( " unknown=" ); ADDHEX( 4 ); - PRINT(); - LINESTART(); - ADDTEXT( "crypt-provider-name='" ); - sal_uInt16 nChar; - do - { - rIn >> nChar; - if( nChar ) - t += (sal_Char)(((32 <= nChar) && (nChar <=127)) ? nChar : '.'); - } - while( nChar ); - ADDTEXT( "'" ); - PRINT(); - LINESTART(); - sal_uInt32 nLen; - rIn >> nLen; - ADDTEXT( "*** document-id *** len=" ); __AddHex( t, nLen ); - PRINT(); - ContDump( nLen ); - LINESTART(); - ADDTEXT( "*** salt-data *** len=" ); __AddHex( t, nLen ); - PRINT(); - ContDump( nLen ); - LINESTART(); - rIn >> nLen; - ADDTEXT( "*** salt-hash *** len=" ); __AddHex( t, nLen ); - PRINT(); - ContDump( nLen ); - } - break; - default: - { - ADDTEXT( "!unknown!)" ); - PRINT(); - ContDump( rIn.GetRecLeft() ); - } - } - } - break; - - default: - { - ADDTEXT( "!unknown!)" ); - PRINT(); - ContDump( rIn.GetRecLeft() ); - } - } - } - break; - case 0x0031: // FONT - case 0x0231: - { - LINESTART(); - ADDTEXT( "(index=" ); __AddDec( t, nFontIndex ); - ADDTEXT( ") " ); - nFontIndex++; if( nFontIndex == 4 ) nFontIndex++; - ADDTEXT( "height: " ); ADDDEC( 2 ); - ADDTEXT( "/20pt " ); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0002, "fItalic" ); - ADDFLAG( 0x0008, "fStrikeout" ); - ADDFLAG( 0x0010, "fOutline" ); - ADDFLAG( 0x0020, "fShadow" ); - ADDRESERVED( 0xFFC5 ); - PRINT(); - LINESTART(); - ADDTEXT( "color: " ); ADDDEC( 2 ); - ADDTEXT( " boldness: " ); ADDDEC( 2 ); - ADDTEXT( " sub/sup: " ); ADDDEC( 2 ); - ADDTEXT( " underline: " ); ADDHEX( 1 ); - PRINT(); - LINESTART(); - ADDTEXT( "family: " ); ADDDEC( 1 ); - ADDTEXT( " charset: " ); ADDDEC( 1 ); -// ADDTEXT( " reserved: " ); ADDHEX( 1 ); - rIn.Ignore( 1 ); - ADDTEXT( " " ); - AddUNICODEString( t, rIn, FALSE ); - PRINT(); - } - break; - case 0x003D: // WINDOW1 - { - LINESTART(); - ADDTEXT( "pos-x=" ); ADDDEC( 2 ); - ADDTEXT( " pos-y=" ); ADDDEC( 2 ); - ADDTEXT( " width=" ); ADDDEC( 2 ); - ADDTEXT( " height=" ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0001, "hide-window" ); - ADDFLAG( 0x0002, "min-window" ); - ADDFLAG( 0x0008, "show-hscroll" ); - ADDFLAG( 0x0010, "show-vscroll" ); - ADDFLAG( 0x0020, "show-tabbar" ); - ADDRESERVED( 0xFFC4 ); - PRINT(); - LINESTART(); - ADDTEXT( "active-tab=" ); ADDDEC( 2 ); - ADDTEXT( " first-vis-tab=" ); ADDDEC( 2 ); - ADDTEXT( " selected-tabs=" ); ADDDEC( 2 ); - ADDTEXT( " tabbar-width=" ); ADDDEC( 2 ); - PRINT(); - } - break; - case 0x0041: // PANE - { - LINESTART(); - ADDTEXT( "vert-split-pos=" ); ADDDEC( 2 ); - ADDTEXT( " hor-split-pos=" ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "first-row=" ); ADDDEC( 2 ); - ADDTEXT( " first-col=" ); ADDDEC( 2 ); - ADDTEXT( " active-pane=" ); ADDDEC( 2 ); - PRINT(); - } - break; - case 0x0042: // CODEPAGE - { - LINESTART(); - sal_uInt16 nCodePage = rIn.ReaduInt16(); - ADDTEXT( "codepage=" ); __AddHex( t, nCodePage ); - ADDTEXT( " (" ); __AddDec( t, nCodePage ); - ADDTEXT( ")" ); - PRINT(); - } - break; - case 0x004D: // PLS - { - LINESTART(); - static const sal_Char* const ppcTypes[] = { "Win", "Mac" }; - sal_uInt16 nType = rIn.ReaduInt16(); - ADDTEXT( "environment=" ); - lcl_AddEnum( t, nType, ppcTypes, STATIC_TABLE_SIZE( ppcTypes ) ); - PRINT(); - if( nType == 0 ) - { - String aData; - sal_uInt32 __nFlags; - LINESTART(); - rIn.SetNulSubstChar( '\0' ); - aData = rIn.ReadRawUniString( 32, true ); - ADDTEXT( "device-name='" ); ADDTEXT( GETSTR( aData ) ); - ADDTEXT( "'" ); - PRINT(); LINESTART(); - ADDTEXT( "spec-version=" ); ADDDEC( 2 ); - ADDTEXT( " driver-version=" ); ADDDEC( 2 ); - sal_uInt16 nOwnSize, nPrvSize; - rIn >> nOwnSize >> nPrvSize; - ADDTEXT( " own-size=" ); __AddDec( t, nOwnSize ); - ADDTEXT( " prv-size=" ); __AddDec( t, nPrvSize ); - PRINT(); LINESTART(); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x00000001, "orient" ); - ADDFLAG( 0x00000002, "paper-size" ); - ADDFLAG( 0x00000004, "paper-height" ); - ADDFLAG( 0x00000008, "paper-width" ); - ADDFLAG( 0x00000010, "scale" ); - ADDFLAG( 0x00000100, "copies" ); - ADDRESERVED( 0xE0000080 ); - PRINT(); LINESTART(); - static const sal_Char* const ppcOrient[] = { 0, "portrait", "landsc" }; - sal_uInt16 nOrient = rIn.ReaduInt16(); - ADDTEXT( "orientation=" ); - lcl_AddEnum( t, nOrient, ppcOrient, STATIC_TABLE_SIZE( ppcOrient ) ); - ADDTEXT( " paper-size=" ); ADDDEC( 2 ); - ADDTEXT( " paper-width=" ); ADDDEC( 2 ); - ADDTEXT( " paper-height=" ); ADDDEC( 2 ); - PRINT(); LINESTART(); - ADDTEXT( "scale=" ); ADDDEC( 2 ); - ADDTEXT( " copies=" ); ADDDEC( 2 ); - PRINT(); - if( nOwnSize > 88 ) - { - LINESTART(); ADDTEXT( "additional data:" ); PRINT(); - ContDump( nOwnSize - 88 ); - } - if( nPrvSize > 0 ) - { - LINESTART(); ADDTEXT( "private data:" ); PRINT(); - ContDump( nPrvSize ); - } - } - if( rIn.GetRecLeft() > 0 ) - { - LINESTART(); ADDTEXT( "unknown data:" ); PRINT(); - ContDump( rIn.GetRecLeft() ); - } - } - break; - case 0x51: - { - UINT16 nR1, nR2; - UINT8 nC1, nC2; - rIn >> nR1 >> nR2 >> nC1 >> nC2; - lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 ); - PRINT(); - LINESTART(); - ADDTEXT( "workbook: " ); - AddUNICODEString( t, rIn, TRUE ); - PRINT(); - } - break; - case 0x0052: // DCONNAME - { - ADDTEXT( "name=" ); - AddUNICODEString( t, rIn, TRUE ); - PRINT(); - LINESTART(); - ADDTEXT( "sheet=" ); - AddUNICODEString( t, rIn, TRUE ); - PRINT(); - } - break; - case 0x5B: // FILESHARING - { - PreDump( nL ); - rIn >> __nFlags; - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fReadOnlyRec" ); - PRINT(); - } - DumpValidPassword( rIn, pPre ); - } - break; - case 0x5D: - ObjDump( nL ); - break; - case 0x007D: // COLINFO - col range info - { - LINESTART(); - ADDTEXT( "col range: " ); - ADDDEC( 2 ); - ADDTEXT( "-" ); - ADDDEC( 2 ); - ADDTEXT( " width: " ); - ADDDEC( 2 ); - ADDTEXT( "/256 charwidth ix to XF: " ); - ADDDEC( 2 ); - PRINT(); - rIn >> __nFlags; - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fHidden" ); - ADDTEXT( " outlnlev=" ); - __AddDec( t, (UINT16)((__nFlags & 0x0700) >> 8) ); - ADDFLAG( 0x1000, "fCollapsed" ); - ADDRESERVED( 0xE8FE ); - PRINT(); - LINESTART(); - ADDTEXT( "reserved: " ); - ADDHEX( 1 ); - PRINT(); - } - break; - case 0x7E: - { -// LINESTART(); - ADDCELLHEAD(); - ADDTEXT( " val = " ); - __AddRK( t, rIn.ReadInt32() ); - PRINT(); - } - break; - case 0x0080: // GUTS - row & col gutters for outlines - { - LINESTART(); - ADDTEXT( "size row gutter: " ); - __AddDec( t, Read2( rIn ), 5 ); - ADDTEXT( " | size col gutter: " ); - __AddDec( t, Read2( rIn ), 5 ); - PRINT(); - LINESTART(); - ADDTEXT( "max outline lev: " ); - __AddDec( t, Read2( rIn ), 5 ); - ADDTEXT( " | max outline lev: " ); - __AddDec( t, Read2( rIn ), 5 ); - PRINT(); - } - break; - case 0x0081: // WSBOOL - additional workspace info - { - rIn >> __nFlags; - LINESTART(); - STARTFLAG(); - if( __nFlags & 0x00F1 ) - { - ADDFLAG( 0x0001, "fShowAutoBreaks" ); - ADDFLAG( 0x0010, "fDialog" ); - ADDFLAG( 0x0020, "fApplyStyles" ); - ADDFLAG( 0x0040, "fRowSumsBelow" ); - ADDFLAG( 0x0080, "fColSumsBelow" ); - PRINT(); - LINESTART(); - } - if( __nFlags & (0xCD00 | 0x320E) ) - { - ADDTEXT( " " ); - ADDFLAG( 0x0100, "fFitToPage" ); - ADDFLAG( 0x0400, "fDispRowGuts" ); - ADDFLAG( 0x0800, "fDispColGuts" ); - ADDFLAG( 0x4000, "fAee" ); - ADDFLAG( 0x8000, "fAfe" ); - ADDRESERVED( 0x320E ); - PRINT(); - } - if( !__nFlags ) - PRINT(); - } - break; - case 0x008C: // COUNTRY - { - LINESTART(); - ADDTEXT( "ui-country=" ); ADDDEC( 2 ); - ADDTEXT( " doc-country=" ); ADDDEC( 2 ); - PRINT(); - } - break; - case 0x92: // PALETTE - { - UINT16 nColCnt; - rIn >> nColCnt; - LINESTART(); - ADDTEXT( "count: " ); - __AddDec( t, nColCnt ); - PRINT(); - LINESTART(); - for( UINT16 nCol = 0; nCol < nColCnt; nCol++ ) - { - __AddDec( t, nCol, 2 ); - ADDTEXT( "=" ); - ADDHEX( 4 ); - ADDTEXT( " " ); - if( (nCol % 5 == 4) || (nCol == nColCnt - 1) ) - { - PRINT(); - LINESTART(); - } - } - } - break; - case 0x9D: // AUTOFILTERINFO -- count of drop-down arrows - { - LINESTART(); - ADDTEXT( "count of drop-down arrows: " ); - ADDDEC( 2 ); - PRINT(); - } - break; - case 0x9E: // AUTOFILTER -- autofilter settings - { - UINT8 nType; - UINT8 nCompare; - ByteString sTemp[ 2 ]; - UINT16 nLen[ 2 ] = { 0, 0 }; - UINT8 nF; - LINESTART(); - ADDTEXT( "count: " ); - ADDDEC( 2 ); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0003, "fJoin" ); - ADDFLAG( 0x0004, "fSimpleEq1" ); - ADDFLAG( 0x0008, "fSimpleEq2" ); - ADDFLAG( 0x0010, "fTop10" ); - ADDFLAG( 0x0020, "fTop" ); - ADDFLAG( 0x0040, "fPercent" ); - PRINT(); - LINESTART(); - if( __nFlags & 0x0003 ) - ADDTEXT( "(custom conditions are OR-ed" ); - else - ADDTEXT( "(custom conditions are AND-ed" ); - if( __nFlags & 0x0010 ) - { - if( __nFlags & 0x0020 ) - ADDTEXT( "; show top " ); - else - ADDTEXT( "; show bottom " ); - __AddDec( t, (UINT16)(__nFlags >> 7) ); - if( __nFlags & 0x0040 ) - ADDTEXT( " percent" ); - else - ADDTEXT( " items" ); - } - ADDTEXT( ")" ); - PRINT(); - for( nF = 0; nF < 2; nF++ ) - { - LINESTART(); - __AddDec( t, (UINT16)(nF + 1) ); - ADDTEXT( ". Filter: " ); - rIn >> nType >> nCompare; - switch( nType ) - { - case 0x00: ADDTEXT( "not used " ); break; - case 0x02: ADDTEXT( "RK " ); break; - case 0x04: ADDTEXT( "double " ); break; - case 0x06: ADDTEXT( "string " ); break; - case 0x08: ADDTEXT( "bool/err " ); break; - case 0x0A: ADDTEXT( "show nothing " ); break; - case 0x0C: ADDTEXT( "all blanks " ); break; - case 0x0E: ADDTEXT( "all non-blanks " ); break; - default: - ADDTEXT( "unknown (" ); - __AddHex( t, nType ); - ADDTEXT( ") " ); - } - switch( nCompare ) - { - case 0x01: ADDTEXT( "< " ); break; - case 0x02: ADDTEXT( "= " ); break; - case 0x03: ADDTEXT( "<= " ); break; - case 0x04: ADDTEXT( "> " ); break; - case 0x05: ADDTEXT( "<> " ); break; - case 0x06: ADDTEXT( ">= " ); break; - default: if( nCompare ) __AddHex( t, nCompare ); - } - sTemp[ nF ] = t; - switch( nType ) - { - case 0x02: - __AddRK( sTemp[ nF ], rIn.ReadInt32() ); - IGNORE( 4 ); - break; - case 0x04: - __AddDouble( sTemp[ nF ], Read8( rIn ) ); - break; - case 0x06: - IGNORE( 4 ); - nLen[ nF ] = Read1( rIn ); - IGNORE( 3 ); - break; - case 0x08: - __AddHex( sTemp[ nF ], Read1( rIn ) ); - sTemp[ nF ] += " "; - __AddHex( sTemp[ nF ], Read1( rIn ) ); - IGNORE( 6 ); - break; - default: - IGNORE( 8 ); - } - } - for( nF = 0; nF < 2; nF++ ) - { - t = sTemp[ nF ]; - if( nLen[ nF ] ) - AddUNICODEString( t, rIn, TRUE, nLen[ nF ] ); - PRINT(); - } - } - break; - case 0xA0: - { - UINT16 nN, nD; - rIn >> nN >> nD; - LINESTART(); - ADDTEXT( "Window Zoom Magnification = " ); - __AddDec( t, nN ); - ADDTEXT( "/" ); - __AddDec( t, nD ); - PRINT(); - } - break; - case 0x00A1: // SETUP - { - LINESTART(); - ADDTEXT( "paper size: " ); ADDDEC( 2 ); - ADDTEXT( " scaling: " ); ADDDEC( 2 ); - ADDTEXT( " start page: " ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "fit to width: " ); ADDDEC( 2 ); - ADDTEXT( " fit to height: " ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0001, "fLeftRight" ); - ADDFLAG( 0x0002, "fPortrait" ); - ADDFLAG( 0x0004, "fNoPrintSettings" ); - ADDFLAG( 0x0008, "fMonochrom" ); - ADDFLAG( 0x0010, "fDraft" ); - ADDFLAG( 0x0020, "fNotes" ); - ADDFLAG( 0x0040, "fNoOrientation" ); - ADDFLAG( 0x0080, "fCustomNumber" ); - PRINT(); - LINESTART(); - ADDTEXT( "Print res: " ); ADDDEC( 2 ); - ADDTEXT( " vert print res: " ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "header margin: " ); ADDDOUBLE(); - ADDTEXT( " footer margin: " ); ADDDOUBLE(); - ADDTEXT( " copies: " ); ADDDEC( 2 ); - PRINT(); - } - break; - case 0xAF: - { - UINT16 nCref; - UINT8 nLocked, nHidden, nName, nComment, nNameUser; - rIn >> nCref >> nLocked >> nHidden >> nName >> nComment >> nNameUser; - LINESTART(); - ADDTEXT( "Changing Cells = " ); - __AddDec( t, nCref ); - if( nLocked ) - ADDTEXT( " fLocked" ); - if( nHidden ) - ADDTEXT( " fHidden" ); - PRINT(); - LINESTART(); - ADDTEXT( "Name = " ); - __AddDec( t, nName ); - ADDTEXT( " Comment = " ); - __AddDec( t, nComment ); - ADDTEXT( " Name User = " ); - __AddDec( t, nNameUser ); - PRINT(); - ContDump( rIn.GetRecLeft() ); - } - break; - case 0xB0: // SXVIEW - { - UINT16 nColFirst, nColLast, nRowFirst, nRowLast; - rIn >> nRowFirst >> nRowLast >> nColFirst >> nColLast; - nSXLIIndex = 0; // new pivot table - LINESTART(); - ADDTEXT( "PivotTable: " ); __AddDec( t, nColFirst ); - ADDTEXT( " / " ); __AddDec( t, nRowFirst ); - ADDTEXT( " - " ); __AddDec( t, nColLast ); - ADDTEXT( " / " ); __AddDec( t, nRowLast ); - PRINT(); - LINESTART(); - ADDTEXT( "1st Head: " ); ADDDEC( 2 ); - rIn >> nRowFirst; - ADDTEXT( " First Data: " ); ADDDEC( 2 ); - ADDTEXT( " / " ); __AddDec( t, nRowFirst ); - PRINT(); - LINESTART(); - ADDTEXT( "Cache index: " ); ADDDEC( 2 ); - ADDTEXT( " reserved: " ); ADDHEX( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "axis 4 data: " ); ADDDEC( 2 ); - ADDTEXT( " pos 4 Data: " ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "num of fields: " ); ADDDEC( 2 ); - rIn >> nSXLISize[0] >> nSXLISize[1]; - ADDTEXT( " ...row fields: " ); __AddDec( t, nSXLISize[0] ); - ADDTEXT( " ...col fields: " ); __AddDec( t, nSXLISize[1] ); - PRINT(); - LINESTART(); - ADDTEXT( "num of page fields: " ); ADDDEC( 2 ); - ADDTEXT( " ...data fields: " ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "data rows: " ); ADDDEC( 2 ); - ADDTEXT( " data cols: " ); ADDDEC( 2 ); - rIn >> __nFlags; - PRINT(); - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fRowGrand" ); - ADDFLAG( 0x0002, "fColGrand" ); - ADDFLAG( 0x0008, "fAutoFormat" ); - ADDFLAG( 0x0010, "fWidthHeightAuto" ); - ADDFLAG( 0x0020, "fFontAuto" ); - ADDFLAG( 0x0040, "fAlignAuto" ); - ADDFLAG( 0x0080, "fBorderAuto" ); - ADDFLAG( 0x0100, "fPatternAuto" ); - ADDFLAG( 0x0200, "fNumberAuto" ); - PRINT(); - } - LINESTART(); - ADDTEXT( "index 2 PivotTable autoform: " ); - ADDDEC( 2 ); - PRINT(); - LINESTART(); - UINT16 nTableLen = Read2( rIn ); - UINT16 nDataLen = Read2( rIn ); - ADDTEXT( "PivotTable name: " ); - if( nTableLen ) - AddUNICODEString( t, rIn, TRUE, nTableLen ); - else - ADDTEXT( "-/-" ); - PRINT(); - LINESTART(); - ADDTEXT( "data field name: " ); - if( nDataLen ) - AddUNICODEString( t, rIn, TRUE, nDataLen ); - else - ADDTEXT( "-/-" ); - PRINT(); - } - break; - case 0xB1: // SXVD - { - rIn >> __nFlags; - LINESTART(); - ADDTEXT( "Axis (" ); - __AddHex( t, __nFlags ); - ADDTEXT( "):" ); - if( __nFlags ) - { - ADDFLAG( 0x0001, "row" ); - ADDFLAG( 0x0002, "col" ); - ADDFLAG( 0x0004, "page" ); - ADDFLAG( 0x0008, "data" ); - } - else - ADDTEXT( " no axis" ); - ADDTEXT( " num of att. subtotals: " ); - ADDDEC( 2 ); - PRINT(); - rIn >> __nFlags; - LINESTART(); - ADDTEXT( "subtotal type(" ); - __AddHex( t, __nFlags ); - ADDTEXT( "):" ); - if( __nFlags ) - { - ADDFLAG( 0x0001, "Default" ); - ADDFLAG( 0x0002, "Sum" ); - ADDFLAG( 0x0004, "Counta" ); - ADDFLAG( 0x0008, "Average" ); - ADDFLAG( 0x0010, "Max" ); - ADDFLAG( 0x0020, "Min" ); - ADDFLAG( 0x0040, "Product" ); - ADDFLAG( 0x0080, "Count" ); - ADDFLAG( 0x0100, "Stdev" ); - ADDFLAG( 0x0200, "Stddevp" ); - ADDFLAG( 0x0400, "Var" ); - ADDFLAG( 0x0800, "Varp" ); - } - else - ADDTEXT( " none" ); - PRINT(); - LINESTART(); - ADDTEXT( "num of items: " ); - ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "Name: " ); - UINT16 nLen = Read2( rIn ); - if( nLen == 0xFFFF ) - ADDTEXT( "<name in cache>" ); - else if( nLen ) - AddUNICODEString( t, rIn, TRUE, nLen ); - PRINT(); - } - break; - case 0xB2: // SXVI - { - UINT16 nType, nCache; - rIn >> nType >> __nFlags >> nCache; - LINESTART(); - switch( nType ) - { - case 0xFE: p = "Page"; break; - case 0xFF: p = "Null"; break; - case 0x00: p = "Data"; break; - case 0x01: p = "Default"; break; - case 0x02: p = "SUM"; break; - case 0x03: p = "COUNT"; break; - case 0x04: p = "AVERAGE"; break; - case 0x05: p = "MAX"; break; - case 0x06: p = "MIN"; break; - case 0x07: p = "PRODUCT"; break; - case 0x08: p = "COUNTA"; break; - case 0x09: p = "STDEV"; break; - case 0x0A: p = "STDEVP"; break; - case 0x0B: p = "VAR"; break; - case 0x0C: p = "VARP"; break; - case 0x0D: p = "Grand total"; break; - default: p = pU; - } - ADDTEXT( "Type (" ); - __AddHex( t, nType ); - ADDTEXT( "): " ); - ADDTEXT( p ); - ADDTEXT( " iCache: " ); - __AddDec( t, nCache ); - PRINT(); - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x01, "fHidden" ); - ADDFLAG( 0x02, "fHideDetail" ); - ADDFLAG( 0x04, "fFormula" ); - ADDFLAG( 0x08, "fMissing" ); - PRINT(); - } - LINESTART(); - ADDTEXT( "Name: " ); - UINT16 nCch = Read2( rIn ); - if( nCch == 0xFFFF ) - ADDTEXT( "<name in cache>" ); - else if( nCch ) - AddUNICODEString( t, rIn, TRUE, nCch ); - else - ADDTEXT( "<empty string>" ); - PRINT(); - } - break; - case 0xB4: // SXIVD - { - const UINT16 nBrkNum = 5; - UINT16 nBrk = nBrkNum; - UINT16 nSize = (UINT16)(nL / 2); - LINESTART(); - for( UINT16 i = 0; i < nSize; i++ ) - { - ADDHEX( 2 ); - nBrk--; - if( nBrk ) - ADDTEXT( " " ); - else - { - PRINT(); - LINESTART(); - nBrk = nBrkNum; - } - } - if( nBrk < nBrkNum ) PRINT(); - } - break; - case 0xB5: // SXLI - pivot table line item array - { - UINT16 nIdent; - UINT16 nType; - UINT16 nMaxInd; - const sal_Char* pInd = " "; - const sal_Char* pType[] = { - "Data", "Default", "SUM", "COUNT","AVERAGE", - "MAX", "MIN", "PRODUCT", "COUNTA", "STDEV", - "STDEVP", "VAR", "VARP", "Grand total", - "Blank line" }; // undocumented - while( rIn.GetRecLeft() > 0 ) - { - rIn >> nIdent >> nType >> nMaxInd >> __nFlags; - LINESTART(); - ADDTEXT( "# of ident. items: " ); - __AddDec( t, nIdent ); - ADDTEXT( " Type (" ); - __AddHex( t, nType ); - ADDTEXT( "): " ); - if( nType > 0x0E ) - p = pU; - else - p = pType[ nType ]; - ADDTEXT( p ); - ADDTEXT( " relevant indexes: " ); - __AddDec( t, nMaxInd ); - PRINT(); - LINESTART(); - ADDTEXT( pInd ); - STARTFLAG(); - ADDFLAG( 0x0001, "fMultiDataName" ); - ADDFLAG( 0x0200, "fSub" ); - ADDFLAG( 0x0400, "fBlock" ); - ADDFLAG( 0x0800, "fGrand" ); - ADDFLAG( 0x1000, "fMultiDataOnAxis" ); - ADDFLAG( 0x2000, "fBlankLine" ); // undocumented - ADDFLAG( 0x4000, "fHideDetail" ); // undocumented - ADDRESERVED( 0x8000 ); - PRINT(); - LINESTART(); - ADDTEXT( pInd ); - ADDTEXT( "index to data field: " ); - __AddDec( t, (UINT16) ( (__nFlags & 0x01FE) >> 1 ) ); - PRINT(); - LINESTART(); - ADDTEXT( pInd ); - ADDTEXT( "array of " ); - __AddDec( t, nSXLISize[nSXLIIndex] ); - ADDTEXT( " indexes (^ are ident., * are irrelevant):" ); - PRINT(); - LINESTART(); - ADDTEXT( pInd ); - ADDTEXT( " " ); - const UINT16 nBrkNum = 5; - UINT16 nBrk = nBrkNum; - for( UINT16 i = 0; i < nSXLISize[nSXLIIndex]; i++ ) - { - __AddDec( t, Read2( rIn ), 7 ); - if( i < nIdent ) - ADDTEXT( "^" ); - else if( i < nMaxInd ) - ADDTEXT( " " ); - else - ADDTEXT( "*" ); - nBrk--; - if( !nBrk ) - { - PRINT(); - LINESTART(); - ADDTEXT( pInd ); - ADDTEXT( " " ); - nBrk = nBrkNum; - } - } - if( nBrk < nBrkNum ) - PRINT(); - } - nSXLIIndex = 1 - nSXLIIndex; - } - break; - case 0xB6: // SXPI - pivot table page item(s) - { - UINT16 nArrayCnt = (UINT16)(nL / 6); - LINESTART(); - __AddDec( t, nArrayCnt ); - ADDTEXT( " page items:" ); - PRINT(); - for( UINT16 iArray = 0; iArray < nArrayCnt; iArray++ ) - { - LINESTART(); - ADDTEXT( "index SXVD: " ); - __AddDec( t, Read2( rIn ), 3 ); - ADDTEXT( " index SXVI: " ); - UINT16 nSXVIInd; - rIn >> nSXVIInd; - __AddDec( t, nSXVIInd, 5 ); - if( nSXVIInd == 32765 ) - ADDTEXT( " (All items) Obj ID: " ); - else - ADDTEXT( " Obj ID: " ); - ADDHEX( 2 ); - PRINT(); - } - } - break; - case 0xBD: - { - UINT16 nC, nR, nXF; - INT32 nRK; - UINT16 n = (UINT16)((nL - 4) / 6); - - rIn >> nR >> nC; - while( n ) - { - rIn >> nXF >> nRK; - LINESTART(); - __AddCellHead( t, nC, nR, nXF ); - ADDTEXT( " val = " ); - __AddRK( t, nRK ); - PRINT(); - nC++; - n--; - } - } - break; - case 0xBE: - { - LINESTART(); - ADDCELLHEAD(); - PRINT(); - LINESTART(); - ADDTEXT( "next XFs: " ); - UINT16 n = (UINT16)((nL - 6) / 2); - while( n ) - { - __AddDec( t, Read2( rIn ) ); - n--; - if( n ) - ADDTEXT( ' ' ); - } - PRINT(); - } - break; - case 0x00C5: // SXDI - { - LINESTART(); - ADDTEXT( "Field: " ); - ADDDEC( 2 ); - UINT16 nFunc = Read2( rIn ); - ADDTEXT( " aggregation func (" ); - __AddHex( t, nFunc ); - ADDTEXT( "): " ); - const sal_Char* pFunc[] = { "Sum", "Count", "Average", "Max", "Min", - "Product", "Count Nums", "StdDev", "StdDevp", "Var", - "Varp" }; - p = (nFunc > 0x0A) ? pU : pFunc[ nFunc ]; - ADDTEXT( p ); - ADDTEXT( " display format (" ); - const sal_Char* pDispl[] = { - "Normal", "Difference", "Percentage of", "Percentage difference from", "Running total in", - "Percentage of row", "Percentage of column", "Percentage of total", "Index" }; - UINT16 nDispl = Read2( rIn ); - __AddHex( t, nDispl ); - ADDTEXT( "): " ); - p = (nDispl > 0x08) ? pU : pDispl[ nDispl ]; - ADDTEXT( p ); - PRINT(); - LINESTART(); - ADDTEXT( "ind. to SXVD: " ); ADDDEC( 2 ); - ADDTEXT( " ind. to SXVI: " ); ADDDEC( 2 ); - ADDTEXT( " num format: " ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "name: " ); - UINT16 nCch = Read2( rIn ); - if( nCch == 0xFFFF ) - ADDTEXT( "<name in cache>" ); - else if( nCch ) - AddUNICODEString( t, rIn, TRUE, nCch ); - else - ADDTEXT( "<empty string>" ); - PRINT(); - } - break; - case 0x00C6: // SXDB - cache info - { - ADDTEXT( "number of recs: " ); ADDDEC( 4 ); - ADDTEXT( " stream id: " ); ADDHEX( 2 ); - ADDTEXT( " flags: " ); ADDHEX( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "DB block recs: " ); ADDDEC( 2 ); - ADDTEXT( " base fields: " ); ADDDEC( 2 ); - ADDTEXT( " all fields: " ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "reserved: " ); ADDHEX( 2 ); - ADDTEXT( " type: " ); ADDHEX( 2 ); - ADDTEXT( " changed by:" ); - PRINT(); - LINESTART(); - AddUNICODEString( t, rIn ); - PRINT(); - } - break; - case 0x00C7: // SXFIELD - Pivot Field - { - nItemCnt = 0; - - ADDTEXT( "#" ); - __AddDec( t, nFieldCnt, 3 ); - nFieldCnt++; - ADDTEXT( " (pivot field): " ); - if( rIn.GetRecLeft() < 14 ) - { - ADDTEXT( "<break in pivot field start>" ); - PRINT(); - } - else - { - PRINT(); - LINESTART(); - ADDTEXT( pPre ); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0001, "fOrigItems" ); - ADDFLAG( 0x0002, "fPostponed" ); - ADDFLAG( 0x0004, "fCalculated" ); - ADDFLAG( 0x0008, "fGroupChild" ); - ADDFLAG( 0x0010, "fNumGroup" ); - ADDFLAG( 0x0200, "fLongIndex" ); - ADDFLAG( 0x1000, "f1000?" ); - ADDFLAG( 0x8000, "f8000?" ); - ADDRESERVED( 0x6000 ); - ADDTEXT( " data-type=" ); - __AddHex( t, static_cast< sal_uInt16 >( __nFlags & 0x0DE0 ) ); - ADDTEXT( "=" ); - switch( __nFlags & 0x0DE0 ) - { - case 0x0000: ADDTEXT( "spc" ); break; - case 0x0480: ADDTEXT( "str" ); break; - case 0x0520: ADDTEXT( "int[+dbl]" ); break; - case 0x0560: ADDTEXT( "dbl" ); break; - case 0x05A0: ADDTEXT( "str+int[+dbl]" ); break; - case 0x05E0: ADDTEXT( "str+dbl" ); break; - case 0x0900: ADDTEXT( "dat" ); break; - case 0x0D00: ADDTEXT( "dat+int/dbl" ); break; - case 0x0D80: ADDTEXT( "dat+str[+int/dbl]" ); break; - default: ADDTEXT( pU ); - } - PRINT(); - LINESTART(); - ADDTEXT( pPre ); - ADDTEXT( "group-subfield=" ); ADDDEC( 2 ); - ADDTEXT( " group-basefield=" ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( pPre ); - ADDTEXT( "item-count=" ); ADDDEC( 2 ); - ADDTEXT( " group-item-count=" ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( pPre ); - ADDTEXT( "base-item-count=" ); ADDDEC( 2 ); - ADDTEXT( " source-item-count=" ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( pPre ); - if( rIn.GetRecLeft() < 3 ) - { - ADDTEXT( "<break in pivot field name>" ); - PRINT(); - } - else - { - ADDTEXT( "name=" ); - AddUNICODEString( t, rIn ); - PRINT(); - } - } - } - break; - case 0x00C8: // SXINDEXLIST - indexes to source data - { - ADDTEXT( "#" ); - __AddDec( t, nTabIndexCnt, 3 ); - nTabIndexCnt++; - ADDTEXT( " (index list):" ); - for( UINT16 iIndex = 0; iIndex < rIn.GetRecSize(); iIndex++ ) - { - ADDTEXT( " " ); - ADDHEX( 1 ); - } - PRINT(); - } - break; - case 0x00C9: // SXDOUBLE - cache entry: double value - { - ADDTEXT( "#" ); - __AddDec( t, nItemCnt, 3 ); - ADDTEXT( " (double): " ); - nItemCnt++; - ADDTEXT( " " ); - ADDDOUBLE(); - PRINT(); - } - break; - case 0x00CA: // SXBOOLEAN - cache entry: boolean value - { - ADDTEXT( "#" ); - __AddDec( t, nItemCnt, 3 ); - ADDTEXT( " (boolean): " ); - nItemCnt++; - ADDTEXT( " " ); - lcl_AddFlag( t, rIn.ReaduInt16() != 0 ); - PRINT(); - } - break; - case 0x00CB: // SXERROR - cache entry: error code - { - ADDTEXT( "#" ); - __AddDec( t, nItemCnt, 3 ); - ADDTEXT( " (error): " ); - nItemCnt++; - ADDTEXT( " " ); - ADDHEX( 2 ); - PRINT(); - } - break; - case 0x00CC: // SXINTEGER - signed 16bit integer - { - ADDTEXT( "#" ); - __AddDec( t, nItemCnt, 3 ); - ADDTEXT( " (integer): " ); - nItemCnt++; - ADDTEXT( " " ); - ADDDEC( 2 ); - PRINT(); - } - break; - case 0x00CD: // SXSTRING - String - { - if( bSubStream ) - { - ADDTEXT( "#" ); - __AddDec( t, nItemCnt, 3 ); - ADDTEXT( " (string): " ); - nItemCnt++; - } - AddUNICODEString( t, rIn ); - PRINT(); - } - break; - case 0x00CE: // SXDATETIME - date & time special format - { - ADDTEXT( "#" ); - __AddDec( t, nItemCnt, 3 ); - ADDTEXT( " (date/time): " ); - nItemCnt++; - UINT8 nDay, nHour, nMin, nSec; - UINT16 nYear, nMonth; - rIn >> nYear >> nMonth >> nDay >> nHour >> nMin >> nSec; - if( nDay ) - { - __AddDec( t, nDay ); - ADDTEXT( "." ); - __AddDec( t, nMonth ); - ADDTEXT( "." ); - __AddDec( t, nYear ); - ADDTEXT( " " ); - } - __AddDec( t, nHour, 2, '0' ); - ADDTEXT( ":" ); - __AddDec( t, nMin, 2, '0' ); - ADDTEXT( ":" ); - __AddDec( t, nSec, 2, '0' ); - PRINT(); - } - break; - case 0x00CF: // SXEMPTY - cache entry: empty - { - ADDTEXT( "#" ); - __AddDec( t, nItemCnt, 3 ); - ADDTEXT( " (empty): " ); - nItemCnt++; - PRINT(); - } - break; - case 0x00D5: // SXIDSTM - pivot table cache stream id - { - LINESTART(); - UINT16 nStrId = Read2( rIn ); - ADDTEXT( "Stream ID: " ); - __AddHex( t, nStrId ); - PRINT(); - DumpRecordStream( OpenStorage( EXC_STORAGE_PTCACHE ), ScfTools::GetHexStr( nStrId ), EMPTY_STRING ); - } - break; - case 0x00D8: // SXNUMGROUP - numerical grouping in pivot cache field - { - LINESTART(); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0001, "fAutoMin" ); - ADDFLAG( 0x0002, "fAutoMax" ); - ADDTEXT( " data-type=" ); - switch( (__nFlags & 0x003C) >> 2 ) - { - case 0x0001: ADDTEXT( "seconds" ); break; - case 0x0002: ADDTEXT( "minutes" ); break; - case 0x0003: ADDTEXT( "hours" ); break; - case 0x0004: ADDTEXT( "days" ); break; - case 0x0005: ADDTEXT( "months" ); break; - case 0x0006: ADDTEXT( "quarters" ); break; - case 0x0007: ADDTEXT( "years" ); break; - case 0x0008: ADDTEXT( "numeric" ); break; - default: ADDTEXT( pU ); - } - (__nFlags &= 0xFFC0) >>= 6; - ADDTEXT( " remaining=" ); __AddHex( t, __nFlags ); - ADDTEXT( "=" ); __AddDec( t, __nFlags ); - PRINT(); - } - break; - case 0xE0: - DumpXF( rIn, pPre ); - break; - case 0xE3: - { - LINESTART(); - ADDTEXT( "view source (" ); - UINT16 n = Read2( rIn ); - __AddHex( t, n ); - ADDTEXT( "): " ); - switch( n ) - { - case 0x01: p = "M$ Excel list or database"; break; - case 0x02: p = "external data source"; break; - case 0x04: p = "multiple consolidation ranges"; break; - case 0x08: p = "pivot table"; break; - case 0x10: p = "scenario manager summary report"; break; - default: p = pU; - } - ADDTEXT( p ); - PRINT(); - } - break; - case 0x00E5: // CELLMERGING - { - UINT16 nCount, nInd; - UINT16 nRow1, nRow2, nCol1, nCol2; - rIn >> nCount; - LINESTART(); - ADDTEXT( "Count: " ); - __AddDec( t, nCount ); - PRINT(); - LINESTART(); - for( nInd = 0; nInd < 3; nInd++ ) - ADDTEXT( " row - row / col-col | " ); - PRINT(); - LINESTART(); - if( (ULONG)(nCount * 8 + 2) == nL ) - { - for( nInd = 0; nInd < nCount; nInd++ ) - { - rIn >> nRow1 >> nRow2 >> nCol1 >> nCol2; - __AddDec( t, nRow1, 5 ); - ADDTEXT( "-" ); - __AddDec( t, nRow2, 5 ); - ADDTEXT( " / " ); - __AddDec( t, nCol1, 3 ); - ADDTEXT( "-" ); - __AddDec( t, nCol2, 3 ); - ADDTEXT( " | " ); - if( (nInd % 3 == 2) || (nInd == nCount - 1) ) - { - PRINT(); - LINESTART(); - } - } - } - else - { - LINESTART(); - ADDTEXT( "<Wrong record length!>" ); - PRINT(); - } - } - break; - case 0xEB: - case 0xEC: - case 0xED: - EscherDump( nL, true ); - break; - case 0x00F6: // SXNAME - { - LINESTART(); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0002, "fNameErr" ); - ADDRESERVED( 0xFFFD ); - ADDTEXT( " field=" ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - sal_Int16 nFunc; - rIn >> nFunc; - ADDTEXT( "function=" ); __AddHex( t, (INT32)nFunc ); - static const sal_Char* const ppcFuncs[] = { - "none", 0, "sum", "counta", "count", "average", "max", "min", - "product", "stdev", "stdevp", "var", "varp" }; - lcl_AddEnum( t, nFunc, ppcFuncs, STATIC_TABLE_SIZE( ppcFuncs ), 0, -1 ); - ADDTEXT( " SXPAIR-count=" ); ADDDEC( 2 ); - PRINT(); - } - break; - case 0x00F9: // SXFMLA - { - LINESTART(); - sal_uInt16 nSize; - rIn >> nSize; - ADDTEXT( "formula-size=" ); __AddDec( t, nSize ); - ADDTEXT( " SXNAME-count=" ); ADDDEC( 2 ); - PRINT(); - FormulaDump( nSize, FT_RangeName ); - } - break; - case 0xFC: - { - UINT16 nCnt = 0; - BOOL bOK = TRUE; - ContDump( 8 ); - - while( bOK && (rIn.GetRecLeft() > 0) ) - { - LINESTART(); - __AddDec( t, nCnt ); - ADDTEXT( ": " ); - bOK = AddUNICODEString( t, rIn ); - PRINT(); - nCnt++; - } - } - break; - case 0xFD: - { - LINESTART(); - ADDCELLHEAD(); - ADDTEXT( " sst = " ); - ADDDEC(4); - PRINT(); - } - break; - case 0x0100: // SXVDEX - { - LINESTART(); - sal_uInt32 __nFlags = Read4( rIn ); - STARTFLAG(); - if( __nFlags & 0x0000009F ) - { - ADDFLAG( 0x00000001, "fShowAllItems" ); - ADDFLAG( 0x00000002, "fDragToRow" ); - ADDFLAG( 0x00000004, "fDragToColumn" ); - ADDFLAG( 0x00000008, "fDragToPage" ); - ADDFLAG( 0x00000010, "fDragToHide" ); - ADDFLAG( 0x00000080, "fServerBased" ); - PRINT(); - LINESTART(); - } - if( __nFlags & 0x00007E00 ) - { - ADDTEXT( " " ); - ADDFLAG( 0x00000200, "fAutoSort" ); - ADDFLAG( 0x00000400, "fAscendSort" ); - ADDFLAG( 0x00000800, "fAutoShow" ); - ADDFLAG( 0x00001000, "fAscendShow" ); - ADDFLAG( 0x00002000, "fCalculatedField" ); - ADDFLAG( 0x00004000, "fLONewPage" ); // undocumented - PRINT(); - LINESTART(); - } - if( __nFlags & 0xFFE00000 ) - { - ADDTEXT( " " ); // Layout flags: - ADDFLAG( 0x00200000, "fLOReport" ); // undocumented - ADDFLAG( 0x00400000, "fLOBlankLine" ); // undocumented - ADDFLAG( 0x00800000, "fLOSubTotalTop" ); // undocumented - ADDTEXT( " show-items=" ); __AddDec( t, sal_uInt32( __nFlags >> 24 ) ); - PRINT(); - LINESTART(); - } - if( __nFlags & 0x001F8160 ) - { - ADDTEXT( " !RESERVED!" ); - PRINT(); - } - if( !__nFlags ) - PRINT(); - LINESTART(); - ADDTEXT( " sort-field=" ); - ADDDEC( 2 ); - ADDTEXT( " show-field=" ); - ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "format=" ); - UINT16 n = Read2( rIn ); - if( n ) - __AddDec( t, n ); - else - ADDTEXT( "none" ); - PRINT(); - } - break; - case 0x0122: // SXDBEX - ext. cache info - { - ADDTEXT( "last changed: " ); ADDDOUBLE(); - ADDTEXT( " SXFORMULA recs: " ); ADDDEC( 4 ); - PRINT(); - } - break; - case 0x0138: // CHTRINFO - change tracking info - { - rIn.DisableDecryption(); - ADDTEXT( "14 bytes of unknown data..." ); - PRINT(); - ContDump( 14 ); - LINESTART(); - ADDTEXT( "16 bytes unknown identification:" ); - PRINT(); - ContDump( 16 ); - LINESTART(); - ADDTEXT( "unknown: " ); ADDHEX( 2 ); - ADDTEXT( " user: " ); - if( rIn.GetRecLeft() > 3 ) - AddUNICODEString( t, rIn ); - PRINT(); - LINESTART(); - __AddDec( t, (UINT16)(rIn.GetRecLeft() - 10) ); - ADDTEXT( " bytes of unknown data..." ); - PRINT(); - ContDump( rIn.GetRecLeft() - 10 ); - LINESTART(); - ADDTEXT( "date/time: " ); ADDDEC( 2 ); - ADDTEXT( "-" ); ADDDEC( 1 ); - ADDTEXT( "-" ); ADDDEC( 1 ); - ADDTEXT( " " ); ADDDEC( 1 ); - ADDTEXT( ":" ); ADDDEC( 1 ); - ADDTEXT( ":" ); ADDDEC( 1 ); - ADDTEXT( " unknown: " ); ADDHEX( 1 ); - ADDTEXT( " " ); ADDHEX( 2 ); - PRINT(); - } - break; - case 0x0137: // CHTRINSERT - change tracking: insert/remove - { - ADDTEXT( "len: " ); ADDDEC( 4 ); - ADDTEXT( " index: " ); ADDDEC( 4 ); - ADDTEXT( " op: " ); - UINT16 nOp; - rIn >> nOp; - switch( nOp ) - { - case 0x0000: ADDTEXT( "insert row" ); break; - case 0x0001: ADDTEXT( "insert column" ); break; - case 0x0002: ADDTEXT( "delete row" ); break; - case 0x0003: ADDTEXT( "delete column" ); break; - default: - __AddHex( t, nOp ); - ADDTEXT( " *UNKNOWN*" ); - } - ADDTEXT( " accept: " ); ADDHEX( 2 ); - ADDTEXT( " tab: " ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - UINT16 __nFlags = Read2( rIn ); - STARTFLAG(); - ADDFLAG( 0x0001, "fAuto" ); - ADDRESERVED( 0xFFFE ); - UINT16 nCol1, nRow1, nCol2, nRow2; - rIn >> nRow1 >> nRow2 >> nCol1 >> nCol2; - ADDTEXT( " range: " ); lcl_AddRangeRef( t, nCol1, nRow1, nCol2, nRow2 ); - ADDTEXT( " unknown: " ); ADDHEX( 4 ); - PRINT(); - } - break; - case 0x013B: // CHTRCELLCONTENT: change tracking: changed cell - { - PreDump( nL ); - ADDTEXT( "len: " ); ADDDEC( 4 ); - ADDTEXT( " index: " ); ADDDEC( 4 ); - ADDTEXT( " opcode: " ); ADDHEX( 2 ); - ADDTEXT( " accept: " ); ADDHEX( 2 ); - ADDTEXT( " tab: " ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - UINT16 nChg, nOldType, nNewType; - rIn >> nChg; - nOldType = (nChg & 0x0038) >> 3; - nNewType = nChg & 0x0007; - ADDTEXT( "change (" ); __AddHex( t, nChg ); - ADDTEXT( "): " ); - switch( nOldType ) - { - case 0x0000: ADDTEXT( "empty->" ); break; - case 0x0001: ADDTEXT( "RK->" ); break; - case 0x0002: ADDTEXT( "double->" ); break; - case 0x0003: ADDTEXT( "string->" ); break; - case 0x0004: ADDTEXT( "bool->" ); break; - case 0x0005: ADDTEXT( "formula->" ); break; - default: ADDTEXT( "*UNKNOWN*->" ); - } - switch( nNewType ) - { - case 0x0000: ADDTEXT( "empty" ); break; - case 0x0001: ADDTEXT( "RK" ); break; - case 0x0002: ADDTEXT( "double" ); break; - case 0x0003: ADDTEXT( "string" ); break; - case 0x0004: ADDTEXT( "bool" ); break; - case 0x0005: ADDTEXT( "formula" ); break; - default: ADDTEXT( "*UNKNOWN*" ); - } - UINT16 nFormatData = (nChg & 0xFF00); - if( (nFormatData == 0x1100) || (nFormatData == 0x1300) ) - ADDTEXT( "; contains add. data" ); - ADDTEXT( " format: " ); ADDHEX( 2 ); - UINT16 nCol, nRow; - rIn >> nRow >> nCol; - ADDTEXT( " address: " ); lcl_AddRef( t, nCol, nRow ); - PRINT(); - LINESTART(); - UINT16 nOldLen; - rIn >> nOldLen; - ADDTEXT( "old value len: " ); __AddHex( t, nOldLen ); - if( nOldType == 0x0003 ) - nOldLen >>= 1; - ADDTEXT( " unknown: " ); ADDHEX( 4 ); - PRINT(); - UINT16 nCount = 0; - switch( nFormatData ) - { - case 0x1100: nCount = 8; break; - case 0x1300: nCount = 4; break; - } - if( nCount ) - { - LINESTART(); - ADDTEXT( "additional format data:" ); - for( UINT16 nIndex = 0; nIndex < nCount; nIndex ++ ) - { - ADDTEXT( " " ); - ADDHEX( 2 ); - } - PRINT(); - } - if( nOldType ) - { - LINESTART(); - ADDTEXT( "old value: " ); - switch( nOldType ) - { - case 0x0001: - __AddRK( t, rIn.ReadInt32() ); - PRINT(); - break; - case 0x0002: - ADDDOUBLE(); - PRINT(); - break; - case 0x0003: - AddUNICODEString( t, rIn ); - PRINT(); - break; - case 0x0004: - if( Read2( rIn ) ) - ADDTEXT( "true" ); - else - ADDTEXT( "false" ); - PRINT(); - break; - case 0x0005: - { - PRINT(); - UINT16 nLen; - rIn >> nLen; - FormulaDump( nLen, FT_CellFormula ); - IGNORE( 1 ); - } - break; - } - } - if( nNewType ) - { - LINESTART(); - ADDTEXT( "new value: " ); - switch( nNewType ) - { - case 0x0001: - __AddRK( t, rIn.ReadInt32() ); - PRINT(); - break; - case 0x0002: - ADDDOUBLE(); - PRINT(); - break; - case 0x0003: - AddUNICODEString( t, rIn ); - PRINT(); - break; - case 0x0004: - if( Read2( rIn ) ) - ADDTEXT( "true" ); - else - ADDTEXT( "false" ); - PRINT(); - break; - case 0x0005: - { - PRINT(); - UINT16 nLen; - rIn >> nLen; - FormulaDump( nLen, FT_CellFormula ); - IGNORE( 1 ); - } - break; - } - } - if( rIn.GetRecLeft() > 0 ) - { - LINESTART(); - ADDTEXT( "*UNKNOWN* data:" ); - PRINT(); - PreDump( rIn.GetRecLeft() ); - } - } - break; - case 0x013D: // TABID - { - ADDTEXT( "tab ids:" ); - while( rIn.GetRecLeft() ) - { - ADDTEXT( " " ); - ADDDEC( 2 ); - } - PRINT(); - } - break; - case 0x0140: // CHTRMOVE - change tracking: moved range - { - ADDTEXT( "len: " ); ADDDEC( 4 ); - ADDTEXT( " index: " ); ADDDEC( 4 ); - ADDTEXT( " opcode: " ); ADDHEX( 2 ); - ADDTEXT( " accept: " ); ADDHEX( 2 ); - PRINT(); - UINT16 nTab1, nTab2; - UINT16 nCol11, nCol12, nCol21, nCol22; - UINT16 nRow11, nRow12, nRow21, nRow22; - rIn >> nTab2 >> nRow11 >> nRow12 >> nCol11 >> nCol12 >> nRow21 >> nRow22 >> nCol21 >> nCol22 >> nTab1; - LINESTART(); - ADDTEXT( "move range from: tab=" ); __AddDec( t, nTab1 ); - ADDTEXT( " " ); lcl_AddRangeRef( t, nCol11, nRow11, nCol12, nRow12 ); - ADDTEXT( " to: tab=" ); __AddDec( t, nTab2 ); - ADDTEXT( " " ); lcl_AddRangeRef( t, nCol21, nRow21, nCol22, nRow22 ); - ADDTEXT( " unknown: " ); ADDHEX( 4 ); - PRINT(); - } - break; - case 0x014D: // CHTRINSERTTAB - change tracking: insert tab - { - ADDTEXT( "len: " ); ADDDEC( 4 ); - ADDTEXT( " index: " ); ADDDEC( 4 ); - ADDTEXT( " opcode: " ); ADDHEX( 2 ); - ADDTEXT( " accept: " ); ADDHEX( 2 ); - ADDTEXT( " tab: " ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "unknown: " ); ADDHEX( 4 ); - ADDTEXT( " table name: " ); - AddUNICODEString( t, rIn ); - PRINT(); - LINESTART(); - __AddDec( t, (sal_uInt32)rIn.GetRecLeft() ); - ADDTEXT( " bytes of unknown data:" ); - PRINT(); - ContDump( rIn.GetRecLeft() ); - } - break; - case 0x015F: // LABELRANGES - { - UINT16 nCnt, nR1, nR2, nC1, nC2; - rIn >> nCnt; - ADDTEXT( "row headers: " ); __AddDec( t, nCnt ); - PRINT(); - while( nCnt-- ) - { - rIn >> nR1 >> nR2 >> nC1 >> nC2; - LINESTART(); - AddRangeRef( t, nR1, nC1 | 0xC000, nR2, nC2 | 0xC000, FALSE ); - PRINT(); - } - rIn >> nCnt; - LINESTART(); - ADDTEXT( "column headers: " ); __AddDec( t, nCnt ); - PRINT(); - while( nCnt-- ) - { - rIn >> nR1 >> nR2 >> nC1 >> nC2; - LINESTART(); - AddRangeRef( t, nR1, nC1 | 0xC000, nR2, nC2 | 0xC000, FALSE ); - PRINT(); - } - } - break; - case 0x0193: - { - ADDTEXT( "unknown: " ); ADDHEX( 4 ); - PRINT(); - LINESTART(); - ADDTEXT( "16 bytes unknown identification:" ); - PRINT(); - ContDump( 16 ); - LINESTART(); - ADDTEXT( "date/time: " ); ADDDEC( 2 ); - ADDTEXT( "-" ); ADDDEC( 1 ); - ADDTEXT( "-" ); ADDDEC( 1 ); - ADDTEXT( " " ); ADDDEC( 1 ); - ADDTEXT( ":" ); ADDDEC( 1 ); - ADDTEXT( ":" ); ADDDEC( 1 ); - ADDTEXT( " unknown: " ); ADDHEX( 1 ); - PRINT(); - LINESTART(); - ADDTEXT( "user: " ); - if( rIn.GetRecLeft() > 3 ) - AddUNICODEString( t, rIn ); - PRINT(); - } - break; - case 0x0194: - { - rIn.DisableDecryption(); - ADDTEXT( "unknown: " ); ADDHEX( 4 ); - ADDTEXT( " date/time: " ); ADDDEC( 2 ); - ADDTEXT( "-" ); ADDDEC( 1 ); - ADDTEXT( "-" ); ADDDEC( 1 ); - ADDTEXT( " " ); ADDDEC( 1 ); - ADDTEXT( ":" ); ADDDEC( 1 ); - ADDTEXT( ":" ); ADDDEC( 1 ); - ADDTEXT( " unknown: " ); ADDHEX( 1 ); - PRINT(); - LINESTART(); - ADDTEXT( "user: " ); - if( rIn.GetRecLeft() > 3 ) - AddUNICODEString( t, rIn ); - PRINT(); - LINESTART(); - __AddDec( t, (sal_uInt32)rIn.GetRecLeft() ); - ADDTEXT( " bytes of unknown data:" ); - PRINT(); - ContDump( rIn.GetRecLeft() ); - } - break; - case 0x0195: - rIn.DisableDecryption(); - ContDump( nL ); - break; - case 0x0196: - { - rIn.DisableDecryption(); - ADDTEXT( "unknown: " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "16 bytes unknown identification:" ); - PRINT(); - ContDump( 16 ); - LINESTART(); - ADDTEXT( "16 bytes unknown identification:" ); - PRINT(); - ContDump( 16 ); - LINESTART(); - ADDTEXT( "count of changes: " ); ADDDEC( 2 ); - ADDTEXT( " " ); - __AddDec( t, (sal_uInt32)rIn.GetRecLeft() ); - ADDTEXT( " bytes of unknown data:" ); - PRINT(); - ContDump( rIn.GetRecLeft() ); - } - break; - case 0x01A9: // USERBVIEW - { - LINESTART(); - ADDTEXT( "view id: " ); ADDHEX( 4 ); - ADDTEXT( " tab id: " ); ADDDEC( 4 ); - ADDTEXT( " guid: " ); __AddGUID( t, rIn ); - PRINT(); - LINESTART(); - ADDTEXT( "window x: " ); ADDDEC( 4 ); - ADDTEXT( " y: " ); ADDDEC( 4 ); - ADDTEXT( " width: " ); ADDDEC( 4 ); - ADDTEXT( " height: " ); ADDDEC( 4 ); - ADDTEXT( " ratio: " ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - UINT16 __nFlags = Read2( rIn ); - STARTFLAG(); - ADDFLAG( 0x0001, "fDsplFormulaBar" ); - ADDFLAG( 0x0002, "fDsplStatus" ); - ADDFLAG( 0x0004, "fNoteOff" ); - ADDFLAG( 0x0008, "fDsplHScroll" ); - ADDFLAG( 0x0010, "fDsplVScroll" ); - ADDFLAG( 0x0020, "fBotAdornment" ); - ADDFLAG( 0x0040, "fZoom" ); - ADDFLAG( 0x0080, "fShowPlaceHld" ); - ADDFLAG( 0x0100, "fHideAll" ); - if( !(__nFlags & 0x0180) ) - ADDTEXT( " fShowAll" ); - PRINT(); - LINESTART(); - ADDTEXT( "flags2: " ); ADDHEX( 2 ); - ADDTEXT( " merge int: " ); ADDDEC( 2 ); - ADDTEXT( " reserved: " ); ADDHEX( 2 ); - PRINT(); - if( rIn.GetRecLeft() > 3 ) - { - LINESTART(); - ADDTEXT( "name: " ); - AddUNICODEString( t, rIn ); - PRINT(); - } - } - break; - case 0x01AA: // USERSVIEWBEGIN - { - LINESTART(); - ADDTEXT( "guid: " ); __AddGUID( t, rIn ); - ADDTEXT( " tab id: " ); ADDDEC( 4 ); - PRINT(); - LINESTART(); - ADDTEXT( "wscale: " ); ADDDEC( 4 ); - ADDTEXT( " icolor: " ); ADDDEC( 4 ); - ADDTEXT( " pane: " ); ADDDEC( 4 ); - PRINT(); - LINESTART(); - UINT32 __nFlags = Read4( rIn ); - STARTFLAG(); - if( __nFlags & 0x000000FF ) - { - ADDFLAG( 0x00000001, "fShowPgBrk" ); - ADDFLAG( 0x00000002, "fDsplForml" ); - ADDFLAG( 0x00000004, "fDsplGrid" ); - ADDFLAG( 0x00000008, "fDsplRCHead" ); - ADDFLAG( 0x00000010, "fDsplGuts" ); - ADDFLAG( 0x00000020, "fDsplZeros" ); - ADDFLAG( 0x00000040, "fPrintHorC" ); - ADDFLAG( 0x00000080, "fPrintVerC" ); - PRINT(); - LINESTART(); - } - if( __nFlags & 0x00007F00 ) - { - ADDTEXT( " " ); - ADDFLAG( 0x00000100, "fPrintRCHead" ); - ADDFLAG( 0x00000200, "fPrintGrid" ); - ADDFLAG( 0x00000400, "fFitToPage" ); - ADDFLAG( 0x00000800, "fPrintArea" ); - ADDFLAG( 0x00001000, "fOnePrintArea" ); - ADDFLAG( 0x00002000, "fFilter" ); - ADDFLAG( 0x00004000, "fAutoFilter" ); - PRINT(); - LINESTART(); - } - if( __nFlags & 0xFFF80000 ) - { - ADDTEXT( " " ); - ADDFLAG( 0x00020000, "fSplitV" ); - ADDFLAG( 0x00040000, "fSplitH" ); - ADDFLAG( 0x00180000, "fHiddenRow" ); - ADDFLAG( 0x00200000, "fHiddenCol" ); - ADDFLAG( 0x01000000, "fChartSize" ); - ADDFLAG( 0x02000000, "fFilterUnique" ); - ADDFLAG( 0x04000000, "fLayoutView" ); - ADDRESERVED( 0xF8C18000 ); - PRINT(); - LINESTART(); - } - if( !__nFlags ) - PRINT(); - ADDTEXT( "visible: " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "pane pos vert: " ); ADDDOUBLE(); - ADDTEXT( " hor: " ); ADDDOUBLE(); - ADDTEXT( " 1st vis right: " ); ADDDEC( 2 ); - ADDTEXT( " bott: " ); ADDDEC( 2 ); - PRINT(); - } - break; - case 0x01AB: // USERSVIEWEND - { - LINESTART(); - ADDTEXT( "settings are valid: " ); ADDHEX( 2 ); - PRINT(); - } - break; - case 0x01AD: // QSI - web query range - { - LINESTART(); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0001, "fTitles" ); - ADDFLAG( 0x0002, "fRowNums" ); - ADDFLAG( 0x0004, "fDisRefr" ); - ADDFLAG( 0x0080, "fFill" ); - ADDFLAG( 0x0100, "fAutoFmt" ); - ADDFLAG( 0x0400, "fDisEdit" ); - ADDRESERVED( 0xFA78 ); - PRINT(); - LINESTART(); - ADDTEXT( "AutoFmt: " ); ADDDEC( 2 ); - ADDTEXT( " AutoFmtAttr: " ); ADDHEX( 2 ); - ADDTEXT( " reserved: " ); ADDHEX( 4 ); - PRINT(); - LINESTART(); - ADDTEXT( "name: " ); - AddUNICODEString( t, rIn ); - PRINT(); - } - break; - case 0x01AE: - { - LINESTART(); - ADDTEXT( "# of tabs: " ); - UINT16 nTabs; - rIn >> nTabs; - __AddDec( t, nTabs ); - rIn.PushPosition(); - PRINT(); - LINESTART(); - if( nL <= (ULONG)(2 + 2 * nTabs) ) - { - ADDTEXT( "----- shortened record -----" ); - PRINT(); - - rIn.PopPosition(); - ContDump( nL - 2 ); - } - else - { - rIn.RejectPosition(); - ADDTEXT( "file name: " ); - AddUNICODEString( t, rIn ); - PRINT(); - while( nTabs ) - { - LINESTART(); - ADDTEXT( " " ); - AddUNICODEString( t, rIn ); - PRINT(); - nTabs--; - } - } - - } - break; - case 0x01B0: // CONDFMT - { - LINESTART(); - ADDTEXT( "cf-count=" ); ADDDEC( 2 ); - rIn >> __nFlags; - ADDTEXT( " " ); - STARTFLAG(); - ADDFLAG( 0x0001, "tough-recalc" ); - ADDRESERVED( 0xFFFE ); - PRINT(); - LINESTART(); - sal_uInt16 nR1, nR2, nC1, nC2, nCount; - rIn >> nR1 >> nR2 >> nC1 >> nC2 >> nCount; - ADDTEXT( "max-range=" ); lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 ); - ADDTEXT( " range-count=" ); __AddDec( t, nCount ); - PRINT(); - - for( sal_uInt16 nRange = 0; rIn.IsValid() && (nRange < nCount); ++nRange ) - { - if( !(nRange % 4) ) - { - LINESTART(); - ADDTEXT( pPre ); - } - rIn >> nR1 >> nR2 >> nC1 >> nC2; - ByteString aRef; - lcl_AddRangeRef( aRef, nC1, nR1, nC2, nR2 ); - aRef.Expand( 16, ' ' ); - ADDTEXT( aRef ); - if( (nRange % 4 == 3) || (nRange + 1 == nCount) ) - PRINT(); - } - } - break; - case 0x01B1: // CF - conditional format - { - sal_uInt8 nType, nOp; - sal_uInt16 nSize1, nSize2; - sal_uInt32 nFlags; - rIn >> nType >> nOp >> nSize1 >> nSize2 >> nFlags; - LINESTART(); - ADDTEXT( "type=" ); __AddHex( t, nType ); - ADDTEXT( " (" ); - switch( nType ) - { - case 0x01: ADDTEXT( "compare" ); break; - case 0x02: ADDTEXT( "formula" ); break; - default: ADDTEXT( "!unknown!" ); - } - ADDTEXT( ") operator=" ); __AddHex( t, nOp ); - ADDTEXT( " (" ); - switch( nOp ) - { - case 0x00: ADDTEXT( "none" ); break; - case 0x01: ADDTEXT( "between" ); break; - case 0x02: ADDTEXT( "not-between" ); break; - case 0x03: ADDTEXT( "equal" ); break; - case 0x04: ADDTEXT( "not-equal" ); break; - case 0x05: ADDTEXT( "greater" ); break; - case 0x06: ADDTEXT( "less" ); break; - case 0x07: ADDTEXT( "greater-eq" ); break; - case 0x08: ADDTEXT( "less-eq" ); break; - default: ADDTEXT( "!unknown!" ); - } - ADDTEXT( ")" ); - PRINT(); - LINESTART(); - ADDTEXT( "formula-size-1=" ); __AddDec( t, nSize1 ); - ADDTEXT( " formula-size-2=" ); __AddDec( t, nSize2 ); - PRINT(); - LINESTART(); - sal_uInt32 __nFlags = nFlags; - STARTFLAG(); - __nFlags = ~__nFlags; - ADDFLAG( 0x00000400, "bord-lft" ); - ADDFLAG( 0x00000800, "bord-rgt" ); - ADDFLAG( 0x00001000, "bord-top" ); - ADDFLAG( 0x00002000, "bord-bot" ); - ADDFLAG( 0x00010000, "patt-style" ); - ADDFLAG( 0x00020000, "patt-fgcol" ); - ADDFLAG( 0x00040000, "patt-bgcol" ); - __nFlags = ~__nFlags; - ADDFLAG( 0x04000000, "font" ); - ADDFLAG( 0x10000000, "bord" ); - ADDFLAG( 0x20000000, "patt" ); - ADDRESERVED( 0xCBC00000 ); - PRINT(); - LINESTART(); - ADDTEXT( "unknown=" ); ADDHEX( 2 ); - PRINT(); - if( nFlags & 0x04000000 ) - { - LINESTART(); ADDTEXT( "*** FONT ***" ); PRINT(); - ContDump( 64 ); - LINESTART(); - ADDTEXT( "height=" ); ADDHEX( 4 ); - rIn >> __nFlags; - ADDTEXT( " style-" ); - STARTFLAG(); - ADDFLAG( 0x00000002, "italic" ); - ADDFLAG( 0x00000080, "strikeout" ); - ADDRESERVED( 0xFFFFFF7D ); - ADDTEXT( " weight=" ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - sal_uInt16 nEsc; - rIn >> nEsc; - ADDTEXT( "escapement=" ); __AddDec( t, nEsc ); - ADDTEXT( " (" ); - switch( nEsc ) - { - case 0x0000: ADDTEXT( "none" ); break; - case 0x0001: ADDTEXT( "super" ); break; - case 0x0002: ADDTEXT( "sub" ); break; - default: ADDTEXT( "!unknown!" ); - } - sal_uInt8 nUnd; - rIn >> nUnd; - ADDTEXT( ") underline=" ); __AddDec( t, nUnd ); - ADDTEXT( " (" ); - switch( nUnd ) - { - case 0x00: ADDTEXT( "none" ); break; - case 0x01: ADDTEXT( "single" ); break; - case 0x02: ADDTEXT( "double" ); break; - default: ADDTEXT( "!unknown!" ); - } - ADDTEXT( ") unknown=" ); ADDHEX( 1 ); - ADDTEXT( " " ); ADDHEX( 1 ); - ADDTEXT( " " ); ADDHEX( 1 ); - PRINT(); - LINESTART(); - ADDTEXT( "color=" ); ADDHEX( 4 ); - ADDTEXT( " unknown=" ); ADDHEX( 4 ); - rIn >> __nFlags; - ADDTEXT( " used-" ); - STARTFLAG(); - __nFlags = ~__nFlags; - ADDFLAG( 0x00000002, "italic" ); - ADDFLAG( 0x00000080, "strikeout" ); - __nFlags = ~__nFlags; - ADDRESERVED( 0xFFFFFF65 ); - PRINT(); - LINESTART(); - ADDTEXT( "escape-def=" ); ADDHEX( 4 ); - ADDTEXT( " underl-def=" ); ADDHEX( 4 ); - PRINT(); - ContDump( 18 ); - } - if( nFlags & 0x10000000 ) - { - LINESTART(); ADDTEXT( "*** BORDER ***" ); PRINT(); - sal_uInt16 nLine; - sal_uInt32 nColor; - rIn >> nLine >> nColor; - LINESTART(); - ADDTEXT( "line-style=" ); __AddHex( t, nLine ); - ADDTEXT( " (lft=" ); __AddDec( t, (sal_uInt16)(nLine & 0x000F) ); - ADDTEXT( " rgt=" ); __AddDec( t, (sal_uInt16)((nLine & 0x00F0) >> 4) ); - ADDTEXT( " top=" ); __AddDec( t, (sal_uInt16)((nLine & 0x0F00) >> 8) ); - ADDTEXT( " bot=" ); __AddDec( t, (sal_uInt16)((nLine & 0xF000) >> 12) ); - ADDTEXT( ")" ); - PRINT(); - LINESTART(); - ADDTEXT( "line-color=" ); __AddHex( t, nColor ); - ADDTEXT( " (lft=" ); __AddDec( t, (sal_uInt16)(nColor & 0x0000007F) ); - ADDTEXT( " rgt=" ); __AddDec( t, (sal_uInt16)((nColor & 0x00003F80) >> 7) ); - ADDTEXT( " top=" ); __AddDec( t, (sal_uInt16)((nColor & 0x007F0000) >> 16) ); - ADDTEXT( " bot=" ); __AddDec( t, (sal_uInt16)((nColor & 0x3F800000) >> 23) ); - ADDTEXT( ") unknown=" ); ADDHEX( 2 ); - PRINT(); - } - if( nFlags & 0x20000000 ) - { - LINESTART(); ADDTEXT( "*** AREA ***" ); PRINT(); - sal_uInt16 nPatt, nColor; - rIn >> nPatt >> nColor; - LINESTART(); - ADDTEXT( "pattern=" ); __AddHex( t, nPatt ); - ADDTEXT( " (" ); __AddDec( t, (sal_uInt16)((nPatt & 0xFC00) >> 10) ); - ADDTEXT( ") color=" ); __AddHex( t, nColor ); - ADDTEXT( " (fg=" ); __AddDec( t, (sal_uInt16)(nColor & 0x007F) ); - ADDTEXT( " bg=" ); __AddDec( t, (sal_uInt16)((nColor & 0x3F80) >> 7) ); - ADDTEXT( ")" ); - PRINT(); - } - if( rIn.IsValid() && nSize1 && (rIn.GetRecLeft() >= nSize1) ) - { - LINESTART(); ADDTEXT( "*** FORMULA 1 ***" ); PRINT(); - FormulaDump( nSize1, FT_RangeName ); - } - if( rIn.IsValid() && nSize2 && (rIn.GetRecLeft() >= nSize2) ) - { - LINESTART(); ADDTEXT( "*** FORMULA 2 ***" ); PRINT(); - FormulaDump( nSize2, FT_RangeName ); - } - } - break; - case 0x01B2: // DVAL - header of DV recs - { - rIn >> __nFlags; - LINESTART(); - STARTFLAG(); - ADDTEXT( " (" ); - __AddPureBin( t, __nFlags ); - ADDTEXT( ")" ); - ADDTEXT( "):" ); - ADDFLAG( 0x0001, "fWnClosed" ); - ADDFLAG( 0x0002, "fWnPinned" ); - ADDFLAG( 0x0004, "fCached" ); - PRINT(); - LINESTART(); - ADDTEXT( "input window: " ); - ADDHEX( 4 ); - ADDTEXT( " / " ); - ADDHEX( 4 ); - PRINT(); - LINESTART(); - ADDTEXT( "object id: " ); - ADDHEX( 4 ); - PRINT(); - LINESTART(); - ADDTEXT( "num of DV recs: " ); - ADDDEC( 4 ); - PRINT(); - } - break; - case 0x01B6: // TXO - text box - { - LINESTART(); - rIn >> __nFlags; - STARTFLAG(); - switch( __nFlags & 0x000E ) - { - case 0x0002: ADDTEXT( " h-left" ); break; - case 0x0004: ADDTEXT( " h-center" ); break; - case 0x0006: ADDTEXT( " h-right" ); break; - case 0x0008: ADDTEXT( " h-block" ); break; - default: ADDTEXT( " *h-unknown*" ); - } - switch( __nFlags & 0x0070 ) - { - case 0x0010: ADDTEXT( " v-top" ); break; - case 0x0020: ADDTEXT( " v-center" ); break; - case 0x0030: ADDTEXT( " v-bottom" ); break; - case 0x0040: ADDTEXT( " v-block" ); break; - default: ADDTEXT( " *v-unknown*" ); - } - ADDFLAG( 0x0200, "lock-text" ); - ADDRESERVED( 0xFD81 ); - ADDTEXT( " orient=" ); - sal_uInt16 nOrient = rIn.ReaduInt16(); - __AddDec( t, nOrient ); - ADDTEXT( " (" ); - switch( nOrient ) - { - case 0: ADDTEXT( "no-rot" ); break; - case 1: ADDTEXT( "stacked" ); break; - case 2: ADDTEXT( "90\xB0 ccw" ); break; - case 3: ADDTEXT( "90\xB0 cw" ); break; - default: ADDTEXT( "!unknown!" ); - } - ADDTEXT( ")" ); - PRINT(); - LINESTART(); - ADDTEXT( "reserved=" ); - ADDHEX( 2 ); ADDTEXT( " " ); ADDHEX( 2 ); ADDTEXT( " " ); ADDHEX( 2 ); - ADDTEXT( " text-len=" ); ADDDEC( 2 ); - ADDTEXT( " format-size=" ); ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "reserved=" ); ADDHEX( 2 ); - sal_uInt16 nLinkSize = rIn.ReaduInt16(); - ADDTEXT( " link-size=" ); __AddDec( t, nLinkSize ); - PRINT(); - if( nLinkSize > 0 ) - { - LINESTART(); - sal_uInt16 nFmlaSize = rIn.ReaduInt16(); - ADDTEXT( "fmla-size=" ); __AddDec( t, nFmlaSize ); - ADDTEXT( " reserved=" ); ADDHEX( 4 ); - PRINT(); - FormulaDump( nFmlaSize, FT_CellFormula ); - } - } - break; - case 0x01BE: // DV - data validation record - { - UINT32 __nFlags; - rIn >> __nFlags; - LINESTART(); - STARTFLAG(); - ADDTEXT( " (" ); - __AddPureBin( t, __nFlags ); - ADDTEXT( ")" ); - PRINT(); - LINESTART(); - if( __nFlags ) - { - ADDTEXT( " " ); - ADDFLAG( 0x00000080, "fStrLookup" ); - ADDFLAG( 0x00000100, "fAllowBlank" ); - ADDFLAG( 0x00000200, "fSuppressCombo" ); - ADDFLAG( 0x00040000, "fShowInputMsg" ); - ADDFLAG( 0x00080000, "fShowErrorMsg" ); - } - PRINT(); - LINESTART(); - ADDTEXT( "error style: " ); - const char* pErrStyle[] = { "stop", "warning", "info", "4" }; - ADDTEXT( pErrStyle[ ( __nFlags >> 4 ) & 0x03 ] ); - PRINT(); - LINESTART(); - const char* pValType[] = - { - "all", "integer", "decimal", "list", "date", "time", "text len", "user", - "8", "9", "A", "B", "C", "D", "E", "F" - }; - LINESTART(); - ADDTEXT( "validation type: " ); - ADDTEXT( pValType[ __nFlags & 0x0000000F ] ); - PRINT(); - - const char* pOpType[] = - { - "between", "not between", "equal", "not equal", - "greater", "less", "greater or equal", "less or equal", - "8", "9", "A", "B", "C", "D", "E", "F" - }; - LINESTART(); - ADDTEXT( "operator type: " ); - ADDTEXT( pOpType[ ( __nFlags >> 20 ) & 0x0000000F ] ); - PRINT(); - - LINESTART(); - ADDTEXT( "Prompt Title: " ); - AddUNICODEString( t, rIn ); - PRINT(); - LINESTART(); - ADDTEXT( "Error Title: " ); - AddUNICODEString( t, rIn ); - PRINT(); - LINESTART(); - ADDTEXT( "Prompt Message: " ); - AddUNICODEString( t, rIn ); - PRINT(); - LINESTART(); - ADDTEXT( "Error Message: " ); - AddUNICODEString( t, rIn ); - PRINT(); - if( rIn.GetRecLeft() > 8 ) - { - UINT16 nLen; - rIn >> nLen; - LINESTART(); - ADDTEXT( "Len1: " ); - __AddDec( t, nLen ); - ADDTEXT( " (unknown1: " ); - ADDHEX( 2 ); - ADDTEXT( ")" ); - PRINT(); - FormulaDump( nLen, FT_RangeName ); - - rIn >> nLen; - LINESTART(); - ADDTEXT( "Len2: " ); - __AddDec( t, nLen ); - ADDTEXT( " (unknown2: " ); - ADDHEX( 2 ); - ADDTEXT( ")" ); - PRINT(); - FormulaDump( nLen, FT_RangeName ); - - LINESTART(); - ADDTEXT( "range count: " ); - ADDHEX( 2 ); - PRINT(); - } - - while( rIn.GetRecLeft() >= 8 ) - { - // Row-Row / Col-Col - UINT16 nR1, nR2, nC1, nC2; - rIn >> nR1 >> nR2 >> nC1 >> nC2; - LINESTART(); - AddRangeRef( t, nR1, nC1 | 0xC000, nR2, nC2 | 0xC000, FALSE ); - PRINT(); - } - } - break; - case 0x01B8: // HLINK - { - PreDump( nL ); - - UINT32 n1, n2; - LINESTART(); - PRINT(); - UINT16 nR1, nR2, nC1, nC2; - rIn >> nR1 >> nR2 >> nC1 >> nC2; - ADDTEXT( "Cellrange=" ); - lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 ); - PRINT(); - LINESTART(); - ADDTEXT( "GUID StdLink=" ); __AddGUID( t, rIn ); - PRINT(); - LINESTART(); - ADDTEXT( " must=79EAC9D0-BAF9-11CE-8C82-00AA004BA90B" ); - PRINT(); - LINESTART(); - ADDTEXT( "unknown=" ); ADDHEX( 4 ); - PRINT(); - UINT32 __nFlags = Read4( rIn ); - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x00000001, "fBody" ); - ADDFLAG( 0x00000002, "fAbs" ); - ADDFLAG( 0x00000014, "fDescr" ); - ADDFLAG( 0x00000008, "fMark" ); - ADDFLAG( 0x00000080, "fFrame" ); - ADDFLAG( 0x00000100, "fUNC" ); - ADDRESERVED( 0xFFFFFE60 ); - PRINT(); - - //description - String aData; - if( __nFlags & 0x00000014 ) - { - LINESTART(); - rIn >> n1; - ADDTEXT( "## Description ## [l=" ); - __AddDec( t, n1 ); - ADDTEXT( "]: '" ); - aData = rIn.ReadRawUniString( (USHORT)(n1 - 1), TRUE ); - t += GETSTR( aData ); - ADDTEXT( "<" ); ADDHEX( 2 ); ADDTEXT( ">'" ); // trailing zero - PRINT(); - } - - // frame name - if( __nFlags & 0x00000080 ) - { - LINESTART(); - rIn >> n1; - ADDTEXT( "## Frame ## [l=" ); - __AddDec( t, n1 ); - ADDTEXT( "]: '" ); - aData = rIn.ReadRawUniString( (USHORT)(n1 - 1), TRUE ); - t += GETSTR( aData ); - ADDTEXT( "<" ); ADDHEX( 2 ); ADDTEXT( ">'" ); // trailing zero - PRINT(); - } - - // network path - if( __nFlags & 0x00000100 ) - { - LINESTART(); - rIn >> n1; - ADDTEXT( "## UNC ## [l=" ); - __AddDec( t, n1 ); - ADDTEXT( "]: '" ); - aData = rIn.ReadRawUniString( (USHORT)(n1 - 1), TRUE ); - t += GETSTR( aData ); - ADDTEXT( "<" ); ADDHEX( 2 ); ADDTEXT( ">'" ); // trailing zero - PRINT(); - } - - // file link or URL - else if( __nFlags & 0x00000001 ) - { - rIn.PushPosition(); - rIn >> n1; - rIn.PopPosition(); - LINESTART(); - ADDTEXT( "## Content GUID ## " ); - __AddGUID( t, rIn ); - switch( n1 ) - { - case 0x00000303: // file - { - ADDTEXT( " File Moniker" ); - PRINT(); - LINESTART(); - ADDTEXT( " must=00000303-0000-0000-C000-000000000046" ); - PRINT(); - LINESTART(); - ADDTEXT( "## File link ## up level=" ); - ADDDEC( 2 ); - rIn >> n2; - ADDTEXT( " [l=" ); __AddDec( t, n2 ); - ADDTEXT( ", 8-Bit]: '" ); - aData = rIn.ReadRawByteString( (USHORT)(n2 - 1) ); - t += GETSTR( aData ); - ADDTEXT( "<" ); ADDHEX( 1 ); ADDTEXT( ">'" ); // trailing zero - PRINT(); - ContDump( 24 ); - rIn >> n2; - LINESTART(); - ADDTEXT( "bytes left=" ); __AddDec( t, n2 ); - if( n2 ) - { - rIn >> n2; - LINESTART(); - ADDTEXT( " string byte count=" ); - __AddDec( t, n2 ); - ADDTEXT( " unknown=" ); - ADDHEX( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "[l=" ); - __AddDec( t, n2 / 2 ); - ADDTEXT( "]: '" ); - aData = rIn.ReadRawUniString( (USHORT)n2, TRUE ); - t += GETSTR( aData ); - ADDTEXT( "'" ); - } - PRINT(); - } - break; - case 0x79EAC9E0: // URL - { - ADDTEXT( " URL Moniker" ); - PRINT(); - LINESTART(); - ADDTEXT( " must=79EAC9E0-BAF9-11CE-8C82-00AA004BA90B" ); - PRINT(); - rIn >> n2; - LINESTART(); - ADDTEXT( "## URL ## string byte count=" ); - __AddDec( t, n2 ); - PRINT(); - LINESTART(); - ADDTEXT( "[l=" ); - __AddDec( t, n2 / 2 ); - ADDTEXT( "]: '" ); - aData = rIn.ReadRawUniString( (USHORT)(n2 / 2 - 1), TRUE ); - t += GETSTR( aData ); - ADDTEXT( "<" ); ADDHEX( 2 ); ADDTEXT( ">'" ); // trailing zero - PRINT(); - } - break; - default: - { - ADDTEXT( " (!!UNKNOWN!!)" ); - PRINT(); - } - break; - } - } - - // text mark - if( __nFlags & 0x00000008 ) - { - LINESTART(); - rIn >> n1; - ADDTEXT( "## Text mark ## [l=" ); - __AddDec( t, n1 ); - ADDTEXT( "]: '" ); - aData = rIn.ReadRawUniString( (USHORT)(n1 - 1), TRUE ); - t += GETSTR( aData ); - ADDTEXT( "<" ); ADDHEX( 2 ); ADDTEXT( ">'" ); // trailing zero - PRINT(); - } - } - break; - case 0x01BB: // SXFDBTYPE - SQL data type - { - ADDTEXT( "SQL data type: " ); ADDHEX( 2 ); - PRINT(); - } - break; - case 0x0201: - { - LINESTART(); - ADDCELLHEAD(); - PRINT(); - } - break; - case 0x0203: - { - LINESTART(); - ADDCELLHEAD(); - ADDTEXT( " val = " ); - ADDDOUBLE(); - PRINT(); - } - break; - case 0x0205: - { - LINESTART(); - ADDCELLHEAD(); - ADDTEXT( " val = " ); ADDHEX( 1 ); - ADDTEXT( " type = " ); ADDDEC( 1 ); - PRINT(); - } - break; - case 0x0208: // ROW - row info - { - LINESTART(); - ADDTEXT( "row #: " ); ADDDEC( 2 ); - ADDTEXT( " def. cols: " ); ADDDEC( 2 ); - ADDTEXT( "-" ); ADDDEC( 2 ); - ADDTEXT( " ht: " ); ADDDEC( 2 ); - ADDTEXT( " reserved: " ); ADDHEX( 4 ); - PRINT(); - rIn >> __nFlags; - LINESTART(); - STARTFLAG(); - ADDTEXT( " outlnlev=" ); - __AddDec( t, (UINT16)(__nFlags & 0x0007) ); - ADDFLAG( 0x0010, "fCollapsed" ); - ADDFLAG( 0x0020, "fRowHeightZero" ); - ADDFLAG( 0x0040, "fUnsynced" ); - ADDFLAG( 0x0080, "fGhostDirty" ); - ADDRESERVED( 0xFF08 ); - PRINT(); - UINT16 nXF; - rIn >> nXF; - LINESTART(); - ADDTEXT( "ix to XF: " ); __AddDec( t, (UINT16)(nXF & 0x0FFF) ); - ADDTEXT( " add. flags(" ); __AddHex( t, nXF ); - ADDTEXT( "):" ); - ADDFLAG( 0x1000, "fExAsc" ); - ADDFLAG( 0x2000, "fExDsc" ); - ADDRESERVED( 0xC000 ); - PRINT(); - } - break; - case 0x0021: // ARRAY - case 0x0221: - { - UINT16 nR1, nR2; - UINT8 nC1, nC2; - rIn >> nR1 >> nR2 >> nC1 >> nC2 >> __nFlags; - LINESTART(); - ADDTEXT( "range: " ); - lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 ); - PRINT(); - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fAlwaysCalc" ); - ADDFLAG( 0x0002, "fCalcOnLoad" ); - ADDRESERVED( 0xFFFC ); - PRINT(); - LINESTART(); - ADDTEXT( "chn = " ); - ADDHEX( 4 ); - UINT16 n; - rIn >> n; - ADDTEXT( " cce = " ); - __AddDec( t, n ); - PRINT(); - FormulaDump( n, FT_SharedFormula ); - } - break; - case 0x0225: // DEFAULTROWHEIGHT - height & flags - { - rIn >> __nFlags; - LINESTART(); - ADDTEXT( "default row " ); - STARTFLAG(); - ADDFLAG( 0x0001, "fUnsynced" ); - ADDFLAG( 0x0002, "fRowHtZero" ); - ADDFLAG( 0x0004, "fExAsc" ); - ADDFLAG( 0x0008, "fExDsc" ); - ADDRESERVED( 0xFFF0 ); - PRINT(); - LINESTART(); - ADDTEXT( "default row height: " ); - ADDDEC( 2 ); - PRINT(); - } - break; - case 0x023E: // WINDOW2 - { - LINESTART(); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0001, "show-formulas" ); - ADDFLAG( 0x0002, "show-grid" ); - ADDFLAG( 0x0004, "show-headers" ); - ADDFLAG( 0x0008, "frozen" ); - ADDFLAG( 0x0010, "show-zero" ); - ADDFLAG( 0x0020, "auto-grid-color" ); - ADDFLAG( 0x0040, "right-to-left" ); - ADDFLAG( 0x0080, "show-outline" ); - ADDFLAG( 0x0100, "remove-splits" ); - ADDFLAG( 0x0200, "sheet-selected" ); - ADDFLAG( 0x0400, "sheet-visible" ); - ADDFLAG( 0x0800, "show-pagebreak" ); - ADDRESERVED( 0xF000 ); - PRINT(); - LINESTART(); - ADDTEXT( "first-row=" ); ADDDEC( 2 ); - ADDTEXT( " first-col=" ); ADDDEC( 2 ); - ADDTEXT( " grid-color=" ); ADDDEC( 2 ); - ADDTEXT( " reserved=" ); ADDHEX( 2 ); - PRINT(); - // reallife: WINDOW2 in charts do not have teh following fields - if( rIn.GetRecLeft() >= 8 ) - { - LINESTART(); - ADDTEXT( "pagebreak-zoom=" ); ADDDEC( 2 ); - ADDTEXT( "% view-zoom=" ); ADDDEC( 2 ); - ADDTEXT( "% reserved=" ); ADDHEX( 4 ); - PRINT(); - } - } - break; - case 0x027E: - { - ADDCELLHEAD(); - ADDTEXT( " val = " ); - __AddRK( t, rIn.ReadInt32() ); - PRINT(); - } - break; - case 0x0293: // STYLE - { - LINESTART(); - sal_uInt16 nXF; - rIn >> nXF; - ADDTEXT( "xf-ref=" ); __AddHex( t, nXF ); - ADDTEXT( " (xf=#" ); __AddDec( t, static_cast< sal_uInt16 >( nXF & EXC_STYLE_XFMASK ) ); - if( ::get_flag( nXF, EXC_STYLE_BUILTIN ) ) - { - sal_uInt8 nStyleId, nLevel; - rIn >> nStyleId >> nLevel; - ADDTEXT( " builtin) style-id=" ); __AddDec( t, nStyleId ); - ADDTEXT( " (" ); - static const sal_Char* ppcStyles[] = { - "Normal", "RowLevel", "ColLevel", "Comma", "Currency", - "Percent", "Comma_0", "Currency_0", - "Hyperlink", "Followed_Hyperlink" }; - if( nStyleId < STATIC_TABLE_SIZE( ppcStyles ) ) - ADDTEXT( ppcStyles[ nStyleId ] ); - else - ADDTEXT( "!unknown!" ); - ADDTEXT( ") outline-level=" ); __AddDec( t, nLevel ); - } - else - { - ADDTEXT( ") name=" ); - AddUNICODEString( t, rIn ); - } - PRINT(); - } - break; - case 0x041E: - { - LINESTART(); - ADDTEXT( "Index: " ); ADDHEX( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "Format: " ); AddUNICODEString( t, rIn ); - PRINT(); - } - break; - case 0x04BC: - { - UINT16 nR1, nR2; - UINT8 nC1, nC2; - LINESTART(); - rIn >> nR1 >> nR2 >> nC1 >> nC2; - lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 ); - PRINT(); - LINESTART(); - ADDTEXT( "reserved = " ); - __AddPureHex( t, Read2( rIn ) ); - UINT16 n; - rIn >> n; - ADDTEXT( " cce = " ); - __AddDec( t, n ); - PRINT(); - FormulaDump( n, FT_SharedFormula ); - } - break; - case 0x0803: // WEBQRYSETTINGS - web query: options - { - UINT16 nCnt; - LINESTART(); - ADDTEXT( "repeated recnum: " ); - ADDHEX( 2 ); - ADDTEXT( " unknown:" ); - for( nCnt = 0; nCnt < 3; nCnt++ ) - { - ADDTEXT( " " ); - ADDHEX( 2 ); - } - PRINT(); - LINESTART(); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0001, "fImportPRE" ); - ADDFLAG( 0x0002, "fIgnoreSep" ); - ADDFLAG( 0x0004, "fUseSetting" ); - ADDFLAG( 0x0010, "fIgnoreDate" ); - ADDFLAG( 0x0020, "fWhatIsIt?" ); - ADDRESERVED( 0xFFC8 ); - PRINT(); - LINESTART(); - rIn >> __nFlags; - STARTFLAG(); - ADDFLAG( 0x0002, "fTables" ); - ADDRESERVED( 0xFFFD ); - PRINT(); - LINESTART(); - ADDTEXT( "unknown: " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "refresh: " ); ADDDEC( 2 ); - ADDTEXT( " unknown: " ); ADDHEX( 2 ); - ADDTEXT( " " ); ADDHEX( 2 ); - PRINT(); - } - break; - case 0x0804: // WEBQRYTABLES - web query: selected tables - { - LINESTART(); - ADDTEXT( "repeated recnum: " ); ADDHEX( 2 ); - ADDTEXT( " unknown: " ); ADDHEX( 2 ); - PRINT(); - if( nL > 6 ) - { - LINESTART(); - ADDTEXT( "text: " ); - AddUNICODEString( t, rIn ); - PRINT(); - } - } - break; - case 0x0809: // BOF - { - rIn.DisableDecryption(); - LINESTART(); - ADDTEXT( "version number: " ); - ADDHEX( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "substream type: " ); - rIn >> mnSubstream; - __AddHex( t, mnSubstream ); - ADDTEXT( " (" ); - switch( mnSubstream ) - { - case 0x0005: p = "Workbook globals"; break; - case 0x0006: p = "Visual Basic module"; break; - case 0x0010: p = "Worksheet or dialog sheet"; break; - case 0x0020: p = "Chart"; break; - case 0x0040: p = "MS 4.0 Macro"; break; - case 0x0100: p = "Workspace file"; break; - default: p = pU; - } - ADDTEXT( p ); - ADDTEXT( ")" ); - PRINT(); - LINESTART(); - UINT16 n; - rIn >> n; - ADDTEXT( "build identifier: "); - __AddHex( t, n ); - ADDTEXT( " (=" ); - __AddDec( t, n ); - ADDTEXT( ")" ); - PRINT(); - - LINESTART(); - rIn >> n; - ADDTEXT( "build year: "); - __AddHex( t, n ); - ADDTEXT( " (=" ); - __AddDec( t, n ); - ADDTEXT( ")" ); - PRINT(); - - UINT32 __nFlags; - rIn >> __nFlags; - LINESTART(); - ADDTEXT( "file history " ); - STARTFLAG(); - if( __nFlags ) - { - ADDFLAG( 0x00000001, "fWin" ); - ADDFLAG( 0x00000002, "fRisc" ); - ADDFLAG( 0x00000004, "fBeta" ); - ADDFLAG( 0x00000008, "fWinAny" ); - ADDFLAG( 0x00000010, "fMacAny" ); - ADDFLAG( 0x00000020, "fBetaAny" ); - ADDFLAG( 0x00000100, "fRiscAny" ); - ADDRESERVED( 0xFFFFE0C0 ); - } - PRINT(); - - LINESTART(); - ADDTEXT( "lowest BIFF version: "); - ADDHEX( 4 ); - PRINT(); - } - break; - case 0x1002: // ChartChart - { - LINESTART(); - ADDTEXT( "Pos = " ); - ADD16P16(); - ADDTEXT( " / " ); - ADD16P16(); - ADDTEXT( " Size = " ); - ADD16P16(); - ADDTEXT( " / " ); - ADD16P16(); - PRINT(); - } - break; - case 0x1003: // ChartSeries - { - sal_uInt16 nCatType, nValType, nCatCnt, nValCnt, nBubType, nBubCnt; - rIn >> nCatType >> nValType >> nCatCnt >> nValCnt >> nBubType >> nBubCnt; - LINESTART(); - ADDTEXT( "category-type=" ); __AddDec( t, nCatType ); - ADDTEXT( " " ); ADDTEXT( GetSeriesType( nCatType ) ); - ADDTEXT( " count=" ); __AddDec( t, nCatCnt ); - PRINT(); - LINESTART(); - ADDTEXT( " value-type=" ); __AddDec( t, nValType ); - ADDTEXT( " " ); ADDTEXT( GetSeriesType( nValType ) ); - ADDTEXT( " count=" ); __AddDec( t, nValCnt ); - PRINT(); - LINESTART(); - ADDTEXT( " bubble-type=" ); __AddDec( t, nBubType ); - ADDTEXT( " " ); ADDTEXT( GetSeriesType( nBubType ) ); - ADDTEXT( " count=" ); __AddDec( t, nBubCnt ); - PRINT(); - } - break; - case 0x1006: // ChartDataformat - { - INT16 n; - LINESTART(); - rIn >> n; - ADDTEXT( "Point number = " ); - __AddDec( t, n ); - if( n == -1 ) - ADDTEXT( " (entire series)" ); - PRINT(); - LINESTART(); - ADDTEXT( "Series index = " ); - ADDDEC( 2 ); - ADDTEXT( " Series number = " ); - ADDDEC( 2 ); - if( Read2( rIn ) & 0x01 ) - ADDTEXT( " (fXL4iss)" ); - PRINT(); - } - break; - case 0x1007: // ChartLineform - { - LINESTART(); - ADDTEXT( "Color = " ); - ADDTEXT( GetRGB( Read4( rIn ) ) ); - ADDTEXT( " Pattern : " ); - ADDTEXT( GetLineType( Read2( rIn ) ) ); - switch( ( INT16 ) Read2( rIn ) ) - { - case -1: p = "hairline"; break; - case 0: p = "narrow (single)"; break; - case 1: p = "medium (double)"; break; - case 2: p = "wide (triple)"; break; - default: p = pU; - } - ADDTEXT( ", " ); - ADDTEXT( p ); - PRINT(); - rIn >> __nFlags; - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fAuto" ); - ADDFLAG( 0x0004, "fDrawTick" ); - PRINT(); - } - LINESTART(); - ADDTEXT( "color index = " ); - ADDDEC( 2 ); - PRINT(); - } - break; - case 0x1009: // ChartMarkerformat - { - UINT16 n; - LINESTART(); - ADDTEXT( "Fore = " ); - ADDTEXT( GetRGB( Read4( rIn ) ) ); - ADDTEXT( " Back = " ); - ADDTEXT( GetRGB( Read4( rIn ) ) ); - rIn >> n; - switch( n ) - { - case 0: p = "no marker"; break; - case 1: p = "square"; break; - case 2: p = "diamond"; break; - case 3: p = "triangle"; break; - case 4: p = "X"; break; - case 5: p = "star"; break; - case 6: p = "Dow-Jones"; break; - case 7: p = "std deviation"; break; - case 8: p = "circle"; break; - case 9: p = "plus sign"; break; - default: p = pU; - } - ADDTEXT( " Type = " ); - ADDTEXT( p ); - PRINT(); - rIn >> __nFlags; - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fAuto" ); - ADDFLAG( 0x0010, "fNoBackg" ); - ADDFLAG( 0x0020, "fNoFore" ); - ADDRESERVED( 0xFFCE ); - PRINT(); - } - LINESTART(); - ADDTEXT( "border color = " ); - ADDDEC( 2 ); - ADDTEXT( " fill color = " ); - ADDDEC( 2 ); - ADDTEXT( " size = " ); - ADDDEC(4); - PRINT(); - } - break; - case 0x100A: // ChartAreaformat - { - LINESTART(); - ADDTEXT( "Fore = " ); - ADDTEXT( GetRGB( Read4( rIn ) ) ); - ADDTEXT( " Back = " ); - ADDTEXT( GetRGB( Read4( rIn ) ) ); - ADDTEXT( " Pattern = " ); - UINT16 n; - rIn >> n >> __nFlags; - __AddDec( t, n ); - ADDTEXT( " (" ); - __AddHex( t, n ); - ADDTEXT( ")" ); - PRINT(); - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x01, "fAuto" ); - ADDFLAG( 0x02, "fInvertNeg" ); - PRINT(); - } - } - LINESTART(); - ADDTEXT( "color index fore = " ); - ADDDEC( 2 ); - ADDTEXT( ", back = " ); - ADDDEC( 2 ); - PRINT(); - break; - case 0x100B: // ChartPieformat - LINESTART(); - ADDDEC( 2 ); - ADDTEXT( "%" ); - PRINT(); - break; - case 0x100C: // ChartAttachedlabel - ContDump( nL ); - break; - case 0x100D: // ChartSeriestext - ContDump( nL ); - break; - case 0x1014: // ChartChartformat - { - ContDump( 16 ); - LINESTART(); - rIn >> __nFlags; - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fVaried" ); - PRINT(); - } - LINESTART(); - ADDTEXT( "drawing order = " ); - ADDDEC( 2 ); - PRINT(); - } - break; - case 0x1015: // ChartLegend - { - UINT32 nX, nY, nDx, nDy; - UINT8 nWType, nWSpacing; - rIn >> nX >> nY >> nDx >> nDy >> nWType >> nWSpacing >> __nFlags; - LINESTART(); - __AddDec( t, nX ); - ADDTEXT( " / " ); - __AddDec( t, nY ); - ADDTEXT( " [" ); - __AddDec( t, nDx ); - ADDTEXT( " / " ); - __AddDec( t, nDy ); - ADDTEXT( "]" ); - PRINT(); - LINESTART(); - ADDTEXT( " Type: " ); - switch( nWType ) - { - case 0: p = "bottom"; break; - case 1: p = "corner"; break; - case 2: p = "top"; break; - case 3: p = "right"; break; - case 4: p = "left"; break; - case 7: p = "not docked or inside the plot area"; break; - default: p = pU; - } - ADDTEXT( p ); - ADDTEXT( " Spacing: " ); - switch( nWSpacing ) - { - case 0: p = "close"; break; - case 1: p = "medium"; break; - case 2: p = "open"; break; - default: p = pU; - } - ADDTEXT( p ); - PRINT(); - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x01, "fAutoPosition" ); - ADDFLAG( 0x02, "fAutoSeries" ); - ADDFLAG( 0x04, "fAutoPosX" ); - ADDFLAG( 0x08, "fAutoPosY" ); - ADDFLAG( 0x10, "fVert" ); - ADDFLAG( 0x20, "fWasDataTable" ); - PRINT(); - } - } - break; - case 0x1016: // ChartSerieslist - ContDump( nL ); - break; - case 0x1017: // ChartBar - { - LINESTART(); - ADDTEXT( "space betw. bars = " ); - ADDDEC( 2 ); - ADDTEXT( " space betw. cat = " ); - ADDDEC( 2 ); - PRINT(); - rIn >> __nFlags; - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fTranspose" ); - ADDFLAG( 0x0002, "fStacked" ); - ADDFLAG( 0x0004, "f100" ); - ADDFLAG( 0x0008, "fHasShadow" ); - PRINT(); - } - } - break; - case 0x1018: // ChartLine - ContDump( nL ); - break; - case 0x1019: // ChartPie - ContDump( nL ); - break; - case 0x101A: // ChartArea - ContDump( nL ); - break; - case 0x101C: // ChartLine - ContDump( nL ); - break; - case 0x101D: // ChartAxis - { - static const sal_Char* const ppcIds[] = { "x-axis", "y-axis", "z-axis" }; - LINESTART(); - sal_uInt16 nAxisId = rIn.ReaduInt16(); - ADDTEXT( "axis-id=" ); __AddDec( t, nAxisId ); - lcl_AddEnum( t, nAxisId, ppcIds, STATIC_TABLE_SIZE( ppcIds ) ); - PRINT(); - ContDump( 16 ); - } - break; - case 0x101E: // CHTICK - { - static const sal_Char* const ppcTickMode[] = { "off", "inside", "outside", "cross" }; - static const sal_Char* const ppcTickPos[] = { "off", "low", "high", "next-to-axis" }; - static const sal_Char* const ppcText[] = { "transparent", "opaque" }; - LINESTART(); - sal_uInt8 nMajor, nMinor, nPos, nText; - rIn >> nMajor >> nMinor >> nPos >> nText; - ADDTEXT( "major=" ); __AddDec( t, nMajor ); - lcl_AddEnum( t, nMajor, ppcTickMode, STATIC_TABLE_SIZE( ppcTickMode ) ); - ADDTEXT( " minor=" ); __AddDec( t, nMinor ); - lcl_AddEnum( t, nMinor, ppcTickMode, STATIC_TABLE_SIZE( ppcTickMode ) ); - PRINT(); - LINESTART(); - ADDTEXT( "position=" ); __AddDec( t, nPos ); - lcl_AddEnum( t, nPos, ppcTickPos, STATIC_TABLE_SIZE( ppcTickPos ) ); - ADDTEXT( " text-mode=" ); __AddDec( t, nText ); - lcl_AddEnum( t, nText, ppcText, STATIC_TABLE_SIZE( ppcText ) ); - ADDTEXT( " text-color=" ); - ADDTEXT( GetRGB( Read4( rIn ) ) ); - PRINT(); - LINESTART(); - ADDTEXT( "reserved=" ); ADDHEX( 4 ); - ADDTEXT( "," ); ADDHEX( 4 ); - ADDTEXT( "," ); ADDHEX( 4 ); - ADDTEXT( "," ); ADDHEX( 4 ); - PRINT(); - rIn >> __nFlags; - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fAutoCol" ); - ADDFLAG( 0x0002, "fAutoBack" ); - ADDFLAG( 0x0020, "fAutoRot" ); - ADDRESERVED( 0xFFDC ); - PRINT(); - LINESTART(); - ADDTEXT( "color=" ); ADDDEC( 2 ); - ADDTEXT( " rotation=" ); ADDDEC( 2 ); - PRINT(); - } - break; - case 0x101F: // CHVALUERANGE - { - LINESTART(); - ADDTEXT( "min=" ); ADDDOUBLE(); - ADDTEXT( " max=" ); ADDDOUBLE(); - ADDTEXT( " major=" ); ADDDOUBLE(); - ADDTEXT( " minor=" ); ADDDOUBLE(); - ADDTEXT( " axis-cross=" ); ADDDOUBLE(); - PRINT(); - rIn >> __nFlags; - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fAutoMin" ); - ADDFLAG( 0x0002, "fAutoMax" ); - ADDFLAG( 0x0004, "fAutoMajor" ); - ADDFLAG( 0x0008, "fAutoMinor" ); - ADDFLAG( 0x0010, "fAutoCross" ); - ADDFLAG( 0x0020, "fLogScale" ); - ADDFLAG( 0x0040, "fReverse" ); - ADDFLAG( 0x0080, "fMaxCross" ); - ADDRESERVED( 0xFF00 ); - PRINT(); - } - break; - case 0x1020: // CHEXTRANGE - { - LINESTART(); - ADDTEXT( "axis-cross=" ); ADDDEC( 2 ); - ADDTEXT( " label-freq=" ); ADDDEC( 2 ); - ADDTEXT( " mark-freq=" ); ADDDEC( 2 ); - PRINT(); - rIn >> __nFlags; - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fBetween" ); - ADDFLAG( 0x0002, "fMaxCross" ); - ADDFLAG( 0x0004, "fReverse" ); - ADDRESERVED( 0xFFF8 ); - PRINT(); - } - break; - case 0x1021: // ChartAxislineformat - { - LINESTART(); - switch( Read2( rIn ) ) - { - case 0: p = "axis line itself"; break; - case 1: p = "major grid line"; break; - case 2: p = "minor grid line"; break; - case 3: p = "walls or floor"; break; - default: p = pU; - } - ADDTEXT( p ); - PRINT(); - } - break; - case 0x1022: // CHARTFORMATLINK - ContDump( nL ); - break; - case 0x1024: // ChartDefaulttext - ContDump( nL ); - break; - case 0x1025: // ChartText - { - LINESTART(); - UINT8 nAt, nVat; - UINT16 nBkgMode; - INT32 nX, nY, nDx, nDy; - UINT16 nGrbit2, nIcvText; - INT16 nTrot; - rIn >> nAt >> nVat >> nBkgMode; - ADDTEXT( "h = " ); - switch( nAt ) - { - case 1: p = "left"; break; - case 2: p = "center"; break; - case 3: p = "right"; break; - case 4: p = "justify"; break; - case 5: p = "distribute"; break; - default: p = pU; - } - ADDTEXT( p ); - ADDTEXT( " v = " ); - switch( nVat ) - { - case 1: p = "top"; break; - case 2: p = "center"; break; - case 3: p = "bottom"; break; - case 4: p = "justify"; break; - case 5: p = "distribute"; break; - default: p = pU; - } - ADDTEXT( p ); - ADDTEXT( " mode = " ); - if( nBkgMode == 1 ) - ADDTEXT( "transparent" ); - else if( nBkgMode == 2 ) - ADDTEXT( "opaque" ); - else - ADDTEXT( pU ); - PRINT(); - LINESTART(); - ADDTEXT( "color = " ); - ADDTEXT( GetRGB( Read4( rIn ) ) ); - rIn >> nX >> nY >> nDx >> nDy >> __nFlags >> nIcvText >> nGrbit2 >> nTrot; - ADDTEXT( " pos[size] = " ); - __AddDec( t, nX ); - ADDTEXT( " / " ); - __AddDec( t, nY ); - ADDTEXT( " [" ); - __AddDec( t, nDx ); - ADDTEXT( " / " ); - __AddDec( t, nDy ); - ADDTEXT( "]" ); - PRINT(); - LINESTART(); - ADDTEXT( " (pos[size] = " ); - __AddHex( t, nX ); - ADDTEXT( " / " ); - __AddHex( t, nY ); - ADDTEXT( " [" ); - __AddHex( t, nDx ); - ADDTEXT( " / " ); - __AddHex( t, nDy ); - ADDTEXT( "])" ); - PRINT(); - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fAutoColor" ); - ADDFLAG( 0x0002, "fShowKey" ); - ADDFLAG( 0x0004, "fShowValue" ); - ADDFLAG( 0x0008, "fVert" ); - ADDFLAG( 0x0010, "fAutoText" ); - ADDFLAG( 0x0020, "fGenerated" ); - ADDFLAG( 0x0040, "fDeleted" ); - ADDFLAG( 0x0080, "fAutoMode" ); - ADDFLAG( 0x0800, "fShLabPct" ); - ADDFLAG( 0x1000, "fShowPct" ); - ADDFLAG( 0x2000, "fShowBubbleSizes" ); - ADDFLAG( 0x4000, "fShowLabel" ); - PRINT(); - } - LINESTART(); - ADDTEXT( "rot = " ); - switch( __nFlags & 0x0700 ) - { - case 0x0000: p = "no rotation"; break; - case 0x0100: p = "top to bottom, upright"; break; - case 0x0200: p = "90 deg counterclockwise"; break; - case 0x0300: p = "90 deg clockwise"; break; - default: p = pU; - } - ADDTEXT( p ); - ADDTEXT( " trot = " ); - __AddDec( t, nTrot ); - PRINT(); - LINESTART(); - ADDTEXT( "text color = " ); - __AddDec( t, nIcvText ); - PRINT(); - LINESTART(); - ADDTEXT( "placement: " ); - switch( nGrbit2 & 0x000F ) - { - case 0: p = "0 default"; break; - case 1: p = "outside"; break; - case 2: p = "inside"; break; - case 3: p = "center"; break; - case 4: p = "axis"; break; - case 5: p = "above"; break; - case 6: p = "below"; break; - case 7: p = "left"; break; - case 8: p = "right"; break; - case 9: p = "auto"; break; - case 10: p = "moved"; break; - default: p = pU; - } - ADDTEXT( p ); - PRINT(); - } - break; - case 0x1026: // ChartFontx - ContDump( nL ); - break; - case 0x1027: // CHOBJECTLINK - { - static const sal_Char* const ppcObjLink[] = { 0, "title", "y-axis", "x-axis", "data", "legend", "none", "z-axis" }; - LINESTART(); - sal_uInt16 nObjLink; - rIn >> nObjLink; - ADDTEXT( "link=" ); __AddDec( t, nObjLink ); - lcl_AddEnum( t, nObjLink, ppcObjLink, STATIC_TABLE_SIZE( ppcObjLink ) ); - ADDTEXT( " series=" ); ADDDEC( 2 ); - ADDTEXT( " point=" ); ADDDEC( 2 ); - PRINT(); - } - break; - case 0x1032: // ChartFrame - { - LINESTART(); - switch( Read2( rIn ) ) - { - case 0: p = "no border"; break; - case 1: - case 2: - case 3: p = "reserved"; break; - case 4: p = "with shadow"; break; - default: p = pU; - } - ADDTEXT( "Frame type: " ); - ADDTEXT( p ); - PRINT(); - rIn >> __nFlags; - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x01, "fAutoSize" ); - ADDFLAG( 0x02, "fAutoPosition" ); - PRINT(); - } - } - break; - case 0x1035: // ChartPlotarea - ContDump( nL ); - break; - case 0x103A: // Chart3D - ContDump( nL ); - break; - case 0x103C: // ChartPicf - LINESTART(); - ADDTEXT( "bmp-mode=" ); ADDDEC( 2 ); - ADDTEXT( " format=" ); ADDDEC( 2 ); - ADDTEXT( " flags=" ); ADDHEX( 2 ); - ADDTEXT( " scale=" ); ADDDOUBLE(); - PRINT(); - break; - case 0x103D: // ChartDropbar - ContDump( nL ); - break; - case 0x103E: // ChartRadar - ContDump( nL ); - break; - case 0x103F: // ChartSurface - ContDump( nL ); - break; - case 0x1040: // ChartRadararea - ContDump( nL ); - break; - case 0x1041: // ChartAxisparent - { - LINESTART(); - switch( Read2( rIn ) ) - { - case 0: p = "main"; break; - case 1: p = "secondary"; break; - default: p = pU; - } - ADDTEXT( "Index: " ); - ADDTEXT( p ); - ADDTEXT( " " ); - ADDDEC(4); - ADDTEXT( '/' ); - ADDDEC(4); - ADDTEXT( " [" ); - ADDDEC(4); - ADDTEXT( '/' ); - ADDDEC(4); - ADDTEXT( ']' ); - PRINT(); - } - break; - case 0x1043: // ChartLegendxn - ContDump( nL ); - break; - case 0x1044: // ChartShtprops - ContDump( nL ); - break; - case 0x1045: // ChartSertocrt - ContDump( nL ); - break; - case 0x1046: // ChartAxesused - { - LINESTART(); - ADDTEXT( "Used : " ); - ADDDEC( 2 ); - PRINT(); - } - break; - case 0x1048: // ChartSbaseref - ContDump( nL ); - break; - case 0x104A: // CHSERPARENT - LINESTART(); - ADDTEXT( "parent-index=" ); ADDDEC( 2 ); - ADDTEXT( " (one-based)" ); - PRINT(); - break; - case 0x104B: // CHSERTRENDLINE - { - static const sal_Char* const ppcType[] = - { "poynomial", "exponential", "logarithmic", "power", "moving-avg" }; - sal_uInt8 nType; - rIn >> nType; - LINESTART(); - ADDTEXT( "line-type=" ); __AddDec( t, nType ); - lcl_AddEnum( t, nType, ppcType, STATIC_TABLE_SIZE( ppcType ) ); - ADDTEXT( " order=" ); ADDDEC( 1 ); - ADDTEXT( " intercept=" ); ADDDOUBLE(); - PRINT(); - LINESTART(); - ADDTEXT( "show-equation=" ); ADDDEC( 1 ); - ADDTEXT( " show-r-sqr=" ); ADDDEC( 1 ); - PRINT(); - LINESTART(); - ADDTEXT( "forecast-for=" ); ADDDOUBLE(); - ADDTEXT( " forecast-back=" ); ADDDOUBLE(); - PRINT(); - } - break; - case 0x104E: // ChartIfmt - ContDump( nL ); - break; - case 0x104F: // ChartPos - { - LINESTART(); - UINT16 nMdTopLt, nMdBotRt; - INT32 nX, nY, nDx, nDy; - rIn >> nMdTopLt >> nMdBotRt >> nX >> nY >> nDx >> nDy; - ADDTEXT( "TopLr = " ); - __AddDec( t, nMdTopLt ); - ADDTEXT( " BotRt = " ); - __AddDec( t, nMdBotRt ); - PRINT(); - LINESTART(); - __AddDec( t, nX ); - ADDTEXT( " / " ); - __AddDec( t, nY ); - ADDTEXT( " [" ); - __AddDec( t, nDx ); - ADDTEXT( " / " ); - __AddDec( t, nDy ); - ADDTEXT( "]" ); - PRINT(); - } - break; - case 0x1050: // ChartAlruns - ContDump( nL ); - break; - case 0x1051: // AI - { - LINESTART(); - UINT8 n8 = Read1( rIn ); - switch( n8 ) - { - case 0: p = "title or text"; break; - case 1: p = "values"; break; - case 2: p = "categories"; break; - case 3: p = "bubble sizes"; break; - default: p = pU; - } - ADDTEXT( "Link index identifier: " ); - ADDTEXT( p ); - if ( p == pU ) - __AddHex( t, n8 ); - PRINT(); - LINESTART(); - switch( Read1( rIn ) ) - { - case 0: p = "default categories"; break; - case 1: p = "text or value"; break; - case 2: p = "linked to worksheet"; break; - case 3: p = "not used (HaHaHa...)"; break; - case 4: p = "error reported"; break; - default: p = pU; - } - ADDTEXT( "Refernce type: " ); - ADDTEXT( p ); - PRINT(); - rIn >> __nFlags; - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x01, "fCustomIfmt" ); - PRINT(); - } - LINESTART(); - ADDTEXT( "Numberformat = " ); - ADDDEC( 2 ); - PRINT(); - LINESTART(); - UINT16 n; - rIn >> n; - ADDTEXT( "Formula [" ); - __AddDec( t, n ); - ADDTEXT( "]: ---------------- " ); - PRINT(); - FormulaDump( n, FT_CellFormula ); - } - break; - case 0x105B: // CHSERERRORBAR - { - static const sal_Char* const ppcType[] = { 0, "x-plus", "x-minus", "y-plus", "y-minus" }; - static const sal_Char* const ppcSource[] = { 0, "percent", "fixed", "std-dev", "custom", "std-error" }; - static const sal_Char* const ppcLineEnd[] = { "blank", "t-shape" }; - sal_uInt8 nType, nSource, nLineEnd; - rIn >> nType >> nSource >> nLineEnd; - LINESTART(); - ADDTEXT( "bar-type=" ); __AddDec( t, nType ); - lcl_AddEnum( t, nType, ppcType, STATIC_TABLE_SIZE( ppcType ) ); - ADDTEXT( " value-source=" ); __AddDec( t, nSource ); - lcl_AddEnum( t, nSource, ppcSource, STATIC_TABLE_SIZE( ppcSource ) ); - ADDTEXT( " line-end=" ); __AddDec( t, nLineEnd ); - lcl_AddEnum( t, nLineEnd, ppcLineEnd, STATIC_TABLE_SIZE( ppcLineEnd ) ); - PRINT(); - LINESTART(); - ADDTEXT( "reserved=" ); ADDHEX( 1 ); - ADDTEXT( " value=" ); ADDDOUBLE(); - ADDTEXT( " ref-count=" ); ADDDEC( 2 ); - PRINT(); - } - break; - case 0x105D: // ChartSerfmt - ContDump( nL ); - break; - case 0x105F: // Chart3DDataForm - { - UINT8 nGround, nTop; - nGround = Read1( rIn ); - nTop = Read1( rIn ); - UINT16 nStyle = ((UINT16)nGround << 8) | nTop; - LINESTART(); - ADDTEXT( "3D - format (" ); - __AddHex( t, nGround ); - ADDTEXT( " " ); - __AddHex( t, nTop ); - ADDTEXT( "): " ); - switch( nStyle ) - { - case 0x0000: ADDTEXT( "bar" ); break; - case 0x0001: ADDTEXT( "pyramid" ); break; - case 0x0002: ADDTEXT( "pyramid, cut" ); break; - case 0x0100: ADDTEXT( "cylinder" ); break; - case 0x0101: ADDTEXT( "cone" ); break; - case 0x0102: ADDTEXT( "cone, cut" ); break; - default: ADDTEXT( pU ); - } - PRINT(); - } - break; - case 0x1060: // ChartFbi - { - LINESTART(); - ADDTEXT( "dmixBasis = " ); - ADDDEC( 2 ); - ADDTEXT( " dmiyBasis = " ); - ADDDEC( 2 ); - ADDTEXT( " twpHeightBasis = " ); - ADDDEC( 2 ); - ADDTEXT( " scab = " ); - ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "ifnt = " ); - ADDDEC( 2 ); - PRINT(); - } - break; - case 0x1061: // ChartBoppop - ContDump( nL ); - break; - case 0x1062: // ChartAxcext - { - LINESTART(); - ADDTEXT( "cat on axis: " ); - ADDDEC( 2 ); - ADDTEXT( " ... " ); - ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "major unit: val = " ); - ADDDEC( 2 ); - ADDTEXT( " units = " ); - ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "minor unit: val = " ); - ADDDEC( 2 ); - ADDTEXT( " units = " ); - ADDDEC( 2 ); - PRINT(); - LINESTART(); - ADDTEXT( "base unit = " ); - ADDDEC( 2 ); - ADDTEXT( " crossing point of val axis = " ); - ADDDEC( 2 ); - PRINT(); - rIn >> __nFlags; - if( __nFlags ) - { - LINESTART(); - STARTFLAG(); - ADDFLAG( 0x0001, "fAutoMin" ); - ADDFLAG( 0x0002, "fAutoMax" ); - ADDFLAG( 0x0004, "fAutoMajor" ); - ADDFLAG( 0x0008, "fAutoMinor" ); - ADDFLAG( 0x0010, "fDateAxis" ); - ADDFLAG( 0x0020, "fAutoBase" ); - ADDFLAG( 0x0040, "fAutoCross" ); - ADDFLAG( 0x0080, "fAutoDate" ); - PRINT(); - } - } - break; - case 0x1063: // ChartDat - ContDump( nL ); - break; - case 0x1064: // ChartPlotgrowth - { - UINT32 nDx, nDy; - rIn >> nDx >> nDy; - LINESTART(); - ADDTEXT( "dxPlotGrowth = " ); - __Add16p16( t, nDx ); - ADDTEXT( " (" ); - __AddHex( t, nDx ); - ADDTEXT( ") dyPlotGrowth = " ); - __Add16p16( t, nDy ); - ADDTEXT( " (" ); - __AddHex( t, nDy ); - ADDTEXT( ")" ); - PRINT(); - } - break; - case 0x1065: // ChartSiindex - ContDump( nL ); - break; - case 0x1066: // ChartGelframe - EscherDump( nL, false ); - break; - case 0x1067: // ChartBoppcustom - ContDump( nL ); - break; - default: - if( !bEncrypted ) - ContDump( nL ); - } - - } - - if( nR == EXC_ID_FILEPASS ) - { - bEncrypted = true; - pIn->Seek( EXC_REC_SEEK_TO_BEGIN ); - bool bValid = (XclImpDecryptHelper::ReadFilepass( *pIn ) == ERRCODE_NONE); - LINESTART(); - ADDTEXT( "decrypter=" ); lcl_AddOnOff( t, bValid ); - PRINT(); - bBIFF8 = bBIFF8 && bValid; // dump BIFF8 hex only on invalid decrypter - } - - if( bDec ) - pLevelPre -= nLevelInc; -} - - -static const sal_Char* GetBlipType( UINT8 n ) -{ - switch ( n ) - { - case 0 : - return " ERROR"; - break; - case 1 : - return " UNKNOWN"; - break; - case 2 : - return " EMF"; - break; - case 3 : - return " WMF"; - break; - case 4 : - return " PICT"; - break; - case 5 : - return " JPEG"; - break; - case 6 : - return " PNG"; - break; - case 7 : - return " DIB"; - break; - default: - if ( n < 32 ) - return " NotKnown"; - else - return " Client"; - } -} - -void Biff8RecDumper::EscherDump( const ULONG nMaxLen, bool bDumpOffset ) -{ - ULONG n = nMaxLen; - UINT16 nPre, nR; - UINT32 nL; - const sal_Char* p; - ByteString aT; - UINT16 nDumpSize; - - aT += pLevelPre; - - ULONG nStartPos = pIn->GetSvStreamPos(); - while( pIn->IsValid() && (n > 0) ) - { - ULONG nCurrPos = pIn->GetSvStreamPos(); - *pIn >> nPre >> nR >> nL; - n -= sizeof( nPre ) + sizeof( nR ) + sizeof( nL ); - - switch( nR ) - { - case 0xF000: p = "MsofbtDggContainer"; break; - case 0xF006: p = "MsofbtDgg"; break; - case 0xF016: p = "MsofbtCLSID"; break; - case 0xF00B: p = "MsofbtOPT"; break; - case 0xF11A: p = "MsofbtColorMRU"; break; - case 0xF11E: p = "MsofbtSplitMenuColors"; break; - case 0xF001: p = "MsofbtBstoreContainer"; break; - case 0xF007: p = "MsofbtBSE"; break; - case 0xF002: p = "MsofbtDgContainer"; break; - case 0xF008: p = "MsofbtDg"; break; - case 0xF118: p = "MsofbtRegroupItem"; break; - case 0xF120: p = "MsofbtColorScheme"; break; - case 0xF003: p = "MsofbtSpgrContainer"; break; - case 0xF004: p = "MsofbtSpContainer"; break; - case 0xF009: p = "MsofbtSpgr"; break; - case 0xF00A: p = "MsofbtSp"; break; - case 0xF00C: p = "MsofbtTextbox"; break; - case 0xF00D: p = "MsofbtClientTextbox"; break; - case 0xF00E: p = "MsofbtAnchor"; break; - case 0xF00F: p = "MsofbtChildAnchor"; break; - case 0xF010: p = "MsofbtClientAnchor"; break; - case 0xF011: p = "MsofbtClientData"; break; - case 0xF11F: p = "MsofbtOleObject"; break; - case 0xF11D: p = "MsofbtDeletedPspl"; break; - case 0xF005: p = "MsofbtSolverContainer"; break; - case 0xF012: p = "MsofbtConnectorRule"; break; - case 0xF013: p = "MsofbtAlignRule"; break; - case 0xF014: p = "MsofbtArcRule"; break; - case 0xF015: p = "MsofbtClientRule"; break; - case 0xF017: p = "MsofbtCalloutRule"; break; - case 0xF119: p = "MsofbtSelection"; break; - case 0xF122: p = "MsofbtUDefProp"; break; - default: - if( nR >= 0xF018 && nR <= 0xF117 ) - p = "MsofbtBLIP"; - else if ( ( nPre & 0x000F ) == 0x000F ) - p = "UNKNOWN container"; - else - p = "UNKNOWN ID"; - } - - aT += " "; - __AddHex( aT, nR ); - ((aT += " ") += p) += " ["; - __AddHex( aT, nPre ); - aT += ','; - __AddHex( aT, nL ); - aT += "] instance: "; - __AddDec( aT, (UINT16)(nPre >> 4) ); - if( bDumpOffset ) - { - aT.Append( " pos=" ); - __AddHex( aT, static_cast< sal_uInt32 >( mnEscherPos + nCurrPos - nStartPos ) ); - } - Print( aT ); - - if ( nR == 0xF007 && 36 <= n && 36 <= nL ) - { // BSE, FBSE - ULONG nP = pIn->GetRecPos(); - UINT8 n8; - UINT16 n16; - UINT32 n32; - - aT = " btWin32: "; - *pIn >> n8; - __AddHex( aT, n8 ); - aT += GetBlipType( n8 ); - aT += " btMacOS: "; - *pIn >> n8; - __AddHex( aT, n8 ); - aT += GetBlipType( n8 ); - Print( aT ); - - aT = " rgbUid:"; - Print( aT ); - ContDump( 16 ); - - aT = " tag: "; - *pIn >> n16; - __AddHex( aT, n16 ); - Print( aT ); - - aT = " size: "; - *pIn >> n32; - __AddHex( aT, n32 ); - Print( aT ); - - aT = " cRef: "; - *pIn >> n32; - __AddHex( aT, n32 ); - Print( aT ); - - aT = " offs: "; - *pIn >> n32; - __AddHex( aT, n32 ); - Print( aT ); - - aT = " usage: "; - *pIn >> n8; - __AddHex( aT, n8 ); - aT += " cbName: "; - *pIn >> n8; - __AddHex( aT, n8 ); - aT += " unused2: "; - *pIn >> n8; - __AddHex( aT, n8 ); - aT += " unused3: "; - *pIn >> n8; - __AddHex( aT, n8 ); - Print( aT ); - - n -= pIn->GetRecPos() - nP; - nL = 0; // loop to MsofbtBLIP - } - else if ( nR == 0xF00F && 0x10 <= n && 0x10 <= nL ) - { // ChildAnchor - ULONG nP = pIn->GetRecPos(); - sal_Int32 n32; - - aT.Assign( " pos1=" ); - *pIn >> n32; lclAppendDec( aT, n32 ); - aT.Append( " pos2=" ); - *pIn >> n32; lclAppendDec( aT, n32 ); - aT.Append( " pos3=" ); - *pIn >> n32; lclAppendDec( aT, n32 ); - aT.Append( " pos4=" ); - *pIn >> n32; lclAppendDec( aT, n32 ); - Print( aT ); - - ULONG nC = pIn->GetRecPos() - nP; - n -= nC; - nL -= nC; - } - else if ( nR == 0xF010 && 0x12 <= n && 0x12 <= nL ) - { // ClientAnchor - ULONG nP = pIn->GetRecPos(); - UINT16 n16; - - aT = " Flag: "; - *pIn >> n16; - __AddHex( aT, n16 ); - if( n16 & 0x0001 ) aT += " -fixedpos"; - if( n16 & 0x0002 ) aT += " -fixedsize"; - Print( aT ); - - aT = " Col1: "; - *pIn >> n16; - __AddHex( aT, n16 ); - aT += " dX1: "; - *pIn >> n16; - __AddHex( aT, n16 ); - aT += " Row1: "; - *pIn >> n16; - __AddHex( aT, n16 ); - aT += " dY1: "; - *pIn >> n16; - __AddHex( aT, n16 ); - Print( aT ); - - aT = " Col2: "; - *pIn >> n16; - __AddHex( aT, n16 ); - aT += " dX2: "; - *pIn >> n16; - __AddHex( aT, n16 ); - aT += " Row2: "; - *pIn >> n16; - __AddHex( aT, n16 ); - aT += " dY2: "; - *pIn >> n16; - __AddHex( aT, n16 ); - Print( aT ); - - ULONG nC = pIn->GetRecPos() - nP; - n -= nC; - nL -= nC; - } - else if ( nR == 0xF00A ) - { - sal_uInt32 nId, nFlags; - *pIn >> nId >> nFlags; - aT.Assign( " shape-id=" ); - __AddHex( aT, nId ); - aT.Append( " flags=" ); - __AddHex( aT, nFlags ); - Print( aT ); - nL -= 8; n -= 8; - } - else if ( nR == 0xF00B || nR == 0xF122 ) - { // OPT - sal_uInt32 nComplex = 0; - while ( nL >= 6 + nComplex && n >= 6 + nComplex ) - { - UINT16 n16; - UINT32 n32; - *pIn >> n16 >> n32; - nL -= 6; n -= 6; - aT = " "; - __AddHex( aT, n16 ); - aT += " ("; - __AddDec( aT, n16 & 0x3FFF, 5 ); - if ( (n16 & 0x8000) == 0 ) - { - if ( n16 & 0x4000 ) - aT += ", fBlipID"; - aT += ") "; - __AddHex( aT, n32 ); - if ( (n16 & 0x4000) == 0 ) - { - aT += " ("; - __AddDec1616( aT, n32 ); - aT += ')'; - } - Print( aT ); - } - else - { - aT += ", fComplex) "; - __AddHex( aT, n32 ); - Print( aT ); - nComplex += n32; - } - } - // complex property data - while ( nComplex && n > 0 ) - { - sal_uInt32 nDumpSize = (nComplex > n) ? n : nComplex; - ContDump( nDumpSize ); - nComplex -= nDumpSize; - nL -= nDumpSize; - n -= nDumpSize; - } - } - else if ( nR == 0xF012 ) - { - aT = " Connector rule: "; __AddDec( aT, pIn->ReaduInt32() ); - aT += " ShapeID A: "; __AddHex( aT, pIn->ReaduInt32() ); - aT += " ShapeID B: "; __AddHex( aT, pIn->ReaduInt32() ); - Print( aT ); - aT = " ShapeID connector: "; __AddHex( aT, pIn->ReaduInt32() ); - aT += " Connect pt A: "; __AddHex( aT, pIn->ReaduInt32() ); - aT += " Connect pt B: "; __AddHex( aT, pIn->ReaduInt32() ); - Print( aT ); - nL -= 24; n -= 24; - } - - if( ( nPre & 0x000F ) == 0x000F ) - { // Container - if ( nL <= (UINT32) n ) - Print( " completed within" ); - else - Print( " continued elsewhere" ); - } - else - // -> 0x0000 ... 0x0FFF - { - nDumpSize = ( ( UINT32 ) nL > ( UINT32 ) n )? ( UINT16 ) n : ( UINT16 ) nL; - - if( nDumpSize ) - { - ContDump( nDumpSize ); - n -= nDumpSize; - } - } - - aT.Erase(); - } - if( bDumpOffset ) - mnEscherPos += nMaxLen; -} - - -void Biff8RecDumper::ObjDump( const ULONG nMaxLen ) -{ -#if 0 -// if an entire hex block is needed - pIn->PushPosition(); - ContDump( nMaxLen ); - pIn->PopPosition(); -#endif - - ULONG n = nMaxLen; - UINT16 nR, nL; - const sal_Char* p; - ByteString t; - XclImpStream& rIn = *pIn; - UINT16 nDumpSize; - sal_uInt16 nObjFlags = 0; - - t += pLevelPre; - - while( n > 0 ) - { - rIn >> nR >> nL; - n -= sizeof( nR ) + sizeof( nL ); - - BOOL bDetails = FALSE; - switch( nR ) - { - case 0x0000: p = "ftEnd"; break; - case 0x0001: p = "(Reserved)"; break; - case 0x0002: p = "(Reserved)"; break; - case 0x0003: p = "(Reserved)"; break; - case 0x0004: p = "ftMacro"; break; - case 0x0005: p = "ftButton"; break; - case 0x0006: p = "ftGmo"; break; - case 0x0007: p = "ftCf"; break; - case 0x0008: p = "ftPioGrbit"; bDetails = TRUE; break; - case 0x0009: p = "ftPictFmla"; bDetails = TRUE; break; - case 0x000A: p = "ftCbls"; break; - case 0x000B: p = "ftRbo"; break; - case 0x000C: p = "ftSbs"; break; - case 0x000D: p = "ftNts"; break; - case 0x000E: p = "ftSbsFmla"; break; - case 0x000F: p = "ftGboData"; break; - case 0x0010: p = "ftEdoData"; break; - case 0x0011: p = "ftRboData"; break; - case 0x0012: p = "ftCblsData"; break; - case 0x0013: p = "ftLbsData"; break; - case 0x0014: p = "ftCblsFmla"; break; - case 0x0015: p = "ftCmo"; bDetails = TRUE; break; - default: - p = "UNKNOWN ID"; - } - - t += " "; - __AddHex( t, nR ); - t += " ["; - __AddHex( t, nL ); - (t += "] ") += p; - Print( t ); - - nDumpSize = ( ( UINT32 ) nL > ( UINT32 ) n )? ( UINT16 ) n : ( UINT16 ) nL; - - if( nDumpSize ) - { - ULONG nPos1 = (bDetails ? rIn.GetRecPos() : 0); - ContDump( nDumpSize ); - n -= nDumpSize; - if ( bDetails ) - { - ULONG nPos2 = rIn.GetRecPos(); - rIn.Seek( nPos1 ); - t.Erase(); - switch ( nR ) - { - case 0x0008 : // ftPioGrbit - { - rIn >> nObjFlags; - UINT16 __nFlags = nObjFlags; - if ( __nFlags ) - { - ADDTEXT( " " ); - STARTFLAG(); - ADDFLAG( 0x0001, "man-size" ); - ADDFLAG( 0x0002, "linked" ); - ADDFLAG( 0x0008, "symbol" ); - ADDFLAG( 0x0010, "control" ); - ADDFLAG( 0x0020, "ctls-stream" ); - ADDFLAG( 0x0200, "autoload" ); - ADDRESERVED( 0xFDC4 ); - } - } - break; - case 0x0009 : // ftPictFmla - { - ADDTEXT( " Document type " ); - UINT16 nFmlaLen; - rIn >> nFmlaLen; - if( nObjFlags & 0x0002 ) - { - ADDTEXT( "linked\n OLE stream: LNK??? (from EXTERNNAME) " ); - rIn >> nFmlaLen; - ADDTEXT( " unknown=" ); ADDHEX( 4 ); - PRINT(); - t.Erase(); - FormulaDump( nFmlaLen, FT_CellFormula ); - } - else - { - ADDTEXT( "embedded " ); - const UINT16 nStringOffset = 14; // MAY be right - rIn.Seek( nPos1 + nStringOffset ); - INT32 nBytesLeft = nL - nStringOffset; - UINT16 nStrLen = rIn.ReaduInt16(); - ULONG nPos3 = rIn.GetRecPos(); - if( nStrLen ) - AddUNICODEString( t, rIn, TRUE, nStrLen ); - nBytesLeft -= (rIn.GetRecPos() - nPos3); - ADDTEXT( '\n' ); - if ( nBytesLeft < 4 ) - ADDTEXT( " >> ByteString OVERRUN <<\n" ); - - rIn.Seek( nPos1 + sizeof(nFmlaLen) + nFmlaLen ); - if( nObjFlags & 0x0020 ) - { - sal_uInt32 nStrmStart, nStrmLen; - rIn >> nStrmStart >> nStrmLen; - ADDTEXT( " 'Ctls' stream start=" ); - __AddHex( t, nStrmStart ); - ADDTEXT( " size=" ); - __AddHex( t, nStrmLen ); - maCtlsPosMap[ nStrmStart ] = nStrmLen; - } - else - { - ADDTEXT( " OLE storage name: MBD" ); - __AddPureHex( t, rIn.ReaduInt32() ); - } - } - } - break; - case 0x0015 : // ftCmo - { - UINT16 nType, nId; - rIn >> nType >> nId; - ADDTEXT( " Object ID " ); - __AddHex( t, nId ); - switch ( nType ) - { - case 0x0000 : p = "Group"; break; - case 0x0001 : p = "Line"; break; - case 0x0002 : p = "Rectangle"; break; - case 0x0003 : p = "Oval"; break; - case 0x0004 : p = "Arc"; break; - case 0x0005 : p = "Chart"; break; - case 0x0006 : p = "Text"; break; - case 0x0007 : p = "Button"; break; - case 0x0008 : p = "Picture"; break; - case 0x0009 : p = "Polygon"; break; - case 0x000a : p = "(Reserved)"; break; - case 0x000b : p = "Check box"; break; - case 0x000c : p = "Option button";break; - case 0x000d : p = "Edit box"; break; - case 0x000e : p = "Label"; break; - case 0x000f : p = "Dialog box"; break; - case 0x0010 : p = "Spinner"; break; - case 0x0011 : p = "Scroll bar"; break; - case 0x0012 : p = "List box"; break; - case 0x0013 : p = "Group box"; break; - case 0x0014 : p = "Combo box"; break; - case 0x0015 : p = "(Reserved)"; break; - case 0x0016 : p = "(Reserved)"; break; - case 0x0017 : p = "(Reserved)"; break; - case 0x0018 : p = "(Reserved)"; break; - case 0x0019 : p = "Comment"; break; - case 0x001a : p = "(Reserved)"; break; - case 0x001b : p = "(Reserved)"; break; - case 0x001c : p = "(Reserved)"; break; - case 0x001d : p = "(Reserved)"; break; - case 0x001e : p = "Microsoft Office drawing"; break; - default: - p = "UNKNOWN"; - } - ADDTEXT( ", type " ); - __AddHex( t, nType ); - ADDTEXT( ' ' ); - ADDTEXT( p ); - } - break; - } - if ( t.Len() ) - PRINT(); - rIn.Seek( nPos2 ); - } - } - - t.Erase(); - } -} - - -#undef LINESTART -#undef IGNORE -#undef ADDHEX -#undef ADDDEC -#undef PRINT -#undef PreDump -#undef ADDCELLHEAD - -void Biff8RecDumper::ContDump( const ULONG nL ) -{ - UINT32 nC = nMaxBodyLines; - UINT32 n = nL; - UINT32 nInL, nTmp; - UINT8* pB = new UINT8[ nL ]; - UINT8* p; - const UINT16 nLineLen = 16; - UINT16 nCharCnt; - BOOL bPart; - ByteString aT; - - aT += pLevelPre; - - while( n && nC ) - { - bPart = n < nLineLen; - nInL = bPart? n : nLineLen; - n -= nInL; - - pIn->Read( pB, nInL ); - - // als Hex-Codes - nTmp = nInL; - p = pB; - nCharCnt = 0; - while( nTmp ) - { - if( nCharCnt == nLineLen / 2 ) - aT += ' '; - - nCharCnt++; - - aT += ' '; - __AddPureHex( aT, *p ); - p++; - - nTmp--; - } - - if( bPart ) - aT += GetBlanks( ( UINT16 ) ( ( nLineLen - nInL ) * 3 ) ); - - // als chars - - aT += " "; - if( nInL < 9 ) - aT += ' '; - - nTmp = nInL; - p = pB; - nCharCnt = 0; - while( nTmp ) - { - if( nCharCnt == nLineLen / 2 ) - aT += ' '; - - nCharCnt++; - - if( IsPrintable( *p ) ) - aT += static_cast< sal_Char >( *p ); - else - aT += '.'; - - p++; - - nTmp--; - } - - Print( aT ); - aT.Erase(); - aT += pLevelPre; - - nC--; - } - - delete[] pB; -} - - -// Formula dumper ============================================================= - -/** Name and parameter count of an Excel function. */ -struct XclDumpFunc -{ - const sal_Char* pName; /// Name of the function. - sal_uInt16 nParam; /// Parameter count for fixed functions. -}; - -static const XclDumpFunc pFuncData[] = -{ -/* 0*/ { "COUNT", 0 }, - { "IF", 0 }, - { "ISNA", 1 }, - { "ISERROR", 1 }, - { "SUM", 0 }, -/* 5*/ { "AVERAGE", 0 }, - { "MIN", 0 }, - { "MAX", 0 }, - { "ROW", 0 }, - { "COLUMN", 0 }, -/* 10*/ { "NA", 0 }, - { "NPV", 0 }, - { "STDEV", 0 }, - { "DOLLAR", 0 }, - { "FIXED", 0 }, -/* 15*/ { "SIN", 1 }, - { "COS", 1 }, - { "TAN", 1 }, - { "ATAN", 1 }, - { "PI", 0 }, -/* 20*/ { "SQRT", 1 }, - { "EXP", 1 }, - { "LN", 1 }, - { "LOG10", 1 }, - { "ABS", 1 }, -/* 25*/ { "INT", 1 }, - { "SIGN", 1 }, - { "ROUND", 2 }, - { "LOOKUP", 0 }, - { "INDEX", 0 }, -/* 30*/ { "REPT", 2 }, - { "MID", 3 }, - { "LEN", 1 }, - { "VALUE", 1 }, - { "TRUE", 0 }, -/* 35*/ { "FALSE", 0 }, - { "AND", 0 }, - { "OR", 0 }, - { "NOT", 1 }, - { "MOD", 2 }, -/* 40*/ { "DCOUNT", 3 }, - { "DSUM", 3 }, - { "DAVERAGE", 3 }, - { "DMIN", 3 }, - { "DMAX", 3 }, -/* 45*/ { "DSTDEV", 3 }, - { "VAR", 0 }, - { "DVAR", 3 }, - { "TEXT", 2 }, - { "LINEST", 0 }, -/* 50*/ { "TREND", 0 }, - { "LOGEST", 0 }, - { "GROWTH", 0 }, - { "GOTO" }, // macro/internal - { "HALT" }, // macro/internal -/* 55*/ { "RETURN" }, // macro/internal - { "PV", 0 }, - { "FV", 0 }, - { "NPER", 0 }, - { "PMT", 0 }, -/* 60*/ { "RATE", 0 }, - { "MIRR", 3 }, - { "IRR", 0 }, - { "RAND", 0 }, - { "MATCH", 0 }, -/* 65*/ { "DATE", 3 }, - { "TIME", 3 }, - { "DAY", 1 }, - { "MONTH", 1 }, - { "YEAR", 1 }, -/* 70*/ { "WEEKDAY", 0 }, - { "HOUR", 1 }, - { "MINUTE", 1 }, - { "SECOND", 1 }, - { "NOW", 0 }, -/* 75*/ { "AREAS", 1 }, - { "ROWS", 1 }, - { "COLUMNS", 1 }, - { "OFFSET", 0 }, - { "ABSREF" }, // macro/internal -/* 80*/ { "RELREF" }, // macro/internal - { "ARGUMENT" }, // macro/internal - { "SEARCH", 0 }, - { "TRANSPOSE", 1 }, - { "ERROR" }, // macro/internal -/* 85*/ { "STEP" }, // macro/internal - { "TYPE", 1 }, - { "ECHO" }, // macro/internal - { "SET.NAME" }, // macro/internal - { "CALLER" }, // macro/internal -/* 90*/ { "DEREF" }, // macro/internal - { "WINDOWS" }, // macro/internal - { "SERIES" }, // macro/internal - { "DOCUMENTS" }, // macro/internal - { "ACTIVE.CELL" }, // macro/internal -/* 95*/ { "SELECTION" }, // macro/internal - { "RESULT" }, // macro/internal - { "ATAN2", 2 }, - { "ASIN", 1 }, - { "ACOS", 1 }, -/*100*/ { "CHOOSE", 0 }, - { "HLOOKUP", 0 }, - { "VLOOKUP", 0 }, - { "LINKS" }, // macro/internal - { "INPUT" }, // macro/internal -/*105*/ { "ISREF", 1 }, - { "GET.FORMULA" }, // macro/internal - { "GET.NAME" }, // macro/internal - { "SET.VALUE", 2 }, // macro/internal - { "LOG", 0 }, -/*110*/ { "EXEC" }, // macro/internal - { "CHAR", 1 }, - { "LOWER", 1 }, - { "UPPER", 1 }, - { "PROPER", 1 }, -/*115*/ { "LEFT", 0 }, - { "RIGHT", 0 }, - { "EXACT", 2 }, - { "TRIM", 1 }, - { "REPLACE", 4 }, -/*120*/ { "SUBSTITUTE", 0 }, - { "CODE", 1 }, - { "NAMES" }, // macro/internal - { "DIRECTORY" }, // macro/internal - { "FIND", 0 }, -/*125*/ { "CELL", 0 }, - { "ISERR", 1 }, - { "ISTEXT", 1 }, - { "ISNUMBER", 1 }, - { "ISBLANK", 1 }, -/*130*/ { "T", 1 }, - { "N", 1 }, - { "FOPEN" }, // macro/internal - { "FCLOSE" }, // macro/internal - { "FSIZE" }, // macro/internal -/*135*/ { "FREADLN" }, // macro/internal - { "FREAD" }, // macro/internal - { "FWRITELN" }, // macro/internal - { "FWRITE" }, // macro/internal - { "FPOS" }, // macro/internal -/*140*/ { "DATEVALUE", 1 }, - { "TIMEVALUE", 1 }, - { "SLN", 3 }, - { "SYD", 4 }, - { "DDB", 0 }, -/*145*/ { "GET.DEF" }, // macro/internal - { "REFTEXT" }, // macro/internal - { "TEXTREF" }, // macro/internal - { "INDIRECT", 0 }, - { "REGISTER" }, // macro/internal -/*150*/ { "CALL" }, - { "ADD.BAR" }, // macro/internal - { "ADD.MENU" }, // macro/internal - { "ADD.COMMAND" }, // macro/internal - { "ENABLE.COMMAND" }, // macro/internal -/*155*/ { "CHECK.COMMAND" }, // macro/internal - { "RENAME.COMMAND" }, // macro/internal - { "SHOW.BAR" }, // macro/internal - { "DELETE.MENU" }, // macro/internal - { "DELETE.COMMAND" }, // macro/internal -/*160*/ { "GET.CHART.ITEM" }, // macro/internal - { "DIALOG.BOX" }, // macro/internal - { "CLEAN", 1 }, - { "MDETERM", 1 }, - { "MINVERSE", 1 }, -/*165*/ { "MMULT", 2 }, - { "FILES" }, // macro/internal - { "IPMT", 0 }, - { "PPMT", 0 }, - { "COUNTA", 0 }, -/*170*/ { "CANCEL.KEY" }, // macro/internal - { "FOR" }, // macro/internal - { "WHILE" }, // macro/internal - { "BREAK" }, // macro/internal - { "NEXT" }, // macro/internal -/*175*/ { "INITIATE" }, // macro/internal - { "REQUEST" }, // macro/internal - { "POKE" }, // macro/internal - { "EXECUTE" }, // macro/internal - { "TERMINATE" }, // macro/internal -/*180*/ { "RESTART" }, // macro/internal - { "HELP" }, // macro/internal - { "GET.BAR" }, // macro/internal - { "PRODUCT", 0 }, - { "FACT", 1 }, -/*185*/ { "GET.CELL" }, // macro/internal - { "GET.WORKSPACE" }, // macro/internal - { "GET.WINDOW" }, // macro/internal - { "GET.DOCUMENT" }, // macro/internal - { "DPRODUCT", 3 }, -/*190*/ { "ISNONTEXT", 1 }, - { "GET.NOTE" }, // macro/internal - { "NOTE" }, // macro/internal - { "STDEVP", 0 }, - { "VARP", 0 }, -/*195*/ { "DSTDDEVP", 3 }, - { "DVARP", 3 }, - { "TRUNC", 0 }, - { "ISLOGICAL", 1 }, - { "DBCOUNTA", 3 }, -/*200*/ { "DELETE.BAR" }, // macro/internal - { "UNREGISTER" }, // macro/internal - { "202" }, // not used - { "203" }, // not used - { "USDOLLAR" }, -/*205*/ { "FINDB" }, - { "SEARCHB" }, - { "REPLACEB", 4 }, - { "LEFTB" }, - { "RIGHTB" }, -/*210*/ { "MIDB", 3 }, - { "LENB", 1 }, - { "ROUNDUP", 2 }, - { "ROUNDDOWN", 2 }, - { "ASC", 1 }, -/*215*/ { "DBSC", 1 }, - { "RANK", 0 }, - { "217" }, // not used - { "218" }, // not used - { "ADDRESS", 0 }, -/*220*/ { "DAYS360", 0 }, - { "TODAY", 0 }, - { "VDB", 0 }, - { "ELSE" }, // macro/internal - { "ELSE.IF" }, // macro/internal -/*225*/ { "END.IF" }, // macro/internal - { "FOR.CELL" }, // macro/internal - { "MEDIAN", 0 }, - { "SUMPRODUCT", 0 }, - { "SINH", 1 }, -/*230*/ { "COSH", 1 }, - { "TANH", 1 }, - { "ASINH", 1 }, - { "ACOSH", 1 }, - { "ATANH", 1 }, -/*235*/ { "DGET", 3 }, - { "CREATE.OBJECT" }, // macro/internal - { "VOLATILE" }, // macro/internal - { "LAST.ERROR" }, // macro/internal - { "CUSTOM.UNDO" }, // macro/internal -/*240*/ { "CUSTOM.REPEAT" }, // macro/internal - { "FORMULA.CONVERT" }, // macro/internal - { "GET.LINK.INFO" }, // macro/internal - { "TEXT.BOX" }, // macro/internal - { "INFO", 1 }, -/*245*/ { "GROUP" }, // macro/internal - { "GET.OBJECT" }, // macro/internal - { "DB", 0 }, - { "PAUSE" }, // macro/internal - { "249" }, // not used -/*250*/ { "250" }, // not used - { "RESUME" }, // macro/internal - { "FREQUENCY", 2 }, - { "ADD.TOOLBAR" }, // macro/internal - { "DELETE.TOOLBAR" }, // macro/internal -/*255*/ { "EXTERN.CALL" }, // macro/internal - { "RESET.TOOLBAR" }, // macro/internal - { "EVALUATE" }, // macro/internal - { "GET.TOOLBAR" }, // macro/internal - { "GET.TOOL" }, // macro/internal -/*260*/ { "SPELLING.CHECK" }, // macro/internal - { "ERROR.TYPE", 1 }, - { "APP.TITLE" }, // macro/internal - { "WINDOW.TITLE" }, // macro/internal - { "SAVE.TOOLBAR" }, // macro/internal -/*265*/ { "ENABLE.TOOL" }, // macro/internal - { "PRESS.TOOL" }, // macro/internal - { "REGISTER.ID" }, // macro/internal - { "GET.WORKBOOK" }, // macro/internal - { "AVEDEV", 0 }, -/*270*/ { "BETADIST", 0 }, - { "GAMMALN", 1 }, - { "BETAINV", 0 }, - { "BINOMDIST", 4 }, - { "CHIDIST", 2 }, -/*275*/ { "CHIINV", 2 }, - { "COMBIN", 2 }, - { "CONFIDENCE", 3 }, - { "CRITBINOM", 3 }, - { "EVEN", 1 }, -/*280*/ { "EXPONDIST", 3 }, - { "FDIST", 3 }, - { "FINV", 3 }, - { "FISHER", 1 }, - { "FISHERINV", 1 }, -/*285*/ { "FLOOR", 2 }, - { "GAMMADIST", 4 }, - { "GAMMAINV", 3 }, - { "CEILING", 2 }, - { "HYPGEOMDIST", 4 }, -/*290*/ { "LOGNORMDIST", 3 }, - { "LOGINV", 3 }, - { "NEGBINOMDIST", 3 }, - { "NORMDIST", 4 }, - { "NORMSDIST", 1 }, -/*295*/ { "NORMINV", 3 }, - { "NORMSINV", 1 }, - { "STANDARDIZE", 3 }, - { "ODD", 1 }, - { "PERMUT", 2 }, -/*300*/ { "POISSON", 3 }, - { "TDIST", 3 }, - { "WEIBULL", 4 }, - { "SUMXMY2", 2 }, - { "SUMX2MY2", 2 }, -/*305*/ { "SUMX2PY2", 2 }, - { "CHITEST", 2 }, - { "CORREL", 2 }, - { "COVAR", 2 }, - { "FORECAST", 3 }, -/*310*/ { "FTEST", 2 }, - { "INTERCEPT", 2 }, - { "PEARSON", 2 }, - { "RSQ", 2 }, - { "STEYX", 2 }, -/*315*/ { "SLOPE", 2 }, - { "TTEST", 4 }, - { "PROB", 0 }, - { "DEVSQ", 0 }, - { "GEOMEAN", 0 }, -/*320*/ { "HARMEAN", 0 }, - { "SUMSQ", 0 }, - { "KURT", 0 }, - { "SKEW", 0 }, - { "ZTEST", 0 }, -/*325*/ { "LARGE", 2 }, - { "SMALL", 2 }, - { "QUARTILE", 2 }, - { "PERCENTILE", 2 }, - { "PERCENTRANK", 0 }, -/*330*/ { "MODE", 0 }, - { "TRIMMEAN", 2 }, - { "TINV", 2 }, - { "333" }, // not used - { "MOVIE.COMMAND" }, // macro/internal -/*335*/ { "GET.MOVIE" }, // macro/internal - { "CONCATENATE", 0 }, - { "POWER", 2 }, - { "PIVOT.ADD.DATA" }, // macro/internal - { "GET.PIVOT.TABLE" }, // macro/internal -/*340*/ { "GET.PIVOT.FIELD" }, // macro/internal - { "GET.PIVOT.ITEM" }, // macro/internal - { "RADIANS", 1 }, - { "DEGREES", 1 }, - { "SUBTOTAL", 0 }, -/*345*/ { "SUMIF", 0 }, - { "COUNTIF", 2 }, - { "COUNTBLANK", 1 }, - { "SCENARIO.GET" }, // macro/internal - { "OPTIONS.LISTS.GET" }, // macro/internal -/*350*/ { "ISPMT", 4 }, - { "DATEDIF", 3 }, - { "DATESTRING", 1 }, - { "NUMBERSTRING", 2 }, - { "ROMAN", 0 }, -/*355*/ { "OPEN.DIALOG" }, // macro/internal - { "SAVE.DIALOG" }, // macro/internal - { "VIEW.GET" }, // macro/internal - { "GETPIVOTDATA", 0 }, - { "HYPERLINK", 2 }, -/*360*/ { "PHONETIC", 1 }, - { "AVERAGEA", 0 }, - { "MAXA", 0 }, - { "MINA", 0 }, - { "STDEVPA", 0 }, -/*365*/ { "VARPA", 0 }, - { "STDEVA", 0 }, - { "VARA", 0 }, - { "BAHTTEXT", 1 }, - { "THAIDAYOFWEEK", 1 }, -/*370*/ { "THAIDIGIT", 1 }, - { "THAIMONTHOFYEAR", 1 }, - { "THAINUMSOUND", 1 }, - { "THAINUMSTRING", 1 }, - { "THAISTRINGLENGTH", 1 }, -/*375*/ { "ISTHAIDIGIT", 1 }, - { "ROUNDBAHTDOWN", 1 }, - { "ROUNDBAHTUP", 1 }, - { "THAIYEAR", 1 }, - { "RTD" }, -/*380*/ { "ISHYPERLINK", 1 } -}; - -const XclDumpFunc* lcl_GetFuncData( sal_uInt16 nIndex ) -{ - return (nIndex < STATIC_TABLE_SIZE( pFuncData )) ? (pFuncData + nIndex) : NULL; -} - -// ---------------------------------------------------------------------------- - -/** Stack helper to create a human readable formula string from UPN. */ -class XclDumpFormulaStackImpl : private ScfDelStack< ByteString > -{ -public: - void PushOperand( const ByteString& rOperand ); - void PushUnary( const ByteString& rOperator, bool bInFront ); - void PushBinary( const ByteString& rOperator ); - void PushFunction( const ByteString& rFuncName, sal_uInt16 nParamCount ); - inline ByteString GetString() const { return Top() ? *Top() : ByteString(); } -}; - -void XclDumpFormulaStackImpl::PushOperand( const ByteString& rOperand ) -{ - Push( new ByteString( rOperand ) ); -} - -void XclDumpFormulaStackImpl::PushUnary( const ByteString& rOperator, bool bInFront ) -{ - if( !Count() ) return; - ByteString* pOp = Top(); - pOp->Insert( rOperator, bInFront ? 0 : pOp->Len() ); -} - -void XclDumpFormulaStackImpl::PushBinary( const ByteString& rOperator ) -{ - if( Count() < 2 ) return; - // second operand is on top - ByteString* pSecond = Pop(); - ByteString* pFirst = Top(); - *pFirst += rOperator; - *pFirst += *pSecond; - delete pSecond; -} - -void XclDumpFormulaStackImpl::PushFunction( const ByteString& rFuncName, sal_uInt16 nParamCount ) -{ - if( Count() < nParamCount ) return; - ByteString* pNew = new ByteString( ')' ); - for( sal_uInt16 nIndex = 0; nIndex < nParamCount; ++nIndex ) - { - if( nIndex ) pNew->Insert( ';', 0 ); - ByteString* pOp = Pop(); - pNew->Insert( *pOp, 0 ); - delete pOp; - } - pNew->Insert( '(', 0 ); - pNew->Insert( rFuncName, 0 ); - Push( pNew ); -} - -// ---------------------------------------------------------------------------- - -/** Stack to create a human readable formula and token class overview from UPN. */ -class XclDumpFormulaStack -{ -public: - void PushOperand( const ByteString& rOperand, sal_uInt8 nToken ); - inline void PushOperand( const sal_Char* pcOperand, sal_uInt8 nToken ) - { PushOperand( ByteString( pcOperand ), nToken ); } - - void PushUnary( const ByteString& rOperator, bool bInFront = true ); - inline void PushUnary( const sal_Char* pcOperator, bool bInFront = true ) - { PushUnary( ByteString( pcOperator ), bInFront ); } - - void PushBinary( const ByteString& rOperator ); - inline void PushBinary( const sal_Char* pcOperator ) - { PushBinary( ByteString( pcOperator ) ); } - - void PushFunction( const ByteString& rFuncName, sal_uInt16 nParamCount, sal_uInt8 nToken ); - inline void PushFunction( const sal_Char* pcFuncName, sal_uInt16 nParamCount, sal_uInt8 nToken ) - { PushFunction( ByteString( pcFuncName ), nParamCount, nToken ); } - - inline ByteString GetFormula() const { return maFmla.GetString(); } - inline ByteString GetTokenClasses() const { return maClass.GetString(); } - - static ByteString GetTokenClass( sal_uInt8 nToken ); - -private: - void PushTokenClass( sal_uInt8 nToken ); - - XclDumpFormulaStackImpl maFmla; - XclDumpFormulaStackImpl maClass; -}; - -void XclDumpFormulaStack::PushOperand( const ByteString& rOperand, sal_uInt8 nToken ) -{ - maFmla.PushOperand( rOperand ); - maClass.PushOperand( GetTokenClass( nToken ) ); -} - -void XclDumpFormulaStack::PushUnary( const ByteString& rOperator, bool bInFront ) -{ - maFmla.PushUnary( rOperator, bInFront ); - maClass.PushUnary( rOperator, bInFront ); -} - -void XclDumpFormulaStack::PushBinary( const ByteString& rOperator ) -{ - maFmla.PushBinary( rOperator ); - maClass.PushBinary( rOperator ); -} - -void XclDumpFormulaStack::PushFunction( const ByteString& rFuncName, sal_uInt16 nParamCount, sal_uInt8 nToken ) -{ - maFmla.PushFunction( rFuncName, nParamCount ); - maClass.PushFunction( GetTokenClass( nToken ), nParamCount ); -} - -ByteString XclDumpFormulaStack::GetTokenClass( sal_uInt8 nToken ) -{ - sal_Char cClass = 'B'; - switch( nToken & 0xE0 ) - { - case 0x20: cClass = 'R'; break; - case 0x40: cClass = 'V'; break; - case 0x60: cClass = 'A'; break; - } - return ByteString( cClass ); -} - -// ---------------------------------------------------------------------------- - -const sal_Char* lcl_GetErrorString( sal_uInt8 nErr ) -{ - switch( nErr ) - { - case 0x00: return "#NULL!"; - case 0x07: return "#DIV/0!"; - case 0x0F: return "#VALUE!"; - case 0x17: return "#REF!"; - case 0x1D: return "#NAME?"; - case 0x24: return "#NUM!"; - case 0x2A: return "#N/A!"; - } - return "!unknown!"; -} - - - -void lcl_StartToken( ByteString& rString, sal_uInt16 nPos, sal_uInt8 nToken, const sal_Char* pTokenName ) -{ - rString.Erase(); - rString.Append( " " ); - __AddHex( rString, nPos ); - rString.Append( " " ); - __AddHex( rString, nToken ); - rString.Append( " t" ).Append( pTokenName ).Expand( 33, ' ' ); -} - -void lcl_StartTokenClass( ByteString& rString, sal_uInt16 nPos, sal_uInt8 nToken, const sal_Char* pTokenName ) -{ - ByteString aToken( pTokenName ); - aToken.Append( XclDumpFormulaStack::GetTokenClass( nToken ) ); - lcl_StartToken( rString, nPos, nToken, aToken.GetBuffer() ); -} - -void Biff8RecDumper::FormulaDump( const UINT16 nL, const FORMULA_TYPE eFT ) -{ - if( !nL ) - return; - - sal_uInt32 nStartPos = pIn->GetRecPos(); - const sal_uInt32 nAfterPos = nStartPos + nL; - - BYTE nOp; - ByteString t, aOperand; - BOOL bError = FALSE; - const BOOL bRangeName = eFT == FT_RangeName; - const BOOL bSharedFormula = eFT == FT_SharedFormula; - const BOOL bRNorSF = bRangeName || bSharedFormula; - - XclDumpFormulaStack aStack; - sal_Bool bPrinted = sal_True; - -#define PRINTTOKEN() { if( !bPrinted ) Print( t ); bPrinted = sal_True; } -#define STARTTOKEN( name ) lcl_StartToken( t, static_cast< sal_uInt16 >( pIn->GetRecPos() - nStartPos - 1 ), nOp, name ) -#define STARTTOKENCLASS( name ) lcl_StartTokenClass( t, static_cast< sal_uInt16 >( pIn->GetRecPos() - nStartPos - 1 ), nOp, name ) - - while( pIn->IsValid() && ( pIn->GetRecPos() < nAfterPos ) && !bError ) - { - *pIn >> nOp; - bPrinted = sal_False; - aOperand.Erase(); - - switch( nOp ) // Buch Seite: - { // SDK4 SDK5 - case 0x01: // Array Formula [325 ] - { - STARTTOKEN( "Exp" ); - sal_uInt16 nRow, nCol; - *pIn >> nRow >> nCol; - t += "array formula or shared formula, base-address="; - lcl_AddRef( t, nCol, nRow ); - aStack.PushFunction( "ARRAY", 0, nOp ); - } - break; - case 0x02: // Data Table [325 277] - { - STARTTOKEN( "Tbl" ); - sal_uInt16 nRow, nCol; - *pIn >> nRow >> nCol; - t += "multiple operation, base-address="; - lcl_AddRef( t, nCol, nRow ); - aStack.PushFunction( "MULTIPLE.OPERATIONS", 0, nOp ); - } - break; - case 0x03: // Addition [312 264] - STARTTOKEN( "Add" ); - aStack.PushBinary( "+" ); - break; - case 0x04: // Subtraction [313 264] - STARTTOKEN( "Sub" ); - aStack.PushBinary( "-" ); - break; - case 0x05: // Multiplication [313 264] - STARTTOKEN( "Mul" ); - aStack.PushBinary( "*" ); - break; - case 0x06: // Division [313 264] - STARTTOKEN( "Div" ); - aStack.PushBinary( "/" ); - break; - case 0x07: // Exponetiation [313 265] - STARTTOKEN( "Power" ); - aStack.PushBinary( "^" ); - break; - case 0x08: // Concatenation [313 265] - STARTTOKEN( "Concat" ); - aStack.PushBinary( "&" ); - break; - case 0x09: // Less Than [313 265] - STARTTOKEN( "LT" ); - aStack.PushBinary( "<" ); - break; - case 0x0A: // Less Than or Equal [313 265] - STARTTOKEN( "LE" ); - aStack.PushBinary( "<=" ); - break; - case 0x0B: // Equal [313 265] - STARTTOKEN( "EQ" ); - aStack.PushBinary( "=" ); - break; - case 0x0C: // Greater Than or Equal [313 265] - STARTTOKEN( "GE" ); - aStack.PushBinary( ">=" ); - break; - case 0x0D: // Greater Than [313 265] - STARTTOKEN( "GT" ); - aStack.PushBinary( ">" ); - break; - case 0x0E: // Not Equal [313 265] - STARTTOKEN( "NE" ); - aStack.PushBinary( "<>" ); - break; - case 0x0F: // Intersection [314 265] - STARTTOKEN( "Isect" ); - aStack.PushBinary( " " ); - break; - case 0x10: // List [314 265] - STARTTOKEN( "List" ); - aStack.PushBinary( ";" ); - break; - case 0x11: // Range [314 265] - STARTTOKEN( "Range" ); - aStack.PushBinary( ":" ); - break; - case 0x12: // Unary Plus [312 264] - STARTTOKEN( "Uplus" ); - aStack.PushUnary( "+" ); - break; - case 0x13: // Unary Minus [312 264] - STARTTOKEN( "Uminus" ); - aStack.PushUnary( "-" ); - break; - case 0x14: // Percent Sign [312 264] - STARTTOKEN( "Percent" ); - aStack.PushUnary( "%", false ); - break; - case 0x15: // Parenthesis [326 278] - STARTTOKEN( "Paren" ); - // simulate two unary operators to enclose operand - aStack.PushUnary( "(" ); - aStack.PushUnary( ")", false ); - break; - case 0x16: // Missing Argument [314 266] - STARTTOKEN( "MissArg" ); - aStack.PushOperand( "~", nOp ); - break; - case 0x17: // ByteString Constant [314 266] - { - STARTTOKEN( "Str" ); - - UINT8 nLen; - *pIn >> nLen; - - t += "string [len="; - __AddDec( t, nLen ); - t += "] "; - - aOperand += '"'; - if( nLen ) - aOperand += GETSTR( pIn->ReadUniString( nLen ) ); - else - pIn->Ignore( 1 ); - aOperand += '"'; - t += aOperand; - aStack.PushOperand( aOperand, nOp ); - } - break; - case 0x18: - { - STARTTOKEN( "Extended" ); - UINT8 nEptg; - *pIn >> nEptg; - -#define D(name,size,ext,type) {t+="eptg ";__AddDec(t,(UINT16)nEptg);t+=": "; \ - t+=name;t+=" [";__AddDec(t,(UINT16)size);t+="] ";t+=type; \ - if(ext)t+=" + ext";PRINTTOKEN();ContDump(size);aStack.PushOperand(name,nOp);} - switch( nEptg ) - { // name size ext type - case 0x00: // res - D( "res", 0, 0, "" ); - break; - case 0x01: // Lel 4 - err - D( "Lel", 4, 0, "err" ); - break; - case 0x02: // Rw 4 - ref - D( "Rw", 4, 0, "ref" ); - break; - case 0x03: // Col 4 - ref - D( "Col", 4, 0, "ref" ); - break; - case 0x04: // res - case 0x05: // res - D( "res", 0, 0, "" ); - break; - case 0x06: // RwV 4 - val - D( "RwV", 4, 0, "val" ); - break; - case 0x07: // ColV 4 - val - D( "ColV", 4, 0, "val" ); - break; - case 0x08: // res - case 0x09: // res - D( "res", 0, 0, "" ); - break; - case 0x0A: // Radical 13 - ref - D( "Radical", 13, 0, "ref" ); - break; - case 0x0B: // RadicalS 13 x ref - D( "RadicalS", 13, 1, "ref" ); - break; - case 0x0C: // RwS 4 x ref - D( "RwS", 4, 1, "ref" ); - break; - case 0x0D: // ColS 4 x ref - D( "ColS", 4, 1, "ref" ); - break; - case 0x0E: // RwSV 4 x val - D( "RwSV", 4, 1, "val" ); - break; - case 0x0F: // ColSV 4 x val - D( "ColSV", 4, 1, "val" ); - break; - case 0x10: // RadicalLel 4 - err - D( "RadicalLel", 4, 0, "err" ); - break; - case 0x11: // res - case 0x12: // res - case 0x13: // res - case 0x14: // res - case 0x15: // res - case 0x16: // res - case 0x17: // res - case 0x18: // res - D( "res", 0, 0, "" ); - break; - case 0x19: // invalid values - case 0x1A: // invalid values - D( "invalid vals", 0, 0, "" ); - break; - case 0x1B: // res - case 0x1C: // res - D( "res", 0, 0, "" ); - break; - case 0x1D: // SxName 4 - val - D( "SxName", 4, 0, "val" ); - break; - case 0x1E: // res - D( "res", 0, 0, "" ); - break; - default: - D( "!unknown!", 0, 0, "" ); - } -#undef D - } - break; - case 0x19: // Special Attribute [327 279] - { - STARTTOKEN( "Attr" ); - UINT16 nData, nFakt; - BYTE nOpt; - - *pIn >> nOpt >> nData; - nFakt = 2; - - t += "flags="; __AddHex( t, nOpt ); - - if( nOpt & 0x01 ) t += " volatile"; - if( nOpt & 0x02 ) t += " if"; - if( nOpt & 0x04 ) t += " choose"; - if( nOpt & 0x08 ) t += " skip"; - if( nOpt & 0x10 ) t += " sum"; - if( nOpt & 0x20 ) t += " assignment"; - if( nOpt & 0x40 ) t += " space"; - if( nOpt & 0x80 ) t += " unknown"; - - if( nOpt & 0x02 ) - { - t += " skip-to-false="; - __AddHex( t, nData ); - } - if( nOpt & 0x04 ) - { - t += " count="; - __AddDec( t, nData ); - t += " skip="; - for( sal_uInt16 nIdx = 0; nIdx <= nData; ++nIdx ) - { - if( nIdx ) t += ','; - __AddDec( t, pIn->ReaduInt16() ); - } - } - if( nOpt & 0x08 ) - { - t += " skip="; - __AddHex( t, nData ); - t += " ("; - __AddDec( t, sal_uInt8( nData + 1 ) ); - t += " bytes)"; - } - if( nOpt & 0x10 ) - aStack.PushFunction( "ATTRSUM", 1, nOp ); - if( nOpt & 0x40 ) - { - t += " type="; - __AddDec( t, static_cast< sal_uInt8 >( nData ) ); - t += " count="; - __AddDec( t, static_cast< sal_uInt8 >( nData >> 8 ) ); - } - } - break; - case 0x1C: // Error Value [314 266] - { - STARTTOKEN( "Err" ); - sal_uInt8 nErr = pIn->ReaduInt8(); - t += "error value ("; __AddHex( t, nErr ); - t += ") "; - t += lcl_GetErrorString( nErr ); - aStack.PushOperand( lcl_GetErrorString( nErr ), nOp ); - } - break; - case 0x1D: // Boolean [315 266] - STARTTOKEN( "Bool" ); - aOperand += pIn->ReaduInt8() ? "TRUE" : "FALSE"; - t += aOperand; - aStack.PushOperand( aOperand, nOp ); - break; - case 0x1E: // Integer [315 266] - STARTTOKEN( "Int" ); - __AddDec( aOperand, pIn->ReaduInt16() ); - t += aOperand; - aStack.PushOperand( aOperand, nOp ); - break; - case 0x1F: // Number [315 266] - STARTTOKEN( "Num" ); - __AddDouble( aOperand, pIn->ReadDouble() ); - t += aOperand; - aStack.PushOperand( aOperand, nOp ); - break; - case 0x20: // Array Constant [317 268] - case 0x40: - case 0x60: - STARTTOKENCLASS( "Array" ); - pIn->Ignore( 7 ); - aStack.PushOperand( "{ConstArray}", nOp ); - break; - case 0x21: // Function, Fixed Number of Arguments [333 282] - case 0x41: - case 0x61: - { - STARTTOKENCLASS( "Func" ); - UINT16 nInd = pIn->ReaduInt16(); - const XclDumpFunc* pFunc = lcl_GetFuncData( nInd ); - aOperand += pFunc ? pFunc->pName : "!unknown!"; - - t += "fix function: index="; __AddHex( t, nInd ); - t += " ("; t += aOperand; - t += ')'; - aStack.PushFunction( aOperand, pFunc ? pFunc->nParam : 0, nOp ); - } - break; - case 0x22: // Function, Variable Number of Arg. [333 283] - case 0x42: - case 0x62: - { - STARTTOKENCLASS( "FuncVar" ); - BYTE nAnz; - UINT16 nInd; - *pIn >> nAnz >> nInd; - const XclDumpFunc* pFunc = lcl_GetFuncData( nInd & 0x7FFF ); - aOperand += pFunc ? pFunc->pName : "!unknown!"; - - t += "var function: index="; __AddHex( t, nInd ); - t += " ("; t += aOperand; - t += ") param count="; __AddHex( t, nAnz ); - t += " ("; __AddDec( t, (UINT8)(nAnz & 0x7F) ); - t += ')'; - if( nAnz & 0x8000 ) - t += " cmd-equiv."; - aStack.PushFunction( aOperand, nAnz & 0x7F, nOp ); - } - break; - case 0x23: // Name [318 269] - case 0x43: - case 0x63: - { - STARTTOKENCLASS( "Name" ); - sal_uInt16 nNameIdx = pIn->ReaduInt16(); - __AddDec( aOperand, nNameIdx ); - t += "internal name: index="; - t += aOperand; - pIn->Ignore( 2 ); - if( (0 < nNameIdx) && (nNameIdx <= maNames.size()) ) - aOperand = maNames[ nNameIdx - 1 ]; - else - aOperand.Insert( "NAME(", 0 ).Append( ')' ); - aStack.PushOperand( aOperand, nOp ); - } - break; - case 0x24: // Cell Reference [319 270] - case 0x44: - case 0x64: - case 0x2A: // Deleted Cell Reference [323 273] - case 0x4A: - case 0x6A: - { - if( (nOp & 0x1F) == 0x04 ) - STARTTOKENCLASS( "Ref" ); - else - STARTTOKENCLASS( "RefErr" ); - - UINT16 nCol, nRow; - *pIn >> nRow >> nCol; - AddRef( aOperand, nRow, nCol, bRangeName ); - t += "2D cell ref C/R="; __AddHex( t, nCol ); - t += '/'; __AddHex( t, nRow ); - t += ' '; t += aOperand; - aStack.PushOperand( aOperand, nOp ); - } - break; - case 0x25: // Area Reference [320 270] - case 0x45: - case 0x65: - case 0x2B: // Deleted Area Refernce [323 273] - case 0x4B: - case 0x6B: - { - if( (nOp & 0x1F) == 0x05 ) - STARTTOKENCLASS( "Area" ); - else - STARTTOKENCLASS( "AreaErr" ); - - UINT16 nRowFirst, nRowLast, nColFirst, nColLast; - *pIn >> nRowFirst >> nRowLast >> nColFirst >> nColLast; - AddRangeRef( aOperand, nRowFirst, nColFirst, nRowLast, nColLast, bRangeName ); - t += "2D area ref C/R:C/R="; __AddHex( t, nColFirst ); - t += '/'; __AddHex( t, nRowFirst ); - t += ':'; __AddHex( t, nColLast ); - t += '/'; __AddHex( t, nRowLast ); - t += ' '; t += aOperand; - aStack.PushOperand( aOperand, nOp ); - } - break; - case 0x26: // Constant Reference Subexpression [321 271] - case 0x46: - case 0x66: - { - STARTTOKENCLASS( "MemArea" ); - sal_uInt32 nRes; - sal_uInt16 nSize; - *pIn >> nRes >> nSize; - t += "reserved="; __AddHex( t, nRes ); - t += " size="; __AddDec( t, nSize ); - } - break; - case 0x27: // Erroneous Constant Reference Subexpr. [322 272] - case 0x47: - case 0x67: - { - STARTTOKENCLASS( "MemErr" ); - sal_uInt32 nRes; - sal_uInt16 nSize; - *pIn >> nRes >> nSize; - t += "reserved="; __AddHex( t, nRes ); - t += " size="; __AddDec( t, nSize ); - } - break; - case 0x28: // Incomplete Constant Reference Subexpr.[331 281] - case 0x48: - case 0x68: - { - STARTTOKENCLASS( "MemNoMem" ); - sal_uInt32 nRes; - sal_uInt16 nSize; - *pIn >> nRes >> nSize; - t += "reserved="; __AddHex( t, nRes ); - t += " size="; __AddDec( t, nSize ); - } - break; - case 0x29: // Variable Reference Subexpression [331 281] - case 0x49: - case 0x69: - { - STARTTOKENCLASS( "MemFunc" ); - sal_uInt16 nSize; - *pIn >> nSize; - t += "size="; __AddDec( t, nSize ); - } - break; - case 0x2C: // Cell Reference Within a Name/ShrdFmla [323 273] - case 0x4C: - case 0x6C: - { - STARTTOKENCLASS( "RefN" ); - UINT16 nRow, nCol; - *pIn >> nRow >> nCol; - AddRef( aOperand, nRow, nCol, bRNorSF ); - t += "2D cell ref in name C/R="; __AddHex( t, nCol ); - t += '/'; __AddHex( t, nRow ); - t += ' '; t += aOperand; - aStack.PushOperand( aOperand, nOp ); - } - break; - case 0x2D: // Area Reference Within a Name/ShrdFmla [324 274] - case 0x4D: - case 0x6D: - { - STARTTOKENCLASS( "AreaN" ); - UINT16 nRowFirst, nRowLast, nColFirst, nColLast; - *pIn >> nRowFirst >> nRowLast >> nColFirst >> nColLast; - AddRangeRef( aOperand, nRowFirst, nColFirst, nRowLast, nColLast, bRNorSF ); - t += "2D area ref in name C/R:C/R"; __AddHex( t, nColFirst ); - t += '/'; __AddHex( t, nRowFirst ); - t += ':'; __AddHex( t, nColLast ); - t += '/'; __AddHex( t, nRowLast ); - t += ' '; t += aOperand; - aStack.PushOperand( aOperand, nOp ); - } - break; - case 0x2E: // Reference Subexpression Within a Name [332 282] - case 0x4E: - case 0x6E: - { - STARTTOKENCLASS( "MemAreaN" ); - sal_uInt16 nSize; - *pIn >> nSize; - t += "size="; __AddDec( t, nSize ); - } - break; - case 0x2F: // Incomplete Reference Subexpression... [332 282] - case 0x4F: - case 0x6F: - { - STARTTOKENCLASS( "MemNoMemN" ); - sal_uInt16 nSize; - *pIn >> nSize; - t += "size="; __AddDec( t, nSize ); - } - break; - case 0x39: // Name or External Name [ 275] - case 0x59: - case 0x79: - { - STARTTOKENCLASS( "NameX" ); - UINT16 nXti, nName; - *pIn >> nXti >> nName; - pIn->Ignore( 2 ); - t += "external name: XTI="; __AddDec( t, nXti ); - t += " name index="; __AddDec( t, nName ); - aOperand += "EXTNAME(XTI("; - __AddDec( aOperand, nXti ); - aOperand += "),"; - __AddDec( aOperand, nName ); - aOperand += ')'; - aStack.PushOperand( aOperand, nOp ); - } - break; - case 0x3A: // 3-D Cell Reference [ 275] - case 0x5A: - case 0x7A: - case 0x3C: // Deleted 3-D Cell Reference [ 277] - case 0x5C: - case 0x7C: - { - if( (nOp & 0x1F) == 0x1A ) - STARTTOKENCLASS( "Ref3d" ); - else - STARTTOKENCLASS( "Ref3dErr" ); - - UINT16 nXti, nRow, nCol; - *pIn >> nXti >> nRow >> nCol; - AddRef( aOperand, nRow, nCol, bRangeName, nXti ); - t += "3D cell ref Xti!C/R="; __AddHex( t, nXti ); - t += '!'; __AddHex( t, nCol ); - t += '/'; __AddHex( t, nRow ); - t += ' '; t += aOperand; - aStack.PushOperand( aOperand, nOp ); - } - break; - case 0x3B: // 3-D Area Reference [ 276] - case 0x5B: - case 0x7B: - case 0x3D: // Deleted 3-D Area Reference [ 277] - case 0x5D: - case 0x7D: - { - if( (nOp & 0x1F) == 0x1B ) - STARTTOKENCLASS( "Area3d" ); - else - STARTTOKENCLASS( "Area3dErr" ); - - UINT16 nXti, nRow1, nCol1, nRow2, nCol2; - *pIn >> nXti >> nRow1 >> nRow2 >> nCol1 >> nCol2; - AddRangeRef( aOperand, nRow1, nCol1, nRow2, nCol2, bRangeName, nXti ); - t += "3D area ref Xti!C/R:C/R="; __AddHex( t, nXti ); - t += '!'; __AddHex( t, nCol1 ); - t += '/'; __AddHex( t, nRow1 ); - t += ':'; __AddHex( t, nCol2 ); - t += '/'; __AddHex( t, nRow2 ); - t += ' '; t += aOperand; - aStack.PushOperand( aOperand, nOp ); - } - break; - default: - STARTTOKEN( "unknown" ); - bError = TRUE; - } - PRINTTOKEN(); - } - t.Assign( " Formula = " ); - if( aStack.GetFormula().Len() ) t += aStack.GetFormula(); else t += "ERROR IN STACK"; - Print( t ); - t.Assign( " Tokencl = " ).Append( aStack.GetTokenClasses() ); - Print( t ); - pIn->Seek( nAfterPos ); -} - - -// ============================================================================ -// -// S T R E A M C O N T E N T S -// -// ============================================================================ - -void Biff8RecDumper::DumpBinary( SvStream& rInStrm, ULONG nSize ) -{ - ULONG nStrmPos = rInStrm.Tell(); - rInStrm.Seek( STREAM_SEEK_TO_END ); - ULONG nStrmLen = rInStrm.Tell(); - rInStrm.Seek( nStrmPos ); - ULONG nDumpEnd = (nSize == STREAM_SEEK_TO_END) ? nStrmLen : ::std::min( nStrmPos + nSize, nStrmLen ); - - const ULONG LINE_SIZE = 16; - sal_uInt8 pnData[ LINE_SIZE ]; - - while( rInStrm.Tell() < nDumpEnd ) - { - ByteString aBinLine; - ByteString aTextLine; - - ULONG nLineLen = ::std::min( nDumpEnd - rInStrm.Tell(), LINE_SIZE ); - rInStrm.Read( pnData, nLineLen ); - - for( sal_uInt8 *pnByte = pnData, *pnEnd = pnData + nLineLen; pnByte != pnEnd; ++pnByte ) - { - if( pnByte - pnData == LINE_SIZE / 2 ) - { - aBinLine.Append( ' ' ); - aTextLine.Append( ' ' ); - } - __AddPureHex( aBinLine, *pnByte ); - aBinLine.Append( ' ' ); - aTextLine.Append( static_cast< sal_Char >( IsPrintable( *pnByte ) ? *pnByte : '.' ) ); - } - - aBinLine.Expand( LINE_SIZE * 3 + 3, ' ' ); - (*pDumpStream) << aBinLine.GetBuffer() << aTextLine.GetBuffer() << "\n"; - } -} - -// ============================================================================ -// -// F O R M C O N T R O L S -// -// ============================================================================ - -namespace { - -// little helpers ------------------------------------------------------------- - -/** Import from bytestream. */ -SvStream& operator>>( SvStream& rStrm, XclGuid& rGuid ) -{ - rStrm.Read( rGuid.mpnData, 16 ); - return rStrm; -} - -/** Output guid into text stream. */ -SvStream& operator<<( SvStream& rStrm, const XclGuid& rGuid ) -{ - ByteString aOut; - lclAppendGuid( aOut, rGuid ); - return rStrm << aOut.GetBuffer(); -} - -void lclAlignStream( SvStream& rInStrm, ULONG nStartPos, ULONG nDataWidth ) -{ - rInStrm.SeekRel( nDataWidth - 1 - (rInStrm.Tell() - nStartPos + nDataWidth - 1) % nDataWidth ); -} - -// control types -------------------------------------------------------------- - -const sal_uInt16 EXC_CTRL_PAGE = 0x0007; -const sal_uInt16 EXC_CTRL_IMAGE = 0x000C; -const sal_uInt16 EXC_CTRL_FRAME = 0x000E; -const sal_uInt16 EXC_CTRL_SPINBUTTON = 0x0010; -const sal_uInt16 EXC_CTRL_PUSHBUTTON = 0x0011; -const sal_uInt16 EXC_CTRL_TABSTRIP = 0x0012; -const sal_uInt16 EXC_CTRL_LABEL = 0x0015; -const sal_uInt16 EXC_CTRL_TEXTBOX = 0x0017; -const sal_uInt16 EXC_CTRL_LISTBOX = 0x0018; -const sal_uInt16 EXC_CTRL_COMBOBOX = 0x0019; -const sal_uInt16 EXC_CTRL_CHECKBOX = 0x001A; -const sal_uInt16 EXC_CTRL_OPTIONBUTTON = 0x001B; -const sal_uInt16 EXC_CTRL_TOGGLEBUTTON = 0x001C; -const sal_uInt16 EXC_CTRL_SCROLLBAR = 0x002F; -const sal_uInt16 EXC_CTRL_MULTIPAGE = 0x0039; -const sal_uInt16 EXC_CTRL_REFEDIT = 0x8000; -const sal_uInt16 EXC_CTRL_FONTDATA = 0xFFF0; // internal use only -const sal_uInt16 EXC_CTRL_USERFORM = 0xFFF1; // internal use only -const sal_uInt16 EXC_CTRL_ADDDATA = 0xFFF2; // internal use only -const sal_uInt16 EXC_CTRL_FRAMECHILD = 0xFFF3; // internal use only -const sal_uInt16 EXC_CTRL_PROGRESSBAR = 0xFFF4; // internal use only -const sal_uInt16 EXC_CTRL_UNKNOWN = 0xFFFF; // internal use only - -const sal_uInt16 EXC_CTRL_RECORD_ID = 0x0000; -const sal_uInt16 EXC_CTRL_CLIENT_ID = 0x0200; -const sal_uInt16 EXC_CTRL_CONTAINER_ID = 0x0400; - -// control names -------------------------------------------------------------- - -struct XclDumpControlInfo -{ - sal_uInt16 mnType; - const sal_Char* mpcName; - sal_uInt16 mnId; -}; - -static const XclDumpControlInfo spControlInfos[] = -{ - { EXC_CTRL_PAGE, "Page", EXC_CTRL_CONTAINER_ID }, - { EXC_CTRL_IMAGE, "Image", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_FRAME, "Frame", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_SPINBUTTON, "Spin", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_PUSHBUTTON, "PushButton", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_TABSTRIP, "TabStrip", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_LABEL, "Label", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_TEXTBOX, "TextBox", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_LISTBOX, "ListBox", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_COMBOBOX, "ComboBox", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_CHECKBOX, "CheckBox", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_OPTIONBUTTON, "OptionButton", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_TOGGLEBUTTON, "ToggleButton", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_SCROLLBAR, "ScrollBar", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_MULTIPAGE, "MultiPage", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_REFEDIT, "RefEdit", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_FONTDATA, "FontData", EXC_CTRL_CLIENT_ID }, - { EXC_CTRL_USERFORM, "UserForm", EXC_CTRL_CONTAINER_ID }, - { EXC_CTRL_ADDDATA, "AddData", EXC_CTRL_RECORD_ID }, - { EXC_CTRL_FRAMECHILD, "FrameChild", EXC_CTRL_RECORD_ID }, - { EXC_CTRL_PROGRESSBAR, "ProgressBar", EXC_CTRL_RECORD_ID } -}; - -typedef ::std::map< sal_uInt16, const XclDumpControlInfo* > XclDumpControlInfoMap; -typedef ScfRef< XclDumpControlInfoMap > XclDumpControlInfoMapRef; - -XclDumpControlInfoMapRef lclCreateControlInfoMap() -{ - XclDumpControlInfoMapRef xMap( new XclDumpControlInfoMap ); - for( const XclDumpControlInfo *pIt = spControlInfos, *pEnd = STATIC_TABLE_END( spControlInfos ); pIt != pEnd; ++pIt ) - (*xMap)[ pIt->mnType ] = pIt; - return xMap; -} - -const XclDumpControlInfoMap& lclGetControlInfoMap() -{ - static const XclDumpControlInfoMapRef sxMap = lclCreateControlInfoMap(); - return *sxMap; -} - -void lclAppendControlType( ByteString& rStr, sal_uInt16 nCtrlType ) -{ - const XclDumpControlInfoMap& rMap = lclGetControlInfoMap(); - XclDumpControlInfoMap::const_iterator aIt = rMap.find( nCtrlType ); - rStr.Append( (aIt == rMap.end()) ? "*UNKNOWN*" : aIt->second->mpcName ); -} - -void lclDumpControlType( SvStream& rOutStrm, sal_uInt16 nCtrlType ) -{ - ByteString aTitle( "type=" ); - lclAppendHex( aTitle, nCtrlType ); - aTitle.Append( " (" ); - lclAppendControlType( aTitle, nCtrlType ); - aTitle.Append( ')' ); - rOutStrm << aTitle.GetBuffer(); -} - -sal_uInt16 lclDumpControlHeader( SvStream& rInStrm, SvStream& rOutStrm, sal_uInt16 nCtrlType ) -{ - lclDumpControlType( rOutStrm, nCtrlType ); - sal_uInt16 nId, nSize; - rInStrm >> nId >> nSize; - ByteString aLine( " id=" ); lclAppendHex( aLine, nId ); - const XclDumpControlInfoMap& rMap = lclGetControlInfoMap(); - XclDumpControlInfoMap::const_iterator aIt = rMap.find( nCtrlType ); - bool bValid = (aIt != rMap.end()) && (aIt->second->mnId == nId); - aLine.Append( bValid ? " (valid)" : " (invalid)" ); - aLine.Append( " size=" ); lclAppendHex( aLine, nSize ); - rOutStrm << aLine.GetBuffer() << "\n"; - return nSize; -} - -// control GUIDs -------------------------------------------------------------- - -struct XclDumpControlGuid -{ - sal_uInt16 mnType; - sal_uInt32 mnGuidData1; - sal_uInt16 mnGuidData2; - sal_uInt16 mnGuidData3; - sal_uInt8 mnGuidData41; - sal_uInt8 mnGuidData42; - sal_uInt8 mnGuidData43; - sal_uInt8 mnGuidData44; - sal_uInt8 mnGuidData45; - sal_uInt8 mnGuidData46; - sal_uInt8 mnGuidData47; - sal_uInt8 mnGuidData48; -}; - -static const XclDumpControlGuid spControlGuids[] = -{ - { EXC_CTRL_PUSHBUTTON, 0xD7053240, 0xCE69, 0x11CD, 0xA7, 0x77, 0x00, 0xDD, 0x01, 0x14, 0x3C, 0x57 }, - { EXC_CTRL_TOGGLEBUTTON, 0x8BD21D60, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 }, - { EXC_CTRL_CHECKBOX, 0x8BD21D40, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 }, - { EXC_CTRL_OPTIONBUTTON, 0x8BD21D50, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 }, - { EXC_CTRL_LABEL, 0x978C9E23, 0xD4B0, 0x11CE, 0xBF, 0x2D, 0x00, 0xAA, 0x00, 0x3F, 0x40, 0xD0 }, - { EXC_CTRL_TEXTBOX, 0x8BD21D10, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 }, - { EXC_CTRL_LISTBOX, 0x8BD21D20, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 }, - { EXC_CTRL_COMBOBOX, 0x8BD21D30, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 }, - { EXC_CTRL_SPINBUTTON, 0x79176FB0, 0xB7F2, 0x11CE, 0x97, 0xEF, 0x00, 0xAA, 0x00, 0x6D, 0x27, 0x76 }, - { EXC_CTRL_SCROLLBAR, 0xDFD181E0, 0x5E2F, 0x11CE, 0xA4, 0x49, 0x00, 0xAA, 0x00, 0x4A, 0x80, 0x3D }, - { EXC_CTRL_IMAGE, 0x4C599241, 0x6926, 0x101B, 0x99, 0x92, 0x00, 0x00, 0x0B, 0x65, 0xC6, 0xF9 }, - { EXC_CTRL_PROGRESSBAR, 0x35053A22, 0x8589, 0x11D1, 0xB1, 0x6A, 0x00, 0xC0, 0xF0, 0x28, 0x36, 0x28 } -}; - -typedef ::std::map< XclGuid, sal_uInt16 > XclDumpControlGuidMap; -typedef ScfRef< XclDumpControlGuidMap > XclDumpControlGuidMapRef; - -XclDumpControlGuidMapRef lclCreateControlGuidMap() -{ - XclDumpControlGuidMapRef xMap( new XclDumpControlGuidMap ); - for( const XclDumpControlGuid *pIt = spControlGuids, *pEnd = STATIC_TABLE_END( spControlGuids ); pIt != pEnd; ++pIt ) - { - XclGuid aGuid( pIt->mnGuidData1, pIt->mnGuidData2, pIt->mnGuidData3, - pIt->mnGuidData41, pIt->mnGuidData42, pIt->mnGuidData43, pIt->mnGuidData44, - pIt->mnGuidData45, pIt->mnGuidData46, pIt->mnGuidData47, pIt->mnGuidData48 ); - (*xMap)[ aGuid ] = pIt->mnType; - } - return xMap; -} - -const XclDumpControlGuidMap& lclGetControlGuidMap() -{ - static const XclDumpControlGuidMapRef sxMap = lclCreateControlGuidMap(); - return *sxMap; -} - -sal_uInt16 lclDumpControlGuid( SvStream& rInStrm, SvStream& rOutStrm ) -{ - XclGuid aGuid; - rInStrm >> aGuid; - const XclDumpControlGuidMap& rMap = lclGetControlGuidMap(); - XclDumpControlGuidMap::const_iterator aIt = rMap.find( aGuid ); - sal_uInt16 nCtrlType = (aIt == rMap.end()) ? EXC_CTRL_UNKNOWN : aIt->second; - rOutStrm << "guid=" << aGuid; - return nCtrlType; -}; - -// other guids ---------------------------------------------------------------- - -static const XclGuid saStdFontGuid( 0x0BE35203, 0x8F91, 0x11CE, 0x9D, 0xE3, 0x00, 0xAA, 0x00, 0x4B, 0xB8, 0x51 ); -static const XclGuid saStdPicGuid( 0x0BE35204, 0x8F91, 0x11CE, 0x9D, 0xE3, 0x00, 0xAA, 0x00, 0x4B, 0xB8, 0x51 );\ - -// ---------------------------------------------------------------------------- - -} // namespace - -// *** yet some other ugly macros for the specials of form control dumping *** - -// align the instream -#define EXC_CTRLDUMP_ALIGN_INSTRM( val ) lclAlignStream( rInStrm, nStartPos, val ) -// push the string to outstream -#define EXC_CTRLDUMP_PRINT() { if( t.Len() ) { rOutStrm << t.GetBuffer() << '\n'; t.Erase(); } } - -// implementation, don't use -#define IMPL_EXC_CTRLDUMP_PLAIN_VALUE( type, func, text ) { type n; rInStrm >> n; t.Append( " " text "=" ); func( t, n ); EXC_CTRLDUMP_PRINT(); } -#define IMPL_EXC_CTRLDUMP_VALUE( type, func, text ) { EXC_CTRLDUMP_ALIGN_INSTRM( sizeof( type ) ); IMPL_EXC_CTRLDUMP_PLAIN_VALUE( type, func, text ); } -#define IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, mask, func, text ) { rInStrm >> var; var &= (mask); t.Append( " " text "=" ); func( t, var ); EXC_CTRLDUMP_PRINT(); } -#define IMPL_EXC_CTRLDUMP_VAR( var, mask, func, text ) { EXC_CTRLDUMP_ALIGN_INSTRM( sizeof( var ) ); IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, mask, func, text ); } - -// read a value from stream (no stream alignment) -#define EXC_CTRLDUMP_PLAIN_HEX4( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_uInt32, lclAppendHex, text ) -#define EXC_CTRLDUMP_PLAIN_DEC4( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_Int32, lclAppendDec, text ) -#define EXC_CTRLDUMP_PLAIN_HEX2( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_uInt16, lclAppendHex, text ) -#define EXC_CTRLDUMP_PLAIN_DEC2( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_Int16, lclAppendDec, text ) -#define EXC_CTRLDUMP_PLAIN_HEX1( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_uInt8, lclAppendHex, text ) -#define EXC_CTRLDUMP_PLAIN_DEC1( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_Int8, lclAppendDec, text ) -#define EXC_CTRLDUMP_PLAIN_DECF( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( float, lclAppendDec, text ) -// read a value from stream (with stream alignment) -#define EXC_CTRLDUMP_HEX4( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_uInt32, lclAppendHex, text ) -#define EXC_CTRLDUMP_DEC4( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_Int32, lclAppendDec, text ) -#define EXC_CTRLDUMP_HEX2( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_uInt16, lclAppendHex, text ) -#define EXC_CTRLDUMP_DEC2( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_Int16, lclAppendDec, text ) -#define EXC_CTRLDUMP_HEX1( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_uInt8, lclAppendHex, text ) -#define EXC_CTRLDUMP_DEC1( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_Int8, lclAppendDec, text ) -// read a value from stream into existing variable (no stream alignment) -#define EXC_CTRLDUMP_PLAIN_HEXVAR( var, text ) IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, ~0, lclAppendHex, text ) -#define EXC_CTRLDUMP_PLAIN_DECVAR( var, text ) IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, ~0, lclAppendDec, text ) -#define EXC_CTRLDUMP_PLAIN_HEXVARMASK( var, mask, text ) IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, mask, lclAppendHex, text ) -#define EXC_CTRLDUMP_PLAIN_DECVARMASK( var, mask, text ) IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, mask, lclAppendDec, text ) -// read a value from stream into existing variable (with stream alignment) -#define EXC_CTRLDUMP_HEXVAR( var, text ) IMPL_EXC_CTRLDUMP_VAR( var, ~0, lclAppendHex, text ) -#define EXC_CTRLDUMP_DECVAR( var, text ) IMPL_EXC_CTRLDUMP_VAR( var, ~0, lclAppendDec, text ) -#define EXC_CTRLDUMP_HEXVARMASK( var, mask, text ) IMPL_EXC_CTRLDUMP_VAR( var, mask, lclAppendHex, text ) -#define EXC_CTRLDUMP_DECVARMASK( var, mask, text ) IMPL_EXC_CTRLDUMP_VAR( var, mask, lclAppendDec, text ) -// read flag fields -#define EXC_CTRLDUMP_PLAIN_STARTOPTFLAG( text, doread, defaults )\ -{ \ - nFlags = defaults; \ - t.Append( " " text ); \ - if( doread ) \ - rInStrm >> nFlags; \ - else \ - t.Append( "-defaulted" ); \ - t.Append( '=' ); \ - lclAppendHex( t, nFlags ); \ -} -#define EXC_CTRLDUMP_STARTOPTFLAG( text, doread, defaults ) { if( doread ) { EXC_CTRLDUMP_ALIGN_INSTRM( sizeof( nFlags ) ); } EXC_CTRLDUMP_PLAIN_STARTOPTFLAG( text, doread, defaults ) } -#define EXC_CTRLDUMP_PLAIN_STARTFLAG( text ) EXC_CTRLDUMP_PLAIN_STARTOPTFLAG( text, true, 0 ) -#define EXC_CTRLDUMP_STARTFLAG( text ) EXC_CTRLDUMP_STARTOPTFLAG( text, true, 0 ) -#define EXC_CTRLDUMP_ADDFLAG( flag, text ) { if( nFlags & (flag) ) t.Append( " " text ); } -#define EXC_CTRLDUMP_ADDFLAGVALUE( start, width, text ) { sal_uInt32 nValue; ::extract_value( nValue, nFlags, start, width ); t.Append( " " text "=" ); lclAppendDec( t, nValue ); } -#define EXC_CTRLDUMP_ENDFLAG( reserved ) { if( nFlags & (reserved) ) { t.Append( " ?" ); lclAppendHex( t, static_cast< sal_uInt32 >( nFlags & (reserved) ) ); } EXC_CTRLDUMP_PRINT(); } -// read coordinates -#define EXC_CTRLDUMP_COORD2( text ) { EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); EXC_CTRLDUMP_DEC2( text "-x" ); EXC_CTRLDUMP_DEC2( text "-y" ); } -#define EXC_CTRLDUMP_COORD4( text ) { EXC_CTRLDUMP_DEC4( text "-x" ); EXC_CTRLDUMP_DEC4( text "-y" ); } -#define EXC_CTRLDUMP_SIZE4( text ) { EXC_CTRLDUMP_DEC4( text "-width" ); EXC_CTRLDUMP_DEC4( text "-height" ); } -// read guid -#define EXC_CTRLDUMP_PLAIN_GUID( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( XclGuid, lclAppendGuid, text ) -#define EXC_CTRLDUMP_GUID( text ) { EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); EXC_CTRLDUMP_PLAIN_GUID( text ); } -// read control type -#define EXC_CTRLDUMP_CTRLTYPE( var, text ) \ -{ \ - EXC_CTRLDUMP_ALIGN_INSTRM( 2 ); \ - rInStrm >> var; \ - t.Assign( " " text "=" ); lclAppendHex( t, var ); \ - t.Append( " (" ); lclAppendControlType( t, var ); \ - t.Append( ')' ); \ - EXC_CTRLDUMP_PRINT(); \ -} -// read character array, add to string, but do not print -#define EXC_CTRLDUMP_RAWSTRING( var ) \ -{ \ - t.Append( "='" ); \ - if( var ) \ - { \ - EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); \ - ULONG nNextPos = rInStrm.Tell() + (var); \ - if( var > 128 ) var = 128; \ - sal_Char pc[ 129 ]; \ - rInStrm.Read( pc, var ); pc[ var ] = '\0'; \ - t.Append( pc ); \ - rInStrm.Seek( nNextPos ); \ - } \ - t.Append( '\'' ); \ -} -// read a string -#define EXC_CTRLDUMP_STRING( var, text ) \ -{ \ - t.Append( " " text ); \ - EXC_CTRLDUMP_RAWSTRING( var ); \ - EXC_CTRLDUMP_PRINT(); \ -} -// read an array of strings -#define EXC_CTRLDUMP_STRINGARRAY( total, count, text ) \ -{ \ - ULONG nNextPos = rInStrm.Tell() + (total); \ - for( sal_uInt32 nIdx = 0; (nIdx < (count)) && (rInStrm.Tell() < nNextPos); ++nIdx )\ - { \ - EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); \ - sal_uInt32 nLen; \ - rInStrm >> nLen; \ - nLen &= 0x7FFFFFFF; \ - t.Append( " " text "[" ); \ - lclAppendDec( t, nIdx + 1 ); \ - t.Append( ']' ); \ - EXC_CTRLDUMP_RAWSTRING( nLen ); \ - } \ - EXC_CTRLDUMP_PRINT(); \ - rInStrm.Seek( nNextPos ); \ -} -// read embedded font data -#define EXC_CTRLDUMP_FONT( var, text ) \ -if( var ) \ -{ \ - EXC_CTRLDUMP_PRINT(); \ - XclGuid aGuid; rInStrm >> aGuid; \ - rOutStrm << "embedded-font-guid=" << aGuid; \ - if( aGuid == saStdFontGuid ) \ - { \ - rOutStrm << " (StdFont)\n"; \ - EXC_CTRLDUMP_PLAIN_HEX1( "unknown1" ); \ - EXC_CTRLDUMP_PLAIN_DEC1( "script-type" ); \ - EXC_CTRLDUMP_PLAIN_HEX1( "unknown2" ); \ - sal_uInt8 nFlags; \ - EXC_CTRLDUMP_PLAIN_STARTFLAG( "font-style-flags" ); \ - EXC_CTRLDUMP_ADDFLAG( 0x02, "italic" ); \ - EXC_CTRLDUMP_ADDFLAG( 0x04, "underline" ); \ - EXC_CTRLDUMP_ADDFLAG( 0x08, "strikeout" ); \ - EXC_CTRLDUMP_ENDFLAG( 0xF1 ); \ - EXC_CTRLDUMP_PLAIN_DEC2( "font-weight" ); \ - EXC_CTRLDUMP_PLAIN_DEC4( "font-size" ); \ -/* font-size := pt*10000 + (1-((pt+1)%3))*2500 */ \ - sal_uInt8 nLen; \ - EXC_CTRLDUMP_PLAIN_DECVAR( nLen, "font-name-len" ); \ - sal_Char* p = new sal_Char[ nLen + 1 ]; \ - rInStrm.Read( p, nLen ); p[ nLen ] = '\0'; \ - t.Append( " font-name='" ).Append( p ).Append( '\'' );\ - delete [] p; \ - EXC_CTRLDUMP_PRINT(); \ - } \ - else \ - rOutStrm << " (*UNKNOWN*)\n"; \ -} -// read image data -#define EXC_CTRLDUMP_IMAGE( var, text ) \ -if( var ) \ -{ \ - EXC_CTRLDUMP_PRINT(); \ - XclGuid aGuid; rInStrm >> aGuid; \ - rOutStrm << "embedded-" text "-guid=" << aGuid; \ - if( aGuid == saStdPicGuid ) \ - { \ - rOutStrm << " (StdPict)\n"; \ - EXC_CTRLDUMP_PLAIN_HEX2( "u1" ); \ - EXC_CTRLDUMP_PLAIN_HEX2( "u2" ); \ - sal_uInt32 nLen; \ - EXC_CTRLDUMP_PLAIN_DECVAR( nLen, text "-len" ); \ - rInStrm.SeekRel( nLen ); \ - } \ - else \ - rOutStrm << " (*UNKNOWN*)\n"; \ -} -// hex dump remaining or unknown data -#define EXC_CTRLDUMP_REMAINING( nextpos ) \ -{ \ - EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); \ - if( rInStrm.Tell() < (nextpos) ) \ - { \ - rOutStrm << " unknown-data=\n"; \ - DumpBinary( rInStrm, ::std::min< ULONG >( (nextpos) - rInStrm.Tell(), 1024 ) );\ - } \ - rInStrm.Seek( nextpos ); \ -} - -// *** macros end *** - -void Biff8RecDumper::DumpControlContents( SvStream& rInStrm, sal_uInt16 nCtrlType ) -{ - SvStream& rOutStrm = *pDumpStream; - - if( nCtrlType == EXC_CTRL_PROGRESSBAR ) - { - lclDumpControlType( rOutStrm, nCtrlType ); - rOutStrm << '\n'; - - ByteString t; // "t" needed for macros - sal_uInt32 nFlags = 0; // "nFlags" needed for macros - - EXC_CTRLDUMP_PLAIN_HEX4( "unknown" ); - EXC_CTRLDUMP_PLAIN_HEX4( "unknown" ); - EXC_CTRLDUMP_PLAIN_DEC4( "width" ); - EXC_CTRLDUMP_PLAIN_DEC4( "height" ); - EXC_CTRLDUMP_PLAIN_HEX4( "unknown" ); - EXC_CTRLDUMP_PLAIN_HEX4( "unknown" ); - EXC_CTRLDUMP_PLAIN_HEX4( "unknown" ); - EXC_CTRLDUMP_PLAIN_DECF( "min" ); - EXC_CTRLDUMP_PLAIN_DECF( "max" ); - EXC_CTRLDUMP_PLAIN_STARTFLAG( "flags1" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000001, "vertical" ); - EXC_CTRLDUMP_ADDFLAG( 0x00010000, "smooth-scroll" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFEFFFE ); - EXC_CTRLDUMP_PLAIN_HEX4( "unknown" ); - EXC_CTRLDUMP_PLAIN_HEX4( "unknown" ); - EXC_CTRLDUMP_PLAIN_HEX4( "unknown" ); - EXC_CTRLDUMP_PLAIN_STARTFLAG( "flags2" ); - EXC_CTRLDUMP_ADDFLAG( 0x0001, "border-single" ); - EXC_CTRLDUMP_ADDFLAG( 0x0002, "enabled" ); - EXC_CTRLDUMP_ADDFLAG( 0x0004, "3d-style" ); - EXC_CTRLDUMP_ADDFLAGVALUE( 3, 8, "mouse-icon" ); - EXC_CTRLDUMP_ADDFLAG( 0x2000, "ole-drop-manual" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFFD800 ); - return; - } - - sal_uInt16 nSize = lclDumpControlHeader( rInStrm, rOutStrm, nCtrlType ); - if( nSize > 0 ) - { - ULONG nStartPos = rInStrm.Tell(); // for stream alignment macro - ByteString t; // "t" needed for macros - sal_uInt32 nFlags = 0; // "nFlags" needed for macros - - bool bHasFontData = false; - sal_uInt32 nNameLen = 0; - sal_uInt32 nCaptionLen = 0; - sal_uInt32 nValueLen = 0; - sal_uInt32 nGroupNameLen = 0; - sal_uInt32 nTagLen = 0; - sal_uInt32 nTipLen = 0; - sal_uInt32 nCtrlIdLen = 0; - sal_uInt32 nCtrlSrcLen = 0; - sal_uInt32 nRowSrcLen = 0; - sal_uInt16 nPic = 0; - sal_uInt16 nIcon = 0; - sal_uInt16 nFont = 0; - - switch( nCtrlType ) - { - case EXC_CTRL_PUSHBUTTON: - { - EXC_CTRLDUMP_STARTFLAG( "content-flags" ); - EXC_CTRLDUMP_ADDFLAG( 0x0001, "forecolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x0002, "backcolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x0004, "option" ); - EXC_CTRLDUMP_ADDFLAG( 0x0008, "caption" ); - EXC_CTRLDUMP_ADDFLAG( 0x0010, "picpos" ); - EXC_CTRLDUMP_ADDFLAG( 0x0020, "size" ); - EXC_CTRLDUMP_ADDFLAG( 0x0040, "mouseptr" ); - EXC_CTRLDUMP_ADDFLAG( 0x0080, "pic" ); - EXC_CTRLDUMP_ADDFLAG( 0x0100, "accel" ); - EXC_CTRLDUMP_ADDFLAG( 0x0200, "notakefocus" ); - EXC_CTRLDUMP_ADDFLAG( 0x0400, "icon" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFFF800 ); - sal_uInt32 nCtrlFlags = nFlags; - - if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_HEX4( "forecolor" ); - if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_HEX4( "backcolor" ); - - EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x0004, 0x0000001B ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000004, "locked" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000008, "opaque" ); - EXC_CTRLDUMP_ADDFLAG( 0x00800000, "wordwrap" ); - EXC_CTRLDUMP_ADDFLAG( 0x10000000, "autosize" ); - EXC_CTRLDUMP_ENDFLAG( 0xEF7FFFF1 ); - - if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_DECVARMASK( nCaptionLen, 0x7FFFFFFF, "caption-len" ); - if( nCtrlFlags & 0x0010 ) EXC_CTRLDUMP_COORD2( "picpos" ); - if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_DEC1( "mouseptr" ); - if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_HEXVAR( nPic, "pic" ); - if( nCtrlFlags & 0x0100 ) EXC_CTRLDUMP_HEX2( "accel" ); - if( nCtrlFlags & 0x0400 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" ); - - if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_STRING( nCaptionLen, "caption" ); - if( nCtrlFlags & 0x0020 ) EXC_CTRLDUMP_SIZE4( "size" ); - EXC_CTRLDUMP_REMAINING( nStartPos + nSize ); - - EXC_CTRLDUMP_IMAGE( nPic, "pic" ); - EXC_CTRLDUMP_IMAGE( nIcon, "icon" ); - bHasFontData = true; - } - break; - - case EXC_CTRL_TOGGLEBUTTON: - case EXC_CTRL_CHECKBOX: - case EXC_CTRL_OPTIONBUTTON: - case EXC_CTRL_TEXTBOX: - case EXC_CTRL_LISTBOX: - case EXC_CTRL_COMBOBOX: - case EXC_CTRL_REFEDIT: - { - EXC_CTRLDUMP_STARTFLAG( "content-flags" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000001, "option" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "backcolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000004, "forecolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000008, "maxlen" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000010, "borderstyle" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000020, "scrollbars" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000040, "style" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000080, "mouseptr" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000100, "size" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000200, "passwordchar" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000400, "listwidth" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000800, "boundcol" ); - EXC_CTRLDUMP_ADDFLAG( 0x00001000, "textcol" ); - EXC_CTRLDUMP_ADDFLAG( 0x00002000, "colcount" ); - EXC_CTRLDUMP_ADDFLAG( 0x00004000, "listrows" ); - EXC_CTRLDUMP_ADDFLAG( 0x00008000, "colwidth?" ); - EXC_CTRLDUMP_ADDFLAG( 0x00010000, "matchentry" ); - EXC_CTRLDUMP_ADDFLAG( 0x00020000, "liststyle" ); - EXC_CTRLDUMP_ADDFLAG( 0x00040000, "showdropbtn" ); - EXC_CTRLDUMP_ADDFLAG( 0x00100000, "dropbtnstyle" ); - EXC_CTRLDUMP_ADDFLAG( 0x00200000, "multistate" ); - EXC_CTRLDUMP_ADDFLAG( 0x00400000, "value" ); - EXC_CTRLDUMP_ADDFLAG( 0x00800000, "caption" ); - EXC_CTRLDUMP_ADDFLAG( 0x01000000, "picpos" ); - EXC_CTRLDUMP_ADDFLAG( 0x02000000, "bordercolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x04000000, "specialeff" ); - EXC_CTRLDUMP_ADDFLAG( 0x08000000, "icon" ); - EXC_CTRLDUMP_ADDFLAG( 0x10000000, "pic" ); - EXC_CTRLDUMP_ADDFLAG( 0x20000000, "accel" ); - EXC_CTRLDUMP_ENDFLAG( 0x40080000 ); // 0x80000000 always set? - sal_uInt32 nCtrlFlags = nFlags; - - EXC_CTRLDUMP_STARTFLAG( "2nd-content-flags" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000001, "groupname" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFFFFFE ); - sal_uInt32 nCtrlFlags2 = nFlags; - - EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x00000001, 0x2C80081B ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000004, "locked" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000008, "opaque" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000400, "colheads" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000800, "intheight" ); - EXC_CTRLDUMP_ADDFLAG( 0x00001000, "matchreq" ); - EXC_CTRLDUMP_ADDFLAG( 0x00002000, "align" ); - EXC_CTRLDUMP_ADDFLAGVALUE( 15, 4, "ime-mode" ); - EXC_CTRLDUMP_ADDFLAG( 0x00080000, "dragbehav" ); - EXC_CTRLDUMP_ADDFLAG( 0x00100000, "enterkeybehav" ); - EXC_CTRLDUMP_ADDFLAG( 0x00200000, "enterfieldbehav" ); - EXC_CTRLDUMP_ADDFLAG( 0x00400000, "tabkeybehav" ); - EXC_CTRLDUMP_ADDFLAG( 0x00800000, "wordwrap" ); - EXC_CTRLDUMP_ADDFLAG( 0x04000000, "selmargin" ); - EXC_CTRLDUMP_ADDFLAG( 0x08000000, "autowordsel" ); - EXC_CTRLDUMP_ADDFLAG( 0x10000000, "autosize" ); - EXC_CTRLDUMP_ADDFLAG( 0x20000000, "hidesel" ); - EXC_CTRLDUMP_ADDFLAG( 0x40000000, "autotab" ); - EXC_CTRLDUMP_ADDFLAG( 0x80000000, "multiline" ); - EXC_CTRLDUMP_ENDFLAG( 0x030043F1 ); - - if( nCtrlFlags & 0x00000002 ) EXC_CTRLDUMP_HEX4( "backcolor" ); - if( nCtrlFlags & 0x00000004 ) EXC_CTRLDUMP_HEX4( "forecolor" ); - if( nCtrlFlags & 0x00000008 ) EXC_CTRLDUMP_DEC4( "maxlen" ); - if( nCtrlFlags & 0x00000010 ) EXC_CTRLDUMP_DEC1( "borderstyle" ); - if( nCtrlFlags & 0x00000020 ) EXC_CTRLDUMP_DEC1( "scrollbars" ); - if( nCtrlFlags & 0x00000040 ) EXC_CTRLDUMP_DEC1( "style" ); - if( nCtrlFlags & 0x00000080 ) EXC_CTRLDUMP_DEC1( "mouseptr" ); - if( nCtrlFlags & 0x00000200 ) EXC_CTRLDUMP_HEX2( "passwordchar" ); - if( nCtrlFlags & 0x00000400 ) EXC_CTRLDUMP_DEC4( "listwidth" ); - if( nCtrlFlags & 0x00000800 ) EXC_CTRLDUMP_DEC2( "boundcol" ); - if( nCtrlFlags & 0x00001000 ) EXC_CTRLDUMP_DEC2( "textcol" ); - if( nCtrlFlags & 0x00002000 ) EXC_CTRLDUMP_DEC2( "colcount" ); - if( nCtrlFlags & 0x00004000 ) EXC_CTRLDUMP_DEC2( "listrows" ); - if( nCtrlFlags & 0x00008000 ) EXC_CTRLDUMP_DEC2( "colwidth?" ); - if( nCtrlFlags & 0x00010000 ) EXC_CTRLDUMP_DEC1( "matchentry" ); - if( nCtrlFlags & 0x00020000 ) EXC_CTRLDUMP_DEC1( "liststyle" ); - if( nCtrlFlags & 0x00040000 ) EXC_CTRLDUMP_DEC1( "showdropbtn" ); - if( nCtrlFlags & 0x00100000 ) EXC_CTRLDUMP_DEC1( "dropbtnstyle" ); - if( nCtrlFlags & 0x00200000 ) EXC_CTRLDUMP_DEC1( "multistate" ); - if( nCtrlFlags & 0x00400000 ) EXC_CTRLDUMP_DECVARMASK( nValueLen, 0x7FFFFFFF, "value-len" ); - if( nCtrlFlags & 0x00800000 ) EXC_CTRLDUMP_DECVARMASK( nCaptionLen, 0x7FFFFFFF, "caption-len" ); - if( nCtrlFlags & 0x01000000 ) EXC_CTRLDUMP_COORD2( "picpos" ); - if( nCtrlFlags & 0x02000000 ) EXC_CTRLDUMP_HEX4( "bordercolor" ); - if( nCtrlFlags & 0x04000000 ) EXC_CTRLDUMP_DEC4( "specialeff" ); - if( nCtrlFlags & 0x08000000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" ); - if( nCtrlFlags & 0x10000000 ) EXC_CTRLDUMP_HEXVAR( nPic, "pic" ); - if( nCtrlFlags & 0x20000000 ) EXC_CTRLDUMP_HEX1( "accel" ); - if( nCtrlFlags2 & 0x00000001 ) EXC_CTRLDUMP_DECVARMASK( nGroupNameLen, 0x7FFFFFFF, "groupname-len" ); - - if( nCtrlFlags & 0x00000100 ) EXC_CTRLDUMP_SIZE4( "size" ); - if( nCtrlFlags & 0x00400000 ) EXC_CTRLDUMP_STRING( nValueLen, "value" ); - if( nCtrlFlags & 0x00800000 ) EXC_CTRLDUMP_STRING( nCaptionLen, "caption" ); - if( nCtrlFlags2 & 0x00000001 ) EXC_CTRLDUMP_STRING( nGroupNameLen, "groupname" ); - EXC_CTRLDUMP_REMAINING( nStartPos + nSize ); - - EXC_CTRLDUMP_IMAGE( nIcon, "icon" ); - EXC_CTRLDUMP_IMAGE( nPic, "pic" ); - bHasFontData = true; - } - break; - - case EXC_CTRL_LABEL: - { - EXC_CTRLDUMP_STARTFLAG( "content-flags" ); - EXC_CTRLDUMP_ADDFLAG( 0x0001, "forecolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x0002, "backcolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x0004, "option" ); - EXC_CTRLDUMP_ADDFLAG( 0x0008, "caption" ); - EXC_CTRLDUMP_ADDFLAG( 0x0010, "picpos" ); - EXC_CTRLDUMP_ADDFLAG( 0x0020, "size" ); - EXC_CTRLDUMP_ADDFLAG( 0x0040, "mouseptr" ); - EXC_CTRLDUMP_ADDFLAG( 0x0080, "bordercolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x0100, "borderstyle" ); - EXC_CTRLDUMP_ADDFLAG( 0x0200, "specialeff" ); - EXC_CTRLDUMP_ADDFLAG( 0x0400, "pic" ); - EXC_CTRLDUMP_ADDFLAG( 0x0800, "accel" ); - EXC_CTRLDUMP_ADDFLAG( 0x1000, "icon" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFFE000 ); - sal_uInt32 nCtrlFlags = nFlags; - - if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_HEX4( "forecolor" ); - if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_HEX4( "backcolor" ); - - EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x0004, 0x0080001B ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000004, "locked" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000008, "opaque" ); - EXC_CTRLDUMP_ADDFLAG( 0x00800000, "wordwrap" ); - EXC_CTRLDUMP_ADDFLAG( 0x10000000, "autosize" ); - EXC_CTRLDUMP_ENDFLAG( 0xEF7FFFF0 ); // 0x00000001 always set? - - if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_DECVARMASK( nCaptionLen, 0x7FFFFFFF, "caption-len" ); - if( nCtrlFlags & 0x0010 ) EXC_CTRLDUMP_COORD2( "picpos" ); - if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_DEC1( "mouseptr" ); - if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_HEX4( "bordercolor" ); - if( nCtrlFlags & 0x0100 ) EXC_CTRLDUMP_HEX2( "borderstyle" ); - if( nCtrlFlags & 0x0200 ) EXC_CTRLDUMP_HEX2( "specialeff" ); - if( nCtrlFlags & 0x0400 ) EXC_CTRLDUMP_HEXVAR( nPic, "pic" ); - if( nCtrlFlags & 0x0800 ) EXC_CTRLDUMP_HEX2( "accel" ); - if( nCtrlFlags & 0x1000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" ); - - if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_STRING( nCaptionLen, "caption" ); - if( nCtrlFlags & 0x0020 ) EXC_CTRLDUMP_SIZE4( "size" ); - EXC_CTRLDUMP_REMAINING( nStartPos + nSize ); - - EXC_CTRLDUMP_IMAGE( nPic, "pic" ); - EXC_CTRLDUMP_IMAGE( nIcon, "icon" ); - bHasFontData = true; - } - break; - - case EXC_CTRL_SPINBUTTON: - case EXC_CTRL_SCROLLBAR: - { - EXC_CTRLDUMP_STARTFLAG( "content-flags" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000001, "forecolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "backcolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000004, "option" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000008, "size" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000010, "mouseptr" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000100, "unknown1" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000200, "unknown2" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000400, "unknown3" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000020, "min" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000040, "max" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000080, "value" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000800, "step" ); - EXC_CTRLDUMP_ADDFLAG( 0x00001000, "page-step" ); - EXC_CTRLDUMP_ADDFLAG( 0x00002000, "orient" ); - EXC_CTRLDUMP_ADDFLAG( 0x00004000, "prop-thumb" ); - EXC_CTRLDUMP_ADDFLAG( 0x00008000, "delay" ); - EXC_CTRLDUMP_ADDFLAG( 0x00010000, "icon" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFE0000 ); - sal_uInt32 nCtrlFlags = nFlags; - - if( nCtrlFlags & 0x00000001 ) EXC_CTRLDUMP_HEX4( "forecolor" ); - if( nCtrlFlags & 0x00000002 ) EXC_CTRLDUMP_HEX4( "backcolor" ); - - EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x00000004, 0x0000001B ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000004, "locked" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000008, "opaque" ); - EXC_CTRLDUMP_ADDFLAG( 0x10000000, "autosize" ); - EXC_CTRLDUMP_ENDFLAG( 0xEFFFFFF1 ); - - if( nCtrlFlags & 0x00000010 ) EXC_CTRLDUMP_DEC1( "mouseptr" ); - if( nCtrlFlags & 0x00000020 ) EXC_CTRLDUMP_DEC4( "min" ); - if( nCtrlFlags & 0x00000040 ) EXC_CTRLDUMP_DEC4( "max" ); - if( nCtrlFlags & 0x00000080 ) EXC_CTRLDUMP_DEC4( "value" ); - if( nCtrlFlags & 0x00000100 ) EXC_CTRLDUMP_HEX4( "unknown1" ); - if( nCtrlFlags & 0x00000200 ) EXC_CTRLDUMP_HEX4( "unknown2" ); - if( nCtrlFlags & 0x00000400 ) EXC_CTRLDUMP_HEX4( "unknown3" ); - if( nCtrlFlags & 0x00000800 ) EXC_CTRLDUMP_DEC4( "step" ); - if( nCtrlFlags & 0x00001000 ) EXC_CTRLDUMP_DEC4( "page-step" ); - if( nCtrlFlags & 0x00002000 ) EXC_CTRLDUMP_DEC4( "orient" ); - if( nCtrlFlags & 0x00004000 ) EXC_CTRLDUMP_DEC4( "prop-thumb" ); - if( nCtrlFlags & 0x00008000 ) EXC_CTRLDUMP_DEC4( "delay" ); - if( nCtrlFlags & 0x00010000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" ); - - if( nCtrlFlags & 0x00000008 ) EXC_CTRLDUMP_SIZE4( "size" ); - EXC_CTRLDUMP_REMAINING( nStartPos + nSize ); - - EXC_CTRLDUMP_IMAGE( nIcon, "icon" ); - } - break; - - case EXC_CTRL_IMAGE: - { - EXC_CTRLDUMP_STARTFLAG( "content-flags" ); - EXC_CTRLDUMP_ADDFLAG( 0x0004, "autosize" ); - EXC_CTRLDUMP_ADDFLAG( 0x0008, "bordercolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x0010, "backcolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x0020, "borderstyle" ); - EXC_CTRLDUMP_ADDFLAG( 0x0040, "mouseptr" ); - EXC_CTRLDUMP_ADDFLAG( 0x0080, "picsizemode" ); - EXC_CTRLDUMP_ADDFLAG( 0x0100, "speceffect" ); - EXC_CTRLDUMP_ADDFLAG( 0x0200, "size" ); - EXC_CTRLDUMP_ADDFLAG( 0x0400, "pic" ); - EXC_CTRLDUMP_ADDFLAG( 0x0800, "picalign" ); - EXC_CTRLDUMP_ADDFLAG( 0x1000, "pictiling" ); - EXC_CTRLDUMP_ADDFLAG( 0x2000, "option" ); - EXC_CTRLDUMP_ADDFLAG( 0x4000, "icon" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFF8003 ); - sal_uInt32 nCtrlFlags = nFlags; - - if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_HEX4( "bordercolor" ); - if( nCtrlFlags & 0x0010 ) EXC_CTRLDUMP_HEX4( "backcolor" ); - if( nCtrlFlags & 0x0020 ) EXC_CTRLDUMP_HEX1( "borderstyle" ); - if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_DEC1( "mouseptr" ); - if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_DEC1( "picsizemode" ); - if( nCtrlFlags & 0x0100 ) EXC_CTRLDUMP_HEX1( "speceffect" ); - if( nCtrlFlags & 0x0400 ) EXC_CTRLDUMP_HEXVAR( nPic, "pic" ); - if( nCtrlFlags & 0x0800 ) EXC_CTRLDUMP_HEX1( "picalign" ); - - EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x2000, 0x0000001B ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000008, "opaque" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFFFFF5 ); - - if( nCtrlFlags & 0x4000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" ); - - if( nCtrlFlags & 0x0200 ) EXC_CTRLDUMP_SIZE4( "size" ); - EXC_CTRLDUMP_REMAINING( nStartPos + nSize ); - - EXC_CTRLDUMP_IMAGE( nPic, "pic" ); - EXC_CTRLDUMP_IMAGE( nIcon, "icon" ); - } - break; - - case EXC_CTRL_TABSTRIP: - { - EXC_CTRLDUMP_STARTFLAG( "content-flags" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000001, "selected-tab" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "backcolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000004, "forecolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000010, "size" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000020, "caption-arr-len" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000040, "mouseptr" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000100, "taborientation" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000200, "tabstyle" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000400, "multirow" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000800, "fixed-width" ); - EXC_CTRLDUMP_ADDFLAG( 0x00001000, "fixed-height" ); - EXC_CTRLDUMP_ADDFLAG( 0x00008000, "infotip-arr-len" ); - EXC_CTRLDUMP_ADDFLAG( 0x00020000, "id-arr-len" ); - EXC_CTRLDUMP_ADDFLAG( 0x00040000, "option" ); - EXC_CTRLDUMP_ADDFLAG( 0x00080000, "last-id" ); - EXC_CTRLDUMP_ADDFLAG( 0x00200000, "unknown-arr-len" ); - EXC_CTRLDUMP_ADDFLAG( 0x00400000, "tab-count" ); - EXC_CTRLDUMP_ADDFLAG( 0x00800000, "shortcut-arr-len" ); - EXC_CTRLDUMP_ADDFLAG( 0x01000000, "icon" ); - EXC_CTRLDUMP_ENDFLAG( 0xFE116088 ); - sal_uInt32 nCtrlFlags = nFlags; - - sal_uInt32 nTabCount = 0; - sal_uInt32 nIdArrLen = 0; - sal_uInt32 nUnknownArrLen = 0; - sal_uInt32 nShortArrLen = 0; - - if( nCtrlFlags & 0x00000001 ) EXC_CTRLDUMP_DEC4( "selected-tab" ); // size ok? - if( nCtrlFlags & 0x00000002 ) EXC_CTRLDUMP_HEX4( "backcolor" ); - if( nCtrlFlags & 0x00000004 ) EXC_CTRLDUMP_HEX4( "forecolor" ); - if( nCtrlFlags & 0x00000020 ) EXC_CTRLDUMP_HEXVAR( nCaptionLen, "caption-arr-len" ); - if( nCtrlFlags & 0x00000040 ) EXC_CTRLDUMP_DEC1( "mouseptr" ); // size ok? - if( nCtrlFlags & 0x00000100 ) EXC_CTRLDUMP_DEC4( "taborientation" ); // size ok? - if( nCtrlFlags & 0x00000200 ) EXC_CTRLDUMP_DEC4( "tabstyle" ); // size ok? - if( nCtrlFlags & 0x00000800 ) EXC_CTRLDUMP_DEC4( "fixed-width" ); - if( nCtrlFlags & 0x00001000 ) EXC_CTRLDUMP_DEC4( "fixed-height" ); - if( nCtrlFlags & 0x00008000 ) EXC_CTRLDUMP_HEXVAR( nTipLen, "infotip-arr-len" ); - if( nCtrlFlags & 0x00020000 ) EXC_CTRLDUMP_HEXVAR( nIdArrLen, "id-arr-len" ); - - EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x00040000, 0x0000001B ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFFFFFD ); - - if( nCtrlFlags & 0x00080000 ) EXC_CTRLDUMP_DEC4( "last-id" ); - if( nCtrlFlags & 0x00200000 ) EXC_CTRLDUMP_HEXVAR( nUnknownArrLen, "unknown-arr-len" ); - if( nCtrlFlags & 0x00400000 ) EXC_CTRLDUMP_DECVAR( nTabCount, "tab-count" ); - if( nCtrlFlags & 0x00800000 ) EXC_CTRLDUMP_HEXVAR( nShortArrLen, "shortcut-arr-len" ); - if( nCtrlFlags & 0x01000000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" ); - - if( nCtrlFlags & 0x00000010 ) EXC_CTRLDUMP_SIZE4( "size" ); - if( nCtrlFlags & 0x00000020 ) EXC_CTRLDUMP_STRINGARRAY( nCaptionLen, nTabCount, "caption" ); - if( nCtrlFlags & 0x00008000 ) EXC_CTRLDUMP_STRINGARRAY( nTipLen, nTabCount, "infotip" ); - if( nCtrlFlags & 0x00020000 ) EXC_CTRLDUMP_STRINGARRAY( nIdArrLen, nTabCount, "id" ); - if( nCtrlFlags & 0x00200000 ) EXC_CTRLDUMP_STRINGARRAY( nUnknownArrLen, nTabCount, "unknown" ); - if( nCtrlFlags & 0x00800000 ) EXC_CTRLDUMP_STRINGARRAY( nShortArrLen, nTabCount, "shortcut" ); - EXC_CTRLDUMP_REMAINING( nStartPos + nSize ); - - EXC_CTRLDUMP_IMAGE( nIcon, "icon" ); - bHasFontData = true; - } - break; - - case EXC_CTRL_USERFORM: - case EXC_CTRL_FRAME: - case EXC_CTRL_MULTIPAGE: - case EXC_CTRL_PAGE: - { - EXC_CTRLDUMP_STARTFLAG( "content-flags" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "backcolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000004, "forecolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000008, "last-id" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000040, "option" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000080, "borderstyle" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000100, "mouseptr" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000200, "scrollbars" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000400, "size" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000800, "scrollsize" ); - EXC_CTRLDUMP_ADDFLAG( 0x00001000, "scrollpos" ); - EXC_CTRLDUMP_ADDFLAG( 0x00008000, "icon" ); - EXC_CTRLDUMP_ADDFLAG( 0x00010000, "cycle" ); - EXC_CTRLDUMP_ADDFLAG( 0x00020000, "speceffect" ); - EXC_CTRLDUMP_ADDFLAG( 0x00040000, "bordercolor" ); - EXC_CTRLDUMP_ADDFLAG( 0x00080000, "caption" ); - EXC_CTRLDUMP_ADDFLAG( 0x00100000, "font" ); - EXC_CTRLDUMP_ADDFLAG( 0x00200000, "pic" ); - EXC_CTRLDUMP_ADDFLAG( 0x00400000, "zoom" ); - EXC_CTRLDUMP_ADDFLAG( 0x00800000, "picalign" ); - EXC_CTRLDUMP_ADDFLAG( 0x01000000, "pictiling" ); - EXC_CTRLDUMP_ADDFLAG( 0x02000000, "picsizemode" ); - EXC_CTRLDUMP_ADDFLAG( 0x04000000, "typeinfover" ); - EXC_CTRLDUMP_ADDFLAG( 0x08000000, "drawbuffer" ); - EXC_CTRLDUMP_ENDFLAG( 0xF0006031 ); - sal_uInt32 nCtrlFlags = nFlags; - - if( nCtrlFlags & 0x00000002 ) EXC_CTRLDUMP_HEX4( "backcolor" ); - if( nCtrlFlags & 0x00000004 ) EXC_CTRLDUMP_HEX4( "forecolor" ); - if( nCtrlFlags & 0x00000008 ) EXC_CTRLDUMP_DEC4( "last-id" ); - - EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x00000040, 0x00000002 ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFFFFFD ); - - if( nCtrlFlags & 0x00000080 ) EXC_CTRLDUMP_HEX1( "borderstyle" ); - if( nCtrlFlags & 0x00000100 ) EXC_CTRLDUMP_DEC1( "mouseptr" ); - if( nCtrlFlags & 0x00000200 ) EXC_CTRLDUMP_HEX1( "scrollbars" ); - if( nCtrlFlags & 0x00008000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" ); - if( nCtrlFlags & 0x00010000 ) EXC_CTRLDUMP_DEC1( "cycle" ); - if( nCtrlFlags & 0x00020000 ) EXC_CTRLDUMP_HEX1( "speceffect" ); - if( nCtrlFlags & 0x00040000 ) EXC_CTRLDUMP_HEX4( "bordercolor" ); - if( nCtrlFlags & 0x00080000 ) EXC_CTRLDUMP_DECVARMASK( nCaptionLen, 0x7FFFFFFF, "caption-len" ); - if( nCtrlFlags & 0x00100000 ) EXC_CTRLDUMP_HEXVAR( nFont, "font" ); - if( nCtrlFlags & 0x00200000 ) EXC_CTRLDUMP_HEXVAR( nPic, "pic" ); - if( nCtrlFlags & 0x00400000 ) EXC_CTRLDUMP_DEC4( "zoom" ); - if( nCtrlFlags & 0x00800000 ) EXC_CTRLDUMP_HEX1( "picalign" ); - if( nCtrlFlags & 0x02000000 ) EXC_CTRLDUMP_DEC1( "picsizemode" ); - if( nCtrlFlags & 0x04000000 ) EXC_CTRLDUMP_DEC4( "typeinfover" ); - if( nCtrlFlags & 0x08000000 ) EXC_CTRLDUMP_DEC4( "drawbuffer" ); - - if( nCtrlFlags & 0x00000400 ) EXC_CTRLDUMP_SIZE4( "size" ); - if( nCtrlFlags & 0x00000800 ) EXC_CTRLDUMP_SIZE4( "scrollsize" ); - if( nCtrlFlags & 0x00001000 ) EXC_CTRLDUMP_COORD4( "scrollpos" ); - if( nCtrlFlags & 0x00080000 ) EXC_CTRLDUMP_STRING( nCaptionLen, "caption" ); - EXC_CTRLDUMP_REMAINING( nStartPos + nSize ); - - EXC_CTRLDUMP_FONT( nFont, "font" ); - EXC_CTRLDUMP_IMAGE( nIcon, "icon" ); - EXC_CTRLDUMP_IMAGE( nPic, "pic" ); - } - break; - - case EXC_CTRL_FONTDATA: - { - EXC_CTRLDUMP_STARTFLAG( "content-flags" ); - EXC_CTRLDUMP_ADDFLAG( 0x01, "font-name" ); - EXC_CTRLDUMP_ADDFLAG( 0x02, "font-style" ); - EXC_CTRLDUMP_ADDFLAG( 0x04, "font-size" ); - EXC_CTRLDUMP_ADDFLAG( 0x10, "language-id" ); - EXC_CTRLDUMP_ADDFLAG( 0x40, "align" ); - EXC_CTRLDUMP_ADDFLAG( 0x80, "font-weight" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFFFF08 ); // 0x20 always set? - sal_uInt32 nCtrlFlags = nFlags; - - if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_DECVARMASK( nNameLen, 0x7FFFFFFF, "font-name-len" ); - - EXC_CTRLDUMP_STARTOPTFLAG( "font-style-flags", nCtrlFlags & 0x0002, 0x40000000 ); - EXC_CTRLDUMP_ADDFLAG( 0x0001, "bold" ); - EXC_CTRLDUMP_ADDFLAG( 0x0002, "italic" ); - EXC_CTRLDUMP_ADDFLAG( 0x0004, "underline" ); - EXC_CTRLDUMP_ADDFLAG( 0x0008, "strikeout" ); - EXC_CTRLDUMP_ADDFLAG( 0x2000, "sunken" ); - EXC_CTRLDUMP_ENDFLAG( 0xBFFFDFF0 ); // 0x40000000 always set? - - if( nCtrlFlags & 0x0004 ) EXC_CTRLDUMP_DEC4( "font-size" ); - if( nCtrlFlags & 0x0010 ) EXC_CTRLDUMP_HEX2( "language-id" ); - if( nCtrlFlags & 0x0040 ) - { - EXC_CTRLDUMP_ALIGN_INSTRM( 2 ); - sal_uInt16 nAlign; rInStrm >> nAlign; - t += " align="; lclAppendDec( t, nAlign ); - switch( nAlign ) - { - case 1: t += "=left"; break; - case 2: t += "=right"; break; - case 3: t += "=center"; break; - default: t += "=!unknown!"; - } - EXC_CTRLDUMP_PRINT(); - } - if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_DEC2( "font-weight" ); - - if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_STRING( nNameLen, "font-name" ); - EXC_CTRLDUMP_REMAINING( nStartPos + nSize ); - } - break; - - case EXC_CTRL_ADDDATA: - { - EXC_CTRLDUMP_STARTFLAG( "content-flags" ); - EXC_CTRLDUMP_ADDFLAG( 0x0001, "guid1" ); - EXC_CTRLDUMP_ADDFLAG( 0x0002, "guid2" ); - EXC_CTRLDUMP_ADDFLAG( 0x0008, "guid4" ); - EXC_CTRLDUMP_ADDFLAG( 0x0040, "unknown1" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFFFFB4 ); - sal_uInt32 nCtrlFlags = nFlags; - - if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_HEX4( "unknown1" ); - - if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_GUID( "guid1" ); - if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_GUID( "guid2" ); - if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_GUID( "guid4" ); - EXC_CTRLDUMP_REMAINING( nStartPos + nSize ); - } - break; - - case EXC_CTRL_FRAMECHILD: - { - EXC_CTRLDUMP_STARTFLAG( "content-flags" ); - EXC_CTRLDUMP_ADDFLAG( 0x0001, "name-len" ); - EXC_CTRLDUMP_ADDFLAG( 0x0002, "tag-len" ); - EXC_CTRLDUMP_ADDFLAG( 0x0004, "storage-id" ); - EXC_CTRLDUMP_ADDFLAG( 0x0008, "helpcontext-id" ); - EXC_CTRLDUMP_ADDFLAG( 0x0010, "option" ); - EXC_CTRLDUMP_ADDFLAG( 0x0020, "substream-len" ); - EXC_CTRLDUMP_ADDFLAG( 0x0040, "tabpos" ); - EXC_CTRLDUMP_ADDFLAG( 0x0080, "type" ); - EXC_CTRLDUMP_ADDFLAG( 0x0100, "pos" ); - EXC_CTRLDUMP_ADDFLAG( 0x0800, "tiptext" ); - EXC_CTRLDUMP_ADDFLAG( 0x1000, "ctrl-id" ); - EXC_CTRLDUMP_ADDFLAG( 0x2000, "ctrl-source" ); - EXC_CTRLDUMP_ADDFLAG( 0x4000, "row-source" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFF8600 ); - sal_uInt32 nCtrlFlags = nFlags; - - sal_uInt32 nStorageId = 0; - sal_uInt32 nSubStrmLen = 0; - sal_uInt16 nChildType = EXC_CTRL_UNKNOWN; - - if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_DECVARMASK( nNameLen, 0x7FFFFFFF, "name-len" ); - if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_DECVARMASK( nTagLen, 0x7FFFFFFF, "tag-len" ); - if( nCtrlFlags & 0x0004 ) EXC_CTRLDUMP_PLAIN_DECVAR( nStorageId, "storage-id" ); - if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_PLAIN_DEC4( "helpcontext-id" ); - - EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x0010, 0x00000033 ); - EXC_CTRLDUMP_ADDFLAG( 0x00000001, "tabstop" ); - EXC_CTRLDUMP_ADDFLAG( 0x00000002, "visible" ); - EXC_CTRLDUMP_ADDFLAG( 0x00040000, "container" ); - EXC_CTRLDUMP_ENDFLAG( 0xFFFBFFFC ); - - if( nCtrlFlags & 0x0020 ) EXC_CTRLDUMP_HEXVAR( nSubStrmLen, "substream-len" ); - if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_DEC2( "tabpos" ); - if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_CTRLTYPE( nChildType, "type" ); - if( nCtrlFlags & 0x0800 ) EXC_CTRLDUMP_DECVARMASK( nTipLen, 0x7FFFFFFF, "infotip-len" ); - if( nCtrlFlags & 0x1000 ) EXC_CTRLDUMP_DECVARMASK( nCtrlIdLen, 0x7FFFFFFF, "ctrl-id-len" ); - if( nCtrlFlags & 0x2000 ) EXC_CTRLDUMP_DECVARMASK( nCtrlSrcLen, 0x7FFFFFFF, "ctrl-source-len" ); - if( nCtrlFlags & 0x4000 ) EXC_CTRLDUMP_DECVARMASK( nRowSrcLen, 0x7FFFFFFF, "row-source-len" ); - - if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_STRING( nNameLen, "name" ); - if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_STRING( nTagLen, "tag" ); - if( nCtrlFlags & 0x0100 ) EXC_CTRLDUMP_COORD4( "pos" ); - if( nCtrlFlags & 0x0800 ) EXC_CTRLDUMP_STRING( nTipLen, "infotip" ); - if( nCtrlFlags & 0x1000 ) EXC_CTRLDUMP_STRING( nCtrlIdLen, "ctrl-id" ); - if( nCtrlFlags & 0x2000 ) EXC_CTRLDUMP_STRING( nCtrlSrcLen, "ctrl-source" ); - if( nCtrlFlags & 0x4000 ) EXC_CTRLDUMP_STRING( nRowSrcLen, "row-source" ); - EXC_CTRLDUMP_REMAINING( nStartPos + nSize ); - - if( (nCtrlFlags & 0x0080) && (nChildType != EXC_CTRL_UNKNOWN) ) - { - if( (nFlags & 0x00040000) && (nStorageId > 0) ) - maCtrlStorages.push_back( XclDumpCtrlPortion( nStorageId, nChildType ) ); - if( (nCtrlFlags & 0x0020) && (nSubStrmLen > 0) ) - maCtrlPortions.push_back( XclDumpCtrlPortion( nSubStrmLen, nChildType ) ); - } - } - break; - - default: - EXC_CTRLDUMP_REMAINING( nStartPos + nSize ); - } - - // font data - if( bHasFontData ) - DumpControlContents( rInStrm, EXC_CTRL_FONTDATA ); - } -} - -// ============================================================================ -// -// S T R E A M S -// -// ============================================================================ - -void Biff8RecDumper::DumpBinaryStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath ) -{ - SotStorageStreamRef xInStrm = OpenStream( xStrg, rStrmName ); - if( !xInStrm || !pDumpStream ) return; - - XclDumpStreamHeader aStrmHeader( *xInStrm, *pDumpStream, rStrmName, rStrgPath ); - DumpBinary( *xInStrm ); - (*pDumpStream) << "\n"; -} - -void Biff8RecDumper::DumpTextStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath ) -{ - SotStorageStreamRef xInStrm = OpenStream( xStrg, rStrmName ); - if( !xInStrm || !pDumpStream ) return; - - XclDumpStreamHeader aStrmHeader( *xInStrm, *pDumpStream, rStrmName, rStrgPath ); - while( xInStrm->Tell() < aStrmHeader.GetStreamLen() ) - { - ByteString aLine; - xInStrm->ReadLine( aLine ); - lclDumpString( *pDumpStream, aLine ); - (*pDumpStream) << "\n"; - } - (*pDumpStream) << "\n"; -} - -void Biff8RecDumper::DumpRecordStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath ) -{ - SotStorageStreamRef xInStrm = OpenStream( xStrg, rStrmName ); - if( !xInStrm || !pDumpStream ) return; - - XclDumpStreamHeader aStrmHeader( *xInStrm, *pDumpStream, rStrmName, rStrgPath ); - - XclImpStream* pOldStream = pIn; - pIn = new XclImpStream( *xInStrm, GetRoot() ); - XclImpStream& rIn = *pIn; - if( pOldStream ) - rIn.CopyDecrypterFrom( *pOldStream ); - - // -- dump from here -- - UINT16 nId; - BOOL bLoop = TRUE; - - while( bLoop && rIn.StartNextRecord() ) - { - nId = rIn.GetRecId(); - if( HasModeDump( nId ) ) - RecDump( TRUE ); - - bLoop = (nId != 0x000A); - } - - delete pIn; - pIn = pOldStream; -} - -void Biff8RecDumper::DumpCtlsStream() -{ - SotStorageStreamRef xInStrm = OpenStream( EXC_STREAM_CTLS ); - if( !xInStrm || !pDumpStream ) return; - - SvStream& rInStrm = *xInStrm; - SvStream& rOutStrm = *pDumpStream; - XclDumpStreamHeader aStrmHeader( rInStrm, rOutStrm, EXC_STREAM_CTLS, EMPTY_STRING ); - - for( StrmPortionMap::const_iterator aIt = maCtlsPosMap.begin(), aEnd = maCtlsPosMap.end(); aIt != aEnd; ++aIt ) - { - ULONG nCtrlPos = static_cast< ULONG >( aIt->first ); - ULONG nCtrlEnd = nCtrlPos + static_cast< ULONG >( aIt->second ); - if( nCtrlEnd <= aStrmHeader.GetStreamLen() ) - { - // stream position - ULONG nStartPos = nCtrlPos; // for stream alignment macro - rInStrm.Seek( nStartPos ); - - ByteString t( "\npos=" ); __AddHex( t, aIt->first ); - t.Append( " len=" ); __AddHex( t, aIt->second ); - rOutStrm << t.GetBuffer() << " "; - - // control type - sal_uInt16 nCtrlType = lclDumpControlGuid( rInStrm, rOutStrm ); - rOutStrm << "\n"; - - // control contents - if( nCtrlType != EXC_CTRL_UNKNOWN ) - DumpControlContents( rInStrm, nCtrlType ); - - // remaining unknown data - EXC_CTRLDUMP_REMAINING( nCtrlEnd ); - rOutStrm << "\n"; - } - } -} - -void Biff8RecDumper::DumpControlFrameStream( SotStorageRef xInStrg, sal_uInt16 nCtrlType, const String& rStrgPath ) -{ - static const String saStrmName( sal_Unicode( 'f' ) ); - - SotStorageStreamRef xInStrm = OpenStream( xInStrg, saStrmName ); - if( !xInStrm || !pDumpStream ) return; - - SvStream& rInStrm = *xInStrm; - SvStream& rOutStrm = *pDumpStream; - XclDumpStreamHeader aStrmHeader( rInStrm, rOutStrm, saStrmName, rStrgPath ); - - if( aStrmHeader.GetStreamLen() > 0 ) - { - ByteString t; // "t" needed for macros - - rOutStrm << "header-record\n"; - DumpControlContents( rInStrm, nCtrlType ); - rOutStrm << "\n"; - - if( nCtrlType == EXC_CTRL_USERFORM ) - { - rOutStrm << "add-records\n"; - sal_uInt16 nAddCount; - EXC_CTRLDUMP_PLAIN_DECVAR( nAddCount, "count" ); - EXC_CTRLDUMP_PRINT(); - rOutStrm << "\n"; - - for( sal_uInt16 nAdd = 0; (nAdd < nAddCount) && (rInStrm.Tell() < aStrmHeader.GetStreamLen()); ++nAdd ) - { - DumpControlContents( rInStrm, EXC_CTRL_ADDDATA ); - rOutStrm << "\n"; - } - } - - rOutStrm << "children-records\n"; - sal_uInt32 nRecCount, nTotalSize; - EXC_CTRLDUMP_PLAIN_DECVAR( nRecCount, "count" ); - EXC_CTRLDUMP_PLAIN_HEXVAR( nTotalSize, "total-size" ); - if( nTotalSize > 0 ) - { - EXC_CTRLDUMP_PLAIN_HEX4( "header-unknown" ); - rOutStrm << "\n"; - - for( sal_uInt32 nRec = 0; (nRec < nRecCount) && (rInStrm.Tell() < aStrmHeader.GetStreamLen()); ++nRec ) - { - DumpControlContents( rInStrm, EXC_CTRL_FRAMECHILD ); - rOutStrm << "\n"; - } - } - else - rOutStrm << "\n"; - - if( rInStrm.Tell() < aStrmHeader.GetStreamLen() ) - { - rOutStrm << "remaining=\n"; - DumpBinary( rInStrm ); - rOutStrm << "\n"; - } - } -} - -void Biff8RecDumper::DumpControlObjectsStream( SotStorageRef xInStrg, const String& rStrgPath ) -{ - static const String saStrmName( sal_Unicode( 'o' ) ); - - SotStorageStreamRef xInStrm = OpenStream( xInStrg, saStrmName ); - if( !xInStrm || !pDumpStream ) return; - - SvStream& rInStrm = *xInStrm; - SvStream& rOutStrm = *pDumpStream; - XclDumpStreamHeader aStrmHeader( rInStrm, rOutStrm, saStrmName, rStrgPath ); - - if( aStrmHeader.GetStreamLen() > 0 ) - { - ULONG nStrmPos = 0; - for( XclDumpCtrlPortionVec::const_iterator aIt = maCtrlPortions.begin(), aEnd = maCtrlPortions.end(); aIt != aEnd; ++aIt ) - { - rInStrm.Seek( nStrmPos ); - DumpControlContents( rInStrm, aIt->second ); - rOutStrm << "\n"; - nStrmPos += aIt->first; - } - - if( rInStrm.Tell() < aStrmHeader.GetStreamLen() ) - { - rOutStrm << "remaining=\n"; - DumpBinary( rInStrm ); - rOutStrm << "\n"; - } - } -} - -// ============================================================================ -// -// S T O R A G E S -// -// ============================================================================ - -void Biff8RecDumper::DumpAnyStorage( SotStorageRef xParentStrg, const String& rStrgName, const String& rStrgPath ) -{ - SotStorageRef xInStrg = OpenStorage( xParentStrg, rStrgName ); - if( !xInStrg || !pDumpStream ) return; - - XclDumpStorageHeader aStrgHeader( *xInStrg, *pDumpStream, rStrgPath ); -} - -void Biff8RecDumper::DumpUserFormStorage( SotStorageRef xParentStrg, const String& rStrgName, sal_uInt16 nCtrlType, const String& rStrgPath ) -{ - SotStorageRef xInStrg = OpenStorage( xParentStrg, rStrgName ); - if( !xInStrg || !pDumpStream ) return; - - XclDumpStorageHeader aStrgHeader( *xInStrg, *pDumpStream, rStrgPath ); - - // streams - maCtrlStorages.clear(); - maCtrlPortions.clear(); - DumpControlFrameStream( xInStrg, nCtrlType, rStrgPath ); - DumpControlObjectsStream( xInStrg, rStrgPath ); - DumpTextStream( xInStrg, CREATE_STRING( "\003VBFrame" ), rStrgPath ); - - // frame substorages - XclDumpCtrlPortionVec aCtrlStorages( maCtrlStorages ); // make local copy, maCtrlStorages is reused in loop - for( XclDumpCtrlPortionVec::const_iterator aIt = aCtrlStorages.begin(), aEnd = aCtrlStorages.end(); aIt != aEnd; ++aIt ) - { - sal_uInt32 nStorageId = aIt->first; - String aSubName( sal_Unicode( 'i' ) ); - if( nStorageId < 10 ) - aSubName.Append( sal_Unicode( '0' ) ); - aSubName.Append( String::CreateFromInt32( static_cast< sal_Int32 >( nStorageId ) ) ); - - String aPath( rStrgPath ); - aPath.Append( sal_Unicode( '/' ) ).Append( rStrgName ); - - DumpUserFormStorage( xInStrg, aSubName, aIt->second, aPath ); - } -} - -void Biff8RecDumper::DumpVbaProjectStorage() -{ - SotStorageRef xInStrg = OpenStorage( EXC_STORAGE_VBA_PROJECT ); - if( !xInStrg || !pDumpStream ) return; - - XclDumpStorageHeader aStrgHeader( *xInStrg, *pDumpStream, EMPTY_STRING ); - // PROJECT substream - DumpTextStream( xInStrg, CREATE_STRING( "PROJECT" ), EXC_STORAGE_VBA_PROJECT ); - // VBA storage - DumpAnyStorage( xInStrg, EXC_STORAGE_VBA, EXC_STORAGE_VBA_PROJECT ); - // user forms - SvStorageInfoList aInfoList; - xInStrg->FillInfoList( &aInfoList ); - for( ULONG nInfo = 0; nInfo < aInfoList.Count(); ++nInfo ) - { - SvStorageInfo& rInfo = aInfoList.GetObject( nInfo ); - if( rInfo.IsStorage() && (rInfo.GetName() != EXC_STORAGE_VBA) ) - DumpUserFormStorage( xInStrg, rInfo.GetName(), EXC_CTRL_USERFORM, EXC_STORAGE_VBA_PROJECT ); - } -} - -// ============================================================================ -// -// ============================================================================ - -const sal_Char* Biff8RecDumper::GetBlanks( const UINT16 nNumOfBlanks ) -{ - DBG_ASSERT( pBlankLine, "-Biff8RecDumper::GetBlanks(): nicht so schnell mein Freund!" ); - DBG_ASSERT( nNumOfBlanks <= nLenBlankLine, - "+Biff8RecDumper::GetBlanks(): So viel kannst Du nicht von mir verlangen!" ); - - return pBlankLine + ( ( nNumOfBlanks <= nLenBlankLine )? ( nLenBlankLine - nNumOfBlanks ) : 0 ); -} - - -BOOL Biff8RecDumper::IsLineEnd( const sal_Char c, sal_Char& rNext, SvStream& rIn, INT32& rLeft ) -{ - static const sal_Char cNL = '\n'; - static const sal_Char cRET = '\r'; - - if( IsEndOfLine( c ) ) - { - sal_Char cDouble = ( c == cNL )? cRET : cNL; - - if( rNext == cDouble ) - { - rIn >> rNext; - rLeft--; - } - - return TRUE; - } - else - return FALSE; -} - - -_KEYWORD Biff8RecDumper::GetKeyType( const ByteString& r ) -{ - ByteString t( r ); - _KEYWORD e; - - t.ToUpperAscii(); - - if( t == "SKIPDUMP" ) - e = Skipdump; - else if( t == "SKIPOFFSET" ) - e = SkipOffset; - else if( t == "READCONTRECS" ) - e = ReadContRecs; - else if( t == "NOWARNINGS" ) - e = NoWarnings; - else if( t == "CONTLOAD" ) - e = Contload; - else if( t == "BLANKLINE" ) - e = BlankLine; - else if( t == "EXPORTBOOKSTREAM" ) - e = ExportBookStream; - else if( t == "PARSEP" ) - e = Parsep; - else if( t == "MAXBODYLINES" ) - e = Maxbodylines; - else if( t == "INCLUDE" || t == "+" ) - e = Include; - else if( t == "EXCLUDE" || t == "-" ) - e = Exclude; - else if( t == "HEX" || t == "H" ) - e = Hex; - else if( t == "BODY" || t == "B" ) - e = Body; - else if( t == "NAMEONLY" || t =="N" ) - e = NameOnly; - else if( t == "COMMENT" ) - e = Comment; - else if( t == "OUTPUT" ) - e = Output; - else if( t == "TITLE" ) - e = Title; - else if( t == "CLEARFILE" ) - e = ClearFile; - else - e = KW_Unknown; - - return e; -} - - -void Biff8RecDumper::Init( void ) -{ - bClearFile = FALSE; - - if( pDumpModes || ppRecNames ) - return; - - const sal_Char* pDefName = "biffrecdumper.ini"; - const sal_Char* pIniKey = "BIFFRECDUMPERINI"; - const sal_Char pPathSep[] = { SAL_PATHDELIMITER, '\0' }; - ByteString aIniName; - - SvFileStream* pIn = NULL; - - // first try: search for biffrecdumper.ini in dir, specified in %HOME% - const sal_Char* pHome = getenv( "HOME" ); - if( pHome ) - { - aIniName = pHome; - aIniName.EraseTrailingChars( *pPathSep ); - aIniName += pPathSep; - aIniName += pDefName; - - pIn = CreateInStream( aIniName.GetBuffer() ); - } - - if( !pIn ) - { // %HOME% not set or %HOME%\biffrecdumper.ini could not be opened - const sal_Char* pIni = getenv( pIniKey ); - if( pIni ) - { - pIn = CreateInStream( pIni ); - if( !pIn ) - { - AddError( 0, "Could not open ini file", ByteString( pIni ) ); - bEndLoading = TRUE; // zur Sicherheit.... - } - } - } - - if( pIn ) - { - pIn->Seek( STREAM_SEEK_TO_END ); - - const UINT32 nStreamLen = pIn->Tell(); - - if( nStreamLen <= 1 ) - { - pIn->Close(); - delete pIn; - return; - } - - pIn->Seek( STREAM_SEEK_TO_BEGIN ); - - pDumpModes = new UINT16[ nRecCnt ]; - ppRecNames = new ByteString*[ nRecCnt ]; - - memset( pDumpModes, 0x00, sizeof( UINT16 ) * nRecCnt ); - memset( ppRecNames, 0x00, sizeof( ByteString* )* nRecCnt ); - - enum STATE { PreLine, InCommand, PostCommand, InId, PostEqu, - InVal, InName, InInExClude, InBodyMode, PostSepIEC, - PostSepBM, InComment }; - - STATE eAct = PreLine; - sal_Char c; - sal_Char cNext; - INT32 n = ( INT32 ) nStreamLen; - ByteString aCommand; - ByteString aVal; - ByteString aInExClude; - ByteString aHexBody; - UINT32 nLine = 1; - BOOL bCommand = FALSE; - - *pIn >> c >> cNext; - - while( n > 0 ) - { - n--; - - switch( eAct ) - { - case PreLine: - if( IsAlphaNum( c ) ) - { - if( IsNum( c ) ) - { - eAct = InId; - bCommand = FALSE; - } - else - { - eAct = InCommand; - bCommand = TRUE; - } - aCommand.Erase(); - aCommand += c; - } - else if( c == cComm1 && cNext == cComm2 ) - eAct = InComment; - else if( IsLineEnd( c, cNext, *pIn, n ) ) - nLine++; - else if( !IsBlank( c ) ) - { - AddError( nLine, "Unexpected command or id" ); - n = 0; - } - break; - case InCommand: - if( c == '=' ) - { - eAct = PostEqu; - aVal.Erase(); - } - else if( IsAlpha( c ) ) - aCommand += c; - else if( IsBlank( c ) ) - eAct = PostCommand; - else if( IsLineEnd( c, cNext, *pIn, n ) ) - { - if( ExecCommand( nLine, aCommand ) ) - { - eAct = PreLine; - nLine++; - } - else - n = 0; - } - else if( c == cComm1 && cNext == cComm2 ) - { - if( ExecCommand( nLine, aCommand ) ) - eAct = InComment; - else - { - AddError( nLine, "Invalid command before comment", aCommand ); - n = 0; - } - } - else - { - aCommand += '>'; - aCommand += c; - aCommand += '<'; - AddError( nLine, "Invalid character in command or id", aCommand ); - n = 0; - } - break; - case PostCommand: - if( c == '=' ) - { - eAct = PostEqu; - aVal.Erase(); - } - else if( IsLineEnd( c, cNext, *pIn, n ) ) - { - if( ExecCommand( nLine, aCommand ) ) - { - eAct = PreLine; - nLine++; - } - else - n = 0; - } - else if( c == cComm1 && cNext == cComm2 ) - { - if( ExecCommand( nLine, aCommand ) ) - eAct = InComment; - else - { - AddError( nLine, "Invalid command before comment", aCommand ); - n = 0; - } - } - else if( !IsBlank( c ) ) - { - AddError( nLine, "Expecting blank or \'=\' following the command", aCommand ); - n = 0; - } - break; - case InId: - if( c == '=' ) - { - eAct = PostEqu; - aVal.Erase(); - } - else if( IsAlphaNum( c ) ) - aCommand += c; - else if( IsBlank( c ) ) - eAct = PostCommand; - else if( ( c == cComm1 && cNext == cComm2 ) || IsLineEnd( c, cNext, *pIn, n ) ) - { - AddError( nLine, "Unexpected end of record id", aCommand ); - eAct = InComment; - } - else - { - AddError( nLine, "Unexpected sal_Char in record id", aCommand ); - n = 0; - } - break; - case PostEqu: - if( bCommand ) - { // Command - if( c == cComm1 && cNext == cComm2 ) - { - if( ExecCommand( nLine, aCommand ) ) - eAct = InComment; - else - { - AddError( nLine, "Unknown command", aCommand ); - n = 0; - } - } - else if( IsLineEnd( c, cNext, *pIn, n ) ) - { - if( ExecCommand( nLine, aCommand ) ) - { - eAct = PreLine; - nLine++; - } - else - { - AddError( nLine, "Unknown command", aCommand ); - n = 0; - } - } - else if( !bCommand && c == cParSep ) - eAct = PostSepIEC; - else if( !IsBlank( c ) ) - { - aVal.Erase(); - aVal += c; - eAct = InVal; - } - } - else - { // Set - if( ( c == cComm1 && cNext == cComm2 ) || IsLineEnd( c, cNext, *pIn, n ) ) - { - AddError( nLine, "No mode set for record", aCommand ); - n = 0; - } - else if( !bCommand && c == cParSep ) - eAct = PostSepIEC; - else - { - aVal.Erase(); - aVal += c; - eAct = InName; - aInExClude.Erase(); - aHexBody.Erase(); - } - } - break; - case InVal: - if( c == cComm1 && cNext == cComm2 ) - { - if( ExecCommand( nLine, aCommand, &aVal ) ) - eAct = InComment; - else - { - AddError( nLine, "Unknown command", aCommand ); - n = 0; - } - } - else if( IsLineEnd( c, cNext, *pIn, n ) ) - { - if( ExecCommand( nLine, aCommand, &aVal ) ) - { - eAct = PreLine; - nLine++; - } - else - { - AddError( nLine, "Unknown command", aCommand ); - n = 0; - } - } - else - aVal += c; - break; - case InName: - if( c == cParSep ) - eAct = PostSepIEC; - else if( c == cComm1 && cNext == cComm2 ) - { - if( ExecSetVal( nLine, aCommand, &aVal, NULL, NULL ) ) - eAct = InComment; - else - n = 0; - } - else if( IsLineEnd( c, cNext, *pIn, n ) ) - { - if( ExecSetVal( nLine, aCommand, &aVal, NULL, NULL ) ) - { - eAct = PreLine; - nLine++; - } - else - n = 0; - } - else - aVal += c; - break; - case InInExClude: - if( c == cParSep ) - eAct = PostSepBM; - else if( c == cComm1 && cNext == cComm2 ) - { - if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, NULL ) ) - eAct = InComment; - else - n = 0; - } - else if( IsLineEnd( c, cNext, *pIn, n ) ) - { - if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, NULL ) ) - { - eAct = PreLine; - nLine++; - } - else - n = 0; - } - else - aInExClude += c; - break; - case InBodyMode: - if( c == cParSep ) - { - AddError( nLine, "Only 3 parameter possible" ); - n = 0; - } - else if( c == cComm1 && cNext == cComm2 ) - { - if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, &aHexBody ) ) - eAct = InComment; - else - n = 0; - } - else if( IsLineEnd( c, cNext, *pIn, n ) ) - { - if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, &aHexBody ) ) - { - eAct = PreLine; - nLine++; - } - else - n = 0; - } - else - aInExClude += c; - break; - case PostSepIEC: - if( c == cParSep ) - eAct = PostSepBM; - else if( c == cComm1 && cNext == cComm2 ) - { - if( ExecSetVal( nLine, aCommand, &aVal, NULL, NULL ) ) - eAct = InComment; - else - n = 0; - } - else if( IsLineEnd( c, cNext, *pIn, n ) ) - { - if( ExecSetVal( nLine, aCommand, &aVal, NULL, NULL ) ) - { - eAct = PreLine; - nLine++; - } - else - n = 0; - } - else if( !IsBlank( c ) ) - { - aInExClude += c; - eAct = InInExClude; - } - break; - case PostSepBM: - if( c == cParSep ) - eAct = PostSepBM; - else if( c == cComm1 && cNext == cComm2 ) - { - if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, NULL ) ) - eAct = InComment; - else - n = 0; - } - else if( IsLineEnd( c, cNext, *pIn, n ) ) - { - if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, NULL ) ) - { - eAct = PreLine; - nLine++; - } - else - n = 0; - } - else if( !IsBlank( c ) ) - { - aHexBody += c; - eAct = InBodyMode; - } - break; - case InComment: - if( IsLineEnd( c, cNext, *pIn, n ) ) - { - eAct = PreLine; - nLine++; - } - break; - default: - n = 0; - } - - c = cNext; - *pIn >> cNext; - } - - pIn->Close(); - delete pIn; - } -} - - -BOOL Biff8RecDumper::ExecCommand( const UINT32 nL, const ByteString& r, const ByteString* pVal ) -{ - _KEYWORD e = GetKeyType( r ); - BOOL b = TRUE; - const UINT32 nValLen = ( pVal )? pVal->Len() : 0; - BOOL bSet; - UINT16 nMode; - - switch( e ) - { - case Skipdump: bSkip = TRUE; break; - case SkipOffset: bSkipOffset = TRUE; break; - case ReadContRecs: bReadContRecs = TRUE; break; - case NoWarnings: bWarnings = FALSE; break; - case Contload: bEndLoading = TRUE; break; - case BlankLine: bBlankLine = TRUE; break; - case ExportBookStream: bExportBookStream = TRUE; break; - case Parsep: - if( nValLen == 0 ) - { - AddError( nL, "No separator found" ); - b = FALSE; - } - else if( nValLen == 1 ) - cParSep = *( pVal->GetBuffer() ); - else - { - AddError( nL, "More than 1 sal_Char is not valid for separator", *pVal ); - b = FALSE; - } - break; - case Maxbodylines: - if( nValLen ) - { - UINT32 n = GetVal( *pVal ); - - if( n == 0xFFFFFFFF ) - { - AddError( nL, "Syntax error in value of body lines" ); - b = FALSE; - } - else - nMaxBodyLines = n; - } - else - { - AddError( nL, "No value specified for number of body lines" ); - b = FALSE; - } - break; - case Include: - bSet = FALSE; - nMode = MODE_SKIP; - goto _common; - case Exclude: - bSet = TRUE; - nMode = MODE_SKIP; - goto _common; - case Hex: - bSet = TRUE; - nMode = MODE_HEX; - goto _common; - case Body: - bSet = FALSE; - nMode = MODE_HEX; - goto _common; - case NameOnly: - bSet = TRUE; - nMode = MODE_NAMEONLY; - goto _common; -_common: - if( pVal ) - { - IdRangeList aRL; - if( FillIdRangeList( nL, aRL, *pVal ) ) - { - const IdRange* p = aRL.First(); - if( bSet ) - { - while( p ) - { SetFlag( p->nFirst, p->nLast, nMode ); p = aRL.Next(); } - } - else - { - while( p ) - { ClrFlag( p->nFirst, p->nLast, nMode ); p = aRL.Next(); } - } - } - else - b = FALSE; - } - break; - case Comment: - if( pVal && pVal->Len() >= 2 ) - { - cComm1 = pVal->GetChar( 0 ); - cComm2 = pVal->GetChar( 1 ); - } - break; - case Output: - CopyStrpOnStrp( pOutName, pVal ); - if( pOutName ) - { - if( *pOutName == "*" ) - { - ByteString aDefault( "DefaultDumpName.txt" ); - SfxObjectShell* pShell = GetDocShell(); - if( pShell ) - { - SfxMedium* pMedium = pShell->GetMedium(); - if( pMedium ) - { - const ByteString aTextExtension( ".txt" ); - aDefault = GETSTR( pMedium->GetPhysicalName() ); - xub_StrLen nStrLen = aDefault.Len(); - if( nStrLen >= 4 ) - { - ByteString aTmp( aDefault ); - aTmp.ToLowerAscii(); - if( aTmp.Copy( nStrLen -4 ) == ".xls" ) - aDefault.Replace( nStrLen - 4, aTextExtension.Len(), aTextExtension ); - else - aDefault += aTextExtension; - } - else - aDefault += aTextExtension; - } - } - - *pOutName = aDefault; - } - CreateOutStream(); - } - else if( pDumpStream ) - { - pDumpStream->Close(); - DELANDNULL( pDumpStream ); - } - break; - case Title: - CopyStrpOnStrp( pTitle, pVal ); - break; - case ClearFile: - bClearFile = TRUE; - break; - default: - AddError( nL, "Unknown command", r ); - b = FALSE; - } - - return b; -} - - -BOOL Biff8RecDumper::ExecSetVal( const UINT32 nL, const ByteString& rId, const ByteString* pName, - const ByteString* pIEC, const ByteString* pHB ) -{ - UINT32 _nId = GetVal( rId ); - - if( _nId == 0xFFFFFFFF ) - { - AddError( nL, "Syntax error in record id", rId ); - return FALSE; - } - else if( _nId >= ( UINT32 ) nRecCnt ) - { - AddError( nL, "Record id to high", rId ); - return FALSE; - } - - UINT16 nId = ( UINT16 ) _nId; - - if( pName && pName->Len() ) - SetName( nId, *pName ); - - _KEYWORD e; - UINT16 n = GetMode( nId ); - - if( pIEC && pIEC->Len() ) - { - e = GetKeyType( *pIEC ); - - if( e == Include ) - n &= ~MODE_SKIP; - else if( e == Exclude ) - n |= MODE_SKIP; - else - { - AddError( nL, "Invalid key for in-/exclude", *pIEC ); - return FALSE; - } - } - - if( pHB && pHB->Len() ) - { - e = GetKeyType( *pHB ); - - if( e == NameOnly ) - n |= MODE_NAMEONLY; - else - { - n &= ~MODE_NAMEONLY; - if( e == Hex ) - n |= MODE_HEX; - else if( e == Body ) - n &= ~MODE_HEX; - else - { - AddError( nL, "Invalid key for hex/body/name only", *pIEC ); - return FALSE; - } - } - } - - SetMode( nId, n ); - return TRUE; -} - - -void Biff8RecDumper::SetFlag( const UINT16 nF, const UINT16 nL, const UINT16 nFl ) -{ - UINT16 n = ( nF < nL )? nF : nL; - UINT16 nLast = ( nF < nL )? nL : nF; - - if( nLast >= nRecCnt ) - nLast = nRecCnt - 1; - - while( n <= nLast ) - { - pDumpModes[ n ] |= nFl; - n++; - } -} - - -void Biff8RecDumper::ClrFlag( const UINT16 nF, const UINT16 nL, const UINT16 nFlags ) -{ - UINT16 n = ( nF < nL )? nF : nL; - UINT16 nLast = ( nF < nL )? nL : nF; - UINT16 nFl = ~nFlags; - - if( nLast >= nRecCnt ) - nLast = nRecCnt - 1; - - while( n <= nLast ) - { - pDumpModes[ n ] &= nFl; - n++; - } -} - - -void Biff8RecDumper::SetName( const UINT16 n, ByteString* p ) -{ - if( n < nRecCnt ) - CopyStrpOnStrp( ppRecNames[ n ], p ); -} - - -UINT32 Biff8RecDumper::GetVal( const ByteString& r ) -{ - const sal_Char* p = r.GetBuffer(); - sal_Char c = *p; - UINT32 n = 0; - const UINT32 nLimitDec = 0xFFFFFFFF / 10; - const UINT32 nLimitHex = 0xFFFFFFFF / 16; - BOOL bError = FALSE; - - enum STATE { First, Dec, MaybeHex, Hex }; - - STATE e = First; - - while( c ) - { - switch( e ) - { - case First: - if( IsNum( c ) ) - { - if( c == '0' ) - e = MaybeHex; - else - { - e = Dec; - n = GetVal( c ); - } - } - else - bError = TRUE; - break; - case Dec: - if( n < nLimitDec && IsNum( c ) ) - { - n *= 10; - n += GetVal( c ); - } - else - bError = TRUE; - break; - case MaybeHex: - if( c == 'x' || c == 'X' ) - { - e = Hex; - n = 0; - } - else if( IsNum( c ) ) - { - n = GetVal( c ); - e = Dec; - } - else - bError = TRUE; - break; - case Hex: - if( n < nLimitHex && IsHex( c ) ) - { - n *= 16; - n += GetVal( c ); - } - else - bError = TRUE; - break; - } - - if( bError ) - c = 0x00; - else - { - p++; - c = *p; - } - } - - if( bError ) - return 0xFFFFFFFF; - else - return n; -} - - -BOOL Biff8RecDumper::FillIdRangeList( const UINT32 nL, IdRangeList& rRL, const ByteString& rV ) -{ - rRL.Clear(); - - const sal_Char* pSyntErr = "Syntax error in number (list)"; - -#define SYNTERR(ch) AddError( ((UINT32)(b=FALSE))+nL, pSyntErr, ch? ((((t+=">")+=ByteString::CreateFromInt32(ch))+="<")) : t ) -#define NEWVAL(_n) _n=(n>=(UINT32)nRecCnt)?nRecCnt-1:(UINT16)n -#define ORDERN() {if(n1>n2){UINT16 nT=n1;n1=n2;n2=nT;}} - - const sal_Char* p = rV.GetBuffer(); - sal_Char c = *p; - const sal_Char cSep = cParSep; - const sal_Char cCont = '.'; - const sal_Char cAll = '*'; - ByteString t; - UINT16 n1 = 0, n2 = 0; - UINT32 n; - BOOL b = TRUE; - BOOL bExp2 = FALSE; - - enum STATE { PreFirst, InFirst, PostFirst, InCont, PreLast, InLast, PostLast }; - STATE e = PreFirst; - - while( c ) - { - switch( e ) - { - case PreFirst: - if( IsAlphaNum( c ) ) - { - t += c; - e = InFirst; - } - else if( c == cAll ) - { - rRL.Append( 0, nRecCnt - 1 ); - e = PostLast; - } - else if( !IsBlank( c ) ) - SYNTERR( c ); - break; - case InFirst: - if( c == cSep || c == cCont || IsBlank( c ) ) - { - n = GetVal( t ); - if( n == 0xFFFFFFFF ) - SYNTERR( 0 ); - else - NEWVAL( n1 ); - - t.Erase(); - - if( c == cSep ) - { - rRL.Append( n1, n1 ); - e = PreFirst; - } - else if( c == cCont ) - { - bExp2 = TRUE; - e = InCont; - } - else - e = PostFirst; - } - else if( IsAlphaNum( c ) ) - t += c; - else - SYNTERR( c ); - break; - case PostFirst: - if( c == cCont ) - { - e = InCont; - bExp2 = TRUE; - } - else if( c == cSep ) - { - n = GetVal( t ); - if( n == 0xFFFFFFFF ) - SYNTERR( 0 ); - else - NEWVAL( n1 ); - - e = PreFirst; - } - else if( !IsBlank( c ) ) - SYNTERR( c ); - break; - case InCont: - if( IsAlphaNum( c ) ) - { - t += c; - e = InLast; - } - else if( IsBlank( c ) ) - e = PreLast; - else if( c == cSep || c == cAll ) - { - rRL.Append( n1, nRecCnt - 1 ); - bExp2 = FALSE; - e = PreFirst; - } - else if( c != cCont ) - SYNTERR( c ); - break; - case PreLast: - if( IsAlphaNum( c ) ) - { - t += c; - e = InLast; - } - else if( !IsBlank( c ) ) - SYNTERR( c ); - break; - break; - case InLast: - if( c == cSep || IsBlank( c ) ) - { - n = GetVal( t ); - if( n == 0xFFFFFFFF ) - SYNTERR( 0 ); - else - NEWVAL( n2 ); - - t.Erase(); - ORDERN(); - rRL.Append( n1, n2 ); - bExp2 = FALSE; - e = ( c == cSep )? PreFirst : PostLast; - } - else if( IsAlphaNum( c ) ) - t += c; - else - SYNTERR( c ); - break; - case PostLast: - if( c == cSep ) - { - e = PreFirst; - bExp2 = FALSE; - } - else if( !IsBlank( c ) ) - SYNTERR( c ); - break; - } - - if( b ) - { - p++; - c = *p; - } - else - c = 0x00; - } - - if( bExp2 ) - { - if( t.Len() ) - { - n = GetVal( t ); - if( n == 0xFFFFFFFF ) - SYNTERR( 0 ); - else - NEWVAL( n2 ); - ORDERN(); - } - else - n2 = nRecCnt - 1; - - if( b ) - rRL.Append( n1, n2 ); - } - -#undef SYNTERR -#undef NEWVAL -#undef ORDERN - - return b; -} - - -BOOL Biff8RecDumper::CreateOutStream() -{ - if( pDumpStream ) - { - pDumpStream->Close(); - DELANDNULL( pDumpStream ); - } - - if( !bSkip && pOutName ) - { - pOutName->EraseLeadingChars( ' ' ); - pOutName->EraseTrailingChars( ' ' ); - pOutName->EraseLeadingChars( '\t' ); - pOutName->EraseTrailingChars( '\t' ); - - pDumpStream = new SvFileStream( String::CreateFromAscii( pOutName->GetBuffer() ), STREAM_WRITE|STREAM_SHARE_DENYWRITE|(bClearFile?STREAM_TRUNC:0) ); - - if( pDumpStream->IsOpen() ) - { - pDumpStream->Seek( bClearFile? STREAM_SEEK_TO_BEGIN : STREAM_SEEK_TO_END ); - return TRUE; - } - else - { - DELANDNULL( pDumpStream ); - } - } - - return FALSE; -} - - -SvFileStream* Biff8RecDumper::CreateInStream( const sal_Char* pN ) -{ - SvFileStream* p = new SvFileStream( String::CreateFromAscii( pN ), STREAM_READ|STREAM_SHARE_DENYWRITE ); - - if( p->IsOpen() ) - return p; - else - { - delete p; - return NULL; - } -} - - -SvFileStream* Biff8RecDumper::CreateInStream( const sal_Char* pP, const sal_Char* pN ) -{ - ByteString t( pP ); - const sal_Char c = t.GetChar( t.Len() - 1 ); - - if( c != '\\' ) - t += '\\'; - else if( c != '/' ) - t += '/'; - - t += pN; - - return CreateInStream( t.GetBuffer() ); -} - - -void Biff8RecDumper::AddError( const UINT32 n, const ByteString& rT, const ByteString& rH ) -{ - DUMP_ERR* p = new DUMP_ERR( n, rT, rH ); - - if( pFirst ) - pLast->pNext = p; - else - pFirst = p; - - pLast = p; -} - - -Biff8RecDumper::Biff8RecDumper( const XclImpRoot& rRoot, BOOL _bBIFF8 ) : - XclImpRoot( rRoot ), - bBIFF8( _bBIFF8 ), - bEncrypted( false ), - mnEscherPos( 0 ) -{ - nXFCount = 0; - nFontIndex = 0; - nInstances++; - mnSubstream = EXC_BOF_UNKNOWN; - - if( !pCharType ) - { - pCharType = new UINT8[ 256 ]; - memset( pCharType, 0x00, 256 ); - - pCharVal = new UINT8[ 256 ]; - memset( pCharVal, 0x00, 256 ); - - sal_Char c; - UINT8 n; - -#define __TYPE(n) pCharType[(UINT8)n] -#define __VAL(n) pCharVal[(UINT8)n] - - __TYPE( '\n' ) = CT_EOL; - __TYPE( '\r' ) = CT_EOL; - - __TYPE( ' ' ) = CT_BLANK; - __TYPE( '\t' ) = CT_BLANK; - - for( c = '0', n = 0 ; c <= '9' ; c++, n++ ) - { - __TYPE( c ) = CT_NUM|CT_HEX|CT_ALPHANUM; - __VAL( c ) = n; - } - for( c = 'a', n = 10 ; c <= 'f' ; c++, n++ ) - { - __TYPE( c ) = CT_HEX|CT_ALPHA|CT_ALPHANUM|CT_LOWERALPHA; - __VAL( c ) = n; - } - for( c = 'g' ; c <= 'z' ; c++ ) - __TYPE( c ) = CT_ALPHA|CT_ALPHANUM|CT_LOWERALPHA; - for( c = 'A', n = 10 ; c <= 'F' ; c++, n++ ) - { - __TYPE( c ) = CT_HEX|CT_ALPHA|CT_ALPHANUM|CT_UPPERALPHA; - __VAL( c ) = n; - } - for( c = 'G' ; c <= 'Z' ; c++ ) - __TYPE( c ) = CT_ALPHA|CT_ALPHANUM|CT_UPPERALPHA; - -#undef __TYPE -#undef __VAL - } - - pDumpStream = NULL; - - if( !pBlankLine ) - { - pBlankLine = new sal_Char[ nLenBlankLine + 1 ]; - memset( pBlankLine, ' ', nLenBlankLine ); - pBlankLine[ nLenBlankLine ] = 0x00; - } - - pTitle = NULL; - pOutName = NULL; - pLevelPre = pLevelPreStringNT; - - nMaxBodyLines = 1024; - bEndLoading = bSkip = bSkipOffset = bReadContRecs = bBlankLine = bExportBookStream = FALSE; - bWarnings = TRUE; - - pDumpModes = NULL; - ppRecNames = NULL; - - pFirst = pLast = pAct = NULL; - - cParSep = ','; - cComm1 = cComm2 = '/'; - - nFieldCnt = nItemCnt = nTabIndexCnt = 0; - - Init(); -} - - -Biff8RecDumper::~Biff8RecDumper() -{ - if( pDumpStream ) - { - pDumpStream->Close(); - delete pDumpStream; - } - - if( nInstances ) - { - nInstances--; - if( !nInstances ) - { - delete[] pBlankLine; - pBlankLine = NULL; - - delete[] pCharType; - pCharType = NULL; - - delete[] pCharVal; - pCharVal = NULL; - } - } - - if( pDumpModes ) - delete[] pDumpModes; - - if( ppRecNames ) - { - ByteString** pp = ppRecNames; - UINT16 n = nRecCnt; - while( n ) - { - if( *pp ) - delete *pp; - pp++; - n--; - } - delete[] ppRecNames; - } - - if( pTitle ) - delete pTitle; - - if( pOutName ) - delete pOutName; - - DUMP_ERR* p = pFirst; - DUMP_ERR* pD; - if( p ) - { - pD = p; - p = p->pNext; - delete pD; - } -} - - -BOOL Biff8RecDumper::Dump( XclImpStream& r ) -{ - const DUMP_ERR* pErr = FirstErr(); - - if( pErr ) - { - if( pDumpStream ) - { - SvFileStream& rOut = *pDumpStream; - while( pErr ) - { - rOut << "\nError"; - if( pErr->nLine ) - { - ByteString t; - t += ByteString::CreateFromInt32( pErr->nLine ); - rOut << " at line " << t.GetBuffer(); - } - - rOut << ": " << pErr->aText.GetBuffer(); - - if( pErr->pHint ) - rOut << " (" << pErr->pHint->GetBuffer() << ')'; - pErr = NextErr(); - } - rOut << '\n'; - } - } - else if( pDumpStream && !bSkip ) - { - SvStream& rOutStrm = *pDumpStream; - - if( bExportBookStream && pOutName ) - { - ByteString aBookOutName( *pOutName, 0, pOutName->Len() - 4 ); - aBookOutName.Append( "_book.xls" ); - SvFileStream aBook( String::CreateFromAscii( aBookOutName.GetBuffer() ), STREAM_WRITE|STREAM_SHARE_DENYWRITE|STREAM_TRUNC ); - if( aBook.IsOpen() ) - { - const sal_uInt32 nBufLen = 0xFFFF; - sal_uInt8 pBuffer[ nBufLen ]; - r.StoreGlobalPosition(); - while( r.StartNextRecord() ) - { - r.ResetRecord( false ); - sal_uInt16 nRecSize = (sal_uInt16) Min( r.GetRecSize(), nBufLen ); - aBook << r.GetRecId() << nRecSize; - r.Read( pBuffer, nRecSize ); - aBook.Write( pBuffer, nRecSize ); - } - r.SeekGlobalPosition(); - } - } - - if( pTitle ) - rOutStrm << pTitle->GetBuffer(); - - pIn = &r; - r.StoreGlobalPosition(); - - ::std::auto_ptr< XclDumpStorageHeader > xStrgHerader; - SotStorageRef xRootStrg = GetRootStorage(); - if( xRootStrg.Is() ) - xStrgHerader.reset( new XclDumpStorageHeader( *xRootStrg, rOutStrm, EMPTY_STRING ) ); - - ::std::auto_ptr< ScfProgressBar > xProgress( new ScfProgressBar( - GetDocShell(), String( RTL_CONSTASCII_USTRINGPARAM( "Dumper" ) ) ) ); - sal_Int32 nStreamSeg = xProgress->AddSegment( r.GetSvStreamSize() ); - xProgress->ActivateSegment( nStreamSeg ); - - while( r.StartNextRecord() ) - { - xProgress->ProgressAbs( r.GetSvStreamPos() ); - if( HasModeDump( r.GetRecId() ) ) - RecDump(); - } - - rOutStrm << "\n\n"; - - pIn = NULL; - xProgress.reset(); - - r.SeekGlobalPosition(); - - // dump substreams - if( xRootStrg.Is() ) - { - pIn = NULL; - bool bOldEncr = bEncrypted; - bEncrypted = false; - DumpRecordStream( xRootStrg, EXC_STREAM_USERNAMES, EMPTY_STRING ); - - pIn = &r; - bEncrypted = bOldEncr; - DumpRecordStream( xRootStrg, EXC_STREAM_REVLOG, EMPTY_STRING ); - - pIn = NULL; - - DumpCtlsStream(); - DumpVbaProjectStorage(); - } - } - - return !bEndLoading; -} - -#undef Read1 -#undef Read2 -#undef Read4 -#undef Read8 - -#endif - diff --git a/sc/source/filter/excel/biffrecdumper.ini b/sc/source/filter/excel/biffrecdumper.ini deleted file mode 100644 index ba30b217e671..000000000000 --- a/sc/source/filter/excel/biffrecdumper.ini +++ /dev/null @@ -1,340 +0,0 @@ -//SKIPDUMP // on = deactivates the dumper -CONTLOAD // on = dump and load file; off = dump only -SKIPOFFSET // on = skip record stream position -READCONTRECS // on = merge CONTINUE records; off = dump CONTINUEs separately -NOWARNINGS // on = no stream assertions -CLEARFILE // on = overwrite text file; off = append to text file -BLANKLINE // on = blank line between records -//EXPORTBOOKSTREAM // on = export the Book or Workbook stream to [filename]_book.xls -PARSEP=, -//COMMENT=// -OUTPUT=* -//TITLE=--------- Biff8 Woorkbook - Stream - Dump -------------------------------- -//TITLE=-------------------------------------------------------------------------- -MAXBODYLINES=8000 -INCLUDE=* // alternativ + -//EXCLUDE=* -BODY=* // alternativ B -//NAMEONLY=0x0000...0x1000 -//EXCLUDE=0x00E1,0x00C1 // alternativ - -//HEX=* // alternativ H -// 0xYYYY=BEZEICHNUNG,IN/EXCLUDE,MODE(=BODY(B),HEX(H) oder NAMEONLY(N)) -0x0000=DIMENSIONS , -0x0001=BLANK , -0x0002=INTEGER , -0x0003=NUMBER , -0x0004=LABEL , -0x0005=BOOLERR , -0x0006=FORMULA , -0x0007=STRING , -0x0008=ROW , -0x0009=BOF , -0x000A=EOF , -0x000B=INDEX , -0x000C=CALCCOUNT , -0x000D=CALCMODE , -0x000E=PRECISION , -0x000F=REFMODE , -0x0010=DELTA , -0x0011=ITERATION , -0x0012=PROTECT , -0x0013=PASSWORD , -0x0014=HEADER , -0x0015=FOOTER , -0x0016=EXTERNCOUNT , -0x0017=EXTERNSHEET , -0x0018=NAME , -0x0019=WINDOWPROTECT , -0x001A=VERTICALPAGEBREAKS , -0x001B=HORIZONTALPAGEBREAKS , -0x001C=NOTE , -0x001D=SELECTION , -0x001E=FORMAT , -0x001F=FORMATCOUNT , -0x0020=COLUMNDEFAULT , -0x0021=ARRAY , -0x0022=1904 , -0x0023=EXTERNNAME , -0x0024=COLWIDTH , -0x0025=DEFAULTROWHEIGHT , -0x0026=LEFTMARGIN , -0x0027=RIGHTMARGIN , -0x0028=TOPMARGIN , -0x0029=BOTTOMMARGIN , -0x002A=PRINTHEADERS , -0x002B=PRINTGRIDLINES , -0x002F=FILEPASS , -0x0031=FONT , -0x0033=PRINTSIZE , -0x0035=INFOOPTS , -0x0036=TABLE , -0x0038=WNDESK , -0x003A=BEGINPREF , -0x003B=ENDPREF , -0x003C=CONTINUE , -0x003D=WINDOW1 , -0x003E=WINDOW2 , -0x0040=BACKUP , -0x0041=PANE , -0x0042=CODEPAGE , -0x0043=XF , -0x0044=IXFE , -0x0045=EFONT , -0x0046=SHOWSCROLL , -0x0047=SHOWFORMULA , -0x0048=STATUSBAR , -0x0049=SHORTMENUS , -0x004A=DDEENABLED , -0x004B=AUTODEC , -0x004C=MENUKEY , -0x004D=PLS|ZOOM , -0x004E=MENUUND , -0x004F=MOVESEL , -0x0050=DCON , -0x0051=DCONREF , -0x0052=DCONNAME , -0x0055=DEFCOLWIDTH , -0x0056=BUILTINFMTCNT , -0x0058=TOOLBAR , -0x0059=XCT , -0x005A=CRN , -0x005B=FILESHARING , -0x005C=WRITEACCESS , -0x005D=OBJ , -0x005E=UNCALCED , -0x005F=SAFERECALC , -0x0060=TEMPLATE , -0x0063=OBJPROTECT , -0x007D=COLINFO , -0x007E=RK , -0x007F=IMDATA , -0x0080=GUTS , -0x0081=WSBOOL , -0x0082=GRIDSET , -0x0083=HCENTER , -0x0084=VCENTER , -0x0085=BOUNDSHEET , -0x0086=WRITEPROT , -0x0087=ADDIN , -0x0088=EDG , -0x0089=PUB , -0x008A=NOTEOFF , -0x008B=LH , -0x008C=COUNTRY , -0x008D=HIDEOBJ , -0x008E=SHEETSOFFSET , -0x008F=SHEETHEADER , -0x0090=SORT , -0x0091=SUB , -0x0092=PALETTE , -0x0093=STYLE , -0x0094=LHRECORD , -0x0095=LHNGRAPH , -0x0096=SOUND , -0x0098=LPR , -0x0099=STANDARDWIDTH , -0x009A=FNGROUPNAME , -0x009B=FILTERMODE , -0x009C=FNGROUPCOUNT , -0x009D=AUTOFILTERINFO , -0x009E=AUTOFILTER , -0x00A0=SCL , -0x00A1=SETUP , -0x00A3=PROJEXTSHEET , -0x00A8=DRAGDROP , -0x00A9=COORDLIST , -0x00AB=GCW , -0x00AE=SCENMAN , -0x00AF=SCENARIO , -0x00B0=SXVIEW , -0x00B1=SXVD , -0x00B2=SXVI , -0x00B4=SXIVD , -0x00B5=SXLI , -0x00B6=SXPI , -0x00B8=DOCROUTE , -0x00B9=RECIPNAME , -0x00BC=SHRFMLA , -0x00BD=MULRK , -0x00BE=MULBLANK , -0x00C1=MMS , -0x00C2=ADDMENU , -0x00C3=DELMENU , -0x00C5=SXDI , -0x00C6=SXDB , -0x00C7=SXFIELD , -0x00C8=SXINDEXLIST , -0x00C9=SXDOUBLE , -0x00CA=SXBOOLEAN , -0x00CB=SXERROR , -0x00CC=SXINTEGER , -0x00CD=SXSTRING , -0x00CE=SXDATETIME , -0x00CF=SXEMPTY , -0x00D0=SXTBL , -0x00D1=SXTBRGITEM , -0x00D2=SXTBPG , -0x00D3=OBPROJ , -0x00D5=SXIDSTM , -0x00D6=RSTRING , -0x00D7=DBCELL , -0x00D8=SXNUMGROUP , -0x00D9=SXGROUPINFO , -0x00DA=BOOKBOOL , -0x00DB=REVERT , -0x00DC=SXEXT|PARAMQRY , -0x00DD=SCENPROTECT , -0x00DE=OLESIZE , -0x00DF=UDDESC , -0x00E0=XF , -0x00E1=INTERFACEHDR , -0x00E2=INTERFACEEND , -0x00E3=SXVS , -0x00E5=CELLMERGING , -0x00E9=BITMAP , -0x00EB=MSODRAWINGGROUP , -0x00EC=MSODRAWING , -0x00ED=MSODRAWINGSELECTION , -0x00EF=PHONETIC , -0x00F0=SXRULE , -0x00F1=SXEX , -0x00F2=SXFILT , -0x00F6=SXNAME , -0x00F7=SXSELECT , -0x00F8=SXPAIR , -0x00F9=SXFMLA , -0x00FB=SXFORMAT , -0x00FC=SST , -0x00FD=LABELSST , -0x00FF=EXTSST , -0x0100=SXVDEX , -0x0103=SXFORMULA , -0x0122=SXDBEX , -0x0137=CHTRINSERT , -0x0138=CHTRINFO , -0x013B=CHTRCELLCONTENT , -0x013D=TABID , -0x0140=CHTRMOVERANGE , -0x014D=CHTRINSERTTAB , -0x015F=LABELRANGES , -0x0160=USESELFS , -0x0162=XL5MODIFY , -0x0196=CHTRHEADER , -0x01A9=USERBVIEW , -0x01AA=USERSVIEWBEGIN , -0x01AB=USERSVIEWEND , -0x01AD=QSI , -0x01AE=SUPBOOK , -0x01AF=PROT4REV , -0x0161=DSF , -0x01B0=CONDFMT , -0x01B1=CF , -0x01B2=DVAL , -0x01B5=DCONBIN , -0x01B6=TXO , -0x01B7=REFRESHALL , -0x01B8=HLINK , -0x01BA=CODENAME , -0x01BB=SXFDBTYPE , -0x01BC=PROT4REVPASS , -0x01BE=DV , -0x0200=DIMENSIONS , -0x0201=BLANK , -0x0203=NUMBER , -0x0204=LABEL , -0x0205=BOOLERR , -0x0206=FORMULA , -0x0207=STRING , -0x0208=ROW , -0x0209=BOF , -0x020B=INDEX , -0x0218=NAME , -0x0221=ARRAY , -0x0223=EXTERNNAME , -0x0225=DEFAULTROWHEIGHT , -0x0231=FONT , -0x0236=TABLE , -0x023E=WINDOW2 , -0x0243=XF , -0x027E=RK , -0x0293=STYLE , -0x0406=FORMULA , -0x0409=BOF , -0x041E=FORMAT , -0x0443=XF , -0x04BC=SHRFMLA , -0x0800=SCREENTIP , -0x0803=WEBQRYSETTINGS , -0x0804=WEBQRYTABLES , -0x0809=BOF , -0x0862=SHEETLAYOUT , -0x0867=SHEETPROTECTION , -0x1001=CHUNITS , -0x1002=CHCHART , -0x1003=CHSERIES , -0x1004=CHSOURCELINK , -0x1006=CHDATAFORMAT , -0x1007=CHLINEFORMAT , -0x1009=CHMARKERFORMAT , -0x100A=CHAREAFORMAT , -0x100B=CHPIEFORMAT , -0x100C=CHATTACHEDLABEL , -0x100D=CHSTRING , -0x1014=CHCHARTGROUP , -0x1015=CHLEGEND , -0x1016=CHSERIESLIST , -0x1017=CHBAR , -0x1018=CHLINE , -0x1019=CHPIE , -0x101A=CHAREA , -0x101B=CHSCATTER , -0x101C=CHCHARTLINE , -0x101D=CHAXIS , -0x101E=CHTICK , -0x101F=CHVALUERANGE , -0x1020=CHLABELRANGE , -0x1021=CHAXISLINE , -0x1022=CHFORMATLINK , -0x1024=CHDEFAULTTEXT , -0x1025=CHTEXT , -0x1026=CHFONT , -0x1027=CHOBJECTLINK , -0x102D=CHARROW , -0x102F=CHARROWHEAD , -0x1032=CHFRAME , -0x1033=CHBEGIN , -0x1034=CHEND , -0x1035=CHPLOTAREA , -0x1036=CHCHARTSIZE , -0x1037=CHRELPOSITION , -0x1038=CHARROWRELPOS , -0x103A=CHCHART3D , -0x103B=CHMULTILINK , -0x103C=CHPICFORMAT , -0x103D=CHDROPBAR , -0x103E=CHRADARLINE , -0x103F=CHSURFACE , -0x1040=CHRADARAREA , -0x1041=CHAXESSET , -0x1043=CHLEGENDENTRY , -0x1044=CHPROPERTIES , -0x1045=CHSERGROUP , -0x1046=CHUSEDAXESSETS , -0x1048=CHPIVOTREF , -0x104A=CHSERPARENT , -0x104B=CHSERTRENDLINE , -0x104E=CHFORMAT , -0x104F=CHPOS , -0x1050=CHFORMATRUNS , -0x1051=CHSOURCELINK , -0x105B=CHSERERRORBAR , -0x105D=CHSERIESFORMAT , -0x105F=CH3DDATAFORMAT , -0x1060=CHFONTBASE , -0x1061=CHPIEEXT , -0x1062=CHEXTRANGE , -0x1063=CHDATATABLE , -0x1064=CHPLOTGROWTH , -0x1065=CHSERINDEX , -0x1066=CHESCHERFORMAT , -0x1067=CHPIEEXTSETT , diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index 1a90817f99ae..7072785b8936 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -77,8 +77,11 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument using namespace ::com::sun::star; using namespace ::comphelper; - // false = use old sc filter for import (OOX only as file dumper), true = use new OOX filter for import - bool bUseOoxFilter = false; + /* Environment variable "OOO_OOXBIFFFILTER": + - "1" = use new OOX filter for import; + - undef/other = use old sc filter for import (OOX only as file dumper). */ + const sal_Char* pcFileName = ::getenv( "OOO_OOXBIFFFILTER" ); + bool bUseOoxFilter = pcFileName && (*pcFileName == '1') && (*(pcFileName + 1) == 0); if( SfxObjectShell* pDocShell = pDocument->GetDocumentShell() ) try { uno::Reference< lang::XComponent > xComponent( pDocShell->GetModel(), uno::UNO_QUERY_THROW ); @@ -87,7 +90,7 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument aArgs[ 0 ] <<= getProcessServiceFactory(); aArgs[ 1 ] <<= !bUseOoxFilter; uno::Reference< document::XImporter > xImporter( ScfApiHelper::CreateInstanceWithArgs( - CREATE_STRING( "com.sun.star.comp.oox.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW ); + CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW ); xImporter->setTargetDocument( xComponent ); MediaDescriptor aDescriptor; diff --git a/sc/source/filter/excel/makefile.mk b/sc/source/filter/excel/makefile.mk index 785ad197a168..4fffb1ef3ed1 100644 --- a/sc/source/filter/excel/makefile.mk +++ b/sc/source/filter/excel/makefile.mk @@ -51,7 +51,6 @@ VISIBILITY_HIDDEN=TRUE # --- Files -------------------------------------------------------- SLOFILES = \ - $(SLO)$/biffdump.obj \ $(SLO)$/colrowst.obj \ $(SLO)$/excdoc.obj \ $(SLO)$/excel.obj \ diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx index f56a00763d4e..a06cf041e7cf 100644 --- a/sc/source/filter/excel/read.cxx +++ b/sc/source/filter/excel/read.cxx @@ -54,20 +54,11 @@ #include "XclImpChangeTrack.hxx" #include "root.hxx" -#include "biffdump.hxx" #include "imp_op.hxx" #include "excimp8.hxx" FltError ImportExcel::Read( void ) { -#if EXC_INCL_DUMPER - { - Biff8RecDumper aDumper( GetRoot(), FALSE ); - if( aDumper.Dump( aIn ) ) - return ERRCODE_ABORT; - } -#endif - XclImpPageSettings& rPageSett = GetPageSettings(); XclImpTabViewSettings& rTabViewSett = GetTabViewSettings(); XclImpPalette& rPal = GetPalette(); diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 211aed3fd079..36e528f86c43 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -53,6 +53,7 @@ #include <com/sun/star/chart2/TickmarkStyle.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> +#include <com/sun/star/chart/MissingValueTreatment.hpp> #include <vcl/outdev.hxx> #include <svx/escherex.hxx> @@ -2741,7 +2742,7 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot, // global chart properties ::set_flag( maProps.mnFlags, EXC_CHPROPS_MANSERIES ); - ::set_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISCELLS, false ); + ::set_flag( maProps.mnFlags, EXC_CHPROPS_SHOWVISIBLEONLY, false ); maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP; // always create both axes set objects @@ -2767,6 +2768,20 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot, if( !mxPrimAxesSet->Is3dChart() ) mxSecnAxesSet->Convert( xDiagram, nFreeGroupIdx ); + // treatment of missing values + ScfPropertySet aDiaProp( xDiagram ); + sal_Int32 nMissingValues = 0; + if( aDiaProp.GetProperty( nMissingValues, EXC_CHPROP_MISSINGVALUETREATMENT ) ) + { + using namespace ::com::sun::star::chart::MissingValueTreatment; + switch( nMissingValues ) + { + case LEAVE_GAP: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP; break; + case USE_ZERO: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_ZERO; break; + case CONTINUE: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_INTERPOLATE; break; + } + } + // finish API conversion FinishConversion(); } diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index e0df86d37d9a..457cdd2a17e4 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -1500,7 +1500,11 @@ void XclExpPivotTable::WriteSxli( XclExpStream& rStrm, sal_uInt16 nLineCount, sa { sal_uInt16 nLineSize = 8 + 2 * nIndexCount; rStrm.StartRecord( EXC_ID_SXLI, nLineSize * nLineCount ); - rStrm.SetSliceSize( nLineSize ); + + /* #158444# Excel expects the records to be filled completely, do not + set a segment size... */ +// rStrm.SetSliceSize( nLineSize ); + for( sal_uInt16 nLine = 0; nLine < nLineCount; ++nLine ) { // #106598# Excel XP needs a partly initialized SXLI record diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 8c37b04d904f..ba3633ffbb1b 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -58,6 +58,7 @@ #include <com/sun/star/chart2/TickmarkStyle.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> +#include <com/sun/star/chart/MissingValueTreatment.hpp> #include <sfx2/objsh.hxx> @@ -2136,7 +2137,9 @@ void XclImpChChart3d::Convert( ScfPropertySet& rPropSet, bool b3dWallChart ) con nPerspective = limit_cast< sal_Int32, sal_Int32 >( maData.mnEyeDist, 0, 100 ); // right-angled axes bRightAngled = !::get_flag( maData.mnFlags, EXC_CHCHART3D_REAL3D ); - eProjMode = bRightAngled ? cssd::ProjectionMode_PARALLEL : cssd::ProjectionMode_PERSPECTIVE; + // projection mode (parallel axes, if right-angled, #i90360# or if perspective is at 0%) + bool bParallel = bRightAngled || (nPerspective == 0); + eProjMode = bParallel ? cssd::ProjectionMode_PARALLEL : cssd::ProjectionMode_PERSPECTIVE; // ambient color (Gray 20%) aAmbientColor.SetColor( RGB_COLORDATA( 204, 204, 204 ) ); // light color (Gray 60%) @@ -2598,7 +2601,8 @@ void XclImpChLabelRange::Convert( ScfPropertySet& rPropSet, ScaleData& rScaleDat // origin (max-cross not supported, fall back to auto-cross) bool bMaxCross = ::get_flag( maData.mnFlags, EXC_CHLABELRANGE_MAXCROSS ); - lclSetValueOrClearAny( rScaleData.Origin, static_cast< double >( maData.mnCross ), bMaxCross ); + sal_uInt16 nCross = ::std::max< sal_uInt16 >( maData.mnCross, 1 ); + lclSetValueOrClearAny( rScaleData.Origin, static_cast< double >( nCross ), bMaxCross ); // reverse order bool bReverse = ::get_flag( maData.mnFlags, EXC_CHLABELRANGE_REVERSE ) != bMirrorOrient; @@ -3307,7 +3311,7 @@ void XclImpChChart::ReadSubRecord( XclImpStream& rStrm ) ReadChSeries( rStrm ); break; case EXC_ID_CHPROPERTIES: - rStrm >> maProps.mnFlags >> maProps.mnEmptyMode; + ReadChProperties( rStrm ); break; case EXC_ID_CHDEFAULTTEXT: ReadChDefaultText( rStrm ); @@ -3400,7 +3404,7 @@ void XclImpChChart::Convert( Reference< XChartDocument > xChartDoc, ScfProgressB /* Create the diagram object and attach it to the chart document. Currently, one diagram is used to carry all coordinate systems and data series. */ - Reference< XDiagram > xDiagram( ScfApiHelper::CreateInstance( SERVICE_CHART2_DIAGRAM ), UNO_QUERY ); + Reference< XDiagram > xDiagram = CreateDiagram(); xChartDoc->setFirstDiagram( xDiagram ); // coordinate systems and chart types, convert axis settings @@ -3453,6 +3457,11 @@ void XclImpChChart::ReadChText( XclImpStream& rStrm ) } } +void XclImpChChart::ReadChProperties( XclImpStream& rStrm ) +{ + rStrm >> maProps.mnFlags >> maProps.mnEmptyMode; +} + void XclImpChChart::Finalize() { // finalize series (must be done first) @@ -3539,6 +3548,28 @@ void XclImpChChart::FinalizeTitle() lclFinalizeTitle( mxTitle, GetDefaultText( EXC_CHTEXTTYPE_TITLE ) ); } +Reference< XDiagram > XclImpChChart::CreateDiagram() const +{ + // create a diagram object + Reference< XDiagram > xDiagram( ScfApiHelper::CreateInstance( SERVICE_CHART2_DIAGRAM ), UNO_QUERY ); + + // convert global chart settings + ScfPropertySet aDiaProp( xDiagram ); + + // treatment of missing values + using namespace ::com::sun::star::chart::MissingValueTreatment; + sal_Int32 nMissingValues = LEAVE_GAP; + switch( maProps.mnEmptyMode ) + { + case EXC_CHPROPS_EMPTY_SKIP: nMissingValues = LEAVE_GAP; break; + case EXC_CHPROPS_EMPTY_ZERO: nMissingValues = USE_ZERO; break; + case EXC_CHPROPS_EMPTY_INTERPOLATE: nMissingValues = CONTINUE; break; + } + aDiaProp.SetProperty( EXC_CHPROP_MISSINGVALUETREATMENT, nMissingValues ); + + return xDiagram; +} + // ---------------------------------------------------------------------------- XclImpChart::XclImpChart( const XclImpRoot& rRoot, bool bOwnTab ) : diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx index fe496af6de3e..2dd2570353be 100644 --- a/sc/source/filter/inc/XclExpChangeTrack.hxx +++ b/sc/source/filter/inc/XclExpChangeTrack.hxx @@ -620,14 +620,13 @@ private: XclExpChTrTabIdBuffer* pTabIdBuffer; ScDocument* pTempDoc; // empty document - ScChangeTrack* pTempChangeTrack; // copy of <pOrigChangeTrack> sal_uInt32 nNewAction; // action number, 1-based XclExpChTrHeader* pHeader; // header record for last GUID sal_uInt8 aGUID[ 16 ]; // GUID for action info records sal_Bool bValidGUID; - sal_Bool CreateTempChangeTrack(); + ScChangeTrack* CreateTempChangeTrack(); void PushActionRecord( const ScChangeAction& rAction ); sal_Bool WriteUserNamesStream(); diff --git a/sc/source/filter/inc/biffdump.hxx b/sc/source/filter/inc/biffdump.hxx deleted file mode 100644 index 777e22fa9463..000000000000 --- a/sc/source/filter/inc/biffdump.hxx +++ /dev/null @@ -1,564 +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: biffdump.hxx,v $ - * $Revision: 1.22 $ - * - * 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 SC_BIFFDUMP_HXX -#define SC_BIFFDUMP_HXX - -#if OSL_DEBUG_LEVEL > 1 - -// ============================================================================ - -// 1 = Compile with BIFF dumper. -#define EXC_INCL_DUMPER 0 - -// ============================================================================ - -#if EXC_INCL_DUMPER - -#include <vector> -#include <map> -#include <tools/string.hxx> -#include <tools/list.hxx> -#include "excform.hxx" -#include "xiroot.hxx" - - -#define MODE_DUMP 0x0000 -#define MODE_SKIP 0x0001 - -#define MODE_HEX 0x0002 -#define MODE_BODY 0x0000 -#define MODE_NAMEONLY 0x0008 - -#define MODE_PLAIN 0x0000 -#define MODE_DETAIL 0x0004 - - -#define CT_EOL 0x01 -#define CT_NUM 0x02 -#define CT_ALPHA 0x04 -#define CT_ALPHANUM 0x08 -#define CT_HEX 0x10 -#define CT_LOWERALPHA 0x20 -#define CT_UPPERALPHA 0x40 -#define CT_BLANK 0x80 - - -#define DELANDNULL(p) {delete p;p=NULL;} - -inline void CopyStrpOnStrp( ByteString*& rpToString, const ByteString* pFromString ); - - -struct DUMP_ERR -{ - DUMP_ERR* pNext; - UINT32 nLine; - ByteString aText; - ByteString* pHint; - - inline DUMP_ERR( const UINT32 nLine, const ByteString& rText, const ByteString& rHint ); - inline DUMP_ERR( const UINT32 nLine, const ByteString& rText ); - ~DUMP_ERR(); -}; - - - - -enum _KEYWORD { KW_Unknown, Skipdump, Contload, Parsep, Maxbodylines, - Include, Exclude, Hex, Body, Comment, Output, Title, - NameOnly, ClearFile, SkipOffset, ReadContRecs, NoWarnings, - BlankLine, ExportBookStream }; - - - - -struct IdRange -{ - UINT16 nFirst; - UINT16 nLast; - IdRange( const UINT16 nF, const UINT16 nL ) : nFirst( nF ), nLast( nL ) {} -}; - - - - -class IdRangeList : protected List -{ -private: -protected: -public: - virtual ~IdRangeList(); - - using List::Count; - - inline const IdRange* First( void ); - inline const IdRange* Next( void ); - inline const IdRange* Get( const UINT32 n ) const; - - inline void Append( const UINT16 nFirst, const UINT16 nNext ); - - void Clear( void ); - }; - - - - -class Biff8RecDumper : public XclImpRoot -{ -protected: - typedef ::std::vector< ByteString > ByteStringVec; - typedef ::std::map< sal_uInt32, sal_uInt32 > StrmPortionMap; - typedef ::std::pair< sal_uInt32, sal_uInt16 > XclDumpCtrlPortion; - typedef ::std::vector< XclDumpCtrlPortion > XclDumpCtrlPortionVec; - - - static const sal_Char* pLevelPreString; - static const sal_Char* pLevelPreStringNT; - const sal_Char* pLevelPre; - UINT16 nLevelCnt; - - ByteString* pTitle; - ByteString* pOutName; - - SvFileStream* pDumpStream; - XclImpStream* pIn; - - StrmPortionMap maCtlsPosMap; /// Control data in 'Ctls' stream. - XclDumpCtrlPortionVec maCtrlStorages; - XclDumpCtrlPortionVec maCtrlPortions; - ByteStringVec maNames; /// Defined names. - - UINT32 nMaxBodyLines; - BOOL bEndLoading; - BOOL bSkip; - BOOL bSkipOffset; - BOOL bReadContRecs; - BOOL bWarnings; - BOOL bClearFile; - BOOL bBlankLine; - BOOL bExportBookStream; - BOOL bBIFF8; - bool bEncrypted; - - UINT32 nFieldCnt; - UINT32 nItemCnt; - UINT32 nTabIndexCnt; - sal_uInt32 mnEscherPos; - UINT16 nFontIndex; - sal_uInt16 mnSubstream; - - static const UINT16 nRecCnt; - UINT16* pDumpModes; - ByteString** ppRecNames; - - static UINT32 nInstances; - - static sal_Char* pBlankLine; - static const UINT16 nLenBlankLine; - - static UINT8* pCharType; - static UINT8* pCharVal; - - DUMP_ERR* pFirst; - DUMP_ERR* pLast; - DUMP_ERR* pAct; - - sal_Char cParSep; - sal_Char cComm1; - sal_Char cComm2; - - void Print( const ByteString& rStr ); - void Print( const sal_Char* pStr ); - - UINT16 DumpXF( XclImpStream& rIn, const sal_Char* pPre ); - void DumpValidPassword( XclImpStream& rIn, const sal_Char* pPre ); - void RecDump( BOOL bSubStream = FALSE ); - void EscherDump( const ULONG nL, bool bDumpOffset ); - void ObjDump( const ULONG nL ); - void ContDump( const ULONG nL ); - void FormulaDump( const UINT16 nL, const FORMULA_TYPE eFT ); - - void DumpBinary( SvStream& rInStrm, ULONG nSize = STREAM_SEEK_TO_END ); - - void DumpControlContents( SvStream& rInStrm, sal_uInt16 nCtrlType ); - void DumpControlContainer( SvStream& rInStrm, sal_uInt16 nCtrlType ); - - void DumpBinaryStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath ); - void DumpTextStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath ); - void DumpRecordStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath ); - void DumpCtlsStream(); - void DumpControlFrameStream( SotStorageRef xInStrg, sal_uInt16 nCtrlType, const String& rStrgPath ); - void DumpControlObjectsStream( SotStorageRef xInStrg, const String& rStrgPath ); - - void DumpAnyStorage( SotStorageRef xParentStrg, const String& rStrgName, const String& rStrgPath ); - void DumpUserFormStorage( SotStorageRef xParentStrg, const String& rStrgName, sal_uInt16 nCtrlType, const String& rStrgPath ); - void DumpVbaProjectStorage(); - - void PreDumpDecrypted( ULONG nL ); - static const sal_Char* GetBlanks( const UINT16 nNumOfBlanks ); - static BOOL IsLineEnd( const sal_Char c, sal_Char& rNext, SvStream& rIn, INT32& rLeft ); - void Init( void ); - static _KEYWORD GetKeyType( const ByteString& rString ); - BOOL ExecCommand( const UINT32 nLine, const ByteString& rCommand, - const ByteString* pVal = NULL ); - BOOL ExecSetVal( const UINT32 nLine, const ByteString& rId, - const ByteString* pName, const ByteString* pInExClude, - const ByteString* pHexBody ); - - inline void SetMode( const UINT16 nRecNum, const UINT16 nMode ); - inline UINT16 GetMode( const UINT16 nRecNum ) const; - inline UINT16* GetModeRef( const UINT16 nRecNum ) const; - inline BOOL HasMode( const UINT16 nRecNum, const UINT16 nRefMode ) const; - inline BOOL HasModeDump( const UINT16 nRecNum ) const; - inline BOOL HasModeSkip( const UINT16 nRecNum ) const; - inline BOOL HasModeHex( const UINT16 nRecNum ) const; - inline BOOL HasModeBody( const UINT16 nRecNum ) const; - inline BOOL HasModePlain( const UINT16 nRecNum ) const; - inline BOOL HasModeDetail( const UINT16 nRecNum ) const; - inline BOOL HasModeNameOnly( const UINT16 nRecNum ) const; - void SetFlag( const UINT16 nFirst, const UINT16 nLast, const UINT16 nFlags ); - void ClrFlag( const UINT16 nFirst, const UINT16 nLast, const UINT16 nFlags ); - - inline void SetName( const UINT16 nRecNum, const sal_Char* pName ); - inline void SetName( const UINT16 nRecNum, const ByteString& rName ); - void SetName( const UINT16 nRecNum, ByteString* pName ); - inline const ByteString* GetName( const UINT16 nRecNum ); - - inline static BOOL IsNum( const sal_Char c ); - inline static BOOL IsAlpha( const sal_Char c ); - inline static BOOL IsAlphaNum( const sal_Char c ); - inline static BOOL IsHex( const sal_Char c ); - inline static BOOL IsEndOfLine( const sal_Char c ); - inline static BOOL IsBlank( const sal_Char c ); - static UINT32 GetVal( const ByteString& rString ); - BOOL FillIdRangeList( const UINT32 nLine, IdRangeList& rRangeList, - const ByteString& rVals ); - inline static UINT8 GetVal( const sal_Char c ); - BOOL CreateOutStream(); - static SvFileStream* CreateInStream( const sal_Char* pName ); - static SvFileStream* CreateInStream( const sal_Char* pPath, const sal_Char* pName ); - - void AddError( const UINT32 nLine, const ByteString& rText, const ByteString& rHint ); - inline void AddError( const UINT32 nLine, const sal_Char* pText, const ByteString& rHint ); - inline void AddError( const UINT32 nLine, const ByteString& rText ); - inline void AddError( const UINT32 nLine, const sal_Char* pText ); - inline const DUMP_ERR* FirstErr( void ); - inline const DUMP_ERR* NextErr( void ); -public: - Biff8RecDumper( const XclImpRoot& rRoot, BOOL bBIFF8 ); - ~Biff8RecDumper(); - BOOL Dump( XclImpStream& rIn ); - // = TRUE -> nicht weiter laden - - inline static BOOL IsPrintable( const UINT8 nC ); - }; - - - - -inline void CopyStrpOnStrp( ByteString*& rp, const ByteString* p ) -{ - if( p ) - { - if( rp ) - *rp = *p; - else - rp = new ByteString( *p ); - } - else if( rp ) - { - delete rp; - rp = NULL; - } -} - - - - -inline DUMP_ERR::DUMP_ERR( const UINT32 n, const ByteString& rT, const ByteString& rH ) : - nLine( n ), aText( rT ), pNext( NULL ) -{ - pHint = new ByteString( rH ); -} - - -inline DUMP_ERR::DUMP_ERR( const UINT32 n, const ByteString& rT ) : - nLine( n ), aText( rT ), pHint( NULL ), pNext( NULL ) -{ -} - - - - -inline const IdRange* IdRangeList::First( void ) -{ - return ( const IdRange* ) List::First(); -} - - -inline const IdRange* IdRangeList::Next( void ) -{ - return ( const IdRange* ) List::Next(); -} - - -inline const IdRange* IdRangeList::Get( const UINT32 n ) const -{ - return ( const IdRange* ) List::GetObject( n ); -} - - -inline void IdRangeList::Append( const UINT16 n1, const UINT16 n2 ) -{ - List::Insert( new IdRange( n1, n2 ), LIST_APPEND ); -} - - - - -inline void Biff8RecDumper::SetMode( const UINT16 n, const UINT16 nM ) -{ - if( n < nRecCnt ) - pDumpModes[ n ] = nM; -} - - -inline UINT16 Biff8RecDumper::GetMode( const UINT16 n ) const -{ - if( n < nRecCnt ) - return pDumpModes[ n ]; - else - return 0xFFFF; -} - - -inline UINT16* Biff8RecDumper::GetModeRef( const UINT16 n ) const -{ - if( n < nRecCnt ) - return pDumpModes + n; - else - return NULL; -} - - -inline BOOL Biff8RecDumper::HasMode( const UINT16 n, const UINT16 nM ) const -{ - if( n < nRecCnt ) - return ( pDumpModes[ n ] & nM ) == nM; - else - return FALSE; -} - - -inline BOOL Biff8RecDumper::HasModeDump( const UINT16 n ) const -{ - if( n < nRecCnt ) - return ( pDumpModes[ n ] & MODE_SKIP ) == 0; - else - return FALSE; -} - - -inline BOOL Biff8RecDumper::HasModeSkip( const UINT16 n ) const -{ - if( n < nRecCnt ) - return ( pDumpModes[ n ] & MODE_SKIP ) != 0; - else - return FALSE; -} - - -inline BOOL Biff8RecDumper::HasModeHex( const UINT16 n ) const -{ - if( n < nRecCnt ) - return ( pDumpModes[ n ] & MODE_HEX ) != 0; - else - return FALSE; -} - - -inline BOOL Biff8RecDumper::HasModeBody( const UINT16 n ) const -{ - if( n < nRecCnt ) - return ( pDumpModes[ n ] & MODE_HEX ) == 0; - else - return FALSE; -} - - -inline BOOL Biff8RecDumper::HasModePlain( const UINT16 n ) const -{ - if( n < nRecCnt ) - return ( pDumpModes[ n ] & MODE_DETAIL ) == 0; - else - return FALSE; -} - - -inline BOOL Biff8RecDumper::HasModeDetail( const UINT16 n ) const -{ - if( n < nRecCnt ) - return ( pDumpModes[ n ] & MODE_DETAIL ) != 0; - else - return FALSE; -} - - -inline BOOL Biff8RecDumper::HasModeNameOnly( const UINT16 n ) const -{ - if( n < nRecCnt ) - return ( pDumpModes[ n ] & MODE_NAMEONLY ) != 0; - else - return FALSE; -} - - -inline void Biff8RecDumper::SetName( const UINT16 n, const sal_Char* p ) -{ - if( n < nRecCnt ) - { - if( ppRecNames[ n ] ) - *ppRecNames[ n ] = p; - else - ppRecNames[ n ] = new ByteString( p ); - } -} - - -inline void Biff8RecDumper::SetName( const UINT16 n, const ByteString& r ) -{ - if( n < nRecCnt ) - { - if( ppRecNames[ n ] ) - *ppRecNames[ n ] = r; - else - ppRecNames[ n ] = new ByteString( r ); - } -} - - -inline const ByteString* Biff8RecDumper::GetName( const UINT16 n ) -{ - if( n < nRecCnt ) - return ppRecNames[ n ]; - else - return NULL; -} - - -inline BOOL Biff8RecDumper::IsNum( const sal_Char c ) -{ - return ( pCharType[ ( UINT8 ) c ] & CT_NUM ) != 0; -} - - -inline BOOL Biff8RecDumper::IsAlpha( const sal_Char c ) -{ - return ( pCharType[ ( UINT8 ) c ] & CT_ALPHA ) != 0; -} - - -inline BOOL Biff8RecDumper::IsAlphaNum( const sal_Char c ) -{ - return ( pCharType[ ( UINT8 ) c ] & CT_ALPHANUM ) != 0; -} - - -inline BOOL Biff8RecDumper::IsHex( const sal_Char c ) -{ - return ( pCharType[ ( UINT8 ) c ] & CT_HEX ) != 0; -} - - -inline BOOL Biff8RecDumper::IsEndOfLine( const sal_Char c ) -{ - return ( pCharType[ ( UINT8 ) c ] & CT_EOL ) != 0; -} - - -inline BOOL Biff8RecDumper::IsBlank( const sal_Char c ) -{ - return ( pCharType[ ( UINT8 ) c ] & CT_BLANK ) != 0; -} - - -inline UINT8 Biff8RecDumper::GetVal( const sal_Char c ) -{ - return pCharVal[ ( UINT8 ) c ]; -} - - -inline void Biff8RecDumper::AddError( const UINT32 n, const sal_Char* p, const ByteString& r ) -{ - AddError( n, ByteString( p ), r ); -} - - -inline void Biff8RecDumper::AddError( const UINT32 nLine, const ByteString& rText ) -{ - AddError( nLine, rText, ByteString::EmptyString() ); -} - - -inline void Biff8RecDumper::AddError( const UINT32 nLine, const sal_Char* pText ) -{ - AddError( nLine, ByteString( pText ), ByteString::EmptyString() ); -} - - -inline const DUMP_ERR* Biff8RecDumper::FirstErr( void ) -{ - pAct = pFirst; - return pAct; -} - - -inline const DUMP_ERR* Biff8RecDumper::NextErr( void ) -{ - if( pAct ) - pAct = pAct->pNext; - - return pAct; -} - - -inline BOOL Biff8RecDumper::IsPrintable( const UINT8 n ) -{ - return n >= ' '; -} - - -#endif -#else -// never use the dumper in product builds -#define EXC_INCL_DUMPER 0 -#endif -#endif - diff --git a/sc/source/filter/inc/xichart.hxx b/sc/source/filter/inc/xichart.hxx index 0ec9ca48d8f8..b87eaf58b9fa 100644 --- a/sc/source/filter/inc/xichart.hxx +++ b/sc/source/filter/inc/xichart.hxx @@ -1316,7 +1316,8 @@ typedef ScfRef< XclImpChAxesSet > XclImpChAxesSetRef; class XclImpChChart : public XclImpChGroupBase, protected XclImpChRoot { public: - typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > XChartDocRef; + typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > XChartDocRef; + typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef; public: explicit XclImpChChart( const XclImpRoot& rRoot ); @@ -1351,6 +1352,8 @@ private: void ReadChAxesSet( XclImpStream& rStrm ); /** Reads a CHTEXT group (chart title and series/point captions). */ void ReadChText( XclImpStream& rStrm ); + /** Reads a CHPROPERTIES record (global chart properties). */ + void ReadChProperties( XclImpStream& rStrm ); /** Final processing after reading the entire chart data. */ void Finalize(); @@ -1361,6 +1364,9 @@ private: /** Finalizes chart title, tries to detect title auto-generated from series name. */ void FinalizeTitle(); + /** Creates and returns a new diagram object and converts global chart settings. */ + XDiagramRef CreateDiagram() const; + private: typedef ::std::vector< XclImpChSeriesRef > XclImpChSeriesVec; typedef ScfRefMap< XclChDataPointPos, XclImpChDataFormat > XclImpChDataFormatMap; diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx index b6ac422b1c89..ffc7d8264640 100644 --- a/sc/source/filter/inc/xlchart.hxx +++ b/sc/source/filter/inc/xlchart.hxx @@ -102,6 +102,7 @@ namespace com { namespace sun { namespace star { #define EXC_CHPROP_LABELPLACEMENT CREATE_OUSTRING( "LabelPlacement" ) #define EXC_CHPROP_MAJORTICKS CREATE_OUSTRING( "MajorTickmarks" ) #define EXC_CHPROP_MINORTICKS CREATE_OUSTRING( "MinorTickmarks" ) +#define EXC_CHPROP_MISSINGVALUETREATMENT CREATE_OUSTRING( "MissingValueTreatment" ) #define EXC_CHPROP_NEGATIVEERROR CREATE_OUSTRING( "NegativeError" ) #define EXC_CHPROP_NUMBERFORMAT CREATE_OUSTRING( "NumberFormat" ) #define EXC_CHPROP_OFFSET CREATE_OUSTRING( "Offset" ) @@ -545,7 +546,7 @@ const sal_uInt16 EXC_CHAXESSET_NONE = 0xFFFF; /// For internal use const sal_uInt16 EXC_ID_CHPROPERTIES = 0x1044; const sal_uInt16 EXC_CHPROPS_MANSERIES = 0x0001; /// Manual series allocation. -const sal_uInt16 EXC_CHPROPS_SHOWVISCELLS = 0x0002; /// Show visible cells only. +const sal_uInt16 EXC_CHPROPS_SHOWVISIBLEONLY = 0x0002; /// Show visible cells only. const sal_uInt16 EXC_CHPROPS_NORESIZE = 0x0004; /// Do not resize chart with window. const sal_uInt16 EXC_CHPROPS_MANPLOTAREA = 0x0008; /// Plot area with CHFRAMEPOS records. diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index 48f5a790f5bb..760599ff594b 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -1072,7 +1072,6 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) : aTabIdBufferList(), pTabIdBuffer( NULL ), pTempDoc( NULL ), - pTempChangeTrack( NULL ), nNewAction( 1 ), pHeader( NULL ), bValidGUID( sal_False ) @@ -1081,7 +1080,8 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) : if( !GetOldRoot().pTabId ) return; - if( !CreateTempChangeTrack() ) + ScChangeTrack* pTempChangeTrack = CreateTempChangeTrack(); + if (!pTempChangeTrack) return; pTabIdBuffer = new XclExpChTrTabIdBuffer( GetTabInfo().GetXclTabCount() ); @@ -1143,25 +1143,23 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) : XclExpChangeTrack::~XclExpChangeTrack() { - if( pTempChangeTrack ) - delete pTempChangeTrack; if( pTempDoc ) delete pTempDoc; } -sal_Bool XclExpChangeTrack::CreateTempChangeTrack() +ScChangeTrack* XclExpChangeTrack::CreateTempChangeTrack() { // get original change track ScChangeTrack* pOrigChangeTrack = GetDoc().GetChangeTrack(); DBG_ASSERT( pOrigChangeTrack, "XclExpChangeTrack::CreateTempChangeTrack - no change track data" ); if( !pOrigChangeTrack ) - return sal_False; + return NULL; // create empty document pTempDoc = new ScDocument; DBG_ASSERT( pTempDoc, "XclExpChangeTrack::CreateTempChangeTrack - no temp document" ); if( !pTempDoc ) - return sal_False; + return NULL; // adjust table count SCTAB nOrigCount = GetDoc().GetTableCount(); @@ -1176,26 +1174,13 @@ sal_Bool XclExpChangeTrack::CreateTempChangeTrack() if( nOrigCount != pTempDoc->GetTableCount() ) return sal_False; - // create empty change track - pTempChangeTrack = new ScChangeTrack( pTempDoc ); - DBG_ASSERT( pTempChangeTrack, "XclExpChangeTrack::CreateTempChangeTrack - no temp change track" ); - if( !pTempChangeTrack ) - return sal_False; - - // copy original change track - SvMemoryStream aMemStrm; - if( !pOrigChangeTrack->Store( aMemStrm ) ) - return sal_False; - aMemStrm.Seek( STREAM_SEEK_TO_BEGIN ); - if( !pTempChangeTrack->Load( aMemStrm, (USHORT) pTempDoc->GetSrcVersion() ) ) - return sal_False; - - return sal_True; + return pOrigChangeTrack->Clone(pTempDoc); } void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction ) { XclExpChTrAction* pXclAction = NULL; + ScChangeTrack* pTempChangeTrack = pTempDoc->GetChangeTrack(); switch( rAction.GetType() ) { case SC_CAT_CONTENT: @@ -1205,7 +1190,8 @@ void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction ) case SC_CAT_INSERT_COLS: case SC_CAT_DELETE_ROWS: case SC_CAT_DELETE_COLS: - pXclAction = new XclExpChTrInsert( rAction, GetRoot(), *pTabIdBuffer, *pTempChangeTrack ); + if (pTempChangeTrack) + pXclAction = new XclExpChTrInsert( rAction, GetRoot(), *pTabIdBuffer, *pTempChangeTrack ); break; case SC_CAT_INSERT_TABS: { @@ -1217,7 +1203,8 @@ void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction ) } break; case SC_CAT_MOVE: - pXclAction = new XclExpChTrMoveRange( (const ScChangeActionMove&) rAction, GetRoot(), *pTabIdBuffer, *pTempChangeTrack ); + if (pTempChangeTrack) + pXclAction = new XclExpChTrMoveRange( (const ScChangeActionMove&) rAction, GetRoot(), *pTabIdBuffer, *pTempChangeTrack ); break; default:; } diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx index 3ea002b71372..32cf92e08d1a 100644 --- a/sc/source/filter/xml/XMLExportDataPilot.cxx +++ b/sc/source/filter/xml/XMLExportDataPilot.cxx @@ -693,7 +693,8 @@ void ScXMLExportDataPilot::WriteDimension(ScDPSaveDimension* pDim, const ScDPDim SvXMLElementExport aElemDPF(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_FIELD, sal_True, sal_True); WriteFieldReference(pDim); WriteLevels(pDim); - WriteGroupDimElements(pDim, pDimData); + if( pDim->GetOrientation() != sheet::DataPilotFieldOrientation_DATA ) + WriteGroupDimElements(pDim, pDimData); } void ScXMLExportDataPilot::WriteDimensions(ScDPSaveData* pDPSave) diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 2f05b7c5d960..3e069b6c9e59 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -437,7 +437,7 @@ ScInputHandler::ScInputHandler() bProtected( FALSE ), bCellHasPercentFormat( FALSE ), nValidation( 0 ), - nAttrAdjust( SVX_HOR_JUSTIFY_STANDARD ), + eAttrAdjust( SVX_HOR_JUSTIFY_STANDARD ), aScaleX( 1,1 ), aScaleY( 1,1 ), pRefViewSh( NULL ), @@ -1706,7 +1706,7 @@ void ScInputHandler::ForgetLastPattern() void ScInputHandler::UpdateAdjust( sal_Unicode cTyped ) { SvxAdjust eSvxAdjust; - switch (nAttrAdjust) + switch (eAttrAdjust) { case SVX_HOR_JUSTIFY_STANDARD: { @@ -1895,13 +1895,13 @@ BOOL ScInputHandler::StartTable( sal_Unicode cTyped, BOOL bFromCommand ) // Ausrichtung - nAttrAdjust = ((const SvxHorJustifyItem&)pPattern-> + eAttrAdjust = (SvxCellHorJustify)((const SvxHorJustifyItem&)pPattern-> GetItem(ATTR_HOR_JUSTIFY)).GetValue(); - if ( nAttrAdjust == SVX_HOR_JUSTIFY_REPEAT && + if ( eAttrAdjust == SVX_HOR_JUSTIFY_REPEAT && static_cast<const SfxBoolItem&>(pPattern->GetItem(ATTR_LINEBREAK)).GetValue() ) { // #i31843# "repeat" with "line breaks" is treated as default alignment - nAttrAdjust = SVX_HOR_JUSTIFY_STANDARD; + eAttrAdjust = SVX_HOR_JUSTIFY_STANDARD; } } @@ -3464,6 +3464,12 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, bInOwnChange = FALSE; } +void ScInputHandler::UpdateCellAdjust( SvxCellHorJustify eJust ) +{ + eAttrAdjust = eJust; + UpdateAdjust( 0 ); +} + void ScInputHandler::ResetDelayTimer() { if(pDelayTimer!=NULL) diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx index 0bcb2fd20eb9..8e09b7350bb1 100644 --- a/sc/source/ui/inc/cellsh.hxx +++ b/sc/source/ui/inc/cellsh.hxx @@ -69,9 +69,6 @@ private: DECL_LINK( ClipboardChanged, TransferableDataHelper* ); DECL_LINK( DialogClosed, AbstractScLinkedAreaDlg* ); - bool IsFullScreen() const; - void SetFullScreen( bool bSet ); - public: TYPEINFO(); diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx index 4c1c8bd06eb8..2ed7b6d7c807 100644 --- a/sc/source/ui/inc/inputhdl.hxx +++ b/sc/source/ui/inc/inputhdl.hxx @@ -35,6 +35,7 @@ #include "address.hxx" #include <tools/fract.hxx> #include <tools/gen.hxx> +#include <svx/svxenum.hxx> class ScDocument; class ScTabView; @@ -101,7 +102,7 @@ private: BOOL bProtected; BOOL bCellHasPercentFormat; ULONG nValidation; - USHORT nAttrAdjust; // enum SvxCellHorJustify + SvxCellHorJustify eAttrAdjust; Fraction aScaleX; // fuer Ref-MapMode Fraction aScaleY; @@ -189,6 +190,7 @@ public: void NotifyChange( const ScInputHdlState* pState, BOOL bForce = FALSE, ScTabViewShell* pSourceSh = NULL, BOOL bStopEditing = TRUE); + void UpdateCellAdjust( SvxCellHorJustify eJust ); void ResetDelayTimer(); //BugId 54702 diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index bc70ea9a7428..13cd49df6879 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -33,6 +33,7 @@ #include <sfx2/viewsh.hxx> #include <sfx2/viewfac.hxx> +#include <svx/svxenum.hxx> #include "scdllapi.h" #include "dbfunc.hxx" // -> tabview #include "target.hxx" @@ -257,6 +258,7 @@ public: ScInputHandler* GetInputHandler() const; void UpdateInputHandler( BOOL bForce = FALSE, BOOL bStopEditing = TRUE ); + void UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust ); BOOL TabKeyInput(const KeyEvent& rKEvt); BOOL SfxKeyInput(const KeyEvent& rKEvt); diff --git a/sc/source/ui/inc/viewutil.hxx b/sc/source/ui/inc/viewutil.hxx index 77d82c258aca..880024bd7304 100644 --- a/sc/source/ui/inc/viewutil.hxx +++ b/sc/source/ui/inc/viewutil.hxx @@ -38,6 +38,7 @@ class String; class SfxItemSet; class SfxBindings; class SvxFontItem; +class SfxViewShell; class ScChangeAction; class ScChangeViewSettings; @@ -75,6 +76,11 @@ public: static void UnmarkFiltered( ScMarkData& rMark, ScDocument* pDoc ); static void HideDisabledSlot( SfxItemSet& rSet, SfxBindings& rBindings, USHORT nSlotId ); + + /** Returns true, if the passed view shell is in full screen mode. */ + static bool IsFullScreen( SfxViewShell& rViewShell ); + /** Enters or leaves full screen mode at the passed view shell. */ + static void SetFullScreen( SfxViewShell& rViewShell, bool bSet ); }; // --------------------------------------------------------------------------- diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 04b250d4523b..fb3f0637dd8f 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -31,14 +31,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - - +#include <algorithm> #include <svtools/smplhint.hxx> #include <rtl/uuid.h> #include "dapiuno.hxx" #include "datauno.hxx" #include "miscuno.hxx" +#include "convuno.hxx" #include "docsh.hxx" #include "tabvwsh.hxx" #include "pivot.hxx" @@ -61,74 +61,123 @@ #include <com/sun/star/sheet/DataPilotTablePositionData.hpp> #include <comphelper/extract.hxx> +#include <comphelper/sequence.hxx> using namespace com::sun::star; +using namespace com::sun::star::sheet; -using ::com::sun::star::lang::IllegalArgumentException; -using ::com::sun::star::sheet::DataPilotFieldFilter; -using ::com::sun::star::sheet::DataPilotTablePositionData; +using ::rtl::OUString; + +using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; + +using ::com::sun::star::container::ElementExistException; +using ::com::sun::star::container::NoSuchElementException; +using ::com::sun::star::container::XEnumeration; +using ::com::sun::star::container::XIndexAccess; +using ::com::sun::star::container::XNameAccess; +using ::com::sun::star::container::XNamed; + +using ::com::sun::star::beans::PropertyVetoException; +using ::com::sun::star::beans::UnknownPropertyException; +using ::com::sun::star::beans::XPropertyChangeListener; +using ::com::sun::star::beans::XPropertySet; +using ::com::sun::star::beans::XPropertySetInfo; +using ::com::sun::star::beans::XVetoableChangeListener; + +using ::com::sun::star::lang::IllegalArgumentException; +using ::com::sun::star::lang::IndexOutOfBoundsException; +using ::com::sun::star::lang::WrappedTargetException; + using ::com::sun::star::table::CellAddress; using ::com::sun::star::table::CellRangeAddress; -using ::com::sun::star::uno::RuntimeException; -using ::com::sun::star::uno::Any; -//------------------------------------------------------------------------ +// ============================================================================ + +namespace { const SfxItemPropertyMap* lcl_GetDataPilotDescriptorBaseMap() { static SfxItemPropertyMap aDataPilotDescriptorBaseMap_Impl[] = { - {MAP_CHAR_LEN(SC_UNO_COLGRAND), 0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNO_DRILLDOWN),0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNO_IGNEMPROWS),0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNO_RPTEMPTY), 0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNO_ROWGRAND), 0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNO_SHOWFILT), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNO_COLGRAND), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNO_DRILLDOWN), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNO_IGNEMPROWS), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNO_RPTEMPTY), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNO_ROWGRAND), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNO_SHOWFILT), 0, &getBooleanCppuType(), 0, 0 }, {0,0,0,0,0,0} }; return aDataPilotDescriptorBaseMap_Impl; } -//------------------------------------------------------------------------ +// ---------------------------------------------------------------------------- const SfxItemPropertyMap* lcl_GetDataPilotFieldMap() { + using namespace ::com::sun::star::beans::PropertyAttribute; static SfxItemPropertyMap aDataPilotFieldMap_Impl[] = { - {MAP_CHAR_LEN(SC_UNONAME_AUTOSHOW), 0, &getCppuType((sheet::DataPilotFieldAutoShowInfo*)0),0 | beans::PropertyAttribute::MAYBEVOID, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_FUNCTION), 0, &getCppuType((sheet::GeneralFunction*)0), 0, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_GROUPINFO), 0, &getCppuType((sheet::DataPilotFieldGroupInfo*)0), 0 | beans::PropertyAttribute::MAYBEVOID, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_HASAUTOSHOW), 0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_HASLAYOUTINFO),0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_HASREFERENCE), 0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_HASSORTINFO), 0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_ISGROUP), 0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_LAYOUTINFO), 0, &getCppuType((sheet::DataPilotFieldLayoutInfo*)0), 0 | beans::PropertyAttribute::MAYBEVOID, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_ORIENT), 0, &getCppuType((sheet::DataPilotFieldOrientation*)0), 0 | beans::PropertyAttribute::MAYBEVOID, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_REFERENCE), 0, &getCppuType((sheet::DataPilotFieldReference*)0), 0 | beans::PropertyAttribute::MAYBEVOID, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_SELPAGE), 0, &getCppuType((rtl::OUString*)0), 0, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_SHOWEMPTY), 0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_SORTINFO), 0, &getCppuType((sheet::DataPilotFieldSortInfo*)0), 0 | beans::PropertyAttribute::MAYBEVOID, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_USESELPAGE), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_AUTOSHOW), 0, &getCppuType((DataPilotFieldAutoShowInfo*)0), MAYBEVOID, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_FUNCTION), 0, &getCppuType((GeneralFunction*)0), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_GROUPINFO), 0, &getCppuType((DataPilotFieldGroupInfo*)0), MAYBEVOID, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_HASAUTOSHOW), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_HASLAYOUTINFO),0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_HASREFERENCE), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_HASSORTINFO), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_ISGROUP), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_LAYOUTINFO), 0, &getCppuType((DataPilotFieldLayoutInfo*)0), MAYBEVOID, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_ORIENT), 0, &getCppuType((DataPilotFieldOrientation*)0), MAYBEVOID, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_REFERENCE), 0, &getCppuType((DataPilotFieldReference*)0), MAYBEVOID, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_SELPAGE), 0, &getCppuType((OUString*)0), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_SHOWEMPTY), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_SORTINFO), 0, &getCppuType((DataPilotFieldSortInfo*)0), MAYBEVOID, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_SUBTOTALS), 0, &getCppuType((Sequence<GeneralFunction>*)0), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_USESELPAGE), 0, &getBooleanCppuType(), 0, 0 }, {0,0,0,0,0,0} }; return aDataPilotFieldMap_Impl; } +// ---------------------------------------------------------------------------- + const SfxItemPropertyMap* lcl_GetDataPilotItemMap() { static SfxItemPropertyMap aDataPilotItemMap_Impl[] = { - {MAP_CHAR_LEN(SC_UNONAME_ISHIDDEN), 0, &getBooleanCppuType(), 0, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_POS), 0, &getCppuType((sal_Int32*)0), 0, 0 }, - {MAP_CHAR_LEN(SC_UNONAME_SHOWDETAIL), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_ISHIDDEN), 0, &getBooleanCppuType(), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_POS), 0, &getCppuType((sal_Int32*)0), 0, 0 }, + {MAP_CHAR_LEN(SC_UNONAME_SHOWDETAIL), 0, &getBooleanCppuType(), 0, 0 }, {0,0,0,0,0,0} }; return aDataPilotItemMap_Impl; } -//------------------------------------------------------------------------ +// ---------------------------------------------------------------------------- + +inline bool lclCheckValidDouble( double fValue, sal_Bool bAuto ) +{ + return bAuto || ::rtl::math::isFinite( fValue ); +} + +bool lclCheckMinMaxStep( const DataPilotFieldGroupInfo& rInfo ) +{ + return + lclCheckValidDouble( rInfo.Start, rInfo.HasAutoStart ) && + lclCheckValidDouble( rInfo.End, rInfo.HasAutoEnd ) && + (rInfo.HasAutoStart || rInfo.HasAutoEnd || (rInfo.Start <= rInfo.End)) && + lclCheckValidDouble( rInfo.Step, sal_False ) && + (0.0 <= rInfo.Step); +} + +} // namespace + +// ============================================================================ SC_SIMPLE_SERVICE_INFO( ScDataPilotDescriptor, "ScDataPilotDescriptor", "stardiv::one::sheet::DataPilotDescriptor" ) SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldObj, "ScDataPilotFieldObj", "com.sun.star.sheet.DataPilotField" ) @@ -144,54 +193,45 @@ SC_SIMPLE_SERVICE_INFO( ScDataPilotFieldGroupItemObj, "ScDataPilotFieldGroupItem //------------------------------------------------------------------------ -//! irgendwann ueberall die neuen enum-Werte benutzen -#define DATA_PILOT_HIDDEN sheet::DataPilotFieldOrientation_HIDDEN -#define DATA_PILOT_COLUMN sheet::DataPilotFieldOrientation_COLUMN -#define DATA_PILOT_ROW sheet::DataPilotFieldOrientation_ROW -#define DATA_PILOT_PAGE sheet::DataPilotFieldOrientation_PAGE -#define DATA_PILOT_DATA sheet::DataPilotFieldOrientation_DATA - -//------------------------------------------------------------------------ - // name that is used in the API for the data layout field #define SC_DATALAYOUT_NAME "Data" //------------------------------------------------------------------------ -sheet::GeneralFunction ScDataPilotConversion::FirstFunc( USHORT nBits ) +GeneralFunction ScDataPilotConversion::FirstFunc( USHORT nBits ) { - if ( nBits & PIVOT_FUNC_SUM ) return sheet::GeneralFunction_SUM; - if ( nBits & PIVOT_FUNC_COUNT ) return sheet::GeneralFunction_COUNT; - if ( nBits & PIVOT_FUNC_AVERAGE ) return sheet::GeneralFunction_AVERAGE; - if ( nBits & PIVOT_FUNC_MAX ) return sheet::GeneralFunction_MAX; - if ( nBits & PIVOT_FUNC_MIN ) return sheet::GeneralFunction_MIN; - if ( nBits & PIVOT_FUNC_PRODUCT ) return sheet::GeneralFunction_PRODUCT; - if ( nBits & PIVOT_FUNC_COUNT_NUM ) return sheet::GeneralFunction_COUNTNUMS; - if ( nBits & PIVOT_FUNC_STD_DEV ) return sheet::GeneralFunction_STDEV; - if ( nBits & PIVOT_FUNC_STD_DEVP ) return sheet::GeneralFunction_STDEVP; - if ( nBits & PIVOT_FUNC_STD_VAR ) return sheet::GeneralFunction_VAR; - if ( nBits & PIVOT_FUNC_STD_VARP ) return sheet::GeneralFunction_VARP; - if ( nBits & PIVOT_FUNC_AUTO ) return sheet::GeneralFunction_AUTO; - return sheet::GeneralFunction_NONE; + if ( nBits & PIVOT_FUNC_SUM ) return GeneralFunction_SUM; + if ( nBits & PIVOT_FUNC_COUNT ) return GeneralFunction_COUNT; + if ( nBits & PIVOT_FUNC_AVERAGE ) return GeneralFunction_AVERAGE; + if ( nBits & PIVOT_FUNC_MAX ) return GeneralFunction_MAX; + if ( nBits & PIVOT_FUNC_MIN ) return GeneralFunction_MIN; + if ( nBits & PIVOT_FUNC_PRODUCT ) return GeneralFunction_PRODUCT; + if ( nBits & PIVOT_FUNC_COUNT_NUM ) return GeneralFunction_COUNTNUMS; + if ( nBits & PIVOT_FUNC_STD_DEV ) return GeneralFunction_STDEV; + if ( nBits & PIVOT_FUNC_STD_DEVP ) return GeneralFunction_STDEVP; + if ( nBits & PIVOT_FUNC_STD_VAR ) return GeneralFunction_VAR; + if ( nBits & PIVOT_FUNC_STD_VARP ) return GeneralFunction_VARP; + if ( nBits & PIVOT_FUNC_AUTO ) return GeneralFunction_AUTO; + return GeneralFunction_NONE; } -USHORT ScDataPilotConversion::FunctionBit( sheet::GeneralFunction eFunc ) +USHORT ScDataPilotConversion::FunctionBit( GeneralFunction eFunc ) { USHORT nRet = PIVOT_FUNC_NONE; // 0 switch (eFunc) { - case sheet::GeneralFunction_SUM: nRet = PIVOT_FUNC_SUM; break; - case sheet::GeneralFunction_COUNT: nRet = PIVOT_FUNC_COUNT; break; - case sheet::GeneralFunction_AVERAGE: nRet = PIVOT_FUNC_AVERAGE; break; - case sheet::GeneralFunction_MAX: nRet = PIVOT_FUNC_MAX; break; - case sheet::GeneralFunction_MIN: nRet = PIVOT_FUNC_MIN; break; - case sheet::GeneralFunction_PRODUCT: nRet = PIVOT_FUNC_PRODUCT; break; - case sheet::GeneralFunction_COUNTNUMS: nRet = PIVOT_FUNC_COUNT_NUM; break; - case sheet::GeneralFunction_STDEV: nRet = PIVOT_FUNC_STD_DEV; break; - case sheet::GeneralFunction_STDEVP: nRet = PIVOT_FUNC_STD_DEVP; break; - case sheet::GeneralFunction_VAR: nRet = PIVOT_FUNC_STD_VAR; break; - case sheet::GeneralFunction_VARP: nRet = PIVOT_FUNC_STD_VARP; break; - case sheet::GeneralFunction_AUTO: nRet = PIVOT_FUNC_AUTO; break; + case GeneralFunction_SUM: nRet = PIVOT_FUNC_SUM; break; + case GeneralFunction_COUNT: nRet = PIVOT_FUNC_COUNT; break; + case GeneralFunction_AVERAGE: nRet = PIVOT_FUNC_AVERAGE; break; + case GeneralFunction_MAX: nRet = PIVOT_FUNC_MAX; break; + case GeneralFunction_MIN: nRet = PIVOT_FUNC_MIN; break; + case GeneralFunction_PRODUCT: nRet = PIVOT_FUNC_PRODUCT; break; + case GeneralFunction_COUNTNUMS: nRet = PIVOT_FUNC_COUNT_NUM; break; + case GeneralFunction_STDEV: nRet = PIVOT_FUNC_STD_DEV; break; + case GeneralFunction_STDEVP: nRet = PIVOT_FUNC_STD_DEVP; break; + case GeneralFunction_VAR: nRet = PIVOT_FUNC_STD_VAR; break; + case GeneralFunction_VARP: nRet = PIVOT_FUNC_STD_VARP; break; + case GeneralFunction_AUTO: nRet = PIVOT_FUNC_AUTO; break; default: { // added to avoid warnings @@ -200,6 +240,16 @@ USHORT ScDataPilotConversion::FunctionBit( sheet::GeneralFunction eFunc ) return nRet; } +void ScDataPilotConversion::FillGroupInfo( DataPilotFieldGroupInfo& rInfo, const ScDPNumGroupInfo& rGroupInfo ) +{ + rInfo.HasDateValues = rGroupInfo.DateValues; + rInfo.HasAutoStart = rGroupInfo.AutoStart; + rInfo.Start = rGroupInfo.Start; + rInfo.HasAutoEnd = rGroupInfo.AutoEnd; + rInfo.End = rGroupInfo.End; + rInfo.Step = rGroupInfo.Step; +} + //------------------------------------------------------------------------ ScDPObject* lcl_GetDPObject( ScDocShell* pDocShell, SCTAB nTab, const String& rName ) @@ -236,31 +286,23 @@ String lcl_CreatePivotName( ScDocShell* pDocShell ) return String(); // sollte nicht vorkommen } -sal_Int32 lcl_GetObjectIndex( ScDPObject* pDPObj, const ScFieldIdentifier& rIdent ) +sal_Int32 lcl_GetObjectIndex( ScDPObject* pDPObj, const ScFieldIdentifier& rFieldId ) { // used for items - nRepeat in identifier can be ignored - if ( pDPObj ) { sal_Int32 nCount = pDPObj->GetDimCount(); - for ( sal_Int32 nDim = 0; nDim < nCount; nDim++ ) + for ( sal_Int32 nDim = 0; nDim < nCount; ++nDim ) { BOOL bIsDataLayout = FALSE; - String aDimName( pDPObj->GetDimName( nDim, bIsDataLayout ) ); - if ( rIdent.bDataLayoutField ? bIsDataLayout : ( aDimName == rIdent.sFieldName ) ) + OUString aDimName( pDPObj->GetDimName( nDim, bIsDataLayout ) ); + if ( rFieldId.mbDataLayout ? bIsDataLayout : (aDimName == rFieldId.maFieldName) ) return nDim; } } return -1; // none } -BOOL lcl_GetMembers( ScDataPilotDescriptorBase* pParent, const ScFieldIdentifier& rIdent, uno::Reference<container::XNameAccess>& xMembers ) -{ - ScDPObject* pDPObj(pParent->GetDPObject()); - sal_Int32 nObjIndex = lcl_GetObjectIndex( pDPObj, rIdent ); - return pDPObj && pDPObj->GetMembersNA( nObjIndex, xMembers ); -} - //------------------------------------------------------------------------ ScDataPilotTablesObj::ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT) : @@ -289,7 +331,7 @@ void ScDataPilotTablesObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) // XDataPilotTables -ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl(SCSIZE nIndex) +ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nIndex ) { if (pDocShell) { @@ -300,7 +342,7 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl(SCSIZE nIndex) // count tables on this sheet // api only handles sheet data at this time //! allow all data sources!!! - SCSIZE nFound = 0; + sal_Int32 nFound = 0; USHORT nCount = pColl->GetCount(); for (USHORT i=0; i<nCount; i++) { @@ -320,18 +362,15 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl(SCSIZE nIndex) return NULL; } -ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByName_Impl(const rtl::OUString& aName) +ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByName_Impl(const OUString& rName) { - if (hasByName(aName)) - { - String aNamStr(aName); - return new ScDataPilotTableObj( pDocShell, nTab, aNamStr ); - } - return NULL; + if (hasByName(rName)) + return new ScDataPilotTableObj( pDocShell, nTab, rName ); + return 0; } -uno::Reference<sheet::XDataPilotDescriptor> SAL_CALL ScDataPilotTablesObj::createDataPilotDescriptor() - throw(uno::RuntimeException) +Reference<XDataPilotDescriptor> SAL_CALL ScDataPilotTablesObj::createDataPilotDescriptor() + throw(RuntimeException) { ScUnoGuard aGuard; if (pDocShell) @@ -339,37 +378,33 @@ uno::Reference<sheet::XDataPilotDescriptor> SAL_CALL ScDataPilotTablesObj::creat return NULL; } -bool lcl_IsDuplicated( const uno::Reference<beans::XPropertySet> xDimProps ) +bool lcl_IsDuplicated( const Reference<XPropertySet> xDimProps ) { - bool bRet = false; - try { - uno::Any aAny = xDimProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIGINAL))); - uno::Reference<container::XNamed> xOriginal( aAny, uno::UNO_QUERY ); - if ( xOriginal.is() ) - bRet = true; + Any aAny = xDimProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_ORIGINAL ) ) ); + Reference< XNamed > xOriginal( aAny, UNO_QUERY ); + return xOriginal.is(); } - catch(uno::Exception&) + catch( Exception& ) { } - - return bRet; + return false; } -rtl::OUString lcl_GetOriginalName( const uno::Reference<container::XNamed> xDim ) +OUString lcl_GetOriginalName( const Reference< XNamed > xDim ) { - uno::Reference<container::XNamed> xOriginal; + Reference< XNamed > xOriginal; - uno::Reference<beans::XPropertySet> xDimProps( xDim, uno::UNO_QUERY ); + Reference< XPropertySet > xDimProps( xDim, UNO_QUERY ); if ( xDimProps.is() ) { try { - uno::Any aAny = xDimProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIGINAL))); + Any aAny = xDimProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIGINAL))); aAny >>= xOriginal; } - catch(uno::Exception&) + catch( Exception& ) { } } @@ -380,17 +415,17 @@ rtl::OUString lcl_GetOriginalName( const uno::Reference<container::XNamed> xDim return xOriginal->getName(); } -void SAL_CALL ScDataPilotTablesObj::insertNewByName( const rtl::OUString& aNewName, - const table::CellAddress& aOutputAddress, - const uno::Reference<sheet::XDataPilotDescriptor>& xDescriptor ) - throw(uno::RuntimeException) +void SAL_CALL ScDataPilotTablesObj::insertNewByName( const OUString& aNewName, + const CellAddress& aOutputAddress, + const Reference<XDataPilotDescriptor>& xDescriptor ) + throw(RuntimeException) { ScUnoGuard aGuard; if (!xDescriptor.is()) return; // inserting with already existing name? if ( aNewName.getLength() && hasByName( aNewName ) ) - throw uno::RuntimeException(); // no other exceptions specified + throw RuntimeException(); // no other exceptions specified BOOL bDone = FALSE; ScDataPilotDescriptorBase* pImp = ScDataPilotDescriptorBase::getImplementation( xDescriptor ); @@ -418,11 +453,11 @@ void SAL_CALL ScDataPilotTablesObj::insertNewByName( const rtl::OUString& aNewNa } if (!bDone) - throw uno::RuntimeException(); // no other exceptions specified + throw RuntimeException(); // no other exceptions specified } -void SAL_CALL ScDataPilotTablesObj::removeByName( const rtl::OUString& aName ) - throw(uno::RuntimeException) +void SAL_CALL ScDataPilotTablesObj::removeByName( const OUString& aName ) + throw(RuntimeException) { ScUnoGuard aGuard; String aNameStr(aName); @@ -433,21 +468,20 @@ void SAL_CALL ScDataPilotTablesObj::removeByName( const rtl::OUString& aName ) aFunc.DataPilotUpdate( pDPObj, NULL, TRUE, TRUE ); // remove - incl. undo etc. } else - throw uno::RuntimeException(); // no other exceptions specified + throw RuntimeException(); // no other exceptions specified } // XEnumerationAccess -uno::Reference<container::XEnumeration> SAL_CALL ScDataPilotTablesObj::createEnumeration() - throw(uno::RuntimeException) +Reference< XEnumeration > SAL_CALL ScDataPilotTablesObj::createEnumeration() throw(RuntimeException) { ScUnoGuard aGuard; - return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotTablesEnumeration"))); + return new ScIndexEnumeration(this, OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotTablesEnumeration"))); } // XIndexAccess -sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(uno::RuntimeException) +sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(RuntimeException) { ScUnoGuard aGuard; if ( pDocShell ) @@ -475,26 +509,23 @@ sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount() throw(uno::RuntimeException) return 0; } -uno::Any SAL_CALL ScDataPilotTablesObj::getByIndex( sal_Int32 nIndex ) - throw(lang::IndexOutOfBoundsException, - lang::WrappedTargetException, uno::RuntimeException) +Any SAL_CALL ScDataPilotTablesObj::getByIndex( sal_Int32 nIndex ) + throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - uno::Reference<sheet::XDataPilotTable2> xTable(GetObjectByIndex_Impl(static_cast<SCSIZE>(nIndex))); - if (xTable.is()) - return uno::makeAny(xTable); - else - throw lang::IndexOutOfBoundsException(); -// return uno::Any(); + Reference<XDataPilotTable2> xTable(GetObjectByIndex_Impl(nIndex)); + if (!xTable.is()) + throw IndexOutOfBoundsException(); + return Any( xTable ); } -uno::Type SAL_CALL ScDataPilotTablesObj::getElementType() throw(uno::RuntimeException) +uno::Type SAL_CALL ScDataPilotTablesObj::getElementType() throw(RuntimeException) { ScUnoGuard aGuard; - return getCppuType((uno::Reference<sheet::XDataPilotTable2>*)0); + return getCppuType((Reference<XDataPilotTable2>*)0); } -sal_Bool SAL_CALL ScDataPilotTablesObj::hasElements() throw(uno::RuntimeException) +sal_Bool SAL_CALL ScDataPilotTablesObj::hasElements() throw(RuntimeException) { ScUnoGuard aGuard; return ( getCount() != 0 ); @@ -502,21 +533,18 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasElements() throw(uno::RuntimeExceptio // XNameAccess -uno::Any SAL_CALL ScDataPilotTablesObj::getByName( const rtl::OUString& aName ) - throw(container::NoSuchElementException, - lang::WrappedTargetException, uno::RuntimeException) +Any SAL_CALL ScDataPilotTablesObj::getByName( const OUString& aName ) + throw(NoSuchElementException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - uno::Reference<sheet::XDataPilotTable2> xTable(GetObjectByName_Impl(aName)); - if (xTable.is()) - return uno::makeAny(xTable); - else - throw container::NoSuchElementException(); -// return uno::Any(); + Reference<XDataPilotTable2> xTable(GetObjectByName_Impl(aName)); + if (!xTable.is()) + throw NoSuchElementException(); + return Any( xTable ); } -uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotTablesObj::getElementNames() - throw(uno::RuntimeException) +Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames() + throw(RuntimeException) { ScUnoGuard aGuard; if (pDocShell) @@ -540,8 +568,8 @@ uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotTablesObj::getElementNames() } USHORT nPos = 0; - uno::Sequence<rtl::OUString> aSeq(nFound); - rtl::OUString* pAry = aSeq.getArray(); + Sequence<OUString> aSeq(nFound); + OUString* pAry = aSeq.getArray(); for (i=0; i<nCount; i++) { ScDPObject* pDPObj = (*pColl)[i]; @@ -552,11 +580,11 @@ uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotTablesObj::getElementNames() return aSeq; } } - return uno::Sequence<rtl::OUString>(0); + return Sequence<OUString>(0); } -sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const rtl::OUString& aName ) - throw(uno::RuntimeException) +sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const OUString& aName ) + throw(RuntimeException) { ScUnoGuard aGuard; if (pDocShell) @@ -586,7 +614,7 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasByName( const rtl::OUString& aName ) //------------------------------------------------------------------------ ScDataPilotDescriptorBase::ScDataPilotDescriptorBase(ScDocShell* pDocSh) : - aPropSet( lcl_GetDataPilotDescriptorBaseMap() ), + maPropSet( lcl_GetDataPilotDescriptorBaseMap() ), pDocShell( pDocSh ) { pDocShell->GetDocument()->AddUnoObject(*this); @@ -598,12 +626,13 @@ ScDataPilotDescriptorBase::~ScDataPilotDescriptorBase() pDocShell->GetDocument()->RemoveUnoObject(*this); } -uno::Any SAL_CALL ScDataPilotDescriptorBase::queryInterface( const uno::Type& rType ) - throw(uno::RuntimeException) +Any SAL_CALL ScDataPilotDescriptorBase::queryInterface( const uno::Type& rType ) + throw(RuntimeException) { - SC_QUERYINTERFACE( sheet::XDataPilotDescriptor ) - SC_QUERYINTERFACE( beans::XPropertySet ) - SC_QUERYINTERFACE( container::XNamed ) // base of XDataPilotDescriptor + SC_QUERYINTERFACE( XDataPilotDescriptor ) + SC_QUERYINTERFACE( XPropertySet ) + SC_QUERYINTERFACE( XDataPilotDataLayoutFieldSupplier ) + SC_QUERYINTERFACE( XNamed ) // base of XDataPilotDescriptor SC_QUERYINTERFACE( lang::XUnoTunnel ) SC_QUERYINTERFACE( lang::XTypeProvider ) SC_QUERYINTERFACE( lang::XServiceInfo ) @@ -621,27 +650,28 @@ void SAL_CALL ScDataPilotDescriptorBase::release() throw() OWeakObject::release(); } -uno::Sequence<uno::Type> SAL_CALL ScDataPilotDescriptorBase::getTypes() - throw(uno::RuntimeException) +Sequence< uno::Type > SAL_CALL ScDataPilotDescriptorBase::getTypes() + throw(RuntimeException) { - static uno::Sequence<uno::Type> aTypes; + static Sequence< uno::Type > aTypes; if ( aTypes.getLength() == 0 ) { - aTypes.realloc(5); + aTypes.realloc( 6 ); uno::Type* pPtr = aTypes.getArray(); - pPtr[0] = getCppuType((const uno::Reference<sheet::XDataPilotDescriptor>*)0); - pPtr[1] = getCppuType((const uno::Reference<beans::XPropertySet>*)0); - pPtr[2] = getCppuType((const uno::Reference<lang::XUnoTunnel>*)0); - pPtr[3] = getCppuType((const uno::Reference<lang::XTypeProvider>*)0); - pPtr[4] = getCppuType((const uno::Reference<lang::XServiceInfo>*)0); + pPtr[ 0 ] = getCppuType( (const Reference< XDataPilotDescriptor >*)0 ); + pPtr[ 1 ] = getCppuType( (const Reference< XPropertySet >*)0 ); + pPtr[ 2 ] = getCppuType( (const Reference< XDataPilotDataLayoutFieldSupplier >*)0 ); + pPtr[ 3 ] = getCppuType( (const Reference< lang::XUnoTunnel >*)0 ); + pPtr[ 4 ] = getCppuType( (const Reference< lang::XTypeProvider >*)0 ); + pPtr[ 5 ] = getCppuType( (const Reference< lang::XServiceInfo >*)0 ); } return aTypes; } -uno::Sequence<sal_Int8> SAL_CALL ScDataPilotDescriptorBase::getImplementationId() - throw(uno::RuntimeException) +Sequence<sal_Int8> SAL_CALL ScDataPilotDescriptorBase::getImplementationId() + throw(RuntimeException) { - static uno::Sequence< sal_Int8 > aId; + static Sequence< sal_Int8 > aId; if( aId.getLength() == 0 ) { aId.realloc( 16 ); @@ -663,119 +693,98 @@ void ScDataPilotDescriptorBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) // XDataPilotDescriptor -table::CellRangeAddress SAL_CALL ScDataPilotDescriptorBase::getSourceRange() - throw(uno::RuntimeException) +CellRangeAddress SAL_CALL ScDataPilotDescriptorBase::getSourceRange() + throw(RuntimeException) { ScUnoGuard aGuard; - table::CellRangeAddress aRet; - ScDPObject* pDPObject(GetDPObject()); - if (pDPObject && pDPObject->IsSheetData()) - { - const ScSheetSourceDesc* pSheetDesc = pDPObject->GetSheetDesc(); - aRet.StartColumn = pSheetDesc->aSourceRange.aStart.Col(); - aRet.EndColumn = pSheetDesc->aSourceRange.aEnd.Col(); - aRet.StartRow = pSheetDesc->aSourceRange.aStart.Row(); - aRet.EndRow = pSheetDesc->aSourceRange.aEnd.Row(); - aRet.Sheet = pSheetDesc->aSourceRange.aStart.Tab(); - } - else - throw uno::RuntimeException(); + if (!pDPObject || !pDPObject->IsSheetData()) + throw RuntimeException(); + CellRangeAddress aRet; + ScUnoConversion::FillApiRange( aRet, pDPObject->GetSheetDesc()->aSourceRange ); return aRet; } -void SAL_CALL ScDataPilotDescriptorBase::setSourceRange( - const table::CellRangeAddress& aSourceRange ) - throw(uno::RuntimeException) +void SAL_CALL ScDataPilotDescriptorBase::setSourceRange( const CellRangeAddress& aSourceRange ) throw(RuntimeException) { ScUnoGuard aGuard; ScDPObject* pDPObject = GetDPObject(); - if (pDPObject) - { - ScSheetSourceDesc aSheetDesc; - if (pDPObject->IsSheetData()) - aSheetDesc = *(pDPObject->GetSheetDesc()); - aSheetDesc.aSourceRange.aStart.SetCol((SCCOL)aSourceRange.StartColumn); - aSheetDesc.aSourceRange.aEnd.SetCol((SCCOL)aSourceRange.EndColumn); - aSheetDesc.aSourceRange.aStart.SetRow((SCROW)aSourceRange.StartRow); - aSheetDesc.aSourceRange.aEnd.SetRow((SCROW)aSourceRange.EndRow); - aSheetDesc.aSourceRange.aStart.SetTab((SCTAB)aSourceRange.Sheet); - pDPObject->SetSheetDesc(aSheetDesc); - SetDPObject(pDPObject); - } - else - throw uno::RuntimeException(); + if (!pDPObject) + throw RuntimeException(); + + ScSheetSourceDesc aSheetDesc; + if (pDPObject->IsSheetData()) + aSheetDesc = *pDPObject->GetSheetDesc(); + ScUnoConversion::FillScRange( aSheetDesc.aSourceRange, aSourceRange ); + pDPObject->SetSheetDesc( aSheetDesc ); + SetDPObject( pDPObject ); } -uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScDataPilotDescriptorBase::getFilterDescriptor() - throw(uno::RuntimeException) +Reference<XSheetFilterDescriptor> SAL_CALL ScDataPilotDescriptorBase::getFilterDescriptor() + throw(RuntimeException) { ScUnoGuard aGuard; return new ScDataPilotFilterDescriptor( pDocShell, this ); } -uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataPilotFields() - throw(uno::RuntimeException) +Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataPilotFields() + throw(RuntimeException) { ScUnoGuard aGuard; - return new ScDataPilotFieldsObj( this, SC_FIELDORIENT_ALL ); + return new ScDataPilotFieldsObj( *this ); } -uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getColumnFields() - throw(uno::RuntimeException) +Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getColumnFields() + throw(RuntimeException) { ScUnoGuard aGuard; - return new ScDataPilotFieldsObj( this, DATA_PILOT_COLUMN ); + return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_COLUMN ); } -uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getRowFields() - throw(uno::RuntimeException) +Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getRowFields() + throw(RuntimeException) { ScUnoGuard aGuard; - return new ScDataPilotFieldsObj( this, DATA_PILOT_ROW ); + return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_ROW ); } -uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getPageFields() - throw(uno::RuntimeException) +Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getPageFields() + throw(RuntimeException) { ScUnoGuard aGuard; - return new ScDataPilotFieldsObj( this, DATA_PILOT_PAGE ); + return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_PAGE ); } -uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataFields() - throw(uno::RuntimeException) +Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getDataFields() + throw(RuntimeException) { ScUnoGuard aGuard; - return new ScDataPilotFieldsObj( this, DATA_PILOT_DATA ); + return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_DATA ); } -uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getHiddenFields() - throw(uno::RuntimeException) +Reference<XIndexAccess> SAL_CALL ScDataPilotDescriptorBase::getHiddenFields() + throw(RuntimeException) { ScUnoGuard aGuard; - return new ScDataPilotFieldsObj( this, DATA_PILOT_HIDDEN ); + return new ScDataPilotFieldsObj( *this, DataPilotFieldOrientation_HIDDEN ); } // XPropertySet -uno::Reference< beans::XPropertySetInfo > SAL_CALL ScDataPilotDescriptorBase::getPropertySetInfo( ) - throw(uno::RuntimeException) +Reference< XPropertySetInfo > SAL_CALL ScDataPilotDescriptorBase::getPropertySetInfo( ) + throw(RuntimeException) { ScUnoGuard aGuard; - static uno::Reference<beans::XPropertySetInfo> aRef = - new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ); + static Reference<XPropertySetInfo> aRef = + new SfxItemPropertySetInfo( maPropSet.getPropertyMap() ); return aRef; } -void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Any& aValue ) - throw(beans::UnknownPropertyException, - beans::PropertyVetoException, - lang::IllegalArgumentException, - lang::WrappedTargetException, - uno::RuntimeException) +void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) + throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, + WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; ScDPObject* pDPObject = GetDPObject(); @@ -813,7 +822,7 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const ::rtl::OUString aNewData.SetDrillDown(::cppu::any2bool( aValue )); } else - throw beans::UnknownPropertyException(); + throw UnknownPropertyException(); pDPObject->SetSaveData( aNewData ); } @@ -822,13 +831,11 @@ void SAL_CALL ScDataPilotDescriptorBase::setPropertyValue( const ::rtl::OUString } } -uno::Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue(const ::rtl::OUString& aPropertyName ) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) +Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue( const OUString& aPropertyName ) + throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - uno::Any aRet; + Any aRet; ScDPObject* pDPObject(GetDPObject()); if (pDPObject) @@ -865,49 +872,60 @@ uno::Any SAL_CALL ScDataPilotDescriptorBase::getPropertyValue(const ::rtl::OUStr aRet = ::cppu::bool2any( aNewData.GetDrillDown() ); } else - throw beans::UnknownPropertyException(); + throw UnknownPropertyException(); } } return aRet; } -void SAL_CALL ScDataPilotDescriptorBase::addPropertyChangeListener( const ::rtl::OUString& /* aPropertyName */, - const uno::Reference<beans::XPropertyChangeListener >& /* xListener */ ) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) +void SAL_CALL ScDataPilotDescriptorBase::addPropertyChangeListener( + const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener >& /* xListener */ ) + throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { } -void SAL_CALL ScDataPilotDescriptorBase::removePropertyChangeListener( const ::rtl::OUString& /* aPropertyName */, - const uno::Reference<beans::XPropertyChangeListener >& /* aListener */ ) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) +void SAL_CALL ScDataPilotDescriptorBase::removePropertyChangeListener( + const OUString& /* aPropertyName */, const Reference<XPropertyChangeListener >& /* aListener */ ) + throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { } -void SAL_CALL ScDataPilotDescriptorBase::addVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, - const uno::Reference<beans::XVetoableChangeListener >& /* aListener */ ) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) +void SAL_CALL ScDataPilotDescriptorBase::addVetoableChangeListener( + const OUString& /* PropertyName */, const Reference<XVetoableChangeListener >& /* aListener */ ) + throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { } -void SAL_CALL ScDataPilotDescriptorBase::removeVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, - const uno::Reference<beans::XVetoableChangeListener >& /* aListener */ ) - throw(beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) +void SAL_CALL ScDataPilotDescriptorBase::removeVetoableChangeListener( + const OUString& /* PropertyName */, const Reference<XVetoableChangeListener >& /* aListener */ ) + throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { } +// XDataPilotDataLayoutFieldSupplier + +Reference< XDataPilotField > SAL_CALL ScDataPilotDescriptorBase::getDataLayoutField() throw(RuntimeException) +{ + ScUnoGuard aGuard; + if( ScDPObject* pDPObject = GetDPObject() ) + { + if( ScDPSaveData* pSaveData = pDPObject->GetSaveData() ) + { + if( /*ScDPSaveDimension* pDataDim =*/ pSaveData->GetDataLayoutDimension() ) + { + ScFieldIdentifier aFieldId( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_DATALAYOUT_NAME ) ), 0, true ); + return new ScDataPilotFieldObj( *this, aFieldId ); + } + } + } + return 0; +} + // XUnoTunnel sal_Int64 SAL_CALL ScDataPilotDescriptorBase::getSomething( - const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException) + const Sequence<sal_Int8 >& rId ) throw(RuntimeException) { if ( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), @@ -919,15 +937,15 @@ sal_Int64 SAL_CALL ScDataPilotDescriptorBase::getSomething( } // static -const uno::Sequence<sal_Int8>& ScDataPilotDescriptorBase::getUnoTunnelId() +const Sequence<sal_Int8>& ScDataPilotDescriptorBase::getUnoTunnelId() { - static uno::Sequence<sal_Int8> * pSeq = 0; + static Sequence<sal_Int8> * pSeq = 0; if( !pSeq ) { osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); if( !pSeq ) { - static uno::Sequence< sal_Int8 > aSeq( 16 ); + static Sequence< sal_Int8 > aSeq( 16 ); rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); pSeq = &aSeq; } @@ -937,10 +955,10 @@ const uno::Sequence<sal_Int8>& ScDataPilotDescriptorBase::getUnoTunnelId() // static ScDataPilotDescriptorBase* ScDataPilotDescriptorBase::getImplementation( - const uno::Reference<sheet::XDataPilotDescriptor> xObj ) + const Reference<XDataPilotDescriptor> xObj ) { ScDataPilotDescriptorBase* pRet = NULL; - uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY ); + Reference<lang::XUnoTunnel> xUT( xObj, UNO_QUERY ); if (xUT.is()) pRet = reinterpret_cast<ScDataPilotDescriptorBase*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId()))); return pRet; @@ -959,13 +977,13 @@ ScDataPilotTableObj::~ScDataPilotTableObj() { } -uno::Any SAL_CALL ScDataPilotTableObj::queryInterface( const uno::Type& rType ) - throw(uno::RuntimeException) +Any SAL_CALL ScDataPilotTableObj::queryInterface( const uno::Type& rType ) + throw(RuntimeException) { // since we manually do resolve the query for XDataPilotTable2 // we also need to do the same for XDataPilotTable - SC_QUERYINTERFACE( sheet::XDataPilotTable ) - SC_QUERYINTERFACE( sheet::XDataPilotTable2 ) + SC_QUERYINTERFACE( XDataPilotTable ) + SC_QUERYINTERFACE( XDataPilotTable2 ) return ScDataPilotDescriptorBase::queryInterface( rType ); } @@ -980,30 +998,29 @@ void SAL_CALL ScDataPilotTableObj::release() throw() ScDataPilotDescriptorBase::release(); } -uno::Sequence<uno::Type> SAL_CALL ScDataPilotTableObj::getTypes() - throw(uno::RuntimeException) +Sequence< uno::Type > SAL_CALL ScDataPilotTableObj::getTypes() throw(RuntimeException) { - static uno::Sequence<uno::Type> aTypes; + static Sequence< uno::Type > aTypes; if ( aTypes.getLength() == 0 ) { - uno::Sequence<uno::Type> aParentTypes(ScDataPilotDescriptorBase::getTypes()); - long nParentLen = aParentTypes.getLength(); + Sequence< uno::Type > aParentTypes = ScDataPilotDescriptorBase::getTypes(); + sal_Int32 nParentLen = aParentTypes.getLength(); const uno::Type* pParentPtr = aParentTypes.getConstArray(); aTypes.realloc( nParentLen + 1 ); uno::Type* pPtr = aTypes.getArray(); - pPtr[nParentLen + 0] = getCppuType((const uno::Reference<sheet::XDataPilotTable2>*)0); + for (sal_Int32 i = 0; i < nParentLen; ++i) + pPtr[ i ] = pParentPtr[ i ]; // parent types first - for (long i=0; i<nParentLen; i++) - pPtr[i] = pParentPtr[i]; // parent types first + pPtr[ nParentLen ] = getCppuType( (const Reference< XDataPilotTable2 >*)0 ); } return aTypes; } -uno::Sequence<sal_Int8> SAL_CALL ScDataPilotTableObj::getImplementationId() - throw(uno::RuntimeException) +Sequence<sal_Int8> SAL_CALL ScDataPilotTableObj::getImplementationId() + throw(RuntimeException) { - static uno::Sequence< sal_Int8 > aId; + static Sequence< sal_Int8 > aId; if( aId.getLength() == 0 ) { aId.realloc( 16 ); @@ -1031,17 +1048,17 @@ void ScDataPilotTableObj::SetDPObject( ScDPObject* pDPObject ) // "rest of XDataPilotDescriptor" -rtl::OUString SAL_CALL ScDataPilotTableObj::getName() throw(uno::RuntimeException) +OUString SAL_CALL ScDataPilotTableObj::getName() throw(RuntimeException) { ScUnoGuard aGuard; ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName); if (pDPObj) return pDPObj->GetName(); - return rtl::OUString(); + return OUString(); } -void SAL_CALL ScDataPilotTableObj::setName( const rtl::OUString& aNewName ) - throw(uno::RuntimeException) +void SAL_CALL ScDataPilotTableObj::setName( const OUString& aNewName ) + throw(RuntimeException) { ScUnoGuard aGuard; ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName); @@ -1058,17 +1075,17 @@ void SAL_CALL ScDataPilotTableObj::setName( const rtl::OUString& aNewName ) } } -rtl::OUString SAL_CALL ScDataPilotTableObj::getTag() throw(uno::RuntimeException) +OUString SAL_CALL ScDataPilotTableObj::getTag() throw(RuntimeException) { ScUnoGuard aGuard; ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName); if (pDPObj) return pDPObj->GetTag(); - return rtl::OUString(); + return OUString(); } -void SAL_CALL ScDataPilotTableObj::setTag( const ::rtl::OUString& aNewTag ) - throw(uno::RuntimeException) +void SAL_CALL ScDataPilotTableObj::setTag( const OUString& aNewTag ) + throw(RuntimeException) { ScUnoGuard aGuard; ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName); @@ -1084,11 +1101,10 @@ void SAL_CALL ScDataPilotTableObj::setTag( const ::rtl::OUString& aNewTag ) // XDataPilotTable -table::CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRange() - throw(uno::RuntimeException) +CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRange() throw(RuntimeException) { ScUnoGuard aGuard; - table::CellRangeAddress aRet; + CellRangeAddress aRet; ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName); if (pDPObj) { @@ -1102,7 +1118,7 @@ table::CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRange() return aRet; } -void SAL_CALL ScDataPilotTableObj::refresh() throw(uno::RuntimeException) +void SAL_CALL ScDataPilotTableObj::refresh() throw(RuntimeException) { ScUnoGuard aGuard; ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName); @@ -1161,25 +1177,16 @@ CellRangeAddress SAL_CALL ScDataPilotTableObj::getOutputRangeByType( sal_Int32 n throw (IllegalArgumentException, RuntimeException) { ScUnoGuard aGuard; - if (nType < 0 || nType > ::com::sun::star::sheet::DataPilotOutputRangeType::RESULT) + if (nType < 0 || nType > DataPilotOutputRangeType::RESULT) throw IllegalArgumentException(); - table::CellRangeAddress aRet; - ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName); - if (!pDPObj) - return aRet; - - const ScRange aRange = pDPObj->GetOutputRangeByType(nType); - aRet.Sheet = aRange.aStart.Tab(); - aRet.StartColumn = aRange.aStart.Col(); - aRet.StartRow = aRange.aStart.Row(); - aRet.EndColumn = aRange.aEnd.Col(); - aRet.EndRow = aRange.aEnd.Row(); - + CellRangeAddress aRet; + if (ScDPObject* pDPObj = lcl_GetDPObject(GetDocShell(), nTab, aName)) + ScUnoConversion::FillApiRange( aRet, pDPObj->GetOutputRangeByType( nType ) ); return aRet; } -//------------------------------------------------------------------------ +// ============================================================================ ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) : ScDataPilotDescriptorBase( pDocSh ), @@ -1220,121 +1227,158 @@ void ScDataPilotDescriptor::SetDPObject( ScDPObject* pDPObject ) // "rest of XDataPilotDescriptor" -rtl::OUString SAL_CALL ScDataPilotDescriptor::getName() throw(uno::RuntimeException) +OUString SAL_CALL ScDataPilotDescriptor::getName() throw(RuntimeException) { ScUnoGuard aGuard; return mpDPObject->GetName(); } -void SAL_CALL ScDataPilotDescriptor::setName( const rtl::OUString& aNewName ) - throw(uno::RuntimeException) +void SAL_CALL ScDataPilotDescriptor::setName( const OUString& aNewName ) + throw(RuntimeException) { ScUnoGuard aGuard; mpDPObject->SetName( aNewName ); } -rtl::OUString SAL_CALL ScDataPilotDescriptor::getTag() throw(uno::RuntimeException) +OUString SAL_CALL ScDataPilotDescriptor::getTag() throw(RuntimeException) { ScUnoGuard aGuard; return mpDPObject->GetTag(); } -void SAL_CALL ScDataPilotDescriptor::setTag( const ::rtl::OUString& aNewTag ) - throw(uno::RuntimeException) +void SAL_CALL ScDataPilotDescriptor::setTag( const OUString& aNewTag ) + throw(RuntimeException) { ScUnoGuard aGuard; mpDPObject->SetTag( aNewTag ); } -//------------------------------------------------------------------------ +// ============================================================================ -ScDataPilotFieldsObj::ScDataPilotFieldsObj(ScDataPilotDescriptorBase* pPar, USHORT nTy) : - pParent( pPar ), - nType( nTy ) +ScDataPilotChildObjBase::ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent ) : + mrParent( rParent ) { - pParent->acquire(); + mrParent.acquire(); } -ScDataPilotFieldsObj::~ScDataPilotFieldsObj() +ScDataPilotChildObjBase::ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ) : + mrParent( rParent ), + maFieldId( rFieldId ) { - pParent->release(); + mrParent.acquire(); } -BOOL lcl_GetDim(ScDPObject* pDPObj, const ScFieldIdentifier& rIdent, ScDPSaveDimension*& rpDim) +ScDataPilotChildObjBase::~ScDataPilotChildObjBase() { - BOOL bRet = FALSE; - ScDPSaveData* pSave = pDPObj->GetSaveData(); - if ( pSave ) + mrParent.release(); +} + +ScDPObject* ScDataPilotChildObjBase::GetDPObject() const +{ + return mrParent.GetDPObject(); +} + +void ScDataPilotChildObjBase::SetDPObject( ScDPObject* pDPObject ) +{ + mrParent.SetDPObject( pDPObject ); +} + +ScDPSaveDimension* ScDataPilotChildObjBase::GetDPDimension( ScDPObject** ppDPObject ) const +{ + if( ScDPObject* pDPObj = GetDPObject() ) { - if ( rIdent.bDataLayoutField ) - { - rpDim = pSave->GetDataLayoutDimension(); - bRet = TRUE; - } - else if ( rIdent.nRepeat == 0 ) + if( ppDPObject ) *ppDPObject = pDPObj; + if( ScDPSaveData* pSaveData = pDPObj->GetSaveData() ) { - rpDim = pSave->GetDimensionByName( rIdent.sFieldName ); - bRet = TRUE; - } - else - { - // count all dimensions with the given name - - String aNameStr( rIdent.sFieldName ); - const List& rDimensions = pSave->GetDimensions(); - sal_Int32 nDimCount = rDimensions.Count(); - sal_Int32 nFound = 0; - for ( sal_Int32 nDim = 0; nDim < nDimCount && !bRet; nDim++ ) + if( maFieldId.mbDataLayout ) + return pSaveData->GetDataLayoutDimension(); + + if( maFieldId.mnFieldIdx == 0 ) + return pSaveData->GetDimensionByName( maFieldId.maFieldName ); + + // find dimension with specified index (search in duplicated dimensions) + String aFieldName = maFieldId.maFieldName; // needed for comparison + const List& rDimensions = pSaveData->GetDimensions(); + ULONG nDimCount = rDimensions.Count(); + sal_Int32 nFoundIdx = 0; + for( ULONG nDim = 0; nDim < nDimCount; ++nDim ) { - ScDPSaveDimension* pOneDim = static_cast<ScDPSaveDimension*>(rDimensions.GetObject(nDim)); - if ( !pOneDim->IsDataLayout() && pOneDim->GetName() == aNameStr ) + ScDPSaveDimension* pDim = static_cast< ScDPSaveDimension* >( rDimensions.GetObject( nDim ) ); + if( !pDim->IsDataLayout() && (pDim->GetName() == aFieldName) ) { - if ( nFound == rIdent.nRepeat ) - { - rpDim = pOneDim; - bRet = TRUE; - } - else - ++nFound; + if( nFoundIdx == maFieldId.mnFieldIdx ) + return pDim; + ++nFoundIdx; } } } } - return bRet; + return 0; +} + +sal_Int32 ScDataPilotChildObjBase::GetMemberCount() const +{ + sal_Int32 nRet = 0; + Reference<XNameAccess> xMembersNA = GetMembers(); + if (xMembersNA.is()) + { + Reference< XIndexAccess > xMembersIA( new ScNameToIndexAccess( xMembersNA ) ); + nRet = xMembersIA->getCount(); + } + return nRet; +} + +Reference< XNameAccess > ScDataPilotChildObjBase::GetMembers() const +{ + Reference< XNameAccess > xMembersNA; + if( ScDPObject* pDPObj = GetDPObject() ) + pDPObj->GetMembersNA( lcl_GetObjectIndex( pDPObj, maFieldId ), xMembersNA ); + return xMembersNA; +} + +// ============================================================================ + +ScDataPilotFieldsObj::ScDataPilotFieldsObj( ScDataPilotDescriptorBase& rParent ) : + ScDataPilotChildObjBase( rParent ) +{ } -SCSIZE lcl_GetFieldCount( const com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>& rSource, USHORT nType ) +ScDataPilotFieldsObj::ScDataPilotFieldsObj( ScDataPilotDescriptorBase& rParent, DataPilotFieldOrientation eOrient ) : + ScDataPilotChildObjBase( rParent ), + maOrient( eOrient ) { - SCSIZE nRet = 0; +} - uno::Reference<container::XNameAccess> xDimsName(rSource->getDimensions()); - uno::Reference<container::XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName )); +ScDataPilotFieldsObj::~ScDataPilotFieldsObj() +{ +} + +sal_Int32 lcl_GetFieldCount( const Reference<XDimensionsSupplier>& rSource, const Any& rOrient ) +{ + sal_Int32 nRet = 0; + + Reference<XNameAccess> xDimsName(rSource->getDimensions()); + Reference<XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName )); sal_Int32 nIntCount = xIntDims->getCount(); - if (nType != SC_FIELDORIENT_ALL) + if (rOrient.hasValue()) { // all fields of the specified orientation, including duplicated - - uno::Reference<beans::XPropertySet> xDim; - sheet::DataPilotFieldOrientation aOrient; + Reference<XPropertySet> xDim; for (sal_Int32 i = 0; i < nIntCount; ++i) { - xDim.set(xIntDims->getByIndex(i), uno::UNO_QUERY); - if (xDim.is()) - { - xDim->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIENTAT))) >>= aOrient; - if (aOrient == nType) - ++nRet; - } + xDim.set(xIntDims->getByIndex(i), UNO_QUERY); + if (xDim.is() && (xDim->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIENTAT))) == rOrient)) + ++nRet; } } else { // count all non-duplicated fields - uno::Reference<beans::XPropertySet> xDim; + Reference<XPropertySet> xDim; for (sal_Int32 i = 0; i < nIntCount; ++i) { - xDim.set(xIntDims->getByIndex(i), uno::UNO_QUERY); + xDim.set(xIntDims->getByIndex(i), UNO_QUERY); if ( xDim.is() && !lcl_IsDuplicated( xDim ) ) ++nRet; } @@ -1343,37 +1387,32 @@ SCSIZE lcl_GetFieldCount( const com::sun::star::uno::Reference<com::sun::star::s return nRet; } -BOOL lcl_GetFieldDataByIndex( const com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>& rSource, - USHORT nType, SCSIZE nIndex, ScFieldIdentifier& rField ) +BOOL lcl_GetFieldDataByIndex( const Reference<XDimensionsSupplier>& rSource, + const Any& rOrient, SCSIZE nIndex, ScFieldIdentifier& rFieldId ) { BOOL bOk = FALSE; SCSIZE nPos = 0; sal_Int32 nDimIndex = 0; - uno::Reference<container::XNameAccess> xDimsName(rSource->getDimensions()); - uno::Reference<container::XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName )); + Reference<XNameAccess> xDimsName(rSource->getDimensions()); + Reference<XIndexAccess> xIntDims(new ScNameToIndexAccess( xDimsName )); sal_Int32 nIntCount = xIntDims->getCount(); - uno::Reference<beans::XPropertySet> xDim; - if (nType != SC_FIELDORIENT_ALL) + Reference<XPropertySet> xDim; + if (rOrient.hasValue()) { - sheet::DataPilotFieldOrientation aOrient; sal_Int32 i = 0; while (i < nIntCount && !bOk) { - xDim.set(xIntDims->getByIndex(i), uno::UNO_QUERY); - if (xDim.is()) + xDim.set(xIntDims->getByIndex(i), UNO_QUERY); + if (xDim.is() && (xDim->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIENTAT))) == rOrient)) { - xDim->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ORIENTAT))) >>= aOrient; - if (aOrient == nType) + if (nPos == nIndex) { - if (nPos == nIndex) - { - bOk = sal_True; - nDimIndex = i; - } - else - ++nPos; + bOk = sal_True; + nDimIndex = i; } + else + ++nPos; } ++i; } @@ -1383,7 +1422,7 @@ BOOL lcl_GetFieldDataByIndex( const com::sun::star::uno::Reference<com::sun::sta sal_Int32 i = 0; while (i < nIntCount && !bOk) { - xDim.set(xIntDims->getByIndex(i), uno::UNO_QUERY); + xDim.set(xIntDims->getByIndex(i), UNO_QUERY); if ( xDim.is() && !lcl_IsDuplicated( xDim ) ) { if (nPos == nIndex) @@ -1400,30 +1439,30 @@ BOOL lcl_GetFieldDataByIndex( const com::sun::star::uno::Reference<com::sun::sta if ( bOk ) { - xDim.set( xIntDims->getByIndex(nDimIndex), uno::UNO_QUERY ); - uno::Reference<container::XNamed> xDimName( xDim, uno::UNO_QUERY ); + xDim.set( xIntDims->getByIndex(nDimIndex), UNO_QUERY ); + Reference<XNamed> xDimName( xDim, UNO_QUERY ); if ( xDimName.is() ) { - rtl::OUString sOriginalName( lcl_GetOriginalName( xDimName ) ); - rField.sFieldName = sOriginalName; - rField.bDataLayoutField = ScUnoHelpFunctions::GetBoolProperty( xDim, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ISDATALA)) ); + OUString sOriginalName( lcl_GetOriginalName( xDimName ) ); + rFieldId.maFieldName = sOriginalName; + rFieldId.mbDataLayout = ScUnoHelpFunctions::GetBoolProperty( xDim, + OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ISDATALA)) ); sal_Int32 nRepeat = 0; - if ( nType != SC_FIELDORIENT_ALL && lcl_IsDuplicated( xDim ) ) + if ( rOrient.hasValue() && lcl_IsDuplicated( xDim ) ) { // find the repeat count // (this relies on the original dimension always being before the duplicates) - uno::Reference<container::XNamed> xPrevName; + Reference<XNamed> xPrevName; for (sal_Int32 i = 0; i < nDimIndex; ++i) { - xPrevName.set( xIntDims->getByIndex(i), uno::UNO_QUERY ); + xPrevName.set( xIntDims->getByIndex(i), UNO_QUERY ); if ( xPrevName.is() && lcl_GetOriginalName( xPrevName ) == sOriginalName ) ++nRepeat; } } - rField.nRepeat = nRepeat; + rFieldId.mnFieldIdx = nRepeat; } else bOk = sal_False; @@ -1432,127 +1471,111 @@ BOOL lcl_GetFieldDataByIndex( const com::sun::star::uno::Reference<com::sun::sta return bOk; } -BOOL lcl_GetFieldDataByName( ScDPObject* pDPObj, USHORT /* nType */, const rtl::OUString& sName, ScFieldIdentifier& rField ) +BOOL lcl_GetFieldDataByName( ScDPObject* pDPObj, const OUString& rFieldName, ScFieldIdentifier& rFieldId ) { // "By name" is always the first match. // The name "Data" always refers to the data layout field. - rField.sFieldName = sName; - rField.bDataLayoutField = sName.equalsAscii( SC_DATALAYOUT_NAME ); - rField.nRepeat = 0; + rFieldId.maFieldName = rFieldName; + rFieldId.mnFieldIdx = 0; + rFieldId.mbDataLayout = rFieldName.equalsAscii( SC_DATALAYOUT_NAME ); pDPObj->GetSource(); // IsDimNameInUse doesn't update source data // check if the named field exists (not for data layout) - return ( rField.bDataLayoutField || pDPObj->IsDimNameInUse( sName ) ); + return rFieldId.mbDataLayout || pDPObj->IsDimNameInUse( rFieldName ); } // XDataPilotFields -ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByIndex_Impl(SCSIZE nIndex) const +ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByIndex_Impl( sal_Int32 nIndex ) const { - ScDPObject* pObj = pParent->GetDPObject(); - // TODO - if (pObj) + if (ScDPObject* pObj = GetDPObject()) { - ScFieldIdentifier aSourceIdent; - BOOL bOk = lcl_GetFieldDataByIndex( pObj->GetSource(), nType, nIndex, aSourceIdent ); - - if (bOk) - return new ScDataPilotFieldObj( pParent, nType, aSourceIdent ); + ScFieldIdentifier aFieldId; + if (lcl_GetFieldDataByIndex( pObj->GetSource(), maOrient, nIndex, aFieldId )) + return new ScDataPilotFieldObj( mrParent, aFieldId, maOrient ); } - - return NULL; + return 0; } -ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByName_Impl(const rtl::OUString& aName) const +ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByName_Impl(const OUString& aName) const { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + if (ScDPObject* pDPObj = GetDPObject()) { - ScFieldIdentifier aSourceIdent; - if (lcl_GetFieldDataByName( pDPObj, nType, aName, aSourceIdent )) - { - return new ScDataPilotFieldObj( pParent, nType, aSourceIdent ); - } + ScFieldIdentifier aFieldId; + if (lcl_GetFieldDataByName( pDPObj, aName, aFieldId )) + return new ScDataPilotFieldObj( mrParent, aFieldId, maOrient ); } - return NULL; + return 0; } // XEnumerationAccess -uno::Reference<container::XEnumeration> SAL_CALL ScDataPilotFieldsObj::createEnumeration() - throw(uno::RuntimeException) +Reference<XEnumeration> SAL_CALL ScDataPilotFieldsObj::createEnumeration() + throw(RuntimeException) { ScUnoGuard aGuard; - return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotFieldsEnumeration"))); + return new ScIndexEnumeration(this, OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotFieldsEnumeration"))); } // XIndexAccess -sal_Int32 SAL_CALL ScDataPilotFieldsObj::getCount() throw(uno::RuntimeException) +sal_Int32 SAL_CALL ScDataPilotFieldsObj::getCount() throw(RuntimeException) { ScUnoGuard aGuard; // TODO - ScDPObject* pDPObj(pParent->GetDPObject()); - - return pDPObj ? static_cast<sal_Int32>(lcl_GetFieldCount( pDPObj->GetSource(), nType )) : 0; + ScDPObject* pDPObj = GetDPObject(); + return pDPObj ? lcl_GetFieldCount( pDPObj->GetSource(), maOrient ) : 0; } -uno::Any SAL_CALL ScDataPilotFieldsObj::getByIndex( sal_Int32 nIndex ) - throw(lang::IndexOutOfBoundsException, - lang::WrappedTargetException, uno::RuntimeException) +Any SAL_CALL ScDataPilotFieldsObj::getByIndex( sal_Int32 nIndex ) + throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - uno::Reference<beans::XPropertySet> xField(GetObjectByIndex_Impl(static_cast<SCSIZE>(nIndex))); - if (xField.is()) - return uno::makeAny(xField); - else - throw lang::IndexOutOfBoundsException(); + Reference< XPropertySet > xField( GetObjectByIndex_Impl( nIndex ) ); + if (!xField.is()) + throw IndexOutOfBoundsException(); + return Any( xField ); } -uno::Type SAL_CALL ScDataPilotFieldsObj::getElementType() throw(uno::RuntimeException) +uno::Type SAL_CALL ScDataPilotFieldsObj::getElementType() throw(RuntimeException) { ScUnoGuard aGuard; - return getCppuType((uno::Reference<beans::XPropertySet>*)0); + return getCppuType((Reference<XPropertySet>*)0); } -sal_Bool SAL_CALL ScDataPilotFieldsObj::hasElements() throw(uno::RuntimeException) +sal_Bool SAL_CALL ScDataPilotFieldsObj::hasElements() throw(RuntimeException) { ScUnoGuard aGuard; return ( getCount() != 0 ); } -uno::Any SAL_CALL ScDataPilotFieldsObj::getByName( const rtl::OUString& aName ) - throw(container::NoSuchElementException, - lang::WrappedTargetException, uno::RuntimeException) +Any SAL_CALL ScDataPilotFieldsObj::getByName( const OUString& aName ) + throw(NoSuchElementException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - uno::Reference<beans::XPropertySet> xField(GetObjectByName_Impl(aName)); - if (xField.is()) - return uno::makeAny(xField); - else - throw container::NoSuchElementException(); + Reference<XPropertySet> xField(GetObjectByName_Impl(aName)); + if (!xField.is()) + throw NoSuchElementException(); + return Any( xField ); } -uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotFieldsObj::getElementNames() - throw(uno::RuntimeException) +Sequence<OUString> SAL_CALL ScDataPilotFieldsObj::getElementNames() + throw(RuntimeException) { ScUnoGuard aGuard; // TODO - - ScDPObject* pDPObj(pParent->GetDPObject()); - - if (pDPObj) + if (ScDPObject* pDPObj = GetDPObject()) { - uno::Sequence<rtl::OUString> aSeq(static_cast<sal_Int32>(lcl_GetFieldCount(pDPObj->GetSource(), nType))); - rtl::OUString* pAry = aSeq.getArray(); + Sequence< OUString > aSeq( lcl_GetFieldCount( pDPObj->GetSource(), maOrient ) ); + OUString* pAry = aSeq.getArray(); const List& rDimensions = pDPObj->GetSaveData()->GetDimensions(); sal_Int32 nDimCount = rDimensions.Count(); for (sal_Int32 nDim = 0; nDim < nDimCount; nDim++) { ScDPSaveDimension* pDim = (ScDPSaveDimension*)rDimensions.GetObject(nDim); - if(pDim->GetOrientation() == nType) + if(maOrient.hasValue() && (pDim->GetOrientation() == maOrient.get< DataPilotFieldOrientation >())) { *pAry = pDim->GetName(); ++pAry; @@ -1560,11 +1583,11 @@ uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotFieldsObj::getElementNames() } return aSeq; } - return uno::Sequence<rtl::OUString>(); + return Sequence<OUString>(); } -sal_Bool SAL_CALL ScDataPilotFieldsObj::hasByName( const rtl::OUString& aName ) - throw(uno::RuntimeException) +sal_Bool SAL_CALL ScDataPilotFieldsObj::hasByName( const OUString& aName ) + throw(RuntimeException) { ScUnoGuard aGuard; @@ -1573,101 +1596,92 @@ sal_Bool SAL_CALL ScDataPilotFieldsObj::hasByName( const rtl::OUString& aName ) //------------------------------------------------------------------------ -ScDataPilotFieldObj::ScDataPilotFieldObj( ScDataPilotDescriptorBase* pPar, - USHORT nST, const ScFieldIdentifier& rIdent ) : - aPropSet( lcl_GetDataPilotFieldMap() ), - pParent( pPar ), - nSourceType( nST ), - aSourceIdent( rIdent ), - nLastFunc( sheet::GeneralFunction_NONE ) +ScDataPilotFieldObj::ScDataPilotFieldObj( + ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ) : + ScDataPilotChildObjBase( rParent, rFieldId ), + maPropSet( lcl_GetDataPilotFieldMap() ) +{ +} + +ScDataPilotFieldObj::ScDataPilotFieldObj( ScDataPilotDescriptorBase& rParent, + const ScFieldIdentifier& rFieldId, const Any& rOrient ) : + ScDataPilotChildObjBase( rParent, rFieldId ), + maPropSet( lcl_GetDataPilotFieldMap() ), + maOrient( rOrient ) { - pParent->acquire(); } ScDataPilotFieldObj::~ScDataPilotFieldObj() { - pParent->release(); } // XNamed -rtl::OUString SAL_CALL ScDataPilotFieldObj::getName() throw(uno::RuntimeException) +OUString SAL_CALL ScDataPilotFieldObj::getName() throw(RuntimeException) { ScUnoGuard aGuard; -// TODO - rtl::OUString sRet; - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + OUString aName; + if( ScDPSaveDimension* pDim = GetDPDimension() ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - { - if (pDim->IsDataLayout()) - return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(SC_DATALAYOUT_NAME)); - else - sRet = pDim->GetLayoutName(); - } + if( pDim->IsDataLayout() ) + aName = OUString( RTL_CONSTASCII_USTRINGPARAM( SC_DATALAYOUT_NAME ) ); + else + aName = pDim->GetLayoutName(); } - return sRet; + return aName; } -void SAL_CALL ScDataPilotFieldObj::setName( const rtl::OUString& aNewName ) - throw(uno::RuntimeException) +void SAL_CALL ScDataPilotFieldObj::setName( const OUString& rName ) throw(RuntimeException) { ScUnoGuard aGuard; -// TODO - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScDPObject* pDPObj = 0; + ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ); + if( pDim && !pDim->IsDataLayout() ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - { - if (!pDim->IsDataLayout()) - { - String aName(aNewName); - pDim->SetLayoutName(&aName); - pParent->SetDPObject(pDPObj); - } - } + String aName( rName ); + pDim->SetLayoutName( &aName ); + SetDPObject( pDPObj ); } } // XPropertySet -uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDataPilotFieldObj::getPropertySetInfo() - throw(uno::RuntimeException) +Reference<XPropertySetInfo> SAL_CALL ScDataPilotFieldObj::getPropertySetInfo() + throw(RuntimeException) { ScUnoGuard aGuard; - static uno::Reference<beans::XPropertySetInfo> aRef( - new SfxItemPropertySetInfo( aPropSet.getPropertyMap() )); + static Reference<XPropertySetInfo> aRef( + new SfxItemPropertySetInfo( maPropSet.getPropertyMap() )); return aRef; } -void SAL_CALL ScDataPilotFieldObj::setPropertyValue( - const rtl::OUString& aPropertyName, const uno::Any& aValue ) - throw(beans::UnknownPropertyException, beans::PropertyVetoException, - lang::IllegalArgumentException, lang::WrappedTargetException, - uno::RuntimeException) +void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) + throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; String aNameString(aPropertyName); if ( aNameString.EqualsAscii( SC_UNONAME_FUNCTION ) ) { - //! test for correct enum type? - sheet::GeneralFunction eFunction = (sheet::GeneralFunction) - ScUnoHelpFunctions::GetEnumFromAny( aValue ); - setFunction( eFunction ); + GeneralFunction eFunction = GeneralFunction_NONE; + if( aValue >>= eFunction ) + setFunction( eFunction ); + } + else if ( aNameString.EqualsAscii( SC_UNONAME_SUBTOTALS ) ) + { + Sequence< GeneralFunction > aSubtotals; + if( aValue >>= aSubtotals ) + setSubtotals( aSubtotals ); } else if ( aNameString.EqualsAscii( SC_UNONAME_ORIENT ) ) { //! test for correct enum type? - sheet::DataPilotFieldOrientation eOrient = (sheet::DataPilotFieldOrientation) + DataPilotFieldOrientation eOrient = (DataPilotFieldOrientation) ScUnoHelpFunctions::GetEnumFromAny( aValue ); setOrientation( eOrient ); } else if ( aNameString.EqualsAscii( SC_UNONAME_SELPAGE ) ) { - rtl::OUString sCurrentPage; + OUString sCurrentPage; if (aValue >>= sCurrentPage) setCurrentPage(sCurrentPage); } @@ -1682,7 +1696,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( } else if ( aNameString.EqualsAscii( SC_UNONAME_AUTOSHOW ) ) { - sheet::DataPilotFieldAutoShowInfo aInfo; + DataPilotFieldAutoShowInfo aInfo; if (aValue >>= aInfo) setAutoShowInfo(&aInfo); } @@ -1693,7 +1707,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( } else if ( aNameString.EqualsAscii( SC_UNONAME_LAYOUTINFO ) ) { - sheet::DataPilotFieldLayoutInfo aInfo; + DataPilotFieldLayoutInfo aInfo; if (aValue >>= aInfo) setLayoutInfo(&aInfo); } @@ -1704,7 +1718,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( } else if ( aNameString.EqualsAscii( SC_UNONAME_REFERENCE ) ) { - sheet::DataPilotFieldReference aRef; + DataPilotFieldReference aRef; if (aValue >>= aRef) setReference(&aRef); } @@ -1715,7 +1729,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( } else if ( aNameString.EqualsAscii( SC_UNONAME_SORTINFO ) ) { - sheet::DataPilotFieldSortInfo aInfo; + DataPilotFieldSortInfo aInfo; if (aValue >>= aInfo) setSortInfo(&aInfo); } @@ -1726,7 +1740,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( } else if ( aNameString.EqualsAscii( SC_UNONAME_GROUPINFO ) ) { - sheet::DataPilotFieldGroupInfo aInfo; + DataPilotFieldGroupInfo aInfo; if (aValue >>= aInfo) setGroupInfo(&aInfo); } @@ -1736,16 +1750,17 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( } } -uno::Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const rtl::OUString& aPropertyName ) - throw(beans::UnknownPropertyException, lang::WrappedTargetException, - uno::RuntimeException) +Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const OUString& aPropertyName ) + throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; String aNameString(aPropertyName); - uno::Any aRet; + Any aRet; if ( aNameString.EqualsAscii( SC_UNONAME_FUNCTION ) ) aRet <<= getFunction(); + else if ( aNameString.EqualsAscii( SC_UNONAME_SUBTOTALS ) ) + aRet <<= getSubtotals(); else if ( aNameString.EqualsAscii( SC_UNONAME_ORIENT ) ) aRet <<= getOrientation(); else if ( aNameString.EqualsAscii( SC_UNONAME_SELPAGE ) ) @@ -1756,33 +1771,33 @@ uno::Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const rtl::OUString& aP aRet = ::cppu::bool2any(getAutoShowInfo() != NULL); else if ( aNameString.EqualsAscii( SC_UNONAME_AUTOSHOW ) ) { - const sheet::DataPilotFieldAutoShowInfo* pInfo = getAutoShowInfo(); + const DataPilotFieldAutoShowInfo* pInfo = getAutoShowInfo(); if (pInfo) - aRet <<= sheet::DataPilotFieldAutoShowInfo(*pInfo); + aRet <<= DataPilotFieldAutoShowInfo(*pInfo); } else if ( aNameString.EqualsAscii( SC_UNONAME_HASLAYOUTINFO ) ) aRet = ::cppu::bool2any(getLayoutInfo() != NULL); else if ( aNameString.EqualsAscii( SC_UNONAME_LAYOUTINFO ) ) { - const sheet::DataPilotFieldLayoutInfo* pInfo = getLayoutInfo(); + const DataPilotFieldLayoutInfo* pInfo = getLayoutInfo(); if (pInfo) - aRet <<= sheet::DataPilotFieldLayoutInfo(*pInfo); + aRet <<= DataPilotFieldLayoutInfo(*pInfo); } else if ( aNameString.EqualsAscii( SC_UNONAME_HASREFERENCE ) ) aRet = ::cppu::bool2any(getReference() != NULL); else if ( aNameString.EqualsAscii( SC_UNONAME_REFERENCE ) ) { - const sheet::DataPilotFieldReference* pRef = getReference(); + const DataPilotFieldReference* pRef = getReference(); if (pRef) - aRet <<= sheet::DataPilotFieldReference(*pRef); + aRet <<= DataPilotFieldReference(*pRef); } else if ( aNameString.EqualsAscii( SC_UNONAME_HASSORTINFO ) ) aRet = ::cppu::bool2any(getSortInfo() != NULL); else if ( aNameString.EqualsAscii( SC_UNONAME_SORTINFO ) ) { - const sheet::DataPilotFieldSortInfo* pInfo = getSortInfo(); + const DataPilotFieldSortInfo* pInfo = getSortInfo(); if (pInfo) - aRet <<= sheet::DataPilotFieldSortInfo(*pInfo); + aRet <<= DataPilotFieldSortInfo(*pInfo); } else if ( aNameString.EqualsAscii( SC_UNONAME_ISGROUP ) ) aRet = ::cppu::bool2any(hasGroupInfo()); @@ -1798,546 +1813,495 @@ uno::Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const rtl::OUString& aP // XDatePilotField -uno::Reference<container::XIndexAccess> SAL_CALL ScDataPilotFieldObj::getItems() - throw (uno::RuntimeException) +Reference<XIndexAccess> SAL_CALL ScDataPilotFieldObj::getItems() + throw (RuntimeException) { - if (!xItems.is()) - xItems.set(new ScDataPilotItemsObj(pParent, aSourceIdent)); - return xItems; + ScUnoGuard aGuard; + if (!mxItems.is()) + mxItems.set( new ScDataPilotItemsObj( mrParent, maFieldId ) ); + return mxItems; } SC_IMPL_DUMMY_PROPERTY_LISTENER( ScDataPilotFieldObj ) -sheet::DataPilotFieldOrientation ScDataPilotFieldObj::getOrientation(void) const +DataPilotFieldOrientation ScDataPilotFieldObj::getOrientation() const { - sheet::DataPilotFieldOrientation eOrient = DATA_PILOT_HIDDEN; -// TODO - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) - { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - eOrient = (sheet::DataPilotFieldOrientation)pDim->GetOrientation(); - } - - return eOrient; + ScUnoGuard aGuard; + ScDPSaveDimension* pDim = GetDPDimension(); + return pDim ? static_cast< DataPilotFieldOrientation >( pDim->GetOrientation() ) : DataPilotFieldOrientation_HIDDEN; } -void ScDataPilotFieldObj::setOrientation(sheet::DataPilotFieldOrientation eNew) +void ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew) { - if ( eNew == nSourceType ) - return; // nix + ScUnoGuard aGuard; + if (maOrient.hasValue() && (eNew == maOrient.get< DataPilotFieldOrientation >())) + return; - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) + ScDPSaveData* pSaveData = pDPObj->GetSaveData(); + + /* If the field was taken from getDataPilotFields(), don't reset the + orientation for an existing use, but create a duplicated field + instead (for "Data" orientation only). */ + if ( !maOrient.hasValue() && !maFieldId.mbDataLayout && + (pDim->GetOrientation() != DataPilotFieldOrientation_HIDDEN) && + (eNew == DataPilotFieldOrientation_DATA) ) { - if ( nSourceType == SC_FIELDORIENT_ALL && pDim->GetOrientation() != DATA_PILOT_HIDDEN && - !aSourceIdent.bDataLayoutField && eNew == DATA_PILOT_DATA ) - { - // If the field was taken from getDataPilotFields, don't reset the orientation - // for an existing use, create a duplicated field instead (for "Data" orientation only) - ScDPSaveDimension* pNewDim = NULL; - ScDPSaveData* pSave = pDPObj->GetSaveData(); + ScDPSaveDimension* pNewDim = 0; - // look for existing duplicate with orientation "hidden" + // look for existing duplicate with orientation "hidden" - String aNameStr( aSourceIdent.sFieldName ); - const List& rDimensions = pSave->GetDimensions(); - sal_Int32 nDimCount = rDimensions.Count(); - sal_Int32 nFound = 0; - for ( sal_Int32 nDim = 0; nDim < nDimCount && !pNewDim; nDim++ ) + String aNameStr( maFieldId.maFieldName ); + const List& rDimensions = pSaveData->GetDimensions(); + sal_Int32 nDimCount = rDimensions.Count(); + sal_Int32 nFound = 0; + for ( sal_Int32 nDim = 0; nDim < nDimCount && !pNewDim; nDim++ ) + { + ScDPSaveDimension* pOneDim = static_cast<ScDPSaveDimension*>(rDimensions.GetObject(nDim)); + if ( !pOneDim->IsDataLayout() && (pOneDim->GetName() == aNameStr) ) { - ScDPSaveDimension* pOneDim = static_cast<ScDPSaveDimension*>(rDimensions.GetObject(nDim)); - if ( !pOneDim->IsDataLayout() && pOneDim->GetName() == aNameStr ) - { - if ( pOneDim->GetOrientation() == DATA_PILOT_HIDDEN ) - pNewDim = pOneDim; // use this one - else - ++nFound; // count existing non-hidden occurences - } + if ( pOneDim->GetOrientation() == DataPilotFieldOrientation_HIDDEN ) + pNewDim = pOneDim; // use this one + else + ++nFound; // count existing non-hidden occurences } - - if ( !pNewDim ) // if none found, create a new duplicated dimension - pNewDim = &pSave->DuplicateDimension( *pDim ); - - aSourceIdent.nRepeat = nFound; // keep accessing the new one - pDim = pNewDim; } - pDim->SetOrientation(sal::static_int_cast<USHORT>(eNew)); - pParent->SetDPObject(pDPObj); + if ( !pNewDim ) // if none found, create a new duplicated dimension + pNewDim = &pSaveData->DuplicateDimension( *pDim ); - nSourceType = sal::static_int_cast<USHORT>(eNew); // modifying the same object's orientation again doesn't create another duplicate + maFieldId.mnFieldIdx = nFound; // keep accessing the new one + pDim = pNewDim; } + + pDim->SetOrientation(sal::static_int_cast<USHORT>(eNew)); + + // move changed field behind all other fields (make it the last field in dimension) + pSaveData->SetPosition( pDim, pSaveData->GetDimensions().Count() ); + + SetDPObject( pDPObj ); + + maOrient <<= eNew; // modifying the same object's orientation again doesn't create another duplicate } } -sheet::GeneralFunction ScDataPilotFieldObj::getFunction(void) const +GeneralFunction ScDataPilotFieldObj::getFunction() const { - sheet::GeneralFunction eRet = sheet::GeneralFunction_NONE; - -// TODO + ScUnoGuard aGuard; + GeneralFunction eRet = GeneralFunction_NONE; + if( ScDPSaveDimension* pDim = GetDPDimension() ) + { + if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA ) + { + // for non-data fields, property Function is the subtotals + long nSubCount = pDim->GetSubTotalsCount(); + if ( nSubCount > 0 ) + eRet = (GeneralFunction)pDim->GetSubTotalFunc(0); // always use the first one + // else keep NONE + } + else + eRet = (GeneralFunction)pDim->GetFunction(); + } + return eRet; +} - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) +void ScDataPilotFieldObj::setFunction(GeneralFunction eNewFunc) +{ + ScUnoGuard aGuard; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) + if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA ) { - if ( pDim->GetOrientation() != DATA_PILOT_DATA ) + // for non-data fields, property Function is the subtotals + if ( eNewFunc == GeneralFunction_NONE ) + pDim->SetSubTotals( 0, NULL ); + else { - // for non-data fields, property Function is the subtotals - long nSubCount = pDim->GetSubTotalsCount(); - if ( nSubCount > 0 ) - eRet = (sheet::GeneralFunction)pDim->GetSubTotalFunc(0); // always use the first one - // else keep NONE + USHORT nFunc = sal::static_int_cast<USHORT>( eNewFunc ); + pDim->SetSubTotals( 1, &nFunc ); } - else - eRet = (sheet::GeneralFunction)pDim->GetFunction(); } + else + pDim->SetFunction( sal::static_int_cast<USHORT>( eNewFunc ) ); + SetDPObject( pDPObj ); } +} - return eRet; +Sequence< GeneralFunction > ScDataPilotFieldObj::getSubtotals() const +{ + ScUnoGuard aGuard; + Sequence< GeneralFunction > aRet; + if( ScDPSaveDimension* pDim = GetDPDimension() ) + { + if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA ) + { + // for non-data fields, property Functions is the sequence of subtotals + sal_Int32 nCount = static_cast< sal_Int32 >( pDim->GetSubTotalsCount() ); + if ( nCount > 0 ) + { + aRet.realloc( nCount ); + for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx ) + aRet[ nIdx ] = (GeneralFunction)pDim->GetSubTotalFunc( nIdx ); + } + } + } + return aRet; } -void ScDataPilotFieldObj::setFunction(sheet::GeneralFunction eNewFunc) +void ScDataPilotFieldObj::setSubtotals( const Sequence< GeneralFunction >& rSubtotals ) { -// TODO - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScUnoGuard aGuard; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) + if( pDim->GetOrientation() != DataPilotFieldOrientation_DATA ) { - if ( pDim->GetOrientation() != DATA_PILOT_DATA ) + sal_Int32 nCount = rSubtotals.getLength(); + if( nCount == 1 ) { - // for non-data fields, property Function is the subtotals - if ( eNewFunc == sheet::GeneralFunction_NONE ) + // count 1: all values are allowed (including NONE and AUTO) + if( rSubtotals[ 0 ] == GeneralFunction_NONE ) pDim->SetSubTotals( 0, NULL ); else { - USHORT nFunc = sal::static_int_cast<USHORT>( eNewFunc ); + USHORT nFunc = sal::static_int_cast<USHORT>( rSubtotals[ 0 ] ); pDim->SetSubTotals( 1, &nFunc ); } } - else - pDim->SetFunction( sal::static_int_cast<USHORT>( eNewFunc ) ); - pParent->SetDPObject(pDPObj); + else if( nCount > 1 ) + { + // set multiple functions, ignore NONE and AUTO in this case + ::std::vector< USHORT > aSubt; + for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx ) + { + GeneralFunction eFunc = rSubtotals[ nIdx ]; + if( (eFunc != GeneralFunction_NONE) && (eFunc != GeneralFunction_AUTO) ) + { + // do not insert functions twice + USHORT nFunc = static_cast< USHORT >( eFunc ); + if( ::std::find( aSubt.begin(), aSubt.end(), nFunc ) == aSubt.end() ) + aSubt.push_back( nFunc ); + } + } + // set values from vector to ScDPSaveDimension + if ( aSubt.empty() ) + pDim->SetSubTotals( 0, NULL ); + else + pDim->SetSubTotals( static_cast< long >( aSubt.size() ), &aSubt.front() ); + } } + SetDPObject( pDPObj ); } } -rtl::OUString ScDataPilotFieldObj::getCurrentPage() const +OUString ScDataPilotFieldObj::getCurrentPage() const { - rtl::OUString sRet; - - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) - { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - if (pDim->HasCurrentPage()) - sRet = pDim->GetCurrentPage(); - } - - return sRet; + ScUnoGuard aGuard; + ScDPSaveDimension* pDim = GetDPDimension(); + if( pDim && pDim->HasCurrentPage() ) + return pDim->GetCurrentPage(); + return OUString(); } -void ScDataPilotFieldObj::setCurrentPage(const rtl::OUString& sPage) +void ScDataPilotFieldObj::setCurrentPage( const OUString& rPage ) { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScUnoGuard aGuard; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - { - String sCur(sPage); - pDim->SetCurrentPage(&sCur); - pParent->SetDPObject(pDPObj); - } + String aPage( rPage ); + pDim->SetCurrentPage( &aPage ); + SetDPObject( pDPObj ); } } sal_Bool ScDataPilotFieldObj::getUseCurrentPage() const { - sal_Bool bRet = sal_False; - - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) - { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - bRet = pDim->HasCurrentPage(); - } - - return bRet; + ScUnoGuard aGuard; + ScDPSaveDimension* pDim = GetDPDimension(); + return pDim && pDim->HasCurrentPage(); } -void ScDataPilotFieldObj::setUseCurrentPage(sal_Bool bUse) +void ScDataPilotFieldObj::setUseCurrentPage( sal_Bool bUse ) { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScUnoGuard aGuard; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) + if( bUse ) { - if (bUse) + /* It is somehow useless to set the property "HasSelectedPage" to + true, because it is still needed to set an explicit page name. */ + if( !pDim->HasCurrentPage() ) { - String sCur; - pDim->SetCurrentPage(&sCur); + String aPage; + pDim->SetCurrentPage( &aPage ); } - else - pDim->SetCurrentPage(NULL); - pParent->SetDPObject(pDPObj); } + else + pDim->SetCurrentPage( 0 ); + SetDPObject( pDPObj ); } } -const sheet::DataPilotFieldAutoShowInfo* ScDataPilotFieldObj::getAutoShowInfo() +const DataPilotFieldAutoShowInfo* ScDataPilotFieldObj::getAutoShowInfo() { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) - { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - return pDim->GetAutoShowInfo(); - } - return NULL; + ScUnoGuard aGuard; + ScDPSaveDimension* pDim = GetDPDimension(); + return pDim ? pDim->GetAutoShowInfo() : 0; } -void ScDataPilotFieldObj::setAutoShowInfo(const sheet::DataPilotFieldAutoShowInfo* pInfo) +void ScDataPilotFieldObj::setAutoShowInfo( const DataPilotFieldAutoShowInfo* pInfo ) { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScUnoGuard aGuard; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - { - pDim->SetAutoShowInfo(pInfo); - pParent->SetDPObject(pDPObj); - } + pDim->SetAutoShowInfo( pInfo ); + SetDPObject( pDPObj ); } } -const sheet::DataPilotFieldLayoutInfo* ScDataPilotFieldObj::getLayoutInfo() +const DataPilotFieldLayoutInfo* ScDataPilotFieldObj::getLayoutInfo() { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) - { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - return pDim->GetLayoutInfo(); - } - - return NULL; + ScUnoGuard aGuard; + ScDPSaveDimension* pDim = GetDPDimension(); + return pDim ? pDim->GetLayoutInfo() : 0; } -void ScDataPilotFieldObj::setLayoutInfo(const sheet::DataPilotFieldLayoutInfo* pInfo) +void ScDataPilotFieldObj::setLayoutInfo( const DataPilotFieldLayoutInfo* pInfo ) { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScUnoGuard aGuard; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - { - pDim->SetLayoutInfo(pInfo); - pParent->SetDPObject(pDPObj); - } + pDim->SetLayoutInfo( pInfo ); + SetDPObject( pDPObj ); } } -const sheet::DataPilotFieldReference* ScDataPilotFieldObj::getReference() +const DataPilotFieldReference* ScDataPilotFieldObj::getReference() { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) - { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - return pDim->GetReferenceValue(); - } - - return NULL; + ScUnoGuard aGuard; + ScDPSaveDimension* pDim = GetDPDimension(); + return pDim ? pDim->GetReferenceValue() : 0; } -void ScDataPilotFieldObj::setReference(const sheet::DataPilotFieldReference* pInfo) +void ScDataPilotFieldObj::setReference( const DataPilotFieldReference* pInfo ) { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScUnoGuard aGuard; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - { - pDim->SetReferenceValue(pInfo); - pParent->SetDPObject(pDPObj); - } + pDim->SetReferenceValue( pInfo ); + SetDPObject( pDPObj ); } } -const sheet::DataPilotFieldSortInfo* ScDataPilotFieldObj::getSortInfo() +const DataPilotFieldSortInfo* ScDataPilotFieldObj::getSortInfo() { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) - { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - return pDim->GetSortInfo(); - } - - return NULL; + ScUnoGuard aGuard; + ScDPSaveDimension* pDim = GetDPDimension(); + return pDim ? pDim->GetSortInfo() : 0; } -void ScDataPilotFieldObj::setSortInfo(const sheet::DataPilotFieldSortInfo* pInfo) +void ScDataPilotFieldObj::setSortInfo( const DataPilotFieldSortInfo* pInfo ) { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScUnoGuard aGuard; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - { - pDim->SetSortInfo(pInfo); - pParent->SetDPObject(pDPObj); - } + pDim->SetSortInfo( pInfo ); + SetDPObject( pDPObj ); } } sal_Bool ScDataPilotFieldObj::getShowEmpty() const { - sal_Bool bRet = sal_False; - - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) - { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - bRet = pDim->GetShowEmpty(); - } - - return bRet; + ScUnoGuard aGuard; + ScDPSaveDimension* pDim = GetDPDimension(); + return pDim && pDim->GetShowEmpty(); } -void ScDataPilotFieldObj::setShowEmpty(sal_Bool bShow) +void ScDataPilotFieldObj::setShowEmpty( sal_Bool bShow ) { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScUnoGuard aGuard; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - { - pDim->SetShowEmpty(bShow); - pParent->SetDPObject(pDPObj); - } + pDim->SetShowEmpty( bShow ); + SetDPObject( pDPObj ); } } -void ScDataPilotFieldObj::SetGroupInfo(const ScDPNumGroupInfo& rGroupInfo, - sheet::DataPilotFieldGroupInfo& rInfo) +sal_Bool ScDataPilotFieldObj::hasGroupInfo() { - rInfo.HasDateValues = rGroupInfo.DateValues; - rInfo.HasAutoStart = rGroupInfo.AutoStart; - rInfo.Start = rGroupInfo.Start; - rInfo.HasAutoEnd = rGroupInfo.AutoEnd; - rInfo.End = rGroupInfo.End; - rInfo.Step = rGroupInfo.Step; + ScUnoGuard aGuard; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) + if( const ScDPDimensionSaveData* pDimData = pDPObj->GetSaveData()->GetExistingDimensionData() ) + return pDimData->GetNamedGroupDim( pDim->GetName() ) || pDimData->GetNumGroupDim( pDim->GetName() ); + return sal_False; } -void ScDataPilotFieldObj::FillGroupInfo(const ScDPSaveGroupDimension* pGroupDim, - const ScDPSaveNumGroupDimension* pNumGroupDim, sheet::DataPilotFieldGroupInfo& rInfo) +DataPilotFieldGroupInfo ScDataPilotFieldObj::getGroupInfo() { - if (pGroupDim || pNumGroupDim) + ScUnoGuard aGuard; + DataPilotFieldGroupInfo aInfo; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - if (pGroupDim) + if( const ScDPDimensionSaveData* pDimData = pDPObj->GetSaveData()->GetExistingDimensionData() ) { - rInfo.GroupBy = pGroupDim->GetDatePart(); - if (pParent) + if( const ScDPSaveGroupDimension* pGroupDim = pDimData->GetNamedGroupDim( pDim->GetName() ) ) { - uno::Reference<container::XNameAccess> xFields(pParent->getDataPilotFields(), uno::UNO_QUERY); - if (xFields.is()) + // grouped by ... + aInfo.GroupBy = pGroupDim->GetDatePart(); + + // find source field + try { - rInfo.SourceField.set(xFields->getByName(pGroupDim->GetSourceDimName()), uno::UNO_QUERY); + Reference< XNameAccess > xFields( mrParent.getDataPilotFields(), UNO_QUERY_THROW ); + aInfo.SourceField.set( xFields->getByName( pGroupDim->GetSourceDimName() ), UNO_QUERY ); } - } - SetGroupInfo(pGroupDim->GetDateInfo(), rInfo); - if (!pGroupDim->GetDatePart()) - { - ScFieldGroups aGroups; - sal_Int32 nCount = pGroupDim->GetGroupCount(); - for (sal_Int32 i = 0; i < nCount; ++i) + catch( Exception& ) { - const ScDPSaveGroupItem* pGroup = pGroupDim->GetGroupByIndex( i ); - if (pGroup) + } + + ScDataPilotConversion::FillGroupInfo( aInfo, pGroupDim->GetDateInfo() ); + if( pGroupDim->GetDatePart() == 0 ) + { + // fill vector of group and group member information + ScFieldGroups aGroups; + for( sal_Int32 nIdx = 0, nCount = pGroupDim->GetGroupCount(); nIdx < nCount; ++nIdx ) { - ScFieldGroup aGroup; - aGroup.sName = pGroup->GetGroupName(); - sal_Int32 nElemCount = pGroup->GetElementCount(); - for(sal_Int32 j = 0; j < nElemCount; ++j) + if( const ScDPSaveGroupItem* pGroup = pGroupDim->GetGroupByIndex( nIdx ) ) { - const String* pElem = pGroup->GetElementByIndex( j ); - if (pElem) - { - aGroup.aMembers.push_back(*pElem); - } + ScFieldGroup aGroup; + aGroup.maName = pGroup->GetGroupName(); + for( sal_Int32 nMemIdx = 0, nMemCount = pGroup->GetElementCount(); nMemIdx < nMemCount; ++nMemIdx ) + if( const String* pMem = pGroup->GetElementByIndex( nMemIdx ) ) + aGroup.maMembers.push_back( *pMem ); + aGroups.push_back( aGroup ); } - aGroups.push_back(aGroup); } + aInfo.Groups = new ScDataPilotFieldGroupsObj( aGroups ); } - rInfo.Groups = new ScDataPilotFieldGroupsObj(aGroups); } - } - else - { - if (pNumGroupDim->GetDatePart()) - { - rInfo.GroupBy = pNumGroupDim->GetDatePart(); - SetGroupInfo(pNumGroupDim->GetDateInfo(), rInfo); - } - else + else if( const ScDPSaveNumGroupDimension* pNumGroupDim = pDimData->GetNumGroupDim( pDim->GetName() ) ) { - SetGroupInfo(pNumGroupDim->GetInfo(), rInfo); - } - } - } -} - -sal_Bool ScDataPilotFieldObj::hasGroupInfo() -{ - sal_Bool bRet = sal_False; - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) - { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - { - const ScDPSaveData* pDPSave = pDPObj->GetSaveData(); - const ScDPDimensionSaveData* pDimData = pDPSave->GetExistingDimensionData(); - if (pDimData) - { - bRet = (pDimData->GetNamedGroupDim(pDim->GetName()) || pDimData->GetNumGroupDim(pDim->GetName())); - } - } - } - return bRet; -} - -sheet::DataPilotFieldGroupInfo ScDataPilotFieldObj::getGroupInfo() -{ - sheet::DataPilotFieldGroupInfo aInfo; - - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) - { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) - { - const ScDPSaveData* pDPSave = pDPObj->GetSaveData(); - const ScDPDimensionSaveData* pDimData = pDPSave->GetExistingDimensionData(); - if (pDimData) - { - FillGroupInfo(pDimData->GetNamedGroupDim(pDim->GetName()), - pDimData->GetNumGroupDim(pDim->GetName()), aInfo); + if (pNumGroupDim->GetDatePart()) + { + ScDataPilotConversion::FillGroupInfo( aInfo, pNumGroupDim->GetDateInfo() ); + aInfo.GroupBy = pNumGroupDim->GetDatePart(); + } + else + { + ScDataPilotConversion::FillGroupInfo( aInfo, pNumGroupDim->GetInfo() ); + } } } } - return aInfo; } -void ScDataPilotFieldObj::setGroupInfo(const sheet::DataPilotFieldGroupInfo* pInfo) +void ScDataPilotFieldObj::setGroupInfo( const DataPilotFieldGroupInfo* pInfo ) { - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScUnoGuard aGuard; + ScDPObject* pDPObj = 0; + if( /*ScDPSaveDimension* pDim =*/ GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if (lcl_GetDim(pDPObj, aSourceIdent, pDim)) + ScDPSaveData* pSaveData = pDPObj->GetSaveData(); + if( pInfo && lclCheckMinMaxStep( *pInfo ) ) { - ScDPSaveData* pSaveData = pDPObj->GetSaveData(); - if (pInfo) + ScDPNumGroupInfo aInfo; + aInfo.Enable = sal_True; + aInfo.DateValues = pInfo->HasDateValues; + aInfo.AutoStart = pInfo->HasAutoStart; + aInfo.AutoEnd = pInfo->HasAutoEnd; + aInfo.Start = pInfo->Start; + aInfo.End = pInfo->End; + aInfo.Step = pInfo->Step; + Reference< XNamed > xNamed( pInfo->SourceField, UNO_QUERY ); + if( xNamed.is() ) { - ScDPNumGroupInfo aInfo; - aInfo.Enable = sal_True; - aInfo.DateValues = pInfo->HasDateValues; - aInfo.AutoStart = pInfo->HasAutoStart; - aInfo.AutoEnd = pInfo->HasAutoEnd; - aInfo.Start = pInfo->Start; - aInfo.End = pInfo->End; - aInfo.Step = pInfo->Step; - uno::Reference<container::XNamed> xNamed(pInfo->SourceField, uno::UNO_QUERY); - if (xNamed.is()) + ScDPSaveGroupDimension aGroupDim( xNamed->getName(), getName() ); + if( pInfo->GroupBy ) + aGroupDim.SetDateInfo(aInfo, pInfo->GroupBy); + else { - ScDPSaveGroupDimension aGroupDim(xNamed->getName(), getName()); - if (pInfo->GroupBy) - aGroupDim.SetDateInfo(aInfo, pInfo->GroupBy); - else + Reference<XIndexAccess> xIndex(pInfo->Groups, UNO_QUERY); + if (xIndex.is()) { - uno::Reference<container::XIndexAccess> xIndex(pInfo->Groups, uno::UNO_QUERY); - if (xIndex.is()) + sal_Int32 nCount(xIndex->getCount()); + for(sal_Int32 i = 0; i < nCount; i++) { - sal_Int32 nCount(xIndex->getCount()); - for(sal_Int32 i = 0; i < nCount; i++) + Reference<XNamed> xGroupNamed(xIndex->getByIndex(i), UNO_QUERY); + if (xGroupNamed.is()) { - uno::Reference<container::XNamed> xGroupNamed(xIndex->getByIndex(i), uno::UNO_QUERY); - if (xGroupNamed.is()) + ScDPSaveGroupItem aItem(xGroupNamed->getName()); + Reference<XIndexAccess> xGroupIndex(xGroupNamed, UNO_QUERY); + if (xGroupIndex.is()) { - ScDPSaveGroupItem aItem(xGroupNamed->getName()); - uno::Reference<container::XIndexAccess> xGroupIndex(xGroupNamed, uno::UNO_QUERY); - if (xGroupIndex.is()) + sal_Int32 nItemCount(xGroupIndex->getCount()); + for (sal_Int32 j = 0; j < nItemCount; ++j) { - sal_Int32 nItemCount(xGroupIndex->getCount()); - for (sal_Int32 j = 0; j < nItemCount; ++j) - { - uno::Reference<container::XNamed> xItemNamed(xGroupIndex->getByIndex(j), uno::UNO_QUERY); - if (xItemNamed.is()) - aItem.AddElement(xItemNamed->getName()); - } + Reference<XNamed> xItemNamed(xGroupIndex->getByIndex(j), UNO_QUERY); + if (xItemNamed.is()) + aItem.AddElement(xItemNamed->getName()); } - aGroupDim.AddGroupItem(aItem); } + aGroupDim.AddGroupItem(aItem); } } } - ScDPDimensionSaveData aDimSaveData; - - aDimSaveData.AddGroupDimension(aGroupDim); - pSaveData->SetDimensionData(&aDimSaveData); } - else //NumGroup - { - ScDPDimensionSaveData* pDimData = pSaveData->GetDimensionData(); // created if not there - ScDPSaveNumGroupDimension* pExisting = pDimData->GetNumGroupDimAcc( getName() ); - if ( pExisting ) - { - if (pInfo->GroupBy) - pExisting->SetDateInfo(aInfo, pInfo->GroupBy); - // modify existing group dimension - pExisting->SetGroupInfo( aInfo ); - } - else - { - // create new group dimension - ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo ); - if (pInfo->GroupBy) - aNumGroupDim.SetDateInfo(aInfo, pInfo->GroupBy); - pDimData->AddNumGroupDimension( aNumGroupDim ); - } - -// pSaveData->SetDimensionData(pDimData); not neccessary - } + // get dimension savedata or create new if none + ScDPDimensionSaveData& rDimSaveData = *pSaveData->GetDimensionData(); + rDimSaveData.ReplaceGroupDimension( aGroupDim ); } - else + else // no source field in group info -> numeric group { - pSaveData->SetDimensionData(NULL); + ScDPDimensionSaveData* pDimData = pSaveData->GetDimensionData(); // created if not there + + ScDPSaveNumGroupDimension* pExisting = pDimData->GetNumGroupDimAcc( getName() ); + if ( pExisting ) + { + if (pInfo->GroupBy) + pExisting->SetDateInfo(aInfo, pInfo->GroupBy); + // modify existing group dimension + pExisting->SetGroupInfo( aInfo ); + } + else if (pInfo->GroupBy) + { + // create new group dimension + ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo, pInfo->GroupBy ); + pDimData->AddNumGroupDimension( aNumGroupDim ); + } + else + { + // create new group dimension + ScDPSaveNumGroupDimension aNumGroupDim( getName(), aInfo ); + pDimData->AddNumGroupDimension( aNumGroupDim ); + } } - pDPObj->SetSaveData(*pSaveData); - pParent->SetDPObject(pDPObj); } + else // null passed as argument + { + pSaveData->SetDimensionData( 0 ); + } + + pDPObj->SetSaveData( *pSaveData ); + SetDPObject( pDPObj ); } } -sal_Bool ScDataPilotFieldObj::HasString(const uno::Sequence< ::rtl::OUString >& rItems, const rtl::OUString& aString) +sal_Bool ScDataPilotFieldObj::HasString(const Sequence< OUString >& rItems, const OUString& aString) { sal_Bool bRet = sal_False; @@ -2353,311 +2317,330 @@ sal_Bool ScDataPilotFieldObj::HasString(const uno::Sequence< ::rtl::OUString >& } // XDataPilotFieldGrouping -uno::Reference < sheet::XDataPilotField > SAL_CALL - ScDataPilotFieldObj::createNameGroup(const uno::Sequence< rtl::OUString >& rItems) - throw (::com::sun::star::uno::RuntimeException, lang::IllegalArgumentException) +Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( const Sequence< OUString >& rItems ) + throw (RuntimeException, IllegalArgumentException) { ScUnoGuard aGuard; - uno::Reference < sheet::XDataPilotField > xRet; - rtl::OUString sNewDim; + Reference< XDataPilotField > xRet; + OUString sNewDim; - if (!rItems.getLength()) - throw lang::IllegalArgumentException(); + if( !rItems.hasElements() ) + throw IllegalArgumentException(); - ScDPObject* pDPObj(pParent->GetDPObject()); - if ( pDPObj ) + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - ScDPSaveDimension* pDim = NULL; - if ( rItems.getLength() > 0 && lcl_GetDim(pDPObj, aSourceIdent, pDim)) - { - String aDimName (pDim->GetName()); + String aDimName = pDim->GetName(); - ScDPSaveData aSaveData(*pDPObj->GetSaveData()); - ScDPDimensionSaveData* pDimData = aSaveData.GetDimensionData(); // created if not there + ScDPSaveData aSaveData = *pDPObj->GetSaveData(); + ScDPDimensionSaveData* pDimData = aSaveData.GetDimensionData(); // created if not there - // find original base - String aBaseDimName( aDimName ); - const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName ); - if ( pBaseGroupDim ) - { - // any entry's SourceDimName is the original base - aBaseDimName = pBaseGroupDim->GetSourceDimName(); - } + // find original base + String aBaseDimName( aDimName ); + const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName ); + if ( pBaseGroupDim ) + { + // any entry's SourceDimName is the original base + aBaseDimName = pBaseGroupDim->GetSourceDimName(); + } - // find existing group dimension - // (using the selected dim, can be intermediate group dim) - ScDPSaveGroupDimension* pGroupDimension = pDimData->GetGroupDimAccForBase( aDimName ); + // find existing group dimension + // (using the selected dim, can be intermediate group dim) + ScDPSaveGroupDimension* pGroupDimension = pDimData->GetGroupDimAccForBase( aDimName ); - // remove the selected items from their groups - // (empty groups are removed, too) - sal_Int32 nEntryCount = rItems.getLength(); - sal_Int32 nEntry; - if ( pGroupDimension ) + // remove the selected items from their groups + // (empty groups are removed, too) + sal_Int32 nEntryCount = rItems.getLength(); + sal_Int32 nEntry; + if ( pGroupDimension ) + { + for (nEntry=0; nEntry<nEntryCount; nEntry++) { - for (nEntry=0; nEntry<nEntryCount; nEntry++) + String aEntryName(rItems[nEntry]); + if ( pBaseGroupDim ) { - String aEntryName(rItems[nEntry]); - if ( pBaseGroupDim ) - { - // for each selected (intermediate) group, remove all its items - // (same logic as for adding, below) - const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName ); - if ( pBaseGroup ) - pBaseGroup->RemoveElementsFromGroups( *pGroupDimension ); // remove all elements - else - pGroupDimension->RemoveFromGroups( aEntryName ); - } + // for each selected (intermediate) group, remove all its items + // (same logic as for adding, below) + const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName ); + if ( pBaseGroup ) + pBaseGroup->RemoveElementsFromGroups( *pGroupDimension ); // remove all elements else pGroupDimension->RemoveFromGroups( aEntryName ); } + else + pGroupDimension->RemoveFromGroups( aEntryName ); } + } - ScDPSaveGroupDimension* pNewGroupDim = NULL; - if ( !pGroupDimension ) - { - // create a new group dimension - String aGroupDimName = pDimData->CreateGroupDimName( aBaseDimName, *pDPObj, false, NULL ); - pNewGroupDim = new ScDPSaveGroupDimension( aBaseDimName, aGroupDimName ); - sNewDim = aGroupDimName; + ScDPSaveGroupDimension* pNewGroupDim = 0; + if ( !pGroupDimension ) + { + // create a new group dimension + String aGroupDimName = pDimData->CreateGroupDimName( aBaseDimName, *pDPObj, false, NULL ); + pNewGroupDim = new ScDPSaveGroupDimension( aBaseDimName, aGroupDimName ); + sNewDim = aGroupDimName; - pGroupDimension = pNewGroupDim; // make changes to the new dim if none existed + pGroupDimension = pNewGroupDim; // make changes to the new dim if none existed - if ( pBaseGroupDim ) + if ( pBaseGroupDim ) + { + // If it's a higher-order group dimension, pre-allocate groups for all + // non-selected original groups, so the individual base members aren't + // used for automatic groups (this would make the original groups hard + // to find). + //! Also do this when removing groups? + //! Handle this case dynamically with automatic groups? + + long nGroupCount = pBaseGroupDim->GetGroupCount(); + for ( long nGroup = 0; nGroup < nGroupCount; nGroup++ ) { - // If it's a higher-order group dimension, pre-allocate groups for all - // non-selected original groups, so the individual base members aren't - // used for automatic groups (this would make the original groups hard - // to find). - //! Also do this when removing groups? - //! Handle this case dynamically with automatic groups? - - long nGroupCount = pBaseGroupDim->GetGroupCount(); - for ( long nGroup = 0; nGroup < nGroupCount; nGroup++ ) - { - const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup ); + const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetGroupByIndex( nGroup ); - StrData aStrData( pBaseGroup->GetGroupName() ); - if ( !HasString(rItems, aStrData.GetString()) ) //! ignore case? - { - // add an additional group for each item that is not in the selection - ScDPSaveGroupItem aGroup( pBaseGroup->GetGroupName() ); - aGroup.AddElementsFromGroup( *pBaseGroup ); - pGroupDimension->AddGroupItem( aGroup ); - } + StrData aStrData( pBaseGroup->GetGroupName() ); + if ( !HasString(rItems, aStrData.GetString()) ) //! ignore case? + { + // add an additional group for each item that is not in the selection + ScDPSaveGroupItem aGroup( pBaseGroup->GetGroupName() ); + aGroup.AddElementsFromGroup( *pBaseGroup ); + pGroupDimension->AddGroupItem( aGroup ); } } } - String aGroupDimName = pGroupDimension->GetGroupDimName(); + } + String aGroupDimName = pGroupDimension->GetGroupDimName(); + + //! localized prefix string + String aGroupName = pGroupDimension->CreateGroupName( String( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); + ScDPSaveGroupItem aGroup( aGroupName ); + Reference< XNameAccess > xMembers = GetMembers(); + if (!xMembers.is()) + { + delete pNewGroupDim; + throw RuntimeException(); + } + + for (nEntry=0; nEntry<nEntryCount; nEntry++) + { + String aEntryName(rItems[nEntry]); - //! localized prefix string - String aGroupName = pGroupDimension->CreateGroupName( String::CreateFromAscii("Group") ); - ScDPSaveGroupItem aGroup( aGroupName ); - uno::Reference<container::XNameAccess> xMembers; - if (!lcl_GetMembers(pParent, aSourceIdent, xMembers)) + if (!xMembers->hasByName(aEntryName)) { delete pNewGroupDim; - throw uno::RuntimeException(); + throw IllegalArgumentException(); } - for (nEntry=0; nEntry<nEntryCount; nEntry++) + if ( pBaseGroupDim ) { - String aEntryName(rItems[nEntry]); - - if (!xMembers->hasByName(aEntryName)) - { - delete pNewGroupDim; - throw lang::IllegalArgumentException(); - } - - if ( pBaseGroupDim ) - { - // for each selected (intermediate) group, add all its items - const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName ); - if ( pBaseGroup ) - aGroup.AddElementsFromGroup( *pBaseGroup ); - else - aGroup.AddElement( aEntryName ); // no group found -> automatic group, add the item itself - } + // for each selected (intermediate) group, add all its items + const ScDPSaveGroupItem* pBaseGroup = pBaseGroupDim->GetNamedGroup( aEntryName ); + if ( pBaseGroup ) + aGroup.AddElementsFromGroup( *pBaseGroup ); else - aGroup.AddElement( aEntryName ); // no group dimension, add all items directly + aGroup.AddElement( aEntryName ); // no group found -> automatic group, add the item itself } + else + aGroup.AddElement( aEntryName ); // no group dimension, add all items directly + } - pGroupDimension->AddGroupItem( aGroup ); - - if ( pNewGroupDim ) - { - pDimData->AddGroupDimension( *pNewGroupDim ); - delete pNewGroupDim; // AddGroupDimension copies the object - // don't access pGroupDimension after here - } - pGroupDimension = pNewGroupDim = NULL; + pGroupDimension->AddGroupItem( aGroup ); - // set orientation - ScDPSaveDimension* pSaveDimension = aSaveData.GetDimensionByName( aGroupDimName ); - if ( pSaveDimension->GetOrientation() == sheet::DataPilotFieldOrientation_HIDDEN ) - { - ScDPSaveDimension* pOldDimension = aSaveData.GetDimensionByName( aDimName ); - pSaveDimension->SetOrientation( pOldDimension->GetOrientation() ); - long nPosition = 0; //! before (immediate) base - aSaveData.SetPosition( pSaveDimension, nPosition ); - } + if ( pNewGroupDim ) + { + pDimData->AddGroupDimension( *pNewGroupDim ); + delete pNewGroupDim; // AddGroupDimension copies the object + // don't access pGroupDimension after here + } + pGroupDimension = pNewGroupDim = NULL; - // apply changes - pDPObj->SetSaveData( aSaveData ); - pParent->SetDPObject(pDPObj); + // set orientation + ScDPSaveDimension* pSaveDimension = aSaveData.GetDimensionByName( aGroupDimName ); + if ( pSaveDimension->GetOrientation() == DataPilotFieldOrientation_HIDDEN ) + { + ScDPSaveDimension* pOldDimension = aSaveData.GetDimensionByName( aDimName ); + pSaveDimension->SetOrientation( pOldDimension->GetOrientation() ); + long nPosition = 0; //! before (immediate) base + aSaveData.SetPosition( pSaveDimension, nPosition ); } + + // apply changes + pDPObj->SetSaveData( aSaveData ); + SetDPObject( pDPObj ); } - if (sNewDim.getLength()) + // if new grouping field has been created (on first group), return it + if( sNewDim.getLength() > 0 ) { - uno::Reference< container::XNameAccess > xFields(pParent->getDataPilotFields(), uno::UNO_QUERY); + Reference< XNameAccess > xFields(mrParent.getDataPilotFields(), UNO_QUERY); if (xFields.is()) { - xRet.set(xFields->getByName(sNewDim), uno::UNO_QUERY); + xRet.set(xFields->getByName(sNewDim), UNO_QUERY); DBG_ASSERT(xRet.is(), "there is a name, so there should be also a field"); } } - return xRet; } -String lcl_GetDateByName( sal_Int32 nGroupBy ) -{ - String aRet; //! globstr-ID - switch (nGroupBy) - { - //! use translated strings from globstr.src - case com::sun::star::sheet::DataPilotFieldGroupBy::SECONDS: aRet = String::CreateFromAscii("Seconds"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::MINUTES: aRet = String::CreateFromAscii("Minutes"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::HOURS: aRet = String::CreateFromAscii("Hours"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::DAYS: aRet = String::CreateFromAscii("Days"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS: aRet = String::CreateFromAscii("Months"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::QUARTERS: aRet = String::CreateFromAscii("Quarters"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::YEARS: aRet = String::CreateFromAscii("Years"); break; - default: - DBG_ERROR("invalid date part"); - } - return aRet; -} - -uno::Reference < sheet::XDataPilotField > SAL_CALL - ScDataPilotFieldObj::createDateGroup(const sheet::DataPilotFieldGroupInfo& rInfo) - throw (::com::sun::star::uno::RuntimeException, lang::IllegalArgumentException) +Reference < XDataPilotField > SAL_CALL ScDataPilotFieldObj::createDateGroup( const DataPilotFieldGroupInfo& rInfo ) + throw (RuntimeException, IllegalArgumentException) { ScUnoGuard aGuard; + using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy; - if (!rInfo.HasDateValues) - throw lang::IllegalArgumentException(); - - uno::Reference < sheet::XDataPilotField > xRet; + // check min/max/step, HasDateValues must be set always + if( !rInfo.HasDateValues || !lclCheckMinMaxStep( rInfo ) ) + throw IllegalArgumentException(); + // only a single date flag is allowed + if( (rInfo.GroupBy == 0) || (rInfo.GroupBy > YEARS) || ((rInfo.GroupBy & (rInfo.GroupBy - 1)) != 0) ) + throw IllegalArgumentException(); + // step must be zero, if something else than DAYS is specified + if( rInfo.Step >= ((rInfo.GroupBy == DAYS) ? 32768.0 : 1.0) ) + throw IllegalArgumentException(); - ScDPObject* pDPObj(pParent->GetDPObject()); - if ( pDPObj ) - { - ScDPSaveDimension* pDim = NULL; - if ( lcl_GetDim(pDPObj, aSourceIdent, pDim)) + String aGroupDimName; + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) + { + ScDPNumGroupInfo aInfo; + aInfo.Enable = sal_True; + aInfo.DateValues = (rInfo.GroupBy == DAYS) && (rInfo.Step >= 1.0); + aInfo.AutoStart = rInfo.HasAutoStart; + aInfo.AutoEnd = rInfo.HasAutoEnd; + aInfo.Start = rInfo.Start; + aInfo.End = rInfo.End; + aInfo.Step = static_cast< sal_Int32 >( rInfo.Step ); + + // create a local copy of the entire save data (will be written back below) + ScDPSaveData aSaveData = *pDPObj->GetSaveData(); + // get or create dimension save data + ScDPDimensionSaveData& rDimData = *aSaveData.GetDimensionData(); + + // find source dimension name + const String& rDimName = pDim->GetName(); + const ScDPSaveGroupDimension* pGroupDim = rDimData.GetNamedGroupDim( rDimName ); + String aSrcDimName = pGroupDim ? pGroupDim->GetSourceDimName() : rDimName; + + // find a group dimension for the base field, or get numeric grouping + pGroupDim = rDimData.GetFirstNamedGroupDim( aSrcDimName ); + const ScDPSaveNumGroupDimension* pNumGroupDim = rDimData.GetNumGroupDim( aSrcDimName ); + + // do not group by dates, if named groups or numeric grouping is present + bool bHasNamedGrouping = pGroupDim && !pGroupDim->GetDateInfo().Enable; + bool bHasNumGrouping = pNumGroupDim && pNumGroupDim->GetInfo().Enable && !pNumGroupDim->GetInfo().DateValues && !pNumGroupDim->GetDateInfo().Enable; + if( bHasNamedGrouping || bHasNumGrouping ) + throw IllegalArgumentException(); + + if( aInfo.DateValues ) // create day ranges grouping { - ScDPNumGroupInfo aInfo; - aInfo.DateValues = rInfo.HasDateValues; - aInfo.AutoStart = rInfo.HasAutoStart; - aInfo.Start = rInfo.Start; - aInfo.AutoEnd = rInfo.HasAutoEnd; - aInfo.End = rInfo.End; - aInfo.Step = rInfo.Step; - - String aDimName (pDim->GetName()); - - ScDPSaveData aData( *pDPObj->GetSaveData() ); - ScDPDimensionSaveData* pDimData = aData.GetDimensionData(); // created if not there - - // find original base - String aBaseDimName( aDimName ); - const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName ); - if ( pBaseGroupDim ) + // first remove all named group dimensions + while( pGroupDim ) { - // any entry's SourceDimName is the original base - aBaseDimName = pBaseGroupDim->GetSourceDimName(); + String aGroupDimName2 = pGroupDim->GetGroupDimName(); + // find next group dimension before deleting this group + pGroupDim = rDimData.GetNextNamedGroupDim( aGroupDimName2 ); + // remove from dimension save data + rDimData.RemoveGroupDimension( aGroupDimName2 ); + // also remove save data settings for the dimension that no longer exists + aSaveData.RemoveDimensionByName( aGroupDimName2 ); } - - if ( rInfo.GroupBy ) + // create or replace the number grouping dimension + ScDPSaveNumGroupDimension aNumGroupDim( aSrcDimName, aInfo ); + rDimData.ReplaceNumGroupDimension( aNumGroupDim ); + } + else // create date grouping + { + // collect all existing date flags + sal_Int32 nDateParts = rDimData.CollectDateParts( aSrcDimName ); + if( nDateParts == 0 ) { - // create date group dimensions - - sal_Bool bFirst(sal_False); - if (!pBaseGroupDim) // it's the base Dim + // insert numeric group dimension, if no date groups exist yet (or replace day range grouping) + ScDPSaveNumGroupDimension aNumGroupDim( aSrcDimName, aInfo, rInfo.GroupBy ); + rDimData.ReplaceNumGroupDimension( aNumGroupDim ); + } + else if( (nDateParts & rInfo.GroupBy) == 0 ) // do nothing if date field exists already + { + // create new named group dimension for additional date groups + aGroupDimName = rDimData.CreateDateGroupDimName( rInfo.GroupBy, *pDPObj, true, 0 ); + ScDPSaveGroupDimension aGroupDim( aSrcDimName, aGroupDimName, aInfo, rInfo.GroupBy ); + rDimData.AddGroupDimension( aGroupDim ); + + // set orientation of new named group dimension + ScDPSaveDimension& rSaveDim = *aSaveData.GetDimensionByName( aGroupDimName ); + if( rSaveDim.GetOrientation() == DataPilotFieldOrientation_HIDDEN ) { - // test whether there is already grouping - const ScDPSaveNumGroupDimension* pNumGroupDim = pDimData->GetNumGroupDim(pDim->GetName()); - if (pNumGroupDim) - { - if (!pNumGroupDim->GetDateInfo().DateValues) - bFirst = sal_True; - } - else - bFirst = sal_True; + ScDPSaveDimension& rOldDim = *aSaveData.GetDimensionByName( aSrcDimName ); + rSaveDim.SetOrientation( rOldDim.GetOrientation() ); + aSaveData.SetPosition( &rSaveDim, 0 ); //! before (immediate) base } + } + } - ScDPNumGroupInfo aEmpty; - if ( bFirst ) - { - // innermost part: create NumGroupDimension (replacing original values) - // Dimension name is left unchanged + // apply changes + pDPObj->SetSaveData( aSaveData ); + SetDPObject( pDPObj ); + } - if ( rInfo.GroupBy == com::sun::star::sheet::DataPilotFieldGroupBy::DAYS && rInfo.Step != 0.0 ) - { - // only days, and a step value specified: use numerical grouping - // with DateValues flag, not date grouping + // return the UNO object of the new dimension, after writing back saved data + Reference< XDataPilotField > xRet; + if( aGroupDimName.Len() > 0 ) try + { + Reference< XNameAccess > xFields( mrParent.getDataPilotFields(), UNO_QUERY_THROW ); + xRet.set( xFields->getByName( aGroupDimName ), UNO_QUERY ); + } + catch( Exception& ) + { + } + return xRet; +} - ScDPNumGroupInfo aNumInfo( aInfo ); - aNumInfo.DateValues = sal_True; +// ============================================================================ - ScDPSaveNumGroupDimension aNumGroupDim( aBaseDimName, aNumInfo ); - pDimData->AddNumGroupDimension( aNumGroupDim ); - } - else - { - ScDPSaveNumGroupDimension aNumGroupDim( aBaseDimName, aEmpty ); - aNumGroupDim.SetDateInfo( aInfo, rInfo.GroupBy ); - pDimData->AddNumGroupDimension( aNumGroupDim ); - } - } - else - { - // additional parts: create GroupDimension (shown as additional dimensions) +namespace { - String aPartName = lcl_GetDateByName( rInfo.GroupBy ); +bool lclExtractGroupMembers( ScFieldGroupMembers& rMembers, const Any& rElement ) +{ + // allow empty value to create a new group + if( !rElement.hasValue() ) + return true; - String aGroupDimName = pDimData->CreateGroupDimName( - aPartName, *pDPObj, true, NULL ); - ScDPSaveGroupDimension aGroupDim( aBaseDimName, aGroupDimName ); - aGroupDim.SetDateInfo( aInfo, rInfo.GroupBy ); - pDimData->AddGroupDimension( aGroupDim ); + // try to extract a simple sequence of strings + Sequence< OUString > aSeq; + if( rElement >>= aSeq ) + { + if( aSeq.hasElements() ) + rMembers.insert( rMembers.end(), aSeq.getConstArray(), aSeq.getConstArray() + aSeq.getLength() ); + return true; + } - // set orientation - ScDPSaveDimension* pSaveDimension = aData.GetDimensionByName( aGroupDimName ); - if ( pSaveDimension->GetOrientation() == sheet::DataPilotFieldOrientation_HIDDEN ) - { - ScDPSaveDimension* pOldDimension = aData.GetDimensionByName( aBaseDimName ); - pSaveDimension->SetOrientation( pOldDimension->GetOrientation() ); - long nPosition = 0; //! before (immediate) base - aData.SetPosition( pSaveDimension, nPosition ); - } - } + // try to use XIndexAccess providing objects that support XNamed + Reference< XIndexAccess > xItemsIA( rElement, UNO_QUERY ); + if( xItemsIA.is() ) + { + for( sal_Int32 nIdx = 0, nCount = xItemsIA->getCount(); nIdx < nCount; ++nIdx ) + { + try // getByIndex() should not throw, but we cannot be sure + { + Reference< XNamed > xItemName( xItemsIA->getByIndex( nIdx ), UNO_QUERY_THROW ); + rMembers.push_back( xItemName->getName() ); + } + catch( Exception& ) + { + // ignore exceptions, go ahead with next element in the array } - - // apply changes - pDPObj->SetSaveData( aData ); - pParent->SetDPObject(pDPObj); } + return true; } - return xRet; + // nothing valid inside the Any -> return false + return false; } -//------------------------------------------------------------------------ -ScDataPilotFieldGroupsObj::ScDataPilotFieldGroupsObj(const ScFieldGroups& rGroups) : - aGroups(rGroups) +} // namespace + +// ---------------------------------------------------------------------------- + +ScDataPilotFieldGroupsObj::ScDataPilotFieldGroupsObj( const ScFieldGroups& rGroups ) : + maGroups( rGroups ) { } @@ -2667,637 +2650,486 @@ ScDataPilotFieldGroupsObj::~ScDataPilotFieldGroupsObj() // XNameAccess -uno::Any SAL_CALL ScDataPilotFieldGroupsObj::getByName( const rtl::OUString& aName ) - throw(container::NoSuchElementException, - lang::WrappedTargetException, uno::RuntimeException) +Any SAL_CALL ScDataPilotFieldGroupsObj::getByName( const OUString& rName ) + throw(NoSuchElementException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - - ScFieldGroups::const_iterator aItr(aGroups.begin()); - ScFieldGroups::const_iterator aEndItr(aGroups.end()); - sal_Bool bFound(sal_False); - while (!bFound && aItr != aEndItr) - { - if (aItr->sName == aName) - bFound = sal_True; - else - ++aItr; - } - if (bFound) - return uno::makeAny(uno::Reference < container::XNameAccess > (new ScDataPilotFieldGroupObj(*aItr))); - else - throw container::NoSuchElementException(); - -// return uno::Any(); + if( implFindByName( rName ) == maGroups.end() ) + throw NoSuchElementException(); + return Any( Reference< XNameAccess >( new ScDataPilotFieldGroupObj( *this, rName ) ) ); } -uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotFieldGroupsObj::getElementNames() - throw(uno::RuntimeException) +Sequence< OUString > SAL_CALL ScDataPilotFieldGroupsObj::getElementNames() throw(RuntimeException) { ScUnoGuard aGuard; -// TODO - - uno::Sequence<rtl::OUString> aSeq(aGroups.size()); - ScFieldGroups::const_iterator aItr(aGroups.begin()); - ScFieldGroups::const_iterator aEndItr(aGroups.end()); - sal_Int32 i(0); - while (aItr != aEndItr) + Sequence< OUString > aSeq; + if( !maGroups.empty() ) { - aSeq[i] = aItr->sName; - ++aItr; - ++i; + aSeq.realloc( static_cast< sal_Int32 >( maGroups.size() ) ); + OUString* pName = aSeq.getArray(); + for( ScFieldGroups::iterator aIt = maGroups.begin(), aEnd = maGroups.end(); aIt != aEnd; ++aIt, ++pName ) + *pName = aIt->maName; } return aSeq; } -sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasByName( const rtl::OUString& aName ) - throw(uno::RuntimeException) +sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasByName( const OUString& rName ) throw(RuntimeException) { ScUnoGuard aGuard; - - ScFieldGroups::const_iterator aItr(aGroups.begin()); - ScFieldGroups::const_iterator aEndItr(aGroups.end()); - sal_Bool bFound(sal_False); - while (!bFound && aItr != aEndItr) - { - if (aItr->sName == aName) - bFound = sal_True; - else - ++aItr; - } - - return bFound; + return implFindByName( rName ) != maGroups.end(); } // XNameReplace -void SAL_CALL ScDataPilotFieldGroupsObj::replaceByName( const ::rtl::OUString& aName, - const uno::Any& aElement ) - throw (lang::IllegalArgumentException, - container::NoSuchElementException, - lang::WrappedTargetException, - uno::RuntimeException) + +void SAL_CALL ScDataPilotFieldGroupsObj::replaceByName( const OUString& rName, const Any& rElement ) + throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - ScFieldGroups::iterator aItr(aGroups.begin()); - ScFieldGroups::iterator aEndItr(aGroups.end()); - sal_Bool bFound(sal_False); - while (!bFound && aItr != aEndItr) - { - if (aItr->sName == aName) - bFound = sal_True; - else - ++aItr; - } - if (bFound) - { - uno::Reference<container::XNamed> xNamed(aElement, uno::UNO_QUERY); - if (xNamed.is()) - { - ScFieldGroup aGroup; - aGroup.sName = xNamed->getName(); - uno::Reference<container::XIndexAccess> xIndex(xNamed, uno::UNO_QUERY); - if (xIndex.is()) - { - sal_Int32 nCount(xIndex->getCount()); - for (sal_Int32 i = 0; i < nCount; ++i) - { - uno::Reference<container::XNamed> xItem(xIndex->getByIndex(i), uno::UNO_QUERY); - if (xItem.is()) - aGroup.aMembers.push_back(xNamed->getName()); - else - throw lang::IllegalArgumentException(); - } - } - else - throw lang::IllegalArgumentException(); + if( rName.getLength() == 0 ) + throw IllegalArgumentException(); - aGroups.erase(aItr); - aGroups.push_back(aGroup); - } - else - throw lang::IllegalArgumentException(); - } - else - throw container::NoSuchElementException(); + ScFieldGroups::iterator aIt = implFindByName( rName ); + if( aIt == maGroups.end() ) + throw NoSuchElementException(); + + // read all item names provided by the passed object + ScFieldGroupMembers aMembers; + if( !lclExtractGroupMembers( aMembers, rElement ) ) + throw IllegalArgumentException(); + + // copy and forget, faster than vector assignment + aIt->maMembers.swap( aMembers ); } // XNameContainer -void SAL_CALL ScDataPilotFieldGroupsObj::insertByName( const ::rtl::OUString& aName, - const uno::Any& aElement ) - throw (lang::IllegalArgumentException, - container::ElementExistException, - lang::WrappedTargetException, - uno::RuntimeException) + +void SAL_CALL ScDataPilotFieldGroupsObj::insertByName( const OUString& rName, const Any& rElement ) + throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - ScFieldGroups::const_iterator aItr(aGroups.begin()); - ScFieldGroups::const_iterator aEndItr(aGroups.end()); - sal_Bool bFound(sal_False); - while (!bFound && aItr != aEndItr) - { - if (aItr->sName == aName) - bFound = sal_True; - else - ++aItr; - } - if (!bFound) - { - uno::Reference<container::XNamed> xNamed(aElement, uno::UNO_QUERY); - if (xNamed.is()) - { - ScFieldGroup aGroup; - aGroup.sName = xNamed->getName(); - uno::Reference<container::XIndexAccess> xIndex(xNamed, uno::UNO_QUERY); - if (xIndex.is()) - { - sal_Int32 nCount(xIndex->getCount()); - for (sal_Int32 i = 0; i < nCount; ++i) - { - uno::Reference<container::XNamed> xItem(xIndex->getByIndex(i), uno::UNO_QUERY); - if (xItem.is()) - aGroup.aMembers.push_back(xNamed->getName()); - else - throw lang::IllegalArgumentException(); - } - } - else - throw lang::IllegalArgumentException(); + if( rName.getLength() == 0 ) + throw IllegalArgumentException(); - aGroups.push_back(aGroup); - } - else - throw lang::IllegalArgumentException(); - } - else - throw container::ElementExistException(); + ScFieldGroups::iterator aIt = implFindByName( rName ); + if( aIt != maGroups.end() ) + throw ElementExistException(); + + // read all item names provided by the passed object + ScFieldGroupMembers aMembers; + if( !lclExtractGroupMembers( aMembers, rElement ) ) + throw IllegalArgumentException(); + + // create the new entry if no error has been occured + maGroups.resize( maGroups.size() + 1 ); + ScFieldGroup& rGroup = maGroups.back(); + rGroup.maName = rName; + rGroup.maMembers.swap( aMembers ); } -void SAL_CALL ScDataPilotFieldGroupsObj::removeByName( const ::rtl::OUString& aName ) - throw (container::NoSuchElementException, - lang::WrappedTargetException, - uno::RuntimeException) +void SAL_CALL ScDataPilotFieldGroupsObj::removeByName( const OUString& rName ) + throw (NoSuchElementException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - ScFieldGroups::iterator aItr(aGroups.begin()); - ScFieldGroups::iterator aEndItr(aGroups.end()); - sal_Bool bFound(sal_False); - while (!bFound && aItr != aEndItr) - { - if (aItr->sName == aName) - bFound = sal_True; - else - ++aItr; - } - if (bFound) - aGroups.erase(aItr); - else - throw container::NoSuchElementException(); + if( rName.getLength() == 0 ) + throw IllegalArgumentException(); + + ScFieldGroups::iterator aIt = implFindByName( rName ); + if( aIt == maGroups.end() ) + throw NoSuchElementException(); + + maGroups.erase( aIt ); +} + +// XIndexAccess + +sal_Int32 SAL_CALL ScDataPilotFieldGroupsObj::getCount() throw(RuntimeException) +{ + ScUnoGuard aGuard; + return static_cast< sal_Int32 >( maGroups.size() ); +} + +Any SAL_CALL ScDataPilotFieldGroupsObj::getByIndex( sal_Int32 nIndex ) + throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) +{ + ScUnoGuard aGuard; + if ((nIndex < 0) || (nIndex >= static_cast< sal_Int32 >( maGroups.size() ))) + throw IndexOutOfBoundsException(); + return Any( Reference< XNameAccess >( new ScDataPilotFieldGroupObj( *this, maGroups[ nIndex ].maName ) ) ); } // XEnumerationAccess -uno::Reference<container::XEnumeration> SAL_CALL ScDataPilotFieldGroupsObj::createEnumeration() - throw(uno::RuntimeException) +Reference<XEnumeration> SAL_CALL ScDataPilotFieldGroupsObj::createEnumeration() throw(RuntimeException) { ScUnoGuard aGuard; - return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotFieldGroupsEnumeration"))); + return new ScIndexEnumeration( this, OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.DataPilotFieldGroupsEnumeration" ) ) ); } -// XIndexAccess +// XElementAccess -sal_Int32 SAL_CALL ScDataPilotFieldGroupsObj::getCount() throw(uno::RuntimeException) +uno::Type SAL_CALL ScDataPilotFieldGroupsObj::getElementType() throw(RuntimeException) { ScUnoGuard aGuard; - return aGroups.size(); + return getCppuType( (Reference< XNameAccess >*)0 ); } -uno::Any SAL_CALL ScDataPilotFieldGroupsObj::getByIndex( sal_Int32 nIndex ) - throw(lang::IndexOutOfBoundsException, - lang::WrappedTargetException, uno::RuntimeException) +sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasElements() throw(RuntimeException) { ScUnoGuard aGuard; - if (nIndex >= 0 && nIndex < sal::static_int_cast<sal_Int32>(aGroups.size())) - return uno::makeAny(uno::Reference < container::XNameAccess > (new ScDataPilotFieldGroupObj(aGroups[nIndex]))); - else - throw lang::IndexOutOfBoundsException(); + return !maGroups.empty(); } -uno::Type SAL_CALL ScDataPilotFieldGroupsObj::getElementType() throw(uno::RuntimeException) +// implementation + +ScFieldGroup& ScDataPilotFieldGroupsObj::getFieldGroup( const OUString& rName ) throw(RuntimeException) { ScUnoGuard aGuard; - return getCppuType((uno::Reference<container::XNameAccess>*)0); + ScFieldGroups::iterator aIt = implFindByName( rName ); + if( aIt == maGroups.end() ) + throw RuntimeException(); + return *aIt; } -sal_Bool SAL_CALL ScDataPilotFieldGroupsObj::hasElements() throw(uno::RuntimeException) +void ScDataPilotFieldGroupsObj::renameFieldGroup( const OUString& rOldName, const OUString& rNewName ) throw(RuntimeException) { ScUnoGuard aGuard; - return ( !aGroups.empty() ); + ScFieldGroups::iterator aOldIt = implFindByName( rOldName ); + ScFieldGroups::iterator aNewIt = implFindByName( rNewName ); + // new name must not exist yet + if( (aOldIt == maGroups.end()) || ((aNewIt != maGroups.end()) && (aNewIt != aOldIt)) ) + throw RuntimeException(); + aOldIt->maName = rNewName; } -//------------------------------------------------------------------------ +// private + +ScFieldGroups::iterator ScDataPilotFieldGroupsObj::implFindByName( const OUString& rName ) +{ + for( ScFieldGroups::iterator aIt = maGroups.begin(), aEnd = maGroups.end(); aIt != aEnd; ++aIt ) + if( aIt->maName == rName ) + return aIt; + return maGroups.end(); +} + +// ============================================================================ + +namespace { + +OUString lclExtractMember( const Any& rElement ) +{ + if( rElement.has< OUString >() ) + return rElement.get< OUString >(); + + Reference< XNamed > xNamed( rElement, UNO_QUERY ); + if( xNamed.is() ) + return xNamed->getName(); + + return OUString(); +} + +} // namespace -ScDataPilotFieldGroupObj::ScDataPilotFieldGroupObj(const ScFieldGroup& rGroup) : - aGroup(rGroup) +// ---------------------------------------------------------------------------- + +ScDataPilotFieldGroupObj::ScDataPilotFieldGroupObj( ScDataPilotFieldGroupsObj& rParent, const OUString& rGroupName ) : + mrParent( rParent ), + maGroupName( rGroupName ) { + mrParent.acquire(); } ScDataPilotFieldGroupObj::~ScDataPilotFieldGroupObj() { + mrParent.release(); } // XNameAccess -uno::Any SAL_CALL ScDataPilotFieldGroupObj::getByName( const rtl::OUString& aName ) - throw(container::NoSuchElementException, - lang::WrappedTargetException, uno::RuntimeException) +Any SAL_CALL ScDataPilotFieldGroupObj::getByName( const OUString& rName ) + throw(NoSuchElementException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - - std::vector< rtl::OUString >::const_iterator aItr(aGroup.aMembers.begin()); - std::vector< rtl::OUString >::const_iterator aEndItr(aGroup.aMembers.end()); - sal_Bool bFound(sal_False); - while (!bFound && aItr != aEndItr) - { - if (*aItr == aName) - bFound = sal_True; - else - ++aItr; - } - if (bFound) - return uno::makeAny(uno::Reference < container::XNamed > (new ScDataPilotFieldGroupItemObj(*aItr))); - - return uno::Any(); + ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers; + ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName ); + if( aIt == rMembers.end() ) + throw NoSuchElementException(); + return Any( Reference< XNamed >( new ScDataPilotFieldGroupItemObj( *this, *aIt ) ) ); } -uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotFieldGroupObj::getElementNames() - throw(uno::RuntimeException) +Sequence< OUString > SAL_CALL ScDataPilotFieldGroupObj::getElementNames() throw(RuntimeException) { ScUnoGuard aGuard; -// TODO - - uno::Sequence<rtl::OUString> aSeq(aGroup.aMembers.size()); - std::vector< rtl::OUString >::const_iterator aItr(aGroup.aMembers.begin()); - std::vector< rtl::OUString >::const_iterator aEndItr(aGroup.aMembers.end()); - sal_Int32 i(0); - while (aItr != aEndItr) - { - aSeq[i] = *aItr; - ++aItr; - ++i; - } - return aSeq; + return ::comphelper::containerToSequence( mrParent.getFieldGroup( maGroupName ).maMembers ); } -sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasByName( const rtl::OUString& aName ) - throw(uno::RuntimeException) +sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasByName( const OUString& rName ) throw(RuntimeException) { ScUnoGuard aGuard; - - std::vector< rtl::OUString >::const_iterator aItr(aGroup.aMembers.begin()); - std::vector< rtl::OUString >::const_iterator aEndItr(aGroup.aMembers.end()); - sal_Bool bFound(sal_False); - while (!bFound && aItr != aEndItr) - { - if (*aItr == aName) - bFound = sal_True; - else - ++aItr; - } - - return bFound; + ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers; + return ::std::find( rMembers.begin(), rMembers.end(), rName ) != rMembers.end(); } // XNameReplace -void SAL_CALL ScDataPilotFieldGroupObj::replaceByName( const ::rtl::OUString& aName, - const uno::Any& aElement ) - throw (lang::IllegalArgumentException, - container::NoSuchElementException, - lang::WrappedTargetException, - uno::RuntimeException) + +void SAL_CALL ScDataPilotFieldGroupObj::replaceByName( const OUString& rName, const Any& rElement ) + throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - std::vector<rtl::OUString>::iterator aItr(aGroup.aMembers.begin()); - std::vector<rtl::OUString>::iterator aEndItr(aGroup.aMembers.end()); - sal_Bool bFound(sal_False); - while (!bFound && aItr != aEndItr) - { - if (*aItr == aName) - bFound = sal_True; - else - ++aItr; - } - if (bFound) - { - uno::Reference<container::XNamed> xNamed(aElement, uno::UNO_QUERY); - if (xNamed.is()) - { - aGroup.aMembers.erase(aItr); - aGroup.aMembers.push_back(xNamed->getName()); - } - else - throw lang::IllegalArgumentException(); - } - else - throw container::NoSuchElementException(); + // it should be possible to quickly rename an item -> accept string or XNamed + OUString aNewName = lclExtractMember( rElement ); + if( (rName.getLength() == 0) || (aNewName.getLength() == 0) ) + throw IllegalArgumentException(); + if( rName == aNewName ) + return; + + ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers; + ScFieldGroupMembers::iterator aOldIt = ::std::find( rMembers.begin(), rMembers.end(), rName ); + ScFieldGroupMembers::iterator aNewIt = ::std::find( rMembers.begin(), rMembers.end(), aNewName ); + // throw if passed member name does not exist + if( aOldIt == rMembers.end() ) + throw NoSuchElementException(); + // throw if new name already exists + if( aNewIt != rMembers.end() ) + throw IllegalArgumentException(); + *aOldIt = aNewName; } // XNameContainer -void SAL_CALL ScDataPilotFieldGroupObj::insertByName( const ::rtl::OUString& aName, - const uno::Any& aElement ) - throw (lang::IllegalArgumentException, - container::ElementExistException, - lang::WrappedTargetException, - uno::RuntimeException) + +void SAL_CALL ScDataPilotFieldGroupObj::insertByName( const OUString& rName, const Any& /*rElement*/ ) + throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - std::vector<rtl::OUString>::iterator aItr(aGroup.aMembers.begin()); - std::vector<rtl::OUString>::iterator aEndItr(aGroup.aMembers.end()); - sal_Bool bFound(sal_False); - while (!bFound && aItr != aEndItr) - { - if (*aItr == aName) - bFound = sal_True; - else - ++aItr; - } - if (!bFound) - { - uno::Reference<container::XNamed> xNamed(aElement, uno::UNO_QUERY); - if (xNamed.is()) - { - if (aName == xNamed->getName()) - aGroup.aMembers.push_back(aName); - else - throw lang::IllegalArgumentException(); - } - else - throw lang::IllegalArgumentException(); - } - else - throw container::ElementExistException(); + // we will ignore the passed element and just try to insert the name + if( rName.getLength() == 0 ) + throw IllegalArgumentException(); + + ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers; + ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName ); + // throw if passed name already exists + if( aIt != rMembers.end() ) + throw IllegalArgumentException(); + rMembers.push_back( rName ); } -void SAL_CALL ScDataPilotFieldGroupObj::removeByName( const ::rtl::OUString& aName ) - throw (container::NoSuchElementException, - lang::WrappedTargetException, - uno::RuntimeException) +void SAL_CALL ScDataPilotFieldGroupObj::removeByName( const OUString& rName ) + throw (NoSuchElementException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - std::vector<rtl::OUString>::iterator aItr(aGroup.aMembers.begin()); - std::vector<rtl::OUString>::iterator aEndItr(aGroup.aMembers.end()); - sal_Bool bFound(sal_False); - while (!bFound && aItr != aEndItr) - { - if (*aItr == aName) - bFound = sal_True; - else - ++aItr; - } - if (bFound) - aGroup.aMembers.erase(aItr); - else - throw container::NoSuchElementException(); + if( rName.getLength() == 0 ) + throw IllegalArgumentException(); + ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers; + ScFieldGroupMembers::iterator aIt = ::std::find( rMembers.begin(), rMembers.end(), rName ); + // throw if passed name does not exist + if( aIt == rMembers.end() ) + throw NoSuchElementException(); + rMembers.erase( aIt ); } -// XEnumerationAccess +// XIndexAccess -uno::Reference<container::XEnumeration> SAL_CALL ScDataPilotFieldGroupObj::createEnumeration() - throw(uno::RuntimeException) +sal_Int32 SAL_CALL ScDataPilotFieldGroupObj::getCount() throw(RuntimeException) { ScUnoGuard aGuard; - return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotFieldGroupEnumeration"))); + return static_cast< sal_Int32 >( mrParent.getFieldGroup( maGroupName ).maMembers.size() ); } -// XIndexAccess - -sal_Int32 SAL_CALL ScDataPilotFieldGroupObj::getCount() throw(uno::RuntimeException) +Any SAL_CALL ScDataPilotFieldGroupObj::getByIndex( sal_Int32 nIndex ) + throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - return aGroup.aMembers.size(); + ScFieldGroupMembers& rMembers = mrParent.getFieldGroup( maGroupName ).maMembers; + if ((nIndex < 0) || (nIndex >= static_cast< sal_Int32 >( rMembers.size() ))) + throw IndexOutOfBoundsException(); + return Any( Reference< XNamed >( new ScDataPilotFieldGroupItemObj( *this, rMembers[ nIndex ] ) ) ); } -uno::Any SAL_CALL ScDataPilotFieldGroupObj::getByIndex( sal_Int32 nIndex ) - throw(lang::IndexOutOfBoundsException, - lang::WrappedTargetException, uno::RuntimeException) +// XEnumerationAccess + +Reference< XEnumeration > SAL_CALL ScDataPilotFieldGroupObj::createEnumeration() throw(RuntimeException) { ScUnoGuard aGuard; - if (nIndex >= 0 && nIndex < sal::static_int_cast<sal_Int32>(aGroup.aMembers.size())) - return uno::makeAny(uno::Reference < container::XNamed > (new ScDataPilotFieldGroupItemObj(aGroup.aMembers[nIndex]))); - else - throw lang::IndexOutOfBoundsException(); + return new ScIndexEnumeration( this, OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.DataPilotFieldGroupEnumeration" ) ) ); } -uno::Type SAL_CALL ScDataPilotFieldGroupObj::getElementType() throw(uno::RuntimeException) +// XElementAccess + +uno::Type SAL_CALL ScDataPilotFieldGroupObj::getElementType() throw(RuntimeException) { ScUnoGuard aGuard; - return getCppuType((uno::Reference<container::XNamed>*)0); + return getCppuType( (Reference< XNamed >*)0 ); } -sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasElements() throw(uno::RuntimeException) +sal_Bool SAL_CALL ScDataPilotFieldGroupObj::hasElements() throw(RuntimeException) { ScUnoGuard aGuard; - return ( !aGroup.aMembers.empty() ); + return !mrParent.getFieldGroup( maGroupName ).maMembers.empty(); } // XNamed -::rtl::OUString SAL_CALL ScDataPilotFieldGroupObj::getName() throw(::com::sun::star::uno::RuntimeException) + +OUString SAL_CALL ScDataPilotFieldGroupObj::getName() throw(RuntimeException) { ScUnoGuard aGuard; - - return aGroup.sName; + return maGroupName; } -void SAL_CALL ScDataPilotFieldGroupObj::setName( const ::rtl::OUString& aName ) - throw(::com::sun::star::uno::RuntimeException) +void SAL_CALL ScDataPilotFieldGroupObj::setName( const OUString& rName ) throw(RuntimeException) { ScUnoGuard aGuard; - - aGroup.sName = aName; + mrParent.renameFieldGroup( maGroupName, rName ); + // if call to renameFieldGroup() did not throw, remember the new name + maGroupName = rName; } -//------------------------------------------------------------------------ +// ============================================================================ -ScDataPilotFieldGroupItemObj::ScDataPilotFieldGroupItemObj(const rtl::OUString& rName) - : sName(rName) +ScDataPilotFieldGroupItemObj::ScDataPilotFieldGroupItemObj( ScDataPilotFieldGroupObj& rParent, const OUString& rName ) : + mrParent( rParent ), + maName( rName ) { + mrParent.acquire(); } ScDataPilotFieldGroupItemObj::~ScDataPilotFieldGroupItemObj() { + mrParent.release(); } - // XNamed -::rtl::OUString SAL_CALL ScDataPilotFieldGroupItemObj::getName() throw(::com::sun::star::uno::RuntimeException) +// XNamed + +OUString SAL_CALL ScDataPilotFieldGroupItemObj::getName() throw(RuntimeException) { ScUnoGuard aGuard; - - return sName; + return maName; } -void SAL_CALL ScDataPilotFieldGroupItemObj::setName( const ::rtl::OUString& aName ) - throw(::com::sun::star::uno::RuntimeException) +void SAL_CALL ScDataPilotFieldGroupItemObj::setName( const OUString& rName ) throw(RuntimeException) { ScUnoGuard aGuard; - - sName = aName; + mrParent.replaceByName( maName, Any( rName ) ); + // if call to replaceByName() did not throw, remember the new name + maName = rName; } -//------------------------------------------------------------------------ +// ============================================================================ -ScDataPilotItemsObj::ScDataPilotItemsObj(ScDataPilotDescriptorBase* pPar, const ScFieldIdentifier& rIdent) : - pParent( pPar ), - aSourceIdent( rIdent ) +ScDataPilotItemsObj::ScDataPilotItemsObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ) : + ScDataPilotChildObjBase( rParent, rFieldId ) { - pParent->acquire(); } ScDataPilotItemsObj::~ScDataPilotItemsObj() { - pParent->release(); } -SCSIZE lcl_GetItemCount( ScDataPilotDescriptorBase* pParent, const ScFieldIdentifier& rIdent ) -{ - SCSIZE nRet = 0; - - uno::Reference<container::XNameAccess> xMembers; - if (lcl_GetMembers(pParent, rIdent, xMembers)) - { - uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers )); - nRet = static_cast<SCSIZE>(xMembersIndex->getCount()); - } +// XDataPilotItems - return nRet; -} - -// XDataPilotItemss - -ScDataPilotItemObj* ScDataPilotItemsObj::GetObjectByIndex_Impl(SCSIZE nIndex) const +ScDataPilotItemObj* ScDataPilotItemsObj::GetObjectByIndex_Impl( sal_Int32 nIndex ) const { -// TODO - if (nIndex < lcl_GetItemCount(pParent, aSourceIdent)) - return new ScDataPilotItemObj( pParent, aSourceIdent, nIndex ); - - return NULL; + return ((0 <= nIndex) && (nIndex < GetMemberCount())) ? + new ScDataPilotItemObj( mrParent, maFieldId, nIndex ) : 0; } // XNameAccess -uno::Any SAL_CALL ScDataPilotItemsObj::getByName( const rtl::OUString& aName ) - throw(container::NoSuchElementException, - lang::WrappedTargetException, uno::RuntimeException) +Any SAL_CALL ScDataPilotItemsObj::getByName( const OUString& aName ) + throw(NoSuchElementException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - + Reference<XNameAccess> xMembers = GetMembers(); + if (xMembers.is()) { - uno::Reference<container::XNameAccess> xMembers; - if (lcl_GetMembers(pParent, aSourceIdent, xMembers)) + Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers )); + sal_Int32 nCount = xMembersIndex->getCount(); + sal_Bool bFound(sal_False); + sal_Int32 nItem = 0; + while (nItem < nCount && !bFound ) { - uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers )); - sal_Int32 nCount = xMembersIndex->getCount(); - sal_Bool bFound(sal_False); - sal_Int32 nItem = 0; - while (nItem < nCount && !bFound ) - { - uno::Reference<container::XNamed> xMember(xMembersIndex->getByIndex(nItem), uno::UNO_QUERY); - if (xMember.is() && aName == xMember->getName()) - return uno::makeAny(uno::Reference<beans::XPropertySet> (GetObjectByIndex_Impl(static_cast<SCSIZE>(nItem)))); - else - nItem++; - } - if (!bFound) - throw container::NoSuchElementException(); + Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY); + if (xMember.is() && (aName == xMember->getName())) + return Any( Reference< XPropertySet >( GetObjectByIndex_Impl( nItem ) ) ); + ++nItem; } + if (!bFound) + throw NoSuchElementException(); } - - return uno::Any(); + return Any(); } -uno::Sequence<rtl::OUString> SAL_CALL ScDataPilotItemsObj::getElementNames() - throw(uno::RuntimeException) +Sequence<OUString> SAL_CALL ScDataPilotItemsObj::getElementNames() + throw(RuntimeException) { ScUnoGuard aGuard; -// TODO - - uno::Sequence<rtl::OUString> aSeq; - if( ScDPObject* pDPObj = pParent->GetDPObject() ) - { - sal_Int32 nObjIndex = lcl_GetObjectIndex( pDPObj, aSourceIdent ); - pDPObj->GetMembers( nObjIndex, aSeq ); - } + Sequence< OUString > aSeq; + if( ScDPObject* pDPObj = GetDPObject() ) + pDPObj->GetMembers( lcl_GetObjectIndex( pDPObj, maFieldId ), aSeq ); return aSeq; } -sal_Bool SAL_CALL ScDataPilotItemsObj::hasByName( const rtl::OUString& aName ) - throw(uno::RuntimeException) +sal_Bool SAL_CALL ScDataPilotItemsObj::hasByName( const OUString& aName ) + throw(RuntimeException) { ScUnoGuard aGuard; - - sal_Bool bFound(sal_False); + sal_Bool bFound = sal_False; + Reference<XNameAccess> xMembers = GetMembers(); + if (xMembers.is()) { - uno::Reference<container::XNameAccess> xMembers; - if (lcl_GetMembers(pParent, aSourceIdent, xMembers)) + Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers )); + sal_Int32 nCount = xMembersIndex->getCount(); + sal_Int32 nItem = 0; + while (nItem < nCount && !bFound ) { - uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers )); - sal_Int32 nCount = xMembersIndex->getCount(); - sal_Int32 nItem = 0; - while (nItem < nCount && !bFound ) - { - uno::Reference<container::XNamed> xMember(xMembersIndex->getByIndex(nItem), uno::UNO_QUERY); - if (xMember.is() && aName == xMember->getName()) - bFound = sal_True; - else - nItem++; - } + Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY); + if (xMember.is() && aName == xMember->getName()) + bFound = sal_True; + else + nItem++; } } - return bFound; } // XEnumerationAccess -uno::Reference<container::XEnumeration> SAL_CALL ScDataPilotItemsObj::createEnumeration() - throw(uno::RuntimeException) +Reference<XEnumeration> SAL_CALL ScDataPilotItemsObj::createEnumeration() + throw(RuntimeException) { ScUnoGuard aGuard; - return new ScIndexEnumeration(this, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotItemsEnumeration"))); + return new ScIndexEnumeration(this, OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.DataPilotItemsEnumeration"))); } // XIndexAccess -sal_Int32 SAL_CALL ScDataPilotItemsObj::getCount() throw(uno::RuntimeException) +sal_Int32 SAL_CALL ScDataPilotItemsObj::getCount() throw(RuntimeException) { ScUnoGuard aGuard; -// TODO - return static_cast<sal_Int32>(lcl_GetItemCount( pParent, aSourceIdent )); + return GetMemberCount(); } -uno::Any SAL_CALL ScDataPilotItemsObj::getByIndex( sal_Int32 nIndex ) - throw(lang::IndexOutOfBoundsException, - lang::WrappedTargetException, uno::RuntimeException) +Any SAL_CALL ScDataPilotItemsObj::getByIndex( sal_Int32 nIndex ) + throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - uno::Reference<beans::XPropertySet> xItem(GetObjectByIndex_Impl(static_cast<SCSIZE>(nIndex))); - if (xItem.is()) - return uno::makeAny(xItem); - else - throw lang::IndexOutOfBoundsException(); + Reference< XPropertySet > xItem( GetObjectByIndex_Impl( nIndex ) ); + if (!xItem.is()) + throw IndexOutOfBoundsException(); + return Any( xItem ); } -uno::Type SAL_CALL ScDataPilotItemsObj::getElementType() throw(uno::RuntimeException) +uno::Type SAL_CALL ScDataPilotItemsObj::getElementType() throw(RuntimeException) { ScUnoGuard aGuard; - return getCppuType((uno::Reference<beans::XPropertySet>*)0); + return getCppuType((Reference<XPropertySet>*)0); } -sal_Bool SAL_CALL ScDataPilotItemsObj::hasElements() throw(uno::RuntimeException) +sal_Bool SAL_CALL ScDataPilotItemsObj::hasElements() throw(RuntimeException) { ScUnoGuard aGuard; return ( getCount() != 0 ); @@ -3305,92 +3137,77 @@ sal_Bool SAL_CALL ScDataPilotItemsObj::hasElements() throw(uno::RuntimeException //------------------------------------------------------------------------ -ScDataPilotItemObj::ScDataPilotItemObj(ScDataPilotDescriptorBase* pPar, const ScFieldIdentifier& rIdent, SCSIZE nI) - : aPropSet( lcl_GetDataPilotItemMap() ), - pParent(pPar), - aSourceIdent(rIdent), - nIndex(nI) +ScDataPilotItemObj::ScDataPilotItemObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId, sal_Int32 nIndex ) : + ScDataPilotChildObjBase( rParent, rFieldId ), + maPropSet( lcl_GetDataPilotItemMap() ), + mnIndex( nIndex ) { - pParent->acquire(); } ScDataPilotItemObj::~ScDataPilotItemObj() { - pParent->release(); } // XNamed -::rtl::OUString SAL_CALL ScDataPilotItemObj::getName() throw(::com::sun::star::uno::RuntimeException) +OUString SAL_CALL ScDataPilotItemObj::getName() throw(RuntimeException) { ScUnoGuard aGuard; - rtl::OUString sRet; - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + OUString sRet; + Reference<XNameAccess> xMembers = GetMembers(); + if (xMembers.is()) { - uno::Reference<container::XNameAccess> xMembers; - if (lcl_GetMembers(pParent, aSourceIdent, xMembers)) + Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers )); + sal_Int32 nCount = xMembersIndex->getCount(); + if (mnIndex < nCount) { - uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers )); - sal_Int32 nCount = xMembersIndex->getCount(); - if (nIndex < static_cast<SCSIZE>(nCount)) - { - uno::Reference<container::XNamed> xMember(xMembersIndex->getByIndex(static_cast<sal_Int32>(nIndex)), uno::UNO_QUERY); - sRet = xMember->getName(); - } + Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY); + sRet = xMember->getName(); } } return sRet; } -void SAL_CALL ScDataPilotItemObj::setName( const ::rtl::OUString& /* aName */ ) - throw(::com::sun::star::uno::RuntimeException) +void SAL_CALL ScDataPilotItemObj::setName( const OUString& /* aName */ ) + throw(RuntimeException) { } // XPropertySet -::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > +Reference< XPropertySetInfo > SAL_CALL ScDataPilotItemObj::getPropertySetInfo( ) - throw(::com::sun::star::uno::RuntimeException) + throw(RuntimeException) { ScUnoGuard aGuard; - static uno::Reference<beans::XPropertySetInfo> aRef = - new SfxItemPropertySetInfo( aPropSet.getPropertyMap() ); + static Reference<XPropertySetInfo> aRef = + new SfxItemPropertySetInfo( maPropSet.getPropertyMap() ); return aRef; } -void SAL_CALL ScDataPilotItemObj::setPropertyValue( const ::rtl::OUString& aPropertyName, - const ::com::sun::star::uno::Any& aValue ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::beans::PropertyVetoException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) +void SAL_CALL ScDataPilotItemObj::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) + throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - String aNameString = aPropertyName; - - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + ScDPObject* pDPObj = 0; + if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) ) { - uno::Reference<container::XNameAccess> xMembers; - ScDPSaveDimension* pDim = NULL; - if (lcl_GetMembers(pParent, aSourceIdent, xMembers) && lcl_GetDim(pDPObj, aSourceIdent, pDim)) + Reference<XNameAccess> xMembers = GetMembers(); + if( xMembers.is() ) { - uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers )); + Reference<XIndexAccess> xMembersIndex( new ScNameToIndexAccess( xMembers ) ); sal_Int32 nCount = xMembersIndex->getCount(); - if (nIndex < static_cast<SCSIZE>(nCount) ) + if( mnIndex < nCount ) { - uno::Reference<container::XNamed> xMember(xMembersIndex->getByIndex(static_cast<sal_Int32>(nIndex)), uno::UNO_QUERY); + Reference<XNamed> xMember(xMembersIndex->getByIndex(mnIndex), UNO_QUERY); String sName(xMember->getName()); ScDPSaveMember* pMember = pDim->GetMemberByName(sName); if (pMember) { bool bGetNewIndex = false; - if ( aNameString.EqualsAscii( SC_UNONAME_SHOWDETAIL ) ) + if ( aPropertyName.equalsAscii( SC_UNONAME_SHOWDETAIL ) ) pMember->SetShowDetails(cppu::any2bool(aValue)); - else if ( aNameString.EqualsAscii( SC_UNONAME_ISHIDDEN ) ) + else if ( aPropertyName.equalsAscii( SC_UNONAME_ISHIDDEN ) ) pMember->SetIsVisible(!cppu::any2bool(aValue)); - else if ( aNameString.EqualsAscii( SC_UNONAME_POS ) ) + else if ( aPropertyName.equalsAscii( SC_UNONAME_POS ) ) { sal_Int32 nNewPos = 0; if ( ( aValue >>= nNewPos ) && nNewPos >= 0 && nNewPos < nCount ) @@ -3400,18 +3217,18 @@ void SAL_CALL ScDataPilotItemObj::setPropertyValue( const ::rtl::OUString& aProp bGetNewIndex = true; } else - throw lang::IllegalArgumentException(); + throw IllegalArgumentException(); } - pParent->SetDPObject(pDPObj); + SetDPObject( pDPObj ); if ( bGetNewIndex ) // after SetDPObject, get the new index { - rtl::OUString aOUName( sName ); - uno::Sequence<rtl::OUString> aItemNames = xMembers->getElementNames(); + OUString aOUName( sName ); + Sequence< OUString > aItemNames = xMembers->getElementNames(); sal_Int32 nItemCount = aItemNames.getLength(); for (sal_Int32 nItem=0; nItem<nItemCount; ++nItem) if (aItemNames[nItem] == aOUName) - nIndex = nItem; + mnIndex = nItem; } } } @@ -3419,67 +3236,56 @@ void SAL_CALL ScDataPilotItemObj::setPropertyValue( const ::rtl::OUString& aProp } } -::com::sun::star::uno::Any SAL_CALL ScDataPilotItemObj::getPropertyValue( - const ::rtl::OUString& aPropertyName ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) +Any SAL_CALL ScDataPilotItemObj::getPropertyValue( const OUString& aPropertyName ) + throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { ScUnoGuard aGuard; - uno::Any aRet; - String aNameString = aPropertyName; - - ScDPObject* pDPObj(pParent->GetDPObject()); - if (pDPObj) + Any aRet; + if( ScDPSaveDimension* pDim = GetDPDimension() ) { - uno::Reference<container::XNameAccess> xMembers; - ScDPSaveDimension* pDim = NULL; - if (lcl_GetMembers(pParent, aSourceIdent, xMembers) && lcl_GetDim(pDPObj, aSourceIdent, pDim)) + Reference< XNameAccess > xMembers = GetMembers(); + if( xMembers.is() ) { - uno::Reference<container::XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers )); + Reference< XIndexAccess > xMembersIndex( new ScNameToIndexAccess( xMembers ) ); sal_Int32 nCount = xMembersIndex->getCount(); - if (nIndex < static_cast<SCSIZE>(nCount) ) + if( mnIndex < nCount ) { - uno::Reference<container::XNamed> xMember(xMembersIndex->getByIndex(static_cast<sal_Int32>(nIndex)), uno::UNO_QUERY); - String sName(xMember->getName()); - ScDPSaveMember* pMember = pDim->GetExistingMemberByName(sName); - if ( aNameString.EqualsAscii( SC_UNONAME_SHOWDETAIL ) ) + Reference< XNamed > xMember( xMembersIndex->getByIndex( mnIndex ), UNO_QUERY ); + String sName( xMember->getName() ); + ScDPSaveMember* pMember = pDim->GetExistingMemberByName( sName ); + if( aPropertyName.equalsAscii( SC_UNONAME_SHOWDETAIL ) ) { if (pMember && pMember->HasShowDetails()) { - aRet = cppu::bool2any(pMember->GetShowDetails()); + aRet <<= (bool)pMember->GetShowDetails(); } else { - uno::Reference<beans::XPropertySet> xMemberProps(xMember, uno::UNO_QUERY); - if(xMemberProps.is()) - { - aRet = xMemberProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_SHOWDETA))); - } + Reference< XPropertySet > xMemberProps( xMember, UNO_QUERY ); + if( xMemberProps.is() ) + aRet = xMemberProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_SHOWDETA ) ) ); else - aRet = cppu::bool2any(sal_True); + aRet <<= true; } } - else if ( aNameString.EqualsAscii( SC_UNONAME_ISHIDDEN ) ) + else if ( aPropertyName.equalsAscii( SC_UNONAME_ISHIDDEN ) ) { if (pMember && pMember->HasIsVisible()) { - aRet = cppu::bool2any(!pMember->GetIsVisible()); + aRet <<= !pMember->GetIsVisible(); } else { - uno::Reference<beans::XPropertySet> xMemberProps(xMember, uno::UNO_QUERY); - if(xMemberProps.is()) - { - aRet = cppu::bool2any(!cppu::any2bool(xMemberProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ISVISIBL))))); - } + Reference< XPropertySet > xMemberProps( xMember, UNO_QUERY ); + if( xMemberProps.is() ) + aRet <<= !cppu::any2bool( xMemberProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_ISVISIBL ) ) ) ); else - aRet = cppu::bool2any(sal_False); + aRet <<= false; } } - else if ( aNameString.EqualsAscii( SC_UNONAME_POS ) ) + else if ( aPropertyName.equalsAscii( SC_UNONAME_POS ) ) { - aRet <<= static_cast<sal_Int32>( nIndex ); + aRet <<= mnIndex; } } } @@ -3487,39 +3293,27 @@ void SAL_CALL ScDataPilotItemObj::setPropertyValue( const ::rtl::OUString& aProp return aRet; } -void SAL_CALL ScDataPilotItemObj::addPropertyChangeListener( const ::rtl::OUString& /* aPropertyName */, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertyChangeListener >& /* xListener */ ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) +void SAL_CALL ScDataPilotItemObj::addPropertyChangeListener( + const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* xListener */ ) + throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { } -void SAL_CALL ScDataPilotItemObj::removePropertyChangeListener( const ::rtl::OUString& /* aPropertyName */, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertyChangeListener >& /* aListener */ ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) +void SAL_CALL ScDataPilotItemObj::removePropertyChangeListener( + const OUString& /* aPropertyName */, const Reference< XPropertyChangeListener >& /* aListener */ ) + throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { } -void SAL_CALL ScDataPilotItemObj::addVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XVetoableChangeListener >& /* aListener */ ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) +void SAL_CALL ScDataPilotItemObj::addVetoableChangeListener( + const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ ) + throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { } -void SAL_CALL ScDataPilotItemObj::removeVetoableChangeListener( const ::rtl::OUString& /* PropertyName */, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XVetoableChangeListener >& /* aListener */ ) - throw(::com::sun::star::beans::UnknownPropertyException, - ::com::sun::star::lang::WrappedTargetException, - ::com::sun::star::uno::RuntimeException) +void SAL_CALL ScDataPilotItemObj::removeVetoableChangeListener( + const OUString& /* PropertyName */, const Reference< XVetoableChangeListener >& /* aListener */ ) + throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index a82319b7b6cd..a327675fe0ee 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1402,14 +1402,13 @@ void SAL_CALL ScModelObj::setPropertyValue( } else if ( aString.EqualsAscii( SC_UNO_ISADJUSTHEIGHTENABLED ) ) { + bool bOldAdjustHeightEnabled = pDoc->IsAdjustHeightEnabled(); bool bAdjustHeightEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue ); - pDoc->EnableAdjustHeight( bAdjustHeightEnabled ); - if ( bAdjustHeightEnabled ) + if( bOldAdjustHeightEnabled != bAdjustHeightEnabled ) { - for ( SCTAB nTab = 0; nTab < pDoc->GetTableCount(); ++nTab ) - { - pDocShell->AdjustRowHeight( 0, MAXROW, nTab ); - } + pDoc->EnableAdjustHeight( bAdjustHeightEnabled ); + if( bAdjustHeightEnabled ) + pDocShell->UpdateAllRowHeights(); } } else if ( aString.EqualsAscii( SC_UNO_ISEXECUTELINKENABLED ) ) diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index a569e04ea238..4bb33a4c7855 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -903,8 +903,8 @@ void ScCellShell::Execute( SfxRequest& rReq ) pTabViewShell->ResetBrushDocument(); // abort format paint brush else if (pTabViewShell->HasHintWindow()) pTabViewShell->RemoveHintWindow(); // Eingabemeldung abschalten - else if( IsFullScreen() ) - SetFullScreen( false ); + else if( ScViewUtil::IsFullScreen( *pTabViewShell ) ) + ScViewUtil::SetFullScreen( *pTabViewShell, false ); else { // TODO/LATER: when is this code executed? @@ -971,27 +971,3 @@ void ScCellShell::Execute( SfxRequest& rReq ) } } -bool ScCellShell::IsFullScreen() const -{ - USHORT nSlot = SID_WIN_FULLSCREEN; - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); - SfxBindings& rBindings = pTabViewShell->GetViewFrame()->GetBindings(); - SfxPoolItem* pItem = 0; - bool bIsFullScreen = false; - - if (rBindings.QueryState( nSlot, pItem ) >= SFX_ITEM_DEFAULT) - bIsFullScreen = static_cast< SfxBoolItem* >( pItem )->GetValue(); - return bIsFullScreen; -} - -void ScCellShell::SetFullScreen( bool bSet ) -{ - if( IsFullScreen() != bSet ) - { - ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); - SfxBoolItem aItem( SID_WIN_FULLSCREEN, bSet ); - pTabViewShell->GetDispatcher()->Execute( SID_WIN_FULLSCREEN, SFX_CALLMODE_RECORD, &aItem, 0L ); - } -} - - diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index a83ef83d3ec9..8dcb47c927a2 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -949,25 +949,6 @@ BOOL ScDBFunc::HasSelectionForNumGroup( ScDPNumGroupInfo& rOldInfo ) return bFound; } -String lcl_GetDatePartName( sal_Int32 nPart ) -{ - String aRet; //! globstr-ID - switch (nPart) - { - //! use translated strings from globstr.src - case com::sun::star::sheet::DataPilotFieldGroupBy::SECONDS: aRet = String::CreateFromAscii("Seconds"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::MINUTES: aRet = String::CreateFromAscii("Minutes"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::HOURS: aRet = String::CreateFromAscii("Hours"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::DAYS: aRet = String::CreateFromAscii("Days"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS: aRet = String::CreateFromAscii("Months"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::QUARTERS: aRet = String::CreateFromAscii("Quarters"); break; - case com::sun::star::sheet::DataPilotFieldGroupBy::YEARS: aRet = String::CreateFromAscii("Years"); break; - default: - DBG_ERROR("invalid date part"); - } - return aRet; -} - void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nParts ) { ScDPObject* pDPObj = GetViewData()->GetDocument()->GetDPAtCursor( GetViewData()->GetCurX(), @@ -987,25 +968,22 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar ScDPDimensionSaveData* pDimData = aData.GetDimensionData(); // created if not there // find original base - String aBaseDimName( aDimName ); - const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName ); - if ( pBaseGroupDim ) - { - // any entry's SourceDimName is the original base + String aBaseDimName = aDimName; + if( const ScDPSaveGroupDimension* pBaseGroupDim = pDimData->GetNamedGroupDim( aDimName ) ) aBaseDimName = pBaseGroupDim->GetSourceDimName(); - } // remove all existing parts (the grouping is built completely new) - const ScDPSaveNumGroupDimension* pExistingNum = pDimData->GetNumGroupDim( aBaseDimName ); - if ( pExistingNum ) - { - pDimData->RemoveNumGroupDimension( aBaseDimName ); - // no changed names - SaveData is not affected - } - - std::vector<String> aDeletedNames; + /* Remove numeric group dimension (exists once at most). No need + to delete anything in save data (grouping was done inplace in + an existing base dimension). */ + pDimData->RemoveNumGroupDimension( aBaseDimName ); + /* Remove named group dimension(s). Collect deleted dimension + names which may be reused while recreating the groups. + Dimensions have to be removed from dimension save data and from + save data too. */ + std::vector< String > aDeletedNames; const ScDPSaveGroupDimension* pExistingGroup = pDimData->GetGroupDimForBase( aBaseDimName ); while ( pExistingGroup ) { @@ -1015,8 +993,8 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar // also remove SaveData settings for the dimension that no longer exists aData.RemoveDimensionByName( aGroupDimName ); - // the name can be used for the new group dimensions, although it is still in use - // with the DataPilotSource + /* The name can be used for the new group dimensions, although + it is still in use with the DataPilotSource. */ aDeletedNames.push_back( aGroupDimName ); // see if there are more group dimensions @@ -1046,7 +1024,7 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar // innermost part: create NumGroupDimension (replacing original values) // Dimension name is left unchanged - if ( nParts == com::sun::star::sheet::DataPilotFieldGroupBy::DAYS && rInfo.Step != 0.0 ) + if ( (nParts == sheet::DataPilotFieldGroupBy::DAYS) && (rInfo.Step >= 1.0) ) { // only days, and a step value specified: use numerical grouping // with DateValues flag, not date grouping @@ -1059,8 +1037,7 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar } else { - ScDPSaveNumGroupDimension aNumGroupDim( aBaseDimName, aEmpty ); - aNumGroupDim.SetDateInfo( rInfo, nMask ); + ScDPSaveNumGroupDimension aNumGroupDim( aBaseDimName, rInfo, nMask ); pDimData->AddNumGroupDimension( aNumGroupDim ); } @@ -1069,10 +1046,7 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar else { // additional parts: create GroupDimension (shown as additional dimensions) - - String aPartName = lcl_GetDatePartName( nMask ); - String aGroupDimName = pDimData->CreateGroupDimName( - aPartName, *pDPObj, true, &aDeletedNames ); + String aGroupDimName = pDimData->CreateDateGroupDimName( nMask, *pDPObj, true, &aDeletedNames ); ScDPSaveGroupDimension aGroupDim( aBaseDimName, aGroupDimName ); aGroupDim.SetDateInfo( rInfo, nMask ); pDimData->AddGroupDimension( aGroupDim ); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 2215cbd4d1af..b2f3e12d1ee6 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1093,7 +1093,12 @@ void ScFormatShell::ExecuteAlignment( SfxRequest& rReq ) break; case SID_H_ALIGNCELL: - pTabViewShell->ApplyAttr( SvxHorJustifyItem( (SvxCellHorJustify)((const SvxHorJustifyItem*)pItem)->GetValue(), ATTR_HOR_JUSTIFY ) ); + { + SvxCellHorJustify eJust = (SvxCellHorJustify)((const SvxHorJustifyItem*)pItem)->GetValue(); + // #i78476# update alignment of text in cell edit mode + pTabViewShell->UpdateInputHandlerCellAdjust( eJust ); + pTabViewShell->ApplyAttr( SvxHorJustifyItem( eJust, ATTR_HOR_JUSTIFY ) ); + } break; case SID_V_ALIGNCELL: pTabViewShell->ApplyAttr( SvxVerJustifyItem( (SvxCellVerJustify)((const SvxVerJustifyItem*)pItem)->GetValue(), ATTR_VER_JUSTIFY ) ); diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index b638b89b7a65..2906440d7e5a 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -76,6 +76,7 @@ #include <com/sun/star/accessibility/XAccessible.hpp> #include "AccessibilityHints.hxx" #include <vcl/svapp.hxx> +#include "viewutil.hxx" // STATIC DATA ----------------------------------------------------------- @@ -696,7 +697,7 @@ void __EXPORT ScPreview::KeyInput( const KeyEvent& rKEvt ) switch(nKey) { case KEY_ADD: nSlot = SID_PREVIEW_ZOOMIN; break; - case KEY_ESCAPE: nSlot = SID_PREVIEW_CLOSE; break; + case KEY_ESCAPE: nSlot = ScViewUtil::IsFullScreen( *pViewShell ) ? SID_CANCEL : SID_PREVIEW_CLOSE; break; case KEY_SUBTRACT: nSlot = SID_PREVIEW_ZOOMOUT; break; } if(nSlot) diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index ae316bcee196..360c05e2f84a 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -827,6 +827,10 @@ void __EXPORT ScPreviewShell::Execute( SfxRequest& rReq ) case SID_CURSORRIGHT: DoScroll( nSlot ); break; + case SID_CANCEL: + if( ScViewUtil::IsFullScreen( *this ) ) + ScViewUtil::SetFullScreen( *this, false ); + break; default: break; diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index cd28936afe98..d10f9ecb222a 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: tabvwsha.cxx,v $ - * $Revision: 1.28 $ + * $Revision: 1.28.14.1 $ * * This file is part of OpenOffice.org. * @@ -675,6 +675,12 @@ void ScTabViewShell::UpdateInputHandler( BOOL bForce /* = FALSE */, BOOL bStopEd rBindings.Invalidate( SID_TABLE_CELL ); } +void ScTabViewShell::UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust ) +{ + if( ScInputHandler* pHdl = pInputHandler ? pInputHandler : SC_MOD()->GetInputHdl() ) + pHdl->UpdateCellAdjust( eJust ); +} + //------------------------------------------------------------------ void __EXPORT ScTabViewShell::ExecuteSave( SfxRequest& rReq ) diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index 6436026613e4..0dc2a2f960f6 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -37,6 +37,8 @@ #include <tools/list.hxx> #include "scitems.hxx" #include <sfx2/bindings.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/dispatch.hxx> #include <svx/charmap.hxx> #include <svx/fontitem.hxx> #include <svx/langitem.hxx> @@ -393,6 +395,26 @@ BOOL ScViewUtil::ExecuteCharMap( const SvxFontItem& rOldFont, return bRet; } +bool ScViewUtil::IsFullScreen( SfxViewShell& rViewShell ) +{ + SfxBindings& rBindings = rViewShell.GetViewFrame()->GetBindings(); + SfxPoolItem* pItem = 0; + bool bIsFullScreen = false; + + if (rBindings.QueryState( SID_WIN_FULLSCREEN, pItem ) >= SFX_ITEM_DEFAULT) + bIsFullScreen = static_cast< SfxBoolItem* >( pItem )->GetValue(); + return bIsFullScreen; +} + +void ScViewUtil::SetFullScreen( SfxViewShell& rViewShell, bool bSet ) +{ + if( IsFullScreen( rViewShell ) != bSet ) + { + SfxBoolItem aItem( SID_WIN_FULLSCREEN, bSet ); + rViewShell.GetDispatcher()->Execute( SID_WIN_FULLSCREEN, SFX_CALLMODE_RECORD, &aItem, 0L ); + } +} + //------------------------------------------------------------------ ScUpdateRect::ScUpdateRect( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 ) |