From b37c10a1019a40cb906fdb98693e44306d44fed2 Mon Sep 17 00:00:00 2001 From: Release Engineers Date: Fri, 7 Aug 2009 12:33:11 +0000 Subject: CWS-TOOLING: integrate CWS calcooo311_DEV300 2009-08-04 13:55:19 +0200 er r274617 : #i102356# add patch flag for i18npool lib 2009-08-03 17:29:15 +0200 dr r274589 : #i103968# ported fix from DEV300, new pie charts lose point color 2009-07-29 23:20:00 +0200 er r274467 : #i103861# Shared formula and named range relative reference wrap with different grid sizes; patch from --- sc/inc/compiler.hxx | 6 +++--- sc/inc/rangenam.hxx | 10 +++++++++ sc/source/core/data/cell2.cxx | 6 +++--- sc/source/core/inc/refupdat.hxx | 2 +- sc/source/core/tool/compiler.cxx | 22 +++++++++---------- sc/source/core/tool/rangenam.cxx | 42 ++++++++++++++++++++++++++++++------ sc/source/core/tool/refupdat.cxx | 10 ++++----- sc/source/filter/excel/namebuff.cxx | 3 +++ sc/source/filter/excel/xeformula.cxx | 2 +- 9 files changed, 72 insertions(+), 31 deletions(-) diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 058b3b30f30a..76293479660c 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -409,9 +409,9 @@ public: const ScDocument* GetDoc() const { return pDoc; } const ScAddress& GetPos() const { return aPos; } - void MoveRelWrap(); - static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, - const ScAddress& rPos ); + void MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow ); + static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos, + SCCOL nMaxCol, SCROW nMaxRow ); BOOL UpdateNameReference( UpdateRefMode eUpdateRefMode, const ScRange&, diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx index 962aff918e7b..002adf9b77ce 100644 --- a/sc/inc/rangenam.hxx +++ b/sc/inc/rangenam.hxx @@ -81,6 +81,11 @@ private: USHORT nIndex; BOOL bModified; // wird bei UpdateReference gesetzt/geloescht + // max row and column to use for wrapping of references. If -1 use the + // application's default. + SCROW mnMaxRow; + SCCOL mnMaxCol; + friend class ScRangeName; ScRangeData( USHORT nIndex ); public: @@ -153,6 +158,11 @@ public: static void MakeValidName( String& rName ); SC_DLLPUBLIC static BOOL IsNameValid( const String& rName, ScDocument* pDoc ); + + SC_DLLPUBLIC void SetMaxRow(SCROW nRow); + SCROW GetMaxRow() const; + SC_DLLPUBLIC void SetMaxCol(SCCOL nCol); + SCCOL GetMaxCol() const; }; inline BOOL ScRangeData::HasType( RangeType nType ) const diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx index 2a1525b76401..a0e776458ca2 100644 --- a/sc/source/core/data/cell2.cxx +++ b/sc/source/core/data/cell2.cxx @@ -1067,7 +1067,7 @@ void ScFormulaCell::UpdateInsertTab(SCTAB nTable) pCode = new ScTokenArray( *pRangeData->GetCode() ); ScCompiler aComp2(pDocument, aPos, *pCode); aComp2.SetGrammar(pDocument->GetGrammar()); - aComp2.MoveRelWrap(); + aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow()); aComp2.UpdateInsertTab( nTable, FALSE ); // If the shared formula contained a named range/formula containing // an absolute reference to a sheet, those have to be readjusted. @@ -1103,7 +1103,7 @@ BOOL ScFormulaCell::UpdateDeleteTab(SCTAB nTable, BOOL bIsMove) ScCompiler aComp2(pDocument, aPos, *pCode); aComp2.SetGrammar(pDocument->GetGrammar()); aComp2.CompileTokenArray(); - aComp2.MoveRelWrap(); + aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow()); aComp2.UpdateDeleteTab( nTable, FALSE, FALSE, bRefChanged ); // If the shared formula contained a named range/formula containing // an absolute reference to a sheet, those have to be readjusted. @@ -1140,7 +1140,7 @@ void ScFormulaCell::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo ) ScCompiler aComp2(pDocument, aPos, *pCode); aComp2.SetGrammar(pDocument->GetGrammar()); aComp2.CompileTokenArray(); - aComp2.MoveRelWrap(); + aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow()); aComp2.UpdateMoveTab( nOldPos, nNewPos, TRUE ); bCompile = TRUE; } diff --git a/sc/source/core/inc/refupdat.hxx b/sc/source/core/inc/refupdat.hxx index 0461578db0a6..2a8b17335fbf 100644 --- a/sc/source/core/inc/refupdat.hxx +++ b/sc/source/core/inc/refupdat.hxx @@ -82,7 +82,7 @@ public: ScComplexRefData& rRef, BOOL bWrap, BOOL bAbsolute ); static void MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos, - ScComplexRefData& rRef ); + SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef ); /// Before calling, the absolute references must be up-to-date! static ScRefUpdateRes UpdateTranspose( ScDocument* pDoc, diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 2b66663f3ee9..bc2266cbd3c8 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3959,7 +3959,7 @@ BOOL ScCompiler::HandleRange() if( pRangeData->HasReferences() ) { SetRelNameReference(); - MoveRelWrap(); + MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow()); } pNew->Reset(); if ( bAddPair ) @@ -4011,7 +4011,7 @@ BOOL ScCompiler::HandleExternalReference(const FormulaToken& _aToken) if (pNew->GetNextReference() != NULL) { SetRelNameReference(); - MoveRelWrap(); + MoveRelWrap(MAXCOL, MAXROW); } pNew->Reset(); return GetToken(); @@ -4106,33 +4106,33 @@ void ScCompiler::SetRelNameReference() // Wrap-adjust relative references of a RangeName to current position, // don't call for other token arrays! -void ScCompiler::MoveRelWrap() +void ScCompiler::MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow ) { pArr->Reset(); for( ScToken* t = static_cast(pArr->GetNextReference()); t; t = static_cast(pArr->GetNextReference()) ) { if ( t->GetType() == svSingleRef || t->GetType() == svExternalSingleRef ) - ScRefUpdate::MoveRelWrap( pDoc, aPos, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() ); + ScRefUpdate::MoveRelWrap( pDoc, aPos, nMaxCol, nMaxRow, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() ); else - ScRefUpdate::MoveRelWrap( pDoc, aPos, t->GetDoubleRef() ); + ScRefUpdate::MoveRelWrap( pDoc, aPos, nMaxCol, nMaxRow, t->GetDoubleRef() ); } } // static // Wrap-adjust relative references of a RangeName to current position, // don't call for other token arrays! -void ScCompiler::MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, - const ScAddress& rPos ) +void ScCompiler::MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos, + SCCOL nMaxCol, SCROW nMaxRow ) { rArr.Reset(); for( ScToken* t = static_cast(rArr.GetNextReference()); t; t = static_cast(rArr.GetNextReference()) ) { if ( t->GetType() == svSingleRef || t->GetType() == svExternalSingleRef ) - ScRefUpdate::MoveRelWrap( pDoc, rPos, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() ); + ScRefUpdate::MoveRelWrap( pDoc, rPos, nMaxCol, nMaxRow, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() ); else - ScRefUpdate::MoveRelWrap( pDoc, rPos, t->GetDoubleRef() ); + ScRefUpdate::MoveRelWrap( pDoc, rPos, nMaxCol, nMaxRow, t->GetDoubleRef() ); } } @@ -4307,7 +4307,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode, SingleDoubleRefModifier aMod( rRef ); if ( rRef.IsRelName() ) { - ScRefUpdate::MoveRelWrap( pDoc, aPos, aMod.Ref() ); + ScRefUpdate::MoveRelWrap( pDoc, aPos, MAXCOL, MAXROW, aMod.Ref() ); rChanged = TRUE; } else @@ -4337,7 +4337,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode, SCTAB nTabs = rRef.Ref2.nTab - rRef.Ref1.nTab; if ( rRef.Ref1.IsRelName() || rRef.Ref2.IsRelName() ) { - ScRefUpdate::MoveRelWrap( pDoc, aPos, rRef ); + ScRefUpdate::MoveRelWrap( pDoc, aPos, MAXCOL, MAXROW, rRef ); rChanged = TRUE; } else diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index 704c3255486e..4a4683935e99 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -60,7 +60,7 @@ using namespace formula; // Interner ctor fuer das Suchen nach einem Index ScRangeData::ScRangeData( USHORT n ) - : pCode( NULL ), nIndex( n ), bModified( FALSE ) + : pCode( NULL ), nIndex( n ), bModified( FALSE ), mnMaxRow(-1), mnMaxCol(-1) {} ScRangeData::ScRangeData( ScDocument* pDok, @@ -76,7 +76,9 @@ ScRangeData::ScRangeData( ScDocument* pDok, eType ( nType ), pDoc ( pDok ), nIndex ( 0 ), - bModified ( FALSE ) + bModified ( FALSE ), + mnMaxRow (-1), + mnMaxCol (-1) { if (rSymbol.Len() > 0) { @@ -122,7 +124,9 @@ ScRangeData::ScRangeData( ScDocument* pDok, eType ( nType ), pDoc ( pDok ), nIndex ( 0 ), - bModified ( FALSE ) + bModified ( FALSE ), + mnMaxRow (-1), + mnMaxCol (-1) { if( !pCode->GetCodeError() ) { @@ -157,7 +161,9 @@ ScRangeData::ScRangeData( ScDocument* pDok, eType ( RT_NAME ), pDoc ( pDok ), nIndex ( 0 ), - bModified ( FALSE ) + bModified ( FALSE ), + mnMaxRow (-1), + mnMaxCol (-1) { ScSingleRefData aRefData; aRefData.InitAddress( rTarget ); @@ -179,7 +185,9 @@ ScRangeData::ScRangeData(const ScRangeData& rScRangeData) : eType (rScRangeData.eType), pDoc (rScRangeData.pDoc), nIndex (rScRangeData.nIndex), - bModified (rScRangeData.bModified) + bModified (rScRangeData.bModified), + mnMaxRow (rScRangeData.mnMaxRow), + mnMaxCol (rScRangeData.mnMaxCol) {} ScRangeData::~ScRangeData() @@ -247,7 +255,7 @@ void ScRangeData::UpdateSymbol( rtl::OUStringBuffer& rBuffer, const ScAddress& r ::std::auto_ptr pTemp( pCode->Clone() ); ScCompiler aComp( pDoc, rPos, *pTemp.get()); aComp.SetGrammar(eGrammar); - aComp.MoveRelWrap(); + aComp.MoveRelWrap(GetMaxCol(), GetMaxRow()); aComp.CreateStringFromTokenArray( rBuffer ); } @@ -393,7 +401,7 @@ BOOL ScRangeData::IsReference( ScRange& rRange, const ScAddress& rPos ) const ::std::auto_ptr pTemp( pCode->Clone() ); ScCompiler aComp( pDoc, rPos, *pTemp); aComp.SetGrammar(pDoc->GetGrammar()); - aComp.MoveRelWrap(); + aComp.MoveRelWrap(MAXCOL, MAXROW); return pTemp->IsReference( rRange ); } @@ -520,6 +528,26 @@ BOOL ScRangeData::IsNameValid( const String& rName, ScDocument* pDoc ) return TRUE; } +void ScRangeData::SetMaxRow(SCROW nRow) +{ + mnMaxRow = nRow; +} + +SCROW ScRangeData::GetMaxRow() const +{ + return mnMaxRow >= 0 ? mnMaxRow : MAXROW; +} + +void ScRangeData::SetMaxCol(SCCOL nCol) +{ + mnMaxCol = nCol; +} + +SCCOL ScRangeData::GetMaxCol() const +{ + return mnMaxCol >= 0 ? mnMaxCol : MAXCOL; +} + USHORT ScRangeData::GetErrCode() { diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx index d019a6082583..ddb5f3dc0a5c 100644 --- a/sc/source/core/tool/refupdat.cxx +++ b/sc/source/core/tool/refupdat.cxx @@ -821,27 +821,27 @@ ScRefUpdateRes ScRefUpdate::Move( ScDocument* pDoc, const ScAddress& rPos, } void ScRefUpdate::MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos, - ScComplexRefData& rRef ) + SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef ) { if( rRef.Ref1.IsColRel() ) { rRef.Ref1.nCol = rRef.Ref1.nRelCol + rPos.Col(); - lcl_MoveItWrap( rRef.Ref1.nCol, static_cast(0), MAXCOL ); + lcl_MoveItWrap( rRef.Ref1.nCol, static_cast(0), nMaxCol ); } if( rRef.Ref2.IsColRel() ) { rRef.Ref2.nCol = rRef.Ref2.nRelCol + rPos.Col(); - lcl_MoveItWrap( rRef.Ref2.nCol, static_cast(0), MAXCOL ); + lcl_MoveItWrap( rRef.Ref2.nCol, static_cast(0), nMaxCol ); } if( rRef.Ref1.IsRowRel() ) { rRef.Ref1.nRow = rRef.Ref1.nRelRow + rPos.Row(); - lcl_MoveItWrap( rRef.Ref1.nRow, static_cast(0), MAXROW ); + lcl_MoveItWrap( rRef.Ref1.nRow, static_cast(0), nMaxRow ); } if( rRef.Ref2.IsRowRel() ) { rRef.Ref2.nRow = rRef.Ref2.nRelRow + rPos.Row(); - lcl_MoveItWrap( rRef.Ref2.nRow, static_cast(0), MAXROW ); + lcl_MoveItWrap( rRef.Ref2.nRow, static_cast(0), nMaxRow ); } SCsTAB nMaxTab = (SCsTAB) pDoc->GetTableCount() - 1; if( rRef.Ref1.IsTabRel() ) diff --git a/sc/source/filter/excel/namebuff.cxx b/sc/source/filter/excel/namebuff.cxx index df53c3edcd3c..b01f5a728263 100644 --- a/sc/source/filter/excel/namebuff.cxx +++ b/sc/source/filter/excel/namebuff.cxx @@ -127,6 +127,9 @@ void ShrfmlaBuffer::Store( const ScRange& rRange, const ScTokenArray& rToken ) DBG_ASSERT( mnCurrIdx <= 0xFFFF, "*ShrfmlaBuffer::Store(): Gleich wird mir schlecht...!" ); ScRangeData* pData = new ScRangeData( pExcRoot->pIR->GetDocPtr(), aName, rToken, rRange.aStart, RT_SHARED ); + const ScAddress& rMaxPos = pExcRoot->pIR->GetMaxPos(); + pData->SetMaxCol(rMaxPos.Col()); + pData->SetMaxRow(rMaxPos.Row()); pData->SetIndex( static_cast< USHORT >( mnCurrIdx ) ); pExcRoot->pIR->GetNamedRanges().Insert( pData ); index_hash[rRange.aStart] = static_cast< USHORT >( mnCurrIdx ); diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index e065099b2824..457c31d4ab04 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -619,7 +619,7 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::Init - missing cell address" ); // clone the passed token array, convert references relative to current cell position mxOwnScTokArr.reset( rScTokArr.Clone() ); - ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos ); + ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos, MAXCOL, MAXROW ); // don't remember pScBasePos in mpScBasePos, shared formulas use real relative refs break; default:; -- cgit From 55d813ddab4bbe1e076736845a10f2bcddfe1235 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 17 Aug 2009 14:12:14 +0000 Subject: CWS-TOOLING: integrate CWS graphite01 2009-08-06 11:09:01 +0200 hdu r274708 : #i10000# fix build breaker for SYSTEM_GRAPHITE=NO 2009-07-21 12:01:52 +0200 hdu r274174 : #i93645# fix include files for EXT_USE_STLPORT 2009-07-21 11:51:07 +0200 hdu r274173 : #i93645# convert line-endings of files to be patched 2009-07-21 10:49:01 +0200 hdu r274170 : #i93645# adjust makefile.vc8 for HH-RelEng env (thanks ause) 2009-07-20 05:21:32 +0200 kstribley r274105 : attempt to fix Windows build error caused by NULL variable in nmake file 2009-07-16 10:22:36 +0200 hdu r274032 : #i69129# also use solar minor version to find graphite lib 2009-07-16 05:36:06 +0200 kstribley r274029 : allow windows build to have Graphite disabled with SAL_DISABLE_GRAPHITE 2009-07-15 13:59:22 +0200 hdu r274011 : #i69129# default to ENABLE_GRAPHITE=TRUE 2009-07-15 13:19:54 +0200 hdu r274008 : #i93645# ignore compile warnings for graphite 2009-07-15 13:18:25 +0200 hdu r274006 : #i93645# stlport needs libmath, use solar minor version to find matching libs 2009-07-15 09:21:13 +0200 hdu r273989 : #i100000# avoid compile warning 2009-07-14 12:19:08 +0200 hdu r273963 : CWS-TOOLING: rebase CWS graphite01 to trunk@273858 (milestone: DEV300:m52) 2009-07-13 06:54:56 +0200 kstribley r273912 : change to use standard file headers 2009-07-13 05:39:14 +0200 kstribley r273911 : Remove unnecessary change to configure.in as reported by Rene 2009-07-10 16:58:44 +0200 hdu r273902 : #i100000# fix compile for precompiled-header support 2009-07-02 13:48:26 +0200 kstribley r273647 : #69129# fix a graphite bug which could crash with fonts containing obscure GDL positioning rules 2009-07-02 01:44:02 +0200 rene r273616 : #i10000# we need to link with -licuuc 2009-07-01 04:02:20 +0200 kstribley r273540 : restore missing sdf files from base 2009-07-01 04:01:40 +0200 kstribley r273539 : restore missing sdf files from base 2009-07-01 04:01:12 +0200 kstribley r273538 : restore missing sdf files from base 2009-07-01 03:59:41 +0200 kstribley r273537 : restore missing sdf files from base 2009-06-29 10:16:51 +0200 kstribley r273456 : #i69129# fixes a bug which caused occasional incorrect linebreaking when graphite is asked to render a part of a cluster not containing a base 2009-06-27 10:43:58 +0200 kstribley r273445 : #i69129# added kashida support for justified RTL text 2009-06-01 12:57:06 +0200 kstribley r272476 : CWS-TOOLING: rebase CWS graphite01 to trunk@272291 (milestone: DEV300:m49) 2009-05-26 10:50:06 +0200 kstribley r272286 : #i69129# fixes a build error when NDEBUG is not defined 2009-05-25 13:14:06 +0200 kstribley r272237 : #i69129# enable debugging by fixing compile warnings 2009-05-25 13:07:47 +0200 kstribley r272234 : #i69129# added env variable to disable GRAPHITE at run time on linux and fixed a bug with a rare attachment sequence 2009-04-20 17:39:25 +0200 kstribley r271001 : CWS-TOOLING: rebase CWS graphite01 to trunk@270723 (milestone: DEV300:m46) 2009-04-18 07:11:33 +0200 kstribley r270957 : #i101178# attempt to fix buildbot builds by reordering configure.in 2009-04-14 17:37:07 +0200 kstribley r270801 : #i93645# tweak configure to enable graphite by default on windows and linux to assist testing with tinderbox build 2009-04-14 16:33:17 +0200 kstribley r270796 : #i96925# another fix for rtl fallback and add optional debug info in MultiSalLayout 2009-04-08 13:27:55 +0200 kstribley r270641 : #i69129# fix features after a bad merge 2009-04-08 13:26:34 +0200 kstribley r270640 : #i69129# add a patch for WinFont 2009-03-24 12:37:54 +0100 kstribley r269937 : #i69129# fix build error due to locale being included in method for features 2009-03-24 12:36:10 +0100 kstribley r269936 : #i93645# change patch variable and fix configure 2009-03-20 04:18:56 +0100 kstribley r269776 : CWS-TOOLING: rebase CWS graphite01 to trunk@269297 (milestone: DEV300:m43) 2009-03-01 13:10:59 +0100 kstribley r268622 : added a patch to improve handling of a font with bad graphite language feature tables #i93645# 2009-02-12 04:50:51 +0100 kstribley r267631 : #i93645# fix windows build for graphite 2.3.1 and remove unnecessary patch 2009-02-10 04:48:50 +0100 kstribley r267535 : #i93645# fix a build error with stlport on Ubuntu 8.10 x86 2009-02-10 03:51:10 +0100 kstribley r267534 : #i69129# remove legacy config_office 2009-02-07 19:12:54 +0100 kstribley r267482 : #i93645# upgrade to using silgraphite-2.3.1 2009-02-02 18:17:57 +0100 kstribley r267290 : #i69129# backout unwanted checkin 2009-02-02 17:44:03 +0100 kstribley r267281 : #i69129# backout erroneous update to aclocal.m4 2009-02-01 10:05:03 +0100 kstribley r267236 : #i69129# fix build error due to locale being added to set font attributes 2009-02-01 06:02:52 +0100 kstribley r267235 : #i69129# fix erroneous merge 2009-01-31 16:24:56 +0100 kstribley r267234 : #i69129# update configure.in solenv.in in their new locations with enable graphite 2009-01-31 10:53:18 +0100 kstribley r267232 : CWS-TOOLING: rebase CWS graphite01 to trunk@267171 (milestone: DEV300:m41) 2008-12-17 04:17:33 +0100 kstribley r265577 : #i93645# remove superfluous autoreconf check and autoconf patch 2008-12-16 10:07:20 +0100 rene r265529 : fix aclocal.m4 breakage 2008-12-16 05:13:29 +0100 kstribley r265520 : #i93645# change to autoconf && configure 2008-12-16 04:39:48 +0100 kstribley r265519 : #i93645# modified LD_FLAGS so that system graphite isn't pulled in by accident and fixed autoconf problem 2008-12-15 14:16:25 +0100 rene r265497 : check for working STL 2008-12-15 12:53:39 +0100 rene r265473 : revert broken check 2008-12-15 11:59:21 +0100 kstribley r265472 : #i93645# added check for system STL, since this is a requirement for system graphite to work correctly and moved the position of the check further down 2008-12-15 11:55:34 +0100 kstribley r265471 : #i93645# remove references to gr3ooo to allow system graphite to be used 2008-12-12 18:48:18 +0100 rene r265437 : fix link for system-graphite 2008-12-12 18:46:45 +0100 rene r265436 : the tarball is in graphite, remove obsolete check 2008-12-12 18:22:22 +0100 rene r265433 : typo; re-autoconf 2008-12-12 17:35:26 +0100 rene r265432 : actually implement SYSTEM_GRAPHIT checks (as already checked for in makefile.mks) but remove the checks in graphit itself and move to BUILD_TYPE 2008-12-12 08:08:33 +0100 kstribley r265387 : #i69129# 2 of the patched files need windows line endings so patch works on linux as well as windows 2008-12-12 08:04:41 +0100 kstribley r265386 : #i69129# rtl fallback fix which prevents caching of segments with fallback 2008-12-08 04:28:12 +0100 kstribley r264969 : results of running autoconf with graphite config changes #i69129# 2008-12-05 08:12:47 +0100 kstribley r264886 : backout unintential change at r264884 2008-12-05 06:26:33 +0100 kstribley r264884 : #i96925# fixes for uniscribe fallback 2008-12-05 06:11:37 +0100 kstribley r264883 : #i69129# improvements to windows graphite code, including caching of sila table lookup 2008-12-02 13:28:51 +0100 kstribley r264694 : #i93645# add graphite library and append to patch 2008-11-27 06:47:10 +0100 kstribley r264445 : #69129# fix rtl loop bug and rtl caching problem 2008-11-27 06:42:20 +0100 kstribley r264444 : add caching for GraphiteFontAdaptor 2008-11-14 15:57:03 +0100 kstribley r263681 : #69129# add graphite addtional files from cvs 2008-11-14 15:54:47 +0100 kstribley r263680 : #69129# fix for modified resolution api 2008-11-13 16:24:09 +0100 kstribley r263652 : #69129# add skeleton to build graphite module library 2008-11-13 16:22:19 +0100 kstribley r263651 : #69129# add skeleton to build graphite module library 2008-11-13 16:16:10 +0100 kstribley r263650 : #69129# migrate from cvs 2008-11-13 15:26:54 +0100 kstribley r263646 : #69129# add a module for the graphite library --- sc/source/core/data/patattr.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 5f2f3c1a4f6e..ee74a66bcc3b 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -258,14 +258,16 @@ void ScPatternAttr::GetFont( FontEmphasisMark eEmphasis; FontRelief eRelief; Color aColor; + LanguageType eLang; - USHORT nFontId, nHeightId, nWeightId, nPostureId; + USHORT nFontId, nHeightId, nWeightId, nPostureId, nLangId; if ( nScript == SCRIPTTYPE_ASIAN ) { nFontId = ATTR_CJK_FONT; nHeightId = ATTR_CJK_FONT_HEIGHT; nWeightId = ATTR_CJK_FONT_WEIGHT; nPostureId = ATTR_CJK_FONT_POSTURE; + nLangId = ATTR_CJK_FONT_LANGUAGE; } else if ( nScript == SCRIPTTYPE_COMPLEX ) { @@ -273,6 +275,7 @@ void ScPatternAttr::GetFont( nHeightId = ATTR_CTL_FONT_HEIGHT; nWeightId = ATTR_CTL_FONT_WEIGHT; nPostureId = ATTR_CTL_FONT_POSTURE; + nLangId = ATTR_CTL_FONT_LANGUAGE; } else { @@ -280,6 +283,7 @@ void ScPatternAttr::GetFont( nHeightId = ATTR_FONT_HEIGHT; nWeightId = ATTR_FONT_WEIGHT; nPostureId = ATTR_FONT_POSTURE; + nLangId = ATTR_FONT_LANGUAGE; } if ( pCondSet ) @@ -337,6 +341,10 @@ void ScPatternAttr::GetFont( if ( pCondSet->GetItemState( ATTR_FONT_COLOR, TRUE, &pItem ) != SFX_ITEM_SET ) pItem = &rItemSet.Get( ATTR_FONT_COLOR ); aColor = ((const SvxColorItem*)pItem)->GetValue(); + + if ( pCondSet->GetItemState( nLangId, TRUE, &pItem ) != SFX_ITEM_SET ) + pItem = &rItemSet.Get( nLangId ); + eLang = ((const SvxLanguageItem*)pItem)->GetLanguage(); } else // alles aus rItemSet { @@ -365,6 +373,9 @@ void ScPatternAttr::GetFont( rItemSet.Get( ATTR_FONT_RELIEF )).GetValue(); aColor = ((const SvxColorItem&) rItemSet.Get( ATTR_FONT_COLOR )).GetValue(); + // for graphite language features + eLang = + ((const SvxLanguageItem&)rItemSet.Get( nLangId )).GetLanguage(); } DBG_ASSERT(pFontAttr,"nanu?"); @@ -381,6 +392,8 @@ void ScPatternAttr::GetFont( rFont.SetCharSet( pFontAttr->GetCharSet() ); rFont.SetPitch( pFontAttr->GetPitch() ); + rFont.SetLanguage(eLang); + // Groesse if ( pOutDev != NULL ) -- cgit From a31d592bd1193b044df148e106d6d0c9de0939c5 Mon Sep 17 00:00:00 2001 From: Release Engineers Date: Tue, 25 Aug 2009 11:00:47 +0000 Subject: CWS-TOOLING: integrate CWS ooxml03 2009-08-11 12:16:50 +0200 kendy r274852 : CWS-TOOLING: rebase CWS ooxml03 to trunk@274622 (milestone: DEV300:m54) 2009-07-17 17:55:14 +0200 hbrinkm r274100 : resolved warning on unxlngi6.pro 2009-07-15 17:11:09 +0200 kendy r274015 : #i96319# With the disabled docx pieces, libmsword is not a UNO library. 2009-07-15 13:38:36 +0200 hbrinkm r274010 : removed unresolved symbols 2009-07-13 16:06:11 +0200 hbrinkm r273943 : resolved warnings 2009-07-10 14:01:03 +0200 hbrinkm r273889 : changes to make compile on Windows 2009-06-22 19:46:17 +0200 kendy r273252 : #i96319# Disable the DOCX export, it's not perfect yet... 2009-06-22 13:04:32 +0200 kendy r273219 : CWS-TOOLING: rebase CWS ooxml03 to trunk@272827 (milestone: DEV300:m50) 2009-06-11 17:11:39 +0200 kendy r272890 : #i96319# Fix regression in the Word 95 output of hyperlinks. 2009-06-05 17:53:08 +0200 kendy r272710 : #i96319# Fix regression in Word 95 output (wrong style number when nodes recurse). 2009-06-03 00:19:27 +0200 kendy r272529 : #i96319# Fix regression in output of the section breaks. 2009-05-29 18:30:19 +0200 kendy r272475 : CWS-TOOLING: rebase CWS ooxml03 to trunk@272291 (milestone: DEV300:m49) 2009-05-29 09:58:02 +0200 kendy r272435 : #i102354# Don't write the debug info directly to the document. 2009-05-28 15:57:01 +0200 kendy r272411 : #i102260# Revert another trivial fix. 2009-05-26 16:43:07 +0200 kendy r272310 : #i102260# Disable fix of FILLIN fields. 2009-05-26 14:14:09 +0200 kendy r272302 : #i96319# Fix regression in the calculation of size of cells. 2009-05-26 01:42:29 +0200 kendy r272274 : #i96319# Fix a regression - don't export RES_PARATR_LINESPACING and RES_UL_SPACE with every style. [And additionally some beautification.] 2009-05-23 00:37:44 +0200 thb r272212 : #i102156# added XFastSAXSerializable plus implementation 2009-05-22 16:43:09 +0200 kendy r272201 : CWS-TOOLING: rebase CWS ooxml03 to trunk@271830 (milestone: DEV300:m48) 2009-05-14 23:37:02 +0200 thb r271924 : #i10000# post-filter split fixes - make non-pro compile again 2009-05-14 22:35:54 +0200 thb r271923 : #i10000# post-svx split fixes - both librpt and librptui need libsvx 2009-05-14 21:39:08 +0200 thb r271922 : #i10000# post-svx split work - getting nonpro build working again 2009-05-11 09:11:23 +0200 kendy r271740 : #i99638# svxcore library is not a UNO library. 2009-04-29 17:31:45 +0200 kendy r271389 : #i96319# Fixed a corner case in docx export of nested tables. Actually, this even simplifies the code a bit :-) 2009-04-29 12:10:08 +0200 kendy r271364 : #i96319# Fix output of spacing in docx. 2009-04-29 10:56:43 +0200 kendy r271357 : #i96319# Fix an endless loop in the docx export of bookmarks. 2009-04-29 01:06:21 +0200 kendy r271348 : #i96319# Fix output of cell width and height. 2009-04-27 13:29:02 +0200 kendy r271264 : #i96319# Fix output of section columns (their number + widths) for docx. 2009-04-24 15:51:23 +0200 kendy r271219 : #i96319# Fix output of dates - xsi:type=... should be there only for dcterms. 2009-04-23 18:27:28 +0200 kendy r271190 : #i96319# Fix output of gridCol's. 2009-04-23 17:13:44 +0200 kendy r271184 : #i96319# Avoid incorrect double output of tcPr. 2009-04-22 15:58:10 +0200 kendy r271125 : #i96319# Fix the output of the nested tables after all the rebases. 2009-04-20 15:16:48 +0200 kendy r270989 : #i96319# More correct output of the nodes. 2009-04-20 13:27:06 +0200 kendy r270976 : #i96319# Make it build after the rebase to m46 again; maybe does not run yet. 2009-04-10 23:00:46 +0200 kendy r270725 : CWS-TOOLING: rebase CWS ooxml03 to trunk@270723 (milestone: DEV300:m46) 2009-04-09 17:31:44 +0200 kendy r270716 : #i96319# Fix output of headers/footers. 2009-04-09 16:42:13 +0200 kendy r270715 : #i99638# Fix visibility for the debug build of svx. 2009-04-03 10:27:50 +0200 kendy r270466 : #i99683# One forgotten gid_File_Filter_Emp -> gid_File_Filter_Sdfilt. 2009-03-06 16:19:03 +0100 kendy r269013 : #i99638# Remove SpecialProgress-related methods and members, not used any more, and breaks linking on Win32. 2009-03-06 09:43:55 +0100 kendy r268974 : #i99638# Resolve some more unresolved symbols on Win32. 2009-03-05 23:01:39 +0100 kendy r268946 : #i99638# Export less SdStyleSheetPool symbols. 2009-03-05 15:31:23 +0100 kendy r268910 : #i99638# MSVC needs struct WW8_PdAttrDesc declared, otherwise fails to link. 2009-03-04 14:15:23 +0100 kendy r268826 : #i99638# More Win32-related build fixes. 2009-03-04 13:47:48 +0100 kendy r268823 : #i99638# Disable pptx export again, brougth in by mistake. 2009-03-04 09:54:00 +0100 kendy r268786 : #i99638# Deliver also isvxcore.lib and isvxmsfilter.lib. 2009-03-03 17:42:25 +0100 kendy r268773 : #i99638# SdrModel::setUnoModel() should not be inline. 2009-03-03 17:25:59 +0100 kendy r268770 : #i99638# Ugh, revert. 2009-03-03 17:05:16 +0100 kendy r268765 : #i99638# Make ObjectContact dll private. 2009-03-03 15:35:41 +0100 kendy r268733 : #i99638# More destructors visible for Win32 linking. 2009-03-03 14:26:23 +0100 kendy r268726 : #i99638# Make some destructors visible, and change one static inline to static to Win32 linking happy. 2009-03-03 10:42:12 +0100 kendy r268712 : #i99638# More moving stuff around to make Win32 linking happy. 2009-03-03 09:48:17 +0100 kendy r268708 : #i99638# Reduce the includes, needed for Win32 linking. 2009-03-03 08:48:00 +0100 kendy r268705 : #i99638# ImpGetResStr() visibility markup moved to the header. 2009-03-02 16:30:17 +0100 kendy r268664 : #i99638# Fix visibility problems that appeared on x86. 2009-02-27 22:25:57 +0100 kendy r268618 : #i96319# Better definition of DBG in utils.hxx. 2009-02-27 21:53:17 +0100 kendy r268616 : #i96319# License for utils.hxx, define DBG only for the debug builds. 2009-02-27 21:44:25 +0100 kendy r268615 : #i96319# Fixed types for printf etc. parameters. 2009-02-27 17:23:17 +0100 kendy r268607 : #i96319# Fix build after the rebase. 2009-02-27 15:12:49 +0100 kendy r268597 : CWS-TOOLING: rebase CWS ooxml03 to trunk@268395 (milestone: DEV300:m42) 2009-02-27 12:37:57 +0100 kendy r268580 : #i96319# Fix build dependency in oox. 2009-02-26 22:02:06 +0100 kendy r268547 : #i99683# Move ppt import to a separate library. The ppt export is already separate, so it makes sense to give there the import as well. The current library 'emp' was renamed to 'scfilt', it links against svxmsfilter, and few symbols had to be made visible (28 of them). 2009-02-26 14:36:25 +0100 kendy r268520 : #i99638# Whitespace fixes. 2009-02-26 14:31:35 +0100 kendy r268518 : #i99638# Split svx into svxcore, svxmsfilter and the rest. SvxImportMSVBasic's SaveOrDelMSVBAStorage(), GetSaveWarningOfMSVBAStorage(), and GetMSBasicStorageName() must go to svxcore (because of Writer). 2009-02-26 00:16:32 +0100 kendy r268471 : #i99638# Split libsvx into 3 pieces - svxcore, svxmsfilter, and svx (the rest). This contains: - the split (based on inter-object dependencies) - svxcore is actually a closure on a graph where the objects are vertexes, and where there's an edge between 2 vertexes when one needs symbol from the second ;-) - maybe still could be split, but that will be most probably harder to achieve - svxmsfilter is a subset that is needed just by the filters of the MS Office formats - the new svx contains the rest that did not fit the above 2 - visibility for svxcore - some svxcore symbols had to be exposed for svxmsfilter or svx - adaption of modules linking against svx - in some cases, linking just against svxcore is enough 2009-02-25 23:35:03 +0100 kendy r268470 : #i99545# Get rid of struct ConstAsciiString, and use simple #define's instead - it's a pre-requisite for a svx split, and also saves memory on x86-64, and some symbol names. 2009-02-25 22:39:02 +0100 kendy r268468 : #i96319# Get rid of the now unneecessary debug class DOCX. 2009-02-17 20:35:29 +0100 kendy r268190 : #i96319# WW8 filter rework + docx export License header + whitespace fixes. 2009-02-17 20:02:39 +0100 kendy r268189 : #i96319# WW8 filter rework + docx export Add license header to preset-definitions-to-shape-types.pl. 2009-02-17 19:58:11 +0100 kendy r268188 : #i96319# WW8 filter rework + docx export oox does not have to depend on FASTSAXLIB. 2009-02-17 17:05:34 +0100 kendy r268182 : #i96319# WW8 filter rework + docx export Fix the sax compilation, apparently some of the changes were missing. 2009-02-17 13:04:14 +0100 kendy r268163 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Fix output of shape paths (point components can be either 16 or 32 bit). [And also implement a fallback for the missing shapes - treated as rectangle.] 2009-02-17 13:03:56 +0100 kendy r268162 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Correction of some values. Now the shapes seem to be good enough; time to abandon them ;-) 2009-02-17 13:03:37 +0100 kendy r268161 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Better detection of consts. 2009-02-17 13:03:19 +0100 kendy r268160 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Fixed the 'sun' shape. 2009-02-17 13:03:00 +0100 kendy r268159 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Better check for unneeded 'prod's. 2009-02-17 13:02:42 +0100 kendy r268158 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Fix the adj values. 2009-02-17 13:02:23 +0100 kendy r268157 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Fix pentagon and star5 shapes. 2009-02-17 13:02:04 +0100 kendy r268156 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Fix most of the 'star' shapes by preventing an overflow. 2009-02-17 13:01:41 +0100 kendy r268155 : #i96319# WW8 filter rework + docx export From: Radek Doulik * fixed build after resolving conflicts 2009-02-17 13:01:19 +0100 kendy r268154 : #i96319# WW8 filter rework + docx export From: Radek Doulik * added TODO comment 2009-02-17 13:00:59 +0100 kendy r268153 : #i96319# WW8 filter rework + docx export From: Radek Doulik * implemented adjustments export in custom shapes 2009-02-17 13:00:40 +0100 kendy r268152 : #i96319# WW8 filter rework + docx export From: Radek Doulik * partially refactored EscherPropertyContainer::CreateCustomShapeProperties extracted 3 helper functions, which are now used in ooxml export 2009-02-17 13:00:17 +0100 kendy r268151 : #i96319# WW8 filter rework + docx export From: Radek Doulik * make mAny member of DrawingML protected, so that ShapeExport can access it * export connector shape * added DrawingML::WriteConnectorConnections * fixed bezier shape outline export (regression fix) 2009-02-17 12:59:54 +0100 kendy r268150 : #i96319# WW8 filter rework + docx export From: Radek Doulik * make EscherConnectorListEntry structure public, so that it can be used by ooxml export 2009-02-17 12:59:34 +0100 kendy r268149 : #i96319# WW8 filter rework + docx export From: Radek Doulik * added mapping of shapes to shape IDs * cleaned a bit shape name generation 2009-02-17 12:59:13 +0100 kendy r268148 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Fixed some of the text shapes, 166/202. In the 202, I counted even shapes that are marked 'should not be used' (and their definition is missing) even in the documentation. The only really missing shapes are those that use general arcTo... 2009-02-17 12:58:53 +0100 kendy r268147 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Found missing shapes, now 159/202. 2009-02-17 12:58:36 +0100 kendy r268146 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Optimize the amount of formulas a bit. Adds one more shape that previously reached the top amount of formulas ;-) 2009-02-17 12:58:15 +0100 kendy r268145 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Implemented quadratic beziers, 144/202 now. I was unable to use 'qb', it did not produce good results, no idea why :-( Instead used 'c' - cubic bezier - and recounted the control points (mathematically equivalent representation). The downside is that for some shapes I run out of formulas :-( - TODO later. 2009-02-17 12:57:56 +0100 kendy r268144 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Fix presetShapeDefinitions.xml, there's an error there. 2009-02-17 12:57:31 +0100 kendy r268143 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Implemented cubicBezTo + few formulas, now 136/202. 2009-02-17 12:57:11 +0100 kendy r268142 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Fixed units of sin/cos, which makes it now 118/202. Realized that some of the shapes are 'too small' - like <10 units, insetad of ~21600; have to look at that. 2009-02-17 12:56:43 +0100 kendy r268141 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: More arcTo shapes, 116/202 now. 2009-02-17 12:56:21 +0100 kendy r268140 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Better conversion of */ (fixes some shapes). Implemented nostroke/nofill. 2009-02-17 12:56:01 +0100 kendy r268139 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: More formulas, and partially implemented 'arcTo' - 93/202 shapes now. 2009-02-17 12:55:39 +0100 kendy r268138 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Radically changed the conversion of formulas to be able to implement +/. [...and actually implemented it ;-), 60/202 shapes now.] 2009-02-17 12:55:19 +0100 kendy r268137 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Shape types generation plugged to the build, 53/202 shapes now. 2009-02-17 12:54:57 +0100 kendy r268136 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: More predefined shapes generated (thanks to 'pin' translation). 2009-02-17 12:54:36 +0100 kendy r268135 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Script that creates the predefined shape types + the definitions. The shape types themselves come from the OOXML documentation; the script just converts them from DrawingML to a VML representation in a C++ file. The converter is not feature-complete yet, resulting in some missing shapes. Also it is not yet part of the build (makefile.mk not modified yet). 2009-02-17 12:54:10 +0100 kendy r268134 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: + Fixed a regression on sections output + Columns break has to be postponed to the next paragraph + Implemented sections properly + Columns formatting properties exported 2009-02-17 12:53:49 +0100 kendy r268133 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat haven't I fixed those problems? 2009-02-17 12:53:29 +0100 kendy r268132 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: + table alignment is now exported 2009-02-17 12:53:07 +0100 kendy r268131 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Integrate VMLExport with Calc for Comment export. Few minor changes needed to VMLExport so that Calc could customize the behavior. Specifically, Calc needed to be able to: - Explicitly specify the //v:shape/@type attribute value so that Excel wouldn't show a diagonal "arrow" underneath the note text instead of showing an actual box. - Add custom Escher properties such as "hidden", etc. - Insert the //v:shape/x:ClientData element before //v:shape is closed. * oox/inc/oox/export/vmlexport.hxx, oox/source/export/vmlexport.cxx: - Make Commit(), StartShape(), and EndShape() protected so that Calc can override those methods - StartShape() is needed to add //v:shape/@type - Commit() is needed to add new Escher properties - EndShape() is needed to generate //v:shape/x:ClientData. - Add AddShapeAttribute() method, so Calc can set the //v:shape/@type value. - Output "visibility:hidden" for the ESCHER_Prop_fHidden property. 2009-02-17 12:52:46 +0100 kendy r268130 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Finish the transition of VMLExport from 'sw' to 'oox' + few trivial fixes. The VML export code is now accessible as oox::vml::VMLExport. The (not that related) fixes include SAL_DLLPUBLIC_EXPORT -> OOX_DLLPUBLIC change and few warning fixes. 2009-02-17 12:52:24 +0100 kendy r268129 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Moved vmlexport.[hc]xx to oox. 2009-02-17 12:52:04 +0100 kendy r268128 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Cleanup before we move to oox. 2009-02-17 12:51:41 +0100 kendy r268127 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: Some more features for tables export 2009-02-17 12:51:21 +0100 kendy r268126 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: + nested tables export refinement + export row height and table headers 2009-02-17 12:50:58 +0100 kendy r268125 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Initialize a local variable. 2009-02-17 12:50:34 +0100 kendy r268124 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: fixed table layout for nested tables. Fixed nested tables output 2009-02-17 12:50:13 +0100 kendy r268123 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: added support of nested tables. Still needs to be heavily tested. Some problems are occuring with the grid layout. 2009-02-17 12:49:49 +0100 kendy r268122 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Change SAL_DLLPUBLIC_EXPORT to SW_DLLPUBLIC which is more appropriate here. 2009-02-17 12:49:28 +0100 kendy r268121 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Fix line-callout-3 translation. The `line-callout-3' callout was being mapped to the `accentBorderCallout90' OOXML callout, which Excel didn't like at all. Changing this to `borderCallout3' produces OOXML that Excel will load. Not sure what mso-spt49 is supposed to be, but given the other mso-spt* values I think accentBorderCallout90 makes more sense (but cannot find such a value in the OOXML XSD files). 2009-02-17 12:49:05 +0100 kendy r268120 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Fix refactoring of DrawingML::WritePolyPolygon(). The original version only checked rPoly.GetFlags() for every item *after* the first item -- i.e. the first item was skipped. Change the `for' loop start index to follow this behavior. 2009-02-17 12:48:42 +0100 kendy r268119 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Fix Bezier output. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit The //a:cubicBezTo element (?5.1.11.7) requires that there be *three* //a:pt child elements. Ensure that this is the case (otherwise Excel yells at me about invalid DrawingML if I export a free-form shape). This also cleans up the code slightly, by moving out a `if(j==0)` block to before the for loop, and re-indenting the code to simplify understanding. 2009-02-17 12:48:22 +0100 kendy r268118 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Flush documentation. 2009-02-17 12:48:00 +0100 kendy r268117 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: + implemented table cell margins and fixed grid layout + reapplied missing patch from m34 about default spacing of paragraphs 2009-02-17 12:47:40 +0100 kendy r268116 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Migrate Calc to use ShapeExport. Minor snafu here: XML_nvPr is valid only within Impress, so if Calc exports it Excel doesn't like the resulting documents. Remove XML_nvPr output from ShapeExport and replace with calls to ShapeExport::WriteNonVisualProperties(). PowerPointShapeExport can thus override ShapeExport::WriteNonVisualProperties() to generate the required //p:nvPr elements. * oox/inc/oox/export/shapes.hxx: Declare ShapeExport::WriteNonVisualProperties(). * oox/source/export/shapes.cxx: * - Replace XML_nvPr generation with calls to WriteNonVisualProperties(). - Get the GraphicObject name property from the shape instead of generating "Picture N" values (if the shape has a Name property). - Generate a GraphicObject Description attribute, if present. - Remove unused method parameter names (to remove warnings). 2009-02-17 12:47:15 +0100 kendy r268114 : #i96319# WW8 filter rework + docx export From: Radek Doulik * fixed few shape names, which were missing Shape at the end * fixed mso-spt202 custom shape translation, which was causing problems with word wrapping * enabled wrap attribure for bodyPr tag * fixed 2 compiler warnings 2009-02-17 12:46:55 +0100 kendy r268113 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: column spans in tables are now exported 2009-02-17 12:46:33 +0100 kendy r268112 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx: + Fixed table structure output + Output table borders + Fixed borders output 2009-02-17 12:46:11 +0100 kendy r268111 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Excercise ShapeExport::WriteShape(). Refactor PowerPointExport::WriteShapeTree() to use ShapeExport::WriteShape(), overloading ShapeExport virtual Write* methods as appropriate to insert support for additional shapes. * oox/source/export/shapes.cxx: Correct the shape names (often by appending "Shape") so that the table lookup works as expected. 2009-02-17 12:45:49 +0100 kendy r268110 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Implement multiplexing ShapeExport::WriteShape(). What got me started on this whole "migrate large fractions of sd into oox" binge was PowerPointExport::WriteShapeTree(), which included a "multiplexer" -- a method that took the XShape's shape type and translated it into a (set of) member function(s) to call to convert the shape. I needed just such a multiplexer for Calc, and was loathe to copy/paste it. However, PowerPointExport::WriteShapeTree() is far more complicated for something to go into oox, dealing as it does with grouping and myriad other sd-specific details. Thus, an overhaul: All the ShapeExport::Write* methods are now virtual. The multiplexing ShapeExport::WriteShape() method will consult a string type -> member function lookup table, and if a matching member function is found it will be invoked. This allows subclasses to customize behavior. If no matching conversion member function is found, then ShapeExport::WriteUnknownShape() is invoked, allowing subclasses to transparently handle additional shapes w/o special-casing the WriteShape() call. * oox/inc/oox/export/shapes.hxx, oox/source/export/shapes.cxx: Make Write* methods virtual; Add WriteUnknownShape(); Replace the (non-functional) WriteShapeTree() with the multiplexing WriteShape(), and provide a hashtable mapping shape type to conversion method. 2009-02-17 12:45:28 +0100 kendy r268109 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Move Impress DrawingML Export code into oox::drawingml::ShapeExport. Begin moving sharable sd/source/filter/eppt/epptooxml.cxx DrawingML code into oox::drawingml::ShapeExport, so that DrawingML elements (w/ different namespaces) can use the same export code. WARNING: the migration makes the assumption that mXPropSet comes from mXShape, that is: Reference< XPropertySet > mXPropSet( mXShape, UNO_QUERY ); If this is wrong, things will obviously break. This *should* be correct, as the altered code path rooted in PowerPointExport::WriteShapeTree() calls PPTWriterBase::GetShapeByIndex(), which ensures that mXPropSet is the XPropertySet for the mXShape instance: Any aAny( mXShape->queryInterface( ::getCppuType( (const Reference< XPropertySet >*) 0 ) )); aAny >>= mXPropSet; * oox/inc/oox/export/shapes.hxx, oox/source/export/shapes.cxx: Sync with the above removed PowerPointExport methods. 2009-02-17 12:45:11 +0100 kendy r268108 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Deliver inc/oox/export/shapes.hxx. 2009-02-17 12:44:51 +0100 kendy r268107 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Abstract out sd's shape export code. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit DrawingML is an evil, evil thing -- it's highly duplicative. For example, the element has been duplicated no less than four times into different XML namespaces: ?4.4.1.12, ?5.1.2.1.8, ?5.2.2.3, ?5.6.2.8, i.e. in the following XML namespaces (from the XSD files): http://schemas.openxmlformats.org/drawingml/2006/chartDrawing http://schemas.openxmlformats.org/drawingml/2006/main http://schemas.openxmlformats.org/drawingml/2006/picture http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing http://schemas.openxmlformats.org/presentationml/2006/main In all these cases, they all have the same attributes, the same parent elements, and the same child elements. They are, for all intents and purposes, identica EXCEPT for the XML namespace. Instead of rampantly duplicating sd's shape export code and doing s/XML_p/XML_???/g (i.e. replace the namespace), I'm refactoring sd's export code into oox::drawingml::ShapeExport. The ShapeExport constructor takes the target XML namespace as a parameter, and generates all XML relative to this namespace. * inc/oox/export/drawingml.hxx: Add DrawingML::GetFB() and DrawingML::GetFS() accessor methods, which are needed by ShapeExport. * source/export/makefile.mk: Add shapes.cxx to the build. * inc/oox/export/shapes.hxx, source/export/shapes.cxx: Declare and implement oox::drawingml::ShapeExport. 2009-02-17 12:44:32 +0100 kendy r268106 : #i96319# WW8 filter rework + docx export From: Radek Doulik * extracted paragraph adjustment translation * added text wrap (commented out as it doesn't work flawlessly yet) 2009-02-17 12:44:12 +0100 kendy r268105 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: now able to export the tables structures 2009-02-17 12:43:53 +0100 kendy r268104 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Fixed a bug in doc table export. 2009-02-17 12:43:34 +0100 kendy r268103 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Fixed several build bugs: + strange integer conversion + unexported symbol dbg_out + Reintegrated missing patches from m34 + Reupdated scp2 module to flag libmsword as a uno component 2009-02-17 12:43:15 +0100 kendy r268102 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Change hardcoded numbers into sprm constants. 2009-02-17 12:42:58 +0100 kendy r268101 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Make the tables build even with the docx-related changes. 2009-02-17 12:42:38 +0100 kendy r268100 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Write shapes defined by paths. 2009-02-17 12:42:14 +0100 kendy r268099 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: implemented paraSnapToGrid & suppressAutoHyphens 2009-02-17 12:41:54 +0100 kendy r268098 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: Implemented ParaScriptSpace and its friends 2009-02-17 12:41:32 +0100 kendy r268097 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx export: Keep with next paragraph 2009-02-17 12:41:11 +0100 kendy r268096 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx: Fixed tab position export, left margin was missing 2009-02-17 12:40:48 +0100 kendy r268095 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat TOX export: + fixed export fields expression containing tabs + fixed the begin element of fields like TOX, Hyperlinks and index marks + implemented export of index marks (same missing things than binary filter) 2009-02-17 12:40:28 +0100 kendy r268094 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Export the core revision document property. The mapping between revision and getEditingCycles() was found by perusing the existing OLE Structured Storage output source. 2009-02-17 12:40:10 +0100 kendy r268093 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Preparations for the predefined shape types. 2009-02-17 12:39:50 +0100 kendy r268092 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Implemented the most interesting stroke properties. 2009-02-17 12:39:31 +0100 kendy r268091 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Minimal working TOX export, not fully tested yet. Implemented DocxExport::AppendBookmark method 2009-02-17 12:39:11 +0100 kendy r268090 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Implemented the most interesting fill properties. 2009-02-17 12:38:53 +0100 kendy r268089 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky VML: Output of lines. 2009-02-17 12:38:35 +0100 kendy r268088 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Thanks to kendy, dateToW3CDTF is now useless 2009-02-17 12:38:16 +0100 kendy r268087 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Uncomplete merge + change the timestamp generation with the use of strftime 2009-02-17 12:37:58 +0100 kendy r268086 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat + Fixes in core properties export: - the first keyword was duplicated, - the CreationTime in apps.xml was written several times + Refactored the fields output to prepare the place for TOX: now using a stack of fields to output + Refactored the Hyperlink export implementation to handle links with anchors in documents 2009-02-17 12:37:36 +0100 kendy r268085 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky MS Word begins to like the VML generated by the docx export :-) We can export basic groups, rects and ellipses now; TODO other shapes and lots of properties. 2009-02-17 12:37:18 +0100 kendy r268084 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Propagate bounding rectangle in EscherEx::Commit(). Ignored in EscherEx itself, but mandatory for the VML export. 2009-02-17 12:36:59 +0100 kendy r268083 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Comment out output of XML_TotalTime (xProperties->getEditingDuration()), breaks here. #i96319# WW8 filter rework + docx export confuses MS Office terribly. 2009-02-17 12:36:42 +0100 kendy r268082 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky The boost datetime conversion broke from time to time, no idea why :-( Now using the most trivial approach... 2009-02-17 12:36:24 +0100 kendy r268081 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Implementation of few basic VML shapes and properties. 2009-02-17 12:36:06 +0100 kendy r268080 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Add EscherPropertyContainer::GetOpts() to be able to get all the options at once. 2009-02-17 12:35:48 +0100 kendy r268079 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Include "tokens.hxx" instead of . The latter attempts to take the version from solver which is not there yet when building from scratch ;-) 2009-02-17 12:35:28 +0100 kendy r268078 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Forgot to remove an include. Compiler didn't crash on it... strange 2009-02-17 12:35:10 +0100 kendy r268077 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Merged the properties export code with the one of jonp. In fact, only the date formatting code of mine has been kept to replace jon's one. 2009-02-17 12:34:49 +0100 kendy r268076 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Export of core properties migrated to oox module 2009-02-17 12:34:23 +0100 kendy r268075 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Add some trace/debugging information. Some of the app/core properties are #ifdef'd, as I don't know what XDocumentProperties attribute is the appropriate mapping. My suspicion is that many of the remaining app/core properties may be found within the DocumentStatistics attribute, and thus I print out the document statistics found. (So far, I'm not seeing any from Calc, but this may bear some fruit with .docx or .pptx export...) 2009-02-17 12:34:01 +0100 kendy r268074 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Document Properties: skip empty elements. * xmlfilterbase.cxx (writeElement): Don't generate an element if the element has no value. 2009-02-17 12:33:35 +0100 kendy r268073 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Initial stab at exporting document properties. Short, short version: to export document properties call XmlFilterBase::exportDocumentProperties(Reference). * oox/inc/oox/core/xmlfilterbase.hxx, oox/source/core/xmlfilterbase.cxx: Add and implement XmlFilterBase::exportDocumentProperties(), which generates docProps/core.xml and docProps/app.xml. * oox/source/token/tokens.txt: Add XML_vt element. * sc/source/filter/excel/excdoc.cxx: call XmlFilterBase::exportDocumentProperties(). * sc/source/filter/excel/expop2.cxx: Remove sfx2::SaveOlePropertySet() call, as it isn't useful for OOXML output. 2009-02-17 12:33:17 +0100 kendy r268072 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Beginnings of the VML export. The shapes are exported, but with no attributes - so their position is not written yet, etc. 2009-02-17 12:32:54 +0100 kendy r268070 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Do more EscherEx methods virtual. We want to re-use EscherEx for the export of VML. For this, some of the methods have to be made virtual so that we can change them to do what we need ;-) 2009-02-17 12:32:26 +0100 kendy r268069 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Removed debug fprintf's 2009-02-17 12:32:09 +0100 kendy r268068 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx: bookmarks now exported 2009-02-17 12:31:52 +0100 kendy r268067 : #i96319# WW8 filter rework + docx export From: Radek Doulik * export polypolygons * export transformation defined by rectangle 2009-02-17 12:31:35 +0100 kendy r268066 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Split text runs to be able to insert bookmark tags 2009-02-17 12:31:18 +0100 kendy r268065 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Enum for specifying the document type to DrawingML. Various document types need it differently... 2009-02-17 12:30:57 +0100 kendy r268064 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Provide an appropriate //Relationship/@Target value. * oox/source/export/drawingml.cxx: The //Relationship/@Target value needs to be a path relative to the DrawingML document. For Excel, the DrawingML is in xl/drawings/drawing*.xml, while the embedded media is in xl/media/image*. Thus, to get from xl/drawings/drawing*.xml to xl/media/image*, we need "../media/image", not "media/image". Without this change, Excel throws an error when loading the Spreadsheet, as it can't find the resource. 2009-02-17 12:30:35 +0100 kendy r268063 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Fixed output of the properties that are written at or time. Fixes the most annoying "the first run has strange properties" bug, and generally improves the quality of output of styles a lot. 2009-02-17 12:30:16 +0100 kendy r268062 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Generate valid DrawingML. The DrawingML is a hack, with hard-coded values in various places that have no business being hardcoded, but it is valid, and Excel does load the DrawingML without error. (It instead errors out because xl/drawings/_rels/drawing1.xml.rels contains an invalid file path. :-( * oox/inc/oox/export/drawingml.hxx, oox/source/export/drawingml.cxx: Add a WriteBlipFill() overload which takes the XML namespace as an argument. This is necessary because Excel wants a element, not , and I don't want to have to duplicate the rest of the WriteBlipFill() logic within sc. 2009-02-17 12:29:59 +0100 kendy r268061 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Remove one of the 2 fixes of the same problem ;-) 2009-02-17 12:29:32 +0100 kendy r268060 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Few whitespace fixes. 2009-02-17 12:29:12 +0100 kendy r268059 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Basic output of images works, both embedded as well as linked. Still some TODOs in FlyFrameGraphic(), to be solved later... 2009-02-17 12:28:51 +0100 kendy r268058 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Add TwipsToEMU() to oox/export/utils.hxx. 2009-02-17 12:28:30 +0100 kendy r268057 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Fix the build. DrawingML::WriteImage(const Graphic&) needs to have a Graphic type in scope. 2009-02-17 12:28:10 +0100 kendy r268056 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Change define FSEND -1 to const sal_Int32 FSEND = -1. The former can hide errors, like startElementNS( ..., "xyz" FSEND ), because it compiles without warning, but then gets part of the string, and we end up without a sentinel. 2009-02-17 12:27:50 +0100 kendy r268055 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Docx export: Dropdown field now exported 2009-02-17 12:27:28 +0100 kendy r268054 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Add the xdr token. The `xdr' token is used as the XML namespace in Spreadsheet DrawingML documents. 2009-02-17 12:27:08 +0100 kendy r268053 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky With a bit of cheating, images can be written... Everything (but the image itself) is hardcoded so far. 2009-02-17 12:26:47 +0100 kendy r268052 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Write the location of the image as media/image, not ../media/image. Hopefully it does not break pptx - but for docx it's necessary. 2009-02-17 12:26:24 +0100 kendy r268051 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Improved mergeTopMarks(). - instead of bool, it accepts MergeMarksEnum with values MERGE_MARKS_APPEND, MERGE_MARKS_PREPEND, and MERGE_MARKS_POSTPONE, which should be more readable - MERGE_MARKS_POSTPONE is a new thing, it allows to write output that is written with the next mergeTopMarks() - useful when you get some data too early and need to write them after the end of data that you are just writing. 2009-02-17 12:26:05 +0100 kendy r268050 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Output of images; framework is mostly done, but disabled due to problems with order. [So far it would be output inside rPr which is not what we want ;-)] 2009-02-17 12:25:41 +0100 kendy r268049 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Intoduced OUString DrawingML::WriteImage( const Graphic& rGraphic ). Additionally - added the possibility to write images to word/ subdir in the zip container, not just ppt/ - added 'wp' to the known tokens - fixed Graphic::GetLink() in vcl to be 'const' - added svx and vcl to the dependencies of oox 2009-02-17 12:25:18 +0100 kendy r268048 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat merged binary and ooxml filters export. 2009-02-17 12:24:55 +0100 kendy r268047 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Core properties created (still have to write the dates) 2009-02-17 12:24:32 +0100 kendy r268046 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Added support for GetExpression and SetExpression fields (only in text format). 2009-02-17 12:24:09 +0100 kendy r268045 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Some more fields supported 2009-02-17 12:23:49 +0100 kendy r268044 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Some more fields 2009-02-17 12:23:27 +0100 kendy r268043 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Write also numbering type "none". 2009-02-17 12:23:07 +0100 kendy r268041 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Numbering finished, implemented the rest of the level information. 2009-02-17 12:22:45 +0100 kendy r268040 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx fields exports: the start of the way 2009-02-17 12:22:23 +0100 kendy r268039 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Write abstract numbering definitions including the levels. Not all of the information is written yet, but will be soon ;-) 2009-02-17 12:22:00 +0100 kendy r268038 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Implementation of the abstract numbering definitions, not yet finished. 2009-02-17 12:21:39 +0100 kendy r268037 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Output numbering definition instances. Abstract numbering definitions are still TODO. 2009-02-17 12:21:21 +0100 kendy r268036 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Rename OutListTab() -> NumberingDefinitions(), and OutListTabLevels() -> AbstractNumberingDefinitions(). This is better aligned with what is used in the docx documentation. 2009-02-17 12:21:00 +0100 kendy r268035 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Changed the ColorToHex to support the "auto" value Code cleaning according to kendy's remarks 2009-02-17 12:20:37 +0100 kendy r268034 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat table horizontal merge 2009-02-17 12:20:15 +0100 kendy r268033 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky impl_convertColor() is not necessary, we already have impl_ColorToHex(). 2009-02-17 12:19:52 +0100 kendy r268032 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx Line numbering 2009-02-17 12:19:31 +0100 kendy r268031 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat docx: Implemented Section Types 2009-02-17 12:19:09 +0100 kendy r268030 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat FIX for borders: documents with no section border didn't wrote completely 2009-02-17 12:18:50 +0100 kendy r268029 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Fixed some output errors for paragraphs borders 2009-02-17 12:18:31 +0100 kendy r268028 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Fixed docx page border export problems and added color support 2009-02-17 12:18:13 +0100 kendy r268027 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Beginning of page borders implementation 2009-02-17 12:17:54 +0100 kendy r268026 : #i96319# WW8 filter rework + docx export From: Radek Doulik * export line arrow ends 2009-02-17 12:17:34 +0100 kendy r268025 : #i96319# WW8 filter rework + docx export From: Radek Doulik * make helper function GetLineArrow public so that it can be used in ooxml export put it in EscherPropertyContainer class (static method) 2009-02-17 12:17:16 +0100 kendy r268024 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat renamed AppendRelation to AddRelation. 2009-02-17 12:16:58 +0100 kendy r268023 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Fixed hyperlinks style. Fixed having a run of text before the hyperlink 2009-02-17 12:16:39 +0100 kendy r268022 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Initialize m_pHyperlinkAttrList to NULL. 2009-02-17 12:16:17 +0100 kendy r268021 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat Fixed the Hyperlink output Partly fixed the language Id output 2009-02-17 12:15:54 +0100 kendy r268020 : #i96319# WW8 filter rework + docx export From: Radek Doulik * fix type mismatch in gradient code * add flip and rotation parameters to shape transformation 2009-02-17 12:15:29 +0100 kendy r268019 : #i96319# WW8 filter rework + docx export From: Radek Doulik * finished gradient fill 2009-02-17 12:15:07 +0100 kendy r268018 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat + docx URL export: output is still wrong 2009-02-17 12:14:44 +0100 kendy r268017 : #i96319# WW8 filter rework + docx export From: Radek Doulik * export linear and axial gradients 2009-02-17 12:14:27 +0100 kendy r268016 : #i96319# WW8 filter rework + docx export From: Radek Doulik * export line joint type 2009-02-17 12:14:05 +0100 kendy r268015 : #i96319# WW8 filter rework + docx export From: Radek Doulik * export dashed lines 2009-02-17 12:13:48 +0100 kendy r268014 : #i96319# WW8 filter rework + docx export From: Cedric Bosdonnat cast problems fixed 2009-02-17 12:13:25 +0100 kendy r268013 : #i96319# WW8 filter rework + docx export From: Radek Doulik * added outline export * wrapped debug printfs in DBG * fix text color and typeface placement * do not write empty runs * do not write empty paragraph properties * added end paragraph properties - need to be filled later 2009-02-17 12:13:02 +0100 kendy r268012 : #i96319# WW8 filter rework + docx export From: Radek Doulik export language and fonts are now accepted by msppt 2009-02-17 12:12:44 +0100 kendy r268011 : #i96319# WW8 filter rework + docx export From: Radek Doulik re-enable pptx export - it was disabled by ooxml02 changes committed to git repo 2009-02-17 12:12:22 +0100 kendy r268010 : #i96319# WW8 filter rework + docx export From: Radek Doulik fix build 2009-02-17 12:12:04 +0100 kendy r268009 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Merge ooxml02 fixes. 2009-02-17 12:11:43 +0100 kendy r268008 : #i96319# WW8 filter rework + docx export From: Radek Doulik move drawingml export to oox/ from sd/ 2009-02-17 12:11:20 +0100 kendy r268007 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Revert commit 8b63649bf0a5d14703459bbf31e1599d592a5dff. It was already fixed easier way. 2009-02-17 12:11:00 +0100 kendy r268006 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor oox fixes to help sc compile... * inc/oox/core/contexthandler2.hxx, inc/oox/drawingml/chart/modelbase.hxx, inc/oox/drawingml/customshapeproperties.hxx, inc/oox/helper/attributelist.hxx, inc/oox/ppt/pptimport.hxx, inc/oox/ppt/slidepersist.hxx: #include not "tokens.hxx" as these files are deployed into solver, and there is no "tokens.hxx" in other modules (such as sc). * prj/d.lst: Deliver enough header files to let sc build some more... 2009-02-17 12:10:34 +0100 kendy r268005 : #i96319# WW8 filter rework + docx export From: Jonathan Pryor Deliver tablestylelist.hxx. * d.lst: Deliver inc/oox/drawingml/table/tablestylelist.hxx, as it's needed by sc export. 2009-02-17 12:10:13 +0100 kendy r268004 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Fix few warnings in sw, and disable DocxExport::WriteNumbering() for now. 2009-02-17 12:09:56 +0100 kendy r268003 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Add empty implementations of 2 abstract import XmlFilterBase methods. To be able to instantiate DocxExportFilter again... 2009-02-17 12:09:35 +0100 kendy r268002 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Resolve an unresolved, forgotten chunk [GetAttr() -> GetFmtAttr()]. 2009-02-17 12:09:08 +0100 kendy r268001 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Field work seems to compile now. Contains also a rename of OutField() to OutputField() to match better the other changes. 2009-02-17 12:08:46 +0100 kendy r268000 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Fix build, WriteOutliner() is now in WW8Export. 2009-02-17 12:08:26 +0100 kendy r267999 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky OutListTab() split into 2 methods [OutListTab() and OutListTabLevels()]. Also introduced a general WW8Export::WriteNumbering() which calls the needed methods. OutListTabLevels() is planned to be reused in docx export as well. 2009-02-17 12:08:09 +0100 kendy r267998 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky DupNumRuleWithLvlStart() renamed to DuplicateNumRule(). 2009-02-17 12:07:40 +0100 kendy r267997 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Check for max numbering level can be in ParaNumRule(). 2009-02-17 12:07:20 +0100 kendy r267996 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Few whitespace changes. 2009-02-17 12:06:49 +0100 kendy r267995 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky GetId( const SwNumRule& rNumRule ) should not be const. If the first thing it does is a const_cast<...>( this ), then something is wrong ;-) 2009-02-17 12:06:29 +0100 kendy r267994 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Redlining: Save author and date. 2009-02-17 12:06:07 +0100 kendy r267993 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Output redlining. So far just insertion and deletion of text, and without author and timestamp. 2009-02-17 12:05:45 +0100 kendy r267992 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Write the font table. 2009-02-17 12:05:27 +0100 kendy r267991 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Get ready to output the fonts. 2009-02-17 12:05:06 +0100 kendy r267990 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Fix namespace of relation id, and output of headers and footers works now... It's r:id, not w:id ;-) 2009-02-17 12:04:40 +0100 kendy r267988 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Write actual headers and footers in docx. #i96319# WW8 filter rework + docx export 2009-02-17 12:04:17 +0100 kendy r267987 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky A small cleanup. 2009-02-17 12:04:00 +0100 kendy r267986 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Fix the regression, caused by SetupSectionPositions() not being virtual (accidentally). 2009-02-17 12:03:40 +0100 kendy r267985 : #i96319# WW8 filter rework + docx export From: Fridrich Strba another iteration of numbering, utterly broken, but not crashing anything 2009-02-17 12:03:18 +0100 kendy r267984 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky SectionProperties() code is now common for binary and docx. Unfortunately binary output does not pass the tests now. 2009-02-17 12:02:49 +0100 kendy r267983 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Improving the SectionProperties() method to be shared between ww8 and docx. Not there yet, but getting closer ;-) The docx code is still a placeholder only. 2009-02-17 12:02:29 +0100 kendy r267982 : #i96319# WW8 filter rework + docx export From: Fridrich Strba some more work towards the numbering.xml 2009-02-17 12:02:08 +0100 kendy r267981 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Get rid of rLnNumInfo and aLineNum. 2009-02-17 12:01:44 +0100 kendy r267980 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky We are in attribute output already. 2009-02-17 12:01:21 +0100 kendy r267979 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Get rid of unsigned int nHdFtGroup. 2009-02-17 12:01:03 +0100 kendy r267978 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Introduce WW8AttributeOutput::SectionProperties(). The goal is to share this between ww8 and docx. 2009-02-17 12:00:45 +0100 kendy r267977 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Be careful, m_pSections/CurrentSectionInfo() might be NULL. 2009-02-17 12:00:22 +0100 kendy r267976 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Write section properties even for the last section. 2009-02-17 11:59:59 +0100 kendy r267975 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Output sections (w:sectPr) and columns. 2009-02-17 11:59:34 +0100 kendy r267974 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky WW8_SepInfo: Move to constructor, what belongs there. 2009-02-17 11:59:14 +0100 kendy r267973 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Remove an obsolete commented out piece. 2009-02-17 11:58:53 +0100 kendy r267972 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Output columns break (when the section has more columns). 2009-02-17 11:58:35 +0100 kendy r267971 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Hook the output of the docx sections to the right place. 2009-02-17 11:58:17 +0100 kendy r267970 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Rename OutputSfxBreakItems() to OutputSectionBreaks(). 2009-02-17 11:57:58 +0100 kendy r267969 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Remove an non-needed comment, add an interesting one. 2009-02-17 11:57:39 +0100 kendy r267968 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Get rid of OutputPageSectionBreaks(), dissolve it into other methods. 2009-02-17 11:57:19 +0100 kendy r267967 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Fix regression in AttributeOutputBase::FormatBreak(). git bisect, thank you so much! :-) 2009-02-17 11:57:00 +0100 kendy r267966 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Move pDop and pFib to WW8Export. 2009-02-17 11:56:42 +0100 kendy r267965 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Implement DocxExport::PrepareNewPageDesc(). 2009-02-17 11:56:24 +0100 kendy r267964 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Improve WW8Export::PrepareNewPageDesc(). 2009-02-17 11:56:04 +0100 kendy r267963 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Move part of WW8_WrPlcSepx::OutHeaderFooter() to MSWordExportBase::WriteHeaderFooterText(). 2009-02-17 11:55:27 +0100 kendy r267961 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Share OutHeader() nad OutFooter() (remove copy'n'paste). 2009-02-17 11:55:06 +0100 kendy r267960 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Rename WriteKFTxt1() to WriteHeaderFooterText() and move it to MSWordExportBase. 2009-02-17 11:54:41 +0100 kendy r267959 : #i96319# WW8 filter rework + docx export From: Fridrich Strba extracting the ParaNumRule to MSWordExportBase 2009-02-17 11:54:20 +0100 kendy r267958 : #i96319# WW8 filter rework + docx export From: Fridrich Strba write out w:numPr node into document.xml + converting some tabs to 4 spaces 2009-02-17 11:53:56 +0100 kendy r267957 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky MSWordSections split into the base and WW8 specific (WW8_WrPlcSepx). [WW8_WrPlcSepx was the original name of MSWordSections - let it there to decrease confusion ;-)] 2009-02-17 11:53:31 +0100 kendy r267956 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Fix docx export crash by initializing pSepx. 2009-02-17 11:53:11 +0100 kendy r267955 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky MSWordExportBase::OutputPageSectionBreaks() is now common for binary and docx. 2009-02-17 11:52:48 +0100 kendy r267954 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky AttributeOutputBase::FormatPageDescription() is now common for binary and docx. 2009-02-17 11:52:28 +0100 kendy r267953 : #i96319# WW8 filter rework + docx export From: Fridrich Strba write an empty numbering stream 2009-02-17 11:52:06 +0100 kendy r267952 : #i96319# WW8 filter rework + docx export From: Fridrich Strba some more of the spacing 2009-02-17 11:51:39 +0100 kendy r267951 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Rename WW8_WrPlcSepx to MSWordSections. 2009-02-17 11:51:19 +0100 kendy r267950 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Move pSepx initialization to the WW8_WrPlcSepx constructor. 2009-02-17 11:50:53 +0100 kendy r267949 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Fixed styles id's (in styles.xml). Now the styles seem to work pretty well. 2009-02-17 11:50:33 +0100 kendy r267948 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Rename AttributeOutput's Style() to ParagraphStyle(), that is more correct. 2009-02-17 11:50:11 +0100 kendy r267947 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky FormatBreak() is now in the common AttributeOutputBase. And pageBreakBefore works now... 2009-02-17 11:49:49 +0100 kendy r267946 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Few obvious m_rWW8Export -> GetExport() in WW8AttributeOutput::FormatBreak(). 2009-02-17 11:49:28 +0100 kendy r267945 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Add PageBreakBefore() to AttrbuteOutput's. It's a preparation for moving FormatBreak() to the generic AttributeOutputBase, and also kills some copy and paste. 2009-02-17 11:49:08 +0100 kendy r267944 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Debug output of attributes is not needed any more, remove. 2009-02-17 11:48:46 +0100 kendy r267943 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Don't create a new AttributeOutput in WW8_WrPlcSepx::WriteKFTxt(). 2009-02-17 11:48:25 +0100 kendy r267942 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Move pEnd and pFtn from MSWordExportBase to WW8Export. 2009-02-17 11:48:03 +0100 kendy r267941 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Now outputting footnotes and endnotes. Their styles are not output correctly yet, thus the number of the footnote resp. endnote is not distinguished from the text of the paragraph. Another problem that is missing. 2009-02-17 11:47:42 +0100 kendy r267940 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Output of footnote/endnote references. And it's prepared for the output of footnote.xml resp. endnote.xml as well. 2009-02-17 11:47:21 +0100 kendy r267939 : #i96319# WW8 filter rework + docx export From: Fridrich Strba some more para properties: widows control, para-splitting and incomplete implementation of spacing 2009-02-17 11:46:59 +0100 kendy r267938 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Make a bit more obvious what's happenning with AttributeLists. 2009-02-17 11:46:38 +0100 kendy r267937 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Part of the footnote/endnote stuff is shared now between binary and docx. It is just a small part, but better than nothing ;-) I'm not sure that sharing more is possible/reasonable at all... 2009-02-17 11:46:16 +0100 kendy r267936 : #i96319# WW8 filter rework + docx export From: Fridrich Strba adding paragraph indentation 2009-02-17 11:45:56 +0100 kendy r267935 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Rename AddWordBookmark() -> AppendWordBookmark(). 2009-02-17 11:45:36 +0100 kendy r267934 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Remove 2nd param from AppendBookmark(), nobody was using that anyway. 2009-02-17 11:45:19 +0100 kendy r267933 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Readability improvements in WW8_WrPlcSubDoc::WriteGenericPlc(). 2009-02-17 11:44:53 +0100 kendy r267932 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Better readable WW8_WrPlcSubDoc::WriteGenericTxt(). 2009-02-17 11:44:35 +0100 kendy r267931 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Move WriteSpecialText() from WW8Export to MSWordExportBase. 2009-02-17 11:44:12 +0100 kendy r267930 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Support for color value 'auto' - used often in the styles. 2009-02-17 11:43:48 +0100 kendy r267929 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Comment the mark()/mergeTopMarks() magic for paragraphs + par. properties. 2009-02-17 11:43:31 +0100 kendy r267928 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Remove the styles debug output. 2009-02-17 11:43:14 +0100 kendy r267927 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Output of styles reworked. The ooxml stuff is implemented as well, but not tested yet. 2009-02-17 11:42:54 +0100 kendy r267926 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Output word/styles.xml - empty one for now. 2009-02-17 11:42:36 +0100 kendy r267925 : #i96319# WW8 filter rework + docx export From: Fridrich Strba Paragraph properties framework + tab stop + paragraph justification + converting some tabs to 4 spaces 2009-02-17 11:42:18 +0100 kendy r267924 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky More preparations for outputting the styles table in docx. 2009-02-17 11:41:56 +0100 kendy r267923 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Initialize pStyles even for docx. MSWordStyles was changed so that it can be initialized from any pDoc, it needs WW8Export just for writing ww8 styles. 2009-02-17 11:41:36 +0100 kendy r267922 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Rename WW8WrtStyle to MSWordStyles. 2009-02-17 11:41:14 +0100 kendy r267921 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Uncomment nStyleBeforeFly = GetId( lcl_getFormatCollection( *this, &rNode ) ); 2009-02-17 11:40:50 +0100 kendy r267920 : #i96319# WW8 filter rework + docx export From: Fridrich Strba oops, write actually the lang property 2009-02-17 11:40:24 +0100 kendy r267919 : #i96319# WW8 filter rework + docx export From: Fridrich Strba character kerning and character language 2009-02-17 11:40:06 +0100 kendy r267918 : #i96319# WW8 filter rework + docx export From: Fridrich Strba implement font names and also the asian layout part of run properties 2009-02-17 11:39:41 +0100 kendy r267917 : #i96319# WW8 filter rework + docx export From: Fridrich Strba this looks like a typo, it should be EndBracket for this one, I assume 2009-02-17 11:39:21 +0100 kendy r267916 : #i96319# WW8 filter rework + docx export From: Fridrich Strba removing some unnecessary warnings 2009-02-17 11:38:56 +0100 kendy r267915 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky OutputTableNode() finally moved to MSWordExportBase. EndTableRow() from *AttributeOutput gets too much parameters now, but unfortunately, at the moment it was the easiest solution. As more functionality will move to the actuall cell output, this will get a bit nicer I hope ;-) 2009-02-17 11:38:36 +0100 kendy r267913 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Trivial output of table cells. Still not complete, OutputTableNode() still contains some WW8-only stuff. 2009-02-17 11:38:10 +0100 kendy r267912 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Reduced code in DocxAttributeOutput::RunText()/impl_RunText(). 2009-02-17 11:37:51 +0100 kendy r267911 : #i96319# WW8 filter rework + docx export From: Fridrich Strba handle also tabs :) 2009-02-17 11:37:28 +0100 kendy r267910 : #i96319# WW8 filter rework + docx export From: Fridrich Strba generically filter out any character that is ascii < 0x20 from the string we write to the file 2009-02-17 11:37:10 +0100 kendy r267909 : #i96319# WW8 filter rework + docx export From: Fridrich Strba wrap debug output in #if #endif statements 2009-02-17 11:36:48 +0100 kendy r267908 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky StartTableRow(), EndTableRow(), and TableRowProperties() for *AttributeOutput. And the appropriate rework in OutputTableNode() (still no ooxml output yet, but getting closer. 2009-02-17 11:36:29 +0100 kendy r267907 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky StartTable() and EndTable() for *AttributeOutput. And the appropriate rework in OutputTableNode() [which is still let in WW8Export, but it's move to MSWordExportBase is close ;-)]. 2009-02-17 11:36:09 +0100 kendy r267906 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Improve readability in OutputTableNode; Out_SfxBreakItems -> MSWordExportBase. Out_SfxBreakItems was also renamed to OutputSfxBreakItems. 2009-02-17 11:35:50 +0100 kendy r267905 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Cosmetic change: OutputFlyFrameImpl() -> OutputFlyFrame_Impl(). 2009-02-17 11:35:30 +0100 kendy r267904 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Change WW8SaveData into SaveData() and RestoreData() methods. WW8SaveData was hard to extend to be able to handle WW8Export and DocxExport at the same time; so instead there are now SaveData() and RestoreData() virtual methods in MSWordExportBase, and the appropriate additions are solved directly in WW8Export (nothing for DocxExport [yet?]). 2009-02-17 11:35:12 +0100 kendy r267903 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Write line breaks. 2009-02-17 11:34:54 +0100 kendy r267902 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky More from WW8Export::ExportDocument_Impl() to MSWordExportBase::ExportDocument(). 2009-02-17 11:34:36 +0100 kendy r267901 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Rename StoreDoc() to ExportDocument(), and move it to MSWordExportBase. The format-dependant parts were moved to a virtual ExportDocument_Impl(). 2009-02-17 11:34:19 +0100 kendy r267900 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Explicitely default construct maMarkStack [to be safe ;-)]. 2009-02-17 11:34:01 +0100 kendy r267899 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Fix few crashes in DocAttributeOutput.cxx (missing FSNS() in vararg). 2009-02-17 11:33:43 +0100 kendy r267898 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Rename writeMarked() to mergeTopMarks() and improve the implementation. Just writing the top mark is not enough; in more complex scenarios it would destroy the order completely. This way we have better control over what's happening, and can nest the mark()/mergeTopMarks()/mergeTopMarks( true ) as necessary directly in the start/end tags. 2009-02-17 11:33:25 +0100 kendy r267897 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Use serializer's mark() and writeMarked() to change order of and ... instead of using m_aText to remember the content of the text. That wouldn't work later anyway - we will probably need to change the order of the paragraph properties and text runs as well which will be done easily using mark() and writeMarked() as well. 2009-02-17 11:33:06 +0100 kendy r267896 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Outputting docx runs with attributes works now. 2009-02-17 11:32:48 +0100 kendy r267895 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky The msword filter compiles again. Added empty implementations of the virtual methods to DocxExport and DocxAttributeBase [printing 'TODO Blah::bleh()' ;-)]. The thing binary output still passes the testsuite, yay! 2009-02-17 11:32:30 +0100 kendy r267894 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky OutputTextNode() is not virtual any more and sits in MSWordExportBase. Lots of stuff has been moved around again - mostly from WW8Export to MSWordExportBase (for the gerenalized stuff) and to WW8AttributeOutput (for the 'hardcore' output of bytes/sprms/data/...) At the moment, it compiles, but the docx part of the filter does not link thanks to the missing implementation of DocxAttributeOutput methods (the new ones). 2009-02-17 11:32:11 +0100 kendy r267893 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Documentation updates. 2009-02-17 11:31:48 +0100 kendy r267892 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Change harcoded sprm ids to consts (reused from writerfilter). This adds a build dependency of sw on writerfilter - hopefully it's OK. 2009-02-17 11:31:28 +0100 kendy r267891 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Get rid of *NodeOutput classes, the code belongs directly to *Export. The callbacks I moved to newly created classes NodeOutputBase, WW8NodeOutput, or DocxNodeOutput respectively in fact should not be in separate classes, but directy in MSWordExportBase, WW8Export, or DocxExport respectively. This commit moves them accordingly. 2009-02-17 11:31:06 +0100 kendy r267890 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky bUnicode -> m_rWW8Export.bWrtWW8; it's the same in this context. 2009-02-17 11:30:44 +0100 kendy r267889 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Remove unnecessary {} block. 2009-02-17 11:30:24 +0100 kendy r267888 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Several German comments to English. 2009-02-17 11:30:08 +0100 kendy r267887 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Move pO cleanup directly into aAttrIter.OutAttr(). 2009-02-17 11:29:44 +0100 kendy r267886 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Shorten WW8NodeOutput::TextNode() by moving SwFmtDrop output to a separate method. 2009-02-17 11:29:22 +0100 kendy r267885 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Unified the use of m_rWW8Export.pO in WW8NodeOutput::TextNode(). In some cases, it was used as m_rWW8Export.pO, in the others as only pO (but meaning the same thing). Changed all the occurences to the simple pO to improve readability. 2009-02-17 11:29:00 +0100 kendy r267884 : #i96319# WW8 filter rework + docx export From: Fridrich Strba and other attributes coming in; we start to have all the more or less easy ones covered now 2009-02-17 11:28:43 +0100 kendy r267883 : #i96319# WW8 filter rework + docx export From: Fridrich Strba some more attributes are comming in 2009-02-17 11:28:26 +0100 kendy r267882 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Create DocxNodeOutput. The basic one with a trivial implementation of TexNode() method so that it at least outputs all the paragraphs as one text run. 2009-02-17 11:28:03 +0100 kendy r267881 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky WriteText() moved from WW8Export do MSWordExportBase. And some refactoring implied by the move. 2009-02-17 11:27:35 +0100 kendy r267880 : #i96319# WW8 filter rework + docx export From: Fridrich Strba some more character attributes implemented 2009-02-17 11:27:18 +0100 kendy r267879 : #i96319# WW8 filter rework + docx export From: Fridrich Strba some text attributes + build fixes (not very informative, but it is me) 2009-02-17 11:26:57 +0100 kendy r267878 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky WW8Export holds an instance of WW8NodeOutput. Instead of creating a new one with every call of WW8Export::WriteText(). 2009-02-17 11:26:35 +0100 kendy r267877 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Get rid of aWW8NodeFnTab callbacks. Introduce NodeOutputBase/WW8NodeOutput instead, and change the OutWW8_* functions to the WW8NodeOutput methods. 2009-02-17 11:26:13 +0100 kendy r267876 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky pCurPam and pOrigPam back to MSWordExportBase. Looks necessary there... 2009-02-17 11:25:52 +0100 kendy r267875 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky DocxAttributeOutput implementation. So far just bare bones printing TODO's to stderr + output of real and ; also nothing instantiates it yet. 2009-02-17 11:25:30 +0100 kendy r267874 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Fixed a problem that more attributes were exported than necessary. 2009-02-17 11:25:10 +0100 kendy r267873 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Moving more stuff from MSWordExportBase to WW8Export. pCurPam and pOrigPam, pO, and pTableStream and pDataStream. Hopefully I won't have to move them back at some stage ;-) 2009-02-17 11:24:49 +0100 kendy r267872 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Cosmetic. 2009-02-17 11:24:27 +0100 kendy r267871 : #i96319# WW8 filter rework + docx export From: Fridrich Strba fix nondebug build too 2009-02-17 11:24:07 +0100 kendy r267870 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky After rework - even saves a trivial document :-) 2009-02-17 11:23:45 +0100 kendy r267869 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky SwWW8Writer and the attributes rework compiles now. Of course, no idea yet if it works at all. 2009-02-17 11:23:25 +0100 kendy r267868 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Ancestor of MSWordExportBase for docx. Just a dump of the work, still just writing the 'Hello, world!' document [if it compiled, which it does not ;-)] 2009-02-17 11:23:03 +0100 kendy r267867 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Instead of callbacks, use virtual functions to output attributes. This is just a dump of the rewrite, for sure does not compile. All the SwWW8Out_ callbacks were moved to a class dedicated for output - WW8AttributeOutput. It is a descendant of AttributeOutputBase; there will be a separate implementation for the docx case. 2009-02-17 11:22:43 +0100 kendy r267866 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Partial split of SwWW8Writer. Introduced a new structure - the logic of the filter will be in class MSWordExportBase, from which we will derive WW8Export and DocxExport. SwWW8Writer has been split into WW8Export (for the logic) and SwWW8Writer (for the actual access to the stream). For most of the methods it means renaming SwWW8Writer::MethodName() to WW8Export::MethodName() + cleaning access to the attributes/other methods. All this is not finished yet, and does not even compile - but it is necessary to dump the current status ;-) 2009-02-17 11:22:25 +0100 kendy r267865 : #i96319# WW8 filter rework + docx export From: Fridrich Strba do the filter forwarding the pure UNO way (hell expensive, but no build dependency on anything) 2009-02-17 11:22:06 +0100 kendy r267864 : #i96319# WW8 filter rework + docx export From: Fridrich Strba yay, we have the same component doing the import and export for word 2007 2009-02-17 11:21:46 +0100 kendy r267863 : #i96319# WW8 filter rework + docx export From: Fridrich Strba more work towards having the import and export in the same component 2009-02-17 11:21:20 +0100 kendy r267862 : #i96319# WW8 filter rework + docx export From: Fridrich Strba starting to forward export in writerfilter 2009-02-17 11:20:58 +0100 kendy r267860 : #i96319# WW8 filter rework + docx export From: Fridrich Strba trying to fix some of the registration stuff 2009-02-17 11:20:35 +0100 kendy r267859 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Exporting a real document. So far just a hardcoded 'Hello, world!' of course ;-) 2009-02-17 11:20:13 +0100 kendy r267858 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Renamed DocxWriter to DocxExportFilter. (...and also the files that contain it) 2009-02-17 11:19:52 +0100 kendy r267857 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky The initial exporter. Can be chosen from the menu, but so far we can just get a SwDoc* in the exportDocument() method, and consequently the exported file has zero size. 2009-02-17 11:19:30 +0100 kendy r267854 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Simple output of the styles. As just the and attributes work for now, the output is not much helpful ;-) - but as a proof-of-concept, this must be enough... 2009-02-17 11:15:14 +0100 kendy r267852 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky The fonts are between and . 2009-02-17 11:11:06 +0100 kendy r267851 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Proof-of-concept saving the fonts (word/fontTable.xml). As with the previous commits, it is just dumped to stderr. 2009-02-17 11:08:36 +0100 kendy r267850 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Proof-of-concept saving attributes of the text runs. Still using the DOCX debug class, which will be gone in the real implementation. 2009-02-17 11:04:40 +0100 kendy r267848 : #i96319# WW8 filter rework + docx export From: Jan Holesovsky Proof-of-concept save of paragraphs/runs/text. The paragraph pieces of DOCX just get dumped to stdout while saving the 'normal' DOC. This is just a hacky way of doing it, will be cleaned up (and converted to actual output to a stream) when I get the attributes, and distinction between main document/headers/footers/etc. right. 2009-02-17 11:02:54 +0100 kendy r267847 : #i96319# WW8 filter rework + docx export From: Fridrich Strba Make writerfilter export filter too (at least formally) 2009-02-16 22:48:29 +0100 kendy r267840 : CWS-TOOLING: rebase CWS ooxml03 to trunk@267171 (milestone: DEV300:m41) --- chart2/source/controller/makefile.mk | 1 + chart2/source/view/makefile.mk | 2 +- sc/util/makefile.mk | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/chart2/source/controller/makefile.mk b/chart2/source/controller/makefile.mk index d2d399d22cff..45060a60d297 100644 --- a/chart2/source/controller/makefile.mk +++ b/chart2/source/controller/makefile.mk @@ -90,6 +90,7 @@ SHL1STDLIBS= $(CHARTTOOLS) \ $(SALLIB) \ $(SVLLIB) \ $(SVTOOLLIB) \ + $(SVXCORELIB) \ $(SVXLIB) \ $(TKLIB) \ $(TOOLSLIB) \ diff --git a/chart2/source/view/makefile.mk b/chart2/source/view/makefile.mk index 58229edf1217..8ab947b9cedc 100644 --- a/chart2/source/view/makefile.mk +++ b/chart2/source/view/makefile.mk @@ -82,7 +82,7 @@ SHL1STDLIBS= $(CHARTTOOLS) \ $(SALLIB) \ $(SVLLIB) \ $(SVTOOLLIB) \ - $(SVXLIB) \ + $(SVXCORELIB) \ $(TOOLSLIB) \ $(UNOTOOLSLIB) \ $(BASEGFXLIB) \ diff --git a/sc/util/makefile.mk b/sc/util/makefile.mk index 3fc0712cd996..49eb10b7e8b4 100644 --- a/sc/util/makefile.mk +++ b/sc/util/makefile.mk @@ -82,6 +82,7 @@ SHL1STDLIBS= \ $(SFXLIB) \ $(SVTOOLLIB) \ $(SVLLIB) \ + $(SVXCORELIB) \ $(SVXLIB) \ $(GOODIESLIB) \ $(BASEGFXLIB) \ @@ -188,6 +189,8 @@ SHL6STDLIBS= \ $(SFXLIB) \ $(SVTOOLLIB) \ $(SVLLIB) \ + $(SVXCORELIB) \ + $(SVXMSFILTERLIB) \ $(SVXLIB) \ $(BASEGFXLIB) \ $(DRAWINGLAYERLIB) \ @@ -215,6 +218,7 @@ DEF8NAME=$(SHL8TARGET) SHL8STDLIBS= \ $(ISCLIB) \ + $(SVXCORELIB) \ $(SVXLIB) \ $(SFX2LIB) \ $(SVTOOLLIB) \ @@ -306,7 +310,7 @@ SHL9STDLIBS= \ $(SALLIB)\ $(BASICLIB) \ $(SFXLIB) \ - $(SVXLIB) \ + $(SVXCORELIB) \ $(SVTOOLLIB) \ $(SVLLIB) \ $(ISCLIB) \ -- cgit From 546fcd1cb956034d0652b4b8a27ca9cab2300bf0 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Tue, 25 Aug 2009 13:53:16 +0000 Subject: CWS-TOOLING: integrate CWS koheicoderemoval02 2009-07-24 Kohei Yoshida Resurrected one method that was now used after the rebase. Now the entire sc module builds. 2009-07-24 Kohei Yoshida Rebased to DEV300_m53. 2009-07-23 Kohei Yoshida resolved conflict during merge to DEV300_m52. 2009-05-09 Kohei Yoshida #i95953# partially applied Caolan's patch. 2009-05-09 Kohei Yoshida #i101326# Removed old pivot implementation code that was already disabled. 2009-05-09 Kohei Yoshida More unused methods commented out. 2009-05-09 Kohei Yoshida More unused methods commented out. 2009-05-08 Kohei Yoshida Removed more unused methods, mostly related to binfilter methods. 2009-05-08 Kohei Yoshida #i95953# the first round of unused method removal, based solely on Caolan's list. All removed methods were double-checked manually to make sure they are really unused, followed by a build test with debug on. --- sc/inc/address.hxx | 2 +- sc/inc/attarray.hxx | 3 +- sc/inc/attrib.hxx | 4 +- sc/inc/cell.hxx | 7 - sc/inc/chartarr.hxx | 1 - sc/inc/chartpos.hxx | 5 +- sc/inc/chgtrack.hxx | 62 - sc/inc/collect.hxx | 6 - sc/inc/column.hxx | 10 +- sc/inc/conditio.hxx | 4 - sc/inc/dapiuno.hxx | 3 - sc/inc/dbcolect.hxx | 2 - sc/inc/document.hxx | 25 +- sc/inc/docuno.hxx | 1 - sc/inc/dpcachetable.hxx | 6 - sc/inc/dpobject.hxx | 6 +- sc/inc/dpsave.hxx | 1 - sc/inc/dptabsrc.hxx | 4 +- sc/inc/global.hxx | 9 +- sc/inc/markarr.hxx | 2 +- sc/inc/olinetab.hxx | 2 - sc/inc/pivot.hxx | 232 +-- sc/inc/rangenam.hxx | 6 +- sc/inc/rechead.hxx | 27 - sc/inc/scmatrix.hxx | 10 +- sc/inc/stlpool.hxx | 2 +- sc/inc/subtotal.hxx | 29 - sc/inc/table.hxx | 8 +- sc/inc/validat.hxx | 2 - sc/source/core/data/attarray.cxx | 6 +- sc/source/core/data/attrib.cxx | 160 +- sc/source/core/data/cell.cxx | 17 - sc/source/core/data/column.cxx | 10 +- sc/source/core/data/column2.cxx | 48 +- sc/source/core/data/conditio.cxx | 7 - sc/source/core/data/documen2.cxx | 60 +- sc/source/core/data/documen3.cxx | 47 - sc/source/core/data/document.cxx | 20 +- sc/source/core/data/dpcachetable.cxx | 25 - sc/source/core/data/dpobject.cxx | 67 - sc/source/core/data/dpsave.cxx | 25 - sc/source/core/data/dpsdbtab.cxx | 9 - sc/source/core/data/dpshttab.cxx | 6 - sc/source/core/data/dptabsrc.cxx | 34 +- sc/source/core/data/global2.cxx | 42 +- sc/source/core/data/markarr.cxx | 8 +- sc/source/core/data/pivot.cxx | 1991 -------------------- sc/source/core/data/pivot2.cxx | 426 ----- sc/source/core/data/stlpool.cxx | 8 +- sc/source/core/data/table1.cxx | 10 +- sc/source/core/data/table2.cxx | 46 +- sc/source/core/data/validat.cxx | 7 - sc/source/core/inc/refupdat.hxx | 5 - sc/source/core/tool/address.cxx | 14 +- sc/source/core/tool/chartpos.cxx | 62 +- sc/source/core/tool/chgtrack.cxx | 514 ----- sc/source/core/tool/collect.cxx | 32 - sc/source/core/tool/compiler.cxx | 71 - sc/source/core/tool/rangenam.cxx | 46 +- sc/source/core/tool/rechead.cxx | 56 - sc/source/core/tool/refupdat.cxx | 33 - sc/source/core/tool/scmatrix.cxx | 84 +- sc/source/core/tool/subtotal.cxx | 182 -- sc/source/filter/excel/excrecds.cxx | 6 - sc/source/filter/excel/tokstack.cxx | 50 +- sc/source/filter/excel/xelink.cxx | 10 +- sc/source/filter/excel/xename.cxx | 8 +- sc/source/filter/excel/xepivot.cxx | 16 +- sc/source/filter/excel/xetable.cxx | 60 +- sc/source/filter/excel/xiescher.cxx | 8 +- sc/source/filter/excel/xihelper.cxx | 38 +- sc/source/filter/excel/xilink.cxx | 66 +- sc/source/filter/excel/xlstyle.cxx | 10 +- sc/source/filter/inc/excrecds.hxx | 1 - sc/source/filter/inc/op.h | 2 +- sc/source/filter/inc/qpro.hxx | 1 - sc/source/filter/inc/tokstack.hxx | 2 +- sc/source/filter/inc/xelink.hxx | 4 +- sc/source/filter/inc/xename.hxx | 4 +- sc/source/filter/inc/xepivot.hxx | 8 +- sc/source/filter/inc/xetable.hxx | 34 +- sc/source/filter/inc/xiescher.hxx | 4 +- sc/source/filter/inc/xihelper.hxx | 40 +- sc/source/filter/inc/xlstyle.hxx | 4 +- sc/source/filter/lotus/op.cxx | 28 +- sc/source/filter/qpro/qpro.cxx | 6 - .../AccessibleDocumentPagePreview.cxx | 74 +- sc/source/ui/dbgui/csvtablebox.cxx | 56 +- sc/source/ui/docshell/docfunc.cxx | 72 +- sc/source/ui/docshell/docsh5.cxx | 7 - sc/source/ui/formdlg/privsplt.cxx | 18 - sc/source/ui/inc/AccessibleDocumentPagePreview.hxx | 6 +- sc/source/ui/inc/anyrefdg.hxx | 1 - sc/source/ui/inc/csvtablebox.hxx | 10 +- sc/source/ui/inc/docfunc.hxx | 2 +- sc/source/ui/inc/docsh.hxx | 7 - sc/source/ui/inc/drawview.hxx | 2 +- sc/source/ui/inc/gridwin.hxx | 17 - sc/source/ui/inc/output.hxx | 2 + sc/source/ui/inc/privsplt.hxx | 1 - sc/source/ui/inc/refundo.hxx | 6 - sc/source/ui/inc/tabview.hxx | 2 +- sc/source/ui/inc/undotab.hxx | 40 +- sc/source/ui/inc/viewutil.hxx | 2 + sc/source/ui/miscdlgs/anyrefdg.cxx | 5 - sc/source/ui/undo/refundo.cxx | 21 - sc/source/ui/undo/undotab.cxx | 107 +- sc/source/ui/unoobj/chart2uno.cxx | 47 - sc/source/ui/unoobj/docuno.cxx | 7 - sc/source/ui/view/cellsh2.cxx | 16 - sc/source/ui/view/drawview.cxx | 50 +- sc/source/ui/view/gridwin.cxx | 24 - sc/source/ui/view/gridwin2.cxx | 444 ----- sc/source/ui/view/output.cxx | 14 +- sc/source/ui/view/tabview.cxx | 32 +- sc/source/ui/view/tabview3.cxx | 10 - sc/source/ui/view/viewutil.cxx | 34 +- 117 files changed, 791 insertions(+), 5414 deletions(-) diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index f1859be15fcf..728f011c3cbc 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -276,7 +276,7 @@ public: {} /* Use the formula::FormulaGrammar::AddressConvention associated with rAddr::Tab() */ Details( const ScDocument* pDoc, const ScAddress & rAddr ); - void SetPos( const ScDocument* pDoc, const ScAddress & rAddr ); +//UNUSED2009-05 void SetPos( const ScDocument* pDoc, const ScAddress & rAddr ); }; SC_DLLPUBLIC static const Details detailsOOOa1; diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx index 1f6c02c2d74f..5cbe1bafd290 100644 --- a/sc/inc/attarray.hxx +++ b/sc/inc/attarray.hxx @@ -110,8 +110,9 @@ public: void SetTab(SCTAB nNewTab) { nTab = nNewTab; } void SetCol(SCCOL nNewCol) { nCol = nNewCol; } - +#ifdef DBG_UTIL void TestData() const; +#endif void Reset( const ScPatternAttr* pPattern, BOOL bAlloc = TRUE ); BOOL Concat(SCSIZE nPos); diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx index cae72cf30cf5..8dd77cf68c3f 100644 --- a/sc/inc/attrib.hxx +++ b/sc/inc/attrib.hxx @@ -244,8 +244,8 @@ public: const IntlWrapper* pIntl = 0 ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - BOOL GetTableList( List& aList ) const; - void SetTableList( const List& aList ); +//UNUSED2009-05 BOOL GetTableList( List& aList ) const; +//UNUSED2009-05 void SetTableList( const List& aList ); public: USHORT nCount; diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx index 10de035abf7c..1e9a8618800e 100644 --- a/sc/inc/cell.hxx +++ b/sc/inc/cell.hxx @@ -59,9 +59,6 @@ class ScCodeArray; class ScProgress; class ScPostIt; -class ScMultipleReadHeader; -class ScMultipleWriteHeader; - // ============================================================================ /** Default cell clone flags: do not start listening, do not adjust 3D refs to @@ -196,10 +193,6 @@ public: ~ScNoteCell(); #endif - ScNoteCell( SvStream& rStream, USHORT nVer ); - - void Save( SvStream& rStream ) const; - private: ScNoteCell( const ScNoteCell& ); }; diff --git a/sc/inc/chartarr.hxx b/sc/inc/chartarr.hxx index e2650c5652c1..b04c70eb01b3 100644 --- a/sc/inc/chartarr.hxx +++ b/sc/inc/chartarr.hxx @@ -40,7 +40,6 @@ class ScAddress; class Table; class ScDocument; -class ScMultipleReadHeader; // ScMemChart is a stripped-down SchMemChart from old chart, diff --git a/sc/inc/chartpos.hxx b/sc/inc/chartpos.hxx index b3b6e8763eb1..cd0bd47f2a32 100644 --- a/sc/inc/chartpos.hxx +++ b/sc/inc/chartpos.hxx @@ -100,8 +100,8 @@ public: return ppRowHeader[ nChartRow ]; return NULL; } - ScRangeListRef GetColRanges( SCCOL nChartCol ) const; - ScRangeListRef GetRowRanges( SCROW nChartRow ) const; +//UNUSED2009-05 ScRangeListRef GetColRanges( SCCOL nChartCol ) const; +//UNUSED2009-05 ScRangeListRef GetRowRanges( SCROW nChartRow ) const; }; @@ -114,7 +114,6 @@ enum ScChartGlue { }; class ScDocument; -class ScMultipleReadHeader; class ScChartPositioner // nur noch Parameter-Struct { diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx index 54a6570c0f1d..6707473f5610 100644 --- a/sc/inc/chgtrack.hxx +++ b/sc/inc/chgtrack.hxx @@ -89,8 +89,6 @@ enum ScChangeActionClipMode }; class SvStream; -class ScMultipleReadHeader; -class ScMultipleWriteHeader; // --- ScChangeActionLinkEntry --------------------------------------------- @@ -278,28 +276,8 @@ protected: const ScBigRange&, const ULONG nAction); - ScChangeAction( SvStream&, - ScMultipleReadHeader&, ScChangeTrack* ); virtual ~ScChangeAction(); - static void StoreCell( ScBaseCell*, SvStream&, - ScMultipleWriteHeader& ); - static ScBaseCell* LoadCell( SvStream&, ScMultipleReadHeader&, - ScDocument*, USHORT nVer ); - - static BOOL StoreLinkChain( ScChangeActionLinkEntry*, - SvStream& ); - static BOOL LoadLinkChain( ScChangeAction*, - ScChangeActionLinkEntry**, - SvStream&, ScChangeTrack*, - BOOL bLinkDeleted ); - - static BOOL StoreCellList( ScChangeActionCellListEntry*, - SvStream& ); - static BOOL LoadCellList( ScChangeAction* pOfAction, - ScChangeActionCellListEntry*&, SvStream&, - ScChangeTrack* ); - String GetRefString( const ScBigRange&, ScDocument*, BOOL bFlag3D = FALSE ) const; @@ -367,10 +345,6 @@ protected: // used in Reject() instead of IsRejectable() BOOL IsInternalRejectable() const; - virtual BOOL Store( SvStream&, ScMultipleWriteHeader& ) const; - virtual BOOL StoreLinks( SvStream& ) const; - virtual BOOL LoadLinks( SvStream&, ScChangeTrack* ); - // Derived classes that hold a pointer to the // ChangeTrack must return that. Otherwise NULL. virtual const ScChangeTrack* GetChangeTrack() const = 0; @@ -491,8 +465,6 @@ class ScChangeActionIns : public ScChangeAction friend class ScChangeTrack; ScChangeActionIns( const ScRange& rRange ); - ScChangeActionIns( SvStream&, - ScMultipleReadHeader&, ScChangeTrack* ); virtual ~ScChangeActionIns(); virtual void AddContent( ScChangeActionContent* ) {} @@ -500,8 +472,6 @@ class ScChangeActionIns : public ScChangeAction virtual BOOL Reject( ScDocument* ); - virtual BOOL Store( SvStream&, ScMultipleWriteHeader& ) const; - virtual const ScChangeTrack* GetChangeTrack() const { return 0; } public: @@ -586,9 +556,6 @@ class ScChangeActionDel : public ScChangeAction ScChangeActionDel( const ScRange& rRange, SCsCOL nDx, SCsROW nDy, ScChangeTrack* ); - ScChangeActionDel( SvStream&, - ScMultipleReadHeader&, ScDocument*, - USHORT nVer, ScChangeTrack* ); virtual ~ScChangeActionDel(); ScChangeActionIns* GetCutOffInsert() { return pCutOff; } @@ -607,9 +574,6 @@ class ScChangeActionDel : public ScChangeAction virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; } - virtual BOOL StoreLinks( SvStream& ) const; - virtual BOOL LoadLinks( SvStream&, ScChangeTrack* ); - public: ScChangeActionDel(const ULONG nActionNumber, const ScChangeActionState eState, @@ -687,8 +651,6 @@ class ScChangeActionMove : public ScChangeAction nStartLastCut(0), nEndLastCut(0) {} - ScChangeActionMove( SvStream&, - ScMultipleReadHeader&, ScChangeTrack* ); virtual ~ScChangeActionMove(); virtual void AddContent( ScChangeActionContent* ); @@ -709,10 +671,6 @@ class ScChangeActionMove : public ScChangeAction virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; } - virtual BOOL Store( SvStream&, ScMultipleWriteHeader& ) const; - virtual BOOL StoreLinks( SvStream& ) const; - virtual BOOL LoadLinks( SvStream&, ScChangeTrack* ); - protected: using ScChangeAction::GetRefString; @@ -765,10 +723,6 @@ class ScChangeActionContent : public ScChangeAction ScChangeActionContent* pNextInSlot; // in gleichem Slot ScChangeActionContent** ppPrevInSlot; - ScChangeActionContent( SvStream&, - ScMultipleReadHeader&, ScDocument*, - USHORT nVer, ScChangeTrack* ); - void InsertInSlot( ScChangeActionContent** pp ) { if ( !ppPrevInSlot ) @@ -849,10 +803,6 @@ class ScChangeActionContent : public ScChangeAction void PutValueToDoc( ScBaseCell*, const String&, ScDocument*, SCsCOL nDx, SCsROW nDy ) const; - virtual BOOL Store( SvStream&, ScMultipleWriteHeader& ) const; - virtual BOOL StoreLinks( SvStream& ) const; - virtual BOOL LoadLinks( SvStream&, ScChangeTrack* ); - protected: using ScChangeAction::GetRefString; @@ -983,8 +933,6 @@ class ScChangeActionReject : public ScChangeAction SetRejectAction( nReject ); SetState( SC_CAS_ACCEPTED ); } - ScChangeActionReject( SvStream&, - ScMultipleReadHeader&, ScChangeTrack* ); virtual void AddContent( ScChangeActionContent* ) {} virtual void DeleteCellEntries() {} @@ -993,8 +941,6 @@ class ScChangeActionReject : public ScChangeAction virtual const ScChangeTrack* GetChangeTrack() const { return 0; } - virtual BOOL Store( SvStream&, ScMultipleWriteHeader& ) const; - public: ScChangeActionReject(const ULONG nActionNumber, const ScChangeActionState eState, @@ -1282,11 +1228,6 @@ public: // alter Wert aus pOldCell, Format aus Doc void AppendContent( const ScAddress& rPos, const ScBaseCell* pOldCell ); - // nachdem neuer Wert im Dokument gesetzt wurde, - // alter Wert aus pOldCell, Format aus RefDoc - void AppendContent( const ScAddress& rPos, - const ScBaseCell* pOldCell, - ScDocument* pRefDoc ); // nachdem neue Werte im Dokument gesetzt wurden, // alte Werte aus RefDoc/UndoDoc. // Alle Contents, wo im RefDoc eine Zelle steht. @@ -1312,9 +1253,6 @@ public: // NewValue bzw. Formelerzeugung) // bevor neuer Wert im Dokument gesetzt wird - void AppendContent( const ScAddress& rPos, - const String& rNewValue ); - // bevor neuer Wert im Dokument gesetzt wird void AppendContent( const ScAddress& rPos, const String& rNewValue, ScBaseCell* pOldCell ); diff --git a/sc/inc/collect.hxx b/sc/inc/collect.hxx index de6539b08311..8f6388a86040 100644 --- a/sc/inc/collect.hxx +++ b/sc/inc/collect.hxx @@ -143,9 +143,6 @@ public: virtual ScDataObject* Clone() const; StrData* operator[]( const USHORT nIndex) const {return (StrData*)At(nIndex);} virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; - - void Load( SvStream& ); - void Store( SvStream& ) const; }; //------------------------------------------------------------------------ @@ -178,9 +175,6 @@ public: private: friend class TypedScStrCollection; -#if OLD_PIVOT_IMPLEMENTATION - friend class PivotScStrCollection; -#endif String aStrValue; double nValue; diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index c66ecb960e7d..816a8ade4628 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -58,8 +58,6 @@ class ScBaseCell; class ScDocument; class ScFormulaCell; class ScMarkData; -class ScMultipleReadHeader; -class ScMultipleWriteHeader; class ScPatternAttr; class ScStyleSheet; class SvtBroadcaster; @@ -146,8 +144,8 @@ public: void SwapRow( SCROW nRow1, SCROW nRow2 ); void SwapCell( SCROW nRow, ScColumn& rCol); - BOOL HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes, - BOOL bLeft, BOOL bRight ) const; +//UNUSED2009-05 BOOL HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes, +//UNUSED2009-05 BOOL bLeft, BOOL bRight ) const; BOOL HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const; BOOL HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const; BOOL ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow, @@ -164,7 +162,7 @@ public: SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const; BOOL HasDataAt(SCROW nRow) const; BOOL HasVisibleDataAt(SCROW nRow) const; - SCROW GetFirstDataPos() const; +//UNUSED2009-05 SCROW GetFirstDataPos() const; SCROW GetLastDataPos() const; SCROW GetLastVisDataPos(BOOL bNotes) const; // ohne Broadcaster SCROW GetFirstVisDataPos(BOOL bNotes) const; @@ -258,7 +256,7 @@ public: BOOL HasStringData( SCROW nRow ) const; BOOL HasValueData( SCROW nRow ) const; - USHORT GetErrorData( SCROW nRow) const; +//UNUSED2009-05 USHORT GetErrorData( SCROW nRow) const; BOOL HasStringCells( SCROW nStartRow, SCROW nEndRow ) const; /** Returns the pointer to a cell note object at the passed row. */ diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index edb0f9371788..141cb5706515 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -40,8 +40,6 @@ class ScBaseCell; class ScFormulaCell; class ScTokenArray; -class ScMultipleReadHeader; -class ScMultipleWriteHeader; class ScRangeList; @@ -285,8 +283,6 @@ public: ScConditionalFormat* GetFormat( sal_uInt32 nKey ); -//UNUSED2008-05 void ResetUsed(); - void CompileAll(); void CompileXML(); void UpdateReference( UpdateRefMode eUpdateRefMode, diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx index 341300228869..c3d5db0bc72b 100644 --- a/sc/inc/dapiuno.hxx +++ b/sc/inc/dapiuno.hxx @@ -72,9 +72,6 @@ namespace com { namespace sun { namespace star { namespace sheet { }}}} class ScDocShell; -#if OLD_PIVOT_IMPLEMENTATION -class ScPivot; -#endif class ScDPSaveDimension; class ScDPSaveGroupDimension; class ScDPSaveNumGroupDimension; diff --git a/sc/inc/dbcolect.hxx b/sc/inc/dbcolect.hxx index 2056bcb331f1..3d9d357b512b 100644 --- a/sc/inc/dbcolect.hxx +++ b/sc/inc/dbcolect.hxx @@ -42,8 +42,6 @@ //------------------------------------------------------------------------ class ScDocument; -class ScMultipleReadHeader; -class ScMultipleWriteHeader; //------------------------------------------------------------------------ diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index c8d3751a7aaf..69c3d6140431 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -99,10 +99,6 @@ class ScFormulaCell; class ScMarkData; class ScOutlineTable; class ScPatternAttr; -#if OLD_PIVOT_IMPLEMENTATION -class ScPivot; -class ScPivotCollection; -#endif class ScPrintRangeSaver; class ScRangeData; class ScRangeName; @@ -237,9 +233,6 @@ friend class ScHorizontalAttrIterator; friend class ScDocAttrIterator; friend class ScAttrRectIterator; friend class ScDocShell; -#if OLD_PIVOT_IMPLEMENTATION -friend class ScPivot; -#endif private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager; @@ -261,9 +254,6 @@ private: ScTable* pTab[MAXTABCOUNT]; ScRangeName* pRangeName; ScDBCollection* pDBCollection; -#if OLD_PIVOT_IMPLEMENTATION - ScPivotCollection* pPivotCollection; -#endif ScDPCollection* pDPCollection; ScChartCollection* pChartCollection; std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock; @@ -497,11 +487,6 @@ public: SC_DLLPUBLIC ScDPCollection* GetDPCollection(); ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const; ScDPObject* GetDPAtBlock( const ScRange& rBlock ) const; -#if OLD_PIVOT_IMPLEMENTATION - ScPivotCollection* GetPivotCollection() const; - void SetPivotCollection(ScPivotCollection* pNewPivotCollection); - ScPivot* GetPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const; -#endif SC_DLLPUBLIC ScChartCollection* GetChartCollection() const; void StopTemporaryChartLock(); @@ -724,8 +709,8 @@ public: BOOL HasSubTotalCells( const ScRange& rRange ); SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell, BOOL bForceTab = FALSE ); - SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell, - ULONG nFormatIndex, BOOL bForceTab = FALSE); +//UNUSED2009-05 SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell, +//UNUSED2009-05 ULONG nFormatIndex, BOOL bForceTab = FALSE); SC_DLLPUBLIC void PutCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell, BOOL bForceTab = FALSE ); SC_DLLPUBLIC void PutCell(SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell, @@ -1345,8 +1330,8 @@ public: SC_DLLPUBLIC void ClearPrintRanges( SCTAB nTab ); /** Adds a new print ranges. */ SC_DLLPUBLIC void AddPrintRange( SCTAB nTab, const ScRange& rNew ); - /** Removes all old print ranges and sets the passed print ranges. */ - void SetPrintRange( SCTAB nTab, const ScRange& rNew ); +//UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */ +//UNUSED2009-05 void SetPrintRange( SCTAB nTab, const ScRange& rNew ); /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */ SC_DLLPUBLIC void SetPrintEntireSheet( SCTAB nTab ); SC_DLLPUBLIC void SetRepeatColRange( SCTAB nTab, const ScRange* pNew ); @@ -1683,7 +1668,7 @@ public: SC_DLLPUBLIC SfxItemPool* GetEnginePool() const; SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine(); SC_DLLPUBLIC ScNoteEditEngine& GetNoteEngine(); - SfxItemPool& GetNoteItemPool(); +//UNUSED2009-05 SfxItemPool& GetNoteItemPool(); ScRefreshTimerControl* GetRefreshTimerControl() const { return pRefreshTimerControl; } diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index defe627dd812..c4b6413c7d58 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -127,7 +127,6 @@ public: void UpdateAllRowHeights( const ScMarkData* pTabMark = NULL ); - ScDrawLayer* MakeDrawLayer(); void BeforeXMLLoading(); void AfterXMLLoading(sal_Bool bRet); diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx index 93cd12c4c937..2115eab7cc42 100644 --- a/sc/inc/dpcachetable.hxx +++ b/sc/inc/dpcachetable.hxx @@ -176,11 +176,6 @@ public: const String* getFieldName(sal_Int32 nIndex) const; - /** Get the field index (i.e. column ID in the original data source) based - on the string value that corresponds with the column title. It returns - -1 if no field matching the string value exists. */ - sal_Int32 getFieldIndex(const String& rStr) const; - /** Get the unique entries for a field specified by index. The caller must make sure that the table is filled before calling function, or it will get an empty collection. */ @@ -194,7 +189,6 @@ public: const ::std::hash_set& rRepeatIfEmptyDims); void clear(); - void swap(ScDPCacheTable& rOther); bool empty() const; private: diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index cffe735f287a..2dc8829485c8 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -55,8 +55,6 @@ class Rectangle; class SvStream; class ScDPSaveData; class ScDPOutput; -class ScMultipleReadHeader; -class ScMultipleWriteHeader; class ScPivot; class ScPivotCollection; struct ScPivotParam; @@ -281,9 +279,7 @@ public: virtual ScDataObject* Clone() const; ScDPObject* operator[](USHORT nIndex) const {return (ScDPObject*)At(nIndex);} -#if OLD_PIVOT_IMPLEMENTATION - void ConvertOldTables( ScPivotCollection& rOldColl ); -#endif + void DeleteOnTab( SCTAB nTab ); void UpdateReference( UpdateRefMode eUpdateRefMode, const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx index 44689bcf0772..d3d8d4354145 100644 --- a/sc/inc/dpsave.hxx +++ b/sc/inc/dpsave.hxx @@ -128,7 +128,6 @@ public: void SetName( const String& rNew ); // used if the source dim was renamed (groups) SC_DLLPUBLIC void SetOrientation(USHORT nNew); - void SetSubTotals(BOOL bSet); // to be removed! SC_DLLPUBLIC void SetSubTotals(long nCount, const USHORT* pFuncs); long GetSubTotalsCount() const { return nSubTotalCount; } USHORT GetSubTotalFunc(long nIndex) const { return pSubTotalFuncs[nIndex]; } diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx index 59996d08b8aa..3b1d8e0e206e 100644 --- a/sc/inc/dptabsrc.hxx +++ b/sc/inc/dptabsrc.hxx @@ -185,7 +185,7 @@ public: ScDPDimensions* GetDimensionsObject(); - void DumpState( ScDocument* pDoc, const ScAddress& rPos ); +//UNUSED2009-05 void DumpState( ScDocument* pDoc, const ScAddress& rPos ); // XDimensionsSupplier virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > @@ -428,7 +428,7 @@ public: const ::com::sun::star::sheet::DataPilotFieldReference& GetReferenceValue() const; - BOOL IsValidPage( const ScDPItemData& rData ); +//UNUSED2009-05 BOOL IsValidPage( const ScDPItemData& rData ); }; class ScDPHierarchies : public cppu::WeakImplHelper2< diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index e329f477d824..7bdff1d0592e 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -86,13 +86,6 @@ extern "C" { #define SC_TRANSLITERATION_CASESENSE 0 #endif -// Remove the old pivot table implementation that the current data pilot -// implementation has effectively replaced. The old pivot code was still -// around to handle loading of the old binary format. Now that the old -// binary filter is handled by binfilter, we can safely remove the old pivot -// handling code. -#define OLD_PIVOT_IMPLEMENTATION 0 - //------------------------------------------------------------------------ struct LabelData; //------------------------------------------------------------------------ @@ -467,7 +460,7 @@ struct ScImportParam ScImportParam& operator= ( const ScImportParam& r ); BOOL operator== ( const ScImportParam& r ) const; - void Clear (); +//UNUSED2009-05 void Clear (); }; struct ScStringHashCode diff --git a/sc/inc/markarr.hxx b/sc/inc/markarr.hxx index 83a218887508..84d7a9d88a1a 100644 --- a/sc/inc/markarr.hxx +++ b/sc/inc/markarr.hxx @@ -65,7 +65,7 @@ public: void CopyMarksTo( ScMarkArray& rDestMarkArray ) const; BOOL Search( SCROW nRow, SCSIZE& nIndex ) const; - void DeleteArea(SCROW nStartRow, SCROW nEndRow); +//UNUSED2009-05 void DeleteArea(SCROW nStartRow, SCROW nEndRow); /// Including current row, may return -1 if bUp and not found SCsROW GetNextMarked( SCsROW nRow, BOOL bUp ) const; diff --git a/sc/inc/olinetab.hxx b/sc/inc/olinetab.hxx index 59846d7717a0..4d42accdf729 100644 --- a/sc/inc/olinetab.hxx +++ b/sc/inc/olinetab.hxx @@ -39,8 +39,6 @@ #define SC_OL_MAXDEPTH 7 class SvStream; -class ScMultipleReadHeader; -class ScMultipleWriteHeader; class ScOutlineEntry : public ScDataObject diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx index 66e87facfd9a..e77dd60f18bb 100644 --- a/sc/inc/pivot.hxx +++ b/sc/inc/pivot.hxx @@ -65,20 +65,9 @@ class SubTotal; #include #include -#if OLD_PIVOT_IMPLEMENTATION -#define PIVOT_STYLE_INNER 0 -#define PIVOT_STYLE_RESULT 1 -#define PIVOT_STYLE_CATEGORY 2 -#define PIVOT_STYLE_TITLE 3 -#define PIVOT_STYLE_FIELDNAME 4 -#define PIVOT_STYLE_TOP 5 -#endif - class SvStream; class ScDocument; class ScUserListData; -class ScMultipleReadHeader; -class ScMultipleWriteHeader; class ScProgress; struct LabelData; @@ -125,7 +114,7 @@ struct ScPivotParam ScPivotParam& operator= ( const ScPivotParam& r ); BOOL operator== ( const ScPivotParam& r ) const; - void Clear (); +//UNUSED2009-05 void Clear (); void ClearLabelData (); void ClearPivotArrays(); void SetLabelData ( LabelData** ppLabArr, @@ -142,228 +131,9 @@ struct ScPivotParam // ----------------------------------------------------------------------- -#if OLD_PIVOT_IMPLEMENTATION -struct PivotColRef -{ - SCSIZE nDataIndex; - SCSIZE nRecCount; - USHORT nFuncMask; - SCSIZE nIndex; - - PivotColRef() - { - nDataIndex = nRecCount = nIndex = 0; - nFuncMask = PIVOT_FUNC_NONE; - } -}; -#endif - typedef PivotField PivotFieldArr[PIVOT_MAXFIELD]; typedef PivotField PivotPageFieldArr[PIVOT_MAXPAGEFIELD]; -#if OLD_PIVOT_IMPLEMENTATION -class PivotScStrCollection : public ScStrCollection -{ - ScUserListData* pUserData; -public: - PivotScStrCollection(USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE) : - ScStrCollection ( nLim, nDel, bDup ), - pUserData (NULL) { } - PivotScStrCollection(const PivotScStrCollection& rPivotScStrCollection) : - ScStrCollection ( rPivotScStrCollection ), - pUserData ( rPivotScStrCollection.pUserData) {} - - virtual ScDataObject* Clone() const; - virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; - - TypedStrData* operator[]( const USHORT nIndex) const - { return (TypedStrData*)At(nIndex); } - void SetUserData(ScUserListData* pData) - { pUserData = pData; } - const String& GetString(USHORT nIndex) - { return ((TypedStrData*)At(nIndex))->GetString(); } - USHORT GetIndex(TypedStrData* pData) const; -}; - -class ScPivot : public ScDataObject -{ - ScDocument* pDoc; - ScQueryParam aQuery; - BOOL bHasHeader; - - BOOL bIgnoreEmpty; // Flags aus Dialog - BOOL bDetectCat; - BOOL bMakeTotalCol; - BOOL bMakeTotalRow; - - String aName; - String aTag; - SCSIZE nColNameCount; - String* pColNames; // Array - - SCCOL nSrcCol1; - SCROW nSrcRow1; - SCCOL nSrcCol2; - SCROW nSrcRow2; - SCTAB nSrcTab; - - SCCOL nDestCol1; - SCROW nDestRow1; - SCCOL nDestCol2; - SCROW nDestRow2; - SCTAB nDestTab; - - SCCOL nDataStartCol; - SCROW nDataStartRow; - - SCSIZE nColCount; - SCSIZE nRowCount; - SCSIZE nDataCount; - - PivotFieldArr aColArr; - PivotFieldArr aRowArr; - PivotFieldArr aDataArr; - - PivotScStrCollection* pColList[PIVOT_MAXFIELD]; // pro Zeile alle Eintraege - PivotScStrCollection* pRowList[PIVOT_MAXFIELD]; - PivotScStrCollection* pDataList; // Shortcut auf Col/RowList mit Daten - - SubTotal** ppDataArr; - SCSIZE nDataColCount; - SCSIZE nDataRowCount; - SCSIZE nRowIndex; - SCSIZE nColIndex; - SCSIZE nDataIndex; - SCSIZE nRecCount; - - PivotColRef* pColRef; - - BOOL bValidArea; - BOOL bDataAtCol; - -public: - ScPivot(ScDocument* pDocument); - ScPivot(const ScPivot& rPivot); - ~ScPivot(); - - virtual ScDataObject* Clone() const; - - ScPivot* CreateNew() const; - - BOOL Load(SvStream& rStream, ScMultipleReadHeader& rHdr ); - BOOL Store(SvStream& rStream, ScMultipleWriteHeader& rHdr ) const; - - void SetQuery(const ScQueryParam& rQuery); - void GetQuery(ScQueryParam& rQuery) const; - - void SetHeader(BOOL bHeader); - BOOL GetHeader() const; - void SetIgnoreEmpty(BOOL bIgnore); - BOOL GetIgnoreEmpty() const; - void SetDetectCat(BOOL bDetect); - BOOL GetDetectCat() const; - void SetMakeTotalCol(BOOL bSet); - BOOL GetMakeTotalCol() const; - void SetMakeTotalRow(BOOL bSet); - BOOL GetMakeTotalRow() const; - - void SetName(const String& rNew); - const String& GetName() const; - void SetTag(const String& rNew); - const String& GetTag() const; - - void SetSrcArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab); - void GetSrcArea(SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2, SCTAB& rTab) const; - ScRange GetSrcArea() const; - - void SetDestPos(SCCOL nCol, SCROW nRow, SCTAB nTab); - void GetDestArea(SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2, SCTAB& rTab) const; - ScRange GetDestArea() const; - - void SetColFields(const PivotField* pFieldArr, SCSIZE nCount); - void GetColFields(PivotField* pFieldArr, SCSIZE& rCount) const; - SCSIZE GetColFieldCount() const { return nColCount; } - - void SetRowFields(const PivotField* pFieldArr, SCSIZE nCount); - void GetRowFields(PivotField* pFieldArr, SCSIZE& rCount) const; - SCSIZE GetRowFieldCount() const { return nRowCount; } - - void SetDataFields(const PivotField* pFieldArr, SCSIZE nCount); - void GetDataFields(PivotField* pFieldArr, SCSIZE& rCount) const; - - void GetParam( ScPivotParam& rParam, ScQueryParam& rQuery, ScArea& rSrcArea ) const; - void SetParam( const ScPivotParam& rParam, const ScQueryParam& rQuery, - const ScArea& rSrcArea ); - - BOOL CreateData(BOOL bKeepDest = FALSE); - void DrawData(); - void ReleaseData(); - - BOOL IsPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const; - BOOL IsFilterAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const; - BOOL GetColFieldAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL& rField) const; - BOOL GetRowFieldAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL& rField) const; - - // Referenz-Anpassung: - - void MoveSrcArea( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab ); - void MoveDestArea( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab ); - void ExtendSrcArea( SCCOL nNewEndCol, SCROW nNewEndRow ); - -private: - BOOL CreateFields(); - void CreateFieldData(); - void CalcArea(); - - void SetDataLine(SCCOL nCol, SCROW nRow, SCTAB nTab, SCSIZE nRIndex); - void SetFuncLine(SCCOL nCol, SCROW nRow, SCTAB nTab, USHORT nFunc, SCSIZE nIndex, SCSIZE nStartRIndex, SCSIZE nEndRIndex); - void ColToTable(SCSIZE nField, SCROW& nRow, ScProgress& rProgress); - void RowToTable(SCSIZE nField, SCCOL& nCol); - void SetFrame(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nWidth = 20); - void SetFrameHor(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); - void SetFrameVer(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); - void SetFontBold(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); - void SetJustifyLeft(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); - void SetJustifyRight(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); - void SetStyle(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nId); - void SetButton(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); - void SetValue(SCCOL nCol, SCROW nRow, const SubTotal& rTotal, USHORT nFunc); - SCROW GetCategoryRow( SCCOL nCol, SCROW nRow ); -}; - -//------------------------------------------------------------------------ -class ScPivotCollection : public ScCollection -{ - -private: - ScDocument* pDoc; -public: - ScPivotCollection(USHORT nLim = 4, USHORT nDel = 4, ScDocument* pDocument = NULL) : - ScCollection ( nLim, nDel), - pDoc ( pDocument ) {} - ScPivotCollection(const ScPivotCollection& rScPivotCollection) : - ScCollection ( rScPivotCollection ), - pDoc ( rScPivotCollection.pDoc ) {} - - virtual ScDataObject* Clone() const; - ScPivot* operator[]( const USHORT nIndex) const {return (ScPivot*)At(nIndex);} - ScPivot* GetPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const; - - BOOL Load( SvStream& rStream ); - BOOL Store( SvStream& rStream ) const; - - void UpdateReference(UpdateRefMode eUpdateRefMode, - SCCOL nCol1, SCROW nRow1, SCTAB nTab1, - SCCOL nCol2, SCROW nRow2, SCTAB nTab2, - SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); - void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ); - - BOOL operator==(const ScPivotCollection& rCmp) const; - - String CreateNewName( USHORT nMin = 1 ) const; -}; -#endif - //------------------------------------------------------------------------ struct LabelData diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx index 002adf9b77ce..2c6f706ff403 100644 --- a/sc/inc/rangenam.hxx +++ b/sc/inc/rangenam.hxx @@ -40,8 +40,6 @@ //------------------------------------------------------------------------ class ScDocument; -class ScMultipleReadHeader; -class ScMultipleWriteHeader; namespace rtl { class OUStringBuffer; @@ -146,7 +144,7 @@ public: BOOL IsReference( ScRange& rRef, const ScAddress& rPos ) const; BOOL IsValidReference( ScRange& rRef ) const; - BOOL IsRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const; +//UNUSED2009-05 BOOL IsRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const; BOOL IsRangeAtBlock( const ScRange& ) const; void UpdateTabRef(SCTAB nOldTable, USHORT nFlag, SCTAB nNewTable); @@ -203,7 +201,7 @@ public: virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; virtual BOOL IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const; - ScRangeData* GetRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const; +//UNUSED2009-05 ScRangeData* GetRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const; SC_DLLPUBLIC ScRangeData* GetRangeAtBlock( const ScRange& ) const; SC_DLLPUBLIC BOOL SearchName( const String& rName, USHORT& rPos ) const; diff --git a/sc/inc/rechead.hxx b/sc/inc/rechead.hxx index 14be3ddcb325..a9e8a5cacd53 100644 --- a/sc/inc/rechead.hxx +++ b/sc/inc/rechead.hxx @@ -130,33 +130,6 @@ class SvStream; // ----------------------------------------------------------------------- -// "Automatischer" Record-Header mit Groessenangabe - -class ScReadHeader -{ -private: - SvStream& rStream; - ULONG nDataEnd; - -public: - ScReadHeader(SvStream& rNewStream); - ~ScReadHeader(); - - ULONG BytesLeft() const; -}; - -class ScWriteHeader -{ -private: - SvStream& rStream; - ULONG nDataPos; - sal_uInt32 nDataSize; - -public: - ScWriteHeader(SvStream& rNewStream, sal_uInt32 nDefault = 0); - ~ScWriteHeader(); -}; - // Header mit Groessenangaben fuer mehrere Objekte class ScMultipleReadHeader diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index 140d3dfe4c4a..7f3b5443d9d9 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -401,11 +401,11 @@ public: void MatTrans( ScMatrix& mRes) const; void MatCopy ( ScMatrix& mRes) const; - /** Copy upper left of this matrix to mRes matrix. - This matrix's dimensions must be greater or equal to the mRes matrix - dimensions. - */ - void MatCopyUpperLeft( ScMatrix& mRes) const; +//UNUSED2009-05 /** Copy upper left of this matrix to mRes matrix. +//UNUSED2009-05 This matrix's dimensions must be greater or equal to the mRes matrix +//UNUSED2009-05 dimensions. +//UNUSED2009-05 */ +//UNUSED2009-05 void MatCopyUpperLeft( ScMatrix& mRes) const; // Convert ScInterpreter::CompareMat values (-1,0,1) to boolean values void CompareEqual(); diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx index 86db2815a0d8..1028bb5f7673 100644 --- a/sc/inc/stlpool.hxx +++ b/sc/inc/stlpool.hxx @@ -63,7 +63,7 @@ public: ScStyleSheet* FindCaseIns( const String& rName, SfxStyleFamily eFam ); - void SetForceStdName( const String* pSet ); +//UNUSED2009-05 void SetForceStdName( const String* pSet ); const String* GetForceStdName() const { return pForceStdName; } virtual SfxStyleSheetBase& Make( const String&, SfxStyleFamily eFam, diff --git a/sc/inc/subtotal.hxx b/sc/inc/subtotal.hxx index adc604151f35..92e03e140288 100644 --- a/sc/inc/subtotal.hxx +++ b/sc/inc/subtotal.hxx @@ -35,35 +35,6 @@ class SubTotal { -#if OLD_PIVOT_IMPLEMENTATION -private: - long nCount; - long nCount2; - double nSum; - double nSumSqr; - double nMax; - double nMin; - double nProduct; - BOOL bSumOk; - BOOL bSumSqrOk; - BOOL bProductOk; - USHORT nProgress; - -public: - SCSIZE nIndex; // Test - -public: - SubTotal(); - ~SubTotal(); - - void UpdateNoVal(); - void Update( double nVal ); - void Update( const SubTotal& rVal ); - - short Valid( USHORT nFunction ) const; - // return 0 => Fehler, -1 => kein Wert, 1 => ok - double Result( USHORT nFunction ) const; -#endif public: static BOOL SafePlus( double& fVal1, double fVal2); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 8b2227d48dbb..bacd4d207cca 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -256,7 +256,7 @@ public: BOOL IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const; void PutCell( const ScAddress&, ScBaseCell* pCell ); - void PutCell( const ScAddress&, ULONG nFormatIndex, ScBaseCell* pCell); +//UNUSED2009-05 void PutCell( const ScAddress&, ULONG nFormatIndex, ScBaseCell* pCell); void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell ); void PutCell(SCCOL nCol, SCROW nRow, ULONG nFormatIndex, ScBaseCell* pCell); // TRUE = Zahlformat gesetzt @@ -459,7 +459,7 @@ public: const SvxBorderLine** ppLeft, const SvxBorderLine** ppTop, const SvxBorderLine** ppRight, const SvxBorderLine** ppBottom ) const; - BOOL HasLines( const ScRange& rRange, Rectangle& rSizes ) const; +//UNUSED2009-05 BOOL HasLines( const ScRange& rRange, Rectangle& rSizes ) const; BOOL HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nMask ) const; BOOL HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const; BOOL ExtendMerge( SCCOL nStartCol, SCROW nStartRow, @@ -542,8 +542,8 @@ public: void ClearPrintRanges(); /** Adds a new print ranges. */ void AddPrintRange( const ScRange& rNew ); - /** Removes all old print ranges and sets the passed print ranges. */ - void SetPrintRange( const ScRange& rNew ); +//UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */ +//UNUSED2009-05 void SetPrintRange( const ScRange& rNew ); /** Marks the specified sheet to be printed completely. Deletes old print ranges! */ void SetPrintEntireSheet(); diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx index cea9c154f04a..e41d81990378 100644 --- a/sc/inc/validat.hxx +++ b/sc/inc/validat.hxx @@ -200,8 +200,6 @@ public: ScValidationData* GetData( sal_uInt32 nKey ); - void ResetUsed(); - void CompileXML(); void UpdateReference( UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 00992cbf962a..c00cc111a7cd 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -103,10 +103,10 @@ ScAttrArray::~ScAttrArray() } //------------------------------------------------------------------------ - +#ifdef DBG_UTIL void ScAttrArray::TestData() const { -#ifdef DBG_UTIL + USHORT nErr = 0; if (pData) { @@ -129,8 +129,8 @@ void ScAttrArray::TestData() const aMsg += ByteString::CreateFromInt32(nCol); DBG_ERROR( aMsg.GetBuffer() ); } -#endif } +#endif //------------------------------------------------------------------------ diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx index a5f38c813d8c..dcc6418445fa 100644 --- a/sc/source/core/data/attrib.cxx +++ b/sc/source/core/data/attrib.cxx @@ -636,32 +636,32 @@ SfxItemPresentation ScTableListItem::GetPresentation // ----------------------------------------------------------------------- -BOOL ScTableListItem::GetTableList( List& aList ) const -{ - for ( USHORT i=0; i 0 ); -} +//UNUSED2009-05 BOOL ScTableListItem::GetTableList( List& aList ) const +//UNUSED2009-05 { +//UNUSED2009-05 for ( USHORT i=0; i 0 ); +//UNUSED2009-05 } // ----------------------------------------------------------------------- -void ScTableListItem::SetTableList( const List& rList ) -{ - nCount = (USHORT)rList.Count(); - - delete [] pTabArr; - - if ( nCount > 0 ) - { - pTabArr = new SCTAB [nCount]; - - for ( USHORT i=0; i 0 ) +//UNUSED2009-05 { +//UNUSED2009-05 pTabArr = new SCTAB [nCount]; +//UNUSED2009-05 +//UNUSED2009-05 for ( USHORT i=0; iType() == aExtFileId ) - { - bConvert = TRUE; - nConvPara = nPara; - nConvPos = nPos; - } - return EMPTY_STRING; -} - -//UNUSED2008-05 BOOL ScFieldChangerEditEngine::ConvertFields() -//UNUSED2008-05 { -//UNUSED2008-05 BOOL bConverted = FALSE; -//UNUSED2008-05 do -//UNUSED2008-05 { -//UNUSED2008-05 bConvert = FALSE; -//UNUSED2008-05 UpdateFields(); -//UNUSED2008-05 if ( bConvert ) -//UNUSED2008-05 { -//UNUSED2008-05 ESelection aSel( nConvPara, nConvPos, nConvPara, nConvPos+1 ); -//UNUSED2008-05 QuickInsertField( SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD), aSel ); -//UNUSED2008-05 bConverted = TRUE; -//UNUSED2008-05 } -//UNUSED2008-05 } while ( bConvert ); -//UNUSED2008-05 return bConverted; -//UNUSED2008-05 } +//UNUSED2009-05 class ScFieldChangerEditEngine : public ScEditEngineDefaulter +//UNUSED2009-05 { +//UNUSED2009-05 TypeId aExtFileId; +//UNUSED2009-05 USHORT nConvPara; +//UNUSED2009-05 xub_StrLen nConvPos; +//UNUSED2009-05 BOOL bConvert; +//UNUSED2009-05 +//UNUSED2009-05 public: +//UNUSED2009-05 ScFieldChangerEditEngine( SfxItemPool* pEnginePool, BOOL bDeleteEnginePool ); +//UNUSED2009-05 virtual ~ScFieldChangerEditEngine() {} +//UNUSED2009-05 +//UNUSED2009-05 virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, +//UNUSED2009-05 USHORT nPos, Color*& rTxtColor, +//UNUSED2009-05 Color*& rFldColor ); +//UNUSED2009-05 +//UNUSED2009-05 BOOL ConvertFields(); +//UNUSED2009-05 }; +//UNUSED2009-05 +//UNUSED2009-05 ScFieldChangerEditEngine::ScFieldChangerEditEngine( SfxItemPool* pEnginePoolP, +//UNUSED2009-05 BOOL bDeleteEnginePoolP ) : +//UNUSED2009-05 ScEditEngineDefaulter( pEnginePoolP, bDeleteEnginePoolP ), +//UNUSED2009-05 aExtFileId( TYPE( SvxExtFileField ) ), +//UNUSED2009-05 nConvPara( 0 ), +//UNUSED2009-05 nConvPos( 0 ), +//UNUSED2009-05 bConvert( FALSE ) +//UNUSED2009-05 { +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 String ScFieldChangerEditEngine::CalcFieldValue( const SvxFieldItem& rField, +//UNUSED2009-05 USHORT nPara, USHORT nPos, Color*& /* rTxtColor */, Color*& /* rFldColor */ ) +//UNUSED2009-05 { +//UNUSED2009-05 const SvxFieldData* pFieldData = rField.GetField(); +//UNUSED2009-05 if ( pFieldData && pFieldData->Type() == aExtFileId ) +//UNUSED2009-05 { +//UNUSED2009-05 bConvert = TRUE; +//UNUSED2009-05 nConvPara = nPara; +//UNUSED2009-05 nConvPos = nPos; +//UNUSED2009-05 } +//UNUSED2009-05 return EMPTY_STRING; +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 BOOL ScFieldChangerEditEngine::ConvertFields() +//UNUSED2009-05 { +//UNUSED2009-05 BOOL bConverted = FALSE; +//UNUSED2009-05 do +//UNUSED2009-05 { +//UNUSED2009-05 bConvert = FALSE; +//UNUSED2009-05 UpdateFields(); +//UNUSED2009-05 if ( bConvert ) +//UNUSED2009-05 { +//UNUSED2009-05 ESelection aSel( nConvPara, nConvPos, nConvPara, nConvPos+1 ); +//UNUSED2009-05 QuickInsertField( SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD), aSel ); +//UNUSED2009-05 bConverted = TRUE; +//UNUSED2009-05 } +//UNUSED2009-05 } while ( bConvert ); +//UNUSED2009-05 return bConverted; +//UNUSED2009-05 } void ScPageHFItem::SetLeftArea( const EditTextObject& rNew ) { diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx index da2de0b68099..364d8b1b3c52 100644 --- a/sc/source/core/data/cell.cxx +++ b/sc/source/core/data/cell.cxx @@ -582,23 +582,6 @@ ScNoteCell::~ScNoteCell() } #endif -ScNoteCell::ScNoteCell( SvStream& rStream, USHORT nVer ) : - ScBaseCell( CELLTYPE_NOTE ) -{ - if( nVer >= SC_DATABYTES2 ) - { - BYTE cData; - rStream >> cData; - if( cData & 0x0F ) - rStream.SeekRel( cData & 0x0F ); - } -} - -void ScNoteCell::Save( SvStream& rStream ) const -{ - rStream << (BYTE) 0x00; -} - // ============================================================================ ScValueCell::ScValueCell() : diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 3238607fd613..33b3404faec6 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -240,11 +240,11 @@ BOOL ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const } -BOOL ScColumn::HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes, - BOOL bLeft, BOOL bRight ) const -{ - return pAttrArray->HasLines( nRow1, nRow2, rSizes, bLeft, bRight ); -} +//UNUSED2009-05 BOOL ScColumn::HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes, +//UNUSED2009-05 BOOL bLeft, BOOL bRight ) const +//UNUSED2009-05 { +//UNUSED2009-05 return pAttrArray->HasLines( nRow1, nRow2, rSizes, bLeft, bRight ); +//UNUSED2009-05 } BOOL ScColumn::HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index a7a5ba39fc6a..01c72ab4e0c4 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1191,23 +1191,23 @@ BOOL ScMarkedDataIter::Next( SCSIZE& rIndex ) return TRUE; } -USHORT ScColumn::GetErrorData( SCROW nRow ) const -{ - SCSIZE nIndex; - if (Search(nRow, nIndex)) - { - ScBaseCell* pCell = pItems[nIndex].pCell; - switch (pCell->GetCellType()) - { - case CELLTYPE_FORMULA : - return ((ScFormulaCell*)pCell)->GetErrCode(); -// break; - default: - return 0; - } - } - return 0; -} +//UNUSED2009-05 USHORT ScColumn::GetErrorData( SCROW nRow ) const +//UNUSED2009-05 { +//UNUSED2009-05 SCSIZE nIndex; +//UNUSED2009-05 if (Search(nRow, nIndex)) +//UNUSED2009-05 { +//UNUSED2009-05 ScBaseCell* pCell = pItems[nIndex].pCell; +//UNUSED2009-05 switch (pCell->GetCellType()) +//UNUSED2009-05 { +//UNUSED2009-05 case CELLTYPE_FORMULA : +//UNUSED2009-05 return ((ScFormulaCell*)pCell)->GetErrCode(); +//UNUSED2009-05 // break; +//UNUSED2009-05 default: +//UNUSED2009-05 return 0; +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 return 0; +//UNUSED2009-05 } //------------ @@ -1376,13 +1376,13 @@ SCSIZE ScColumn::GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirecti return nLines; } -SCROW ScColumn::GetFirstDataPos() const -{ - if (nCount) - return pItems[0].nRow; - else - return 0; -} +//UNUSED2009-05 SCROW ScColumn::GetFirstDataPos() const +//UNUSED2009-05 { +//UNUSED2009-05 if (nCount) +//UNUSED2009-05 return pItems[0].nRow; +//UNUSED2009-05 else +//UNUSED2009-05 return 0; +//UNUSED2009-05 } SCROW ScColumn::GetLastDataPos() const { diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 3c636d9049d4..b4d8a5972211 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1553,13 +1553,6 @@ ScConditionalFormat* ScConditionalFormatList::GetFormat( sal_uInt32 nKey ) return NULL; } -//UNUSED2008-05 void ScConditionalFormatList::ResetUsed() -//UNUSED2008-05 { -//UNUSED2008-05 USHORT nCount = Count(); -//UNUSED2008-05 for (USHORT i=0; iSetUsed(FALSE); -//UNUSED2008-05 } - void ScConditionalFormatList::CompileAll() { USHORT nCount = Count(); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 16613fbcbab4..482aedbc7940 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -248,9 +248,6 @@ ScDocument::ScDocument( ScDocumentMode eMode, pRangeName = new ScRangeName( 4, 4, FALSE, this ); pDBCollection = new ScDBCollection( 4, 4, FALSE, this ); -#if OLD_PIVOT_IMPLEMENTATION - pPivotCollection = new ScPivotCollection(4, 4, this ); -#endif pSelectionAttr = NULL; pChartCollection = new ScChartCollection; apTemporaryChartLock = std::auto_ptr< ScTemporaryChartLock >( new ScTemporaryChartLock(this) ); @@ -421,9 +418,6 @@ ScDocument::~ScDocument() } delete pRangeName; delete pDBCollection; -#if OLD_PIVOT_IMPLEMENTATION - delete pPivotCollection; -#endif delete pSelectionAttr; apTemporaryChartLock.reset(); delete pChartCollection; @@ -548,12 +542,12 @@ ScNoteEditEngine& ScDocument::GetNoteEngine() return *pNoteEngine; } -SfxItemPool& ScDocument::GetNoteItemPool() -{ - if ( !pNoteItemPool ) - pNoteItemPool = new SfxItemPool(SdrObject::GetGlobalDrawObjectItemPool()); - return *pNoteItemPool; -} +//UNUSED2009-05 SfxItemPool& ScDocument::GetNoteItemPool() +//UNUSED2009-05 { +//UNUSED2009-05 if ( !pNoteItemPool ) +//UNUSED2009-05 pNoteItemPool = new SfxItemPool(SdrObject::GetGlobalDrawObjectItemPool()); +//UNUSED2009-05 return *pNoteItemPool; +//UNUSED2009-05 } void ScDocument::ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks ) { @@ -623,22 +617,22 @@ void ScDocument::PutCell( SCCOL nCol, SCROW nRow, SCTAB nTab, } } -void ScDocument::PutCell( const ScAddress& rPos, ScBaseCell* pCell, - ULONG nFormatIndex, BOOL bForceTab ) -{ - SCTAB nTab = rPos.Tab(); - if ( bForceTab && !pTab[nTab] ) - { - BOOL bExtras = !bIsUndo; // Spaltenbreiten, Zeilenhoehen, Flags - - pTab[nTab] = new ScTable(this, nTab, - String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("temp")), - bExtras, bExtras); - } - - if (pTab[nTab]) - pTab[nTab]->PutCell( rPos, nFormatIndex, pCell ); -} +//UNUSED2009-05 void ScDocument::PutCell( const ScAddress& rPos, ScBaseCell* pCell, +//UNUSED2009-05 ULONG nFormatIndex, BOOL bForceTab ) +//UNUSED2009-05 { +//UNUSED2009-05 SCTAB nTab = rPos.Tab(); +//UNUSED2009-05 if ( bForceTab && !pTab[nTab] ) +//UNUSED2009-05 { +//UNUSED2009-05 BOOL bExtras = !bIsUndo; // Spaltenbreiten, Zeilenhoehen, Flags +//UNUSED2009-05 +//UNUSED2009-05 pTab[nTab] = new ScTable(this, nTab, +//UNUSED2009-05 String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("temp")), +//UNUSED2009-05 bExtras, bExtras); +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 if (pTab[nTab]) +//UNUSED2009-05 pTab[nTab]->PutCell( rPos, nFormatIndex, pCell ); +//UNUSED2009-05 } BOOL ScDocument::GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow, BOOL bNotes ) const @@ -759,11 +753,6 @@ BOOL ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos ) pDBCollection->UpdateMoveTab( nOldPos, nNewPos ); xColNameRanges->UpdateReference( URM_REORDER, this, aSourceRange, 0,0,nDz ); xRowNameRanges->UpdateReference( URM_REORDER, this, aSourceRange, 0,0,nDz ); -#if OLD_PIVOT_IMPLEMENTATION - if (pPivotCollection) - pPivotCollection->UpdateReference( URM_REORDER, - 0,0,nOldPos, MAXCOL,MAXROW,nOldPos, 0,0,nDz ); -#endif if (pDPCollection) pDPCollection->UpdateReference( URM_REORDER, aSourceRange, 0,0,nDz ); if (pDetOpList) @@ -858,11 +847,6 @@ BOOL ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM pRangeName->UpdateTabRef(nNewPos, 1); pDBCollection->UpdateReference( URM_INSDEL, 0,0,nNewPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 ); -#if OLD_PIVOT_IMPLEMENTATION - if (pPivotCollection) - pPivotCollection->UpdateReference( - URM_INSDEL, 0,0,nNewPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 ); -#endif if (pDPCollection) pDPCollection->UpdateReference( URM_INSDEL, aRange, 0,0,1 ); if (pDetOpList) diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 08170fd6cdc9..dba29553462e 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -230,46 +230,6 @@ ScDPObject* ScDocument::GetDPAtBlock( const ScRange & rBlock ) const return NULL; } -#if OLD_PIVOT_IMPLEMENTATION -ScPivotCollection* ScDocument::GetPivotCollection() const -{ - return pPivotCollection; -} - -void ScDocument::SetPivotCollection(ScPivotCollection* pNewPivotCollection) -{ - if ( pPivotCollection && pNewPivotCollection && - *pPivotCollection == *pNewPivotCollection ) - { - delete pNewPivotCollection; - return; - } - - if (pPivotCollection) - delete pPivotCollection; - pPivotCollection = pNewPivotCollection; - - if (pPivotCollection) - { - USHORT nCount = pPivotCollection->GetCount(); - for (USHORT i=0; iCreateData()) - pPivot->ReleaseData(); - } - } -} - -ScPivot* ScDocument::GetPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const -{ - if (pPivotCollection) - return pPivotCollection->GetPivotAtCursor(nCol, nRow, nTab); - else - return NULL; -} -#endif - ScChartCollection* ScDocument::GetChartCollection() const { return pChartCollection; @@ -845,10 +805,6 @@ void ScDocument::UpdateReference( UpdateRefMode eUpdateRefMode, xRowNameRanges->UpdateReference( eUpdateRefMode, this, aRange, nDx, nDy, nDz ); pDBCollection->UpdateReference( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz ); pRangeName->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz ); -#if OLD_PIVOT_IMPLEMENTATION - if (pPivotCollection) - pPivotCollection->UpdateReference( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz ); -#endif if ( pDPCollection ) pDPCollection->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz ); UpdateChartRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz ); @@ -938,9 +894,6 @@ void ScDocument::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ) //! UpdateChartRef pRangeName->UpdateGrow( rArea, nGrowX, nGrowY ); -#if OLD_PIVOT_IMPLEMENTATION - pPivotCollection->UpdateGrow( rArea, nGrowX, nGrowY ); -#endif for (SCTAB i=0; i<=MAXTAB && pTab[i]; i++) pTab[i]->UpdateGrow( rArea, nGrowX, nGrowY ); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 61cf3ab94b35..b1d19d4b3dae 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -304,11 +304,6 @@ BOOL ScDocument::InsertTab( SCTAB nPos, const String& rName, pRangeName->UpdateTabRef( nPos, 1 ); pDBCollection->UpdateReference( URM_INSDEL, 0,0,nPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 ); -#if OLD_PIVOT_IMPLEMENTATION - if (pPivotCollection) - pPivotCollection->UpdateReference( - URM_INSDEL, 0,0,nPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 ); -#endif if (pDPCollection) pDPCollection->UpdateReference( URM_INSDEL, aRange, 0,0,1 ); if (pDetOpList) @@ -396,11 +391,6 @@ BOOL ScDocument::DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc ) pRangeName->UpdateTabRef( nTab, 2 ); pDBCollection->UpdateReference( URM_INSDEL, 0,0,nTab, MAXCOL,MAXROW,MAXTAB, 0,0,-1 ); -#if OLD_PIVOT_IMPLEMENTATION - if (pPivotCollection) - pPivotCollection->UpdateReference( - URM_INSDEL, 0,0,nTab, MAXCOL,MAXROW,MAXTAB, 0,0,-1 ); -#endif if (pDPCollection) pDPCollection->UpdateReference( URM_INSDEL, aRange, 0,0,-1 ); if (pDetOpList) @@ -4548,11 +4538,11 @@ void ScDocument::AddPrintRange( SCTAB nTab, const ScRange& rNew ) } -void ScDocument::SetPrintRange( SCTAB nTab, const ScRange& rNew ) -{ - if (ValidTab(nTab) && pTab[nTab]) - pTab[nTab]->SetPrintRange( rNew ); -} +//UNUSED2009-05 void ScDocument::SetPrintRange( SCTAB nTab, const ScRange& rNew ) +//UNUSED2009-05 { +//UNUSED2009-05 if (ValidTab(nTab) && pTab[nTab]) +//UNUSED2009-05 pTab[nTab]->SetPrintRange( rNew ); +//UNUSED2009-05 } void ScDocument::SetPrintEntireSheet( SCTAB nTab ) diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx index 2a1b4481ccaa..dc9b6450ac75 100644 --- a/sc/source/core/data/dpcachetable.cxx +++ b/sc/source/core/data/dpcachetable.cxx @@ -522,23 +522,6 @@ const String* ScDPCacheTable::getFieldName(sal_Int32 nIndex) const return mrSharedString.getString(maHeader[nIndex]); } -sal_Int32 ScDPCacheTable::getFieldIndex(const String& rStr) const -{ - sal_Int32 nStrId = mrSharedString.getStringId(rStr); - if (nStrId < 0) - // string not found. - return nStrId; - - sal_Int32 n = maHeader.size(); - for (sal_Int32 i = 0; i < n; ++i) - { - if (maHeader[i] == nStrId) - return i; - } - - return -1; -} - const TypedScStrCollection& ScDPCacheTable::getFieldEntries(sal_Int32 nIndex) const { if (nIndex < 0 || static_cast(nIndex) >= maFieldEntries.size()) @@ -638,14 +621,6 @@ void ScDPCacheTable::clear() maRowsVisible.clear(); } -void ScDPCacheTable::swap(ScDPCacheTable& rOther) -{ - maTable.swap(rOther.maTable); - maHeader.swap(rOther.maHeader); - maFieldEntries.swap(rOther.maFieldEntries); - maRowsVisible.swap(rOther.maRowsVisible); -} - bool ScDPCacheTable::empty() const { return maTable.empty(); diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 813a3381c901..1f1ebbc45d18 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -2122,50 +2122,6 @@ void ScDPObject::ConvertOrientation( ScDPSaveData& rSaveData, } } -#if OLD_PIVOT_IMPLEMENTATION -void ScDPObject::InitFromOldPivot( const ScPivot& rOld, ScDocument* pDocP, BOOL bSetSource ) -{ - ScDPSaveData aSaveData; - - ScPivotParam aParam; - ScQueryParam aQuery; - ScArea aArea; - rOld.GetParam( aParam, aQuery, aArea ); - - ConvertOrientation( aSaveData, aParam.aPageArr, aParam.nPageCount, - sheet::DataPilotFieldOrientation_PAGE, pDocP, aArea.nRowStart, aArea.nTab, - uno::Reference(), TRUE ); - ConvertOrientation( aSaveData, aParam.aColArr, aParam.nColCount, - sheet::DataPilotFieldOrientation_COLUMN, pDocP, aArea.nRowStart, aArea.nTab, - uno::Reference(), TRUE ); - ConvertOrientation( aSaveData, aParam.aRowArr, aParam.nRowCount, - sheet::DataPilotFieldOrientation_ROW, pDocP, aArea.nRowStart, aArea.nTab, - uno::Reference(), TRUE ); - ConvertOrientation( aSaveData, aParam.aDataArr, aParam.nDataCount, - sheet::DataPilotFieldOrientation_DATA, pDocP, aArea.nRowStart, aArea.nTab, - uno::Reference(), TRUE, - aParam.aColArr, aParam.nColCount, aParam.aRowArr, aParam.nRowCount ); - - aSaveData.SetIgnoreEmptyRows( rOld.GetIgnoreEmpty() ); - aSaveData.SetRepeatIfEmpty( rOld.GetDetectCat() ); - aSaveData.SetColumnGrand( rOld.GetMakeTotalCol() ); - aSaveData.SetRowGrand( rOld.GetMakeTotalRow() ); - - SetSaveData( aSaveData ); - if (bSetSource) - { - ScSheetSourceDesc aDesc; - aDesc.aSourceRange = rOld.GetSrcArea(); - rOld.GetQuery( aDesc.aQueryParam ); - SetSheetDesc( aDesc ); - } - SetOutRange( rOld.GetDestArea() ); - - aTableName = rOld.GetName(); - aTableTag = rOld.GetTag(); -} -#endif - // ----------------------------------------------------------------------- // static @@ -2506,26 +2462,3 @@ void ScDPCollection::clearCacheCellPool() for_each(ps.begin(), ps.end(), DeleteCacheCells()); } -//------------------------------------------------------------------------ -// convert old pivot tables into new datapilot tables - -#if OLD_PIVOT_IMPLEMENTATION -void ScDPCollection::ConvertOldTables( ScPivotCollection& rOldColl ) -{ - // convert old pivot tables into new datapilot tables - - USHORT nOldCount = rOldColl.GetCount(); - for (USHORT i=0; iInitFromOldPivot( *(rOldColl)[i], pDoc, TRUE ); - pNewObj->SetAlive( TRUE ); - Insert( pNewObj ); - } - rOldColl.FreeAll(); -} -#endif - - - - diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index f4180312ce0d..62798076afb9 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -97,20 +97,6 @@ void lcl_SetBoolProperty( const uno::Reference& xProp, // ----------------------------------------------------------------------- -void lcl_SkipExtra( SvStream& rStream ) -{ - USHORT nExtra; - rStream >> nExtra; - if ( nExtra ) - { - rStream.SeekRel( nExtra ); - if ( rStream.GetError() == SVSTREAM_OK ) - rStream.SetError( SCWARN_IMPORT_INFOLOST ); - } -} - -// ----------------------------------------------------------------------- - ScDPSaveMember::ScDPSaveMember(const String& rName) : aName( rName ), nVisibleMode( SC_DPSAVEMODE_DONTKNOW ), @@ -352,17 +338,6 @@ void ScDPSaveDimension::SetOrientation(USHORT nNew) nOrientation = nNew; } -void ScDPSaveDimension::SetSubTotals(BOOL bSet) -{ - if (bSet) - { - USHORT nFunc = sheet::GeneralFunction_AUTO; - SetSubTotals( 1, &nFunc ); - } - else - SetSubTotals( 0, NULL ); -} - void ScDPSaveDimension::SetSubTotals(long nCount, const USHORT* pFuncs) { if (pSubTotalFuncs) diff --git a/sc/source/core/data/dpsdbtab.cxx b/sc/source/core/data/dpsdbtab.cxx index 777ea3f38935..cfc98af5af99 100644 --- a/sc/source/core/data/dpsdbtab.cxx +++ b/sc/source/core/data/dpsdbtab.cxx @@ -231,15 +231,6 @@ long ScDatabaseDPData::GetColumnCount() return pImpl->nColCount; } -void lcl_Reset( const uno::Reference& xRowSet ) - throw(sdbc::SQLException, uno::RuntimeException) -{ - // isBeforeFirst / beforeFirst is not always available - //! query if it is allowed - - xRowSet->execute(); // restart -} - const TypedScStrCollection& ScDatabaseDPData::GetColumnEntries(long nColumn) { CreateCacheTable(); diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx index 1e8c5627ee19..7956b68ad03f 100644 --- a/sc/source/core/data/dpshttab.cxx +++ b/sc/source/core/data/dpshttab.cxx @@ -140,12 +140,6 @@ long ScSheetDPData::GetColumnCount() return pImpl->aCacheTable.getColSize(); } -BOOL lcl_HasQuery( const ScQueryParam& rParam ) -{ - return rParam.GetEntryCount() > 0 && - rParam.GetEntry(0).bDoQuery; -} - const TypedScStrCollection& ScSheetDPData::GetColumnEntries(long nColumn) { DBG_ASSERT(nColumn>=0 && nColumn < pImpl->aCacheTable.getColSize(), "ScSheetDPData: wrong column"); diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index 5fa5c393df37..959e0342fe38 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -991,16 +991,16 @@ void ScDPSource::CreateRes_Impl() } } -void ScDPSource::DumpState( ScDocument* pDoc, const ScAddress& rPos ) -{ - CreateRes_Impl(); - - ScAddress aDocPos( rPos ); - - if (pColResRoot->GetChildDimension()) - pColResRoot->GetChildDimension()->DumpState( NULL, pDoc, aDocPos ); - pRowResRoot->DumpState( pColResRoot, pDoc, aDocPos ); -} +//UNUSED2009-05 void ScDPSource::DumpState( ScDocument* pDoc, const ScAddress& rPos ) +//UNUSED2009-05 { +//UNUSED2009-05 CreateRes_Impl(); +//UNUSED2009-05 +//UNUSED2009-05 ScAddress aDocPos( rPos ); +//UNUSED2009-05 +//UNUSED2009-05 if (pColResRoot->GetChildDimension()) +//UNUSED2009-05 pColResRoot->GetChildDimension()->DumpState( NULL, pDoc, aDocPos ); +//UNUSED2009-05 pRowResRoot->DumpState( pColResRoot, pDoc, aDocPos ); +//UNUSED2009-05 } void ScDPSource::FillLevelList( USHORT nOrientation, List& rList ) { @@ -1497,13 +1497,13 @@ const ScDPItemData& ScDPDimension::GetSelectedData() return *pSelectedData; } -BOOL ScDPDimension::IsValidPage( const ScDPItemData& rData ) -{ - if ( bHasSelectedPage ) - return rData.IsCaseInsEqual( GetSelectedData() ); - - return TRUE; // no selection -> all data -} +//UNUSED2009-05 BOOL ScDPDimension::IsValidPage( const ScDPItemData& rData ) +//UNUSED2009-05 { +//UNUSED2009-05 if ( bHasSelectedPage ) +//UNUSED2009-05 return rData.IsCaseInsEqual( GetSelectedData() ); +//UNUSED2009-05 +//UNUSED2009-05 return TRUE; // no selection -> all data +//UNUSED2009-05 } // XPropertySet diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx index c352dbb550d6..6af662119f12 100644 --- a/sc/source/core/data/global2.cxx +++ b/sc/source/core/data/global2.cxx @@ -96,17 +96,17 @@ ScImportParam::~ScImportParam() { } -void ScImportParam::Clear() -{ - nCol1 = nCol2 = 0; - nRow1 = nRow2 = 0; - bImport = FALSE; - bNative = FALSE; - bSql = TRUE; - nType = ScDbTable; - aDBName.Erase(); - aStatement.Erase(); -} +//UNUSED2009-05 void ScImportParam::Clear() +//UNUSED2009-05 { +//UNUSED2009-05 nCol1 = nCol2 = 0; +//UNUSED2009-05 nRow1 = nRow2 = 0; +//UNUSED2009-05 bImport = FALSE; +//UNUSED2009-05 bNative = FALSE; +//UNUSED2009-05 bSql = TRUE; +//UNUSED2009-05 nType = ScDbTable; +//UNUSED2009-05 aDBName.Erase(); +//UNUSED2009-05 aStatement.Erase(); +//UNUSED2009-05 } ScImportParam& ScImportParam::operator=( const ScImportParam& r ) { @@ -849,16 +849,16 @@ __EXPORT ScPivotParam::~ScPivotParam() //------------------------------------------------------------------------ -void __EXPORT ScPivotParam::Clear() -{ - nCol = 0; - nRow = 0; - nTab = 0; - bIgnoreEmptyRows = bDetectCategories = FALSE; - bMakeTotalCol = bMakeTotalRow = TRUE; - ClearLabelData(); - ClearPivotArrays(); -} +//UNUSED2009-05 void __EXPORT ScPivotParam::Clear() +//UNUSED2009-05 { +//UNUSED2009-05 nCol = 0; +//UNUSED2009-05 nRow = 0; +//UNUSED2009-05 nTab = 0; +//UNUSED2009-05 bIgnoreEmptyRows = bDetectCategories = FALSE; +//UNUSED2009-05 bMakeTotalCol = bMakeTotalRow = TRUE; +//UNUSED2009-05 ClearLabelData(); +//UNUSED2009-05 ClearPivotArrays(); +//UNUSED2009-05 } //------------------------------------------------------------------------ diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx index f5855cb4424b..362c7e769b7a 100644 --- a/sc/source/core/data/markarr.cxx +++ b/sc/source/core/data/markarr.cxx @@ -254,10 +254,10 @@ void ScMarkArray::SetMarkArea( SCROW nStartRow, SCROW nEndRow, BOOL bMarked ) // InfoBox(0, String(nCount) + String(" Eintraege") ).Execute(); } -void ScMarkArray::DeleteArea(SCROW nStartRow, SCROW nEndRow) -{ - SetMarkArea(nStartRow, nEndRow, FALSE); -} +//UNUSED2009-05 void ScMarkArray::DeleteArea(SCROW nStartRow, SCROW nEndRow) +//UNUSED2009-05 { +//UNUSED2009-05 SetMarkArea(nStartRow, nEndRow, FALSE); +//UNUSED2009-05 } BOOL ScMarkArray::IsAllMarked( SCROW nStartRow, SCROW nEndRow ) const { diff --git a/sc/source/core/data/pivot.cxx b/sc/source/core/data/pivot.cxx index 30bacf79989a..00cdf2a84eac 100644 --- a/sc/source/core/data/pivot.cxx +++ b/sc/source/core/data/pivot.cxx @@ -34,1995 +34,4 @@ // ----------------------------------------------------------------------- -#if OLD_PIVOT_IMPLEMENTATION -#ifdef _MSC_VER -#pragma optimize("",off) -#endif - -// INCLUDE --------------------------------------------------------------- - -#include -#include - -#include "globstr.hrc" -#include "global.hxx" -#include "subtotal.hxx" -#include "scitems.hxx" -#include "attrib.hxx" -#include "patattr.hxx" -#include "docpool.hxx" -#include "document.hxx" -#include "userlist.hxx" -#include "pivot.hxx" -#include "cell.hxx" -#include "rechead.hxx" -#include "compiler.hxx" // fuer errNoValue -#include "progress.hxx" - -#include -#include - -// STATIC DATA ----------------------------------------------------------- - -//! bei Gelegenheit... - -static short nStaticStrRefCount = 0; -static String* pLabel[PIVOT_MAXFUNC+1]; // incl. "auto" -static String* pLabelTotal; -static String* pLabelData; - -static SCSIZE nDataMult = 1; - -#define nFirstLine 2 - -static const USHORT nFuncMaskArr[PIVOT_MAXFUNC+1] = - { PIVOT_FUNC_SUM, - PIVOT_FUNC_COUNT, - PIVOT_FUNC_AVERAGE, - PIVOT_FUNC_MAX, - PIVOT_FUNC_MIN, - PIVOT_FUNC_PRODUCT, - PIVOT_FUNC_COUNT_NUM, - PIVOT_FUNC_STD_DEV, - PIVOT_FUNC_STD_DEVP, - PIVOT_FUNC_STD_VAR, - PIVOT_FUNC_STD_VARP, - PIVOT_FUNC_AUTO }; // automatisch - -// ----------------------------------------------------------------------- - -// 1 Filter-Knopf -// 2 Feldnamen links -// 3 "Daten" links -// 4 Feldnamen oben -// 5 "Daten" oben -// 6 einzelne "Gesamt" oben rechts -// 7 "Gesamt" oben rechts -// 8 einzelne "Gesamt" unten links -// 9 "Gesamt" unten links -// 10 innere Kategorie links -// 11 Teilergebnis Label einzeln links -// 12 Teilergebnis Label gesamt links -// 13 letzte Kategorie links -// 14 innere Kategorie oben -// 15 Teilergebnis Label einzeln oben -// 16 Teilergebnis Label gesamt oben -// 17 letzte Kategorie oben -// 18 Werte innen -// 19 Werte in Teilergebnisspalte -// 20 Werte in Gesamt-Spalte -// 21 Werte in einzelnen Gesamt-Spalten -// 22 Werte in Ergebnis-Zeile Teilergebnis oder Gesamt -// 23 Kreuzung von Spalte/Zeile (Teilergebnis-Spalte) -// 24 Kreuzung von Spalte/Zeile (Gesamt-Spalte) -// 25 wie 24 bei einzelnen "Gesamt" - -SCSIZE lcl_MaskToIndex( USHORT nFuncMask ) -{ - SCSIZE i; - for (i=0; i<=PIVOT_MAXFUNC; i++) - if (nFuncMask == nFuncMaskArr[i]) - return i; - - DBG_ERROR("Falsche Maske in MaskToIndex"); - return 0; -} - -BOOL lcl_IsEmptyLine( ScDocument* pDoc, const ScAddress& rPos, SCCOL nCol2 ) -{ - //! ans Document verschieben !!! - - ScAddress aAdr( rPos ); - for (SCCOL nCol=aAdr.Col(); nCol<=nCol2; nCol++) - { - aAdr.SetCol( nCol ); - if ( pDoc->GetCell( aAdr ) ) - return FALSE; - } - return TRUE; -} - -ScPivot::ScPivot(ScDocument* pDocument) : - pDoc (pDocument), - aQuery (), - bHasHeader (FALSE), - bIgnoreEmpty (FALSE), - bDetectCat (FALSE), - bMakeTotalCol (TRUE), - bMakeTotalRow (TRUE), - nColNameCount (0), - pColNames (NULL), - nSrcCol1 (0), - nSrcRow1 (0), - nSrcCol2 (0), - nSrcRow2 (0), - nSrcTab (0), - nDestCol1 (0), - nDestRow1 (0), - nDestCol2 (0), - nDestRow2 (0), - nDestTab (0), - nDataStartCol (0), - nDataStartRow (0), - nColCount (0), - nRowCount (0), - nDataCount (0), - bValidArea (FALSE), - bDataAtCol (FALSE) -{ - for (SCSIZE i=0; i0 && rPivot.pColNames) - { - nColNameCount = rPivot.nColNameCount; - pColNames = new String[nColNameCount]; - for (SCSIZE nCol=0; nColSetQuery(aQuery); - pNewPivot->SetHeader(bHasHeader); - pNewPivot->SetIgnoreEmpty(bIgnoreEmpty); - pNewPivot->SetDetectCat(bDetectCat); - pNewPivot->SetMakeTotalCol(bMakeTotalCol); - pNewPivot->SetMakeTotalRow(bMakeTotalRow); - - pNewPivot->SetSrcArea( nSrcCol1, nSrcRow1, nSrcCol2, nSrcRow2, nSrcTab ); - pNewPivot->SetDestPos( nDestCol1, nDestRow1, nDestTab ); - - return pNewPivot; -} - -void lcl_LoadFieldArr30( SvStream& /* rStream */, PivotField* /* pField */, USHORT /* nCount */ ) -{ -#if SC_ROWLIMIT_STREAM_ACCESS -#error address types changed! - USHORT i; - - for (i=0; i> pField[i].nCol - >> pField[i].nFuncMask - >> pField[i].nFuncCount; - } -#endif -} - -void lcl_LoadFieldArr( SvStream& /* rStream */, PivotField* /* pField */, USHORT /* nCount */ ) -{ -#if SC_ROWLIMIT_STREAM_ACCESS -#error address types changed! - USHORT i; - - for (i=0; i> cData; - if( cData & 0x0F ) - rStream.SeekRel( cData & 0x0F ); - rStream >> pField[i].nCol - >> pField[i].nFuncMask - >> pField[i].nFuncCount; - } -#endif -} - -void lcl_SaveFieldArr( SvStream& /* rStream */, const PivotField* /* pField */, USHORT /* nCount */ ) -{ -#if SC_ROWLIMIT_STREAM_ACCESS -#error address types changed! - USHORT i; - - for (i=0; i> bHasHeader - - >> nSrcCol1 - >> nSrcRow1 - >> nSrcCol2 - >> nSrcRow2 - >> nSrcTab - - >> nDestCol1 - >> nDestRow1 - >> nDestCol2 - >> nDestRow2 - >> nDestTab; - - // Arrays immer ueber Set...Fields initalisieren! - - short nCount; - PivotFieldArr aFieldArr; - - if( pDoc->GetSrcVersion() >= SC_DATABYTES2 ) - { - rStream >> nCount; - lcl_LoadFieldArr( rStream, aFieldArr, nCount ); - SetColFields(aFieldArr, nCount); - - rStream >> nCount; - lcl_LoadFieldArr( rStream, aFieldArr, nCount ); - SetRowFields(aFieldArr, nCount); - - rStream >> nCount; - lcl_LoadFieldArr( rStream, aFieldArr, nCount ); - SetDataFields(aFieldArr, nCount); - } - else - { - rStream >> nCount; - lcl_LoadFieldArr30( rStream, aFieldArr, nCount ); - SetColFields(aFieldArr, nCount); - - rStream >> nCount; - lcl_LoadFieldArr30( rStream, aFieldArr, nCount ); - SetRowFields(aFieldArr, nCount); - - rStream >> nCount; - lcl_LoadFieldArr30( rStream, aFieldArr, nCount ); - SetDataFields(aFieldArr, nCount); - } - - aQuery.Load( rStream ); - - rStream >> bIgnoreEmpty; - rStream >> bDetectCat; - - if (rHdr.BytesLeft()) - { - rStream >> bMakeTotalCol; // ab 355i - rStream >> bMakeTotalRow; - } - - if (rHdr.BytesLeft()) // ab 500a - { - rStream.ReadByteString( aName, rStream.GetStreamCharSet() ); - rStream.ReadByteString( aTag, rStream.GetStreamCharSet() ); - - DBG_ASSERT(!pColNames, "Spaltennamen schon gesetzt?"); - rStream >> nColNameCount; - if (nColNameCount) - { - pColNames = new String[nColNameCount]; - for (SCCOL nCol=0; nCol SOFFICE_FILEFORMAT_40 ) // Name/Tag/Spalten ab 5.0 - { - rStream.WriteByteString( aName, rStream.GetStreamCharSet() ); - rStream.WriteByteString( aTag, rStream.GetStreamCharSet() ); - - if (!pColNames) ((ScPivot*)this)->nColNameCount = 0; // soll nicht sein - rStream << nColNameCount; - for (SCCOL nCol=0; nCol( nSrcCol1 + nDiffX ); - nSrcCol2 = sal::static_int_cast( nSrcCol2 + nDiffX ); - nSrcRow1 = sal::static_int_cast( nSrcRow1 + nDiffY ); - nSrcRow2 = sal::static_int_cast( nSrcRow2 + nDiffY ); - - aQuery.nCol1 = sal::static_int_cast( aQuery.nCol1 + nDiffX ); - aQuery.nCol2 = sal::static_int_cast( aQuery.nCol2 + nDiffX ); - aQuery.nRow1 = sal::static_int_cast( aQuery.nRow1 + nDiffY ); - aQuery.nRow2 = sal::static_int_cast( aQuery.nRow2 + nDiffY ); - - SCSIZE nEC = aQuery.GetEntryCount(); - for (SCSIZE i=0; i( aColArr[nC].nCol + nDiffX ); - for (nR=0; nR( aRowArr[nR].nCol + nDiffX ); - for (nC=0; nC( aDataArr[nC].nCol + nDiffX ); - } - } -} - -void ScPivot::ExtendSrcArea( SCCOL nNewEndCol, SCROW nNewEndRow ) -{ - DBG_ASSERT( nNewEndCol >= nSrcCol2 && nNewEndRow >= nSrcRow2, "ExtendSrcArea: zu klein" ); - - nSrcCol2 = nNewEndCol; - nSrcRow2 = nNewEndRow; - - // alles andere bleibt erhalten -} - -void ScPivot::MoveDestArea( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab ) -{ - if ( nNewCol != nDestCol1 || nNewRow != nDestRow1 || nNewTab != nDestTab ) - { - SCsCOL nDiffX = nNewCol - (SCsCOL) nDestCol1; - SCsROW nDiffY = nNewRow - (SCsROW) nDestRow1; - - nDestTab = nNewTab; - nDestCol1 = sal::static_int_cast( nDestCol1 + nDiffX ); - nDestRow1 = sal::static_int_cast( nDestRow1 + nDiffY ); - - if (bValidArea) - { - nDestCol2 = sal::static_int_cast( nDestCol2 + nDiffX ); - nDestRow2 = sal::static_int_cast( nDestRow2 + nDiffY ); - - nDataStartCol = sal::static_int_cast( nDataStartCol + nDiffX ); - nDataStartRow = sal::static_int_cast( nDataStartRow + nDiffY ); - } - } -} - -void ScPivot::SetColFields(const PivotField* pFieldArr, SCSIZE nCount) -{ - nColCount = Max(static_cast(0), Min(nCount, PIVOT_MAXFIELD)); - for (SCSIZE i = 0; i < nColCount; i++) - { - aColArr[i] = pFieldArr[i]; - aColArr[i].nFuncCount = 0; - if (aColArr[i].nCol == PIVOT_DATA_FIELD) - { - aColArr[i].nFuncMask = PIVOT_FUNC_NONE; - pDataList = pColList[i]; - bDataAtCol = TRUE; - } - else - { - for (SCsCOL j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto" - if (aColArr[i].nFuncMask & nFuncMaskArr[j]) - aColArr[i].nFuncCount++; - } - } - bValidArea = FALSE; -} - -void ScPivot::GetColFields(PivotField* pFieldArr, SCSIZE& rCount) const -{ - for (SCSIZE i=0; i(0), Min(nCount, PIVOT_MAXFIELD)); - for (SCSIZE i = 0; i < nRowCount; i++) - { - aRowArr[i] = pFieldArr[i]; - aRowArr[i].nFuncCount = 0; - if (aRowArr[i].nCol == PIVOT_DATA_FIELD) - { - aRowArr[i].nFuncMask = PIVOT_FUNC_NONE; - pDataList = pRowList[i]; - bDataAtCol = FALSE; - } - else - { - for (SCSIZE j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto" - if (aRowArr[i].nFuncMask & nFuncMaskArr[j]) - aRowArr[i].nFuncCount++; - } - } - bValidArea = FALSE; -} - -void ScPivot::GetRowFields(PivotField* pFieldArr, SCSIZE& rCount) const -{ - for (SCSIZE i=0; iFreeAll(); - nDataCount = 0; - for (i = 0; i < nCount; i++) - { - for (nFuncNo=0; nFuncNoGetString(aDataArr[nDataCount].nCol, nSrcRow1, nSrcTab, aStr); - if (aStr.Len() == 0) - aStr = ScColToAlpha( aDataArr[nDataCount].nCol ); - TypedStrData* pStrData = new TypedStrData(aStr); - if (!(pDataList->AtInsert(pDataList->GetCount(), pStrData))) - { - delete pStrData; - DBG_ERROR("Fehler bei pDataList->AtInsert"); - } - - ++nDataCount; - } - } - - // - // - // - - bValidArea = FALSE; -} - -void ScPivot::GetDataFields(PivotField* pFieldArr, SCSIZE& rCount) const -{ -/* for (SCSIZE i=0; i 1) - { - if (bDataAtCol) - { - while (iGetCount(); - } - else - { - while (iGetCount(); - } - } - DBG_ASSERT(nDataMult,"nDataMult==0"); - - CalcArea(); - if ((ValidCol(nDestCol2)) && (ValidRow(nDestRow2))) - { - CreateFieldData(); - bValidArea = TRUE; - } - else - bRet = FALSE; - } - - if ( bKeepDest ) - { - bValidArea = TRUE; //! ??? - nDestCol2 = nOldCol2; - nDestRow2 = nOldRow2; - } - - return bRet; -} - -void ScPivot::DrawData() -{ - ScProgress aProgress( pDoc->GetDocumentShell(), ScGlobal::GetRscString(STR_PIVOT_PROGRESS), nDestRow2-nDestRow1 ); - - SCSIZE i; - - SCCOL nCol; - SCROW nRow; - String aStr; - pDoc->pTab[nDestTab]->DeleteArea(nDestCol1, nDestRow1, nDestCol2, nDestRow2, IDF_ALL); - - if ( nDataStartRow > nDestRow1+nFirstLine ) - SetStyle(nDestCol1, nDestRow1+nFirstLine, nDestCol2, nDataStartRow-1, PIVOT_STYLE_TOP); - SetStyle(nDataStartCol, nDataStartRow, nDestCol2, nDestRow2, PIVOT_STYLE_INNER); - - pDoc->SetString(nDestCol1, nDestRow1, nDestTab, ScGlobal::GetRscString(STR_CELL_FILTER)); - // Kategorie 1 - SetButton(nDestCol1, nDestRow1, nDestCol1, nDestRow1); - - if (bHasHeader) // Spalten / Zeilennamen ausgeben - { - if (nColCount != 0) - { - nCol = nDestCol1; - nRow = nDataStartRow - 1; - for (i=0; iGetString(aColArr[i].nCol, nSrcRow1, nSrcTab, aStr); - if ( !aStr.Len() ) - aStr = ScColToAlpha( aColArr[i].nCol ); - pDoc->SetString(nCol, nRow, nDestTab, aStr); - // Kategorie 2 - nCol++; - } - else if (nDataCount > 1) - { - pDoc->SetString(nCol, nRow, nDestTab, *pLabelData); - // Kategorie 3 - nCol++; - } - } - SetButton(nDestCol1, nRow, nCol-1, nRow); - SetStyle(nDestCol1, nRow, nCol-1, nRow, PIVOT_STYLE_FIELDNAME); - } - if (nRowCount != 0) - { - nCol = nDataStartCol; - nRow = nDestRow1 + nFirstLine; - for (i=0; iGetString(aRowArr[i].nCol, nSrcRow1, nSrcTab, aStr); - if ( !aStr.Len() ) - aStr = ScColToAlpha( aRowArr[i].nCol ); - pDoc->SetString(nCol, nRow, nDestTab, aStr); - // Kategorie 4 - nCol++; - } - else if (nDataCount > 1) - { - pDoc->SetString(nCol, nRow, nDestTab, *pLabelData); - // Kategorie 5 - nCol++; - } - } - SetButton(nDataStartCol, nRow, nCol-1, nRow); - SetStyle(nDataStartCol, nRow, nCol-1, nRow, PIVOT_STYLE_FIELDNAME); - } - } - - BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD ); - BOOL bNoCols = (nColCount == 0) || ( nColCount == 1 && aColArr[0].nCol == PIVOT_DATA_FIELD ); - if (!bMakeTotalCol) bNoRows = TRUE; - if (!bMakeTotalRow) bNoCols = TRUE; - - SCCOL nTotalCol = nDestCol2; - SCROW nTotalRow = nDestRow2; - if (bDataAtCol) - nTotalRow = sal::static_int_cast( nTotalRow - ( nDataCount - 1 ) ); - else - nTotalCol = sal::static_int_cast( nTotalCol - ( nDataCount - 1 ) ); - - // Spaltenkoepfe ausgeben und ColRef initialisieren - // (String-Collections sind initialisiert) - nDataIndex = 0; - nColIndex = 0; - nCol = nDataStartCol; - nRecCount = 0; - RowToTable(0, nCol); - - // Zeilenkoepfe und Daten ausgeben - // (ruft SetDataLine/SetFuncLine auf) - nRowIndex = 0; - nRow = nDataStartRow; - ColToTable(0, nRow, aProgress); - - // Gesamtergebnis-Zeilen - - if (!bNoCols) - { - if (bDataAtCol) - for (SCSIZE nTotCnt = 0; nTotCntGetString(sal::static_int_cast(i)); - pDoc->SetString(sal::static_int_cast(nTotalCol+i), - sal::static_int_cast(nDestRow1 + nFirstLine), nDestTab, aLab); - // Kategorie 6 - } - } - else - { - pDoc->SetString(nTotalCol, nDestRow1 + nFirstLine, nDestTab, *pLabelTotal); - // Kategorie 7 - } - - if ( nDataStartRow > 0 ) - SetStyle(nTotalCol, nDestRow1+nFirstLine, nDestCol2, nDataStartRow-1, PIVOT_STYLE_TITLE); - SetStyle(nTotalCol, nDataStartRow, nDestCol2, nDestRow2, PIVOT_STYLE_RESULT); - SetFrame(nTotalCol, nDestRow1 + nFirstLine, nDestCol2, nDestRow2); - } - - // Rahmen Zeilenergebnis - - if (!bNoCols) - { - if (bDataAtCol) - { - for (i=0; iGetString(sal::static_int_cast(i)); - pDoc->SetString(nDestCol1, nTotalRow+i, nDestTab, aLab); - // Kategorie 8 - } - } - else - { - pDoc->SetString(nDestCol1, nTotalRow, nDestTab, *pLabelTotal); - // Kategorie 9 - } - - if ( nDataStartCol > 0 ) - SetStyle(nDestCol1, nTotalRow, nDataStartCol-1, nDestRow2, PIVOT_STYLE_TITLE); - SetStyle(nDataStartCol, nTotalRow, nDestCol2, nDestRow2, PIVOT_STYLE_RESULT); - SetFrame(nDestCol1, nTotalRow, nDestCol2, nDestRow2); - } - - // Rahmen gesamt - SetFrame(nDestCol1, nDestRow1 + nFirstLine, nDestCol2, nDestRow2, 40); -} - -void ScPivot::ReleaseData() -{ - for (SCSIZE i = 0; i < PIVOT_MAXFIELD; i++) - { - pColList[i]->FreeAll(); - pRowList[i]->FreeAll(); - } - if (ppDataArr) - { - for (SCSIZE i=0; i= nDestCol1 && nCol <= nDestCol2 - && nRow >= nDestRow1 && nRow <= nDestRow2 ); - else - return FALSE; -} - -BOOL ScPivot::IsFilterAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const -{ - if (bValidArea) - return (nCol == nDestCol1 && nRow == nDestRow1 && nTab == nDestTab); - else - return FALSE; -} - -BOOL ScPivot::GetColFieldAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL& rField) const -{ - rField = 0; - BOOL bRet = FALSE; - if (bValidArea) - { - bRet = ( nCol >= nDestCol1 && nCol < nDataStartCol - && nRow == nDataStartRow - 1 - && nTab == nDestTab ); - if (bRet) - { - rField = aColArr[nCol - nDestCol1].nCol; - if (rField == PIVOT_DATA_FIELD) - bRet = (nDataCount > 1); - } - } - return bRet; -} - -BOOL ScPivot::GetRowFieldAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL& rField) const -{ - rField = 0; - BOOL bRet = FALSE; - if (bValidArea) - { - bRet = ( nCol >= nDataStartCol && nCol < sal::static_int_cast(nDataStartCol + nRowCount) - && nRow == nDestRow1 + nFirstLine - && nTab == nDestTab ); - if (bRet) - { - rField = aRowArr[nCol - nDataStartCol].nCol; - if (rField == PIVOT_DATA_FIELD) - bRet = (nDataCount > 1); - } - } - return bRet; -} - - -//-------------------------------------------------------------------------------------------------- -// Private Methoden -//-------------------------------------------------------------------------------------------------- - -BOOL ScPivot::CreateFields() -{ - SCSIZE i; - SCROW nRow; - SCROW nHeader; - String aStr; - TypedStrData* pStrData; - if (bHasHeader) - nHeader = 1; - else - nHeader = 0; - - // Sortieren nach Benutzerdefinierte Listen ?? - for (i = 0; i < nColCount; i++) - { - if (aColArr[i].nCol != PIVOT_DATA_FIELD) - { - pDoc->GetString(aColArr[i].nCol, nSrcRow1 + nHeader, nSrcTab, aStr); - pColList[i]->SetUserData(ScGlobal::GetUserList()->GetData(aStr)); - } - else - pColList[i]->SetUserData(NULL); - } - for (i = 0; i < nRowCount; i++) - { - if (aRowArr[i].nCol != PIVOT_DATA_FIELD) - { - pDoc->GetString(aRowArr[i].nCol, nSrcRow1 + nHeader, nSrcTab, aStr); - pRowList[i]->SetUserData(ScGlobal::GetUserList()->GetData(aStr)); - } - else - pRowList[i]->SetUserData(NULL); - } - - ScAddress aSrcAdr( nSrcCol1, 0, nSrcTab ); - for (nRow = nSrcRow1 + nHeader; nRow <= nSrcRow2; nRow++) - { - BOOL bValidLine = TRUE; - if (bIgnoreEmpty) - { - aSrcAdr.SetRow( nRow ); - bValidLine = !lcl_IsEmptyLine( pDoc, aSrcAdr, nSrcCol2 ); - } - if (bValidLine) - bValidLine = pDoc->pTab[nSrcTab]->ValidQuery(nRow, aQuery); - if (bValidLine) - { - // Sortierte Liste der Felder erzeugen - //! statt GetCategoryString leere weglassen ! - - for (i = 0; i < nColCount; i++) - { - if (aColArr[i].nCol != PIVOT_DATA_FIELD) - { - SCROW nCatRow = bDetectCat ? GetCategoryRow( aColArr[i].nCol, nRow ) : nRow; - pStrData = new TypedStrData( pDoc, aColArr[i].nCol, nCatRow, nSrcTab, TRUE ); - if (!(pColList[i]->Insert(pStrData))) - delete pStrData; - } - } - for (i = 0; i < nRowCount; i++) - { - if (aRowArr[i].nCol != PIVOT_DATA_FIELD) - { - SCROW nCatRow = bDetectCat ? GetCategoryRow( aRowArr[i].nCol, nRow ) : nRow; - pStrData = new TypedStrData( pDoc, aRowArr[i].nCol, nCatRow, nSrcTab, TRUE ); - if (!(pRowList[i]->Insert(pStrData))) - delete pStrData; - } - } - } - } - return TRUE; -} - -void ScPivot::CreateFieldData() -{ - SCSIZE* pRowListIndex = nRowCount ? new SCSIZE[nRowCount] : NULL; - SCSIZE* pColListIndex = nColCount ? new SCSIZE[nColCount] : NULL; - - SCSIZE i,j,k; - - ppDataArr = new SubTotal*[nDataRowCount]; - for (i=0; ipTab[nSrcTab]->ValidQuery(nRow, aQuery); - if (bValidLine) - { - // Indizes der Kategorien nur einmal ausserhalb nDataCount - for (j=0; jGetIndex(&aStrData); - } - for (j=0; jGetIndex(&aStrData); - } - - String aStr; - SCSIZE nCIndex; - SCSIZE nRIndex; - SCSIZE nIndex; - ScAddress aAdr( 0, nRow, nSrcTab ); - - for (i=0; iGetCount(); - nCIndex += nIndex; - } - } - // RowIndex Berechnen - nRIndex = 0; - for (j=0; jGetCount(); - nRIndex += nIndex; - } - } - // Daten eintragen - if ((nCIndex < nDataColCount) && (nRIndex < nDataRowCount)) - { - DBG_ASSERT(ppDataArr[nRIndex][nCIndex].nIndex == i, "falsch init."); - - ppDataArr[nRIndex][nCIndex].nIndex = i; - aAdr.SetCol( aDataArr[i].nCol ); - CellType eCellType = pDoc->GetCellType( aAdr ); - if ((eCellType != CELLTYPE_NONE) && (eCellType != CELLTYPE_NOTE)) - { - BOOL bValue = (eCellType == CELLTYPE_VALUE); - if (eCellType == CELLTYPE_FORMULA) - { - ScBaseCell* pCell = pDoc->GetCell( aAdr ); - bValue = ((ScFormulaCell*)pCell)->IsValue(); - } - - if (bValue) - { - double nVal = pDoc->GetValue( aAdr ); - ppDataArr[nRIndex][nCIndex].Update(nVal); - } - else - ppDataArr[nRIndex][nCIndex].UpdateNoVal(); // nur nCount - } - } - } - } - } - - delete pColListIndex; - delete pRowListIndex; -} - -void ScPivot::CalcArea() -{ - BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD ); - BOOL bNoCols = (nColCount == 0) || ( nColCount == 1 && aColArr[0].nCol == PIVOT_DATA_FIELD ); - if (!bMakeTotalCol) bNoRows = TRUE; - if (!bMakeTotalRow) bNoCols = TRUE; - - // StartSpalte/StartZeile des Datenbereichs berechnen - if (bDataAtCol) - { - if (nDataCount > 1) - nDataStartCol = sal::static_int_cast(nDestCol1 + nColCount); - else - nDataStartCol = sal::static_int_cast(nDestCol1 + Max(static_cast(0), nColCount - 1)); - } - else - nDataStartCol = sal::static_int_cast(nDestCol1 + nColCount); - if (!bDataAtCol) - { - if (nDataCount > 1) - nDataStartRow = nDestRow1 + nRowCount + nFirstLine + 1; - else - nDataStartRow = nDestRow1 + Max(static_cast(0), nRowCount - 1) + nFirstLine + 1; - } - else - nDataStartRow = nDestRow1 + nRowCount + nFirstLine + 1; - - // - // Groesse der PivotTabelle berechnen - // - - if (nRowCount == 0 || (nRowCount==1 && aRowArr[0].nCol==PIVOT_DATA_FIELD && nDataCount==1)) - { - nDataColCount = 1; - if (nDataCount == 1) - nDestCol2 = sal::static_int_cast(nDestCol1 + nColCount - 1); - else - nDestCol2 = sal::static_int_cast(nDestCol1 + nColCount); - } - else - { - SCSIZE nDx; - // Anzahl Spalten - if ((aRowArr[nRowCount-1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1)) - nDx = 2; - else - nDx = 1; - SCSIZE nColLines = pRowList[nRowCount-nDx]->GetCount(); // SCSIZE to recognize overflow - nDataColCount = pRowList[nRowCount-nDx]->GetCount(); - for (SCSIZE i=nRowCount-nDx; i-- > 0; ) - { - nColLines *= pRowList[i]->GetCount(); - nDataColCount *= pRowList[i]->GetCount(); - if (!bDataAtCol) - nColLines += (pRowList[i]->GetCount() * aRowArr[i].nFuncCount * nDataCount); - else - nColLines += (pRowList[i]->GetCount() * aRowArr[i].nFuncCount); - } - /* - // Ergebnisspalten des letzten Elements - if (aRowArr[nRowCount-1].nCol != PIVOT_DATA_FIELD) - nColLines += (pRowList[nRowCount-1]->GetCount() * aRowArr[nRowCount-1].nFuncCount); - */ - if (nColLines > static_cast(MAXCOL)) - nDestCol2 = MAXCOL+2; // ungueltig, 1 wird unten abgezogen - else if (bDataAtCol) - { - if (nDataCount > 1) - nDestCol2 = sal::static_int_cast(nDestCol1 + nColCount + nColLines); - else - nDestCol2 = sal::static_int_cast(nDestCol1 + (nColCount - 1) + nColLines); - if (!bMakeTotalCol) - --nDestCol2; - } - else - nDestCol2 = sal::static_int_cast(nDestCol1 + nColCount + nColLines); - } - - if (nColCount == 0 || (nColCount==1 && aColArr[0].nCol==PIVOT_DATA_FIELD && nDataCount==1)) - { - nDataRowCount = 1; - if (nDataCount == 1) - nDestRow2 = nDestRow1 + (nRowCount - 1) + nFirstLine + 1; - else - nDestRow2 = nDestRow1 + nRowCount + nFirstLine + 1; - } - else - { - SCSIZE nDx; - // Anzahl Zeilen - if ((aColArr[nColCount-1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1)) - nDx = 2; - else - nDx = 1; - SCSIZE nRowLines = pColList[nColCount-nDx]->GetCount(); // SCSIZE to recognize overflow - nDataRowCount = pColList[nColCount-nDx]->GetCount(); - for (SCSIZE i=nColCount-nDx; i-- > 0; ) - { - nRowLines *= pColList[i]->GetCount(); - nDataRowCount *= pColList[i]->GetCount(); - if (bDataAtCol) - nRowLines += (pColList[i]->GetCount() * aColArr[i].nFuncCount * nDataCount); - else - nRowLines += (pColList[i]->GetCount() * aColArr[i].nFuncCount); - } - /* - // Ergebniszeilen des letzten Elements - if (aColArr[nColCount-1].nCol != PIVOT_DATA_FIELD) - nRowLines += (pColList[nColCount-1]->GetCount() * aColArr[nColCount-1].nFuncCount); - */ - if (nRowLines > static_cast(MAXROW)) - nDestRow2 = MAXROW+2; // ungueltig, 1 wird unten abgezogen - else if (!bDataAtCol) - { - if (nDataCount > 1) - nDestRow2 = nDestRow1 + nRowCount + nRowLines + nFirstLine + 1; - else - nDestRow2 = nDestRow1 + (nRowCount - 1) + nRowLines + nFirstLine + 1; - if (!bMakeTotalRow) - --nDestRow2; - } - else - nDestRow2 = nDestRow1 + nRowCount + nRowLines + nFirstLine + 1; - } - - if (bDataAtCol) - { - if (!bNoCols) - nDestRow2 += nDataCount; - nDestRow2 --; - } - else - { - if (!bNoRows) - nDestCol2 = sal::static_int_cast(nDestCol2 + nDataCount); - nDestCol2 --; - } -} - -void ScPivot::SetDataLine(SCCOL nCol, SCROW nRow, SCTAB /* nTab */, SCSIZE nRIndex) -{ - SCSIZE nCIndex2; - - SubTotal aGrandTotal[PIVOT_MAXFIELD]; // pro Daten-Feld - - for (SCSIZE i=0; i < nColIndex; i++) - { - SCSIZE nCIndex = pColRef[i].nDataIndex; - if (nCIndex != sal::static_int_cast(PIVOT_FUNC_REF)) - { -// if ( ppDataArr[nRIndex][nCIndex].GetCount() ) - { - SCSIZE nDIndex = ppDataArr[nRIndex][nCIndex].nIndex; - SetValue( sal::static_int_cast(nCol+i), nRow, ppDataArr[nRIndex][nCIndex], aDataArr[nDIndex].nFuncMask ); - // Kategorie 18 - - if (bDataAtCol) - aGrandTotal[0].Update(ppDataArr[nRIndex][nCIndex]); - else - aGrandTotal[nDIndex].Update(ppDataArr[nRIndex][nCIndex]); - } - } - else - { - SubTotal aTotal; - SCSIZE k = i-1; - while ((pColRef[k].nDataIndex == sal::static_int_cast(PIVOT_FUNC_REF)) && (k > 0)) - k--; - for (SCSIZE j=k+1; (j-- > 0) && (pColRef[j].nRecCount > pColRef[i].nRecCount); ) - { - nCIndex2 = pColRef[j].nDataIndex; - if (nCIndex2 != sal::static_int_cast(PIVOT_FUNC_REF)) - { - if ((pColRef[i].nIndex == ppDataArr[nRIndex][nCIndex2].nIndex) || - (pColRef[i].nIndex == SCSIZE_MAX)) - { - aTotal.Update( ppDataArr[nRIndex][nCIndex2] ); - } - } - } - - USHORT nFunc = pColRef[i].nFuncMask; - if (nFunc == PIVOT_FUNC_AUTO) - nFunc = aDataArr[nRIndex/nDataMult%nDataCount].nFuncMask; - SetValue( sal::static_int_cast(nCol+i), nRow, aTotal, nFunc ); - // Kategorie 19 - } - } - - BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD ); - if (!bMakeTotalCol) bNoRows = TRUE; - - if (!bNoRows) - { - if (bDataAtCol) - { - SetValue( nDestCol2, nRow, aGrandTotal[0], aDataArr[nRIndex/nDataMult%nDataCount].nFuncMask ); - // Kategorie 20 - } - else - { - SCCOL nTotalCol = sal::static_int_cast(nDestCol2 - nDataCount + 1); - for (SCSIZE nTotCnt = 0; nTotCnt(nTotalCol+nTotCnt), nRow, aGrandTotal[nTotCnt], aDataArr[nTotCnt].nFuncMask ); - // Kategorie 21 - } - } - } -} - -void ScPivot::SetFuncLine(SCCOL nCol, SCROW nRow, SCTAB /* nTab */, USHORT nFunc, SCSIZE nIndex, SCSIZE nStartRIndex, SCSIZE nEndRIndex) -{ - SCSIZE nSubtCount = 0; - SubTotal aGrandTotal[PIVOT_MAXFIELD]; - USHORT nThisFunc = nFunc; - - for (SCSIZE i=0; i(PIVOT_FUNC_REF)) - { - SubTotal aTotal; - for (SCSIZE j = nStartRIndex; j < nEndRIndex; j++) - { - SCSIZE nDIndex = ppDataArr[j][nCIndex].nIndex; - if ((nIndex == nDIndex) || (nIndex == SCSIZE_MAX)) - { - aTotal.Update( ppDataArr[j][nCIndex] ); - } - } - - if (bDataAtCol) - aGrandTotal[0].Update( aTotal ); - else - aGrandTotal[nCIndex/nDataMult%nDataCount].Update( aTotal ); //! immer ? - - if (nFunc == PIVOT_FUNC_AUTO) - { - if (bDataAtCol) - { - if (nIndex(nCol+i), nRow, aTotal, nThisFunc ); - // Kategorie 22 - } - else - { // Kreuzungspunkte kompatibel ? - - if ( nFunc == pColRef[i].nFuncMask ) - { - SCSIZE nEffIndex = nIndex; - if (nEffIndex == SCSIZE_MAX) - { - nEffIndex = nSubtCount % nDataCount; - ++nSubtCount; - } - SubTotal aTotal; - - SCSIZE k = i-1; - while ((pColRef[k].nDataIndex == sal::static_int_cast(PIVOT_FUNC_REF)) && (k > 0)) - k--; - for (SCSIZE j=k+1; (j-- > 0) && (pColRef[j].nRecCount > pColRef[i].nRecCount); ) - { - nCIndex = pColRef[j].nDataIndex; - if (nCIndex != sal::static_int_cast(PIVOT_FUNC_REF)) - { - for (SCSIZE nRIndex = nStartRIndex; nRIndex < nEndRIndex; nRIndex++) - { - SCSIZE nDIndex = ppDataArr[nRIndex][nCIndex].nIndex; - if (nEffIndex == nDIndex) - { - aTotal.Update( ppDataArr[nRIndex][nCIndex] ); - } - } - } - } - - if (nFunc == PIVOT_FUNC_AUTO) - { - if (nEffIndex(nCol+i), nRow, aTotal, nThisFunc ); - // Kategorie 23 - } - } - } - - BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD ); - if (!bMakeTotalCol) bNoRows = TRUE; - - if (!bNoRows) - { - if (bDataAtCol) - { - if (nFunc == PIVOT_FUNC_AUTO) - { - if (nIndex(nDestCol2 - nDataCount + 1); - for (SCSIZE nTotCnt = 0; nTotCnt(nTotalCol+nTotCnt), nRow, aGrandTotal[nTotCnt], nThisFunc ); - // Kategorie 25 - } - } - } -} - -void ScPivot::ColToTable(SCSIZE nField, SCROW& nRow, ScProgress& rProgress) -{ - SCCOL nCol = sal::static_int_cast(nDestCol1 + nField); - if (nColCount == 0) - { -// SetDataLine(nCol + 1, nRow, nDestTab, nRowIndex); - SetDataLine(nCol, nRow, nDestTab, nRowIndex); - nRowIndex++; - return; - } - - SCSIZE nDx; - if ((aColArr[nColCount -1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1)) - nDx = 2; - else - nDx = 1; - if (nField < nColCount - nDx) - { - for (USHORT i = 0; i < pColList[nField]->GetCount(); i++) - { - SCSIZE nSaveIndex = nRowIndex; - String aStr = pColList[nField]->GetString(i); - if (!aStr.Len()) aStr = ScGlobal::GetRscString(STR_EMPTYDATA); - pDoc->SetString(nCol, nRow, nDestTab, aStr); - // Kategorie 10 - SCROW nSaveRow = nRow; - ColToTable(nField + 1, nRow, rProgress); - SetStyle(nCol, nSaveRow, nCol, nRow - 1, PIVOT_STYLE_CATEGORY); - SetFrame(nCol, nSaveRow, nCol, nRow - 1); - if (aColArr[nField].nFuncCount > 0) // Zwischenergebnisse eingestellt? - { - nSaveRow = nRow; - for (SCSIZE j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto" - { - if (aColArr[nField].nFuncMask & nFuncMaskArr[j]) - { - String aLab; - if (bDataAtCol) - { - for (SCSIZE k=0; k < nDataCount; k++) - { - String aDataStr = pDataList->GetString(sal::static_int_cast(k)); // always String - aLab = aStr; - SCSIZE nFuncType; - if ( j==PIVOT_MAXFUNC ) - nFuncType = lcl_MaskToIndex( aDataArr[k].nFuncMask ); - else - nFuncType = j; - aLab += ' '; - aLab += *pLabel[nFuncType]; - aLab += ' '; - aLab += aDataStr; - pDoc->SetString(nCol, nRow, nDestTab, aLab); - // Kategorie 11 - SetFuncLine(nDataStartCol, nRow, nDestTab, nFuncMaskArr[j], k, nSaveIndex, nRowIndex); - nRow++; - } - } - else - { - aLab = aStr; - aLab += ' '; - aLab += *pLabel[j]; - pDoc->SetString(nCol, nRow, nDestTab, aLab); - // Kategorie 12 - SetFuncLine(nDataStartCol, nRow, nDestTab, nFuncMaskArr[j], SCSIZE_MAX, nSaveIndex, nRowIndex); - nRow++; - } - } - } - if ( nDataStartCol > 0 ) - SetStyle(nCol, nSaveRow, nDataStartCol-1, nRow-1, PIVOT_STYLE_TITLE); - SetStyle(nDataStartCol, nSaveRow, nDestCol2, nRow-1, PIVOT_STYLE_RESULT); - SetFrameHor(nCol, nSaveRow, nDestCol2, nRow-1); - } - nSaveIndex = nRowIndex; - } - } - else if (nField < nColCount) - { - SCSIZE nCatCount = pColList[nField]->GetCount(); - SetStyle(nCol, nRow, nCol, nRow+nCatCount-1, PIVOT_STYLE_CATEGORY); - SetFrame(nCol, nRow, nDestCol2, nRow+nCatCount-1); - for (SCSIZE i = 0; i < nCatCount; i++) - { - String aTmpStr = pColList[nField]->GetString(sal::static_int_cast(i)); - if (!aTmpStr.Len()) aTmpStr = ScGlobal::GetRscString(STR_EMPTYDATA); - - String aPutStr; - if (pColList[nField] == pDataList) - { - SCSIZE nFuncType = lcl_MaskToIndex( aDataArr[i].nFuncMask ); - aPutStr = *pLabel[nFuncType]; - aPutStr += ' '; - aPutStr += aTmpStr; - } - else - aPutStr += aTmpStr; - - pDoc->SetString(nCol, nRow, nDestTab, aPutStr); - // Kategorie 13 - SetDataLine(nCol + 1, nRow, nDestTab, nRowIndex); - nRowIndex++; - nRow++; - - rProgress.SetState( nRow - nDestRow1 ); - } - } -} - -void ScPivot::RowToTable(SCSIZE nField, SCCOL& nCol) -{ - nRecCount++; - SCROW nRow = nDestRow1 + nFirstLine + nField + 1; - if (nRowCount == 0) - { - pColRef[nColIndex].nDataIndex = nDataIndex; - nColIndex++; - nDataIndex++; - return; - } - - SCSIZE nDx; - if ((aRowArr[nRowCount -1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1)) - nDx = 2; - else - nDx = 1; - - if (nField < nRowCount - nDx) - { - for (USHORT i = 0; i < pRowList[nField]->GetCount(); i++) - { - String aStr = pRowList[nField]->GetString(i); - if (!aStr.Len()) aStr = ScGlobal::GetRscString(STR_EMPTYDATA); - pDoc->SetString(nCol, nRow, nDestTab, aStr); - // Kategorie 14 - SCCOL nSaveCol = nCol; - RowToTable(nField + 1, nCol); - SetStyle(nSaveCol, nRow, nCol - 1, nRow, PIVOT_STYLE_CATEGORY); - SetFrame(nSaveCol, nRow, nCol - 1, nRow); - if (aRowArr[nField].nFuncCount > 0) - { - nSaveCol = nCol; - for (SCSIZE j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto" - { - if (aRowArr[nField].nFuncMask & nFuncMaskArr[j]) - { - String aLab; - if (!bDataAtCol) - { - for (SCSIZE k=0; k < nDataCount; k++) - { - aLab = aStr; - SCSIZE nFuncType; - if ( j==PIVOT_MAXFUNC ) - nFuncType = lcl_MaskToIndex( aDataArr[k].nFuncMask ); - else - nFuncType = j; - aLab += ' '; - aLab += *pLabel[nFuncType]; - aLab += ' '; - aLab += pDataList->GetString(sal::static_int_cast(k)); - pDoc->SetString(nCol, nRow, nDestTab, aLab); - // Kategorie 15 - pColRef[nColIndex].nDataIndex = PIVOT_FUNC_REF; - pColRef[nColIndex].nRecCount = nRecCount; - pColRef[nColIndex].nIndex = k; - pColRef[nColIndex].nFuncMask = nFuncMaskArr[j]; - nColIndex++; - nCol++; - } - } - else - { - aLab = aStr; - aLab += ' '; - aLab += *pLabel[j]; - pDoc->SetString(nCol, nRow, nDestTab, aLab); - // Kategorie 16 - pColRef[nColIndex].nDataIndex = PIVOT_FUNC_REF; - pColRef[nColIndex].nRecCount = nRecCount; - pColRef[nColIndex].nIndex = SCSIZE_MAX; - pColRef[nColIndex].nFuncMask = nFuncMaskArr[j]; - nColIndex++; - nCol++; - } - } - } - if ( nDataStartRow > 0 ) - SetStyle(nSaveCol, nRow, - nCol-1, nDataStartRow-1, PIVOT_STYLE_TITLE); - SetStyle(nSaveCol, nDataStartRow, nCol-1, nDestRow2, PIVOT_STYLE_RESULT); - SetFrameVer(nSaveCol, nRow, nCol-1, nDestRow2); - } - } - } - else if (nField < nRowCount) - { - SCSIZE nCatCount = pRowList[nField]->GetCount(); - SetStyle(nCol, nRow, sal::static_int_cast(nCol+nCatCount-1), nRow, PIVOT_STYLE_CATEGORY); - SetFrame(nCol, nRow, sal::static_int_cast(nCol+nCatCount-1), nDestRow2); - for (SCSIZE i = 0; i < nCatCount; i++) - { - String aTmpStr = pRowList[nField]->GetString(sal::static_int_cast(i)); - if (!aTmpStr.Len()) aTmpStr = ScGlobal::GetRscString(STR_EMPTYDATA); - - String aPutStr; - if (pRowList[nField] == pDataList) - { - SCSIZE nFuncType = lcl_MaskToIndex( aDataArr[i].nFuncMask ); - aPutStr = *pLabel[nFuncType]; - aPutStr += ' '; - aPutStr += aTmpStr; - } - else - aPutStr = aTmpStr; - - pDoc->SetString(nCol, nRow, nDestTab, aPutStr); - // Kategorie 17 - pColRef[nColIndex].nDataIndex = nDataIndex; - pColRef[nColIndex].nRecCount = nRecCount; - pColRef[nColIndex].nIndex = SCSIZE_MAX; - pColRef[nColIndex].nFuncMask = PIVOT_FUNC_NONE; - nColIndex++; - nDataIndex++; - nCol++; - } - } - nRecCount--; -} - -SCROW ScPivot::GetCategoryRow( SCCOL nCol, SCROW nRow ) -{ - SCROW nMinRow = nSrcRow1; - if (bHasHeader) ++nMinRow; - BOOL bFound = FALSE; - do - { - if ( !pDoc->HasData( nCol, nRow, nSrcTab ) && nRow>nMinRow ) - --nRow; - else - bFound = TRUE; - } - while (!bFound); - return nRow; -} - -#endif diff --git a/sc/source/core/data/pivot2.cxx b/sc/source/core/data/pivot2.cxx index 20303f848b72..db02c921be98 100644 --- a/sc/source/core/data/pivot2.cxx +++ b/sc/source/core/data/pivot2.cxx @@ -64,432 +64,6 @@ using ::com::sun::star::sheet::DataPilotFieldReference; // STATIC DATA ----------------------------------------------------------- -#if OLD_PIVOT_IMPLEMENTATION -//-------------------------------------------------------------------------------------------------- -// Hilfsmethoden von ScPivot -//-------------------------------------------------------------------------------------------------- - -void ScPivot::SetFrame(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nWidth) -{ - if (pDoc->pTab[nDestTab]) - { - SvxBorderLine aLine; - aLine.SetOutWidth(nWidth); - SvxBoxItem aBox( ATTR_BORDER ); - aBox.SetLine(&aLine, BOX_LINE_LEFT); - aBox.SetLine(&aLine, BOX_LINE_TOP); - aBox.SetLine(&aLine, BOX_LINE_RIGHT); - aBox.SetLine(&aLine, BOX_LINE_BOTTOM); - SvxBoxInfoItem aBoxInfo( ATTR_BORDER_INNER ); - aBoxInfo.SetValid(VALID_HORI,FALSE); - aBoxInfo.SetValid(VALID_VERT,FALSE); - aBoxInfo.SetValid(VALID_DISTANCE,FALSE); - pDoc->pTab[nDestTab]->ApplyBlockFrame(&aBox, &aBoxInfo, nCol1, nRow1, nCol2, nRow2); - } -} - -void ScPivot::SetFrameHor(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) -{ - if (pDoc->pTab[nDestTab]) - { - SvxBorderLine aLine; - aLine.SetOutWidth(20); - SvxBoxItem aBox( ATTR_BORDER ); - aBox.SetLine(&aLine, BOX_LINE_LEFT); - aBox.SetLine(&aLine, BOX_LINE_TOP); - aBox.SetLine(&aLine, BOX_LINE_RIGHT); - aBox.SetLine(&aLine, BOX_LINE_BOTTOM); - SvxBoxInfoItem aBoxInfo(ATTR_BORDER_INNER); - aBoxInfo.SetValid(VALID_VERT,FALSE); - aBoxInfo.SetValid(VALID_DISTANCE,FALSE); - aBoxInfo.SetLine(&aLine, BOXINFO_LINE_HORI); - pDoc->pTab[nDestTab]->ApplyBlockFrame(&aBox, &aBoxInfo, nCol1, nRow1, nCol2, nRow2); - } -} - -void ScPivot::SetFrameVer(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) -{ - if (pDoc->pTab[nDestTab]) - { - SvxBorderLine aLine; - aLine.SetOutWidth(20); - SvxBoxItem aBox( ATTR_BORDER ); - aBox.SetLine(&aLine, BOX_LINE_LEFT); - aBox.SetLine(&aLine, BOX_LINE_TOP); - aBox.SetLine(&aLine, BOX_LINE_RIGHT); - aBox.SetLine(&aLine, BOX_LINE_BOTTOM); - SvxBoxInfoItem aBoxInfo( ATTR_BORDER_INNER ); - aBoxInfo.SetValid(VALID_HORI,FALSE); - aBoxInfo.SetValid(VALID_DISTANCE,FALSE); - aBoxInfo.SetLine(&aLine, BOXINFO_LINE_VERT); - pDoc->pTab[nDestTab]->ApplyBlockFrame(&aBox, &aBoxInfo, nCol1, nRow1, nCol2, nRow2); - } -} - -void ScPivot::SetFontBold(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) -{ - if (pDoc->pTab[nDestTab]) - { - ScPatternAttr aPattern( pDoc->GetPool() ); - aPattern.GetItemSet().Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) ); - pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern); - } -} - -void ScPivot::SetJustifyLeft(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) -{ - if (pDoc->pTab[nDestTab]) - { - ScPatternAttr aPattern( pDoc->GetPool() ); - aPattern.GetItemSet().Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY ) ); - pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern); - } -} - -void ScPivot::SetJustifyRight(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) -{ - if (pDoc->pTab[nDestTab]) - { - ScPatternAttr aPattern( pDoc->GetPool() ); - aPattern.GetItemSet().Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT, ATTR_HOR_JUSTIFY ) ); - pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern); - } -} - -void ScPivot::SetButton(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) -{ - if (pDoc->pTab[nDestTab]) - { - ScPatternAttr aPattern( pDoc->GetPool() ); - aPattern.GetItemSet().Put( ScMergeFlagAttr(SC_MF_BUTTON) ); - pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern); - } -} - -void ScPivot::SetStyle(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nId) -{ - if ( nCol1 > nCol2 || nRow1 > nRow2 ) - return; // Falls Bereiche leer sind - - USHORT nStringId = 0; - switch (nId) - { - case PIVOT_STYLE_INNER: nStringId = STR_PIVOT_STYLE_INNER; break; - case PIVOT_STYLE_RESULT: nStringId = STR_PIVOT_STYLE_RESULT; break; - case PIVOT_STYLE_CATEGORY: nStringId = STR_PIVOT_STYLE_CATEGORY; break; - case PIVOT_STYLE_TITLE: nStringId = STR_PIVOT_STYLE_TITLE; break; - case PIVOT_STYLE_FIELDNAME: nStringId = STR_PIVOT_STYLE_FIELDNAME; break; - case PIVOT_STYLE_TOP: nStringId = STR_PIVOT_STYLE_TOP; break; - default: - DBG_ERROR("falsche ID bei ScPivot::SetStyle"); - return; - } - String aStyleName = ScGlobal::GetRscString(nStringId); - - ScStyleSheetPool* pStlPool = pDoc->GetStyleSheetPool(); - ScStyleSheet* pStyle = (ScStyleSheet*) pStlPool->Find( aStyleName, SFX_STYLE_FAMILY_PARA ); - if (!pStyle) - { - // neu anlegen - - pStyle = (ScStyleSheet*) &pStlPool->Make( aStyleName, SFX_STYLE_FAMILY_PARA, - SFXSTYLEBIT_USERDEF ); - pStyle->SetParent( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) ); - SfxItemSet& rSet = pStyle->GetItemSet(); - if ( nId==PIVOT_STYLE_RESULT || nId==PIVOT_STYLE_TITLE ) - rSet.Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) ); - if ( nId==PIVOT_STYLE_CATEGORY || nId==PIVOT_STYLE_TITLE ) - rSet.Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY ) ); - } - - pDoc->pTab[nDestTab]->ApplyStyleArea( nCol1, nRow1, nCol2, nRow2, *pStyle ); -} - -void ScPivot::SetValue(SCCOL nCol, SCROW nRow, const SubTotal& rTotal, USHORT nFunc) -{ - if ( rTotal.Valid( nFunc ) == 1) - pDoc->SetValue(nCol, nRow, nDestTab, rTotal.Result( nFunc )); - else if ( rTotal.Valid( nFunc ) == 0) - pDoc->SetError(nCol, nRow, nDestTab, errNoValue); -} - -//-------------------------------------------------------------------------------------------------- - -void ScPivot::GetParam( ScPivotParam& rParam, ScQueryParam& rQuery, ScArea& rSrcArea ) const -{ - SCSIZE nCount; - SCCOL nDummyCol; - SCROW nDummyRow; - GetDestArea( rParam.nCol,rParam.nRow, nDummyCol,nDummyRow, rParam.nTab ); - - // Row und Col in der Bedeutung vertauscht: - GetRowFields( rParam.aColArr, nCount ); - rParam.nColCount = nCount; - GetColFields( rParam.aRowArr, nCount ); - rParam.nRowCount = nCount; - GetDataFields( rParam.aDataArr, nCount ); - rParam.nDataCount = nCount; - - rParam.bIgnoreEmptyRows = GetIgnoreEmpty(); - rParam.bDetectCategories = GetDetectCat(); - rParam.bMakeTotalCol = GetMakeTotalCol(); - rParam.bMakeTotalRow = GetMakeTotalRow(); - - GetQuery(rQuery); - GetSrcArea( rSrcArea.nColStart, rSrcArea.nRowStart, - rSrcArea.nColEnd, rSrcArea.nRowEnd, rSrcArea.nTab ); -} - -void ScPivot::SetParam( const ScPivotParam& rParam, const ScQueryParam& rQuery, - const ScArea& rSrcArea ) -{ - SetQuery( rQuery ); - SetHeader( TRUE ); - SetSrcArea( rSrcArea.nColStart, rSrcArea.nRowStart, - rSrcArea.nColEnd, rSrcArea.nRowEnd, rSrcArea.nTab ); - SetDestPos( rParam.nCol, rParam.nRow, rParam.nTab ); - SetIgnoreEmpty( rParam.bIgnoreEmptyRows ); - SetDetectCat( rParam.bDetectCategories ); - SetMakeTotalCol( rParam.bMakeTotalCol ); - SetMakeTotalRow( rParam.bMakeTotalRow ); - - // Row und Col in der Bedeutung vertauscht: - SetRowFields( rParam.aColArr, rParam.nColCount ); - SetColFields( rParam.aRowArr, rParam.nRowCount ); - SetDataFields( rParam.aDataArr, rParam.nDataCount ); -} - -ScDataObject* ScPivot::Clone() const -{ - return new ScPivot(*this); -} - -//-------------------------------------------------------------------------------------------------- -// PivotScStrCollection -//-------------------------------------------------------------------------------------------------- - -ScDataObject* PivotScStrCollection::Clone() const -{ - return new PivotScStrCollection(*this); -} - -short PivotScStrCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const -{ - DBG_ASSERT(pKey1&&pKey2,"0-Zeiger bei PivotScStrCollection::Compare"); - - short nResult = 0; - - TypedStrData& rData1 = (TypedStrData&)*pKey1; - TypedStrData& rData2 = (TypedStrData&)*pKey2; - - if ( rData1.nStrType > rData2.nStrType ) - nResult = 1; - else if ( rData1.nStrType < rData2.nStrType ) - nResult = -1; - else if ( !rData1.nStrType /* && !rData2.nStrType */ ) - { - // Zahlen vergleichen: - - if ( rData1.nValue == rData2.nValue ) - nResult = 0; - else if ( rData1.nValue < rData2.nValue ) - nResult = -1; - else - nResult = 1; - } - else /* if ( rData1.nStrType && rData2.nStrType ) */ - { - // Strings vergleichen: - - if (pUserData) - nResult = sal::static_int_cast(pUserData->ICompare(rData1.aStrValue, rData2.aStrValue)); - else - { - nResult = (short) ScGlobal::pTransliteration->compareString( - rData1.aStrValue, rData2.aStrValue ); - } - } - - return nResult; -} - -USHORT PivotScStrCollection::GetIndex(TypedStrData* pData) const -{ - USHORT nIndex = 0; - if (!Search(pData, nIndex)) - nIndex = 0; - return nIndex; -} - -//-------------------------------------------------------------------------------------------------- -// PivotCollection -//-------------------------------------------------------------------------------------------------- - -String ScPivotCollection::CreateNewName( USHORT nMin ) const -{ - String aBase( RTL_CONSTASCII_USTRINGPARAM("DataPilot") ); - //! from Resource? - - for (USHORT nAdd=0; nAdd<=nCount; nAdd++) // nCount+1 Versuche - { - String aNewName = aBase; - aNewName += String::CreateFromInt32( nMin + nAdd ); - BOOL bFound = FALSE; - for (USHORT i=0; iGetName() == aNewName) - bFound = TRUE; - if (!bFound) - return aNewName; // freien Namen gefunden - } - return String(); // sollte nicht vorkommen -} - -ScPivot* ScPivotCollection::GetPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const -{ - if (pItems) - { - for (USHORT i = 0; i < nCount; i++) - if (((ScPivot*)pItems[i])->IsPivotAtCursor(nCol, nRow, nTab)) - { - return (ScPivot*)pItems[i]; - } - } - return NULL; -} - -BOOL ScPivotCollection::Load(SvStream& rStream) -{ - BOOL bSuccess = TRUE; - USHORT nNewCount, i; - FreeAll(); - - ScMultipleReadHeader aHdr( rStream ); - - rStream >> nNewCount; - for (i=0; iLoad(rStream, aHdr); - Insert( pPivot ); - } - else - bSuccess = FALSE; - } - - // fuer alte Dateien: eindeutige Namen vergeben - - if (bSuccess) - for (i=0; iGetName().Len()) - ((ScPivot*)At(i))->SetName( CreateNewName() ); - - return bSuccess; -} - -BOOL ScPivotCollection::Store(SvStream& rStream) const -{ - BOOL bSuccess = TRUE; - - ScMultipleWriteHeader aHdr( rStream ); - - rStream << nCount; - - for (USHORT i=0; iStore( rStream, aHdr ); - - return bSuccess; -} - -void ScPivotCollection::UpdateReference(UpdateRefMode eUpdateRefMode, - SCCOL nCol1, SCROW nRow1, SCTAB nTab1, - SCCOL nCol2, SCROW nRow2, SCTAB nTab2, - SCsCOL nDx, SCsROW nDy, SCsTAB nDz ) -{ - for (USHORT i=0; iGetSrcArea( theCol1, theRow1, theCol2, theRow2, theTab1 ); - theTab2 = theTab1; - - eRes = ScRefUpdate::Update( pDoc, eUpdateRefMode, - nCol1,nRow1,nTab1, nCol2,nRow2,nTab2, nDx,nDy,nDz, - theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 ); - - if (eRes != UR_NOTHING) - pPivot->MoveSrcArea( theCol1, theRow1, theTab1 ); - - // Dest - - pPivot->GetDestArea( theCol1, theRow1, theCol2, theRow2, theTab1 ); - theTab2 = theTab1; - - eRes = ScRefUpdate::Update( pDoc, eUpdateRefMode, - nCol1,nRow1,nTab1, nCol2,nRow2,nTab2, nDx,nDy,nDz, - theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 ); - - if (eRes != UR_NOTHING) - pPivot->MoveDestArea( theCol1, theRow1, theTab1 ); - } -} - -void ScPivotCollection::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ) -{ - // nur Quell-Bereich - - for (USHORT i=0; iGetSrcArea(); - ScRefUpdateRes eRes = ScRefUpdate::DoGrow( rArea, nGrowX, nGrowY, aSrc ); - if (eRes != UR_NOTHING) - pPivot->ExtendSrcArea( aSrc.aEnd.Col(), aSrc.aEnd.Row() ); - } -} - -BOOL ScPivotCollection::operator==(const ScPivotCollection& rCmp) const -{ - if (nCount != rCmp.nCount) - return FALSE; - - if (!nCount) - return TRUE; // beide leer - nicht erst die Param's anlegen! - - ScPivotParam aMyParam, aCmpParam; - ScQueryParam aMyQuery, aCmpQuery; - ScArea aMyArea, aCmpArea; - - for (USHORT i=0; iGetParam( aMyParam, aMyQuery, aMyArea ); - ScPivot* pCmpPivot = (ScPivot*)rCmp.pItems[i]; - pCmpPivot->GetParam( aCmpParam, aCmpQuery, aCmpArea ); - if (!( aMyArea==aCmpArea && aMyParam==aCmpParam && aMyQuery==aCmpQuery )) - return FALSE; - } - - return TRUE; -} - -ScDataObject* ScPivotCollection::Clone() const -{ - return new ScPivotCollection(*this); -} - -#endif - // ============================================================================ LabelData::LabelData( const String& rName, short nCol, bool bIsValue ) : diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index 22926f31d003..ca78acc8a1e0 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -95,10 +95,10 @@ void ScStyleSheetPool::SetDocument( ScDocument* pDocument ) //------------------------------------------------------------------------ -void ScStyleSheetPool::SetForceStdName( const String* pSet ) -{ - pForceStdName = pSet; -} +//UNUSED2009-05 void ScStyleSheetPool::SetForceStdName( const String* pSet ) +//UNUSED2009-05 { +//UNUSED2009-05 pForceStdName = pSet; +//UNUSED2009-05 } //------------------------------------------------------------------------ diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 38aabaa51a55..ff6caa2da1bd 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1458,11 +1458,11 @@ void ScTable::AddPrintRange( const ScRange& rNew ) aPrintRanges.push_back( rNew ); } -void ScTable::SetPrintRange( const ScRange& rNew ) -{ - ClearPrintRanges(); - AddPrintRange( rNew ); -} +//UNUSED2009-05 void ScTable::SetPrintRange( const ScRange& rNew ) +//UNUSED2009-05 { +//UNUSED2009-05 ClearPrintRanges(); +//UNUSED2009-05 AddPrintRange( rNew ); +//UNUSED2009-05 } void ScTable::SetPrintEntireSheet() { diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 59858796078c..daaf2d56b193 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -837,13 +837,13 @@ void ScTable::PutCell( const ScAddress& rPos, ScBaseCell* pCell ) } -void ScTable::PutCell( const ScAddress& rPos, ULONG nFormatIndex, ScBaseCell* pCell ) -{ - if (pCell) - aCol[rPos.Col()].Insert( rPos.Row(), nFormatIndex, pCell ); - else - aCol[rPos.Col()].Delete( rPos.Row() ); -} +//UNUSED2009-05 void ScTable::PutCell( const ScAddress& rPos, ULONG nFormatIndex, ScBaseCell* pCell ) +//UNUSED2009-05 { +//UNUSED2009-05 if (pCell) +//UNUSED2009-05 aCol[rPos.Col()].Insert( rPos.Row(), nFormatIndex, pCell ); +//UNUSED2009-05 else +//UNUSED2009-05 aCol[rPos.Col()].Delete( rPos.Row() ); +//UNUSED2009-05 } BOOL ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rString ) @@ -1182,22 +1182,22 @@ BOOL ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USH } -BOOL ScTable::HasLines( const ScRange& rRange, Rectangle& rSizes ) const -{ - SCCOL nCol1 = rRange.aStart.Col(); - SCROW nRow1 = rRange.aStart.Row(); - SCCOL nCol2 = rRange.aEnd.Col(); - SCROW nRow2 = rRange.aEnd.Row(); - PutInOrder( nCol1, nCol2 ); - PutInOrder( nRow1, nRow2 ); - - BOOL bFound = FALSE; - for (SCCOL i=nCol1; i<=nCol2; i++) - if (aCol[i].HasLines( nRow1, nRow2, rSizes, (i==nCol1), (i==nCol2) )) - bFound = TRUE; - - return bFound; -} +//UNUSED2009-05 BOOL ScTable::HasLines( const ScRange& rRange, Rectangle& rSizes ) const +//UNUSED2009-05 { +//UNUSED2009-05 SCCOL nCol1 = rRange.aStart.Col(); +//UNUSED2009-05 SCROW nRow1 = rRange.aStart.Row(); +//UNUSED2009-05 SCCOL nCol2 = rRange.aEnd.Col(); +//UNUSED2009-05 SCROW nRow2 = rRange.aEnd.Row(); +//UNUSED2009-05 PutInOrder( nCol1, nCol2 ); +//UNUSED2009-05 PutInOrder( nRow1, nRow2 ); +//UNUSED2009-05 +//UNUSED2009-05 BOOL bFound = FALSE; +//UNUSED2009-05 for (SCCOL i=nCol1; i<=nCol2; i++) +//UNUSED2009-05 if (aCol[i].HasLines( nRow1, nRow2, rSizes, (i==nCol1), (i==nCol2) )) +//UNUSED2009-05 bFound = TRUE; +//UNUSED2009-05 +//UNUSED2009-05 return bFound; +//UNUSED2009-05 } BOOL ScTable::HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 9bb8bff1081f..443474060c3e 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -953,13 +953,6 @@ ScValidationData* ScValidationDataList::GetData( sal_uInt32 nKey ) return NULL; } -void ScValidationDataList::ResetUsed() -{ - USHORT nCount = Count(); - for (USHORT i=0; iSetUsed(FALSE); -} - void ScValidationDataList::CompileXML() { USHORT nCount = Count(); diff --git a/sc/source/core/inc/refupdat.hxx b/sc/source/core/inc/refupdat.hxx index 2a8b17335fbf..6ecc67259463 100644 --- a/sc/source/core/inc/refupdat.hxx +++ b/sc/source/core/inc/refupdat.hxx @@ -96,11 +96,6 @@ public: static ScRefUpdateRes UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY, ScComplexRefData& rRef ); - -#if OLD_PIVOT_IMPLEMENTATION - static ScRefUpdateRes DoGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY, - ScRange& rRef ); -#endif }; diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index b38d5b52e4f5..8bfeaaa72289 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -59,13 +59,13 @@ ScAddress::Details::Details ( const ScDocument* pDoc, { } -void ScAddress::Details::SetPos ( const ScDocument* pDoc, - const ScAddress & rAddr ) -{ - nRow = rAddr.Row(); - nCol = rAddr.Col(); - eConv = pDoc->GetAddressConvention(); -} +//UNUSED2009-05 void ScAddress::Details::SetPos ( const ScDocument* pDoc, +//UNUSED2009-05 const ScAddress & rAddr ) +//UNUSED2009-05 { +//UNUSED2009-05 nRow = rAddr.Row(); +//UNUSED2009-05 nCol = rAddr.Col(); +//UNUSED2009-05 eConv = pDoc->GetAddressConvention(); +//UNUSED2009-05 } //////////////////////////////////////////////////////////////////////////// diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx index fff3122052bd..9873ea42ff13 100644 --- a/sc/source/core/tool/chartpos.cxx +++ b/sc/source/core/tool/chartpos.cxx @@ -616,34 +616,34 @@ ScChartPositionMap::~ScChartPositionMap() } -ScRangeListRef ScChartPositionMap::GetColRanges( SCCOL nChartCol ) const -{ - ScRangeListRef xRangeList = new ScRangeList; - if ( nChartCol < nColCount ) - { - ULONG nStop = GetIndex( nChartCol, nRowCount ); - for ( ULONG nIndex = GetIndex( nChartCol, 0 ); nIndex < nStop; nIndex++ ) - { - if ( ppData[ nIndex ] ) - xRangeList->Join( *ppData[ nIndex ] ); - } - } - return xRangeList; -} - - -ScRangeListRef ScChartPositionMap::GetRowRanges( SCROW nChartRow ) const -{ - ScRangeListRef xRangeList = new ScRangeList; - if ( nChartRow < nRowCount ) - { - ULONG nStop = GetIndex( nColCount, nChartRow ); - for ( ULONG nIndex = GetIndex( 0, nChartRow ); nIndex < nStop; - nIndex += nRowCount ) - { - if ( ppData[ nIndex ] ) - xRangeList->Join( *ppData[ nIndex ] ); - } - } - return xRangeList; -} +//UNUSED2009-05 ScRangeListRef ScChartPositionMap::GetColRanges( SCCOL nChartCol ) const +//UNUSED2009-05 { +//UNUSED2009-05 ScRangeListRef xRangeList = new ScRangeList; +//UNUSED2009-05 if ( nChartCol < nColCount ) +//UNUSED2009-05 { +//UNUSED2009-05 ULONG nStop = GetIndex( nChartCol, nRowCount ); +//UNUSED2009-05 for ( ULONG nIndex = GetIndex( nChartCol, 0 ); nIndex < nStop; nIndex++ ) +//UNUSED2009-05 { +//UNUSED2009-05 if ( ppData[ nIndex ] ) +//UNUSED2009-05 xRangeList->Join( *ppData[ nIndex ] ); +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 return xRangeList; +//UNUSED2009-05 } + + +//UNUSED2009-05 ScRangeListRef ScChartPositionMap::GetRowRanges( SCROW nChartRow ) const +//UNUSED2009-05 { +//UNUSED2009-05 ScRangeListRef xRangeList = new ScRangeList; +//UNUSED2009-05 if ( nChartRow < nRowCount ) +//UNUSED2009-05 { +//UNUSED2009-05 ULONG nStop = GetIndex( nColCount, nChartRow ); +//UNUSED2009-05 for ( ULONG nIndex = GetIndex( 0, nChartRow ); nIndex < nStop; +//UNUSED2009-05 nIndex += nRowCount ) +//UNUSED2009-05 { +//UNUSED2009-05 if ( ppData[ nIndex ] ) +//UNUSED2009-05 xRangeList->Join( *ppData[ nIndex ] ); +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 return xRangeList; +//UNUSED2009-05 } diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx index 5f1213e79b35..22d996dd701f 100644 --- a/sc/source/core/tool/chgtrack.cxx +++ b/sc/source/core/tool/chgtrack.cxx @@ -157,29 +157,6 @@ ScChangeAction::ScChangeAction( ScChangeActionType eTypeP, const ScBigRange& rRa aDateTime.ConvertToUTC(); } -ScChangeAction::ScChangeAction( SvStream& rStrm, ScMultipleReadHeader& /* rHdr */, - ScChangeTrack* /* pTrack */ ) - : - pNext( NULL ), - pPrev( NULL ), - pLinkAny( NULL ), - pLinkDeletedIn( NULL ), - pLinkDeleted( NULL ), - pLinkDependent( NULL ) -{ - // ScChangeTrack speichert aUser als Index auf Collection und eType selber - UINT32 n32; - UINT16 n16; - rStrm >> aBigRange; - rStrm >> n32; aDateTime.SetDate( n32 ); - rStrm >> n32; aDateTime.SetTime( n32 ); - rStrm >> n32; nAction = n32; - rStrm >> n32; nRejectAction = n32; - rStrm >> n16; eState = (ScChangeActionState) n16; - rStrm.ReadByteString( aComment, rStrm.GetStreamCharSet() ); - // LinkEntries in zweiter Runde -} - ScChangeAction::~ScChangeAction() { @@ -187,40 +164,6 @@ ScChangeAction::~ScChangeAction() } -BOOL ScChangeAction::Store( SvStream& rStrm, ScMultipleWriteHeader& /* rHdr */ ) const -{ - // ScChangeTrack speichert aUser als Index auf Collection und eType selber - rStrm << aBigRange; - rStrm << (UINT32) aDateTime.GetDate(); - rStrm << (UINT32) aDateTime.GetTime(); - rStrm << (UINT32) nAction; - rStrm << (UINT32) nRejectAction; - rStrm << (UINT16) eState; - rStrm.WriteByteString( aComment, rStrm.GetStreamCharSet() ); - // LinkEntries in zweiter Runde - - return TRUE; -} - - -BOOL ScChangeAction::StoreLinks( SvStream& rStrm ) const -{ - BOOL bOk = ScChangeAction::StoreLinkChain( pLinkDeleted, rStrm ); - bOk &= ScChangeAction::StoreLinkChain( pLinkDependent, rStrm ); - return bOk; -} - - -BOOL ScChangeAction::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrack ) -{ - BOOL bOk = ScChangeAction::LoadLinkChain( this, &pLinkDeleted, rStrm, - pTrack, TRUE ); - bOk &= ScChangeAction::LoadLinkChain( this, &pLinkDependent, rStrm, - pTrack, FALSE ); - return bOk; -} - - BOOL ScChangeAction::IsVisible() const { //! sequence order of execution is significant @@ -682,159 +625,6 @@ void ScChangeAction::RejectRestoreContents( ScChangeTrack* pTrack, } -// static -void ScChangeAction::StoreCell( ScBaseCell* /* pCell */, SvStream& /* rStrm */, - ScMultipleWriteHeader& /* rHdr */ ) -{ -#if SC_ROWLIMIT_STREAM_ACCESS -#error address types changed! - if ( pCell ) - { - CellType eCellType = pCell->GetCellType(); - switch( eCellType ) - { - case CELLTYPE_VALUE: - rStrm << (BYTE) eCellType; - ((ScValueCell*)pCell)->Save( rStrm ); - break; - case CELLTYPE_STRING: - rStrm << (BYTE) eCellType; - ((ScStringCell*)pCell)->Save( rStrm ); - break; - case CELLTYPE_EDIT: - rStrm << (BYTE) eCellType; - ((ScEditCell*)pCell)->Save( rStrm ); - break; - case CELLTYPE_FORMULA: - rStrm << (BYTE) eCellType; - rStrm << ((ScFormulaCell*)pCell)->aPos; - ((ScFormulaCell*)pCell)->Save( rStrm, rHdr ); - break; - default: - DBG_ERROR( "ScChangeAction::StoreCell: unknown CellType" ); - rStrm << (BYTE) CELLTYPE_NONE; - } - } - else - rStrm << (BYTE) CELLTYPE_NONE; -#endif // SC_ROWLIMIT_STREAM_ACCESS -} - - -// static -ScBaseCell* ScChangeAction::LoadCell( SvStream& /* rStrm */, - ScMultipleReadHeader& /* rHdr */, ScDocument* /* pDoc */, USHORT /* nVer */ ) -{ -#if SC_ROWLIMIT_STREAM_ACCESS -#error address types changed! - ScBaseCell* pCell; - BYTE nByte; - rStrm >> nByte; - switch ( (CellType) nByte ) - { - case CELLTYPE_VALUE: - { - pCell = new ScValueCell( rStrm, nVer ); - } - break; - case CELLTYPE_STRING: - { - pCell = new ScStringCell( rStrm, nVer ); - } - break; - case CELLTYPE_EDIT: - { - pCell = new ScEditCell( rStrm, nVer, pDoc ); - } - break; - case CELLTYPE_FORMULA: - { - ScAddress aPos; - rStrm >> aPos; - pCell = new ScFormulaCell( pDoc, aPos, rStrm, rHdr ); - ((ScFormulaCell*)pCell)->SetInChangeTrack( TRUE ); - } - break; - case CELLTYPE_NONE : - pCell = NULL; - break; - default: - DBG_ERROR( "ScChangeAction::LoadCell: unknown CellType" ); - rStrm.SetError( SVSTREAM_FILEFORMAT_ERROR ); - pCell = NULL; - } - return pCell; -#else - return 0; -#endif // SC_ROWLIMIT_STREAM_ACCESS -} - - -// static -BOOL ScChangeAction::StoreLinkChain( ScChangeActionLinkEntry* pLinkFirst, - SvStream& rStrm ) -{ - BOOL bOk = TRUE; - UINT32 nCount = 0; - if ( pLinkFirst ) - { - // rueckwaerts speichern, damit onLoad mit Insert die Reihenfolge wieder stimmt - Stack* pStack = new Stack; - for ( ScChangeActionLinkEntry* pL = pLinkFirst; pL; pL = pL->GetNext() ) - { - ++nCount; - pStack->Push( pL ); - } - rStrm << nCount; - ScChangeActionLinkEntry* pHere; - while ( ( pHere = (ScChangeActionLinkEntry*) pStack->Pop() ) != NULL ) - { - ScChangeAction* p = pHere->GetAction(); - rStrm << (UINT32) ( p ? p->GetActionNumber() : 0 ); - } - delete pStack; - } - else - rStrm << nCount; - return bOk; -} - - -// static -BOOL ScChangeAction::LoadLinkChain( ScChangeAction* pOfAction, - ScChangeActionLinkEntry** ppLinkFirst, SvStream& rStrm, - ScChangeTrack* pTrack, BOOL bLinkDeleted ) -{ - BOOL bOk = TRUE; - UINT32 nCount; - rStrm >> nCount; - for ( UINT32 j = 0; j < nCount; j++ ) - { - ScChangeAction* pAct = NULL; - UINT32 nAct; - rStrm >> nAct; - if ( nAct ) - { - pAct = pTrack->GetActionOrGenerated( nAct ); - DBG_ASSERT( pAct, "ScChangeAction::LoadLinkChain: missing Action" ); - } - if ( bLinkDeleted ) - { - if ( pAct ) - pAct->SetDeletedIn( pOfAction ); - } - else - { - ScChangeActionLinkEntry* pLink = new ScChangeActionLinkEntry( - ppLinkFirst, pAct ); - if ( pAct ) - pAct->AddLink( pOfAction, pLink ); - } - } - return bOk; -} - - void ScChangeAction::SetDeletedInThis( ULONG nActionNumber, const ScChangeTrack* pTrack ) { @@ -863,52 +653,6 @@ void ScChangeAction::AddDependent( ULONG nActionNumber, } } -// static -BOOL ScChangeAction::StoreCellList( ScChangeActionCellListEntry* pFirstCell, - SvStream& rStrm ) -{ - UINT32 nCount = 0; - for ( const ScChangeActionCellListEntry* pE = pFirstCell; pE; - pE = pE->pNext ) - ++nCount; - rStrm << nCount; - - if ( nCount ) - { - for ( const ScChangeActionCellListEntry* pE = pFirstCell; pE; - pE = pE->pNext ) - { // Store/Load vertauscht die Reihenfolge, aber das ist hierbei egal - rStrm << (UINT32) pE->pContent->GetActionNumber(); - } - } - return TRUE; -} - - -BOOL ScChangeAction::LoadCellList( ScChangeAction* pOfAction, - ScChangeActionCellListEntry*& /* pFirstCell */, SvStream& rStrm, - ScChangeTrack* pTrack ) -{ - UINT32 nCount; - rStrm >> nCount; - if ( nCount ) - { - for ( UINT32 j = 0; j < nCount; j++ ) - { - ScChangeActionContent* pContent; - UINT32 nContent; - rStrm >> nContent; - pContent = (ScChangeActionContent*) pTrack->GetActionOrGenerated( nContent ); - if ( pContent ) - pOfAction->AddContent( pContent ); - else - { - DBG_ERROR( "ScChangeActionDel::LoadLinks: missing Content" ); - } - } - } - return TRUE; -} #if DEBUG_CHANGETRACK String ScChangeAction::ToString( ScDocument* pDoc ) const @@ -1082,13 +826,6 @@ ScChangeActionIns::ScChangeActionIns( const ScRange& rRange ) } -ScChangeActionIns::ScChangeActionIns( SvStream& rStrm, - ScMultipleReadHeader& rHdr, ScChangeTrack* pTrack ) - : - ScChangeAction( rStrm, rHdr, pTrack ) -{ -} - ScChangeActionIns::ScChangeActionIns(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber, const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String& sComment, const ScChangeActionType eTypeP) @@ -1102,13 +839,6 @@ ScChangeActionIns::~ScChangeActionIns() } -BOOL ScChangeActionIns::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const -{ - BOOL bOk = ScChangeAction::Store( rStrm, rHdr ); - return bOk; -} - - void ScChangeActionIns::GetDescription( String& rStr, ScDocument* pDoc, BOOL bSplitRange, bool bWarning ) const { @@ -1209,26 +939,6 @@ ScChangeActionDel::ScChangeActionDel( const ScRange& rRange, } -ScChangeActionDel::ScChangeActionDel( SvStream& rStrm, - ScMultipleReadHeader& rHdr, ScDocument* /* pDoc */, USHORT /* nVer */, - ScChangeTrack* pTrackP ) - : - ScChangeAction( rStrm, rHdr, pTrackP ), - pTrack( pTrackP ), - pFirstCell( NULL ), - pLinkMove( NULL ) -{ -#if SC_ROWLIMIT_STREAM_ACCESS -#error address types changed! - UINT32 n32; - INT16 n16s; - rStrm >> n32; pCutOff = (ScChangeActionIns*)(ULONG) n32; - rStrm >> n16s; nCutOff = n16s; - rStrm >> n16s; nDx = n16s; - rStrm >> n16s; nDy = n16s; -#endif // SC_ROWLIMIT_STREAM_ACCESS -} - ScChangeActionDel::ScChangeActionDel(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber, const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String &sComment, const ScChangeActionType eTypeP, const SCsCOLROW nD, ScChangeTrack* pTrackP) // wich of nDx and nDy is set is depend on the type @@ -1255,72 +965,6 @@ ScChangeActionDel::~ScChangeActionDel() delete pLinkMove; } -BOOL ScChangeActionDel::StoreLinks( SvStream& rStrm ) const -{ - BOOL bOk = ScChangeAction::StoreLinks( rStrm ); - UINT32 nCount = 0; - if ( pLinkMove ) - { - // rueckwaerts speichern, damit onLoad mit Insert die Reihenfolge wieder stimmt - Stack* pStack = new Stack; - for ( ScChangeActionDelMoveEntry* pL = pLinkMove; pL; pL = pL->GetNext() ) - { - ++nCount; - pStack->Push( pL ); - } - rStrm << nCount; - ScChangeActionDelMoveEntry* pHere; - while ( ( pHere = (ScChangeActionDelMoveEntry*) pStack->Pop() ) != NULL ) - { - ScChangeAction* p = pHere->GetAction(); - rStrm << (UINT32) ( p ? p->GetActionNumber() : 0 ); - rStrm << (INT16) pHere->GetCutOffFrom(); - rStrm << (INT16) pHere->GetCutOffTo(); - } - delete pStack; - } - else - rStrm << nCount; - - bOk &= ScChangeAction::StoreCellList( pFirstCell, rStrm ); - - return bOk; -} - - -BOOL ScChangeActionDel::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrackP ) -{ - BOOL bOk = ScChangeAction::LoadLinks( rStrm, pTrackP ); - UINT32 nCount; - rStrm >> nCount; - for ( UINT32 j = 0; j < nCount; j++ ) - { - ScChangeActionMove* pAct = NULL; - UINT32 nAct; - rStrm >> nAct; - if ( nAct ) - { - pAct = (ScChangeActionMove*) pTrackP->GetAction( nAct ); - DBG_ASSERT( pAct, "ScChangeActionDel::LoadLinks: missing Move" ); - } - INT16 nFrom, nTo; - rStrm >> nFrom >> nTo; - ScChangeActionDelMoveEntry* pLink = new ScChangeActionDelMoveEntry( - &pLinkMove, pAct, nFrom, nTo ); - if ( pAct ) - pAct->AddLink( this, pLink ); - } - if ( pCutOff ) - { - pCutOff = (ScChangeActionIns*) pTrackP->GetAction( (ULONG) pCutOff ); - DBG_ASSERT( pCutOff, "ScChangeActionDel::LoadLinks: missing Insert" ); - } - - bOk &= ScChangeAction::LoadCellList( this, pFirstCell, rStrm, pTrackP ); - - return bOk; -} - void ScChangeActionDel::AddContent( ScChangeActionContent* pContent ) { ScChangeActionCellListEntry* pE = new ScChangeActionCellListEntry( @@ -1623,18 +1267,6 @@ void ScChangeActionDel::UndoCutOffInsert() // --- ScChangeActionMove -------------------------------------------------- -ScChangeActionMove::ScChangeActionMove( SvStream& rStrm, - ScMultipleReadHeader& rHdr, ScChangeTrack* pTrackP ) - : - ScChangeAction( rStrm, rHdr, pTrackP ), - pTrack( pTrackP ), - pFirstCell( NULL ), - nStartLastCut(0), - nEndLastCut(0) -{ - rStrm >> aFromRange; -} - ScChangeActionMove::ScChangeActionMove(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber, const ScBigRange& aToBigRange, const String& aUserP, const DateTime& aDateTimeP, const String &sComment, const ScBigRange& aFromBigRange, ScChangeTrack* pTrackP) // wich of nDx and nDy is set is depend on the type @@ -1654,30 +1286,6 @@ ScChangeActionMove::~ScChangeActionMove() } -BOOL ScChangeActionMove::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const -{ - BOOL bOk = ScChangeAction::Store( rStrm, rHdr ); - rStrm << aFromRange; - return bOk; -} - - -BOOL ScChangeActionMove::StoreLinks( SvStream& rStrm ) const -{ - BOOL bOk = ScChangeAction::StoreLinks( rStrm ); - bOk &= ScChangeAction::StoreCellList( pFirstCell, rStrm ); - return bOk; -} - - -BOOL ScChangeActionMove::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrackP ) -{ - BOOL bOk = ScChangeAction::LoadLinks( rStrm, pTrackP ); - bOk &= ScChangeAction::LoadCellList( this, pFirstCell, rStrm, pTrackP ); - return bOk; -} - - void ScChangeActionMove::AddContent( ScChangeActionContent* pContent ) { ScChangeActionCellListEntry* pE = new ScChangeActionCellListEntry( @@ -1816,28 +1424,6 @@ BOOL ScChangeActionMove::Reject( ScDocument* pDoc ) const USHORT nMemPoolChangeActionContent = (0x8000 - 64) / sizeof(ScChangeActionContent); IMPL_FIXEDMEMPOOL_NEWDEL( ScChangeActionContent, nMemPoolChangeActionContent, nMemPoolChangeActionContent ) - -ScChangeActionContent::ScChangeActionContent( SvStream& rStrm, - ScMultipleReadHeader& rHdr, ScDocument* pDoc, USHORT nVer, - ScChangeTrack* pTrack ) - : - ScChangeAction( rStrm, rHdr, pTrack ), - pNextInSlot( NULL ), - ppPrevInSlot( NULL ) -{ - UINT32 n32; - rStrm.ReadByteString( aOldValue, rStrm.GetStreamCharSet() ); - rStrm.ReadByteString( aNewValue, rStrm.GetStreamCharSet() ); - rStrm >> n32; pNextContent = (ScChangeActionContent*)(ULONG) n32; - rStrm >> n32; pPrevContent = (ScChangeActionContent*)(ULONG) n32; - - { - ScMultipleReadHeader aDataHdr( rStrm ); - pOldCell = ScChangeAction::LoadCell( rStrm, aDataHdr, pDoc, nVer ); - pNewCell = ScChangeAction::LoadCell( rStrm, aDataHdr, pDoc, nVer ); - } -} - ScChangeActionContent::ScChangeActionContent( const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber, const ScBigRange& aBigRangeP, const String& aUserP, @@ -1895,52 +1481,6 @@ void ScChangeActionContent::ClearTrack() } -BOOL ScChangeActionContent::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const -{ - BOOL bOk = ScChangeAction::Store( rStrm, rHdr ); - rStrm.WriteByteString( aOldValue, rStrm.GetStreamCharSet() ); - rStrm.WriteByteString( aNewValue, rStrm.GetStreamCharSet() ); - rStrm << (UINT32) ( pNextContent ? pNextContent->GetActionNumber() : 0 ); - rStrm << (UINT32) ( pPrevContent ? pPrevContent->GetActionNumber() : 0 ); - - { - ScMultipleWriteHeader aDataHdr( rStrm ); - ScChangeAction::StoreCell( pOldCell, rStrm, aDataHdr ); - ScChangeAction::StoreCell( pNewCell, rStrm, aDataHdr ); - } - - return bOk; -} - - -BOOL ScChangeActionContent::StoreLinks( SvStream& rStrm ) const -{ - BOOL bOk = ScChangeAction::StoreLinks( rStrm ); - return bOk; -} - - -BOOL ScChangeActionContent::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrack ) -{ - BOOL bOk = ScChangeAction::LoadLinks( rStrm, pTrack ); - if ( pNextContent ) - { - pNextContent = (ScChangeActionContent*) pTrack->GetAction( - (ULONG) pNextContent ); - DBG_ASSERT( pNextContent, - "ScChangeActionContent::LoadLinks: missing NextContent" ); - } - if ( pPrevContent ) - { - pPrevContent = (ScChangeActionContent*) pTrack->GetAction( - (ULONG) pPrevContent ); - DBG_ASSERT( pPrevContent, - "ScChangeActionContent::LoadLinks: missing PrevContent" ); - } - return bOk; -} - - ScChangeActionContent* ScChangeActionContent::GetTopContent() const { if ( pNextContent ) @@ -2658,13 +2198,6 @@ void ScChangeActionContent::UpdateReference( const ScChangeTrack* pTrack, // --- ScChangeActionReject ------------------------------------------------ -ScChangeActionReject::ScChangeActionReject( SvStream& rStrm, - ScMultipleReadHeader& rHdr, ScChangeTrack* pTrack ) - : - ScChangeAction( rStrm, rHdr, pTrack ) -{ -} - ScChangeActionReject::ScChangeActionReject(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber, const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String& sComment) : @@ -2672,12 +2205,6 @@ ScChangeActionReject::ScChangeActionReject(const ULONG nActionNumber, const ScCh { } -BOOL ScChangeActionReject::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const -{ - (void)ScChangeAction::Store( rStrm, rHdr ); - return TRUE; -} - // --- ScChangeTrack ------------------------------------------------------- @@ -2915,29 +2442,6 @@ void ScChangeTrack::NotifyModified( ScChangeTrackMsgType eMsgType, } -void lcl_EnsureSorting( ScStrCollection& rCollection ) -{ - BOOL bSorted = TRUE; - USHORT nCount = rCollection.GetCount(); - USHORT i; - for (i=0; i+1Clone(); - if (!aNewColl.Insert(pNewObj)) - delete pNewObj; - } - rCollection = aNewColl; - } -} - void ScChangeTrack::MasterLinks( ScChangeAction* pAppend ) { ScChangeActionType eType = pAppend->GetType(); @@ -3243,14 +2747,6 @@ BOOL ScChangeTrack::IsMatrixFormulaRangeDifferent( const ScBaseCell* pOldCell, } -void ScChangeTrack::AppendContent( const ScAddress& rPos, - const String& rNewValue ) -{ - ScBaseCell* pCell = pDoc->GetCell( rPos ); - AppendContent( rPos, rNewValue, pCell ); -} - - void ScChangeTrack::AppendContent( const ScAddress& rPos, const String& rNewValue, ScBaseCell* pOldCell ) { @@ -3321,16 +2817,6 @@ void ScChangeTrack::AppendContent( const ScAddress& rPos, } -void ScChangeTrack::AppendContent( const ScAddress& rPos, - const ScBaseCell* pOldCell, ScDocument* pRefDoc ) -{ - if ( ScChangeActionContent::NeedsNumberFormat( pOldCell ) ) - AppendContent( rPos, pOldCell, pRefDoc->GetNumberFormat( rPos ), pRefDoc ); - else - AppendContent( rPos, pOldCell, 0, pRefDoc ); -} - - void ScChangeTrack::SetLastCutMoveRange( const ScRange& rRange, ScDocument* pRefDoc ) { diff --git a/sc/source/core/tool/collect.cxx b/sc/source/core/tool/collect.cxx index 04343bb65a41..c5d4df22ccea 100644 --- a/sc/source/core/tool/collect.cxx +++ b/sc/source/core/tool/collect.cxx @@ -333,38 +333,6 @@ ScDataObject* ScStrCollection::Clone() const return new ScStrCollection(*this); } -//------------------------------------------------------------------------ - -void ScStrCollection::Load( SvStream& rStream ) -{ - ScReadHeader aHdr( rStream ); - lcl_DeleteScDataObjects( pItems, nCount ); - BOOL bDups; - rStream >> bDups; - SetDups( bDups ); - rStream >> nCount >> nLimit >> nDelta; - pItems = new ScDataObject*[nLimit]; - String aStr; - rtl_TextEncoding eSet = rStream.GetStreamCharSet(); - for ( USHORT i=0; iGetString(), eSet ); - } -} - //------------------------------------------------------------------------ // TypedScStrCollection //------------------------------------------------------------------------ diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index bc2266cbd3c8..599d7c63d68b 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -127,77 +127,6 @@ enum ScanState static const sal_Char* pInternal[ 5 ] = { "GAME", "SPEW", "TTT", "STARCALCTEAM", "ANTWORT" }; using namespace ::com::sun::star::i18n; -///////////////////////////////////////////////////////////////////////// - -short lcl_GetRetFormat( OpCode eOpCode ) -{ - switch (eOpCode) - { - case ocEqual: - case ocNotEqual: - case ocLess: - case ocGreater: - case ocLessEqual: - case ocGreaterEqual: - case ocAnd: - case ocOr: - case ocNot: - case ocTrue: - case ocFalse: - case ocIsEmpty: - case ocIsString: - case ocIsNonString: - case ocIsLogical: - case ocIsRef: - case ocIsValue: - case ocIsFormula: - case ocIsNA: - case ocIsErr: - case ocIsError: - case ocIsEven: - case ocIsOdd: - case ocExact: - return NUMBERFORMAT_LOGICAL; - case ocGetActDate: - case ocGetDate: - case ocEasterSunday : - return NUMBERFORMAT_DATE; - case ocGetActTime: - return NUMBERFORMAT_DATETIME; - case ocGetTime: - return NUMBERFORMAT_TIME; - case ocNPV: - case ocBW: - case ocDIA: - case ocGDA: - case ocGDA2: - case ocVBD: - case ocLIA: - case ocRMZ: - case ocZW: - case ocZinsZ: - case ocKapz: - case ocKumZinsZ: - case ocKumKapZ: - return NUMBERFORMAT_CURRENCY; - case ocZins: - case ocIRR: - case ocMIRR: - case ocZGZ: - case ocEffektiv: - case ocNominal: - case ocPercentSign: - return NUMBERFORMAT_PERCENT; -// case ocSum: -// case ocSumSQ: -// case ocProduct: -// case ocAverage: -// return -1; - default: - return NUMBERFORMAT_NUMBER; - } - return NUMBERFORMAT_NUMBER; -} ///////////////////////////////////////////////////////////////////////// diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index 4a4683935e99..24ed502e33b1 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -363,19 +363,19 @@ BOOL ScRangeData::operator== (const ScRangeData& rData) const // fuer Undo return TRUE; } -BOOL ScRangeData::IsRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const -{ - BOOL bRet = FALSE; - ScRange aRange; - if ( IsReference(aRange) ) - { - if ( bStartOnly ) - bRet = ( rPos == aRange.aStart ); - else - bRet = ( aRange.In( rPos ) ); - } - return bRet; -} +//UNUSED2009-05 BOOL ScRangeData::IsRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const +//UNUSED2009-05 { +//UNUSED2009-05 BOOL bRet = FALSE; +//UNUSED2009-05 ScRange aRange; +//UNUSED2009-05 if ( IsReference(aRange) ) +//UNUSED2009-05 { +//UNUSED2009-05 if ( bStartOnly ) +//UNUSED2009-05 bRet = ( rPos == aRange.aStart ); +//UNUSED2009-05 else +//UNUSED2009-05 bRet = ( aRange.In( rPos ) ); +//UNUSED2009-05 } +//UNUSED2009-05 return bRet; +//UNUSED2009-05 } BOOL ScRangeData::IsRangeAtBlock( const ScRange& rBlock ) const { @@ -799,16 +799,16 @@ ScRangeData* ScRangeName::FindIndex( USHORT nIndex ) return NULL; } -ScRangeData* ScRangeName::GetRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const -{ - if ( pItems ) - { - for ( USHORT i = 0; i < nCount; i++ ) - if ( ((ScRangeData*)pItems[i])->IsRangeAtCursor( rPos, bStartOnly ) ) - return (ScRangeData*)pItems[i]; - } - return NULL; -} +//UNUSED2009-05 ScRangeData* ScRangeName::GetRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const +//UNUSED2009-05 { +//UNUSED2009-05 if ( pItems ) +//UNUSED2009-05 { +//UNUSED2009-05 for ( USHORT i = 0; i < nCount; i++ ) +//UNUSED2009-05 if ( ((ScRangeData*)pItems[i])->IsRangeAtCursor( rPos, bStartOnly ) ) +//UNUSED2009-05 return (ScRangeData*)pItems[i]; +//UNUSED2009-05 } +//UNUSED2009-05 return NULL; +//UNUSED2009-05 } ScRangeData* ScRangeName::GetRangeAtBlock( const ScRange& rBlock ) const { diff --git a/sc/source/core/tool/rechead.cxx b/sc/source/core/tool/rechead.cxx index 7e8a271470e4..517759524c92 100644 --- a/sc/source/core/tool/rechead.cxx +++ b/sc/source/core/tool/rechead.cxx @@ -44,62 +44,6 @@ // ======================================================================= -ScReadHeader::ScReadHeader(SvStream& rNewStream) : - rStream( rNewStream ) -{ - sal_uInt32 nDataSize; - rStream >> nDataSize; - nDataEnd = rStream.Tell() + nDataSize; -} - -ScReadHeader::~ScReadHeader() -{ - ULONG nReadEnd = rStream.Tell(); - DBG_ASSERT( nReadEnd <= nDataEnd, "zuviele Bytes gelesen" ); - if ( nReadEnd != nDataEnd ) - { - if ( rStream.GetError() == SVSTREAM_OK ) - rStream.SetError( SCWARN_IMPORT_INFOLOST ); - rStream.Seek(nDataEnd); // Rest ueberspringen - } -} - -ULONG ScReadHeader::BytesLeft() const -{ - ULONG nReadEnd = rStream.Tell(); - if (nReadEnd <= nDataEnd) - return nDataEnd-nReadEnd; - - DBG_ERROR("Fehler bei ScReadHeader::BytesLeft"); - return 0; -} - -// ----------------------------------------------------------------------- - -ScWriteHeader::ScWriteHeader(SvStream& rNewStream, sal_uInt32 nDefault) : - rStream( rNewStream ) -{ - nDataSize = nDefault; - rStream << nDataSize; - - nDataPos = rStream.Tell(); -} - -ScWriteHeader::~ScWriteHeader() -{ - ULONG nPos = rStream.Tell(); - - if ( nPos - nDataPos != nDataSize ) // Default getroffen? - { - nDataSize = nPos - nDataPos; - rStream.Seek(nDataPos - sizeof(sal_uInt32)); - rStream << nDataSize; // Groesse am Anfang eintragen - rStream.Seek(nPos); - } -} - -// ======================================================================= - ScMultipleReadHeader::ScMultipleReadHeader(SvStream& rNewStream) : rStream( rNewStream ) { diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx index ddb5f3dc0a5c..1f70ef80963c 100644 --- a/sc/source/core/tool/refupdat.cxx +++ b/sc/source/core/tool/refupdat.cxx @@ -939,37 +939,4 @@ ScRefUpdateRes ScRefUpdate::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCRO return eRet; } -#if OLD_PIVOT_IMPLEMENTATION -ScRefUpdateRes ScRefUpdate::DoGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY, - ScRange& rRef ) -{ - // wie UpdateGrow, nur mit Range statt RefData - - ScRefUpdateRes eRet = UR_NOTHING; - - BOOL bUpdateX = ( nGrowX && - rRef.aStart.Col() == rArea.aStart.Col() && rRef.aEnd.Col() == rArea.aEnd.Col() && - rRef.aStart.Row() >= rArea.aStart.Row() && rRef.aEnd.Row() <= rArea.aEnd.Row() && - rRef.aStart.Tab() >= rArea.aStart.Tab() && rRef.aEnd.Tab() <= rArea.aEnd.Tab() ); - BOOL bUpdateY = ( nGrowY && - rRef.aStart.Col() >= rArea.aStart.Col() && rRef.aEnd.Col() <= rArea.aEnd.Col() && - ( rRef.aStart.Row() == rArea.aStart.Row() || rRef.aStart.Row() == rArea.aStart.Row()+1 ) && - rRef.aEnd.Row() == rArea.aEnd.Row() && - rRef.aStart.Tab() >= rArea.aStart.Tab() && rRef.aEnd.Tab() <= rArea.aEnd.Tab() ); - - if ( bUpdateX ) - { - rRef.aEnd.SetCol( rRef.aEnd.Col() + nGrowX ); - eRet = UR_UPDATED; - } - if ( bUpdateY ) - { - rRef.aEnd.SetRow( rRef.aEnd.Row() + nGrowY ); - eRet = UR_UPDATED; - } - - return eRet; -} -#endif - diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index af22bf7e43a3..ad7147ccb14d 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -608,48 +608,48 @@ void ScMatrix::MatTrans(ScMatrix& mRes) const } } -void ScMatrix::MatCopyUpperLeft(ScMatrix& mRes) const -{ - if (nColCount < mRes.nColCount || nRowCount < mRes.nRowCount) - { - DBG_ERRORFILE("ScMatrix::MatCopyUpperLeft: dimension error"); - } - else - { - if (mnValType) - { - ScMatValType nType; - mRes.ResetIsString(); - for ( SCSIZE i = 0; i < mRes.nColCount; i++ ) - { - SCSIZE nStart = i * nRowCount; - for ( SCSIZE j = 0; j < mRes.nRowCount; j++ ) - { - if ( IsNonValueType( (nType = mnValType[nStart+j]) )) - mRes.PutStringEntry( pMat[nStart+j].pS, nType, - i*mRes.nRowCount+j ); - else - { - mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal; - mRes.mnValType[i*mRes.nRowCount+j] = nType; - } - } - } - } - else - { - mRes.DeleteIsString(); - for ( SCSIZE i = 0; i < mRes.nColCount; i++ ) - { - SCSIZE nStart = i * nRowCount; - for ( SCSIZE j = 0; j < mRes.nRowCount; j++ ) - { - mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal; - } - } - } - } -} +//UNUSED2009-05 void ScMatrix::MatCopyUpperLeft(ScMatrix& mRes) const +//UNUSED2009-05 { +//UNUSED2009-05 if (nColCount < mRes.nColCount || nRowCount < mRes.nRowCount) +//UNUSED2009-05 { +//UNUSED2009-05 DBG_ERRORFILE("ScMatrix::MatCopyUpperLeft: dimension error"); +//UNUSED2009-05 } +//UNUSED2009-05 else +//UNUSED2009-05 { +//UNUSED2009-05 if (mnValType) +//UNUSED2009-05 { +//UNUSED2009-05 ScMatValType nType; +//UNUSED2009-05 mRes.ResetIsString(); +//UNUSED2009-05 for ( SCSIZE i = 0; i < mRes.nColCount; i++ ) +//UNUSED2009-05 { +//UNUSED2009-05 SCSIZE nStart = i * nRowCount; +//UNUSED2009-05 for ( SCSIZE j = 0; j < mRes.nRowCount; j++ ) +//UNUSED2009-05 { +//UNUSED2009-05 if ( IsNonValueType( (nType = mnValType[nStart+j]) )) +//UNUSED2009-05 mRes.PutStringEntry( pMat[nStart+j].pS, nType, +//UNUSED2009-05 i*mRes.nRowCount+j ); +//UNUSED2009-05 else +//UNUSED2009-05 { +//UNUSED2009-05 mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal; +//UNUSED2009-05 mRes.mnValType[i*mRes.nRowCount+j] = nType; +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 else +//UNUSED2009-05 { +//UNUSED2009-05 mRes.DeleteIsString(); +//UNUSED2009-05 for ( SCSIZE i = 0; i < mRes.nColCount; i++ ) +//UNUSED2009-05 { +//UNUSED2009-05 SCSIZE nStart = i * nRowCount; +//UNUSED2009-05 for ( SCSIZE j = 0; j < mRes.nRowCount; j++ ) +//UNUSED2009-05 { +//UNUSED2009-05 mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal; +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 } void ScMatrix::FillDouble( double fVal, SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2 ) { diff --git a/sc/source/core/tool/subtotal.cxx b/sc/source/core/tool/subtotal.cxx index 828a65654242..c8061441abfc 100644 --- a/sc/source/core/tool/subtotal.cxx +++ b/sc/source/core/tool/subtotal.cxx @@ -39,188 +39,6 @@ // ----------------------------------------------------------------------- -#if OLD_PIVOT_IMPLEMENTATION -SubTotal::SubTotal() -{ - nIndex = 0; //! test fuer Pivot - - nCount = 0; - nCount2 = 0; - nSum = 0.0; - nSumSqr = 0.0; - nMax = -MAXDOUBLE; - nMin = MAXDOUBLE; - nProduct = 1.0; - bSumOk = TRUE; - bSumSqrOk = TRUE; - bProductOk = TRUE; -} - - -SubTotal::~SubTotal() -{ -} - - -void SubTotal::UpdateNoVal() -{ - nCount++; -} - - -void SubTotal::Update( double nVal ) -{ - SAL_MATH_FPEXCEPTIONS_OFF(); - nCount++; - nCount2++; - if (nVal > nMax) nMax = nVal; - if (nVal < nMin) nMin = nVal; - nProgress = 0; - if (bSumOk) nSum += nVal; - nProgress = 1; - if (bProductOk) nProduct *= nVal; - nProgress = 2; - if (bSumSqrOk) nSumSqr += nVal*nVal; - if (!::rtl::math::isFinite(nSum)) - bSumOk = FALSE; - if (!::rtl::math::isFinite(nProduct)) - bProductOk = FALSE; - if (!::rtl::math::isFinite(nSumSqr)) - bSumSqrOk = FALSE; -} - - -void SubTotal::Update( const SubTotal& rVal ) -{ - SAL_MATH_FPEXCEPTIONS_OFF(); - nCount += rVal.nCount; - nCount2 += rVal.nCount2; - if (rVal.nMax > nMax) nMax = rVal.nMax; - if (rVal.nMin < nMin) nMin = rVal.nMin; - nProgress = 0; - if (rVal.bSumOk && bSumOk) - nSum += rVal.nSum; - else - bSumOk = FALSE; - nProgress = 1; - if (rVal.bProductOk && bProductOk) - nProduct *= rVal.nProduct; - else - bProductOk = FALSE; - nProgress = 2; - if (rVal.bSumSqrOk && bSumSqrOk) - nSumSqr += rVal.nSumSqr; - else - bSumSqrOk = FALSE; - if (!::rtl::math::isFinite(nSum)) - bSumOk = FALSE; - if (!::rtl::math::isFinite(nProduct)) - bProductOk = FALSE; - if (!::rtl::math::isFinite(nSumSqr)) - bSumSqrOk = FALSE; -} - - -short SubTotal::Valid( USHORT nFunction ) const - // return 0 => Fehler, -1 => kein Wert, 1 => ok -{ - short nRet; - switch (nFunction) - { - case PIVOT_FUNC_AVERAGE: - if (nCount2 == 0) - nRet = -1; - else - nRet = bSumOk; - break; - case PIVOT_FUNC_STD_DEVP: - case PIVOT_FUNC_STD_VARP: - if (nCount2 == 0) - nRet = -1; - else - nRet = bSumSqrOk; - break; - case PIVOT_FUNC_STD_DEV: - case PIVOT_FUNC_STD_VAR: - if (nCount2 < 2) - nRet = -1; - else - nRet = bSumSqrOk; - break; - case PIVOT_FUNC_MAX: - if (nCount2 == 0) - nRet = -1; - else - nRet = 1; - break; - case PIVOT_FUNC_MIN: - if (nCount2 == 0) - nRet = -1; - else - nRet = 1; - break; - case PIVOT_FUNC_SUM: - if (nCount2 == 0) - nRet = -1; - else - nRet = bSumOk; - break; - case PIVOT_FUNC_PRODUCT: - if (nCount2 == 0) - nRet = -1; - else - nRet = bProductOk; - break; - default: - nRet = 1; - break; - } - return nRet; -} - - -double SubTotal::Result( USHORT nFunction ) const -{ - double nRet = 0.0; - switch (nFunction) - { - case PIVOT_FUNC_COUNT: nRet = (double) nCount; break; - case PIVOT_FUNC_COUNT_NUM: nRet = (double) nCount2; break; - case PIVOT_FUNC_SUM: nRet = nSum; break; - case PIVOT_FUNC_MAX: nRet = nMax; break; - case PIVOT_FUNC_MIN: nRet = nMin; break; - case PIVOT_FUNC_PRODUCT: nRet = nProduct; break; - case PIVOT_FUNC_AVERAGE: - if (nCount2 > 0) - nRet = nSum / (double) nCount2; - break; - case PIVOT_FUNC_STD_DEV: - if (nCount2 > 1) - nRet = sqrt((nSumSqr - nSum*nSum/(double)(nCount2)) - / (double)(nCount2-1)); - break; - case PIVOT_FUNC_STD_DEVP: - if (nCount2 > 0) - nRet = sqrt((nSumSqr - nSum*nSum/(double)(nCount2)) - / (double)nCount2); - break; - case PIVOT_FUNC_STD_VAR: - if (nCount2 > 1) - nRet = (nSumSqr - nSum*nSum/(double)(nCount2)) - / (double)(nCount2-1); - break; - case PIVOT_FUNC_STD_VARP: - if (nCount2 > 0) - nRet = (nSumSqr - nSum*nSum/(double)(nCount2)) - / (double)(nCount2); - break; - default: - DBG_ERROR("unbekannte Funktion bei SubTotal::Result"); - } - return nRet; -} -#endif - BOOL SubTotal::SafePlus(double& fVal1, double fVal2) { BOOL bOk = TRUE; diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 0f51bb8f2f1b..bff8d4cba246 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -218,12 +218,6 @@ UINT16 ExcDummyRec::GetNum( void ) const //------------------------------------------------------- class ExcBoolRecord - -ExcBoolRecord::ExcBoolRecord( SfxItemSet* pItemSet, USHORT nWhich, BOOL bDefault ) -{ - bVal = pItemSet? ( ( const SfxBoolItem& ) pItemSet->Get( nWhich ) ).GetValue() : bDefault; -} - - void ExcBoolRecord::SaveCont( XclExpStream& rStrm ) { rStrm << (UINT16)(bVal ? 0x0001 : 0x0000); diff --git a/sc/source/filter/excel/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx index 28ce1a19b932..34c2b9284fed 100644 --- a/sc/source/filter/excel/tokstack.cxx +++ b/sc/source/filter/excel/tokstack.cxx @@ -208,20 +208,20 @@ void TokenPool::GrowDouble( void ) } -void TokenPool::GrowError( void ) -{ - UINT16 nP_ErrNew = nP_Err * 2; - - USHORT* pP_ErrNew = new USHORT[ nP_ErrNew ]; - - for( UINT16 nL = 0 ; nL < nP_Err ; nL++ ) - pP_ErrNew[ nL ] = pP_Err[ nL ]; - - nP_Err = nP_ErrNew; - - delete[] pP_Err; - pP_Err = pP_ErrNew; -} +//UNUSED2009-05 void TokenPool::GrowError( void ) +//UNUSED2009-05 { +//UNUSED2009-05 UINT16 nP_ErrNew = nP_Err * 2; +//UNUSED2009-05 +//UNUSED2009-05 USHORT* pP_ErrNew = new USHORT[ nP_ErrNew ]; +//UNUSED2009-05 +//UNUSED2009-05 for( UINT16 nL = 0 ; nL < nP_Err ; nL++ ) +//UNUSED2009-05 pP_ErrNew[ nL ] = pP_Err[ nL ]; +//UNUSED2009-05 +//UNUSED2009-05 nP_Err = nP_ErrNew; +//UNUSED2009-05 +//UNUSED2009-05 delete[] pP_Err; +//UNUSED2009-05 pP_Err = pP_ErrNew; +//UNUSED2009-05 } void TokenPool::GrowTripel( void ) @@ -593,28 +593,6 @@ const TokenId TokenPool::Store( const double& rDouble ) } -//UNUSED2008-05 const TokenId TokenPool::StoreError( USHORT nError ) -//UNUSED2008-05 { -//UNUSED2008-05 if( nElementAkt >= nElement ) -//UNUSED2008-05 GrowElement(); -//UNUSED2008-05 -//UNUSED2008-05 if( nP_ErrAkt >= nP_Err ) -//UNUSED2008-05 GrowError(); -//UNUSED2008-05 -//UNUSED2008-05 pElement[ nElementAkt ] = nP_ErrAkt; // Index in Error-Array -//UNUSED2008-05 pType[ nElementAkt ] = T_Err; // Typinfo Error eintragen -//UNUSED2008-05 -//UNUSED2008-05 pP_Err[ nP_ErrAkt ] = nError; -//UNUSED2008-05 -//UNUSED2008-05 pSize[ nElementAkt ] = 1; // eigentlich Banane -//UNUSED2008-05 -//UNUSED2008-05 nElementAkt++; -//UNUSED2008-05 nP_ErrAkt++; -//UNUSED2008-05 -//UNUSED2008-05 return ( const TokenId ) nElementAkt; // Ausgabe von altem Wert + 1! -//UNUSED2008-05 } - - const TokenId TokenPool::Store( const UINT16 nIndex ) { if( nElementAkt >= nElement ) diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 3fc04d7edd1a..2c6741811f3f 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -846,11 +846,11 @@ SCTAB XclExpTabInfo::GetRealScTab( SCTAB nSortedScTab ) const return (nSortedScTab < mnScCnt) ? maFromSortedVec[ nSortedScTab ] : SCTAB_INVALID; } -SCTAB XclExpTabInfo::GetSortedScTab( SCTAB nScTab ) const -{ - DBG_ASSERT( nScTab < mnScCnt, "XclExpTabInfo::GetSortedScTab - sheet out of range" ); - return (nScTab < mnScCnt) ? maToSortedVec[ nScTab ] : SCTAB_INVALID; -} +//UNUSED2009-05 SCTAB XclExpTabInfo::GetSortedScTab( SCTAB nScTab ) const +//UNUSED2009-05 { +//UNUSED2009-05 DBG_ASSERT( nScTab < mnScCnt, "XclExpTabInfo::GetSortedScTab - sheet out of range" ); +//UNUSED2009-05 return (nScTab < mnScCnt) ? maToSortedVec[ nScTab ] : SCTAB_INVALID; +//UNUSED2009-05 } bool XclExpTabInfo::GetFlag( SCTAB nScTab, sal_uInt8 nFlags ) const { diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index b4de1126959d..ace7a66dc1f9 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -720,10 +720,10 @@ sal_uInt16 XclExpNameManager::InsertDBRange( USHORT nScDBRangeIdx ) return mxImpl->InsertDBRange( nScDBRangeIdx ); } -sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab ) -{ - return mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, nScTab ); -} +//UNUSED2009-05 sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab ) +//UNUSED2009-05 { +//UNUSED2009-05 return mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, nScTab ); +//UNUSED2009-05 } sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, const ScRange& rRange ) { diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 457cdd2a17e4..4695c2c191cf 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -701,10 +701,10 @@ const XclExpPCField* XclExpPivotCache::GetField( sal_uInt16 nFieldIdx ) const return maFieldList.GetRecord( nFieldIdx ).get(); } -const XclExpPCField* XclExpPivotCache::GetField( const String& rFieldName ) const -{ - return const_cast< XclExpPivotCache* >( this )->GetFieldAcc( rFieldName ); -} +//UNUSED2009-05 const XclExpPCField* XclExpPivotCache::GetField( const String& rFieldName ) const +//UNUSED2009-05 { +//UNUSED2009-05 return const_cast< XclExpPivotCache* >( this )->GetFieldAcc( rFieldName ); +//UNUSED2009-05 } bool XclExpPivotCache::HasAddFields() const { @@ -1014,10 +1014,10 @@ sal_uInt16 XclExpPTField::GetLastDataInfoIndex() const return static_cast< sal_uInt16 >( maDataInfoVec.size() - 1 ); } -const XclExpPTItem* XclExpPTField::GetItem( const String& rName ) const -{ - return const_cast< XclExpPTField* >( this )->GetItemAcc( rName ); -} +//UNUSED2009-05 const XclExpPTItem* XclExpPTField::GetItem( const String& rName ) const +//UNUSED2009-05 { +//UNUSED2009-05 return const_cast< XclExpPTField* >( this )->GetItemAcc( rName ); +//UNUSED2009-05 } sal_uInt16 XclExpPTField::GetItemIndex( const String& rName, sal_uInt16 nDefaultIdx ) const { diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index fadc916d7b86..ef30e9a78f6d 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -653,36 +653,36 @@ void XclExpBooleanCell::WriteContents( XclExpStream& rStrm ) // ---------------------------------------------------------------------------- -IMPL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell, 256, 256 ) - -XclExpErrorCell::XclExpErrorCell( - const XclExpRoot rRoot, const XclAddress& rXclPos, - const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId, sal_uInt8 nErrCode ) : - // #i41210# always use latin script for error cells - XclExpSingleCellBase( rRoot, EXC_ID3_BOOLERR, 2, rXclPos, pPattern, ApiScriptType::LATIN, nForcedXFId ), - mnErrCode( nErrCode ) -{ -} - -void XclExpErrorCell::SaveXml( XclExpXmlStream& rStrm ) -{ - sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); - rWorksheet->startElement( XML_c, - XML_r, XclXmlUtils::ToOString( GetXclPos() ).getStr(), - XML_s, lcl_GetStyleId( rStrm, *this ).getStr(), - XML_t, "e", - // OOXTODO: XML_cm, XML_vm, XML_ph - FSEND ); - rWorksheet->startElement( XML_v, FSEND ); - rWorksheet->write( (sal_Int32) mnErrCode ); - rWorksheet->endElement( XML_v ); - rWorksheet->endElement( XML_c ); -} - -void XclExpErrorCell::WriteContents( XclExpStream& rStrm ) -{ - rStrm << mnErrCode << EXC_BOOLERR_ERROR; -} +//UNUSED2009-05 IMPL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell, 256, 256 ) +//UNUSED2009-05 +//UNUSED2009-05 XclExpErrorCell::XclExpErrorCell( +//UNUSED2009-05 const XclExpRoot rRoot, const XclAddress& rXclPos, +//UNUSED2009-05 const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId, sal_uInt8 nErrCode ) : +//UNUSED2009-05 // #i41210# always use latin script for error cells +//UNUSED2009-05 XclExpSingleCellBase( rRoot, EXC_ID3_BOOLERR, 2, rXclPos, pPattern, ApiScriptType::LATIN, nForcedXFId ), +//UNUSED2009-05 mnErrCode( nErrCode ) +//UNUSED2009-05 { +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 void XclExpErrorCell::SaveXml( XclExpXmlStream& rStrm ) +//UNUSED2009-05 { +//UNUSED2009-05 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); +//UNUSED2009-05 rWorksheet->startElement( XML_c, +//UNUSED2009-05 XML_r, XclXmlUtils::ToOString( GetXclPos() ).getStr(), +//UNUSED2009-05 XML_s, lcl_GetStyleId( rStrm, *this ).getStr(), +//UNUSED2009-05 XML_t, "e", +//UNUSED2009-05 // OOXTODO: XML_cm, XML_vm, XML_ph +//UNUSED2009-05 FSEND ); +//UNUSED2009-05 rWorksheet->startElement( XML_v, FSEND ); +//UNUSED2009-05 rWorksheet->write( (sal_Int32) mnErrCode ); +//UNUSED2009-05 rWorksheet->endElement( XML_v ); +//UNUSED2009-05 rWorksheet->endElement( XML_c ); +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 void XclExpErrorCell::WriteContents( XclExpStream& rStrm ) +//UNUSED2009-05 { +//UNUSED2009-05 rStrm << mnErrCode << EXC_BOOLERR_ERROR; +//UNUSED2009-05 } // ---------------------------------------------------------------------------- diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 98e8719414df..599b33f9c8aa 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -2900,10 +2900,10 @@ void XclImpPictureObj::ReadPictFmla( XclImpStream& rStrm, sal_uInt16 nLinkSize ) // DFF stream conversion ====================================================== -void XclImpSolverContainer::ReadSolverContainer( SvStream& rDffStrm ) -{ - rDffStrm >> *this; -} +//UNUSED2009-05 void XclImpSolverContainer::ReadSolverContainer( SvStream& rDffStrm ) +//UNUSED2009-05 { +//UNUSED2009-05 rDffStrm >> *this; +//UNUSED2009-05 } void XclImpSolverContainer::InsertSdrObjectInfo( SdrObject& rSdrObj, sal_uInt32 nDffShapeId, sal_uInt32 nDffFlags ) { diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index dab0a5c412c2..47b42ad51e93 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -137,23 +137,23 @@ bool XclImpAddressConverter::ConvertRange( ScRange& rScRange, return bValidStart; } -ScRange XclImpAddressConverter::CreateValidRange( - const XclRange& rXclRange, SCTAB nScTab1, SCTAB nScTab2, bool bWarn ) -{ - return ScRange( - CreateValidAddress( rXclRange.maFirst, nScTab1, bWarn ), - CreateValidAddress( rXclRange.maLast, nScTab2, bWarn ) ); -} +//UNUSED2009-05 ScRange XclImpAddressConverter::CreateValidRange( +//UNUSED2009-05 const XclRange& rXclRange, SCTAB nScTab1, SCTAB nScTab2, bool bWarn ) +//UNUSED2009-05 { +//UNUSED2009-05 return ScRange( +//UNUSED2009-05 CreateValidAddress( rXclRange.maFirst, nScTab1, bWarn ), +//UNUSED2009-05 CreateValidAddress( rXclRange.maLast, nScTab2, bWarn ) ); +//UNUSED2009-05 } // cell range list ------------------------------------------------------------ -bool XclImpAddressConverter::CheckRangeList( const XclRangeList& rXclRanges, bool bWarn ) -{ - for( XclRangeList::const_iterator aIt = rXclRanges.begin(), aEnd = rXclRanges.end(); aIt != aEnd; ++aIt ) - if( !CheckRange( *aIt, bWarn ) ) - return false; - return true; -} +//UNUSED2009-05 bool XclImpAddressConverter::CheckRangeList( const XclRangeList& rXclRanges, bool bWarn ) +//UNUSED2009-05 { +//UNUSED2009-05 for( XclRangeList::const_iterator aIt = rXclRanges.begin(), aEnd = rXclRanges.end(); aIt != aEnd; ++aIt ) +//UNUSED2009-05 if( !CheckRange( *aIt, bWarn ) ) +//UNUSED2009-05 return false; +//UNUSED2009-05 return true; +//UNUSED2009-05 } void XclImpAddressConverter::ConvertRangeList( ScRangeList& rScRanges, const XclRangeList& rXclRanges, SCTAB nScTab, bool bWarn ) @@ -254,11 +254,11 @@ EditTextObject* XclImpStringHelper::CreateTextObject( return lclCreateTextObject( rRoot, rString, EXC_FONTITEM_EDITENG, 0 ); } -EditTextObject* XclImpStringHelper::CreateNoteObject( - const XclImpRoot& rRoot, const XclImpString& rString ) -{ - return lclCreateTextObject( rRoot, rString, EXC_FONTITEM_NOTE, 0 ); -} +//UNUSED2009-05 EditTextObject* XclImpStringHelper::CreateNoteObject( +//UNUSED2009-05 const XclImpRoot& rRoot, const XclImpString& rString ) +//UNUSED2009-05 { +//UNUSED2009-05 return lclCreateTextObject( rRoot, rString, EXC_FONTITEM_NOTE, 0 ); +//UNUSED2009-05 } ScBaseCell* XclImpStringHelper::CreateCell( const XclImpRoot& rRoot, const XclImpString& rString, sal_uInt16 nXFIndex ) diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 2c2426382178..9033ecc125bd 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -206,20 +206,20 @@ public: private: /** Returns the specified SUPBOOK (external document). */ const XclImpSupbook* GetSupbook( sal_uInt32 nXtiIndex ) const; - /** Returns the SUPBOOK (external workbook) specified by its URL. */ - const XclImpSupbook* GetSupbook( const String& rUrl ) const; +//UNUSED2009-05 /** Returns the SUPBOOK (external workbook) specified by its URL. */ +//UNUSED2009-05 const XclImpSupbook* GetSupbook( const String& rUrl ) const; void LoadCachedValues(); - /** Finds the largest range of sheet indexes in a SUPBOOK after a start sheet index. - @param rnSBTabFirst (out-param) The first sheet index of the range in SUPBOOK is returned here. - @param rnSBTabLast (out-param) The last sheet index of the range in SUPBOOK is returned here (inclusive). - @param nSupbook The list index of the SUPBOOK. - @param nSBTabStart The first allowed sheet index. Sheet ranges with an earlier start index are ignored. - @return true = the return values are valid; false = nothing found. */ - bool FindNextTabRange( - sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast, - sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const; +//UNUSED2009-05 /** Finds the largest range of sheet indexes in a SUPBOOK after a start sheet index. +//UNUSED2009-05 @param rnSBTabFirst (out-param) The first sheet index of the range in SUPBOOK is returned here. +//UNUSED2009-05 @param rnSBTabLast (out-param) The last sheet index of the range in SUPBOOK is returned here (inclusive). +//UNUSED2009-05 @param nSupbook The list index of the SUPBOOK. +//UNUSED2009-05 @param nSBTabStart The first allowed sheet index. Sheet ranges with an earlier start index are ignored. +//UNUSED2009-05 @return true = the return values are valid; false = nothing found. */ +//UNUSED2009-05 bool FindNextTabRange( +//UNUSED2009-05 sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast, +//UNUSED2009-05 sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const; private: typedef ScfDelList< XclImpXti > XclImpXtiList; @@ -677,13 +677,13 @@ const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( sal_uInt32 nXtiIndex ) c return pXti ? maSupbookList.GetObject( pXti->mnSupbook ) : 0; } -const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( const String& rUrl ) const -{ - for( const XclImpSupbook* pSupbook = maSupbookList.First(); pSupbook; pSupbook = maSupbookList.Next() ) - if( pSupbook->GetXclUrl() == rUrl ) - return pSupbook; - return 0; -} +//UNUSED2009-05 const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( const String& rUrl ) const +//UNUSED2009-05 { +//UNUSED2009-05 for( const XclImpSupbook* pSupbook = maSupbookList.First(); pSupbook; pSupbook = maSupbookList.Next() ) +//UNUSED2009-05 if( pSupbook->GetXclUrl() == rUrl ) +//UNUSED2009-05 return pSupbook; +//UNUSED2009-05 return 0; +//UNUSED2009-05 } void XclImpLinkManagerImpl::LoadCachedValues() { @@ -698,21 +698,21 @@ void XclImpLinkManagerImpl::LoadCachedValues() } } -bool XclImpLinkManagerImpl::FindNextTabRange( - sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast, - sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const -{ - rnSBTabFirst = rnSBTabLast = EXC_NOTAB; - for( const XclImpXti* pXti = maXtiList.First(); pXti; pXti = maXtiList.Next() ) - { - if( (nSupbook == pXti->mnSupbook) && (nSBTabStart <= pXti->mnSBTabLast) && (pXti->mnSBTabFirst < rnSBTabFirst) ) - { - rnSBTabFirst = ::std::max( nSBTabStart, pXti->mnSBTabFirst ); - rnSBTabLast = pXti->mnSBTabLast; - } - } - return rnSBTabFirst != EXC_NOTAB; -} +//UNUSED2009-05 bool XclImpLinkManagerImpl::FindNextTabRange( +//UNUSED2009-05 sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast, +//UNUSED2009-05 sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const +//UNUSED2009-05 { +//UNUSED2009-05 rnSBTabFirst = rnSBTabLast = EXC_NOTAB; +//UNUSED2009-05 for( const XclImpXti* pXti = maXtiList.First(); pXti; pXti = maXtiList.Next() ) +//UNUSED2009-05 { +//UNUSED2009-05 if( (nSupbook == pXti->mnSupbook) && (nSBTabStart <= pXti->mnSBTabLast) && (pXti->mnSBTabFirst < rnSBTabFirst) ) +//UNUSED2009-05 { +//UNUSED2009-05 rnSBTabFirst = ::std::max( nSBTabStart, pXti->mnSBTabFirst ); +//UNUSED2009-05 rnSBTabLast = pXti->mnSBTabLast; +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 return rnSBTabFirst != EXC_NOTAB; +//UNUSED2009-05 } // ============================================================================ diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx index 4e5bf9b7570a..401f135b381a 100644 --- a/sc/source/filter/excel/xlstyle.cxx +++ b/sc/source/filter/excel/xlstyle.cxx @@ -471,11 +471,11 @@ void XclFontData::SetApiFamily( sal_Int16 nApiFamily ) } } -void XclFontData::SetApiFontEncoding( sal_Int16 nApiFontEnc ) -{ - // API constants are equal to rtl_TextEncoding constants - SetFontEncoding( static_cast< rtl_TextEncoding >( nApiFontEnc ) ); -} +//UNUSED2009-05 void XclFontData::SetApiFontEncoding( sal_Int16 nApiFontEnc ) +//UNUSED2009-05 { +//UNUSED2009-05 // API constants are equal to rtl_TextEncoding constants +//UNUSED2009-05 SetFontEncoding( static_cast< rtl_TextEncoding >( nApiFontEnc ) ); +//UNUSED2009-05 } void XclFontData::SetApiPosture( Awt::FontSlant eApiPosture ) { diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx index 1f2eee05fd55..568032aa317f 100644 --- a/sc/source/filter/inc/excrecds.hxx +++ b/sc/source/filter/inc/excrecds.hxx @@ -149,7 +149,6 @@ protected: public: inline ExcBoolRecord( const BOOL bDefault ) : bVal( bDefault ) {} - ExcBoolRecord( SfxItemSet*, USHORT nWhich, BOOL bDefault ); virtual sal_Size GetLen( void ) const; }; diff --git a/sc/source/filter/inc/op.h b/sc/source/filter/inc/op.h index fb79084f48fb..2bfbedde0aed 100644 --- a/sc/source/filter/inc/op.h +++ b/sc/source/filter/inc/op.h @@ -42,7 +42,7 @@ void OP_EOF( SvStream &aStream, USHORT nLaenge ); void OP_Integer( SvStream &aStream, USHORT nLaenge ); void OP_Number( SvStream &aStream, USHORT nLaenge ); void OP_Label( SvStream &aStream, USHORT nLaenge ); -void OP_Text( SvStream &aStream, USHORT nLaenge ); // WK3 +//UNUSED2009-05 void OP_Text( SvStream &aStream, USHORT nLaenge ); // WK3 void OP_Integer3( SvStream &aStream, USHORT nLaenge ); // WK3 void OP_Number3( SvStream &aStream, USHORT nLaenge ); // WK3 void OP_Formula( SvStream &aStream, USHORT nLaenge ); diff --git a/sc/source/filter/inc/qpro.hxx b/sc/source/filter/inc/qpro.hxx index 0db26b9c280c..a9b1c61955c5 100644 --- a/sc/source/filter/inc/qpro.hxx +++ b/sc/source/filter/inc/qpro.hxx @@ -48,7 +48,6 @@ class ScQProReader : public ScBiffReader { public: bool recordsLeft(); - bool IsEndOfFile(); void SetEof( bool bValue ){ mbEndOfFile = bValue; } bool nextRecord(); sal_uInt16 getId() { return mnId; } diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx index 9627f2457a67..3a60b709d5bf 100644 --- a/sc/source/filter/inc/tokstack.hxx +++ b/sc/source/filter/inc/tokstack.hxx @@ -179,7 +179,7 @@ class TokenPool void GrowString( void ); void GrowDouble( void ); - void GrowError( void ); +//UNUSED2009-05 void GrowError( void ); void GrowTripel( void ); void GrowId( void ); void GrowElement( void ); diff --git a/sc/source/filter/inc/xelink.hxx b/sc/source/filter/inc/xelink.hxx index 3a016759275e..1b49bf7bac02 100644 --- a/sc/source/filter/inc/xelink.hxx +++ b/sc/source/filter/inc/xelink.hxx @@ -84,8 +84,8 @@ public: /** Returns the Calc sheet index of the nSortedTab-th entry in the sorted sheet names list. */ SCTAB GetRealScTab( SCTAB nSortedScTab ) const; - /** Returns the index of the passed Calc sheet in the sorted sheet names list. */ - SCTAB GetSortedScTab( SCTAB nScTab ) const; +//UNUSED2009-05 /** Returns the index of the passed Calc sheet in the sorted sheet names list. */ +//UNUSED2009-05 SCTAB GetSortedScTab( SCTAB nScTab ) const; /** Returns the number of Calc sheets. */ inline SCTAB GetScTabCount() const { return mnScCnt; } diff --git a/sc/source/filter/inc/xename.hxx b/sc/source/filter/inc/xename.hxx index affe57264331..32c48e779cad 100644 --- a/sc/source/filter/inc/xename.hxx +++ b/sc/source/filter/inc/xename.hxx @@ -56,8 +56,8 @@ public: /** Inserts the Calc database range with the passed index and returns the Excel NAME index. */ sal_uInt16 InsertDBRange( USHORT nScDBRangeIdx ); - /** Inserts a new built-in defined name. */ - sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab ); +//UNUSED2009-05 /** Inserts a new built-in defined name. */ +//UNUSED2009-05 sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab ); /** Inserts a new built-in defined name, referring to the passed sheet range. */ sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, const ScRange& rRange ); /** Inserts a new built-in defined name, referring to the passed sheet range list. */ diff --git a/sc/source/filter/inc/xepivot.hxx b/sc/source/filter/inc/xepivot.hxx index 80356d41f4a8..28df1586cdcb 100644 --- a/sc/source/filter/inc/xepivot.hxx +++ b/sc/source/filter/inc/xepivot.hxx @@ -198,8 +198,8 @@ public: sal_uInt16 GetFieldCount() const; /** Returns the specified pivot cache field. */ const XclExpPCField* GetField( sal_uInt16 nFieldIdx ) const; - /** Returns a pivot cache field by its name. */ - const XclExpPCField* GetField( const String& rFieldName ) const; +//UNUSED2009-05 /** Returns a pivot cache field by its name. */ +//UNUSED2009-05 const XclExpPCField* GetField( const String& rFieldName ) const; /** Returns true, if this pivot cache contains non-standard fields (e.g. grouping fields). */ bool HasAddFields() const; @@ -301,8 +301,8 @@ public: /** Returns the index of the last inserted data info struct. */ sal_uInt16 GetLastDataInfoIndex() const; - /** Returns an item by its name. */ - const XclExpPTItem* GetItem( const String& rName ) const; +//UNUSED2009-05 /** Returns an item by its name. */ +//UNUSED2009-05 const XclExpPTItem* GetItem( const String& rName ) const; /** Returns the list index of an item by its name. @param nDefaultIdx This value will be returned, if the item could not be found. */ sal_uInt16 GetItemIndex( const String& rName, sal_uInt16 nDefaultIdx ) const; diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx index 5322b0c47f01..6680aa1719ca 100644 --- a/sc/source/filter/inc/xetable.hxx +++ b/sc/source/filter/inc/xetable.hxx @@ -409,23 +409,23 @@ private: // ---------------------------------------------------------------------------- -/** Represents a BOOLERR record that describes a cell with an error code. */ -class XclExpErrorCell : public XclExpSingleCellBase -{ - DECL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell ) - -public: - explicit XclExpErrorCell( const XclExpRoot rRoot, const XclAddress& rXclPos, - const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId, - sal_uInt8 nErrCode ); - - virtual void SaveXml( XclExpXmlStream& rStrm ); -private: - virtual void WriteContents( XclExpStream& rStrm ); - -private: - sal_uInt8 mnErrCode; /// The error code. -}; +//UNUSED2009-05 /** Represents a BOOLERR record that describes a cell with an error code. */ +//UNUSED2009-05 class XclExpErrorCell : public XclExpSingleCellBase +//UNUSED2009-05 { +//UNUSED2009-05 DECL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell ) +//UNUSED2009-05 +//UNUSED2009-05 public: +//UNUSED2009-05 explicit XclExpErrorCell( const XclExpRoot rRoot, const XclAddress& rXclPos, +//UNUSED2009-05 const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId, +//UNUSED2009-05 sal_uInt8 nErrCode ); +//UNUSED2009-05 +//UNUSED2009-05 virtual void SaveXml( XclExpXmlStream& rStrm ); +//UNUSED2009-05 private: +//UNUSED2009-05 virtual void WriteContents( XclExpStream& rStrm ); +//UNUSED2009-05 +//UNUSED2009-05 private: +//UNUSED2009-05 sal_uInt8 mnErrCode; /// The error code. +//UNUSED2009-05 }; // ---------------------------------------------------------------------------- diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx index 5fd785992ae4..c9d2daa6bb2f 100644 --- a/sc/source/filter/inc/xiescher.hxx +++ b/sc/source/filter/inc/xiescher.hxx @@ -917,8 +917,8 @@ private: class XclImpSolverContainer : public SvxMSDffSolverContainer { public: - /** Reads the entire solver container. Stream must point to begin of container header. */ - void ReadSolverContainer( SvStream& rDffStrm ); +//UNUSED2009-05 /** Reads the entire solver container. Stream must point to begin of container header. */ +//UNUSED2009-05 void ReadSolverContainer( SvStream& rDffStrm ); /** Inserts information about a new SdrObject. */ void InsertSdrObjectInfo( SdrObject& rSdrObj, sal_uInt32 nDffShapeId, sal_uInt32 nDffFlags ); diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx index 5e60feeb49bb..a46d473f02a9 100644 --- a/sc/source/filter/inc/xihelper.hxx +++ b/sc/source/filter/inc/xihelper.hxx @@ -89,24 +89,24 @@ public: bool ConvertRange( ScRange& rScRange, const XclRange& rXclRange, SCTAB nScTab1, SCTAB nScTab2, bool bWarn ); - /** Returns a valid cell range by moving it into allowed dimensions. - @descr The start and/or end position of the range may be modified. - @param rXclRange The Excel cell range to convert. - @param bWarn true = Sets the internal flag that produces a warning box - after loading/saving the file, if the cell range contains invalid cells. - @return The converted Calc cell range. */ - ScRange CreateValidRange( const XclRange& rXclRange, - SCTAB nScTab1, SCTAB nScTab2, bool bWarn ); +//UNUSED2009-05 /** Returns a valid cell range by moving it into allowed dimensions. +//UNUSED2009-05 @descr The start and/or end position of the range may be modified. +//UNUSED2009-05 @param rXclRange The Excel cell range to convert. +//UNUSED2009-05 @param bWarn true = Sets the internal flag that produces a warning box +//UNUSED2009-05 after loading/saving the file, if the cell range contains invalid cells. +//UNUSED2009-05 @return The converted Calc cell range. */ +//UNUSED2009-05 ScRange CreateValidRange( const XclRange& rXclRange, +//UNUSED2009-05 SCTAB nScTab1, SCTAB nScTab2, bool bWarn ); // cell range list -------------------------------------------------------- - /** Checks if the passed cell range list is valid. - @param rXclRanges The Excel cell range list to check. - @param bWarn true = Sets the internal flag that produces a warning box - after loading/saving the file, if the cell range list contains at - least one invalid range. - @return true = Cell range list in rScRanges is completly valid. */ - bool CheckRangeList( const XclRangeList& rXclRanges, bool bWarn ); +//UNUSED2009-05 /** Checks if the passed cell range list is valid. +//UNUSED2009-05 @param rXclRanges The Excel cell range list to check. +//UNUSED2009-05 @param bWarn true = Sets the internal flag that produces a warning box +//UNUSED2009-05 after loading/saving the file, if the cell range list contains at +//UNUSED2009-05 least one invalid range. +//UNUSED2009-05 @return true = Cell range list in rScRanges is completly valid. */ +//UNUSED2009-05 bool CheckRangeList( const XclRangeList& rXclRanges, bool bWarn ); /** Converts the passed Excel cell range list to a Calc cell range list. @descr The start position of the ranges will not be modified. Cell @@ -139,11 +139,11 @@ public: const XclImpRoot& rRoot, const XclImpString& rString ); - /** Returns a new edit engine text object for a cell note. - @param nXFIndex Index to XF for first text portion (for escapement). */ - static EditTextObject* CreateNoteObject( - const XclImpRoot& rRoot, - const XclImpString& rString ); +//UNUSED2009-05 /** Returns a new edit engine text object for a cell note. +//UNUSED2009-05 @param nXFIndex Index to XF for first text portion (for escapement). */ +//UNUSED2009-05 static EditTextObject* CreateNoteObject( +//UNUSED2009-05 const XclImpRoot& rRoot, +//UNUSED2009-05 const XclImpString& rString ); /** Creates a new text cell or edit cell for a Calc document. @param nXFIndex Index to XF for first text portion (for escapement). */ diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx index 303da212d262..9d02f0720efc 100644 --- a/sc/source/filter/inc/xlstyle.hxx +++ b/sc/source/filter/inc/xlstyle.hxx @@ -372,8 +372,8 @@ struct XclFontData void SetApiHeight( float fPoint ); /** Sets the API font family. */ void SetApiFamily( sal_Int16 nApiFamily ); - /** Sets the API font text encoding. */ - void SetApiFontEncoding( sal_Int16 nApiFontEnc ); +//UNUSED2009-05 /** Sets the API font text encoding. */ +//UNUSED2009-05 void SetApiFontEncoding( sal_Int16 nApiFontEnc ); /** Sets the API font posture. */ void SetApiPosture( ::com::sun::star::awt::FontSlant eApiPosture ); /** Sets the API font weight. */ diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx index 92cb49e786eb..8759d21297f3 100644 --- a/sc/source/filter/lotus/op.cxx +++ b/sc/source/filter/lotus/op.cxx @@ -171,20 +171,20 @@ void OP_Label( SvStream& r, UINT16 n ) } -void OP_Text( SvStream& r, UINT16 n ) // WK3 -{ - UINT16 nRow; - BYTE nCol, nTab; - sal_Char pText[ 256 ]; - - r >> nRow >> nTab >> nCol; - n -= 4; - - r.Read( pText, n ); - pText[ n ] = 0; // zur Sicherheit Nullterminator anhaengen - - PutFormString( static_cast (nCol), static_cast (nRow), static_cast (nTab), pText ); -} +//UNUSED2009-05 void OP_Text( SvStream& r, UINT16 n ) // WK3 +//UNUSED2009-05 { +//UNUSED2009-05 UINT16 nRow; +//UNUSED2009-05 BYTE nCol, nTab; +//UNUSED2009-05 sal_Char pText[ 256 ]; +//UNUSED2009-05 +//UNUSED2009-05 r >> nRow >> nTab >> nCol; +//UNUSED2009-05 n -= 4; +//UNUSED2009-05 +//UNUSED2009-05 r.Read( pText, n ); +//UNUSED2009-05 pText[ n ] = 0; // zur Sicherheit Nullterminator anhaengen +//UNUSED2009-05 +//UNUSED2009-05 PutFormString( static_cast (nCol), static_cast (nRow), static_cast (nTab), pText ); +//UNUSED2009-05 } void OP_Formula( SvStream& r, UINT16 /*n*/ ) diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx index 52627c7848e4..5ea9efae2b3e 100644 --- a/sc/source/filter/qpro/qpro.cxx +++ b/sc/source/filter/qpro/qpro.cxx @@ -217,12 +217,6 @@ bool ScQProReader::recordsLeft() return bValue; } -bool ScQProReader::IsEndOfFile() -{ - bool bValue = ScBiffReader::mbEndOfFile; - return bValue; -} - bool ScQProReader::nextRecord() { bool bValue = ScBiffReader::nextRecord(); diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index 7d66c19cfb79..a81f359f04c7 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -1906,40 +1906,40 @@ ScShapeChilds* ScAccessibleDocumentPagePreview::GetShapeChilds() return mpShapeChilds; } -uno::Reference < XAccessible > ScAccessibleDocumentPagePreview::GetCurrentAccessibleTable() -{ - if (!mpTable) - { - if ( mpViewShell ) - { - const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); - ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() ); - //! order is background shapes, header, table or notes, footer, foreground shapes, controls - sal_Int32 nIndex (aCount.nBackShapes + aCount.nHeaders); - - mpTable = new ScAccessiblePreviewTable( this, mpViewShell, nIndex ); - mpTable->acquire(); - mpTable->Init(); - } - } - return mpTable; -} - -void ScAccessibleDocumentPagePreview::ChildCountChanged() -{ - if (mpViewShell) - { - const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); - ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() ); - //! order is background shapes, header, table or notes, footer, foreground shapes, controls - if(mpHeader) - mpHeader->SetCurrentIndexInParent(aCount.nBackShapes); - if (mpTable) - mpTable->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders); - if (mpFooter) - mpFooter->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders + aCount.nTables + aCount.nNoteParagraphs); - - if (mpNotesChilds) - mpNotesChilds->SetOffset(aCount.nBackShapes + aCount.nHeaders); - } -} +//UNUSED2009-05 uno::Reference < XAccessible > ScAccessibleDocumentPagePreview::GetCurrentAccessibleTable() +//UNUSED2009-05 { +//UNUSED2009-05 if (!mpTable) +//UNUSED2009-05 { +//UNUSED2009-05 if ( mpViewShell ) +//UNUSED2009-05 { +//UNUSED2009-05 const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); +//UNUSED2009-05 ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() ); +//UNUSED2009-05 //! order is background shapes, header, table or notes, footer, foreground shapes, controls +//UNUSED2009-05 sal_Int32 nIndex (aCount.nBackShapes + aCount.nHeaders); +//UNUSED2009-05 +//UNUSED2009-05 mpTable = new ScAccessiblePreviewTable( this, mpViewShell, nIndex ); +//UNUSED2009-05 mpTable->acquire(); +//UNUSED2009-05 mpTable->Init(); +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 return mpTable; +//UNUSED2009-05 } + +//UNUSED2009-05 void ScAccessibleDocumentPagePreview::ChildCountChanged() +//UNUSED2009-05 { +//UNUSED2009-05 if (mpViewShell) +//UNUSED2009-05 { +//UNUSED2009-05 const ScPreviewLocationData& rData = mpViewShell->GetLocationData(); +//UNUSED2009-05 ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() ); +//UNUSED2009-05 //! order is background shapes, header, table or notes, footer, foreground shapes, controls +//UNUSED2009-05 if(mpHeader) +//UNUSED2009-05 mpHeader->SetCurrentIndexInParent(aCount.nBackShapes); +//UNUSED2009-05 if (mpTable) +//UNUSED2009-05 mpTable->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders); +//UNUSED2009-05 if (mpFooter) +//UNUSED2009-05 mpFooter->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders + aCount.nTables + aCount.nNoteParagraphs); +//UNUSED2009-05 +//UNUSED2009-05 if (mpNotesChilds) +//UNUSED2009-05 mpNotesChilds->SetOffset(aCount.nBackShapes + aCount.nHeaders); +//UNUSED2009-05 } +//UNUSED2009-05 } diff --git a/sc/source/ui/dbgui/csvtablebox.cxx b/sc/source/ui/dbgui/csvtablebox.cxx index 2c7691bd7188..c3cfb97cd52c 100644 --- a/sc/source/ui/dbgui/csvtablebox.cxx +++ b/sc/source/ui/dbgui/csvtablebox.cxx @@ -42,16 +42,16 @@ // ============================================================================ -ScCsvTableBox::ScCsvTableBox( Window* pParent ) : - ScCsvControl( pParent, maData, WB_BORDER | WB_TABSTOP | WB_DIALOGCONTROL ), - maRuler( *this ), - maGrid( *this ), - maHScroll( this, WB_HORZ | WB_DRAG ), - maVScroll( this, WB_VERT | WB_DRAG ), - maScrollBox( this ) -{ - Init(); -} +//UNUSED2009-05 ScCsvTableBox::ScCsvTableBox( Window* pParent ) : +//UNUSED2009-05 ScCsvControl( pParent, maData, WB_BORDER | WB_TABSTOP | WB_DIALOGCONTROL ), +//UNUSED2009-05 maRuler( *this ), +//UNUSED2009-05 maGrid( *this ), +//UNUSED2009-05 maHScroll( this, WB_HORZ | WB_DRAG ), +//UNUSED2009-05 maVScroll( this, WB_VERT | WB_DRAG ), +//UNUSED2009-05 maScrollBox( this ) +//UNUSED2009-05 { +//UNUSED2009-05 Init(); +//UNUSED2009-05 } ScCsvTableBox::ScCsvTableBox( Window* pParent, const ResId& rResId ) : ScCsvControl( pParent, maData, rResId ), @@ -225,24 +225,24 @@ void ScCsvTableBox::SetUniStrings( EnableRepaint(); } -void ScCsvTableBox::SetByteStrings( - const ByteString* pTextLines, CharSet eCharSet, - const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep ) -{ - // assuming that pTextLines is a string array with size CSV_PREVIEW_LINES - // -> will be dynamic sometime - DisableRepaint(); - sal_Int32 nEndLine = GetFirstVisLine() + CSV_PREVIEW_LINES; - const ByteString* pString = pTextLines; - for( sal_Int32 nLine = GetFirstVisLine(); nLine < nEndLine; ++nLine, ++pString ) - { - if( mbFixedMode ) - maGrid.ImplSetTextLineFix( nLine, String( *pString, eCharSet ) ); - else - maGrid.ImplSetTextLineSep( nLine, String( *pString, eCharSet ), rSepChars, cTextSep, bMergeSep ); - } - EnableRepaint(); -} +//UNUSED2009-05 void ScCsvTableBox::SetByteStrings( +//UNUSED2009-05 const ByteString* pTextLines, CharSet eCharSet, +//UNUSED2009-05 const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep ) +//UNUSED2009-05 { +//UNUSED2009-05 // assuming that pTextLines is a string array with size CSV_PREVIEW_LINES +//UNUSED2009-05 // -> will be dynamic sometime +//UNUSED2009-05 DisableRepaint(); +//UNUSED2009-05 sal_Int32 nEndLine = GetFirstVisLine() + CSV_PREVIEW_LINES; +//UNUSED2009-05 const ByteString* pString = pTextLines; +//UNUSED2009-05 for( sal_Int32 nLine = GetFirstVisLine(); nLine < nEndLine; ++nLine, ++pString ) +//UNUSED2009-05 { +//UNUSED2009-05 if( mbFixedMode ) +//UNUSED2009-05 maGrid.ImplSetTextLineFix( nLine, String( *pString, eCharSet ) ); +//UNUSED2009-05 else +//UNUSED2009-05 maGrid.ImplSetTextLineSep( nLine, String( *pString, eCharSet ), rSepChars, cTextSep, bMergeSep ); +//UNUSED2009-05 } +//UNUSED2009-05 EnableRepaint(); +//UNUSED2009-05 } // column settings ------------------------------------------------------------ diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index ebb080a89cfa..61bd4f7bf0e9 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2766,42 +2766,42 @@ BOOL ScDocFunc::SetLayoutRTL( SCTAB nTab, BOOL bRTL, BOOL /* bApi */ ) return TRUE; } -BOOL ScDocFunc::SetGrammar( formula::FormulaGrammar::Grammar eGrammar ) -{ - ScDocument* pDoc = rDocShell.GetDocument(); - - if ( pDoc->GetGrammar() == eGrammar ) - return TRUE; - - BOOL bUndo(pDoc->IsUndoEnabled()); - ScDocShellModificator aModificator( rDocShell ); - - pDoc->SetGrammar( eGrammar ); - - if (bUndo) - { - rDocShell.GetUndoManager()->AddUndoAction( new ScUndoSetGrammar( &rDocShell, eGrammar ) ); - } - - rDocShell.PostPaint( 0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_ALL ); - - ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); - if (NULL != pViewSh) - { - pViewSh->UpdateInputHandler( FALSE, FALSE ); - } - - aModificator.SetDocumentModified(); - - SfxBindings* pBindings = rDocShell.GetViewBindings(); - if (pBindings) - { - // erAck: 2006-09-07T22:19+0200 commented out in CWS scr1c1 - //pBindings->Invalidate( FID_TAB_USE_R1C1 ); - } - - return TRUE; -} +//UNUSED2009-05 BOOL ScDocFunc::SetGrammar( formula::FormulaGrammar::Grammar eGrammar ) +//UNUSED2009-05 { +//UNUSED2009-05 ScDocument* pDoc = rDocShell.GetDocument(); +//UNUSED2009-05 +//UNUSED2009-05 if ( pDoc->GetGrammar() == eGrammar ) +//UNUSED2009-05 return TRUE; +//UNUSED2009-05 +//UNUSED2009-05 BOOL bUndo(pDoc->IsUndoEnabled()); +//UNUSED2009-05 ScDocShellModificator aModificator( rDocShell ); +//UNUSED2009-05 +//UNUSED2009-05 pDoc->SetGrammar( eGrammar ); +//UNUSED2009-05 +//UNUSED2009-05 if (bUndo) +//UNUSED2009-05 { +//UNUSED2009-05 rDocShell.GetUndoManager()->AddUndoAction( new ScUndoSetGrammar( &rDocShell, eGrammar ) ); +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 rDocShell.PostPaint( 0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_ALL ); +//UNUSED2009-05 +//UNUSED2009-05 ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); +//UNUSED2009-05 if (NULL != pViewSh) +//UNUSED2009-05 { +//UNUSED2009-05 pViewSh->UpdateInputHandler( FALSE, FALSE ); +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 aModificator.SetDocumentModified(); +//UNUSED2009-05 +//UNUSED2009-05 SfxBindings* pBindings = rDocShell.GetViewBindings(); +//UNUSED2009-05 if (pBindings) +//UNUSED2009-05 { +//UNUSED2009-05 // erAck: 2006-09-07T22:19+0200 commented out in CWS scr1c1 +//UNUSED2009-05 //pBindings->Invalidate( FID_TAB_USE_R1C1 ); +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 return TRUE; +//UNUSED2009-05 } BOOL ScDocFunc::RenameTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL bApi ) { diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 281f03ff3622..b8d89a644fb4 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -440,13 +440,6 @@ void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore ) aDocument.EnableUndo( bIsUndoEnabled ); } -#if OLD_PIVOT_IMPLEMENTATION -void ScDocShell::PivotUpdate( ScPivot*, ScPivot*, BOOL, BOOL ) -{ - DBG_ERRORFILE("PivotUpdate is obsolete!"); -} -#endif - void ScDocShell::RefreshPivotTables( const ScRange& rSource ) { //! rename to RefreshDataPilotTables? diff --git a/sc/source/ui/formdlg/privsplt.cxx b/sc/source/ui/formdlg/privsplt.cxx index 2ea9636691d7..c6eedbc5f06e 100644 --- a/sc/source/ui/formdlg/privsplt.cxx +++ b/sc/source/ui/formdlg/privsplt.cxx @@ -231,24 +231,6 @@ void ScPrivatSplit::MouseMove( const MouseEvent& rMEvt ) } } -/************************************************************************* -#* Member: SetXRange Datum:14.10.97 -#*------------------------------------------------------------------------ -#* -#* Klasse: ScPrivatSplit -#* -#* Funktion: Setzt den Range fuer die X- Verschiebung -#* -#* Input: neuer Bereich -#* -#* Output: --- -#* -#************************************************************************/ -void ScPrivatSplit::SetXRange(Range cRgeX) -{ - aXMovingRange=cRgeX; -} - /************************************************************************* #* Member: SetYRange Datum:14.10.97 #*------------------------------------------------------------------------ diff --git a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx index ba1b10dc4ccd..af871def7b65 100644 --- a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx +++ b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx @@ -116,10 +116,10 @@ public: ///===== internal ======================================================== - com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > - GetCurrentAccessibleTable(); +//UNUSED2009-05 com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > +//UNUSED2009-05 GetCurrentAccessibleTable(); - void ChildCountChanged(); +//UNUSED2009-05 void ChildCountChanged(); protected: /// Return this object's description. diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index 74621d3ced41..9e2d833b27d0 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -128,7 +128,6 @@ private: protected: virtual BOOL DoClose( USHORT nId ); - void EnableSpreadsheets( BOOL bFlag = TRUE, BOOL bChilds = TRUE ); void SetDispatcherLock( BOOL bLock ); virtual long PreNotify( NotifyEvent& rNEvt ); diff --git a/sc/source/ui/inc/csvtablebox.hxx b/sc/source/ui/inc/csvtablebox.hxx index 544ec0aaecee..6e9c6b379ca9 100644 --- a/sc/source/ui/inc/csvtablebox.hxx +++ b/sc/source/ui/inc/csvtablebox.hxx @@ -77,7 +77,7 @@ private: // ------------------------------------------------------------------------ public: - explicit ScCsvTableBox( Window* pParent ); +//UNUSED2009-05 explicit ScCsvTableBox( Window* pParent ); explicit ScCsvTableBox( Window* pParent, const ResId& rResId ); // common table box handling ---------------------------------------------- @@ -112,10 +112,10 @@ public: void SetUniStrings( const String* pTextLines, const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep ); - /** Fills all cells of all lines with the passed texts (ByteStrings). */ - void SetByteStrings( - const ByteString* pLineTexts, CharSet eCharSet, - const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep ); +//UNUSED2009-05 /** Fills all cells of all lines with the passed texts (ByteStrings). */ +//UNUSED2009-05 void SetByteStrings( +//UNUSED2009-05 const ByteString* pLineTexts, CharSet eCharSet, +//UNUSED2009-05 const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep ); // column settings -------------------------------------------------------- public: diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx index 21e295a58fa4..3e9ff5258682 100644 --- a/sc/source/ui/inc/docfunc.hxx +++ b/sc/source/ui/inc/docfunc.hxx @@ -124,7 +124,7 @@ public: BOOL SetLayoutRTL( SCTAB nTab, BOOL bRTL, BOOL bApi ); - BOOL SetGrammar( formula::FormulaGrammar::Grammar eGrammar ); +//UNUSED2009-05 BOOL SetGrammar( formula::FormulaGrammar::Grammar eGrammar ); SC_DLLPUBLIC BOOL SetWidthOrHeight( BOOL bWidth, SCCOLROW nRangeCnt, SCCOLROW* pRanges, SCTAB nTab, ScSizeMode eMode, USHORT nSizeTwips, diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index b8b8d10f0c6e..4e6cf05ddd0d 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -59,9 +59,6 @@ class INetURLObject; class ScPaintItem; class ScViewData; class ScDocFunc; -#if OLD_PIVOT_IMPLEMENTATION -class ScPivot; -#endif class ScDrawLayer; class ScTabViewShell; class ScSbxDocHelper; @@ -293,10 +290,6 @@ public: void UpdateAllRowHeights( const ScMarkData* pTabMark = NULL ); void UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore = false ); -#if OLD_PIVOT_IMPLEMENTATION - void PivotUpdate( ScPivot* pOldPivot, ScPivot* pNewPivot, - BOOL bRecord = TRUE, BOOL bApi = FALSE ); -#endif void RefreshPivotTables( const ScRange& rSource ); void DoConsolidate( const ScConsolidateParam& rParam, BOOL bRecord = TRUE ); void UseScenario( SCTAB nTab, const String& rName, BOOL bRecord = TRUE ); diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx index 33d0f4adf95d..1890bb1247c4 100644 --- a/sc/source/ui/inc/drawview.hxx +++ b/sc/source/ui/inc/drawview.hxx @@ -143,7 +143,7 @@ public: inline void UnlockInternalLayer() { LockInternalLayer( false ); } SdrEndTextEditKind ScEndTextEdit(); // ruft SetDrawTextUndo(0) - void CaptionTextDirection(USHORT nSlot); +//UNUSED2009-05 void CaptionTextDirection(USHORT nSlot); ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable(); }; diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 844d88055578..0f51f985cd72 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -44,9 +44,6 @@ struct ScTableInfo; class ScViewSelectionEngine; -#if OLD_PIVOT_IMPLEMENTATION -class ScPivot; -#endif class ScDPObject; class ScOutputData; class ScFilterListBox; @@ -170,14 +167,6 @@ private: BYTE nMouseStatus; BYTE nNestedButtonState; // track nested button up/down calls -#if OLD_PIVOT_IMPLEMENTATION - BOOL bPivotMouse; // Pivot-D&D (alte Pivottabellen) - ScPivot* pDragPivot; - BOOL bPivotColField; - SCCOL nPivotCol; - SCCOL nPivotField; -#endif - BOOL bDPMouse; // DataPilot-D&D (neue Pivottabellen) long nDPField; ScDPObject* pDragDPObj; //! name? @@ -235,12 +224,6 @@ private: BOOL DoPageFieldSelection( SCCOL nCol, SCROW nRow ); void DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt ); -#if OLD_PIVOT_IMPLEMENTATION - void PivotMouseMove( const MouseEvent& rMEvt ); - void PivotMouseButtonUp( const MouseEvent& rMEvt ); - BOOL PivotTestMouse( const MouseEvent& rMEvt, BOOL bMove ); - void DoPivotDrop( BOOL bDelete, BOOL bToCols, SCSIZE nDestPos ); -#endif void DPMouseMove( const MouseEvent& rMEvt ); void DPMouseButtonUp( const MouseEvent& rMEvt ); diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index da70a3465dc6..80da3d20982e 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -244,7 +244,9 @@ public: void FindChanged(); void SetPagebreakMode( ScPageBreakData* pPageData ); +#ifdef OLD_SELECTION_PAINT void DrawMark( Window* pWin ); +#endif void DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY, SCCOL nRefEndX, SCROW nRefEndY, const Color& rColor, BOOL bHandle ); diff --git a/sc/source/ui/inc/privsplt.hxx b/sc/source/ui/inc/privsplt.hxx index b8277a46c4f7..d3b7c9ad96b8 100644 --- a/sc/source/ui/inc/privsplt.hxx +++ b/sc/source/ui/inc/privsplt.hxx @@ -73,7 +73,6 @@ class ScPrivatSplit : public Control virtual void CtrModified(); - void SetXRange(Range cRgeX); void SetYRange(Range cRgeY); void MoveSplitTo(Point aPos); diff --git a/sc/source/ui/inc/refundo.hxx b/sc/source/ui/inc/refundo.hxx index a796fcd611de..f3250e708b4c 100644 --- a/sc/source/ui/inc/refundo.hxx +++ b/sc/source/ui/inc/refundo.hxx @@ -37,9 +37,6 @@ class ScDocument; class ScDBCollection; class ScRangeName; class ScPrintRangeSaver; -#if OLD_PIVOT_IMPLEMENTATION -class ScPivotCollection; -#endif class ScDPCollection; class ScChartCollection; class ScConditionalFormatList; @@ -54,9 +51,6 @@ private: ScDBCollection* pDBCollection; ScRangeName* pRangeName; ScPrintRangeSaver* pPrintRanges; -#if OLD_PIVOT_IMPLEMENTATION - ScPivotCollection* pPivotCollection; -#endif ScDPCollection* pDPCollection; ScConditionalFormatList* pCondFormList; ScDetOpList* pDetOpList; diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index d7b5e2a8260b..dcc4651d6290 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -227,7 +227,7 @@ protected: public: ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ); - ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell ); +//UNUSED2009-05 ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell ); ~ScTabView(); void MakeDrawLayer(); diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx index 1eadf24041db..a7cf0d094d6b 100644 --- a/sc/source/ui/inc/undotab.hxx +++ b/sc/source/ui/inc/undotab.hxx @@ -493,26 +493,26 @@ private: }; -class ScUndoSetGrammar : public ScSimpleUndo -{ -public: - TYPEINFO(); - ScUndoSetGrammar( ScDocShell* pShell, - formula::FormulaGrammar::Grammar eGrammar ); - virtual ~ScUndoSetGrammar(); - - virtual void Undo(); - virtual void Redo(); - virtual void Repeat(SfxRepeatTarget& rTarget); - virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const; - - virtual String GetComment() const; - -private: - formula::FormulaGrammar::Grammar meNewGrammar, meOldGrammar; - - void DoChange( formula::FormulaGrammar::Grammar eGrammar ); -}; +//UNUSED2009-05 class ScUndoSetGrammar : public ScSimpleUndo +//UNUSED2009-05 { +//UNUSED2009-05 public: +//UNUSED2009-05 TYPEINFO(); +//UNUSED2009-05 ScUndoSetGrammar( ScDocShell* pShell, +//UNUSED2009-05 formula::FormulaGrammar::Grammar eGrammar ); +//UNUSED2009-05 virtual ~ScUndoSetGrammar(); +//UNUSED2009-05 +//UNUSED2009-05 virtual void Undo(); +//UNUSED2009-05 virtual void Redo(); +//UNUSED2009-05 virtual void Repeat(SfxRepeatTarget& rTarget); +//UNUSED2009-05 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const; +//UNUSED2009-05 +//UNUSED2009-05 virtual String GetComment() const; +//UNUSED2009-05 +//UNUSED2009-05 private: +//UNUSED2009-05 formula::FormulaGrammar::Grammar meNewGrammar, meOldGrammar; +//UNUSED2009-05 +//UNUSED2009-05 void DoChange( formula::FormulaGrammar::Grammar eGrammar ); +//UNUSED2009-05 }; #endif diff --git a/sc/source/ui/inc/viewutil.hxx b/sc/source/ui/inc/viewutil.hxx index bfc24e36b464..e7e4e27f233c 100644 --- a/sc/source/ui/inc/viewutil.hxx +++ b/sc/source/ui/inc/viewutil.hxx @@ -106,8 +106,10 @@ public: ScUpdateRect( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 ); void SetNew( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 ); BOOL GetDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ); +#ifdef OLD_SELECTION_PAINT BOOL GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, BOOL& rCont ); void GetContDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ); +#endif }; diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 874236075d9f..befabb51a17c 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -826,11 +826,6 @@ BOOL __EXPORT ScAnyRefDlg::DoClose( USHORT nId ) return TRUE; } -void ScAnyRefDlg::EnableSpreadsheets(BOOL bFlag, BOOL bChilds) -{ - m_aHelper.EnableSpreadsheets(bFlag, bChilds); -} - void ScAnyRefDlg::SetDispatcherLock( BOOL bLock ) { m_aHelper.SetDispatcherLock( bLock ); diff --git a/sc/source/ui/undo/refundo.cxx b/sc/source/ui/undo/refundo.cxx index 85bf65179bd8..8c72da7e7e25 100644 --- a/sc/source/ui/undo/refundo.cxx +++ b/sc/source/ui/undo/refundo.cxx @@ -66,10 +66,6 @@ ScRefUndoData::ScRefUndoData( const ScDocument* pDoc ) : pPrintRanges = pDoc->CreatePrintRangeSaver(); // neu erzeugt -#if OLD_PIVOT_IMPLEMENTATION - ScPivotCollection* pOldPivot = pDoc->GetPivotCollection(); - pPivotCollection = pOldPivot ? new ScPivotCollection(*pOldPivot) : NULL; -#endif //! bei Pivot nur Bereiche merken ??? ScDPCollection* pOldDP = ((ScDocument*)pDoc)->GetDPCollection(); //! const @@ -96,9 +92,6 @@ ScRefUndoData::~ScRefUndoData() delete pDBCollection; delete pRangeName; delete pPrintRanges; -#if OLD_PIVOT_IMPLEMENTATION - delete pPivotCollection; -#endif delete pDPCollection; delete pCondFormList; delete pDetOpList; @@ -130,15 +123,6 @@ void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc ) delete pNewRanges; } -#if OLD_PIVOT_IMPLEMENTATION - if (pPivotCollection) - { - ScPivotCollection* pNewPivot = pDoc->GetPivotCollection(); - if ( pNewPivot && *pPivotCollection == *pNewPivot ) - DELETEZ(pPivotCollection); - } -#endif - if (pDPCollection) { ScDPCollection* pNewDP = ((ScDocument*)pDoc)->GetDPCollection(); //! const @@ -195,11 +179,6 @@ void ScRefUndoData::DoUndo( ScDocument* pDoc, BOOL bUndoRefFirst ) if (pPrintRanges) pDoc->RestorePrintRanges(*pPrintRanges); -#if OLD_PIVOT_IMPLEMENTATION - if (pPivotCollection) - pDoc->SetPivotCollection( new ScPivotCollection(*pPivotCollection) ); -#endif - if (pDPCollection) { ScDPCollection* pDocDP = pDoc->GetDPCollection(); diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index abd6f815abf9..ce428311d3f8 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -92,7 +92,7 @@ TYPEINIT1(ScUndoPrintRange, SfxUndoAction); TYPEINIT1(ScUndoScenarioFlags, SfxUndoAction); TYPEINIT1(ScUndoRenameObject, SfxUndoAction); TYPEINIT1(ScUndoLayoutRTL, SfxUndoAction); -TYPEINIT1(ScUndoSetGrammar, SfxUndoAction); +//UNUSED2009-05 TYPEINIT1(ScUndoSetGrammar, SfxUndoAction); // ----------------------------------------------------------------------- @@ -1611,59 +1611,54 @@ String ScUndoLayoutRTL::GetComment() const // Set the grammar used for the sheet // -ScUndoSetGrammar::ScUndoSetGrammar( ScDocShell* pShell, - formula::FormulaGrammar::Grammar eGrammar ) : - ScSimpleUndo( pShell ), - meNewGrammar( eGrammar ) -{ - meOldGrammar = pDocShell->GetDocument()->GetGrammar(); -} - -ScUndoSetGrammar::~ScUndoSetGrammar() -{ -} - -void ScUndoSetGrammar::DoChange( formula::FormulaGrammar::Grammar eGrammar ) -{ - pDocShell->SetInUndo( TRUE ); - ScDocument* pDoc = pDocShell->GetDocument(); - pDoc->SetGrammar( eGrammar ); - pDocShell->SetDocumentModified(); - pDocShell->SetInUndo( FALSE ); -} - -void ScUndoSetGrammar::Undo() -{ - DoChange( meOldGrammar ); -} - -void ScUndoSetGrammar::Redo() -{ - DoChange( meNewGrammar ); -} - -void ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */) -{ -#if 0 -// erAck: 2006-09-07T23:00+0200 commented out in CWS scr1c1 - if (rTarget.ISA(ScTabViewTarget)) - ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher(). - Execute( FID_TAB_USE_R1C1, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); -#endif -} - -BOOL ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const -{ - return (rTarget.ISA(ScTabViewTarget)); -} - -String ScUndoSetGrammar::GetComment() const -{ - return ScGlobal::GetRscString( STR_UNDO_TAB_R1C1 ); -} - - - - - +//UNUSED2009-05 ScUndoSetGrammar::ScUndoSetGrammar( ScDocShell* pShell, +//UNUSED2009-05 formula::FormulaGrammar::Grammar eGrammar ) : +//UNUSED2009-05 ScSimpleUndo( pShell ), +//UNUSED2009-05 meNewGrammar( eGrammar ) +//UNUSED2009-05 { +//UNUSED2009-05 meOldGrammar = pDocShell->GetDocument()->GetGrammar(); +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 __EXPORT ScUndoSetGrammar::~ScUndoSetGrammar() +//UNUSED2009-05 { +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 void ScUndoSetGrammar::DoChange( formula::FormulaGrammar::Grammar eGrammar ) +//UNUSED2009-05 { +//UNUSED2009-05 pDocShell->SetInUndo( TRUE ); +//UNUSED2009-05 ScDocument* pDoc = pDocShell->GetDocument(); +//UNUSED2009-05 pDoc->SetGrammar( eGrammar ); +//UNUSED2009-05 pDocShell->SetDocumentModified(); +//UNUSED2009-05 pDocShell->SetInUndo( FALSE ); +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Undo() +//UNUSED2009-05 { +//UNUSED2009-05 DoChange( meOldGrammar ); +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Redo() +//UNUSED2009-05 { +//UNUSED2009-05 DoChange( meNewGrammar ); +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */) +//UNUSED2009-05 { +//UNUSED2009-05 #if 0 +//UNUSED2009-05 // erAck: 2006-09-07T23:00+0200 commented out in CWS scr1c1 +//UNUSED2009-05 if (rTarget.ISA(ScTabViewTarget)) +//UNUSED2009-05 ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher(). +//UNUSED2009-05 Execute( FID_TAB_USE_R1C1, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD); +//UNUSED2009-05 #endif +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 BOOL __EXPORT ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const +//UNUSED2009-05 { +//UNUSED2009-05 return (rTarget.ISA(ScTabViewTarget)); +//UNUSED2009-05 } +//UNUSED2009-05 +//UNUSED2009-05 String __EXPORT ScUndoSetGrammar::GetComment() const +//UNUSED2009-05 { +//UNUSED2009-05 return ScGlobal::GetRscString( STR_UNDO_TAB_R1C1 ); +//UNUSED2009-05 } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index ccd1b558342b..d63fbb837e44 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -957,15 +957,6 @@ void lcl_convertTokensToString(OUString& rStr, const vector& r func.getString(rStr); } -void lcl_convertTokenToString(OUString& rStr, const ScSharedTokenRef& rToken, ScDocument* pDoc, - FormulaGrammar::Grammar eGrammar) -{ - const sal_Unicode cRangeSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0); - Tokens2RangeString func(pDoc, eGrammar, cRangeSep); - func.operator() (rToken); - func.getString(rStr); -} - } // anonymous namespace // DataProvider ============================================================== @@ -995,44 +986,6 @@ void ScChart2DataProvider::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint } } -void lcl_SeperateOneColumnRange(ScRange aR, const ScAddress& rPos, ScRangeListRef& xRanges) -{ - if (aR.aStart == rPos) - { - aR.aStart.SetRow(aR.aStart.Row() + 1); - xRanges->Join(aR); - } - else if (aR.aEnd == rPos) - { - aR.aStart.SetRow(aR.aStart.Row() - 1); - xRanges->Join(aR); - } - else - { - xRanges->Join(ScRange(aR.aStart, ScAddress(rPos.Col(), rPos.Row() - 1, rPos.Tab()))); - xRanges->Join(ScRange(ScAddress(rPos.Col(), rPos.Row() + 1, rPos.Tab()), aR.aEnd )); - } -} - -void lcl_SeperateOneRowRange(ScRange aR, const ScAddress& rPos, ScRangeListRef& xRanges) -{ - if (aR.aStart == rPos) - { - aR.aStart.SetCol(aR.aStart.Col() + 1); - xRanges->Join(aR); - } - else if (aR.aEnd == rPos) - { - aR.aStart.SetCol(aR.aStart.Col() - 1); - xRanges->Join(aR); - } - else - { - xRanges->Join(ScRange(aR.aStart, ScAddress(rPos.Col() - 1, rPos.Row(), rPos.Tab()))); - xRanges->Join(ScRange(ScAddress(rPos.Col() + 1, rPos.Row(), rPos.Tab()), aR.aEnd )); - } -} - ::sal_Bool SAL_CALL ScChart2DataProvider::createDataSourcePossible( const uno::Sequence< beans::PropertyValue >& aArguments ) throw (uno::RuntimeException) { diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index c924205bdce5..a4370f6665fb 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -277,13 +277,6 @@ void ScModelObj::UpdateAllRowHeights(const ScMarkData* pTabMark) pDocShell->UpdateAllRowHeights(pTabMark); } -ScDrawLayer* ScModelObj::MakeDrawLayer() -{ - if (pDocShell) - return pDocShell->MakeDrawLayer(); - return NULL; -} - void ScModelObj::BeforeXMLLoading() { if (pDocShell) diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index eabf33f3defc..039e4dc256ba 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -1235,22 +1235,6 @@ void __EXPORT ScCellShell::GetDBState( SfxItemSet& rSet ) bOk = pDBData->HasQueryParam() || pDBData->HasSortParam() || pDBData->HasSubTotalParam(); -#if OLD_PIVOT_IMPLEMENTATION - if (!bOk) - { - // Pivottabelle mit den Daten als Quellbereich ? - ScRange aDataRange; - pDBData->GetArea(aDataRange); - ScPivotCollection* pPivotCollection = pDoc->GetPivotCollection(); - USHORT nCount = pPivotCollection ? pPivotCollection->GetCount() : 0; - for (USHORT i=0; iGetSrcArea().Intersects( aDataRange ) ) - bOk = TRUE; - } - } -#endif } } if (!bOk) diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 0c59e083f0fe..ef68bbc9bd0c 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -828,28 +828,28 @@ void ScDrawView::MarkDropObj( SdrObject* pObj ) } } -void ScDrawView::CaptionTextDirection( USHORT nSlot ) -{ - if(nSlot != SID_TEXTDIRECTION_LEFT_TO_RIGHT && nSlot != SID_TEXTDIRECTION_TOP_TO_BOTTOM) - return; - - SdrObject* pObject = GetTextEditObject(); - if ( ScDrawLayer::IsNoteCaption( pObject ) ) - { - if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) ) - { - SfxItemSet aAttr(pCaption->GetMergedItemSet()); - aAttr.Put( SvxWritingModeItem( - nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ? - com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL, - SDRATTR_TEXTDIRECTION ) ); - pCaption->SetMergedItemSet(aAttr); - FuPoor* pPoor = pViewData->GetView()->GetDrawFuncPtr(); - if ( pPoor ) - { - FuText* pText = static_cast(pPoor); - pText->StopEditMode(TRUE); - } - } - } -} +//UNUSED2009-05 void ScDrawView::CaptionTextDirection( USHORT nSlot ) +//UNUSED2009-05 { +//UNUSED2009-05 if(nSlot != SID_TEXTDIRECTION_LEFT_TO_RIGHT && nSlot != SID_TEXTDIRECTION_TOP_TO_BOTTOM) +//UNUSED2009-05 return; +//UNUSED2009-05 +//UNUSED2009-05 SdrObject* pObject = GetTextEditObject(); +//UNUSED2009-05 if ( ScDrawLayer::IsNoteCaption( pObject ) ) +//UNUSED2009-05 { +//UNUSED2009-05 if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) ) +//UNUSED2009-05 { +//UNUSED2009-05 SfxItemSet aAttr(pCaption->GetMergedItemSet()); +//UNUSED2009-05 aAttr.Put( SvxWritingModeItem( +//UNUSED2009-05 nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ? +//UNUSED2009-05 com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL, +//UNUSED2009-05 SDRATTR_TEXTDIRECTION ) ); +//UNUSED2009-05 pCaption->SetMergedItemSet(aAttr); +//UNUSED2009-05 FuPoor* pPoor = pViewData->GetView()->GetDrawFuncPtr(); +//UNUSED2009-05 if ( pPoor ) +//UNUSED2009-05 { +//UNUSED2009-05 FuText* pText = static_cast(pPoor); +//UNUSED2009-05 pText->StopEditMode(TRUE); +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 } +//UNUSED2009-05 } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 5397377b69cc..d873bf7e58b8 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -383,9 +383,6 @@ ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhic bEEMouse( FALSE ), nMouseStatus( SC_GM_NONE ), nNestedButtonState( SC_NESTEDBUTTON_NONE ), -#if OLD_PIVOT_IMPLEMENTATION - bPivotMouse( FALSE ), -#endif bDPMouse( FALSE ), bRFMouse( FALSE ), nPagebreakMouse( SC_PD_NONE ), @@ -1844,15 +1841,6 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) return; } -#if OLD_PIVOT_IMPLEMENTATION - if (bPivotMouse) - { - PivotMouseButtonUp( rMEvt ); - bPivotMouse = FALSE; - return; - } -#endif - if (bDPMouse) { DPMouseButtonUp( rMEvt ); // resets bDPMouse @@ -2260,14 +2248,6 @@ void __EXPORT ScGridWindow::MouseMove( const MouseEvent& rMEvt ) return; } -#if OLD_PIVOT_IMPLEMENTATION - if (bPivotMouse) - { - PivotMouseMove( rMEvt ); - return; - } -#endif - if (bDPMouse) { DPMouseMove( rMEvt ); @@ -2478,10 +2458,6 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt ) { if (!pViewData->GetView()->IsInActivatePart()) { -#if OLD_PIVOT_IMPLEMENTATION - if (bPivotMouse) - bPivotMouse = FALSE; // gezeichnet wird per bDragRect -#endif if (bDPMouse) bDPMouse = FALSE; // gezeichnet wird per bDragRect if (bDragRect) diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index 92743ef65524..643928a7c8aa 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -104,91 +104,6 @@ void ScGridWindow::DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt ScDPObject* pDPObj = pDoc->GetDPAtCursor(nCol, nRow, nTab); -#if OLD_PIVOT_IMPLEMENTATION - ScPivotCollection* pPivotCollection = pDoc->GetPivotCollection(); - ScPivot* pPivot = pPivotCollection->GetPivotAtCursor(nCol, nRow, nTab); - - if (pPivot) // alte Pivottabellen - { - if (pPivot->IsFilterAtCursor(nCol, nRow, nTab)) - { - ReleaseMouse(); // falls schon beim ButtonDown gecaptured, #44018# - - ScQueryParam aQueryParam; - pPivot->GetQuery(aQueryParam); - SCTAB nSrcTab = pPivot->GetSrcArea().aStart.Tab(); - - SfxItemSet aArgSet( pViewData->GetViewShell()->GetPool(), - SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, pViewData, &aQueryParam ) ); - - //CHINA001 ScPivotFilterDlg* pDlg = new ScPivotFilterDlg( - //CHINA001 pViewData->GetViewShell()->GetDialogParent(), - //CHINA001 aArgSet, nSrcTab ); - ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001 - - AbstractScPivotFilterDlg* pDlg = pFact->CreateScPivotFilterDlg( pViewData->GetViewShell()->GetDialogParent(), - aArgSet, nSrcTab, - RID_SCDLG_PIVOTFILTER); - DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001 - if ( pDlg->Execute() == RET_OK ) - { - ScPivot* pNewPivot = pPivot->CreateNew(); - - const ScQueryItem& rQueryItem = pDlg->GetOutputItem(); - pNewPivot->SetQuery(rQueryItem.GetQueryData()); - - PivotField* pColArr = new PivotField[PIVOT_MAXFIELD]; - SCSIZE nColCount; - pPivot->GetColFields( pColArr, nColCount ); - PivotField* pRowArr = new PivotField[PIVOT_MAXFIELD]; - SCSIZE nRowCount; - pPivot->GetRowFields( pRowArr, nRowCount ); - PivotField* pDataArr = new PivotField[PIVOT_MAXFIELD]; - SCSIZE nDataCount; - pPivot->GetDataFields( pDataArr, nDataCount ); - - pNewPivot->SetColFields( pColArr, nColCount ); - pNewPivot->SetRowFields( pRowArr, nRowCount ); - pNewPivot->SetDataFields( pDataArr, nDataCount ); - - pNewPivot->SetName( pPivot->GetName() ); - pNewPivot->SetTag( pPivot->GetTag() ); - - pViewData->GetDocShell()->PivotUpdate( pPivot, pNewPivot ); - } - delete pDlg; - } - else - { - SCCOL nField; - if (pPivot->GetColFieldAtCursor(nCol, nRow, nTab, nField)) - { - bPivotMouse = TRUE; - nPivotField = nField; - bPivotColField = TRUE; - nPivotCol = nCol; - pDragPivot = pPivot; - PivotTestMouse( rMEvt, TRUE ); - // CaptureMouse(); - StartTracking(); - } - else if (pPivot->GetRowFieldAtCursor(nCol, nRow, nTab, nField)) - { - bPivotMouse = TRUE; - nPivotField = nField; - bPivotColField = FALSE; - nPivotCol = nCol; - pDragPivot = pPivot; - PivotTestMouse( rMEvt, TRUE ); - // CaptureMouse(); - StartTracking(); - } - } - } -#endif - if (pDPObj) { USHORT nOrient = sheet::DataPilotFieldOrientation_HIDDEN; @@ -256,365 +171,6 @@ void ScGridWindow::DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt } } -#if OLD_PIVOT_IMPLEMENTATION -void ScGridWindow::DoPivotDrop( BOOL bDelete, BOOL bToCols, SCSIZE nDestPos ) -{ - if ( nPivotField == PIVOT_DATA_FIELD && bDelete ) - { - pViewData->GetView()->ErrorMessage(STR_PIVOT_MOVENOTALLOWED); - return; - } - - if ( bPivotColField != bToCols && !bDelete ) - { - SCSIZE nDestCount = bToCols ? pDragPivot->GetColFieldCount() - : pDragPivot->GetRowFieldCount(); - if ( nDestCount >= PIVOT_MAXFIELD ) // schon voll? - { - // Versuch, mehr als PIVOT_MAXFIELD Eintraege zu erzeugen - pViewData->GetView()->ErrorMessage(STR_PIVOT_ERROR); - return; - } - } - - PivotField* pColArr = new PivotField[PIVOT_MAXFIELD]; - SCSIZE nColCount; - pDragPivot->GetColFields( pColArr, nColCount ); - - PivotField* pRowArr = new PivotField[PIVOT_MAXFIELD]; - SCSIZE nRowCount; - pDragPivot->GetRowFields( pRowArr, nRowCount ); - - PivotField* pDataArr = new PivotField[PIVOT_MAXFIELD]; - SCSIZE nDataCount; - pDragPivot->GetDataFields( pDataArr, nDataCount ); - - SCSIZE nOldPos = 0; - PivotField aMoveField; - - PivotField* pSource = bPivotColField ? pColArr : pRowArr; - SCSIZE& rCount = bPivotColField ? nColCount : nRowCount; - - BOOL bFound = FALSE; - for (SCSIZE i=0; i i) - --nDestPos; - bFound = TRUE; - } - - if (bFound) - { - if (!bDelete) - { - PivotField* pDest = bToCols ? pColArr : pRowArr; - SCSIZE& rDestCount = bToCols ? nColCount : nRowCount; - - if (nDestPos < rDestCount) - memmove( &pDest[nDestPos+1], &pDest[nDestPos], - (rDestCount-nDestPos)*sizeof(PivotField) ); - pDest[nDestPos] = aMoveField; - ++rDestCount; - } - - BOOL bEmpty = ( nColCount + nRowCount == 0 || - ( nColCount + nRowCount == 1 && nDataCount <= 1 ) ); - - if ( bEmpty ) // Pivottabelle loeschen - { - pViewData->GetDocShell()->PivotUpdate( pDragPivot, NULL ); - } - else - { - ScPivot* pNewPivot = pDragPivot->CreateNew(); - pNewPivot->SetColFields( pColArr, nColCount ); - pNewPivot->SetRowFields( pRowArr, nRowCount ); - pNewPivot->SetDataFields( pDataArr, nDataCount ); - - pNewPivot->SetName( pDragPivot->GetName() ); - pNewPivot->SetTag( pDragPivot->GetTag() ); - - pViewData->GetDocShell()->PivotUpdate( pDragPivot, pNewPivot ); - } - pDragPivot = NULL; - } - else - { - DBG_ASSERT(0,"Pivot-Eintrag nicht gefunden"); - } - - delete[] pColArr; - delete[] pRowArr; - delete[] pDataArr; -} - -BOOL ScGridWindow::PivotTestMouse( const MouseEvent& rMEvt, BOOL bMove ) -{ - BOOL bRet = FALSE; - BOOL bTimer = FALSE; - Point aPos = rMEvt.GetPosPixel(); - - SCsCOL nDx = 0; - SCsROW nDy = 0; - if ( aPos.X() < 0 ) - nDx = -1; - if ( aPos.Y() < 0 ) - nDy = -1; - Size aSize = GetOutputSizePixel(); - if ( aPos.X() >= aSize.Width() ) - nDx = 1; - if ( aPos.Y() >= aSize.Height() ) - nDy = 1; - if ( nDx != 0 || nDy != 0 ) - { - if (bDragRect) - { - // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE ); - bDragRect = FALSE; - UpdateDragRectOverlay(); - } - - if ( nDx != 0 ) - pViewData->GetView()->ScrollX( nDx, WhichH(eWhich) ); - if ( nDy != 0 ) - pViewData->GetView()->ScrollY( nDy, WhichV(eWhich) ); - - bTimer = TRUE; - } - - SCsCOL nPosX; - SCsROW nPosY; - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); - BOOL bMouseLeft; - BOOL bMouseTop; - pViewData->GetMouseQuadrant( aPos, eWhich, nPosX, nPosY, bMouseLeft, bMouseTop ); - - SCCOL nPiCol1; - SCROW nPiRow1; - SCCOL nPiCol2; - SCROW nPiRow2; - SCTAB nTab; - pDragPivot->GetDestArea( nPiCol1, nPiRow1, nPiCol2, nPiRow2, nTab ); - - if ( nPosX >= (SCsCOL) nPiCol1 && nPosX <= (SCsCOL) nPiCol2 && - nPosY >= (SCsROW) nPiRow1 && nPosY <= (SCsROW) nPiRow2 ) - { - SCsROW nFilterAdd = 2; // Platz fuer Filter-Button - SCsROW nColRows = 1; //! Ueberschrift: 0, wenn keine Zeilen, aber mehrere Datenfelder - SCCOL nNewStartX; - SCROW nNewStartY; - SCCOL nNewEndX; - SCROW nNewEndY; - - SCsCOL nRelX = nPosX - (SCsCOL) nPiCol1; - SCsROW nRelY = nPosY - (SCsROW) nPiRow1 - nFilterAdd; - - PivotField* pFieldArr = new PivotField[PIVOT_MAXFIELD]; - SCSIZE nColCount; - pDragPivot->GetColFields( pFieldArr, nColCount ); - SCSIZE nRowCount; - pDragPivot->GetRowFields( pFieldArr, nRowCount ); - delete[] pFieldArr; - - BOOL bBefore; - SCsCOL nColSize = static_cast(Max( nColCount, (SCSIZE) 1 )); - SCsROW nRowSize = static_cast(Max( nRowCount, (SCSIZE) 1 )); - - BOOL bToCols; - if (nRelX < nColSize && nRelY >= nRowSize) - bToCols = TRUE; // links - else if (nRelY < nRowSize && nRelX >= nColSize) - bToCols = FALSE; // oben - else - bToCols = ( nRelY-nRowSize > static_cast(nRelX-nColSize) ); - - SCsCOL nDestCol = 0; - SCsROW nDestRow = 0; - BOOL bNothing = FALSE; - - if ( bToCols ) - { - bBefore = bMouseLeft; - nDestCol = nRelX; - if (nDestCol < 0) - { - nDestCol = 0; - bBefore = TRUE; - } - if (nDestCol >= static_cast(nColCount)) - { - nDestCol = static_cast(nColCount)-1; - bBefore = FALSE; - } - - nNewStartY = nPiRow1 + nFilterAdd + static_cast(nRowCount) + nColRows; - nNewEndY = nPiRow2 - 1; - nNewStartX = nPiCol1 + (SCCOL) nDestCol; - nNewEndX = nNewStartX; - - if ( !bPivotColField ) // von der anderen Seite - { - if (bBefore) - nNewEndX = nNewStartX - 1; // vor dem Feld - else - nNewStartX = nNewEndX + 1; // hinter dem Feld - } - else - { - SCCOL nThisCol = (SCCOL) nPosX; // absolute Spalte ( == Maus ) - if ( nThisCol < nPivotCol ) - { - nNewEndX = nNewStartX - 1; // vor dem Feld - bBefore = TRUE; - } - else if ( nThisCol > nPivotCol ) - { - nNewStartX = nNewEndX + 1; // hinter dem Feld - bBefore = FALSE; - } - else - bNothing = TRUE; - } - SetPointer( Pointer( POINTER_PIVOT_ROW ) ); - } - else - { - if (nRelY <= 0 && static_cast(nRelX) < static_cast(nColCount)+static_cast(nRowCount)) - { - nDestRow = static_cast(nRelX) - static_cast(nColCount); - bBefore = bMouseLeft; - } - else - { - nDestRow = nRelY-1; - bBefore = bMouseTop; - } - if (nDestRow < 0) - { - nDestRow = 0; - bBefore = TRUE; - } - if (nDestRow >= static_cast(nRowCount)) - { - nDestRow = static_cast(nRowCount)-1; - bBefore = FALSE; - } - - nNewStartX = nPiCol1 + (SCCOL) nColCount; - nNewEndX = nPiCol2 - 1; - nNewStartY = nPiRow1 + nFilterAdd + nDestRow + nColRows; - nNewEndY = nNewStartY; - if ( bPivotColField ) // von der anderen Seite - { - if (bBefore) - nNewEndY = nNewStartY - 1; // vor dem Feld - else - nNewStartY = nNewEndY + 1; // hinter dem Feld - } - else - { - SCCOL nThisCol = - static_cast(static_cast(nDestRow) + - static_cast(nColCount) + nPiCol1); - // absolute Spalte - if ( nThisCol < nPivotCol ) - { - bBefore = TRUE; - nNewEndY = nNewStartY - 1; // vor dem Feld - } - else if ( nThisCol > nPivotCol ) - { - bBefore = FALSE; - nNewStartY = nNewEndY + 1; // hinter dem Feld - } - else - bNothing = TRUE; - } - SetPointer( Pointer( POINTER_PIVOT_COL ) ); - } - - if (bMove) - { - if ( nNewStartX != nDragStartX || nNewEndX != nDragEndX || - nNewStartY != nDragStartY || nNewEndY != nDragEndY || !bDragRect ) - { - //if (bDragRect) - // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE ); - - nDragStartX = nNewStartX; - nDragStartY = nNewStartY; - nDragEndX = nNewEndX; - nDragEndY = nNewEndY; - bDragRect = TRUE; - - // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE ); - - UpdateDragRectOverlay(); - } - } - else - { - if (bDragRect) - { - // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE ); - bDragRect = FALSE; - UpdateDragRectOverlay(); - } - - if (!bNothing) - { - SCSIZE nDestPos = bToCols ? static_cast(nDestCol) : static_cast(nDestRow); - if (!bBefore) - ++nDestPos; - DoPivotDrop( FALSE, bToCols, nDestPos ); - } - } - - bRet = TRUE; - } - else - { - if (bMove) - SetPointer( Pointer( POINTER_PIVOT_DELETE ) ); - // if (bDragRect) - // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE ); - bDragRect = FALSE; - UpdateDragRectOverlay(); - - if (!bMove) - DoPivotDrop( TRUE, FALSE,0 ); - } - - if (bTimer && bMove) - pViewData->GetView()->SetTimer( this, rMEvt ); // Event wiederholen - else - pViewData->GetView()->ResetTimer(); - - return bRet; -} - -void ScGridWindow::PivotMouseMove( const MouseEvent& rMEvt ) -{ - PivotTestMouse( rMEvt, TRUE ); -} - -void ScGridWindow::PivotMouseButtonUp( const MouseEvent& rMEvt ) -{ - bPivotMouse = FALSE; // als erstes, falls PivotTestMouse eine Fehlermeldung bringt - ReleaseMouse(); - - PivotTestMouse( rMEvt, FALSE ); - SetPointer( Pointer( POINTER_ARROW ) ); -} -#endif - // ----------------------------------------------------------------------- // // Data Pilot interaction diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index b600600acb6b..9d2da303988c 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -1816,6 +1816,7 @@ void ScOutputData::FindChanged() pDoc->DisableIdle( bWasIdleDisabled ); } +#ifdef OLD_SELECTION_PAINT void ScOutputData::DrawMark( Window* pWin ) { Rectangle aRect; @@ -1826,14 +1827,14 @@ void ScOutputData::DrawMark( Window* pWin ) for (SCSIZE nArrY=1; nArrY+1bChanged ) + if (pThisRowInfo->bChanged) { long nPosX = nScrX; - if ( bLayoutRTL ) + if (bLayoutRTL) nPosX += nMirrorW - 1; // always in pixels aRect = Rectangle( Point( nPosX,nPosY ), Size(1, pThisRowInfo->nHeight) ); - if ( bLayoutRTL ) + if (bLayoutRTL) aRect.Left() = aRect.Right() + 1; else aRect.Right() = aRect.Left() - 1; @@ -1841,12 +1842,12 @@ void ScOutputData::DrawMark( Window* pWin ) BOOL bOldMarked = FALSE; for (SCCOL nX=nX1; nX<=nX2; nX++) { - if ( pThisRowInfo->pCellInfo[nX+1].bMarked != bOldMarked ) + if (pThisRowInfo->pCellInfo[nX+1].bMarked != bOldMarked) { if (bOldMarked && aRect.Right() >= aRect.Left()) aInvert.AddRect( aRect ); - if ( bLayoutRTL ) + if (bLayoutRTL) aRect.Right() = nPosX; else aRect.Left() = nPosX; @@ -1854,7 +1855,7 @@ void ScOutputData::DrawMark( Window* pWin ) bOldMarked = pThisRowInfo->pCellInfo[nX+1].bMarked; } - if ( bLayoutRTL ) + if (bLayoutRTL) { nPosX -= pRowInfo[0].pCellInfo[nX+1].nWidth; aRect.Left() = nPosX+1; @@ -1871,6 +1872,7 @@ void ScOutputData::DrawMark( Window* pWin ) nPosY += pThisRowInfo->nHeight; } } +#endif void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY, SCCOL nRefEndX, SCROW nRefEndY, diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index c51c81c36dd8..459f5e89e0fb 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -398,22 +398,22 @@ ScTabView::ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pView Init(); } -ScTabView::ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell ) : - pFrameWin( pParent ), - aViewData( rScTabView.aViewData ), - TABVIEW_INIT -{ - RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScTabView::ScTabView" ); - - aViewData.SetViewShell( pViewShell ); - Init(); - - UpdateShow(); - if ( aViewData.GetActivePart() != SC_SPLIT_BOTTOMLEFT ) - pGridWin[SC_SPLIT_BOTTOMLEFT]->Show(); - - InvalidateSplit(); -} +//UNUSED2009-05 ScTabView::ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell ) : +//UNUSED2009-05 pFrameWin( pParent ), +//UNUSED2009-05 aViewData( rScTabView.aViewData ), +//UNUSED2009-05 TABVIEW_INIT +//UNUSED2009-05 { +//UNUSED2009-05 RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScTabView::ScTabView" ); +//UNUSED2009-05 +//UNUSED2009-05 aViewData.SetViewShell( pViewShell ); +//UNUSED2009-05 Init(); +//UNUSED2009-05 +//UNUSED2009-05 UpdateShow(); +//UNUSED2009-05 if ( aViewData.GetActivePart() != SC_SPLIT_BOTTOMLEFT ) +//UNUSED2009-05 pGridWin[SC_SPLIT_BOTTOMLEFT]->Show(); +//UNUSED2009-05 +//UNUSED2009-05 InvalidateSplit(); +//UNUSED2009-05 } void ScTabView::InitScrollBar( ScrollBar& rScrollBar, long nMaxVal ) { diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 608658024d2b..f8cf331bc8cf 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -466,19 +466,9 @@ void ScTabView::CursorPosChanged() // Broadcast, damit andere Views des Dokuments auch umschalten ScDocument* pDoc = aViewData.GetDocument(); -#if OLD_PIVOT_IMPLEMENTATION - BOOL bPivot = ( NULL != pDoc->GetPivotAtCursor( aViewData.GetCurX(), - aViewData.GetCurY(), - aViewData.GetTabNo() ) || - NULL != pDoc->GetDPAtCursor( aViewData.GetCurX(), - aViewData.GetCurY(), - aViewData.GetTabNo() ) ); - aViewData.GetViewShell()->SetPivotShell(bPivot); -#else bool bDP = NULL != pDoc->GetDPAtCursor( aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() ); aViewData.GetViewShell()->SetPivotShell(bDP); -#endif // UpdateInputHandler jetzt in CellContentChanged diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index 83dd05c9d33c..d0a6f2acf015 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -481,12 +481,13 @@ BOOL ScUpdateRect::GetDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ) return TRUE; } +#ifdef OLD_SELECTION_PAINT BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, BOOL& rCont ) { rCont = FALSE; - if ( nNewStartX == nOldStartX && nNewEndX == nOldEndX && - nNewStartY == nOldStartY && nNewEndY == nOldEndY ) + if (nNewStartX == nOldStartX && nNewEndX == nOldEndX && + nNewStartY == nOldStartY && nNewEndY == nOldEndY) { rX1 = nNewStartX; rY1 = nNewStartY; @@ -500,14 +501,14 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B rX2 = Max(nNewEndX,nOldEndX); rY2 = Max(nNewEndY,nOldEndY); - if ( nNewStartX == nOldStartX && nNewEndX == nOldEndX ) // nur vertikal + if (nNewStartX == nOldStartX && nNewEndX == nOldEndX) // nur vertikal { - if ( nNewStartY == nOldStartY ) + if (nNewStartY == nOldStartY) { rY1 = Min( nNewEndY, nOldEndY ) + 1; rY2 = Max( nNewEndY, nOldEndY ); } - else if ( nNewEndY == nOldEndY ) + else if (nNewEndY == nOldEndY) { rY1 = Min( nNewStartY, nOldStartY ); rY2 = Max( nNewStartY, nOldStartY ) - 1; @@ -523,14 +524,14 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B nContX2 = rX2; } } - else if ( nNewStartY == nOldStartY && nNewEndY == nOldEndY ) // nur horizontal + else if (nNewStartY == nOldStartY && nNewEndY == nOldEndY) // nur horizontal { - if ( nNewStartX == nOldStartX ) + if (nNewStartX == nOldStartX) { rX1 = Min( nNewEndX, nOldEndX ) + 1; rX2 = Max( nNewEndX, nOldEndX ); } - else if ( nNewEndX == nOldEndX ) + else if (nNewEndX == nOldEndX) { rX1 = Min( nNewStartX, nOldStartX ); rX2 = Max( nNewStartX, nOldStartX ) - 1; @@ -546,9 +547,9 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B nContY2 = rY2; } } - else if ( nNewEndX == nOldEndX && nNewEndY == nOldEndY ) // links oben + else if (nNewEndX == nOldEndX && nNewEndY == nOldEndY) // links oben { - if ( (nNewStartX Date: Wed, 26 Aug 2009 09:55:20 +0000 Subject: CWS-TOOLING: integrate CWS fillednetchart 2009-07-22 17:48:07 +0200 oc r274255 : #i103584# new testcase for fillednetchart added 2009-07-22 17:42:41 +0200 oc r274254 : #i103584# Case 8 set to maximum 4 because of new fillednetchart 2009-07-13 17:29:40 +0200 iha r273946 : CWS-TOOLING: rebase CWS fillednetchart to trunk@273858 (milestone: DEV300:m52) 2009-07-03 15:04:36 +0200 dr r273704 : #i102667# import/export of filled radar charts 2009-07-03 09:50:28 +0200 dr r273680 : #i102677# import filled radar charts from MSOOXML 2009-06-11 18:21:05 +0200 iha r272896 : #i64752# filled net chart 2009-06-11 17:30:46 +0200 iha r272892 : #i64752# filled net chart 2009-06-11 17:07:11 +0200 iha r272889 : #i64752# filled net chart 2009-06-11 16:25:01 +0200 iha r272883 : #i64752# filled net chart 2009-06-11 16:15:10 +0200 iha r272878 : #i64752# filled net chart --- .../chartapiwrapper/ChartDocumentWrapper.cxx | 10 ++ .../controller/chartapiwrapper/DiagramWrapper.cxx | 7 ++ chart2/source/controller/dialogs/Bitmaps.hrc | 4 +- chart2/source/controller/dialogs/Bitmaps.src | 8 +- chart2/source/controller/dialogs/Bitmaps_HC.hrc | 4 +- chart2/source/controller/dialogs/Bitmaps_HC.src | 8 +- .../dialogs/ChartTypeDialogController.cxx | 11 ++ chart2/source/controller/dialogs/DataBrowser.cxx | 3 +- .../controller/dialogs/Strings_ChartTypes.src | 4 + chart2/source/inc/ChartTypeHelper.hxx | 2 + chart2/source/inc/CommonConverters.hxx | 4 + chart2/source/inc/Strings.hrc | 3 +- chart2/source/inc/servicenames_charttypes.hxx | 1 + chart2/source/model/template/ChartTypeManager.cxx | 18 ++++ .../source/model/template/FilledNetChartType.cxx | 97 +++++++++++++++++ .../source/model/template/FilledNetChartType.hxx | 66 ++++++++++++ chart2/source/model/template/NetChartType.cxx | 120 +++++++-------------- chart2/source/model/template/NetChartType.hxx | 40 ++++--- .../source/model/template/NetChartTypeTemplate.cxx | 28 +++-- .../source/model/template/NetChartTypeTemplate.hxx | 4 +- .../template/_serviceregistration_charttypes.cxx | 9 ++ chart2/source/model/template/makefile.mk | 1 + chart2/source/tools/ChartTypeHelper.cxx | 29 ++++- chart2/source/tools/CommonConverters.cxx | 23 ++++ chart2/source/tools/DiagramHelper.cxx | 2 + chart2/source/view/axes/VCoordinateSystem.cxx | 5 +- chart2/source/view/charttypes/AreaChart.cxx | 64 ++++++++++- chart2/source/view/charttypes/AreaChart.hxx | 2 + chart2/source/view/charttypes/VSeriesPlotter.cxx | 7 ++ chart2/source/view/inc/VCoordinateSystem.hxx | 4 +- chart2/source/view/inc/VSeriesPlotter.hxx | 2 + chart2/source/view/main/ChartView.cxx | 20 +++- sc/source/filter/excel/xlchart.cxx | 49 ++++----- 33 files changed, 505 insertions(+), 154 deletions(-) create mode 100644 chart2/source/model/template/FilledNetChartType.cxx create mode 100644 chart2/source/model/template/FilledNetChartType.hxx diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index fcc17fefeebc..397527f3ea9d 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -95,6 +95,7 @@ enum eServiceType SERVICE_NAME_DONUT_DIAGRAM, SERVICE_NAME_LINE_DIAGRAM, SERVICE_NAME_NET_DIAGRAM, + SERVICE_NAME_FILLED_NET_DIAGRAM, SERVICE_NAME_PIE_DIAGRAM, SERVICE_NAME_STOCK_DIAGRAM, SERVICE_NAME_XY_DIAGRAM, @@ -124,6 +125,7 @@ tServiceNameMap & lcl_getStaticServiceNameMap() ( C2U( "com.sun.star.chart.DonutDiagram" ), SERVICE_NAME_DONUT_DIAGRAM ) ( C2U( "com.sun.star.chart.LineDiagram" ), SERVICE_NAME_LINE_DIAGRAM ) ( C2U( "com.sun.star.chart.NetDiagram" ), SERVICE_NAME_NET_DIAGRAM ) + ( C2U( "com.sun.star.chart.FilledNetDiagram" ), SERVICE_NAME_FILLED_NET_DIAGRAM ) ( C2U( "com.sun.star.chart.PieDiagram" ), SERVICE_NAME_PIE_DIAGRAM ) ( C2U( "com.sun.star.chart.StockDiagram" ), SERVICE_NAME_STOCK_DIAGRAM ) ( C2U( "com.sun.star.chart.XYDiagram" ), SERVICE_NAME_XY_DIAGRAM ) @@ -1341,6 +1343,14 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( bCreateDiagram = true; } break; + case SERVICE_NAME_FILLED_NET_DIAGRAM: + if( xManagerFact.is()) + { + xTemplate.set( + xManagerFact->createInstance( + C2U( "com.sun.star.chart2.template.FilledNet" )), uno::UNO_QUERY ); + bCreateDiagram = true; + } case SERVICE_NAME_PIE_DIAGRAM: if( xManagerFact.is()) { diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index fe1359aab7f3..4a02d9aa99e5 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -538,6 +538,10 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName ) if( aName.indexOf( C2U("Scatter") ) != -1 ) return C2U( "com.sun.star.chart.XYDiagram" ); + // "FilledNet" "StackedFilledNet" "PercentStackedFilledNet" + if( aName.indexOf( C2U("FilledNet") ) != -1 ) + return C2U( "com.sun.star.chart.FilledNetDiagram" ); + // "Net" "NetSymbol" "NetLine" "StackedNet" "StackedNetSymbol" // "StackedNetLine" "PercentStackedNet" "PercentStackedNetSymbol" // "PercentStackedNetLine" @@ -591,6 +595,9 @@ const tMakeStringStringMap& lcl_getChartTypeNameMap() ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ScatterChartType" ) , ::rtl::OUString::createFromAscii( "com.sun.star.chart.XYDiagram" ) ) + ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.FilledNetChartType" ) + , ::rtl::OUString::createFromAscii( "com.sun.star.chart.FilledNetDiagram" ) ) + ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.NetChartType" ) , ::rtl::OUString::createFromAscii( "com.sun.star.chart.NetDiagram" ) ) diff --git a/chart2/source/controller/dialogs/Bitmaps.hrc b/chart2/source/controller/dialogs/Bitmaps.hrc index 07ed2eeec0d5..8823b582a28e 100644 --- a/chart2/source/controller/dialogs/Bitmaps.hrc +++ b/chart2/source/controller/dialogs/Bitmaps.hrc @@ -173,8 +173,8 @@ #define BMP_NET_SYMB_STACK (RID_APP_START + 77) #define BMP_NET_LINESYMB (RID_APP_START + 78) #define BMP_NET_LINESYMB_STACK (RID_APP_START + 79) -#define BMP_NET_FILLED (RID_APP_START + 80) -#define BMP_NET_FILLED_STACKED (RID_APP_START + 81) +#define BMP_NET_FILL (RID_APP_START + 80) +#define BMP_NET_FILL_STACK (RID_APP_START + 81) //---------------------- // Stock Chart Subtypes diff --git a/chart2/source/controller/dialogs/Bitmaps.src b/chart2/source/controller/dialogs/Bitmaps.src index 35a897848fb1..67d8588897d8 100644 --- a/chart2/source/controller/dialogs/Bitmaps.src +++ b/chart2/source/controller/dialogs/Bitmaps.src @@ -359,13 +359,13 @@ Bitmap BMP_NET_LINESYMB_STACK { File = "netlinepointstack_52x60.png" ; }; -Bitmap BMP_NET_FILLED +Bitmap BMP_NET_FILL { - File = "net_52x60.png" ; + File = "netfill_52x60.png" ; }; -Bitmap BMP_NET_FILLED_STACKED +Bitmap BMP_NET_FILL_STACK { - File = "netstack_52x60.png" ; + File = "netstackfill_52x60.png" ; }; //--------------------- Bitmap BMP_PYRAMIDQ_3D_1 diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.hrc b/chart2/source/controller/dialogs/Bitmaps_HC.hrc index 84a23ba426bc..8dd4acaffd15 100644 --- a/chart2/source/controller/dialogs/Bitmaps_HC.hrc +++ b/chart2/source/controller/dialogs/Bitmaps_HC.hrc @@ -173,8 +173,8 @@ #define BMP_NET_SYMB_STACK_HC (RID_SCH_START + 77) #define BMP_NET_LINESYMB_HC (RID_SCH_START + 78) #define BMP_NET_LINESYMB_STACK_HC (RID_SCH_START + 79) -#define BMP_NET_FILLED_HC (RID_SCH_START + 80) -#define BMP_NET_FILLED_STACKED_HC (RID_SCH_START + 81) +#define BMP_NET_FILL_HC (RID_SCH_START + 80) +#define BMP_NET_FILL_STACK_HC (RID_SCH_START + 81) //---------------------- // Stock Chart Subtypes diff --git a/chart2/source/controller/dialogs/Bitmaps_HC.src b/chart2/source/controller/dialogs/Bitmaps_HC.src index 0fb7ef5e5a1a..a82893273ae2 100644 --- a/chart2/source/controller/dialogs/Bitmaps_HC.src +++ b/chart2/source/controller/dialogs/Bitmaps_HC.src @@ -359,13 +359,13 @@ Bitmap BMP_NET_LINESYMB_STACK_HC { File = "netlinepointstack_52x60_h.png" ; }; -Bitmap BMP_NET_FILLED_HC +Bitmap BMP_NET_FILL_HC { - File = "net_52x60_h.png" ; + File = "netfill_52x60_h.png" ; }; -Bitmap BMP_NET_FILLED_STACKED_HC +Bitmap BMP_NET_FILL_STACK_HC { - File = "netstack_52x60_h.png" ; + File = "netstackfill_52x60_h.png" ; }; //--------------------- Bitmap BMP_PYRAMIDQ_3D_1_HC diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index de57e82e58da..fa51d17a03d8 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -1000,6 +1000,10 @@ const tTemplateServiceChartTypeParameterMap& NetChartDialogController::getTempla ( C2U( "com.sun.star.chart2.template.NetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_NONE,false,true) ) ( C2U( "com.sun.star.chart2.template.StackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y,false,true) ) ( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT,false,true) ) + + ( C2U( "com.sun.star.chart2.template.FilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_NONE,false,false) ) + ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y,false,false) ) + ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ),ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y_PERCENT,false,false) ) ; return m_aTemplateMap; } @@ -1012,17 +1016,20 @@ void NetChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, bool bIs rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB ) ); rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB ) ); rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET ) ); + rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL ) ); } else { rSubTypeList.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB_STACK ) ); rSubTypeList.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB_STACK ) ); rSubTypeList.InsertItem( 3, SELECT_BITMAP( BMP_NET_STACK ) ); + rSubTypeList.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL_STACK ) ); } rSubTypeList.SetItemText( 1, String( SchResId( STR_POINTS_ONLY )) ); rSubTypeList.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES )) ); rSubTypeList.SetItemText( 3, String( SchResId( STR_LINES_ONLY )) ); + rSubTypeList.SetItemText( 4, String( SchResId( STR_FILLED )) ); } void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter ) { @@ -1040,6 +1047,10 @@ void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rPa rParameter.bSymbols = false; rParameter.bLines = true; break; + case 4: + rParameter.bSymbols = false; + rParameter.bLines = false; + break; default: rParameter.bSymbols = true; rParameter.bLines = false; diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 0a9b58758de6..56ef98b159ba 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -413,7 +413,8 @@ Image SeriesHeader::GetChartTypeImage( { aResult = SELECT_IMAGE( IMG_TYPE_PIE, bHC ); } - else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_NET )) + else if( aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_NET ) + || aChartTypeName.equals( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) ) { aResult = SELECT_IMAGE( IMG_TYPE_NET, bHC ); } diff --git a/chart2/source/controller/dialogs/Strings_ChartTypes.src b/chart2/source/controller/dialogs/Strings_ChartTypes.src index 2234f04a3fcd..f2731b2971c2 100644 --- a/chart2/source/controller/dialogs/Strings_ChartTypes.src +++ b/chart2/source/controller/dialogs/Strings_ChartTypes.src @@ -139,6 +139,10 @@ String STR_DEEP { Text [ en-US ] = "Deep" ; }; +String STR_FILLED +{ + Text [ en-US ] = "Filled" ; +}; //----------------------------------------------------------------------------- String STR_TYPE_BUBBLE { diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index df43e24a9482..9c5cdafe49f2 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -83,6 +83,8 @@ public: static sal_Int32 getNumberOfDisplayedSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nNumberOfSeries ); SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + static bool isSeriesInFrontOfAxisLine( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + static sal_Int32 //one of ::com::sun::star::chart2::AxisType getAxisType( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType , sal_Int32 nDimensionIndex ); diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx index 102ffde71918..493c4d2096e2 100644 --- a/chart2/source/inc/CommonConverters.hxx +++ b/chart2/source/inc/CommonConverters.hxx @@ -121,6 +121,10 @@ OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::drawing::Position3D getPointFromPoly( , sal_Int32 nPointIndex, sal_Int32 nPolyIndex=0 ); //----------------------------------------------------------------------------- +OOO_DLLPUBLIC_CHARTTOOLS +void addPolygon( com::sun::star::drawing::PolyPolygonShape3D& rRet + , const com::sun::star::drawing::PolyPolygonShape3D& rAdd ); +//----------------------------------------------------------------------------- /** PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D */ OOO_DLLPUBLIC_CHARTTOOLS diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc index 133f5bcc255b..1092efe6e900 100644 --- a/chart2/source/inc/Strings.hrc +++ b/chart2/source/inc/Strings.hrc @@ -33,7 +33,7 @@ // this includes no link dependency #include -//next free is 285 +//next free is 286 //single free is: 134 //#define RID_APP_START 30000 @@ -100,6 +100,7 @@ #define STR_STACKED (RID_APP_START + 11) #define STR_PERCENT (RID_APP_START + 12) #define STR_DEEP (RID_APP_START + 13) +#define STR_FILLED (RID_APP_START + 285) #define STR_DONUT (RID_APP_START + 8) #define STR_TYPE_PIE (RID_APP_START + 187) diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx index 1c2782de3852..1e824798fa66 100644 --- a/chart2/source/inc/servicenames_charttypes.hxx +++ b/chart2/source/inc/servicenames_charttypes.hxx @@ -42,6 +42,7 @@ namespace chart #define CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ::rtl::OUString::createFromAscii("com.sun.star.chart2.ScatterChartType") #define CHART2_SERVICE_NAME_CHARTTYPE_PIE ::rtl::OUString::createFromAscii("com.sun.star.chart2.PieChartType") #define CHART2_SERVICE_NAME_CHARTTYPE_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.NetChartType") +#define CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.FilledNetChartType") #define CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ::rtl::OUString::createFromAscii("com.sun.star.chart2.CandleStickChartType") #define CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ::rtl::OUString::createFromAscii("com.sun.star.chart2.BubbleChartType") diff --git a/chart2/source/model/template/ChartTypeManager.cxx b/chart2/source/model/template/ChartTypeManager.cxx index 0e4a3a119a02..bb419a10f1ac 100644 --- a/chart2/source/model/template/ChartTypeManager.cxx +++ b/chart2/source/model/template/ChartTypeManager.cxx @@ -128,6 +128,9 @@ enum TemplateId TEMPLATE_PERCENTSTACKEDNET, TEMPLATE_PERCENTSTACKEDNETSYMBOL, TEMPLATE_PERCENTSTACKEDNETLINE, + TEMPLATE_FILLEDNET, + TEMPLATE_STACKEDFILLEDNET, + TEMPLATE_PERCENTSTACKEDFILLEDNET, TEMPLATE_STOCKLOWHIGHCLOSE, TEMPLATE_STOCKOPENLOWHIGHCLOSE, TEMPLATE_STOCKVOLUMELOWHIGHCLOSE, @@ -200,6 +203,9 @@ const tTemplateMapType & lcl_DefaultChartTypeMap() ( C2U( "com.sun.star.chart2.template.PercentStackedNet" ), TEMPLATE_PERCENTSTACKEDNET ) ( C2U( "com.sun.star.chart2.template.PercentStackedNetSymbol" ), TEMPLATE_PERCENTSTACKEDNETSYMBOL ) ( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), TEMPLATE_PERCENTSTACKEDNETLINE ) + ( C2U( "com.sun.star.chart2.template.FilledNet" ), TEMPLATE_FILLEDNET ) + ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), TEMPLATE_STACKEDFILLEDNET ) + ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ), TEMPLATE_PERCENTSTACKEDFILLEDNET ) ( C2U( "com.sun.star.chart2.template.StockLowHighClose" ), TEMPLATE_STOCKLOWHIGHCLOSE ) ( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), TEMPLATE_STOCKOPENLOWHIGHCLOSE ) ( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), TEMPLATE_STOCKVOLUMELOWHIGHCLOSE ) @@ -503,6 +509,18 @@ uno::Reference< uno::XInterface > SAL_CALL ChartTypeManager::createInstance( StackMode_Y_STACKED_PERCENT, false, true )); break; + case TEMPLATE_FILLEDNET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode_NONE, false, false, true )); + break; + case TEMPLATE_STACKEDFILLEDNET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode_Y_STACKED, false, false, true )); + break; + case TEMPLATE_PERCENTSTACKEDFILLEDNET: + xTemplate.set( new NetChartTypeTemplate( m_xContext, aServiceSpecifier, + StackMode_Y_STACKED_PERCENT, false, false, true )); + break; case TEMPLATE_STOCKLOWHIGHCLOSE: xTemplate.set( new StockChartTypeTemplate( m_xContext, aServiceSpecifier, diff --git a/chart2/source/model/template/FilledNetChartType.cxx b/chart2/source/model/template/FilledNetChartType.cxx new file mode 100644 index 000000000000..ce96488270a4 --- /dev/null +++ b/chart2/source/model/template/FilledNetChartType.cxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * 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: FilledNetChartType.cxx,v $ + * $Revision: 1.7 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_chart2.hxx" +#include "FilledNetChartType.hxx" +#include "PropertyHelper.hxx" +#include "macros.hxx" +#include "PolarCoordinateSystem.hxx" +#include "Scaling.hxx" +#include "servicenames_charttypes.hxx" +#include "ContainerHelper.hxx" +#include "AxisIndexDefines.hxx" +#include +#include + +using namespace ::com::sun::star; +using namespace ::com::sun::star::chart2; + +using ::rtl::OUString; +using ::com::sun::star::beans::Property; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Any; +using ::osl::MutexGuard; + +namespace chart +{ + +FilledNetChartType::FilledNetChartType( + const uno::Reference< uno::XComponentContext > & xContext ) : + NetChartType_Base( xContext ) +{} + +FilledNetChartType::FilledNetChartType( const FilledNetChartType & rOther ) : + NetChartType_Base( rOther ) +{ +} + +FilledNetChartType::~FilledNetChartType() +{} + +// ____ XCloneable ____ +uno::Reference< util::XCloneable > SAL_CALL FilledNetChartType::createClone() + throw (uno::RuntimeException) +{ + return uno::Reference< util::XCloneable >( new FilledNetChartType( *this )); +} + +// ____ XChartType ____ +::rtl::OUString SAL_CALL FilledNetChartType::getChartType() + throw (uno::RuntimeException) +{ + return CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET; +} + +uno::Sequence< ::rtl::OUString > FilledNetChartType::getSupportedServiceNames_Static() +{ + uno::Sequence< ::rtl::OUString > aServices( 3 ); + aServices[ 0 ] = CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET; + aServices[ 1 ] = C2U( "com.sun.star.chart2.ChartType" ); + aServices[ 2 ] = C2U( "com.sun.star.beans.PropertySet" ); + return aServices; +} + +// implement XServiceInfo methods basing upon getSupportedServiceNames_Static +APPHELPER_XSERVICEINFO_IMPL( FilledNetChartType, + C2U( "com.sun.star.comp.chart.FilledNetChartType" )); + +} // namespace chart diff --git a/chart2/source/model/template/FilledNetChartType.hxx b/chart2/source/model/template/FilledNetChartType.hxx new file mode 100644 index 000000000000..3e694c12b0dd --- /dev/null +++ b/chart2/source/model/template/FilledNetChartType.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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: FilledNetChartType.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CHART_FILLEDNETCHARTTYPE_HXX +#define CHART_FILLEDNETCHARTTYPE_HXX + +#include "NetChartType.hxx" +#include "ServiceMacros.hxx" + +namespace chart +{ + +class FilledNetChartType : public NetChartType_Base +{ +public: + FilledNetChartType( ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > const & xContext ); + virtual ~FilledNetChartType(); + + APPHELPER_XSERVICEINFO_DECL() + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( FilledNetChartType ) + +protected: + explicit FilledNetChartType( const FilledNetChartType & rOther ); + + // ____ XChartType ____ + virtual ::rtl::OUString SAL_CALL getChartType() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XCloneable ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() + throw (::com::sun::star::uno::RuntimeException); +}; + +} // namespace chart + +// CHART_FILLEDNETCHARTTYPE_HXX +#endif diff --git a/chart2/source/model/template/NetChartType.cxx b/chart2/source/model/template/NetChartType.cxx index 9de315679223..757d2dc07122 100644 --- a/chart2/source/model/template/NetChartType.cxx +++ b/chart2/source/model/template/NetChartType.cxx @@ -52,76 +52,24 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; using ::osl::MutexGuard; -namespace -{ - -void lcl_AddPropertiesToVector( - ::std::vector< Property > & /* rOutProperties */ ) -{ -} - -void lcl_AddDefaultsToMap( - ::chart::tPropertyValueMap & /* rOutMap */ ) -{ -} - -const Sequence< Property > & lcl_GetPropertySequence() -{ - static Sequence< Property > aPropSeq; - - // /-- - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) - { - // get properties - ::std::vector< ::com::sun::star::beans::Property > aProperties; - lcl_AddPropertiesToVector( aProperties ); - - // and sort them for access via bsearch - ::std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); - - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); - } - - return aPropSeq; -} - -} // anonymous namespace - namespace chart { -NetChartType::NetChartType( +NetChartType_Base::NetChartType_Base( const uno::Reference< uno::XComponentContext > & xContext ) : ChartType( xContext ) {} -NetChartType::NetChartType( const NetChartType & rOther ) : +NetChartType_Base::NetChartType_Base( const NetChartType_Base & rOther ) : ChartType( rOther ) { } -NetChartType::~NetChartType() +NetChartType_Base::~NetChartType_Base() {} -// ____ XCloneable ____ -uno::Reference< util::XCloneable > SAL_CALL NetChartType::createClone() - throw (uno::RuntimeException) -{ - return uno::Reference< util::XCloneable >( new NetChartType( *this )); -} - -// ____ XChartType ____ -::rtl::OUString SAL_CALL NetChartType::getChartType() - throw (uno::RuntimeException) -{ - return CHART2_SERVICE_NAME_CHARTTYPE_NET; -} - Reference< XCoordinateSystem > SAL_CALL - NetChartType::createCoordinateSystem( ::sal_Int32 DimensionCount ) + NetChartType_Base::createCoordinateSystem( ::sal_Int32 DimensionCount ) throw (lang::IllegalArgumentException, uno::RuntimeException) { @@ -157,42 +105,23 @@ Reference< XCoordinateSystem > SAL_CALL } // ____ OPropertySet ____ -uno::Any NetChartType::GetDefaultValue( sal_Int32 nHandle ) const +uno::Any NetChartType_Base::GetDefaultValue( sal_Int32 /*nHandle*/ ) const throw(beans::UnknownPropertyException) { - static tPropertyValueMap aStaticDefaults; - - // /-- - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aStaticDefaults.size() ) - { - // initialize defaults - lcl_AddDefaultsToMap( aStaticDefaults ); - } - - tPropertyValueMap::const_iterator aFound( - aStaticDefaults.find( nHandle )); - - if( aFound == aStaticDefaults.end()) - return uno::Any(); - - return (*aFound).second; - // \-- + return uno::Any(); } // ____ OPropertySet ____ -::cppu::IPropertyArrayHelper & SAL_CALL NetChartType::getInfoHelper() +::cppu::IPropertyArrayHelper & SAL_CALL NetChartType_Base::getInfoHelper() { - static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(), - /* bSorted = */ sal_True ); - + uno::Sequence< beans::Property > aProps; + static ::cppu::OPropertyArrayHelper aArrayHelper(aProps); return aArrayHelper; } - // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL - NetChartType::getPropertySetInfo() + NetChartType_Base::getPropertySetInfo() throw (uno::RuntimeException) { static uno::Reference< beans::XPropertySetInfo > xInfo; @@ -209,6 +138,35 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL // \-- } +//----------------------------------------------------------------------------- + +NetChartType::NetChartType( + const uno::Reference< uno::XComponentContext > & xContext ) : + NetChartType_Base( xContext ) +{} + +NetChartType::NetChartType( const NetChartType & rOther ) : + NetChartType_Base( rOther ) +{ +} + +NetChartType::~NetChartType() +{} + +// ____ XCloneable ____ +uno::Reference< util::XCloneable > SAL_CALL NetChartType::createClone() + throw (uno::RuntimeException) +{ + return uno::Reference< util::XCloneable >( new NetChartType( *this )); +} + +// ____ XChartType ____ +::rtl::OUString SAL_CALL NetChartType::getChartType() + throw (uno::RuntimeException) +{ + return CHART2_SERVICE_NAME_CHARTTYPE_NET; +} + uno::Sequence< ::rtl::OUString > NetChartType::getSupportedServiceNames_Static() { uno::Sequence< ::rtl::OUString > aServices( 3 ); diff --git a/chart2/source/model/template/NetChartType.hxx b/chart2/source/model/template/NetChartType.hxx index f38d110a60ba..97afeeaeea13 100644 --- a/chart2/source/model/template/NetChartType.hxx +++ b/chart2/source/model/template/NetChartType.hxx @@ -6,7 +6,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: NetChartType.hxx,v $ + * $RCSfile: NetChartType_Base.hxx,v $ * $Revision: 1.4 $ * * This file is part of OpenOffice.org. @@ -36,24 +36,17 @@ namespace chart { -class NetChartType : public ChartType +class NetChartType_Base : public ChartType { public: - NetChartType( ::com::sun::star::uno::Reference< + NetChartType_Base( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext ); - virtual ~NetChartType(); - - APPHELPER_XSERVICEINFO_DECL() - - /// establish methods for factory instatiation - APPHELPER_SERVICE_FACTORY_HELPER( NetChartType ) + virtual ~NetChartType_Base(); protected: - explicit NetChartType( const NetChartType & rOther ); + explicit NetChartType_Base( const NetChartType_Base & rOther ); // ____ XChartType ____ - virtual ::rtl::OUString SAL_CALL getChartType() - throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > SAL_CALL createCoordinateSystem( ::sal_Int32 DimensionCount ) throw (::com::sun::star::lang::IllegalArgumentException, @@ -63,13 +56,34 @@ protected: virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const throw(::com::sun::star::beans::UnknownPropertyException); - // ____ OPropertySet ____ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); // ____ XPropertySet ____ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); +}; + +//------------------------------------------------------------------------------------- + +class NetChartType : public NetChartType_Base +{ +public: + NetChartType( ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > const & xContext ); + virtual ~NetChartType(); + + APPHELPER_XSERVICEINFO_DECL() + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( NetChartType ) + +protected: + explicit NetChartType( const NetChartType & rOther ); + + // ____ XChartType ____ + virtual ::rtl::OUString SAL_CALL getChartType() + throw (::com::sun::star::uno::RuntimeException); // ____ XCloneable ____ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx index e348b32b7bc6..9b2c089b7298 100644 --- a/chart2/source/model/template/NetChartTypeTemplate.cxx +++ b/chart2/source/model/template/NetChartTypeTemplate.cxx @@ -64,11 +64,13 @@ NetChartTypeTemplate::NetChartTypeTemplate( const ::rtl::OUString & rServiceName, StackMode eStackMode, bool bSymbols, - bool bHasLines ) : + bool bHasLines , + bool bHasFilledArea ) : ChartTypeTemplate( xContext, rServiceName ), m_eStackMode( eStackMode ), m_bHasSymbols( bSymbols ), - m_bHasLines( bHasLines ) + m_bHasLines( bHasLines ), + m_bHasFilledArea( bHasFilledArea ) {} NetChartTypeTemplate::~NetChartTypeTemplate() @@ -110,11 +112,18 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate( { sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram, bAdaptProperties ); - // check symbol-style - // for a template with symbols it is ok, if there is at least one series - // with symbols, otherwise an unknown template is too easy to achieve + uno::Reference< beans::XPropertySet > xChartTypeProp( + DiagramHelper::getChartTypeByIndex( xDiagram, 0 ), uno::UNO_QUERY_THROW ); + if( bResult ) { + //filled net chart?: + if( m_bHasFilledArea ) + return sal_True; + + // check symbol-style + // for a template with symbols it is ok, if there is at least one series + // with symbols, otherwise an unknown template is too easy to achieve bool bSymbolFound = false; bool bLineFound = false; @@ -182,8 +191,13 @@ Reference< chart2::XChartType > NetChartTypeTemplate::getChartTypeForIndex( sal_ { Reference< lang::XMultiServiceFactory > xFact( GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW ); - xResult.set( xFact->createInstance( - CHART2_SERVICE_NAME_CHARTTYPE_NET ), uno::UNO_QUERY_THROW ); + + if( m_bHasFilledArea ) + xResult.set( xFact->createInstance( + CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ), uno::UNO_QUERY_THROW ); + else + xResult.set( xFact->createInstance( + CHART2_SERVICE_NAME_CHARTTYPE_NET ), uno::UNO_QUERY_THROW ); } catch( uno::Exception & ex ) { diff --git a/chart2/source/model/template/NetChartTypeTemplate.hxx b/chart2/source/model/template/NetChartTypeTemplate.hxx index 0e963b8d4500..9c17e6639497 100644 --- a/chart2/source/model/template/NetChartTypeTemplate.hxx +++ b/chart2/source/model/template/NetChartTypeTemplate.hxx @@ -45,7 +45,8 @@ public: const ::rtl::OUString & rServiceName, StackMode eStackMode, bool bSymbols, - bool bHasLines = true + bool bHasLines = true, + bool bHasFilledArea = false ); virtual ~NetChartTypeTemplate(); @@ -80,6 +81,7 @@ private: StackMode m_eStackMode; bool m_bHasSymbols; bool m_bHasLines; + bool m_bHasFilledArea; }; } // namespace chart diff --git a/chart2/source/model/template/_serviceregistration_charttypes.cxx b/chart2/source/model/template/_serviceregistration_charttypes.cxx index 6e5960410445..7b739ca73830 100644 --- a/chart2/source/model/template/_serviceregistration_charttypes.cxx +++ b/chart2/source/model/template/_serviceregistration_charttypes.cxx @@ -39,6 +39,7 @@ #include "ColumnChartType.hxx" #include "LineChartType.hxx" #include "NetChartType.hxx" +#include "FilledNetChartType.hxx" #include "PieChartType.hxx" #include "ScatterChartType.hxx" #include "BubbleChartType.hxx" @@ -95,6 +96,14 @@ static struct ::cppu::ImplementationEntry g_entries_chart2_charttypes[] = , 0 , 0 } + ,{ + ::chart::FilledNetChartType::create + , ::chart::FilledNetChartType::getImplementationName_Static + , ::chart::FilledNetChartType::getSupportedServiceNames_Static + , ::cppu::createSingleComponentFactory + , 0 + , 0 + } ,{ ::chart::PieChartType::create , ::chart::PieChartType::getImplementationName_Static diff --git a/chart2/source/model/template/makefile.mk b/chart2/source/model/template/makefile.mk index ad8fcd552c8d..63367014ed6b 100644 --- a/chart2/source/model/template/makefile.mk +++ b/chart2/source/model/template/makefile.mk @@ -63,6 +63,7 @@ SLOFILES= \ $(SLO)$/ColumnChartType.obj \ $(SLO)$/ColumnLineChartTypeTemplate.obj \ $(SLO)$/DataInterpreter.obj \ + $(SLO)$/FilledNetChartType.obj \ $(SLO)$/LineChartType.obj \ $(SLO)$/LineChartTypeTemplate.obj \ $(SLO)$/NetChartType.obj \ diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index 357cf5c43d92..9e521fa76dae 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -106,6 +106,8 @@ sal_Bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference< return sal_False; if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) return sal_False; + if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + return sal_False; if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) return sal_False; if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) //todo: BubbleChart support error bars and trend lines @@ -197,6 +199,8 @@ sal_Bool ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference< XChar return sal_False; if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) return sal_False; + if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + return sal_False; } return sal_True; } @@ -335,14 +339,21 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) { - aRet.realloc(5); + aRet.realloc(6); sal_Int32* pSeq = aRet.getArray(); + *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE; *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::TOP; *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::BOTTOM; *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::LEFT; *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::RIGHT; *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::CENTER; } + else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + { + aRet.realloc(1); + sal_Int32* pSeq = aRet.getArray(); + *pSeq++ = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE; + } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) { aRet.realloc( 1 ); @@ -399,6 +410,8 @@ bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference< chart2: rtl::OUString aChartTypeName = xChartType->getChartType(); if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) return false; + if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + return false; } if( nDimensionCount==3 ) return nDimensionIndex<2; @@ -579,7 +592,8 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( *pSeq++ = ::com::sun::star::chart::MissingValueTreatment::CONTINUE; } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_LINE) || - aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET)) + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) || + aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) { aRet.realloc( bStacked ? 2 : 3 ); sal_Int32* pSeq = aRet.getArray(); @@ -609,6 +623,17 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( return aRet; } +bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const uno::Reference< XChartType >& xChartType ) +{ + if( xChartType.is() ) + { + rtl::OUString aChartTypeName = xChartType->getChartType(); + if( aChartTypeName.match( CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ) ) + return false; + } + return true; +} + rtl::OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const uno::Reference< XChartType >& xChartType ) { rtl::OUString aRet( C2U( "values-y" ) ); diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx index 692f6ee54a1b..9452763153a5 100644 --- a/chart2/source/tools/CommonConverters.cxx +++ b/chart2/source/tools/CommonConverters.cxx @@ -223,6 +223,29 @@ drawing::Position3D getPointFromPoly( const drawing::PolyPolygonShape3D& rPolygo return aRet; } +void addPolygon( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd ) +{ + sal_Int32 nAddOuterCount = rAdd.SequenceX.getLength(); + sal_Int32 nOuterCount = rRet.SequenceX.getLength() + nAddOuterCount; + rRet.SequenceX.realloc( nOuterCount ); + rRet.SequenceY.realloc( nOuterCount ); + rRet.SequenceZ.realloc( nOuterCount ); + + sal_Int32 nIndex = 0; + sal_Int32 nOuter = nOuterCount - nAddOuterCount; + for( ; nOuter < nOuterCount; nOuter++ ) + { + if( nIndex >= nAddOuterCount ) + break; + + rRet.SequenceX[nOuter] = rAdd.SequenceX[nIndex]; + rRet.SequenceY[nOuter] = rAdd.SequenceY[nIndex]; + rRet.SequenceZ[nOuter] = rAdd.SequenceZ[nIndex]; + + nIndex++; + } +} + void appendPoly( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd ) { sal_Int32 nOuterCount = Max( rRet.SequenceX.getLength(), rAdd.SequenceX.getLength() ); diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index ac2a32f93298..fbc8042af27b 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -1320,6 +1320,8 @@ bool DiagramHelper::isSupportingFloorAndWall( const Reference< return false; if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) return false; + if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + return false; } return true; } diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index 6e43ebc75b67..47cc6de405f7 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -112,7 +112,8 @@ VCoordinateSystem::~VCoordinateSystem() void SAL_CALL VCoordinateSystem::initPlottingTargets( const Reference< drawing::XShapes >& xLogicTarget , const Reference< drawing::XShapes >& xFinalTarget - , const Reference< lang::XMultiServiceFactory >& xShapeFactory ) + , const Reference< lang::XMultiServiceFactory >& xShapeFactory + , Reference< drawing::XShapes >& xLogicTargetForSeriesBehindAxis ) throw (uno::RuntimeException) { DBG_ASSERT(xLogicTarget.is()&&xFinalTarget.is()&&xShapeFactory.is(),"no proper initialization parameters"); @@ -125,12 +126,14 @@ void SAL_CALL VCoordinateSystem::initPlottingTargets( const Reference< drawing: { //create and add to target m_xLogicTargetForGrids = aShapeFactory.createGroup2D( xLogicTarget ); + xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup2D( xLogicTarget ); m_xLogicTargetForAxes = aShapeFactory.createGroup2D( xLogicTarget ); } else { //create and added to target m_xLogicTargetForGrids = aShapeFactory.createGroup3D( xLogicTarget ); + xLogicTargetForSeriesBehindAxis = aShapeFactory.createGroup3D( xLogicTarget ); m_xLogicTargetForAxes = aShapeFactory.createGroup3D( xLogicTarget ); } m_xFinalTarget = xFinalTarget; diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 0b1a17ca7701..406e5d119cd6 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -45,6 +45,7 @@ #include "LabelPositionHelper.hxx" #include "Clipping.hxx" #include "Stripe.hxx" +#include "PolarLabelPositionHelper.hxx" #include #include @@ -84,6 +85,7 @@ AreaChart::AreaChart( const uno::Reference& xChartTypeModel , m_bArea(!bNoArea) , m_bLine(bNoArea) , m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) ) + , m_bIsPolarCooSys( bConnectLastToFirstPoint ) , m_bConnectLastToFirstPoint( bConnectLastToFirstPoint ) , m_bAddOneToXMax(bAddOneToXMax) , m_bExpandIfValuesCloseToBorder( bExpandIfValuesCloseToBorder ) @@ -230,7 +232,7 @@ bool AreaChart::keepAspectRatio() const void AreaChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot ) { - if( m_bArea && pSeries ) + if( m_bArea && !m_bIsPolarCooSys && pSeries ) { sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment(); if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP ) @@ -432,7 +434,12 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries drawing::PolyPolygonShape3D aPoly( *pSeriesPoly ); //add second part to the polygon (grounding points or previous series points) - if(!pPreviousSeriesPoly) + if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) ) + { + if( pPreviousSeriesPoly ) + addPolygon( aPoly, *pPreviousSeriesPoly ); + } + else if(!pPreviousSeriesPoly) { double fMinX = pSeries->m_fLogicMinX; double fMaxX = pSeries->m_fLogicMaxX; @@ -726,6 +733,22 @@ void AreaChart::createShapes() double fLogicX = (*aSeriesIter)->getXValue(nIndex); double fLogicY = (*aSeriesIter)->getYValue(nIndex); + if( m_bIsPolarCooSys && m_bArea && + ( ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) ) ) + { + if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP ) + { + if( pSeriesList->size() == 1 || nSeriesIndex == 0 ) + { + fLogicY = pPosHelper->getLogicMinY(); + if( !pPosHelper->isMathematicalOrientationY() ) + fLogicY = pPosHelper->getLogicMaxY(); + } + else + fLogicY = 0.0; + } + } + if( m_nDimension==3 && m_bArea && pSeriesList->size()!=1 ) fLogicY = fabs( fLogicY ); @@ -797,8 +820,22 @@ void AreaChart::createShapes() //store point information for series polygon //for area and/or line (symbols only do not need this) if( isValidPosition(aScaledLogicPosition) ) + { AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex ); + //prepare clipping for filled net charts + if( !bIsVisible && m_bIsPolarCooSys && m_bArea ) + { + drawing::Position3D aClippedPos(aScaledLogicPosition); + pPosHelper->clipScaledLogicValues( 0, &aClippedPos.PositionY, 0 ); + if( pPosHelper->isLogicVisible( aClippedPos.PositionX, aClippedPos.PositionY, aClippedPos.PositionZ ) ) + { + AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aClippedPos, (*aSeriesIter)->m_nPolygonIndex ); + AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex ); + } + } + } + //create a single datapoint if point is visible //apply clipping: if( !bIsVisible ) @@ -909,12 +946,29 @@ void AreaChart::createShapes() break; } + awt::Point aScreenPosition2D;//get the screen position for the labels + sal_Int32 nOffset = 100; //todo maybe calculate this font height dependent + if( m_bIsPolarCooSys && nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::OUTSIDE ) + { + PolarPlottingPositionHelper* pPolarPosHelper = dynamic_cast(pPosHelper); + if( pPolarPosHelper ) + { + PolarLabelPositionHelper aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory); + aScreenPosition2D = awt::Point( aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues( + eAlignment, fLogicX, fLogicY, fLogicZ, nOffset )); + } + } + else + { + if(LABEL_ALIGN_CENTER==eAlignment || m_nDimension == 3 ) + nOffset = 0; + aScreenPosition2D = awt::Point( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory) + .transformSceneToScreenPosition( aScenePosition3D ) ); + } - awt::Point aScreenPosition2D( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory) - .transformSceneToScreenPosition( aScenePosition3D ) ); this->createDataLabel( m_xTextTarget, **aSeriesIter, nIndex , fLogicValueForLabeDisplay - , aLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment ); + , aLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment, nOffset ); } } diff --git a/chart2/source/view/charttypes/AreaChart.hxx b/chart2/source/view/charttypes/AreaChart.hxx index ec56d9e2390b..ec90e92ba1a4 100644 --- a/chart2/source/view/charttypes/AreaChart.hxx +++ b/chart2/source/view/charttypes/AreaChart.hxx @@ -110,9 +110,11 @@ private: //member bool m_bArea;//false -> line or symbol only bool m_bLine; bool m_bSymbol; + bool m_bIsPolarCooSys;//used e.g. for net chart (the data labels need to be placed different) bool m_bConnectLastToFirstPoint;//used e.g. for net chart bool m_bAddOneToXMax;//used e.g. for net chart (the angle axis needs a different autoscaling) bool m_bExpandIfValuesCloseToBorder; // e.g. false for net charts + sal_Int32 m_nKeepAspectRatio; //0->no 1->yes other value->automatic ::com::sun::star::drawing::Direction3D m_aGivenAspectRatio; //only used if nKeepAspectRatio==1 diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 73fa9039bf44..c8f473d226d0 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1726,6 +1726,11 @@ bool VSeriesPlotter::PointsWereSkipped() const return m_bPointsWereSkipped; } +bool VSeriesPlotter::WantToPlotInFrontOfAxisLine() +{ + return ChartTypeHelper::isSeriesInFrontOfAxisLine( m_xChartTypeModel ); +} + Sequence< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntries( LegendExpansion eLegendExpansion , const Reference< beans::XPropertySet >& xTextProperties @@ -2070,6 +2075,8 @@ VSeriesPlotter* VSeriesPlotter::createSeriesPlotter( pRet = new PieChart(xChartTypeModel,nDimensionCount); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,true,new PolarPlottingPositionHelper(),true,true,false,1,drawing::Direction3D(1,1,1) ); + else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + pRet = new AreaChart(xChartTypeModel,nDimensionCount,true,false,new PolarPlottingPositionHelper(),true,true,false,1,drawing::Direction3D(1,1,1) ); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) pRet = new CandleStickChart(xChartTypeModel,nDimensionCount); else diff --git a/chart2/source/view/inc/VCoordinateSystem.hxx b/chart2/source/view/inc/VCoordinateSystem.hxx index f9a575be0123..111b1cb02f99 100644 --- a/chart2/source/view/inc/VCoordinateSystem.hxx +++ b/chart2/source/view/inc/VCoordinateSystem.hxx @@ -74,7 +74,9 @@ public: , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xFinalTarget , const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) + ::com::sun::star::lang::XMultiServiceFactory >& xFactory + , ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShapes >& xLogicTargetForSeriesBehindAxis ) throw (::com::sun::star::uno::RuntimeException); void setParticle( const rtl::OUString& rCooSysParticle ); diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index eeb561b13f02..e94ef6c68687 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -296,6 +296,8 @@ public: virtual void rearrangeLabelToAvoidOverlapIfRequested( const ::com::sun::star::awt::Size& rPageSize ); + bool WantToPlotInFrontOfAxisLine(); + //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 7098e150a175..dfd57f9bce92 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1377,12 +1377,13 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo drawing::Direction3D aPreferredAspectRatio( rSeriesPlotterContainer.getPreferredAspectRatio() ); - uno::Reference< drawing::XShapes > xCoordinateRegionTarget(0); + uno::Reference< drawing::XShapes > xSeriesTargetInFrontOfAxis(0); + uno::Reference< drawing::XShapes > xSeriesTargetBehindAxis(0); VDiagram aVDiagram(xDiagram, aPreferredAspectRatio, nDimensionCount); {//create diagram aVDiagram.init(xDiagramPlusAxes_Shapes,xDiagramPlusAxes_Shapes,m_xShapeFactory); aVDiagram.createShapes(rAvailablePos,rAvailableSize); - xCoordinateRegionTarget = aVDiagram.getCoordinateRegion(); + xSeriesTargetInFrontOfAxis = aVDiagram.getCoordinateRegion(); aVDiagram.reduceToMimimumSize(); } @@ -1394,7 +1395,7 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo for( nC=0; nC < rVCooSysList.size(); nC++) { VCoordinateSystem* pVCooSys = rVCooSysList[nC]; - pVCooSys->initPlottingTargets(xCoordinateRegionTarget,xTextTargetShapes,m_xShapeFactory); + pVCooSys->initPlottingTargets(xSeriesTargetInFrontOfAxis,xTextTargetShapes,m_xShapeFactory,xSeriesTargetBehindAxis); pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix( createTransformationSceneToScreen( aVDiagram.getCurrentRectangle() ) )); @@ -1469,7 +1470,15 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo //------------ set transformation to plotter / create series VSeriesPlotter* pSeriesPlotter = *aPlotterIter; rtl::OUString aCID; //III - pSeriesPlotter->initPlotter(xCoordinateRegionTarget,xTextTargetShapes,m_xShapeFactory,aCID); + uno::Reference< drawing::XShapes > xSeriesTarget(0); + if( pSeriesPlotter->WantToPlotInFrontOfAxisLine() ) + xSeriesTarget = xSeriesTargetInFrontOfAxis; + else + { + xSeriesTarget = xSeriesTargetBehindAxis; + DBG_ASSERT( !lcl_resizeAfterCompleteCreation(xDiagram), "not implemented yet! - during a complete recreation this shape is destroyed so no series can be created anymore" ); + } + pSeriesPlotter->initPlotter( xSeriesTarget,xTextTargetShapes,m_xShapeFactory,aCID ); pSeriesPlotter->setPageReferenceSize( rPageSize ); VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( rVCooSysList, pSeriesPlotter ); if(2==nDimensionCount) @@ -1503,7 +1512,8 @@ void ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlo } //clear and recreate - ShapeFactory::removeSubShapes( xCoordinateRegionTarget ); + ShapeFactory::removeSubShapes( xSeriesTargetInFrontOfAxis ); //xSeriesTargetBehindAxis is a sub shape of xSeriesTargetInFrontOfAxis and will be removed here + xSeriesTargetBehindAxis.clear(); ShapeFactory::removeSubShapes( xTextTargetShapes ); //set new transformation diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx index dfe74405fbf6..d5664c088e29 100644 --- a/sc/source/filter/excel/xlchart.cxx +++ b/sc/source/filter/excel/xlchart.cxx @@ -504,35 +504,36 @@ const XclChFormatInfo& XclChFormatInfoProvider::GetFormatInfo( XclChObjectType e namespace { // chart type service names -const sal_Char SERVICE_CHART2_AREA[] = "com.sun.star.chart2.AreaChartType"; -const sal_Char SERVICE_CHART2_CANDLE[] = "com.sun.star.chart2.CandleStickChartType"; -const sal_Char SERVICE_CHART2_COLUMN[] = "com.sun.star.chart2.ColumnChartType"; -const sal_Char SERVICE_CHART2_LINE[] = "com.sun.star.chart2.LineChartType"; -const sal_Char SERVICE_CHART2_NET[] = "com.sun.star.chart2.NetChartType"; -const sal_Char SERVICE_CHART2_PIE[] = "com.sun.star.chart2.PieChartType"; -const sal_Char SERVICE_CHART2_SCATTER[] = "com.sun.star.chart2.ScatterChartType"; -const sal_Char SERVICE_CHART2_BUBBLE[] = "com.sun.star.chart2.BubbleChartType"; -const sal_Char SERVICE_CHART2_SURFACE[] = "com.sun.star.chart2.ColumnChartType"; // Todo +const sal_Char SERVICE_CHART2_AREA[] = "com.sun.star.chart2.AreaChartType"; +const sal_Char SERVICE_CHART2_CANDLE[] = "com.sun.star.chart2.CandleStickChartType"; +const sal_Char SERVICE_CHART2_COLUMN[] = "com.sun.star.chart2.ColumnChartType"; +const sal_Char SERVICE_CHART2_LINE[] = "com.sun.star.chart2.LineChartType"; +const sal_Char SERVICE_CHART2_NET[] = "com.sun.star.chart2.NetChartType"; +const sal_Char SERVICE_CHART2_FILLEDNET[] = "com.sun.star.chart2.FilledNetChartType"; +const sal_Char SERVICE_CHART2_PIE[] = "com.sun.star.chart2.PieChartType"; +const sal_Char SERVICE_CHART2_SCATTER[] = "com.sun.star.chart2.ScatterChartType"; +const sal_Char SERVICE_CHART2_BUBBLE[] = "com.sun.star.chart2.BubbleChartType"; +const sal_Char SERVICE_CHART2_SURFACE[] = "com.sun.star.chart2.ColumnChartType"; // Todo namespace csscd = ::com::sun::star::chart::DataLabelPlacement; static const XclChTypeInfo spTypeInfos[] = { - // chart type chart type category record id service varied point color def label pos comb2d 3d polar area2d area3d 1stvis xcateg swap stack revers betw - { EXC_CHTYPEID_BAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true }, - { EXC_CHTYPEID_HORBAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, false, true, false, true, true, false, true, true, true, false, true }, - { EXC_CHTYPEID_LINE, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_LINE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, true, false, false, true, false, true, false, true, false, false }, - { EXC_CHTYPEID_AREA, EXC_CHTYPECATEG_LINE, EXC_ID_CHAREA, SERVICE_CHART2_AREA, EXC_CHVARPOINT_NONE, csscd::CENTER, true, true, false, true, true, false, true, false, true, true, false }, - { EXC_CHTYPEID_STOCK, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_CANDLE, EXC_CHVARPOINT_NONE, csscd::RIGHT, true, false, false, false, false, false, true, false, true, false, false }, - { EXC_CHTYPEID_RADARLINE, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARLINE, SERVICE_CHART2_NET, EXC_CHVARPOINT_SINGLE, csscd::TOP, false, false, true, false, true, false, true, false, false, false, false }, - { EXC_CHTYPEID_RADARAREA, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARAREA, SERVICE_CHART2_NET, EXC_CHVARPOINT_NONE, csscd::TOP, false, false, true, true, true, false, true, false, false, false, false }, - { EXC_CHTYPEID_PIE, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, true, true, false, false, false, false }, - { EXC_CHTYPEID_DONUT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, false, true, false, false, true, false }, - { EXC_CHTYPEID_PIEEXT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIEEXT, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, false, true, true, true, true, true, false, false, false, false }, - { EXC_CHTYPEID_SCATTER, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_SCATTER, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, false, false, false, true, false, false, false, false, false, false }, - { EXC_CHTYPEID_BUBBLES, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_BUBBLE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, false, false, false, true, true, false, false, false, false, false, false }, - { EXC_CHTYPEID_SURFACE, EXC_CHTYPECATEG_SURFACE, EXC_ID_CHSURFACE, SERVICE_CHART2_SURFACE, EXC_CHVARPOINT_NONE, csscd::RIGHT, false, true, false, true, true, false, true, false, false, false, false }, - { EXC_CHTYPEID_UNKNOWN, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true } + // chart type chart type category record id service varied point color def label pos comb2d 3d polar area2d area3d 1stvis xcateg swap stack revers betw + { EXC_CHTYPEID_BAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true }, + { EXC_CHTYPEID_HORBAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, false, true, false, true, true, false, true, true, true, false, true }, + { EXC_CHTYPEID_LINE, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_LINE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, true, false, false, true, false, true, false, true, false, false }, + { EXC_CHTYPEID_AREA, EXC_CHTYPECATEG_LINE, EXC_ID_CHAREA, SERVICE_CHART2_AREA, EXC_CHVARPOINT_NONE, csscd::CENTER, true, true, false, true, true, false, true, false, true, true, false }, + { EXC_CHTYPEID_STOCK, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_CANDLE, EXC_CHVARPOINT_NONE, csscd::RIGHT, true, false, false, false, false, false, true, false, true, false, false }, + { EXC_CHTYPEID_RADARLINE, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARLINE, SERVICE_CHART2_NET, EXC_CHVARPOINT_SINGLE, csscd::TOP, false, false, true, false, true, false, true, false, false, false, false }, + { EXC_CHTYPEID_RADARAREA, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARAREA, SERVICE_CHART2_FILLEDNET, EXC_CHVARPOINT_NONE, csscd::TOP, false, false, true, true, true, false, true, false, false, true, false }, + { EXC_CHTYPEID_PIE, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, true, true, false, false, false, false }, + { EXC_CHTYPEID_DONUT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, false, true, false, false, true, false }, + { EXC_CHTYPEID_PIEEXT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIEEXT, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, false, true, true, true, true, true, false, false, false, false }, + { EXC_CHTYPEID_SCATTER, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_SCATTER, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, false, false, false, true, false, false, false, false, false, false }, + { EXC_CHTYPEID_BUBBLES, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_BUBBLE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, false, false, false, true, true, false, false, false, false, false, false }, + { EXC_CHTYPEID_SURFACE, EXC_CHTYPECATEG_SURFACE, EXC_ID_CHSURFACE, SERVICE_CHART2_SURFACE, EXC_CHVARPOINT_NONE, csscd::RIGHT, false, true, false, true, true, false, true, false, false, false, false }, + { EXC_CHTYPEID_UNKNOWN, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true } }; } // namespace -- cgit From c1b45151c3c75e2cce692e78d815e33187ccd95f Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Wed, 26 Aug 2009 12:47:18 +0000 Subject: CWS-TOOLING: integrate CWS chart40 2009-08-05 10:28:53 +0200 iha r274640 : CWS-TOOLING: rebase CWS chart40 to trunk@274622 (milestone: DEV300:m54) 2009-07-31 18:03:11 +0200 iha r274546 : #i91420# number of lines on chart type dialog is incorrect 2009-07-23 15:51:13 +0200 iha r274275 : correct detection of old chart files b6700820 2009-07-23 15:10:30 +0200 iha r274273 : #i103287# some lines vanish on import of some old files (opacity-problem) 2009-07-23 13:42:10 +0200 iha r274268 : #i103588# Chart in report cause crash 2009-07-23 10:57:14 +0200 iha r274264 : #i95503# Enter key does not work in source ranges dialog 2009-07-22 10:25:02 +0200 iha r274221 : #i103713# ambiguous && || 2009-07-20 12:59:02 +0200 iha r274120 : #i103468# remove warning --- .../source/controller/dialogs/dlg_DataSource.cxx | 13 ++++++++++++ chart2/source/controller/dialogs/tp_ChartType.cxx | 3 ++- chart2/source/controller/dialogs/tp_DataSource.cxx | 23 ++++++++++++++++++++++ chart2/source/controller/dialogs/tp_DataSource.hxx | 7 +++++++ .../source/controller/dialogs/tp_RangeChooser.cxx | 23 ++++++++++++++++++++++ .../source/controller/dialogs/tp_RangeChooser.hxx | 6 ++++++ chart2/source/controller/inc/dlg_DataSource.hxx | 3 +++ chart2/source/view/charttypes/BubbleChart.cxx | 4 ++-- chart2/source/view/main/VDataSeries.cxx | 2 +- 9 files changed, 80 insertions(+), 4 deletions(-) diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx index 1d76a106d72b..1aa7db1f0f17 100644 --- a/chart2/source/controller/dialogs/dlg_DataSource.cxx +++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx @@ -202,6 +202,19 @@ DataSourceDialog::~DataSourceDialog() delete m_pTabControl; } +short DataSourceDialog::Execute() +{ + short nResult = TabDialog::Execute(); + if( nResult == RET_OK ) + { + if( m_pRangeChooserTabePage ) + m_pRangeChooserTabePage->commitPage(); + if( m_pDataSourceTabPage ) + m_pDataSourceTabPage->commitPage(); + } + return nResult; +} + void DataSourceDialog::setInvalidPage( TabPage * pTabPage ) { if( pTabPage == m_pRangeChooserTabePage ) diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx index b2d64400ef98..c35f11546d36 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.cxx +++ b/chart2/source/controller/dialogs/tp_ChartType.cxx @@ -995,7 +995,8 @@ IMPL_LINK( ChartTypeTabPage, SelectMainTypeHdl, void *, EMPTYARG ) aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel ); this->fillAllControls( aParameter ); - m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel); + uno::Reference< beans::XPropertySet > xTemplateProps( this->getCurrentTemplate(), uno::UNO_QUERY ); + m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel,xTemplateProps); } return 0; } diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index f499e2acc23a..ff858c5bfdf5 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -377,6 +377,29 @@ void DataSourceTabPage::initializePage() { } +void DataSourceTabPage::DeactivatePage() +{ + commitPage(); + svt::OWizardPage::DeactivatePage(); +} + +void DataSourceTabPage::commitPage() +{ + commitPage(eFinish); +} + +sal_Bool DataSourceTabPage::commitPage( CommitPageReason /*eReason*/ ) +{ + //ranges may have been edited in the meanwhile (dirty is true in that case here) + if( isValid() ) + { + updateModelFromControl( 0 /*update all*/ ); + return sal_True;//return false if this page should not be left + } + else + return sal_False; +} + bool DataSourceTabPage::isRangeFieldContentValid( Edit & rEdit ) { OUString aRange( rEdit.GetText()); diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx index 2703836d5d1d..6c42f1cb98e2 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.hxx +++ b/chart2/source/controller/dialogs/tp_DataSource.hxx @@ -87,8 +87,15 @@ public: bool bHideDescription = false ); virtual ~DataSourceTabPage(); + void commitPage(); + +protected: // OWizardPage virtual void ActivatePage(); + virtual sal_Bool commitPage( CommitPageReason eReason ); + + //TabPage + virtual void DeactivatePage(); virtual void initializePage(); diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx index 2c2bc3fc6892..8ba4d61a8057 100644 --- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx +++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx @@ -216,6 +216,29 @@ void RangeChooserTabPage::initControlsFromModel() m_nChangingControlCalls--; } +void RangeChooserTabPage::DeactivatePage() +{ + commitPage(); + svt::OWizardPage::DeactivatePage(); +} + +void RangeChooserTabPage::commitPage() +{ + commitPage(eFinish); +} + +sal_Bool RangeChooserTabPage::commitPage( CommitPageReason /*eReason*/ ) +{ + //ranges may have been edited in the meanwhile (dirty is true in that case here) + if( isValid() ) + { + changeDialogModelAccordingToControls(); + return sal_True;//return false if this page should not be left + } + else + return sal_False; +} + void RangeChooserTabPage::changeDialogModelAccordingToControls() { if(m_nChangingControlCalls>0) diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hxx b/chart2/source/controller/dialogs/tp_RangeChooser.hxx index 01062ba4c0f1..bb508da8d9a1 100644 --- a/chart2/source/controller/dialogs/tp_RangeChooser.hxx +++ b/chart2/source/controller/dialogs/tp_RangeChooser.hxx @@ -70,10 +70,16 @@ virtual ~RangeChooserTabPage(); virtual void listeningFinished( const ::rtl::OUString & rNewRange ); virtual void disposingRangeSelection(); + void commitPage(); + protected: //methods //OWizardPage virtual void ActivatePage(); + virtual sal_Bool commitPage( CommitPageReason eReason ); + + //TabPage + virtual void DeactivatePage(); void initControlsFromModel(); void changeDialogModelAccordingToControls(); diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx index cfbe7aa561e8..331136607e75 100644 --- a/chart2/source/controller/inc/dlg_DataSource.hxx +++ b/chart2/source/controller/inc/dlg_DataSource.hxx @@ -68,6 +68,9 @@ public: ::com::sun::star::uno::XComponentContext > & xContext ); virtual ~DataSourceDialog(); + // from Dialog (base of TabDialog) + virtual short Execute(); + // TabPageNotifiable virtual void setInvalidPage( TabPage * pTabPage ); virtual void setValidPage( TabPage * pTabPage ); diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index b63603ef403a..6069189ff0ac 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -111,7 +111,7 @@ void BubbleChart::calculateMaximumLogicBubbleSize() double fSize = pSeries->getBubble_Size( nIndex ); if( m_bShowNegativeValues ) - fSize = abs(fSize); + fSize = fabs(fSize); if( fSize > fMaxSize ) fMaxSize = fSize; } @@ -146,7 +146,7 @@ drawing::Direction3D BubbleChart::transformToScreenBubbleSize( double fLogicSize return aRet; if( m_bShowNegativeValues ) - fLogicSize = abs(fLogicSize); + fLogicSize = fabs(fLogicSize); double fMaxSize = m_fMaxLogicBubbleSize; diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index d2456110b79b..abe8fad1a942 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -151,7 +151,7 @@ void lcl_clearIfNoValuesButTextIsContained( VDataSequence& rData, const uno::Ref void lcl_maybeReplaceNanWithZero( double& rfValue, sal_Int32 nMissingValueTreatment ) { if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::USE_ZERO - && ::rtl::math::isNan(rfValue) || ::rtl::math::isInf(rfValue) ) + && (::rtl::math::isNan(rfValue) || ::rtl::math::isInf(rfValue)) ) rfValue = 0.0; } -- cgit From 11ee54427f1c4f514556d39d888ec1b333d4d566 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Wed, 26 Aug 2009 13:37:34 +0000 Subject: CWS-TOOLING: integrate CWS swa11y32_2nd 2009-08-13 13:04:09 +0200 mav r274936 : #i104204# remove support for Ctrl-Tab 2009-08-13 09:59:22 +0200 od r274924 : #i93269# method - emit also object:state-changed:focus, if cursor is inside object 2009-08-11 12:15:11 +0200 tl r274851 : CWS-TOOLING: rebase CWS swa11y32_2nd to trunk@274622 (milestone: DEV300:m54) 2009-07-14 17:35:03 +0200 tl r273982 : 2009-07-10 10:46:39 +0200 tl r273879 : CWS-TOOLING: rebase CWS swa11y32 to trunk@273468 (milestone: DEV300:m51) 2009-07-01 14:00:25 +0200 mav r273577 : #i102879# the text of the button should not change 2009-07-01 13:16:19 +0200 od r273574 : #159496# method - do not release the solar mutex 2009-06-29 15:29:10 +0200 od r273476 : #i95042# method - return instance for instance of type . note: is inherited from 2009-06-23 15:49:32 +0200 mav r273283 : #i101967# fix tab-control implementation 2009-06-22 13:56:22 +0200 od r273229 : #i100938# method - always provide start_offset and end_offset - do _not_ increment the end_offset provide by instance 2009-06-02 12:09:03 +0200 mav r272492 : #i101959# Let the additional dialog window add its childred to the parents tab-hierarchy 2009-06-02 09:55:39 +0200 mav r272484 : #i102015# allow to have indirect child windows in tab-hierarchy 2009-06-02 09:49:42 +0200 mav r272482 : #i102015# Let the windows containing the extension dialog controls add controls to the tab hierarchy 2009-05-27 15:45:33 +0200 od r272354 : #i101012# method - emit vcl event LISTBOX_SELECT only in case that the given entry is selected. 2009-05-27 09:54:36 +0200 od r272333 : #i92103# map UNO-API accessible events list box entry expanded/collapsed to corresponding atk events. 2009-05-27 09:52:15 +0200 od r272331 : #i92103# process list box entry expanded/collapsed events 2009-05-27 09:49:19 +0200 od r272330 : #i92103# emit vcl event list box entry expanded/collapsed 2009-05-26 10:42:05 +0200 od r272283 : #i93269# correct fix: check success of call 2009-05-04 15:52:04 +0200 od r271469 : #i92103# new vcl event ids VCLEVENT_LISTBOX_ENTRY_EXPANDED and VCLEVENT_LISTBOX_ENTRY_COLLAPSED 2009-05-04 15:10:20 +0200 od r271460 : #i92103# refine definition of new constants 2009-05-04 14:36:44 +0200 od r271454 : #i92103# new constants for indicating that a list box entry is expanded respectively collapsed. 2009-04-30 16:09:40 +0200 od r271421 : #i93269# method - emit text_caret_moved event for object, if cursor is inside the object. 2009-04-22 14:00:10 +0200 tl r271105 : warning-free code 2009-04-22 09:17:30 +0200 tl r271073 : CWS-TOOLING: rebase CWS swa11y32 to trunk@270723 (milestone: DEV300:m46) 2009-04-20 12:53:03 +0200 cd r270974 : #i83639# Check extendedhelp state to provide correct tool tip text 2009-04-03 13:07:13 +0200 tl r270471 : #i63983# changed accessible object names to empty strings 2009-04-01 15:52:09 +0200 tl r270336 : #i90991# accessible names and description for paragraphs should be empty 2009-04-01 15:12:42 +0200 tl r270333 : #i90991# accessible names and description for paragraphs should be empty 2009-04-01 15:10:34 +0200 tl r270331 : warning-free code 2009-04-01 12:54:44 +0200 tl r270319 : #i89176# Implementation of XAccessibleMultiLineText in EditEngine 2009-04-01 12:52:56 +0200 tl r270318 : #i89176# Implementation of XAccessibleMultiLineText in EditEngine 2009-03-27 18:31:01 +0100 tbe r270166 : #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells 2009-03-13 13:43:54 +0100 tl r269476 : #i94322# ImpEditView::ShowCursor and nPara == USHRT_MAX problem fixed 2009-03-12 10:27:30 +0100 tl r269366 : warning-free code; unresolved external dbg_out when compiling with debug=t 2009-03-11 12:40:31 +0100 tl r269312 : warning-free code Solaris x86 2009-03-10 15:49:01 +0100 tl r269279 : #i86443# handle GetColumnCount() == 0 2009-03-10 10:48:32 +0100 cl r269254 : #i91742# name cells for accessibility 2009-03-09 17:06:33 +0100 cl r269203 : #i91742# call init on accessible cells --- sc/source/ui/Accessibility/AccessibleCell.cxx | 2 +- sc/source/ui/Accessibility/AccessibleText.cxx | 140 +++++++++++++++++++++++--- sc/source/ui/inc/AccessibleText.hxx | 4 +- 3 files changed, 128 insertions(+), 18 deletions(-) diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index 4e36c8df0196..4dbc47524276 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -371,7 +371,7 @@ ScDocument* ScAccessibleCell::GetDocument(ScTabViewShell* pViewShell) ::std::auto_ptr< SvxEditSource > ScAccessibleCell::CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos) { ::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData - (new ScAccessibleCellTextData(pViewShell, aCell, eSplitPos)); + ( new ScAccessibleCellTextData( pViewShell, aCell, eSplitPos, this ) ); ::std::auto_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(pAccessibleCellTextData)); return pEditSource; diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 18470475cebf..feeae8c73023 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -37,6 +37,7 @@ #include #include "AccessibleText.hxx" +#include "AccessibleCell.hxx" #include "tabvwsh.hxx" #include "editutil.hxx" #include "document.hxx" @@ -54,6 +55,7 @@ #include #include #include +#include // ============================================================================ @@ -753,13 +755,14 @@ void ScEditViewForwarder::SetInvalid() // ScAccessibleCellTextData: shared data between sub objects of a accessible cell text object ScAccessibleCellTextData::ScAccessibleCellTextData(ScTabViewShell* pViewShell, - const ScAddress& rP, ScSplitPos eSplitPos) + const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell) : ScAccessibleCellBaseTextData(GetDocShell(pViewShell), rP), mpViewForwarder(NULL), mpEditViewForwarder(NULL), mpViewShell(pViewShell), meSplitPos(eSplitPos), - mbViewEditEngine(sal_False) + mbViewEditEngine(sal_False), + mpAccessibleCell( pAccCell ) { } @@ -792,7 +795,7 @@ void ScAccessibleCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ScAccessibleTextData* ScAccessibleCellTextData::Clone() const { - return new ScAccessibleCellTextData(mpViewShell, aCellPos, meSplitPos); + return new ScAccessibleCellTextData( mpViewShell, aCellPos, meSplitPos, mpAccessibleCell ); } void ScAccessibleCellTextData::GetCellText(const ScAddress& rCellPos, String& rText) @@ -866,7 +869,8 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder() if (!bHasForwarder)*/ ScCellTextData::GetTextForwarder(); // creates Forwarder and EditEngine - if (pEditEngine && mpViewShell) + ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL ); + if ( pDoc && pEditEngine && mpViewShell ) { long nSizeX, nSizeY; mpViewShell->GetViewData()->GetMergeSizePixel( @@ -874,9 +878,39 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder() Size aSize(nSizeX, nSizeY); - Window* pWin = mpViewShell->GetWindowByPos(meSplitPos); - if (pWin) - aSize = pWin->PixelToLogic(aSize, pEditEngine->GetRefMapMode()); + // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells + long nIndent = 0; + const SvxHorJustifyItem* pHorJustifyItem = static_cast< const SvxHorJustifyItem* >( + pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_HOR_JUSTIFY ) ); + SvxCellHorJustify eHorJust = ( pHorJustifyItem ? static_cast< SvxCellHorJustify >( pHorJustifyItem->GetValue() ) : SVX_HOR_JUSTIFY_STANDARD ); + if ( eHorJust == SVX_HOR_JUSTIFY_LEFT ) + { + const SfxUInt16Item* pIndentItem = static_cast< const SfxUInt16Item* >( + pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_INDENT ) ); + if ( pIndentItem ) + { + nIndent = static_cast< long >( pIndentItem->GetValue() ); + } + } + + const SvxMarginItem* pMarginItem = static_cast< const SvxMarginItem* >( + pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_MARGIN ) ); + ScViewData* pViewData = mpViewShell->GetViewData(); + double nPPTX = ( pViewData ? pViewData->GetPPTX() : 0 ); + double nPPTY = ( pViewData ? pViewData->GetPPTY() : 0 ); + long nLeftM = ( pMarginItem ? static_cast< long >( ( pMarginItem->GetLeftMargin() + nIndent ) * nPPTX ) : 0 ); + long nTopM = ( pMarginItem ? static_cast< long >( pMarginItem->GetTopMargin() * nPPTY ) : 0 ); + long nRightM = ( pMarginItem ? static_cast< long >( pMarginItem->GetRightMargin() * nPPTX ) : 0 ); + long nBottomM = ( pMarginItem ? static_cast< long >( pMarginItem->GetBottomMargin() * nPPTY ) : 0 ); + long nWidth = aSize.getWidth() - nLeftM - nRightM; + aSize.setWidth( nWidth ); + aSize.setHeight( aSize.getHeight() - nTopM - nBottomM ); + + Window* pWin = mpViewShell->GetWindowByPos( meSplitPos ); + if ( pWin ) + { + aSize = pWin->PixelToLogic( aSize, pEditEngine->GetRefMapMode() ); + } /* #i19430# Gnopernicus reads text partly if it sticks out of the cell boundaries. This leads to wrong results in cases where the cell text @@ -888,20 +922,94 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder() return the size of the complete text then, which is used to expand the cell bounding box in ScAccessibleCell::GetBoundingBox() (see sc/source/ui/Accessibility/AccessibleCell.cxx). */ - if (pDocShell && pDocShell->GetDocument()) + const SfxInt32Item* pItem = static_cast< const SfxInt32Item* >( + pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_ROTATE_VALUE ) ); + if( pItem && (pItem->GetValue() != 0) ) + { + pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) ); + long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() ); + aSize.setWidth( std::max( aSize.getWidth(), nTxtWidth + 2 ) ); + } + else { - const SfxInt32Item* pItem = static_cast< const SfxInt32Item* >( - pDocShell->GetDocument()->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_ROTATE_VALUE ) ); - if( pItem && (pItem->GetValue() != 0) ) + // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells + const SfxBoolItem* pLineBreakItem = static_cast< const SfxBoolItem* >( + pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_LINEBREAK ) ); + bool bLineBreak = ( pLineBreakItem && pLineBreakItem->GetValue() ); + if ( !bLineBreak ) { - pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) ); - long nTextWidth = static_cast< long >( pEditEngine->CalcTextWidth() ); - aSize.setWidth( std::max( aSize.getWidth(), nTextWidth + 2 ) ); + long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() ); + aSize.setWidth( ::std::max( aSize.getWidth(), nTxtWidth ) ); } } - // #i70916# Text in spread sheet cells return the wrong extents - pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) ); + pEditEngine->SetPaperSize( aSize ); + + // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells + if ( eHorJust == SVX_HOR_JUSTIFY_STANDARD && pDoc->HasValueData( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) ) + { + pEditEngine->SetDefaultItem( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); + } + + Size aTextSize; + if ( pWin ) + { + aTextSize = pWin->LogicToPixel( Size( pEditEngine->CalcTextWidth(), pEditEngine->GetTextHeight() ), pEditEngine->GetRefMapMode() ); + } + long nTextWidth = aTextSize.Width(); + long nTextHeight = aTextSize.Height(); + + long nOffsetX = nLeftM; + long nDiffX = nTextWidth - nWidth; + if ( nDiffX > 0 ) + { + switch ( eHorJust ) + { + case SVX_HOR_JUSTIFY_RIGHT: + { + nOffsetX -= nDiffX; + } + break; + case SVX_HOR_JUSTIFY_CENTER: + { + nOffsetX -= nDiffX / 2; + } + break; + default: + { + } + break; + } + } + + long nOffsetY = 0; + const SvxVerJustifyItem* pVerJustifyItem = static_cast< const SvxVerJustifyItem* >( + pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_VER_JUSTIFY ) ); + SvxCellVerJustify eVerJust = ( pVerJustifyItem ? static_cast< SvxCellVerJustify >( pVerJustifyItem->GetValue() ) : SVX_VER_JUSTIFY_STANDARD ); + switch ( eVerJust ) + { + case SVX_VER_JUSTIFY_STANDARD: + case SVX_VER_JUSTIFY_BOTTOM: + { + nOffsetY = nSizeY - nBottomM - nTextHeight; + } + break; + case SVX_VER_JUSTIFY_CENTER: + { + nOffsetY = ( nSizeY - nTopM - nBottomM - nTextHeight ) / 2 + nTopM; + } + break; + default: + { + nOffsetY = nTopM; + } + break; + } + + if ( mpAccessibleCell ) + { + mpAccessibleCell->SetOffset( Point( nOffsetX, nOffsetY ) ); + } pEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) ); } diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx index 63e263a12f8a..a1138e869d3b 100644 --- a/sc/source/ui/inc/AccessibleText.hxx +++ b/sc/source/ui/inc/AccessibleText.hxx @@ -46,6 +46,7 @@ class ScEditViewForwarder; class ScPreviewShell; class EditTextObject; class ScCsvViewForwarder; +class ScAccessibleCell; // ============================================================================ @@ -103,7 +104,7 @@ class ScAccessibleCellTextData : public ScAccessibleCellBaseTextData { public: ScAccessibleCellTextData(ScTabViewShell* pViewShell, - const ScAddress& rP, ScSplitPos eSplitPos); + const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell); virtual ~ScAccessibleCellTextData(); virtual ScAccessibleTextData* Clone() const; @@ -123,6 +124,7 @@ private: ScTabViewShell* mpViewShell; ScSplitPos meSplitPos; sal_Bool mbViewEditEngine; + ScAccessibleCell* mpAccessibleCell; // prevent the using of this method of the base class ScSharedCellEditSource* GetOriginalSource() { return NULL; } -- cgit From 73eeb9abf364da2a669762c974e1ec3ce2f39c7b Mon Sep 17 00:00:00 2001 From: Release Engineers Date: Wed, 26 Aug 2009 14:41:39 +0000 Subject: CWS-TOOLING: integrate CWS aw075 2009-08-12 18:26:05 +0200 aw r274912 : #i97672# use SelectionMaximumLuminancePercent to limit the hilight color to be not too invisible 2009-08-12 18:25:53 +0200 aw r274911 : #i97672# use SelectionMaximumLuminancePercent to limit the hilight color to be not too invisible 2009-08-12 18:25:20 +0200 aw r274910 : #i97672# Added SelectionMaximumLuminancePercent to decide which maximum luminance for the selection color to accept from the system 2009-08-12 18:00:17 +0200 aw r274908 : #i97672# added SelectionMaximumLuminancePercent which limits the luminance of the system's selection color to a maximum luminance (default is 70) 2009-08-11 14:01:07 +0200 aw r274859 : #i104150# take over values from transparence percent field even when disabled 2009-08-11 13:59:33 +0200 aw r274858 : #i103500# corrected the transparent SC overlay pixel alignment 2009-08-11 12:42:46 +0200 jsk r274854 : #i103937# Added two new controls to options/view page for transparency and opacity 2009-08-10 16:20:02 +0200 aw r274823 : #i97672# Adapting MF_SELECTION to #i35956# 2009-08-04 17:50:42 +0200 aw r274626 : #i102109# need to use AlphaMask instead of Bitmap 2009-08-04 17:03:25 +0200 aw r274624 : #i103982# corrected OutlinerParaObject owvership in GetBackgroundTextForwarder() 2009-08-04 12:18:11 +0200 aw r274614 : #i97672# corrected warning due to member initialisation 2009-08-03 11:54:16 +0200 aw r274571 : #i99268# corrected SdrExchangeView::GetObjGraphic 2009-07-31 14:22:57 +0200 aw r274529 : #i101520# added support for not correct 3d polygons for 3D polygon object which is used over API from chart directly 2009-07-31 13:25:20 +0200 aw r274527 : #i97672# added disabling selection options when system does not support them; slightly corrected positions 2009-07-31 13:20:32 +0200 aw r274526 : #i102706# Do not merge closed polygons when converting MetaFiles to SdrObjects 2009-07-30 18:03:07 +0200 aw r274499 : #i102175# corrected 1870 degree rotation situation for MetaFile paints 2009-07-30 17:06:31 +0200 aw r274496 : #i103709# corrected HitTest for callouts and DrawingLayer text objects 2009-07-29 18:55:22 +0200 aw r274465 : #i102956# corrected CutFindProcessor to back-transform all found cuts to the starting 3D coordinate system 2009-07-29 13:38:40 +0200 aw r274448 : #i103720# corrected mpAsynchLoadEvent usage 2009-07-29 12:48:12 +0200 aw r274447 : #i96762# cleanup: spaces 2009-07-28 19:11:31 +0200 aw r274427 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 19:09:39 +0200 aw r274425 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 19:09:27 +0200 aw r274424 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 19:09:14 +0200 aw r274423 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 19:08:59 +0200 aw r274422 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 19:08:47 +0200 aw r274421 : #97672# first version of reworked selection with changeable transparency and frame 2009-07-28 15:44:50 +0200 aw r274411 : #i102556# corrected TextLayouterDevice::getTextBoundRect implementation and usage; empty Rectangles were not handled correctly 2009-07-23 17:48:36 +0200 aw r274277 : #i102063# implemented in-between OLE content holder (SdrOleContentPrimitive2D) and it's decomposition. Cleaned up diverse OLE graphic preparations 2009-07-22 12:55:12 +0200 aw r274227 : #i102109# extended OutputDevice::DrawTransparent (the version with TransparenceGradient) to work correctly with AntiAliased content 2009-07-21 13:31:12 +0200 aw r274191 : #i102611# changed scaling of Z-Range for Z-Buffer for ZBufferProcessor3D 2009-07-20 20:06:46 +0200 aw r274155 : #i103500# moved OverlayObjectCell back to use discrete coordinates for rectangle list 2009-07-16 17:33:26 +0200 aw r274065 : #i103530# corrected parameter preparation for MetaFile::Rotate call --- sc/source/ui/inc/gridwin.hxx | 40 +---- sc/source/ui/inc/tabview.hxx | 6 - sc/source/ui/view/gridwin.cxx | 365 ++++++++++++----------------------------- sc/source/ui/view/gridwin4.cxx | 2 - sc/source/ui/view/tabview.cxx | 3 +- sc/source/ui/view/tabview5.cxx | 10 -- 6 files changed, 109 insertions(+), 317 deletions(-) diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 0f51f985cd72..8b680daad6cb 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -37,6 +37,7 @@ #include "viewdata.hxx" #include "cbutton.hxx" #include +#include #include @@ -94,44 +95,7 @@ public: // --------------------------------------------------------------------------- // predefines -class ScGridWindow; - -enum ScOverlayType { SC_OVERLAY_INVERT, SC_OVERLAY_SOLID, SC_OVERLAY_BORDER_TRANSPARENT }; - -// #114409# -namespace sdr -{ - namespace overlay - { - // predefines - class OverlayObjectList; - - // OverlayObjectCell - used for cell cursor, selection and AutoFill handle - - class OverlayObjectCell : public OverlayObject - { - public: - typedef ::std::vector< basegfx::B2DRange > RangeVector; - - protected: - basegfx::B2DPolyPolygon impGetOverlayPolyPolygon() const; - - private: - ScOverlayType mePaintType; - RangeVector maRectangles; - - // geometry creation for OverlayObject - virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); - - public: - OverlayObjectCell( ScOverlayType eType, const Color& rColor, const RangeVector& rRects); - virtual ~OverlayObjectCell(); - }; - - } // end of namespace overlay -} // end of namespace sdr - -// --------------------------------------------------------------------------- +namespace sdr { namespace overlay { class OverlayObjectList; }} class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHelper { diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index dcc4651d6290..fe5da618e895 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -181,9 +181,6 @@ private: BOOL bMoveIsShift; BOOL bNewStartIfMarking; - BOOL bOldSelection; // old style (inverting) of selection - - void Init(); void DoAddWin( ScGridWindow* pWin ); @@ -528,9 +525,6 @@ public: void SetBrushDocument( ScDocument* pNew, BOOL bLock ); void SetDrawBrushSet( SfxItemSet* pNew, BOOL bLock ); void ResetBrushDocument(); - - void UpdateSelectionType(); - BOOL IsOldSelection() const { return bOldSelection; } }; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index d873bf7e58b8..de2b962f3272 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -122,18 +122,11 @@ #include "tabprotection.hxx" #include "postit.hxx" -// #114409# -#include // FRound #include "drawview.hxx" #include -#include #include #include - -#include -#include -#include -#include +#include using namespace com::sun::star; using ::com::sun::star::uno::Sequence; @@ -359,8 +352,7 @@ void lcl_UnLockComment( ScDrawView* pView, SdrPageView* pPV, SdrModel* pDrDoc, c } } -//================================================================== - +// --------------------------------------------------------------------------- // WB_DIALOGCONTROL noetig fuer UNO-Controls ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhichPos ) : Window( pParent, WB_CLIPCHILDREN | WB_DIALOGCONTROL ), @@ -4866,7 +4858,6 @@ BOOL ScGridWindow::GetEditUrlOrError( BOOL bSpellErr, const Point& rPos, MapMode aEditMode = pViewData->GetLogicMode(eWhich); // ohne Drawing-Skalierung Rectangle aLogicEdit = PixelToLogic( aEditRect, aEditMode ); long nThisColLogic = aLogicEdit.Right() - aLogicEdit.Left() + 1; - Size aPaperSize = Size( 1000000, 1000000 ); if(pCell->GetCellType() == CELLTYPE_FORMULA) { @@ -5181,37 +5172,30 @@ void ScGridWindow::UpdateCursorOverlay() } } - // - // convert into logic units and create overlay object - // - if ( aPixelRects.size() ) { - sdr::overlay::OverlayObjectCell::RangeVector aRanges; - - std::vector::const_iterator aPixelEnd( aPixelRects.end() ); - for ( std::vector::const_iterator aPixelIter( aPixelRects.begin() ); - aPixelIter != aPixelEnd; ++aPixelIter ) - { - Rectangle aLogic( PixelToLogic( *aPixelIter, aDrawMode ) ); - - const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top()); - const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom()); - const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight); - - aRanges.push_back( a2DRange ); - } - // #i70788# get the OverlayManager safely ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager(); if(pOverlayManager) { - BOOL bOld = pViewData->GetView()->IsOldSelection(); + const Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); + std::vector< basegfx::B2DRange > aRanges; + const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation()); + + for(sal_uInt32 a(0); a < aPixelRects.size(); a++) + { + const Rectangle aRA(aPixelRects[a]); + basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1); + aRB.transform(aTransform); + aRanges.push_back(aRB); + } - ScOverlayType eType = bOld ? SC_OVERLAY_INVERT : SC_OVERLAY_SOLID; - Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); - sdr::overlay::OverlayObjectCell* pOverlay = new sdr::overlay::OverlayObjectCell( eType, aCursorColor, aRanges ); + sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection( + sdr::overlay::OVERLAY_SOLID, + aCursorColor, + aRanges, + false); pOverlayManager->add(*pOverlay); mpOOCursors = new ::sdr::overlay::OverlayObjectList; @@ -5236,50 +5220,52 @@ void ScGridWindow::UpdateSelectionOverlay() SetMapMode( aDrawMode ); DeleteSelectionOverlay(); - std::vector aPixelRects; GetSelectionRects( aPixelRects ); if ( aPixelRects.size() && pViewData->IsActive() ) { - SCTAB nTab = pViewData->GetTabNo(); - BOOL bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( nTab ); - BOOL bOld = pViewData->GetView()->IsOldSelection(); - - sdr::overlay::OverlayObjectCell::RangeVector aRanges; + // #i70788# get the OverlayManager safely + ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager(); - std::vector::const_iterator aPixelEnd( aPixelRects.end() ); - for ( std::vector::const_iterator aPixelIter( aPixelRects.begin() ); - aPixelIter != aPixelEnd; ++aPixelIter ) + if(pOverlayManager) { - Rectangle aPixel( *aPixelIter ); - if ( !bOld ) + std::vector< basegfx::B2DRange > aRanges; + const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation()); + + for(sal_uInt32 a(0); a < aPixelRects.size(); a++) { - // for transparent selection, add a pixel so the border is on the grid on all edges - if ( bLayoutRTL ) - aPixel.Right() += 1; - else - aPixel.Left() -= 1; - aPixel.Top() -= 1; + const Rectangle aRA(aPixelRects[a]); + basegfx::B2DRange aRB(aRA.Left() - 1, aRA.Top() - 1, aRA.Right(), aRA.Bottom()); + aRB.transform(aTransform); + aRanges.push_back(aRB); } - Rectangle aLogic( PixelToLogic( aPixel, aDrawMode ) ); - const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top()); - const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom()); - const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight); + // #i97672# get the system's hilight color and limit it to the maximum + // allowed luminance. This is needed to react on too bright hilight colors + // which would otherwise vive a bad visualisation + Color aHighlight(GetSettings().GetStyleSettings().GetHighlightColor()); + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + const basegfx::BColor aSelection(aHighlight.getBColor()); + const double fLuminance(aSelection.luminance()); + const double fMaxLum(aSvtOptionsDrawinglayer.GetSelectionMaximumLuminancePercent() / 100.0); - aRanges.push_back( a2DRange ); - } + if(fLuminance > fMaxLum) + { + const double fFactor(fMaxLum / fLuminance); + const basegfx::BColor aNewSelection( + aSelection.getRed() * fFactor, + aSelection.getGreen() * fFactor, + aSelection.getBlue() * fFactor); - // #i70788# get the OverlayManager safely - ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager(); + aHighlight = Color(aNewSelection); + } - if(pOverlayManager) - { - ScOverlayType eType = bOld ? SC_OVERLAY_INVERT : SC_OVERLAY_BORDER_TRANSPARENT; - Color aHighlight( GetSettings().GetStyleSettings().GetHighlightColor() ); - sdr::overlay::OverlayObjectCell* pOverlay = - new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges ); + sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection( + sdr::overlay::OVERLAY_TRANSPARENT, + aHighlight, + aRanges, + true); pOverlayManager->add(*pOverlay); mpOOSelection = new ::sdr::overlay::OverlayObjectList; @@ -5331,31 +5317,24 @@ void ScGridWindow::UpdateAutoFillOverlay() aFillPos.Y() -= 2; Rectangle aFillRect( aFillPos, Size(6,6) ); - // - // convert into logic units - // - - sdr::overlay::OverlayObjectCell::RangeVector aRanges; - - Rectangle aLogic( PixelToLogic( aFillRect, aDrawMode ) ); - - const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top()); - const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom()); - const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight); - - aRanges.push_back( a2DRange ); - // #i70788# get the OverlayManager safely ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager(); if(pOverlayManager) { - BOOL bOld = pViewData->GetView()->IsOldSelection(); + const Color aHandleColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); + std::vector< basegfx::B2DRange > aRanges; + const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation()); + basegfx::B2DRange aRB(aFillRect.Left(), aFillRect.Top(), aFillRect.Right() + 1, aFillRect.Bottom() + 1); + + aRB.transform(aTransform); + aRanges.push_back(aRB); - ScOverlayType eType = bOld ? SC_OVERLAY_INVERT : SC_OVERLAY_SOLID; - Color aHandleColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); - sdr::overlay::OverlayObjectCell* pOverlay = - new sdr::overlay::OverlayObjectCell( eType, aHandleColor, aRanges ); + sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection( + sdr::overlay::OVERLAY_SOLID, + aHandleColor, + aRanges, + false); pOverlayManager->add(*pOverlay); mpOOAutoFill = new ::sdr::overlay::OverlayObjectList; @@ -5466,34 +5445,28 @@ void ScGridWindow::UpdateDragRectOverlay() aPixelRects.push_back( Rectangle( aRect.Left()+3, aRect.Bottom()-2, aRect.Right()-3, aRect.Bottom() ) ); } - // - // convert into logic units and create overlay object - // - - sdr::overlay::OverlayObjectCell::RangeVector aRanges; - - std::vector::const_iterator aPixelEnd( aPixelRects.end() ); - for ( std::vector::const_iterator aPixelIter( aPixelRects.begin() ); - aPixelIter != aPixelEnd; ++aPixelIter ) - { - Rectangle aLogic( PixelToLogic( *aPixelIter, aDrawMode ) ); - - const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top()); - const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom()); - const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight); - - aRanges.push_back( a2DRange ); - } - // #i70788# get the OverlayManager safely ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager(); if(pOverlayManager) { - ScOverlayType eType = SC_OVERLAY_INVERT; - Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor(); - sdr::overlay::OverlayObjectCell* pOverlay = - new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges ); + // Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor(); + std::vector< basegfx::B2DRange > aRanges; + const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation()); + + for(sal_uInt32 a(0); a < aPixelRects.size(); a++) + { + const Rectangle aRA(aPixelRects[a]); + basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1); + aRB.transform(aTransform); + aRanges.push_back(aRB); + } + + sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection( + sdr::overlay::OVERLAY_INVERT, + Color(COL_BLACK), + aRanges, + false); pOverlayManager->add(*pOverlay); mpOODragRect = new ::sdr::overlay::OverlayObjectList; @@ -5520,31 +5493,26 @@ void ScGridWindow::UpdateHeaderOverlay() DeleteHeaderOverlay(); // Pixel rectangle is in aInvertRect - - // - // convert into logic units and create overlay object - // - if ( !aInvertRect.IsEmpty() ) { - Rectangle aLogic( PixelToLogic( aInvertRect, aDrawMode ) ); - - const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top()); - const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom()); - const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight); - - sdr::overlay::OverlayObjectCell::RangeVector aRanges; - aRanges.push_back( a2DRange ); - // #i70788# get the OverlayManager safely ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager(); if(pOverlayManager) { - ScOverlayType eType = SC_OVERLAY_INVERT; - Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor(); - sdr::overlay::OverlayObjectCell* pOverlay = - new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges ); + // Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor(); + std::vector< basegfx::B2DRange > aRanges; + const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation()); + basegfx::B2DRange aRB(aInvertRect.Left(), aInvertRect.Top(), aInvertRect.Right() + 1, aInvertRect.Bottom() + 1); + + aRB.transform(aTransform); + aRanges.push_back(aRB); + + sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection( + sdr::overlay::OVERLAY_INVERT, + Color(COL_BLACK), + aRanges, + false); pOverlayManager->add(*pOverlay); mpOOHeader = new ::sdr::overlay::OverlayObjectList; @@ -5595,30 +5563,26 @@ void ScGridWindow::UpdateShrinkOverlay() } } - // - // convert into logic units and create overlay object - // - if ( !aPixRect.IsEmpty() ) { - Rectangle aLogic( PixelToLogic( aPixRect, aDrawMode ) ); - - const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top()); - const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom()); - const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight); - - sdr::overlay::OverlayObjectCell::RangeVector aRanges; - aRanges.push_back( a2DRange ); - // #i70788# get the OverlayManager safely ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager(); if(pOverlayManager) { - ScOverlayType eType = SC_OVERLAY_INVERT; - Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor(); - sdr::overlay::OverlayObjectCell* pOverlay = - new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges ); + // Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor(); + std::vector< basegfx::B2DRange > aRanges; + const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation()); + basegfx::B2DRange aRB(aPixRect.Left(), aPixRect.Top(), aPixRect.Right() + 1, aPixRect.Bottom() + 1); + + aRB.transform(aTransform); + aRanges.push_back(aRB); + + sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection( + sdr::overlay::OVERLAY_INVERT, + Color(COL_BLACK), + aRanges, + false); pOverlayManager->add(*pOverlay); mpOOShrink = new ::sdr::overlay::OverlayObjectList; @@ -5660,121 +5624,4 @@ void ScGridWindow::flushOverlayManager() } // --------------------------------------------------------------------------- - -// #114409# -namespace sdr -{ - namespace overlay - { - OverlayObjectCell::OverlayObjectCell( ScOverlayType eType, const Color& rColor, const RangeVector& rRects ) - : OverlayObject( rColor ), - mePaintType( eType ), - maRectangles( rRects ) - { - // no AA for selection overlays - allowAntiAliase(false); - } - - OverlayObjectCell::~OverlayObjectCell() - { - } - - drawinglayer::primitive2d::Primitive2DSequence OverlayObjectCell::createOverlayObjectPrimitive2DSequence() - { - drawinglayer::primitive2d::Primitive2DSequence aRetval; - const basegfx::BColor aRGBColor(getBaseColor().getBColor()); - const sal_uInt32 nCount(maRectangles.size()); - - if(nCount) - { - // create fill primities for all rectangles - // These ranges are meant as rectangles, so it is not sufficient to replace them - // using the derived polygon. That would leave out the bottom and right lines - // in a discrete width/height due to polygon painting conventions of leaving off those. - // To solve, it is either possible to create a view-dependent rectangle primitive - // handling this internally or to additionally create a hairline primitive to - // cover these areas (which i will do here) - const bool bIsTransparent(SC_OVERLAY_BORDER_TRANSPARENT == mePaintType); - aRetval.realloc(nCount * 2); - - for(sal_uInt32 a(0);a < nCount; a++) - { - const basegfx::B2DRange& rRange(maRectangles[a]); - const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange)); - - aRetval[a * 2] = drawinglayer::primitive2d::Primitive2DReference( - new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( - basegfx::B2DPolyPolygon(aPolygon), - aRGBColor)); - aRetval[(a * 2) + 1] = drawinglayer::primitive2d::Primitive2DReference( - new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D( - basegfx::B2DPolyPolygon(aPolygon), - aRGBColor)); - } - - if(SC_OVERLAY_INVERT == mePaintType) - { - // embed all in invert primitive - const drawinglayer::primitive2d::Primitive2DReference aInvert( - new drawinglayer::primitive2d::InvertPrimitive2D( - aRetval)); - - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1); - } - else if(bIsTransparent) - { - // embed all rectangles in 75% transparent paint - const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha( - new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D( - aRetval, - 0.75)); - - // prepare merged PolyPoygon selection outline - const basegfx::B2DPolyPolygon aPolyPolygon(impGetOverlayPolyPolygon()); - const drawinglayer::primitive2d::Primitive2DReference aSelectionOutline( - new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D( - aPolyPolygon, - aRGBColor)); - - // add both to result - aRetval.realloc(2); - aRetval[0] = aUnifiedAlpha; - aRetval[1] = aSelectionOutline; - } - } - - return aRetval; - } - - basegfx::B2DPolyPolygon OverlayObjectCell::impGetOverlayPolyPolygon() const - { - PolyPolygon aPolyPoly; - const sal_uInt32 nRectCount(maRectangles.size()); - - for(sal_uInt32 nRect(0); nRect < nRectCount; ++nRect) - { - const basegfx::B2DRange& rRange(maRectangles[nRect]); - const Rectangle aRectangle( - FRound(rRange.getMinX()), FRound(rRange.getMinY()), - FRound(rRange.getMaxX()), FRound(rRange.getMaxY())); - - if ( nRectCount == 1 || nRect+1 < nRectCount ) - { - // simply add for all except the last rect - aPolyPoly.Insert( Polygon( aRectangle ) ); - } - else - { - PolyPolygon aTemp( aPolyPoly ); - aTemp.GetUnion( PolyPolygon( Polygon( aRectangle ) ), aPolyPoly ); - } - } - - return aPolyPoly.getB2DPolyPolygon(); - } - } // end of namespace overlay -} // end of namespace sdr - -// --------------------------------------------------------------------------- - // eof diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index b90e5d3e802e..d700ee606731 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -2045,8 +2045,6 @@ void ScGridWindow::DataChanged( const DataChangedEvent& rDCEvt ) // RepeatResize in case scroll bar sizes have changed pView->RepeatResize(); - - pView->UpdateSelectionType(); pView->UpdateAllOverlays(); // invalidate cell attribs in input handler, in case the diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 459f5e89e0fb..3077e852dbaf 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -384,8 +384,7 @@ BOOL lcl_HasRowOutline( const ScViewData& rViewData ) bInActivatePart( FALSE ), \ bInZoomUpdate( FALSE ), \ bMoveIsShift( FALSE ), \ - bNewStartIfMarking( FALSE ), \ - bOldSelection( FALSE ) + bNewStartIfMarking( FALSE ) ScTabView::ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) : diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index c27524c83542..75e961d5eeec 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -148,16 +148,6 @@ void __EXPORT ScTabView::Init() // Das gilt auch fuer ViewOptionsHasChanged() TestHintWindow(); - - UpdateSelectionType(); -} - -void ScTabView::UpdateSelectionType() -{ - // old selection in high contrast mode, or if transparent drawing isn't supported - - bOldSelection = pFrameWin->GetSettings().GetStyleSettings().GetHighContrastMode() || - !pFrameWin->supportsOperation( OutDevSupport_TransparentRect ); } __EXPORT ScTabView::~ScTabView() -- cgit From 613092ae9962ef82c9b752de54ab1573f369ed15 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Thu, 27 Aug 2009 14:46:36 +0000 Subject: CWS-TOOLING: integrate CWS hr64_DEV300 2009-07-21 13:24:57 +0200 hr r274189 : #i99576#: re-enable optimization for tabcont.cxx 2009-07-21 13:17:18 +0200 hr r274188 : #i99592: disable -xspace optimization for Solaris x86 and SunStudio 12, due to some mis-optimzation in sc and elsewhere. SunStudio 12 update 1 is OK, but needs a few unrelated changes which will be implemented in DEV300 code line --- sc/source/ui/view/makefile.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sc/source/ui/view/makefile.mk b/sc/source/ui/view/makefile.mk index 9af8051b6613..466ab5dc8627 100644 --- a/sc/source/ui/view/makefile.mk +++ b/sc/source/ui/view/makefile.mk @@ -135,12 +135,10 @@ SLOFILES = \ $(SLO)$/viewfun4.obj \ $(SLO)$/viewfun2.obj .ELIF "$(OS)$(COM)$(CPUNAME)"=="SOLARISC52INTEL" -# tabcont can be removed if -xspace is no longer used (i99576, i99592) NOOPTFILES=\ $(SLO)$/drawview.obj \ $(SLO)$/dbfunc2.obj \ - $(SLO)$/tabvwsh2.obj \ - $(SLO)$/tabcont.obj + $(SLO)$/tabvwsh2.obj .ELSE NOOPTFILES=\ -- cgit From 712e83090c793bd4a29ca77022e52d7fd82b70f7 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Mon, 7 Sep 2009 14:41:16 +0000 Subject: CWS-TOOLING: integrate CWS dr72 2009-08-26 10:24:00 +0200 dr r275402 : #i92645# CODEPAGE is encrypted... 2009-08-24 14:37:36 +0200 dr r275316 : #i10000# enable exceptions for xlroot.cxx 2009-08-24 14:33:15 +0200 dr r275313 : #i10000# link openssl under solaris correctly 2009-08-21 17:41:16 +0200 dr r275267 : #i10000# unxlngi6 warning 2009-08-21 15:35:56 +0200 dr r275265 : #i10000# remove files again, already deleted in previous milestone... 2009-08-21 11:24:57 +0200 dr r275227 : #160401# port to DEV300 2009-08-21 09:53:45 +0200 dr r275221 : #i92645# full support for encrypted Word2007 files 2009-08-21 09:50:52 +0200 dr r275219 : #i92645# final changes for decryption 2009-08-20 19:48:40 +0200 dr r275195 : #i104370# missing parentheses, patch from cmc 2009-08-20 18:28:22 +0200 dr r275193 : #i92645# rework package decryption to repair 'Reload Document' functionality 2009-08-20 13:55:14 +0200 dr r275179 : #i92645# add new property names 2009-08-19 19:24:21 +0200 dr r275159 : #160401# open writeprotected files read-only, merged to DEV300 2009-08-18 14:41:47 +0200 dr r275109 : #i92645# add 'Aborted' property 2009-08-18 11:20:34 +0200 dr r275084 : #i92645# write back password to medium 2009-08-17 17:52:51 +0200 dr r275066 : #i92645# detect Word2007 docs with oox detection impl, this adds support of encryped Word2007; correct detection of templates and macro-enabled docs 2009-08-17 17:51:31 +0200 dr r275065 : #i92645# detect Word2007 docs with oox detection impl, this adds support of encryped Word2007; correct detection of templates and macro-enabled docs 2009-08-17 11:06:39 +0200 dr r275035 : #i92645# more password handling 2009-08-17 11:05:21 +0200 dr r275034 : #i92645# use new password input mechanism for BIFF filter and dumper in oox 2009-08-14 16:33:53 +0200 nn r274996 : #i104228# DelBroadcastAreasInRange: remove area from hash_set before deleting 2009-08-14 16:27:12 +0200 nn r274995 : #i104059# restore a change lost in the integration of fhawfixes1 2009-08-14 16:24:00 +0200 dr r274994 : #i92645# adapt BIFF import to latest changes 2009-08-14 16:21:30 +0200 dr r274993 : #i92645# adapt BIFF import to latest changes 2009-08-14 16:20:43 +0200 dr r274992 : #i92645# do not add default passwords to media descriptor 2009-08-13 19:20:45 +0200 dr r274965 : #i92645# add a helper to request a document password 2009-08-13 19:09:35 +0200 dr r274964 : #i92645# add a helper to request a document password 2009-08-13 19:09:03 +0200 dr r274963 : #i92645# add a helper to request a document password 2009-08-13 14:35:01 +0200 dr r274946 : #i92645# comment typo 2009-08-13 14:33:47 +0200 dr r274945 : #i92645# add a helper to request a document password 2009-08-13 14:04:47 +0200 dr r274941 : #i92645# add a helper to request a document password 2009-08-13 14:04:22 +0200 dr r274940 : #i92645# add a helper to request a document password 2009-08-13 11:16:27 +0200 dr r274927 : #i42303# show quick help if field name too long for button 2009-08-13 10:55:48 +0200 dr r274925 : #i31600# cut field name and add ellipsis, if too long for button 2009-08-12 18:47:26 +0200 dr r274914 : #i92645# ask user for a password 2009-08-12 18:02:39 +0200 dr r274909 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:59:11 +0200 dr r274906 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:41:18 +0200 dr r274905 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:40:33 +0200 dr r274904 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:40:08 +0200 dr r274903 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:39:30 +0200 dr r274902 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-12 16:15:28 +0200 dr r274899 : #i104183# move svtools/DocPasswordRequest to comphelper to be able to use it in oox 2009-08-11 19:51:12 +0200 dr r274877 : #i92645# open encrypted MSOOXML package protected with standard XL password 'VelvetSweatshop' --- sc/source/core/data/bcaslot.cxx | 2 +- sc/source/filter/excel/biffdump.cxx | 9864 -------------------------------- sc/source/filter/excel/excel.cxx | 36 +- sc/source/filter/excel/impop.cxx | 11 +- sc/source/filter/excel/makefile.mk | 2 +- sc/source/filter/excel/read.cxx | 5 + sc/source/filter/excel/xestream.cxx | 2 +- sc/source/filter/excel/xicontent.cxx | 34 +- sc/source/filter/excel/xiroot.cxx | 12 - sc/source/filter/excel/xistream.cxx | 164 +- sc/source/filter/excel/xlroot.cxx | 8 + sc/source/filter/excel/xlstream.cxx | 52 - sc/source/filter/ftools/fapihelper.cxx | 53 +- sc/source/filter/inc/fapihelper.hxx | 6 +- sc/source/filter/inc/fdumper.hxx | 1520 ----- sc/source/filter/inc/fdumperole.hxx | 186 - sc/source/filter/inc/imp_op.hxx | 2 + sc/source/filter/inc/xestream.hxx | 3 - sc/source/filter/inc/xiroot.hxx | 6 - sc/source/filter/inc/xistream.hxx | 62 +- sc/source/filter/inc/xlcontent.hxx | 4 + sc/source/filter/inc/xldumper.hxx | 683 --- sc/source/filter/inc/xlroot.hxx | 8 + sc/source/filter/inc/xlstream.hxx | 13 - sc/source/ui/dbgui/fieldwnd.cxx | 60 +- sc/source/ui/inc/fieldwnd.hxx | 9 +- sc/source/ui/view/output2.cxx | 6 +- 27 files changed, 252 insertions(+), 12561 deletions(-) delete mode 100644 sc/source/filter/excel/biffdump.cxx delete mode 100644 sc/source/filter/excel/xlstream.cxx delete mode 100644 sc/source/filter/inc/fdumper.hxx delete mode 100644 sc/source/filter/inc/fdumperole.hxx delete mode 100644 sc/source/filter/inc/xldumper.hxx diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index ff82d1fd362f..85f8a4921242 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -294,13 +294,13 @@ void ScBroadcastAreaSlot::DelBroadcastAreasInRange( const ScRange& rRange ) if (rRange.In( rAreaRange)) { ScBroadcastArea* pArea = *aIter; + aBroadcastAreaTbl.erase( aIter++); // erase before modifying if (!pArea->DecRef()) { if (pBASM->IsInBulkBroadcast()) pBASM->RemoveBulkArea( pArea); delete pArea; } - aBroadcastAreaTbl.erase( aIter++); } else ++aIter; 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 - * - * 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 -#include -#include -#include - -#include -#include -#include - -#include -#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( "" ); - 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( "" ); - else if( nCch ) - AddUNICODEString( t, rIn, TRUE, nCch ); - else - ADDTEXT( "" ); - 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( "" ); - else if( nCch ) - AddUNICODEString( t, rIn, TRUE, nCch ); - else - ADDTEXT( "" ); - 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( "" ); - 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( "" ); - 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( "" ); - 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/excel.cxx b/sc/source/filter/excel/excel.cxx index 3965d0acaf4e..8365ef0db3f9 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -98,15 +98,21 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW ); xImporter->setTargetDocument( xComponent ); - MediaDescriptor aDescriptor; - if( const SfxItemSet* pItemSet = rMedium.GetItemSet() ) + MediaDescriptor aMediaDesc; + SfxItemSet* pItemSet = rMedium.GetItemSet(); + if( pItemSet ) + { if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) ) - aDescriptor[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pItem->GetValue() ); - aDescriptor[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream(); + aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pItem->GetValue() ); + if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_PASSWORD ) ) ) + aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pItem->GetValue() ); + } + aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream(); + aMediaDesc[ MediaDescriptor::PROP_INTERACTIONHANDLER() ] <<= rMedium.GetInteractionHandler(); // call the filter uno::Reference< document::XFilter > xFilter( xImporter, uno::UNO_QUERY_THROW ); - bool bResult = xFilter->filter( aDescriptor.getAsConstPropertyValueList() ); + bool bResult = xFilter->filter( aMediaDesc.getAsConstPropertyValueList() ); // if filter returns false, document is invalid, or dumper has disabled import -> exit here if( !bResult ) @@ -141,27 +147,27 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument if( xRootStrg.Is() ) { // try to open the "Book" stream - SotStorageStreamRef xBookStrm5 = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_BOOK ); - XclBiff eBookStrm5Biff = xBookStrm5.Is() ? XclImpStream::DetectBiffVersion( *xBookStrm5 ) : EXC_BIFF_UNKNOWN; + SotStorageStreamRef xBookStrm = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_BOOK ); + XclBiff eBookBiff = xBookStrm.Is() ? XclImpStream::DetectBiffVersion( *xBookStrm ) : EXC_BIFF_UNKNOWN; // try to open the "Workbook" stream - SotStorageStreamRef xBookStrm8 = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_WORKBOOK ); - XclBiff eBookStrm8Biff = xBookStrm8.Is() ? XclImpStream::DetectBiffVersion( *xBookStrm8 ) : EXC_BIFF_UNKNOWN; + SotStorageStreamRef xWorkbookStrm = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_WORKBOOK ); + XclBiff eWorkbookBiff = xWorkbookStrm.Is() ? XclImpStream::DetectBiffVersion( *xWorkbookStrm ) : EXC_BIFF_UNKNOWN; // decide which stream to use - if( (eBookStrm8Biff != EXC_BIFF_UNKNOWN) && ((eBookStrm5Biff == EXC_BIFF_UNKNOWN) || (eBookStrm8Biff > eBookStrm5Biff)) ) + if( (eWorkbookBiff != EXC_BIFF_UNKNOWN) && ((eBookBiff == EXC_BIFF_UNKNOWN) || (eWorkbookBiff > eBookBiff)) ) { /* Only "Workbook" stream exists; or both streams exist, and "Workbook" has higher BIFF version than "Book" stream. */ - xStrgStrm = xBookStrm8; - eBiff = eBookStrm8Biff; + xStrgStrm = xWorkbookStrm; + eBiff = eWorkbookBiff; } - else if( eBookStrm5Biff != EXC_BIFF_UNKNOWN ) + else if( eBookBiff != EXC_BIFF_UNKNOWN ) { /* Only "Book" stream exists; or both streams exist, and "Book" has higher BIFF version than "Workbook" stream. */ - xStrgStrm = xBookStrm5; - eBiff = eBookStrm5Biff; + xStrgStrm = xBookStrm; + eBiff = eBookBiff; } pBookStrm = xStrgStrm; diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index cfbef0a15a6e..5a0ae1f9a972 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -175,6 +176,15 @@ ImportExcel::~ImportExcel( void ) } +void ImportExcel::ReadFileSharing() +{ + sal_uInt16 nRecommendReadOnly, nPasswordHash; + maStrm >> nRecommendReadOnly >> nPasswordHash; + if( (nRecommendReadOnly != 0) || (nPasswordHash != 0) ) + if( SfxItemSet* pItemSet = GetMedium().GetItemSet() ) + pItemSet->Put( SfxBoolItem( SID_DOC_READONLY, TRUE ) ); +} + sal_uInt16 ImportExcel::ReadXFIndex( bool bBiff2 ) { sal_uInt16 nXFIdx = 0; @@ -604,7 +614,6 @@ void ImportExcel::DocPasssword( void ) void ImportExcel::Codepage( void ) { - maStrm.EnableDecryption(); SetCodePage( maStrm.ReaduInt16() ); } diff --git a/sc/source/filter/excel/makefile.mk b/sc/source/filter/excel/makefile.mk index 4fffb1ef3ed1..5b483f04729d 100644 --- a/sc/source/filter/excel/makefile.mk +++ b/sc/source/filter/excel/makefile.mk @@ -103,7 +103,6 @@ SLOFILES = \ $(SLO)$/xlpage.obj \ $(SLO)$/xlpivot.obj \ $(SLO)$/xlroot.obj \ - $(SLO)$/xlstream.obj \ $(SLO)$/xlstyle.obj \ $(SLO)$/xltools.obj \ $(SLO)$/xltracer.obj \ @@ -153,6 +152,7 @@ EXCEPTIONSFILES = \ $(SLO)$/xlchart.obj \ $(SLO)$/xlformula.obj \ $(SLO)$/xlpivot.obj \ + $(SLO)$/xlroot.obj \ $(SLO)$/xlstyle.obj \ $(SLO)$/xlview.obj diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx index e7473ba23d02..a4a286d27171 100644 --- a/sc/source/filter/excel/read.cxx +++ b/sc/source/filter/excel/read.cxx @@ -305,6 +305,7 @@ FltError ImportExcel::Read( void ) if( eLastErr != ERRCODE_NONE ) eAkt = Z_Ende; break; + case EXC_ID_FILESHARING: ReadFileSharing(); break; case 0x41: rTabViewSett.ReadPane( maStrm ); break; case 0x42: Codepage(); break; // CODEPAGE [ 2345] case 0x56: Builtinfmtcnt(); break; // BUILTINFMTCNT[ 34 ] @@ -374,6 +375,7 @@ FltError ImportExcel::Read( void ) if( eLastErr != ERRCODE_NONE ) eAkt = Z_Ende; break; + case EXC_ID_FILESHARING: ReadFileSharing(); break; case 0x41: rTabViewSett.ReadPane( maStrm ); break; case 0x42: Codepage(); break; // CODEPAGE [ 2345] case 0x55: DefColWidth(); break; @@ -412,6 +414,7 @@ FltError ImportExcel::Read( void ) if( eLastErr != ERRCODE_NONE ) eAkt = Z_Ende; break; + case EXC_ID_FILESHARING: ReadFileSharing(); break; case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345] case 0x42: Codepage(); break; // CODEPAGE [ 2345] case 0x55: DefColWidth(); break; @@ -546,6 +549,7 @@ FltError ImportExcel::Read( void ) if( eLastErr != ERRCODE_NONE ) eAkt = Z_Ende; break; + case EXC_ID_FILESHARING: ReadFileSharing(); break; case 0x3D: Window1(); break; case 0x42: Codepage(); break; // CODEPAGE [ 2345] case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5] @@ -902,6 +906,7 @@ FltError ImportExcel8::Read( void ) if( eLastErr != ERRCODE_NONE ) eAkt = EXC_STATE_END; break; + case EXC_ID_FILESHARING: ReadFileSharing(); break; case 0x3D: Window1(); break; case 0x42: Codepage(); break; // CODEPAGE [ 2345 ] case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5 ] diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 6b2f53c8056a..45ced68de006 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -485,7 +485,7 @@ XclExpBiff8Encrypter::XclExpBiff8Encrypter( const XclExpRoot& rRoot, const sal_u String aPass = rRoot.GetPassword(); if (aPass.Len() == 0) // Empty password. Get the default biff8 password. - aPass = XclCryptoHelper::GetBiff8WbProtPassword(); + aPass = rRoot.GetDefaultPassword(); Init(aPass, nDocId, nSalt); } diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 24c1999b581b..b57297b344dc 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -1011,7 +1011,7 @@ XclImpDecrypterRef lclReadFilepass5( XclImpStream& rStrm ) { sal_uInt16 nKey, nHash; rStrm >> nKey >> nHash; - xDecr.reset( new XclImpBiff5Decrypter( rStrm.GetRoot(), nKey, nHash ) ); + xDecr.reset( new XclImpBiff5Decrypter( nKey, nHash ) ); } return xDecr; } @@ -1022,14 +1022,13 @@ XclImpDecrypterRef lclReadFilepass8_Standard( XclImpStream& rStrm ) DBG_ASSERT( rStrm.GetRecLeft() == 48, "lclReadFilepass8 - wrong record size" ); if( rStrm.GetRecLeft() == 48 ) { - sal_uInt8 pnDocId[ 16 ]; - sal_uInt8 pnSaltData[ 16 ]; - sal_uInt8 pnSaltHash[ 16 ]; - rStrm.Read( pnDocId, 16 ); - rStrm.Read( pnSaltData, 16 ); - rStrm.Read( pnSaltHash, 16 ); - xDecr.reset( new XclImpBiff8Decrypter( - rStrm.GetRoot(), pnDocId, pnSaltData, pnSaltHash ) ); + sal_uInt8 pnSalt[ 16 ]; + sal_uInt8 pnVerifier[ 16 ]; + sal_uInt8 pnVerifierHash[ 16 ]; + rStrm.Read( pnSalt, 16 ); + rStrm.Read( pnVerifier, 16 ); + rStrm.Read( pnVerifierHash, 16 ); + xDecr.reset( new XclImpBiff8Decrypter( pnSalt, pnVerifier, pnVerifierHash ) ); } return xDecr; } @@ -1087,6 +1086,7 @@ ErrCode XclImpDecryptHelper::ReadFilepass( XclImpStream& rStrm ) XclImpDecrypterRef xDecr; rStrm.DisableDecryption(); + // read the FILEPASS record and create a new decrypter object switch( rStrm.GetRoot().GetBiff() ) { case EXC_BIFF2: @@ -1097,21 +1097,15 @@ ErrCode XclImpDecryptHelper::ReadFilepass( XclImpStream& rStrm ) default: DBG_ERROR_BIFF(); }; - if (!xDecr.is()) - return EXC_ENCR_ERROR_UNSUPP_CRYPT; - // set decrypter at import stream rStrm.SetDecrypter( xDecr ); - // Store the document password for export. - SfxItemSet* pSet = rStrm.GetRoot().GetDocShell()->GetMedium()->GetItemSet(); - if (pSet) - { - String aPass = xDecr->GetPassword(); - pSet->Put( SfxStringItem(SID_PASSWORD, aPass) ); - } + // request and verify a password (decrypter implements IDocPasswordVerifier) + if( xDecr.is() ) + rStrm.GetRoot().RequestPassword( *xDecr ); - return xDecr->GetError(); + // return error code (success, wrong password, etc.) + return xDecr.is() ? xDecr->GetError() : EXC_ENCR_ERROR_UNSUPP_CRYPT; } // Document protection ======================================================== diff --git a/sc/source/filter/excel/xiroot.cxx b/sc/source/filter/excel/xiroot.cxx index 55ba4bdc4cb4..30cab47f57f5 100644 --- a/sc/source/filter/excel/xiroot.cxx +++ b/sc/source/filter/excel/xiroot.cxx @@ -52,7 +52,6 @@ XclImpRootData::XclImpRootData( XclBiff eBiff, SfxMedium& rMedium, SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ) : XclRootData( eBiff, rMedium, xRootStrg, rDoc, eTextEnc, false ), - mbPassQueried( false ), mbHasCodePage( false ) { } @@ -270,16 +269,5 @@ String XclImpRoot::GetScAddInName( const String& rXclName ) const return rXclName; } -const String& XclImpRoot::QueryPassword() const -{ - if( !mrImpData.mbPassQueried ) - { - mrImpData.maPassw = ScfApiHelper::QueryPasswordForMedium( GetMedium() ); - // set to true, even if dialog has been cancelled (never ask twice) - mrImpData.mbPassQueried = true; - } - return mrImpData.maPassw; -} - // ============================================================================ diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index e7780c065118..b168c4389c4c 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -31,13 +31,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" -// ============================================================================ #include "xistream.hxx" #include "xlstring.hxx" #include "xiroot.hxx" #include +using ::rtl::OString; +using ::rtl::OUString; +using ::rtl::OUStringToOString; + // ============================================================================ // Decryption // ============================================================================ @@ -50,6 +53,7 @@ XclImpDecrypter::XclImpDecrypter() : } XclImpDecrypter::XclImpDecrypter( const XclImpDecrypter& rSrc ) : + ::comphelper::IDocPasswordVerifier(), mnError( rSrc.mnError ), mnOldPos( STREAM_SEEK_TO_END ), mnRecSize( 0 ) @@ -68,6 +72,13 @@ XclImpDecrypterRef XclImpDecrypter::Clone() const return xNewDecr; } +::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyPassword( const OUString& rPassword ) +{ + bool bValid = OnVerify( rPassword ); + mnError = bValid ? ERRCODE_NONE : ERRCODE_ABORT; + return bValid ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; +} + void XclImpDecrypter::Update( SvStream& rStrm, sal_uInt16 nRecSize ) { if( IsValid() ) @@ -99,47 +110,48 @@ sal_uInt16 XclImpDecrypter::Read( SvStream& rStrm, void* pData, sal_uInt16 nByte return nRet; } -const String XclImpDecrypter::GetPassword() const -{ - return maPass; -} +// ---------------------------------------------------------------------------- -void XclImpDecrypter::SetHasValidPassword( bool bValid ) +XclImpBiff5Decrypter::XclImpBiff5Decrypter( sal_uInt16 nKey, sal_uInt16 nHash ) : + maPassword( 16 ), + mnKey( nKey ), + mnHash( nHash ) { - mnError = bValid ? ERRCODE_NONE : EXC_ENCR_ERROR_WRONG_PASS; } -void XclImpDecrypter::SetPassword( const String& rPass ) +XclImpBiff5Decrypter::XclImpBiff5Decrypter( const XclImpBiff5Decrypter& rSrc ) : + XclImpDecrypter( rSrc ), + maPassword( rSrc.maPassword ), + mnKey( rSrc.mnKey ), + mnHash( rSrc.mnHash ) { - maPass = rPass; + if( IsValid() ) + maCodec.InitKey( &maPassword.front() ); } -// ---------------------------------------------------------------------------- - -XclImpBiff5Decrypter::XclImpBiff5Decrypter( const XclImpRoot& rRoot, sal_uInt16 nKey, sal_uInt16 nHash ) +XclImpBiff5Decrypter* XclImpBiff5Decrypter::OnClone() const { - Init( XclCryptoHelper::GetBiff5WbProtPassword(), nKey, nHash ); - if( !IsValid() ) - { - //! TODO: correct byte string encoding in all cases? - ByteString aPass( rRoot.QueryPassword(), RTL_TEXTENCODING_MS_1252 ); - Init( aPass, nKey, nHash ); - } + return new XclImpBiff5Decrypter( *this ); } -XclImpBiff5Decrypter::XclImpBiff5Decrypter( const XclImpBiff5Decrypter& rSrc ) : - XclImpDecrypter( rSrc ) +bool XclImpBiff5Decrypter::OnVerify( const OUString& rPassword ) { - if( rSrc.IsValid() ) + /* Convert password to a byte string. TODO: this needs some finetuning + according to the spec... */ + OString aBytePassword = OUStringToOString( rPassword, osl_getThreadTextEncoding() ); + sal_Int32 nLen = aBytePassword.getLength(); + if( (0 < nLen) && (nLen < 16) ) { - memcpy( mpnPassw, rSrc.mpnPassw, sizeof( mpnPassw ) ); - maCodec.InitKey( mpnPassw ); - } -} + // copy byte string to sal_uInt8 array + maPassword.clear(); + maPassword.resize( 16, 0 ); + memcpy( &maPassword.front(), aBytePassword.getStr(), static_cast< size_t >( nLen ) ); -XclImpBiff5Decrypter* XclImpBiff5Decrypter::OnClone() const -{ - return new XclImpBiff5Decrypter( *this ); + // init codec + maCodec.InitKey( &maPassword.front() ); + return maCodec.VerifyKey( mnKey, mnHash ); + } + return false; } void XclImpBiff5Decrypter::OnUpdate( sal_Size /*nOldStrmPos*/, sal_Size nNewStrmPos, sal_uInt16 nRecSize ) @@ -155,48 +167,26 @@ sal_uInt16 XclImpBiff5Decrypter::OnRead( SvStream& rStrm, sal_uInt8* pnData, sal return nRet; } -void XclImpBiff5Decrypter::Init( const ByteString& rPass, sal_uInt16 nKey, sal_uInt16 nHash ) -{ - xub_StrLen nLen = rPass.Len(); - bool bValid = (0 < nLen) && (nLen < 16); - - if( bValid ) - { - // transform ByteString to sal_uInt8 array - memset( mpnPassw, 0, sizeof( mpnPassw ) ); - for( xub_StrLen nChar = 0; nChar < nLen; ++nChar ) - mpnPassw[ nChar ] = static_cast< sal_uInt8 >( rPass.GetChar( nChar ) ); - // init codec - maCodec.InitKey( mpnPassw ); - bValid = maCodec.VerifyKey( nKey, nHash ); - - String aUniPass( rPass, RTL_TEXTENCODING_MS_1252 ); - SetPassword( aUniPass ); - } - - SetHasValidPassword( bValid ); -} - // ---------------------------------------------------------------------------- -XclImpBiff8Decrypter::XclImpBiff8Decrypter( - const XclImpRoot& rRoot, sal_uInt8 pnDocId[ 16 ], - sal_uInt8 pnSaltData[ 16 ], sal_uInt8 pnSaltHash[ 16 ] ) +XclImpBiff8Decrypter::XclImpBiff8Decrypter( sal_uInt8 pnSalt[ 16 ], + sal_uInt8 pnVerifier[ 16 ], sal_uInt8 pnVerifierHash[ 16 ] ) : + maPassword( 16, 0 ), + maSalt( pnSalt, pnSalt + 16 ), + maVerifier( pnVerifier, pnVerifier + 16 ), + maVerifierHash( pnVerifierHash, pnVerifierHash + 16 ) { - Init( XclCryptoHelper::GetBiff8WbProtPassword(), pnDocId, pnSaltData, pnSaltHash ); - if( !IsValid() ) - Init( rRoot.QueryPassword(), pnDocId, pnSaltData, pnSaltHash ); } XclImpBiff8Decrypter::XclImpBiff8Decrypter( const XclImpBiff8Decrypter& rSrc ) : - XclImpDecrypter( rSrc ) + XclImpDecrypter( rSrc ), + maPassword( rSrc.maPassword ), + maSalt( rSrc.maSalt ), + maVerifier( rSrc.maVerifier ), + maVerifierHash( rSrc.maVerifierHash ) { - if( rSrc.IsValid() ) - { - memcpy( mpnPassw, rSrc.mpnPassw, sizeof( mpnPassw ) ); - memcpy( mpnDocId, rSrc.mpnDocId, sizeof( mpnDocId ) ); - maCodec.InitKey( mpnPassw, mpnDocId ); - } + if( IsValid() ) + maCodec.InitKey( &maPassword.front(), &maSalt.front() ); } XclImpBiff8Decrypter* XclImpBiff8Decrypter::OnClone() const @@ -204,6 +194,27 @@ XclImpBiff8Decrypter* XclImpBiff8Decrypter::OnClone() const return new XclImpBiff8Decrypter( *this ); } +bool XclImpBiff8Decrypter::OnVerify( const OUString& rPassword ) +{ + sal_Int32 nLen = rPassword.getLength(); + if( (0 < nLen) && (nLen < 16) ) + { + // copy string to sal_uInt16 array + maPassword.clear(); + maPassword.resize( 16, 0 ); + const sal_Unicode* pcChar = rPassword.getStr(); + const sal_Unicode* pcCharEnd = pcChar + nLen; + ::std::vector< sal_uInt16 >::iterator aIt = maPassword.begin(); + for( ; pcChar < pcCharEnd; ++pcChar, ++aIt ) + *aIt = static_cast< sal_uInt16 >( *pcChar ); + + // init codec + maCodec.InitKey( &maPassword.front(), &maSalt.front() ); + return maCodec.VerifyKey( &maVerifier.front(), &maVerifierHash.front() ); + } + return false; +} + void XclImpBiff8Decrypter::OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 /*nRecSize*/ ) { if( nNewStrmPos != nOldStrmPos ) @@ -252,31 +263,6 @@ sal_uInt16 XclImpBiff8Decrypter::OnRead( SvStream& rStrm, sal_uInt8* pnData, sal return nRet; } -void XclImpBiff8Decrypter::Init( - const String& rPass, sal_uInt8 pnDocId[ 16 ], - sal_uInt8 pnSaltData[ 16 ], sal_uInt8 pnSaltHash[ 16 ] ) -{ - xub_StrLen nLen = rPass.Len(); - bool bValid = (0 < nLen) && (nLen < 16); - - if( bValid ) - { - // transform String to sal_uInt16 array - memset( mpnPassw, 0, sizeof( mpnPassw ) ); - for( xub_StrLen nChar = 0; nChar < nLen; ++nChar ) - mpnPassw[ nChar ] = static_cast< sal_uInt16 >( rPass.GetChar( nChar ) ); - // copy document ID - memcpy( mpnDocId, pnDocId, sizeof( mpnDocId ) ); - // init codec - maCodec.InitKey( mpnPassw, mpnDocId ); - bValid = maCodec.VerifyKey( pnSaltData, pnSaltHash ); - - SetPassword(rPass); - } - - SetHasValidPassword( bValid ); -} - sal_uInt32 XclImpBiff8Decrypter::GetBlock( sal_Size nStrmPos ) const { return static_cast< sal_uInt32 >( nStrmPos / EXC_ENCR_BLOCKSIZE ); diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 8f5ddadd0370..29522f4f50ff 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -79,6 +79,7 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium, mrMedium( rMedium ), mxRootStrg( xRootStrg ), mrDoc( rDoc ), + maDefPassword( CREATE_STRING( "VelvetSweatshop" ) ), meTextEnc( eTextEnc ), meSysLang( Application::GetSettings().GetLanguage() ), meDocLang( Application::GetSettings().GetLanguage() ), @@ -198,6 +199,13 @@ void XclRoot::SetCharWidth( const XclFontData& rFontData ) } } +String XclRoot::RequestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const +{ + ::std::vector< OUString > aDefaultPasswords; + aDefaultPasswords.push_back( mrData.maDefPassword ); + return ScfApiHelper::QueryPasswordForMedium( mrData.mrMedium, rVerifier, &aDefaultPasswords ); +} + bool XclRoot::HasVbaStorage() const { SotStorageRef xRootStrg = GetRootStorage(); diff --git a/sc/source/filter/excel/xlstream.cxx b/sc/source/filter/excel/xlstream.cxx deleted file mode 100644 index 7340e073c51f..000000000000 --- a/sc/source/filter/excel/xlstream.cxx +++ /dev/null @@ -1,52 +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: xlstream.cxx,v $ - * $Revision: 1.5 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sc.hxx" - -// ============================================================================ -#include "xlstream.hxx" - -// Encryption/decryption ====================================================== - -const ByteString XclCryptoHelper::GetBiff5WbProtPassword() -{ - static const ByteString saPass( "VelvetSweatshop" ); - return saPass; -} - -const String XclCryptoHelper::GetBiff8WbProtPassword() -{ - static const String saPass( GetBiff5WbProtPassword(), RTL_TEXTENCODING_ASCII_US ); - return saPass; -} - -// ============================================================================ - diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx index 3befbf4d866f..31190b6407b1 100644 --- a/sc/source/filter/ftools/fapihelper.cxx +++ b/sc/source/filter/ftools/fapihelper.cxx @@ -35,9 +35,8 @@ #include #include #include -#include -#include #include +#include #include #include #include @@ -45,7 +44,6 @@ #include #include #include -#include #include "miscuno.hxx" using ::rtl::OUString; @@ -55,14 +53,14 @@ using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::TypeClass_BOOLEAN; using ::com::sun::star::uno::XInterface; using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::beans::XPropertyState; using ::com::sun::star::lang::XServiceName; using ::com::sun::star::lang::XMultiServiceFactory; -using ::com::sun::star::task::XInteractionHandler; -using ::com::sun::star::task::XInteractionRequest; +using ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER; // Static helper functions ==================================================== @@ -141,40 +139,25 @@ Reference< XInterface > ScfApiHelper::CreateInstanceWithArgs( return CreateInstanceWithArgs( ::comphelper::getProcessServiceFactory(), rServiceName, rArgs ); } -String ScfApiHelper::QueryPasswordForMedium( SfxMedium& rMedium ) +String ScfApiHelper::QueryPasswordForMedium( SfxMedium& rMedium, + ::comphelper::IDocPasswordVerifier& rVerifier, const ::std::vector< OUString >* pDefaultPasswords ) { - String aPassw; - const SfxItemSet* pSet = rMedium.GetItemSet(); + OUString aMediaPassword; + SfxItemSet* pItemSet = rMedium.GetItemSet(); const SfxPoolItem *pPasswordItem; + if( pItemSet && (SFX_ITEM_SET == pItemSet->GetItemState( SID_PASSWORD, TRUE, &pPasswordItem )) ) + aMediaPassword = static_cast< const SfxStringItem* >( pPasswordItem )->GetValue(); + OUString aDocName = INetURLObject( rMedium.GetOrigURL() ).GetName( INetURLObject::DECODE_WITH_CHARSET ); - if( pSet && (SFX_ITEM_SET == pSet->GetItemState( SID_PASSWORD, TRUE, &pPasswordItem )) ) - { - aPassw = static_cast< const SfxStringItem* >( pPasswordItem )->GetValue(); - } - else - { - try - { - Reference< XInteractionHandler > xHandler( rMedium.GetInteractionHandler() ); - if( xHandler.is() ) - { - RequestDocumentPassword* pRequest = new RequestDocumentPassword( - ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER, - INetURLObject( rMedium.GetOrigURL() ).GetName( INetURLObject::DECODE_WITH_CHARSET ) ); - Reference< XInteractionRequest > xRequest( pRequest ); - - xHandler->handle( xRequest ); - - if( pRequest->isPassword() ) - aPassw = pRequest->getPassword(); - } - } - catch( Exception& ) - { - } - } + bool bIsDefaultPassword = false; + OUString aPassword = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword( + rVerifier, aMediaPassword, rMedium.GetInteractionHandler(), aDocName, + ::comphelper::DocPasswordRequestType_MS, pDefaultPasswords, &bIsDefaultPassword ); + + if( !bIsDefaultPassword && (aPassword.getLength() > 0) && pItemSet ) + pItemSet->Put( SfxStringItem( SID_PASSWORD, aPassword ) ); - return aPassw; + return aPassword; } // Property sets ============================================================== diff --git a/sc/source/filter/inc/fapihelper.hxx b/sc/source/filter/inc/fapihelper.hxx index d8881889e7fa..f3cdc782ee9c 100644 --- a/sc/source/filter/inc/fapihelper.hxx +++ b/sc/source/filter/inc/fapihelper.hxx @@ -45,6 +45,8 @@ namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } } +namespace comphelper { class IDocPasswordVerifier; } + // Static helper functions ==================================================== class SfxMedium; @@ -109,7 +111,9 @@ public: /** Opens a password dialog and returns the entered password. @return The entered password or an empty string on 'Cancel' or any error. */ - static String QueryPasswordForMedium( SfxMedium& rMedium ); + static String QueryPasswordForMedium( SfxMedium& rMedium, + ::comphelper::IDocPasswordVerifier& rVerifier, + const ::std::vector< ::rtl::OUString >* pDefaultPasswords = 0 ); }; template< typename Type > diff --git a/sc/source/filter/inc/fdumper.hxx b/sc/source/filter/inc/fdumper.hxx deleted file mode 100644 index ea4aabf69009..000000000000 --- a/sc/source/filter/inc/fdumper.hxx +++ /dev/null @@ -1,1520 +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: fdumper.hxx,v $ - * $Revision: 1.8.28.2 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SC_FDUMPER_HXX -#define SC_FDUMPER_HXX - -#define SCF_INCL_DUMPER (OSL_DEBUG_LEVEL > 0) && 0 - -#include -// #include -#include "ftools.hxx" - -#if SCF_INCL_DUMPER - -class SvStream; -class SfxMedium; -class SfxObjectShell; -class Color; -class DateTime; - -namespace scf { -namespace dump { - -#define SCF_DUMP_UNUSED "unused" -#define SCF_DUMP_UNKNOWN "?unknown" - -#define SCF_DUMP_ERRASCII( ascii ) "?err:" ascii -#define SCF_DUMP_ERRSTRING( ascii ) CREATE_STRING( SCF_DUMP_ERRASCII( ascii ) ) - -#define SCF_DUMP_ERR_NOMAP SCF_DUMP_ERRSTRING( "no-map" ) -#define SCF_DUMP_ERR_NONAME SCF_DUMP_ERRSTRING( "no-name" ) -#define SCF_DUMP_ERR_STREAM SCF_DUMP_ERRSTRING( "stream-error" ) - -// ============================================================================ -// ============================================================================ - -/** Specifiers for atomic data types. */ -enum DataType -{ - DATATYPE_VOID, /// No data type. - DATATYPE_INT8, /// Signed 8-bit integer. - DATATYPE_UINT8, /// Unsigned 8-bit integer. - DATATYPE_INT16, /// Signed 16-bit integer. - DATATYPE_UINT16, /// Unsigned 16-bit integer. - DATATYPE_INT32, /// Signed 32-bit integer. - DATATYPE_UINT32, /// Unsigned 32-bit integer. - DATATYPE_INT64, /// Signed 64-bit integer. - DATATYPE_UINT64, /// Unsigned 64-bit integer. - DATATYPE_FLOAT, /// Floating-point, single precision. - DATATYPE_DOUBLE /// Floating-point, double precision. -}; - -// ---------------------------------------------------------------------------- - -/** Specifiers for the output format of values. */ -enum FormatType -{ - FORMATTYPE_NONE, /// No numeric format (e.g. show name only). - FORMATTYPE_DEC, /// Decimal. - FORMATTYPE_HEX, /// Hexadecimal. - FORMATTYPE_BIN, /// Binary. - FORMATTYPE_FIX, /// Fixed-point. - FORMATTYPE_BOOL /// Boolean ('true' or 'false'). -}; - -// ---------------------------------------------------------------------------- - -/** Describes the output format of a data item. - - Data items are written in the following format: - - == - - NAME is the name of the data item. The name is contained in the members - maItemName and maItemNameUtf8. If the name is empty, only the value is - written (without a leading equality sign). - - VALUE is the numeric value of the data item. Its format is dependent on the - output format given in the member meFmtType. If the format type is - FORMATTYPE_NONE, no value is written. - - NAME-FROM-LIST is a symbolic name for the current value of the data item. - Various types of name lists produce different names for values, which can - be used for enumerations or names for single bits in bitfields (see class - NameListBase and derived classes). The name of the list is given in the - member maListName. If it is empty, no name is written for the value. - */ -struct ItemFormat -{ - DataType meDataType; /// Data type of the item. - FormatType meFmtType; /// Output format for the value. - String maItemName; /// Name of the item. - ByteString maItemNameUtf8; /// Name of the item, converted to UTF-8. - String maListName; /// Name of a name list to be used for this item. - - explicit ItemFormat(); - - void Set( DataType eDataType, FormatType eFmtType, const String& rItemName ); - void Set( DataType eDataType, FormatType eFmtType, const String& rItemName, const String& rListName ); - - /** Initializes the struct from a vector of strings containing the item format. - - The vector must contain at least 2 strings. The struct is filled from - the strings in the vector in the following order: - 1) Data type (one of: [u]int8, [u]int16, [u]int32, [u]int64, float, double). - 2) Format type (one of: dec, hex, bin, fix, bool, unused, unknown). - 3) Item name (optional). - 4) Name list name (optional). - - @return Iterator pointing to the first unhandled string. - */ - ScfStringVec::const_iterator Parse( const ScfStringVec& rFormatVec ); - - /** Initializes the struct from a string containing the item format. - - The string must have the following format: - DATATYPE,FORMATTYPE[,ITEMNAME[,LISTNAME]] - - DATATYPE is the data type of the item (see above for possible values). - FORMATTYPE is the format type of the item (see above for possible values). - ITEMNAME is the name of the item (optional). - LISTNAME is the name of a name list (optional). - - @return List containing remaining unhandled format strings. - */ - ScfStringVec Parse( const String& rFormatStr ); -}; - -// ============================================================================ -// ============================================================================ - -/** Static helper functions for formatted output to strings. */ -class StringHelper -{ -public: - // append string to string ------------------------------------------------ - - static void AppendString( String& rStr, const String& rData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' ); - - // append decimal --------------------------------------------------------- - - static void AppendDec( String& rStr, sal_uInt8 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' ); - static void AppendDec( String& rStr, sal_Int8 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' ); - static void AppendDec( String& rStr, sal_uInt16 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' ); - static void AppendDec( String& rStr, sal_Int16 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' ); - static void AppendDec( String& rStr, sal_uInt32 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' ); - static void AppendDec( String& rStr, sal_Int32 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' ); - static void AppendDec( String& rStr, sal_uInt64 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' ); - static void AppendDec( String& rStr, sal_Int64 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' ); - static void AppendDec( String& rStr, double fData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' ); - - // append hexadecimal ----------------------------------------------------- - - static void AppendHex( String& rStr, sal_uInt8 nData, bool bPrefix = true ); - static void AppendHex( String& rStr, sal_Int8 nData, bool bPrefix = true ); - static void AppendHex( String& rStr, sal_uInt16 nData, bool bPrefix = true ); - static void AppendHex( String& rStr, sal_Int16 nData, bool bPrefix = true ); - static void AppendHex( String& rStr, sal_uInt32 nData, bool bPrefix = true ); - static void AppendHex( String& rStr, sal_Int32 nData, bool bPrefix = true ); - static void AppendHex( String& rStr, sal_uInt64 nData, bool bPrefix = true ); - static void AppendHex( String& rStr, sal_Int64 nData, bool bPrefix = true ); - static void AppendHex( String& rStr, double fData, bool bPrefix = true ); - - // append shortened hexadecimal ------------------------------------------- - - static void AppendShortHex( String& rStr, sal_uInt8 nData, bool bPrefix = true ); - static void AppendShortHex( String& rStr, sal_Int8 nData, bool bPrefix = true ); - static void AppendShortHex( String& rStr, sal_uInt16 nData, bool bPrefix = true ); - static void AppendShortHex( String& rStr, sal_Int16 nData, bool bPrefix = true ); - static void AppendShortHex( String& rStr, sal_uInt32 nData, bool bPrefix = true ); - static void AppendShortHex( String& rStr, sal_Int32 nData, bool bPrefix = true ); - static void AppendShortHex( String& rStr, sal_uInt64 nData, bool bPrefix = true ); - static void AppendShortHex( String& rStr, sal_Int64 nData, bool bPrefix = true ); - - // append binary ---------------------------------------------------------- - - static void AppendBin( String& rStr, sal_uInt8 nData, bool bDots = true ); - static void AppendBin( String& rStr, sal_Int8 nData, bool bDots = true ); - static void AppendBin( String& rStr, sal_uInt16 nData, bool bDots = true ); - static void AppendBin( String& rStr, sal_Int16 nData, bool bDots = true ); - static void AppendBin( String& rStr, sal_uInt32 nData, bool bDots = true ); - static void AppendBin( String& rStr, sal_Int32 nData, bool bDots = true ); - static void AppendBin( String& rStr, sal_uInt64 nData, bool bDots = true ); - static void AppendBin( String& rStr, sal_Int64 nData, bool bDots = true ); - static void AppendBin( String& rStr, double fData, bool bDots = true ); - - // append fixed-point decimal --------------------------------------------- - - template< typename Type > - static void AppendFix( String& rStr, Type nData, xub_StrLen nWidth = 0 ); - - // append formatted value ------------------------------------------------- - - static void AppendBool( String& rStr, bool bData ); - template< typename Type > - static void AppendValue( String& rStr, Type nData, FormatType eFmtType ); - - // encoded text output ---------------------------------------------------- - - static void AppendCChar( String& rStr, sal_Unicode cChar, bool bPrefix = true ); - static void AppendEncChar( String& rStr, sal_Unicode cChar, xub_StrLen nCount = 1, bool bPrefix = true ); - static void AppendEncString( String& rStr, const String& rData, bool bPrefix = true ); - - // token list ------------------------------------------------------------- - - static void AppendToken( String& rStr, const String& rToken, sal_Unicode cSep = ',' ); - static void AppendToken( String& rStr, sal_Int64 nToken, sal_Unicode cSep = ',' ); - static void PrependToken( String& rStr, const String& rToken, sal_Unicode cSep = ',' ); - static void PrependToken( String& rStr, sal_Int64 nToken, sal_Unicode cSep = ',' ); - - static void AppendIndex( String& rStr, const String& rIdx ); - static void AppendIndex( String& rStr, sal_Int64 nIdx ); - static void AppendIndexedText( String& rStr, const String& rData, const String& rIdx ); - static void AppendIndexedText( String& rStr, const String& rData, sal_Int64 nIdx ); - - static String GetToken( const String& rData, xub_StrLen& rnPos, sal_Unicode cSep = ',' ); - - // quoting and trimming --------------------------------------------------- - - /** Encloses the passed string with the passed characters. Uses cOpen, if cClose is NUL. */ - static void Enclose( String& rStr, sal_Unicode cOpen, sal_Unicode cClose = '\0' ); - - static void TrimSpaces( String& rStr ); - static void TrimQuotes( String& rStr ); - - // string conversion ------------------------------------------------------ - - static ByteString ConvertToUtf8( const String& rStr ); - static DataType ConvertToDataType( const String& rStr ); - static FormatType ConvertToFormatType( const String& rStr ); - - static bool ConvertFromDec( sal_Int64& rnData, const String& rData ); - static bool ConvertFromHex( sal_Int64& rnData, const String& rData ); - - static bool ConvertStringToInt( sal_Int64& rnData, const String& rData ); - static bool ConvertStringToDouble( double& rfData, const String& rData ); - static bool ConvertStringToBool( const String& rData ); - - // string to list conversion ---------------------------------------------- - - static void ConvertStringToStringList( ScfStringVec& rVec, const String& rData, bool bIgnoreEmpty ); - static void ConvertStringToIntList( ScfInt64Vec& rVec, const String& rData, bool bIgnoreEmpty ); - - // file names ------------------------------------------------------------- - - static String ConvertFileNameToUrl( const String& rFileName ); - static xub_StrLen GetFileNamePos( const String& rFileUrl ); -}; - -// ---------------------------------------------------------------------------- - -template< typename Type > -void StringHelper::AppendFix( String& rStr, Type nData, xub_StrLen nWidth ) -{ - AppendDec( rStr, static_cast< double >( nData ) / pow( 2.0, 4.0 * sizeof( Type ) ), nWidth ); -} - -template< typename Type > -void StringHelper::AppendValue( String& rStr, Type nData, FormatType eFmtType ) -{ - switch( eFmtType ) - { - case FORMATTYPE_DEC: AppendDec( rStr, nData ); break; - case FORMATTYPE_HEX: AppendHex( rStr, nData ); break; - case FORMATTYPE_BIN: AppendBin( rStr, nData ); break; - case FORMATTYPE_FIX: AppendFix( rStr, nData ); break; - case FORMATTYPE_BOOL: AppendBool( rStr, nData ); break; - default:; - } -} - -// ============================================================================ - -class StringWrapper -{ -public: - inline StringWrapper() {} - inline /*implicit*/ StringWrapper( const String& rStr ) : maStr( rStr ) {} - inline /*implicit*/ StringWrapper( const sal_Char* pcStr ) : maStr( String::CreateFromAscii( pcStr ? pcStr : "" ) ) {} - inline /*implicit*/ StringWrapper( sal_Unicode cChar ) : maStr( cChar ) {} - - inline bool Empty() const { return maStr.Len() == 0; } - inline const String& GetString() const { return maStr; } - -private: - String maStr; -}; - -// ============================================================================ -// ============================================================================ - -class Base; -typedef ScfRef< Base > BaseRef; - -/** Base class for all dumper classes. - - Derived classes implement the virtual function ImplIsValid(). It should - check all members the other functions rely on. If the function - ImplIsValid() returns true, all references and pointers can be used without - further checking. - - Overview of all classes in this header file based on this Base class: - - Base - | - +----> NameListBase - | | - | +----> ConstList ------> MultiList - | +----> FlagsList ------> CombiList - | +----> UnitConverter - | - +----> ConfigCoreData - +----> Config - +----> CoreData - | - +----> Input ------> SvStreamInput - +----> Output - | - +----> ObjectBase - | - +----> InputObjectBase - | | - | +----> StreamObjectBase - | | | - | | +----> SvStreamObject - | | +----> OleStreamObject - | | +----> WrappedStreamObject - | | - | +----> RecordHeaderBase - | - +----> OleStorageObject - +----> DumperBase - */ -class Base -{ -public: - virtual ~Base(); - - inline bool IsValid() const { return ImplIsValid(); } - inline static bool IsValid( BaseRef xBase ) { return xBase.is() && xBase->IsValid(); } - -protected: - inline explicit Base() {} - - virtual bool ImplIsValid() const = 0; -}; - -// ============================================================================ -// ============================================================================ - -class ConfigItemBase -{ -public: - virtual ~ConfigItemBase(); - void ReadConfigBlock( SvStream& rStrm ); - -protected: - inline explicit ConfigItemBase() {} - - virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData ); - virtual void ImplProcessConfigItemInt( SvStream& rStrm, sal_Int64 nKey, const String& rData ); - - void ReadConfigBlockContents( SvStream& rStrm ); - void IgnoreConfigBlockContents( SvStream& rStrm ); - -private: - enum LineType { LINETYPE_DATA, LINETYPE_BEGIN, LINETYPE_END }; - - LineType ReadConfigLine( SvStream& rStrm, String& rKey, String& rData ) const; - LineType ReadConfigLine( SvStream& rStrm ) const; - void ProcessConfigItem( SvStream& rStrm, const String& rKey, const String& rData ); -}; - -// ============================================================================ - -class ConfigCoreData; -class Config; - -class NameListBase; -typedef ScfRef< NameListBase > NameListRef; - -/** Base class of all classes providing names for specific values (name lists). - - The idea is to provide a unique interfase for all different methods to - write specific names for any values. This can be enumerations (dedicated - names for a subset of values), or names for bits in bit fields. Classes - derived from this base class implement the specific behaviour for the - desired purpose. - */ -class NameListBase : public Base, public ConfigItemBase -{ -public: - typedef ::std::map< sal_Int64, String > StringMap; - typedef StringMap::const_iterator const_iterator; - - virtual ~NameListBase(); - - /** Sets a name for the specified key. */ - void SetName( sal_Int64 nKey, const StringWrapper& rNameWrp ); - /** Include all names of the passed list. */ - void IncludeList( NameListRef xList ); - - /** Returns true, if the map contains an entry for the passed key. */ - template< typename Type > - inline bool HasName( Type nKey ) const - { return maMap.count( static_cast< sal_Int64 >( nKey ) ) != 0; } - /** Returns the name for the passed key. */ - template< typename Type > - inline String GetName( const Config& rCfg, Type nKey ) const - { return ImplGetName( rCfg, static_cast< sal_Int64 >( nKey ) ); } - /** Returns a display name for the passed double value. */ - inline String GetName( const Config& rCfg, double fValue ) const - { return ImplGetNameDbl( rCfg, fValue ); } - - /** Returns a map iterator pointing to the first contained name. */ - inline const_iterator begin() const { return maMap.begin(); } - /** Returns a map iterator pointing one past the last contained name. */ - inline const_iterator end() const { return maMap.end(); } - -protected: - inline explicit NameListBase( const ConfigCoreData& rCoreData ) : mrCoreData( rCoreData ) {} - - virtual bool ImplIsValid() const; - virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData ); - virtual void ImplProcessConfigItemInt( SvStream& rStrm, sal_Int64 nKey, const String& rData ); - - /** Derived classes set the name for the passed key. */ - virtual void ImplSetName( sal_Int64 nKey, const String& rName ) = 0; - /** Derived classes generate and return the name for the passed key. */ - virtual String ImplGetName( const Config& rCfg, sal_Int64 nKey ) const = 0; - /** Derived classes generate and return the name for the passed double value. */ - virtual String ImplGetNameDbl( const Config& rCfg, double fValue ) const = 0; - /** Derived classes insert all names and other settings from the passed list. */ - virtual void ImplIncludeList( const NameListBase& rList ) = 0; - - /** Returns the configuration core data, which can be used to access other name lists. */ - inline const ConfigCoreData& GetCoreData() const { return mrCoreData; } - /** Inserts the passed name into the internal map. */ - void InsertRawName( sal_Int64 nKey, const String& rName ); - /** Returns the name for the passed key, or 0, if nothing found. */ - const String* FindRawName( sal_Int64 nKey ) const; - -private: - /** Includes name lists, given in a comma separated list of names of the lists. */ - void Include( const String& rListKeys ); - /** Excludes names from the list, given by a comma separated list of their keys. */ - void Exclude( const String& rKeys ); - -private: - StringMap maMap; - const ConfigCoreData& mrCoreData; -}; - -// ============================================================================ - -class ConstList : public NameListBase -{ -public: - explicit ConstList( const ConfigCoreData& rCoreData ); - - /** Sets a default name for unknown keys. */ - inline void SetDefaultName( const StringWrapper& rDefName ) { maDefName = rDefName.GetString(); } - /** Enables or disables automatic quotation of returned names. */ - inline void SetQuoteNames( bool bQuoteNames ) { mbQuoteNames = bQuoteNames; } - -protected: - virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData ); - - /** Sets the name for the passed key. */ - virtual void ImplSetName( sal_Int64 nKey, const String& rName ); - /** Returns the name for the passed key, or the default name, if key is not contained. */ - virtual String ImplGetName( const Config& rCfg, sal_Int64 nKey ) const; - /** Returns the name for the passed double value. */ - virtual String ImplGetNameDbl( const Config& rCfg, double fValue ) const; - /** Inserts all names from the passed list. */ - virtual void ImplIncludeList( const NameListBase& rList ); - -private: - String maDefName; - bool mbQuoteNames; -}; - -// ============================================================================ - -class MultiList : public ConstList -{ -public: - explicit MultiList( const ConfigCoreData& rCoreData ); - - void SetNamesFromVec( sal_Int64 nStartKey, const ScfStringVec& rNames ); - -protected: - virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData ); - virtual void ImplSetName( sal_Int64 nKey, const String& rName ); - -private: - void InsertNames( sal_Int64 nStartKey, const String& rData ); - -private: - bool mbIgnoreEmpty; -}; - -// ============================================================================ - -class FlagsList : public NameListBase -{ -public: - explicit FlagsList( const ConfigCoreData& rCoreData ); - - /** Sets flags to be ignored on output. */ - template< typename Type > - inline void SetIgnoreFlags( Type nIgnore ) - { mnIgnore = static_cast< sal_Int64 >( nIgnore ); } - -protected: - virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData ); - - /** Sets the name for the passed key. */ - virtual void ImplSetName( sal_Int64 nKey, const String& rName ); - /** Returns the name for the passed key. */ - virtual String ImplGetName( const Config& rCfg, sal_Int64 nKey ) const; - /** Returns the name for the passed double value. */ - virtual String ImplGetNameDbl( const Config& rCfg, double fValue ) const; - /** Inserts all flags from the passed list. */ - virtual void ImplIncludeList( const NameListBase& rList ); - -private: - sal_Int64 mnIgnore; -}; - -// ============================================================================ - -class CombiList : public FlagsList -{ -public: - explicit CombiList( const ConfigCoreData& rCoreData ); - -protected: - /** Sets the name for the passed key. */ - virtual void ImplSetName( sal_Int64 nKey, const String& rName ); - /** Returns the name for the passed key. */ - virtual String ImplGetName( const Config& rCfg, sal_Int64 nKey ) const; - /** Inserts all flags from the passed list. */ - virtual void ImplIncludeList( const NameListBase& rList ); - -private: - struct ExtItemFormat : public ItemFormat - { - bool mbShiftValue; - inline explicit ExtItemFormat() : mbShiftValue( true ) {} - }; - typedef ::std::map< sal_Int64, ExtItemFormat > ExtItemFormatMap; - ExtItemFormatMap maFmtMap; -}; - -// ============================================================================ - -class UnitConverter : public NameListBase -{ -public: - explicit UnitConverter( const ConfigCoreData& rCoreData ); - - inline void SetUnitName( const StringWrapper& rUnitName ) { maUnitName = rUnitName.GetString(); } - inline void SetFactor( double fFactor ) { mfFactor = fFactor; } - -protected: - /** Sets the name for the passed key. */ - virtual void ImplSetName( sal_Int64 nKey, const String& rName ); - /** Returns the converted value with appended unit name. */ - virtual String ImplGetName( const Config& rCfg, sal_Int64 nKey ) const; - /** Returns the converted value with appended unit name. */ - virtual String ImplGetNameDbl( const Config& rCfg, double fValue ) const; - /** Empty implementation. */ - virtual void ImplIncludeList( const NameListBase& rList ); - -private: - String maUnitName; - double mfFactor; -}; - -// ============================================================================ - -class NameListWrapper -{ -public: - inline NameListWrapper() {} - inline /*implicit*/ NameListWrapper( const String& rListName ) : maNameWrp( rListName ) {} - inline /*implicit*/ NameListWrapper( const sal_Char* pcListName ) : maNameWrp( pcListName ) {} - inline /*implicit*/ NameListWrapper( NameListRef xList ) : mxList( xList ) {} - - inline bool Empty() const { return !mxList && maNameWrp.Empty(); } - NameListRef GetNameList( const Config& rCfg ) const; - -private: - StringWrapper maNameWrp; - mutable NameListRef mxList; -}; - -static const NameListWrapper NO_LIST; - -// ============================================================================ -// ============================================================================ - -class ConfigCoreData : public Base, public ConfigItemBase -{ -public: - explicit ConfigCoreData( const String& rFileName ); - virtual ~ConfigCoreData(); - - void SetOption( const String& rKey, const String& rData ); - const String* GetOption( const String& rKey ) const; - - template< typename ListType > - ScfRef< ListType > CreateNameList( const String& rListName ); - void SetNameList( const String& rListName, NameListRef xList ); - void EraseNameList( const String& rListName ); - NameListRef GetNameList( const String& rListName ) const; - -protected: - inline explicit ConfigCoreData() : mbLoaded( false ) {} - void Construct( const String& rFileName ); - - virtual bool ImplIsValid() const; - virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData ); - -private: - void ConstructCfgCoreData(); - - bool ReadConfigFile( const String& rFileUrl ); - template< typename ListType > - void ReadNameList( SvStream& rStrm, const String& rListName ); - void CreateShortList( const String& rData ); - void CreateUnitConverter( const String& rData ); - -private: - typedef ::std::map< String, String > ConfigDataMap; - typedef ::std::map< String, NameListRef > NameListMap; - - ConfigDataMap maConfigData; - NameListMap maNameLists; - String maConfigPath; - bool mbLoaded; -}; - -// ---------------------------------------------------------------------------- - -template< typename ListType > -ScfRef< ListType > ConfigCoreData::CreateNameList( const String& rListName ) -{ - ScfRef< ListType > xList; - if( rListName.Len() > 0 ) - { - xList.reset( new ListType( *this ) ); - SetNameList( rListName, xList ); - } - return xList; -} - -template< typename ListType > -void ConfigCoreData::ReadNameList( SvStream& rStrm, const String& rListName ) -{ - NameListRef xList = CreateNameList< ListType >( rListName ); - if( xList.is() ) - xList->ReadConfigBlock( rStrm ); -} - -// ============================================================================ - -class Config : public Base -{ -public: - explicit Config( const Config& rParent ); - explicit Config( const String& rFileName ); - explicit Config( const sal_Char* pcEnvVar ); - virtual ~Config(); - - void SetStringOption( const StringWrapper& rKey, const StringWrapper& rData ); - - const String& GetStringOption( const StringWrapper& rKey, const String& rDefault ) const; - bool GetBoolOption( const StringWrapper& rKey, bool bDefault ) const; - template< typename Type > - Type GetIntOption( const StringWrapper& rKey, Type nDefault ) const; - - bool IsDumperEnabled() const; - bool IsImportEnabled() const; - - template< typename ListType > - ScfRef< ListType > CreateNameList( const StringWrapper& rListName ); - void SetNameList( const StringWrapper& rListName, NameListRef xList ); - void EraseNameList( const StringWrapper& rListName ); - NameListRef GetNameList( const StringWrapper& rListName ) const; - - /** Returns the name for the passed key from the passed name list. */ - template< typename Type > - String GetName( const NameListWrapper& rListWrp, Type nKey ) const; - /** Returns true, if the passed name list contains an entry for the passed key. */ - template< typename Type > - bool HasName( const NameListWrapper& rList, Type nKey ) const; - -protected: - inline explicit Config() {} - void Construct( const Config& rParent ); - void Construct( const String& rFileName ); - void Construct( const sal_Char* pcEnvVar ); - - virtual bool ImplIsValid() const; - virtual const String* ImplGetOption( const String& rKey ) const; - virtual NameListRef ImplGetNameList( const String& rListName ) const; - -private: - typedef ScfRef< ConfigCoreData > ConfigCoreDataRef; - ConfigCoreDataRef mxCoreData; -}; - -typedef ScfRef< Config > ConfigRef; - -// ---------------------------------------------------------------------------- - -template< typename Type > -Type Config::GetIntOption( const StringWrapper& rKey, Type nDefault ) const -{ - sal_Int64 nRawData; - const String* pData = ImplGetOption( rKey.GetString() ); - return (pData && StringHelper::ConvertStringToInt( nRawData, *pData )) ? - static_cast< Type >( nRawData ) : nDefault; -} - -template< typename ListType > -ScfRef< ListType > Config::CreateNameList( const StringWrapper& rListName ) -{ - return mxCoreData->CreateNameList< ListType >( rListName.GetString() ); -} - -template< typename Type > -String Config::GetName( const NameListWrapper& rListWrp, Type nKey ) const -{ - NameListRef xList = rListWrp.GetNameList( *this ); - return xList.is() ? xList->GetName( *this, nKey ) : SCF_DUMP_ERR_NOMAP; -} - -template< typename Type > -bool Config::HasName( const NameListWrapper& rListWrp, Type nKey ) const -{ - NameListRef xList = rListWrp.GetNameList( *this ); - return xList.is() && xList->HasName( nKey ); -} - -// ============================================================================ -// ============================================================================ - -class CoreData : public Base -{ -public: - explicit CoreData( SfxMedium& rMedium, SfxObjectShell* pDocShell ); - - inline SfxMedium& GetMedium() { return mrMedium; } - inline SfxObjectShell* GetDocShell() { return mpDocShell; } - SvStream& GetCoreStream(); - -protected: - virtual bool ImplIsValid() const; - -private: - SfxMedium& mrMedium; - SfxObjectShell* mpDocShell; -}; - -typedef ScfRef< CoreData > CoreDataRef; - -// ============================================================================ -// ============================================================================ - -class Input : public Base -{ -public: - virtual sal_Size GetSize() const = 0; - virtual sal_Size Tell() const = 0; - virtual void Seek( sal_Size nPos ) = 0; - virtual void SeekRel( sal_sSize nRelPos ) = 0; - virtual sal_Size Read( void* pBuffer, sal_Size nSize ) = 0; - virtual void ReadLine( String& rLine, rtl_TextEncoding eEnc ) = 0; - - virtual Input& operator>>( sal_Int8& rnData ) = 0; - virtual Input& operator>>( sal_uInt8& rnData ) = 0; - virtual Input& operator>>( sal_Int16& rnData ) = 0; - virtual Input& operator>>( sal_uInt16& rnData ) = 0; - virtual Input& operator>>( sal_Int32& rnData ) = 0; - virtual Input& operator>>( sal_uInt32& rnData ) = 0; - virtual Input& operator>>( float& rfData ) = 0; - virtual Input& operator>>( double& rfData ) = 0; - - inline bool IsValidPos() const { return Tell() < GetSize(); } - template< typename Type > - inline Type ReadValue() { Type nValue; *this >> nValue; return nValue; } - -protected: - virtual bool ImplIsValid() const; -}; - -typedef ScfRef< Input > InputRef; - -Input& operator>>( Input& rIn, sal_Int64& rnData ); -Input& operator>>( Input& rIn, sal_uInt64& rnData ); - -// ============================================================================ - -class SvStreamInput : public Input -{ -public: - explicit SvStreamInput( SvStream& rStrm ); - virtual ~SvStreamInput(); - - virtual sal_Size GetSize() const; - virtual sal_Size Tell() const; - virtual void Seek( sal_Size nPos ); - virtual void SeekRel( sal_sSize nRelPos ); - virtual sal_Size Read( void* pBuffer, sal_Size nSize ); - virtual void ReadLine( String& rLine, rtl_TextEncoding eEnc ); - - virtual SvStreamInput& operator>>( sal_Int8& rnData ); - virtual SvStreamInput& operator>>( sal_uInt8& rnData ); - virtual SvStreamInput& operator>>( sal_Int16& rnData ); - virtual SvStreamInput& operator>>( sal_uInt16& rnData ); - virtual SvStreamInput& operator>>( sal_Int32& rnData ); - virtual SvStreamInput& operator>>( sal_uInt32& rnData ); - virtual SvStreamInput& operator>>( float& rfData ); - virtual SvStreamInput& operator>>( double& rfData ); - -private: - SvStream& mrStrm; -}; - -// ============================================================================ -// ============================================================================ - -class Output : public Base -{ -public: - explicit Output( SvStream& rStrm ); - - // ------------------------------------------------------------------------ - - void NewLine(); - void EmptyLine( size_t nCount = 1 ); - inline String& GetLine() { return maLine; } - - void SetPrefix( const String& rPrefix ); - inline const String& GetPrefix() const { return maPrefix; } - - void IncIndent(); - void DecIndent(); - void ResetIndent(); - - void StartTable( xub_StrLen nW1 ); - void StartTable( xub_StrLen nW1, xub_StrLen nW2 ); - void StartTable( xub_StrLen nW1, xub_StrLen nW2, xub_StrLen nW3 ); - void StartTable( xub_StrLen nW1, xub_StrLen nW2, xub_StrLen nW3, xub_StrLen nW4 ); - void StartTable( size_t nColCount, const xub_StrLen* pnColWidths ); - void Tab(); - void Tab( size_t nCol ); - void EndTable(); - - void ResetItemIndex( sal_Int64 nIdx = 0 ); - void StartItem( const sal_Char* pcName = 0 ); - void ContItem(); - void EndItem(); - inline const String& GetLastItemValue() const { return maLastItem; } - - void StartMultiItems(); - void EndMultiItems(); - - // ------------------------------------------------------------------------ - - void WriteChar( sal_Unicode cChar, xub_StrLen nCount = 1 ); - void WriteAscii( const sal_Char* pcStr ); - void WriteString( const String& rStr ); - void WriteArray( const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = ',' ); - void WriteBool( bool bData ); - void WriteColor( const Color& rColor ); - void WriteDateTime( const DateTime& rDateTime ); - - - template< typename Type > - inline void WriteDec( Type nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' ) - { StringHelper::AppendDec( maLine, nData, nWidth, cFill ); } - template< typename Type > - inline void WriteHex( Type nData, bool bPrefix = true ) - { StringHelper::AppendHex( maLine, nData, bPrefix ); } - template< typename Type > - inline void WriteBin( Type nData, bool bDots = true ) - { StringHelper::AppendBin( maLine, nData, bDots ); } - template< typename Type > - inline void WriteFix( Type nData, xub_StrLen nWidth = 0 ) - { StringHelper::AppendFix( maLine, nData, nWidth ); } - template< typename Type > - inline void WriteValue( Type nData, FormatType eFmtType ) - { StringHelper::AppendValue( maLine, nData, eFmtType ); } - template< typename Type > - inline void WriteName( const Config& rCfg, Type nData, const NameListWrapper& rListWrp ) - { WriteString( rCfg.GetName( rListWrp, nData ) ); } - - // ------------------------------------------------------------------------ -protected: - virtual bool ImplIsValid() const; - -private: - void WriteItemName( const sal_Char* pcName ); - -private: - typedef ::std::vector< xub_StrLen > StringLenVec; - - SvStream& mrStrm; - String maPrefix; - ByteString maPrefixUtf8; - ByteString maIndent; - String maLine; - String maLastItem; - StringLenVec maColPos; - size_t mnCol; - size_t mnItemLevel; - size_t mnMultiLevel; - sal_Int64 mnItemIdx; - xub_StrLen mnLastItem; -}; - -typedef ScfRef< Output > OutputRef; - -// ============================================================================ - -class PrefixGuard : private ScfNoCopy -{ -public: - inline explicit PrefixGuard( Output& rOut, const String& rPrefix ) : - mrOut( rOut ), maOldPrefix( rOut.GetPrefix() ) { mrOut.SetPrefix( rPrefix ); } - inline ~PrefixGuard() { mrOut.SetPrefix( maOldPrefix ); } -private: - Output& mrOut; - String maOldPrefix; -}; - -// ---------------------------------------------------------------------------- - -class IndentGuard : private ScfNoCopy -{ -public: - inline explicit IndentGuard( Output& rOut ) : mrOut( rOut ) { mrOut.IncIndent(); } - inline ~IndentGuard() { mrOut.DecIndent(); } -private: - Output& mrOut; -}; - -// ---------------------------------------------------------------------------- - -class TableGuard : private ScfNoCopy -{ -public: - inline explicit TableGuard( Output& rOut, xub_StrLen nW1 ) : - mrOut( rOut ) { mrOut.StartTable( nW1 ); } - inline explicit TableGuard( Output& rOut, xub_StrLen nW1, xub_StrLen nW2 ) : - mrOut( rOut ) { mrOut.StartTable( nW1, nW2 ); } - inline explicit TableGuard( Output& rOut, xub_StrLen nW1, xub_StrLen nW2, xub_StrLen nW3 ) : - mrOut( rOut ) { mrOut.StartTable( nW1, nW2, nW3 ); } - inline explicit TableGuard( Output& rOut, xub_StrLen nW1, xub_StrLen nW2, xub_StrLen nW3, xub_StrLen nW4 ) : - mrOut( rOut ) { mrOut.StartTable( nW1, nW2, nW3, nW4 ); } - inline explicit TableGuard( Output& rOut, size_t nColCount, - const xub_StrLen* pnColWidths ) : - mrOut( rOut ) { mrOut.StartTable( nColCount, pnColWidths ); } - inline ~TableGuard() { mrOut.EndTable(); } - inline void Tab() { mrOut.Tab(); } - inline void Tab( size_t nCol ) { mrOut.Tab( nCol ); } -private: - Output& mrOut; -}; - -// ---------------------------------------------------------------------------- - -class ItemGuard : private ScfNoCopy -{ -public: - inline explicit ItemGuard( Output& rOut, const sal_Char* pcName = 0 ) : - mrOut( rOut ) { mrOut.StartItem( pcName ); } - inline ~ItemGuard() { mrOut.EndItem(); } - inline void Cont() { mrOut.ContItem(); } -private: - Output& mrOut; -}; - -// ---------------------------------------------------------------------------- - -class MultiItemsGuard : private ScfNoCopy -{ -public: - inline explicit MultiItemsGuard( Output& rOut ) : mrOut( rOut ) { mrOut.StartMultiItems(); } - inline ~MultiItemsGuard() { mrOut.EndMultiItems(); } -private: - Output& mrOut; -}; - -// ============================================================================ -// ============================================================================ - -class ObjectBase : public Base -{ -public: - virtual ~ObjectBase(); - - SfxMedium& GetCoreMedium() const; - SvStream& GetCoreStream() const; - - void Dump(); - - // ------------------------------------------------------------------------ -protected: - inline explicit ObjectBase() {} - void Construct( ConfigRef xConfig, CoreDataRef xCore, OutputRef xOut ); - void Construct( const ObjectBase& rParent ); - - virtual bool ImplIsValid() const; - virtual ConfigRef ImplReconstructConfig(); - virtual OutputRef ImplReconstructOutput(); - virtual void ImplDumpHeader(); - virtual void ImplDumpBody(); - virtual void ImplDumpFooter(); - - // ------------------------------------------------------------------------ - - void ReconstructConfig(); - void ReconstructOutput(); - - inline Config& Cfg() const { return *mxConfig; } - inline CoreData& Core() const { return *mxCore; } - inline Output& Out() const { return *mxOut; } - - // ------------------------------------------------------------------------ - - void WriteEmptyItem( const sal_Char* pcName ); - void WriteInfoItem( const sal_Char* pcName, const StringWrapper& rData ); - void WriteStringItem( const sal_Char* pcName, const String& rData ); - void WriteArrayItem( const sal_Char* pcName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = ',' ); - void WriteBoolItem( const sal_Char* pcName, bool bData ); - void WriteColorItem( const sal_Char* pcName, const Color& rColor ); - void WriteDateTimeItem( const sal_Char* pcName, const DateTime& rDateTime ); - void WriteGuidItem( const sal_Char* pcName, const String& rGuid ); - - template< typename Type > - void AddNameToItem( Type nData, const NameListWrapper& rListWrp ); - - template< typename Type > - void WriteNameItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp ); - template< typename Type > - void WriteDecItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type > - void WriteHexItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type > - void WriteBinItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type > - void WriteFixItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type > - void WriteDecBoolItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type > - void WriteValueItem( const sal_Char* pcName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp = NO_LIST ); - - template< typename Type > - void WriteValueItem( const ItemFormat& rItemFmt, Type nData ); - -private: - ConfigRef mxConfig; - CoreDataRef mxCore; - OutputRef mxOut; -}; - -typedef ScfRef< ObjectBase > ObjectRef; - -// ---------------------------------------------------------------------------- - -template< typename Type > -void ObjectBase::AddNameToItem( Type nData, const NameListWrapper& rListWrp ) -{ - if( !rListWrp.Empty() ) - { - mxOut->ContItem(); - mxOut->WriteName( *mxConfig, nData, rListWrp ); - } -} - -template< typename Type > -void ObjectBase::WriteNameItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp ) -{ - ItemGuard aItem( *mxOut, pcName ); - mxOut->WriteName( *mxConfig, nData, rListWrp ); -} - -template< typename Type > -void ObjectBase::WriteDecItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp ) -{ - ItemGuard aItem( *mxOut, pcName ); - mxOut->WriteDec( nData ); - AddNameToItem( nData, rListWrp ); -} - -template< typename Type > -void ObjectBase::WriteHexItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp ) -{ - ItemGuard aItem( *mxOut, pcName ); - mxOut->WriteHex( nData ); - AddNameToItem( nData, rListWrp ); -} - -template< typename Type > -void ObjectBase::WriteBinItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp ) -{ - ItemGuard aItem( *mxOut, pcName ); - mxOut->WriteBin( nData ); - AddNameToItem( nData, rListWrp ); -} - -template< typename Type > -void ObjectBase::WriteFixItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp ) -{ - ItemGuard aItem( *mxOut, pcName ); - mxOut->WriteFix( nData ); - AddNameToItem( nData, rListWrp ); -} - -template< typename Type > -void ObjectBase::WriteDecBoolItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp ) -{ - ItemGuard aItem( *mxOut, pcName ); - mxOut->WriteDec( nData ); - aItem.Cont(); - mxOut->WriteBool( nData != 0 ); - AddNameToItem( nData, rListWrp ); -} - -template< typename Type > -void ObjectBase::WriteValueItem( const sal_Char* pcName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp ) -{ - if( eFmtType == FORMATTYPE_BOOL ) - WriteDecBoolItem( pcName, nData, rListWrp ); - else - { - ItemGuard aItem( *mxOut, pcName ); - mxOut->WriteValue( nData, eFmtType ); - AddNameToItem( nData, rListWrp ); - } -} - -template< typename Type > -void ObjectBase::WriteValueItem( const ItemFormat& rItemFmt, Type nData ) -{ - WriteValueItem( rItemFmt.maItemNameUtf8.GetBuffer(), - nData, rItemFmt.meFmtType, rItemFmt.maListName ); -} - -// ============================================================================ - -class InputObjectBase : public ObjectBase -{ -public: - virtual ~InputObjectBase(); - - // ------------------------------------------------------------------------ -protected: - inline explicit InputObjectBase() {} - void Construct( const ObjectBase& rParent, InputRef xIn ); - void Construct( const InputObjectBase& rParent ); - - virtual bool ImplIsValid() const; - virtual InputRef ImplReconstructInput(); - virtual void ImplDumpBody(); - - // ------------------------------------------------------------------------ - - void ReconstructInput(); - - inline Input& In() const { return *mxIn; } - - // ------------------------------------------------------------------------ - - void SkipBlock( sal_Size nSize, bool bShowSize = true ); - void DumpRawBinary( sal_Size nSize, bool bShowOffset = true, bool bStream = false ); - - void DumpBinary( const sal_Char* pcName, sal_Size nSize, bool bShowOffset = true ); - void DumpArray( const sal_Char* pcName, sal_Size nSize, sal_Unicode cSep = ',' ); - void DumpRemaining( sal_Size nSize ); - inline void DumpUnused( sal_Size nSize ) { DumpArray( SCF_DUMP_UNUSED, nSize ); } - inline void DumpUnknown( sal_Size nSize ) { DumpArray( SCF_DUMP_UNKNOWN, nSize ); } - - void DumpBinaryStream( bool bShowOffset = true ); - void DumpTextStream( rtl_TextEncoding eEnc, bool bShowLines = true ); - - String DumpGuid( const sal_Char* pcName ); - void DumpItem( const ItemFormat& rItemFmt ); - - template< typename Type > - Type DumpName( const sal_Char* pcName, const NameListWrapper& rListWrp ); - template< typename Type > - Type DumpDec( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type > - Type DumpHex( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type > - Type DumpBin( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type > - Type DumpFix( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type > - Type DumpBool( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type > - Type DumpValue( const ItemFormat& rItemFmt ); - - template< typename Type1, typename Type2 > - Type1 DumpName( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type1, typename Type2 > - Type1 DumpDec( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type1, typename Type2 > - Type1 DumpHex( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type1, typename Type2 > - Type1 DumpBin( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type1, typename Type2 > - Type1 DumpFix( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type1, typename Type2 > - Type1 DumpBool( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST ); - template< typename Type1, typename Type2 > - Type1 DumpValue( bool bType1, const ItemFormat& rItemFmt ); - - // ------------------------------------------------------------------------ - - using ObjectBase::Construct; - -private: - InputRef mxIn; -}; - -typedef ScfRef< InputObjectBase > InputObjectRef; - -// ---------------------------------------------------------------------------- - -template< typename Type > -Type InputObjectBase::DumpName( const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - Type nData; - *mxIn >> nData; - WriteNameItem( pcName, nData, rListWrp ); - return nData; -} - -template< typename Type > -Type InputObjectBase::DumpDec( const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - Type nData; - *mxIn >> nData; - WriteDecItem( pcName, nData, rListWrp ); - return nData; -} - -template< typename Type > -Type InputObjectBase::DumpHex( const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - Type nData; - *mxIn >> nData; - WriteHexItem( pcName, nData, rListWrp ); - return nData; -} - -template< typename Type > -Type InputObjectBase::DumpBin( const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - Type nData; - *mxIn >> nData; - WriteBinItem( pcName, nData, rListWrp ); - return nData; -} - -template< typename Type > -Type InputObjectBase::DumpFix( const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - Type nData; - *mxIn >> nData; - WriteFixItem( pcName, nData, rListWrp ); - return nData; -} - -template< typename Type > -Type InputObjectBase::DumpBool( const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - Type nData; - *mxIn >> nData; - WriteDecBoolItem( pcName, nData, rListWrp ); - return nData; -} - -template< typename Type > -Type InputObjectBase::DumpValue( const ItemFormat& rItemFmt ) -{ - Type nData; - *mxIn >> nData; - WriteValueItem( rItemFmt, nData ); - return nData; -} - -template< typename Type1, typename Type2 > -Type1 InputObjectBase::DumpName( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - return bType1 ? DumpName< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpName< Type2 >( pcName, rListWrp ) ); -} - -template< typename Type1, typename Type2 > -Type1 InputObjectBase::DumpDec( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - return bType1 ? DumpDec< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpDec< Type2 >( pcName, rListWrp ) ); -} - -template< typename Type1, typename Type2 > -Type1 InputObjectBase::DumpHex( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - return bType1 ? DumpHex< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpHex< Type2 >( pcName, rListWrp ) ); -} - -template< typename Type1, typename Type2 > -Type1 InputObjectBase::DumpBin( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - return bType1 ? DumpBin< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpBin< Type2 >( pcName, rListWrp ) ); -} - -template< typename Type1, typename Type2 > -Type1 InputObjectBase::DumpFix( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - return bType1 ? DumpFix< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpFix< Type2 >( pcName, rListWrp ) ); -} - -template< typename Type1, typename Type2 > -Type1 InputObjectBase::DumpBool( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp ) -{ - return bType1 ? DumpBool< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpBool< Type2 >( pcName, rListWrp ) ); -} - -template< typename Type1, typename Type2 > -Type1 InputObjectBase::DumpValue( bool bType1, const ItemFormat& rItemFmt ) -{ - return bType1 ? DumpValue< Type1 >( rItemFmt ) : static_cast< Type1 >( DumpValue< Type2 >( rItemFmt ) ); -} - -// ============================================================================ -// ============================================================================ - -class StreamObjectBase : public InputObjectBase -{ -public: - virtual ~StreamObjectBase(); - - inline SvStream& GetStream() { return *mpStrm; } - inline const String& GetStreamName() const { return maName; } - inline const String& GetStreamPath() const { return maPath; } - String GetFullName() const; - sal_Size GetStreamSize() const; - -protected: - inline explicit StreamObjectBase() : mpStrm( 0 ) {} - void Construct( const ObjectBase& rParent, SvStream& rStrm, - const String& rPath, const String& rStrmName, InputRef xIn ); - void Construct( const ObjectBase& rParent, SvStream& rStrm, - const String& rPath, const String& rStrmName ); - void Construct( const ObjectBase& rParent, SvStream& rStrm ); - - virtual bool ImplIsValid() const; - virtual void ImplDumpHeader(); - virtual void ImplDumpFooter(); - virtual void ImplDumpExtendedHeader(); - - using InputObjectBase::Construct; - -private: - void DumpStreamInfo( bool bExtended ); - -private: - SvStream* mpStrm; - String maPath; - String maName; -}; - -typedef ScfRef< StreamObjectBase > StreamObjectRef; - -// ============================================================================ - -class SvStreamObject : public StreamObjectBase -{ -public: - explicit SvStreamObject( const ObjectBase& rParent, SvStream& rStrm ); - virtual ~SvStreamObject(); - -protected: - inline explicit SvStreamObject() {} - void Construct( const ObjectBase& rParent, SvStream& rStrm ); - - using StreamObjectBase::Construct; -}; - -typedef ScfRef< SvStreamObject > SvStreamObjectRef; - -// ============================================================================ - -class WrappedStreamObject : public StreamObjectBase -{ -public: - explicit WrappedStreamObject( const ObjectBase& rParent, StreamObjectRef xStrmObj ); - virtual ~WrappedStreamObject(); - -protected: - inline explicit WrappedStreamObject() {} - void Construct( const ObjectBase& rParent, StreamObjectRef xStrmObj ); - - virtual bool ImplIsValid() const; - - using StreamObjectBase::Construct; - -private: - StreamObjectRef mxStrmObj; -}; - -// ============================================================================ -// ============================================================================ - -struct RecordHeaderConfigInfo -{ - const sal_Char* mpcRecNames; - const sal_Char* mpcShowRecPos; - const sal_Char* mpcShowRecSize; - const sal_Char* mpcShowRecId; - const sal_Char* mpcShowRecName; - const sal_Char* mpcShowRecBody; -}; - -// ---------------------------------------------------------------------------- - -class RecordHeaderBase : public InputObjectBase -{ -public: - virtual ~RecordHeaderBase(); - - inline NameListRef GetRecNames() const { return mxRecNames; } - inline bool IsShowRecPos() const { return mbShowRecPos; } - inline bool IsShowRecSize() const { return mbShowRecSize; } - inline bool IsShowRecId() const { return mbShowRecId; } - inline bool IsShowRecName() const { return mbShowRecName; } - inline bool IsShowRecBody() const { return mbShowRecBody; } - -protected: - inline explicit RecordHeaderBase() {} - void Construct( const InputObjectBase& rParent, const RecordHeaderConfigInfo& rCfgInfo ); - - virtual bool ImplIsValid() const; - - using InputObjectBase::Construct; - -private: - NameListRef mxRecNames; - bool mbShowRecPos; - bool mbShowRecSize; - bool mbShowRecId; - bool mbShowRecName; - bool mbShowRecBody; -}; - -// ============================================================================ -// ============================================================================ - -class DumperBase : public ObjectBase -{ -public: - virtual ~DumperBase(); - - bool IsImportEnabled() const; - -protected: - inline explicit DumperBase() {} - void Construct( ConfigRef xConfig, CoreDataRef xCore ); - void Construct( ConfigRef xConfig, SfxMedium& rMedium, SfxObjectShell* pDocShell ); - - using ObjectBase::Construct; - -private: - typedef ScfRef< SvStream > SvStreamRef; - SvStreamRef mxOutStrm; -}; - -// ============================================================================ -// ============================================================================ - -} // namespace dump -} // namespace scf - -#endif -#endif - diff --git a/sc/source/filter/inc/fdumperole.hxx b/sc/source/filter/inc/fdumperole.hxx deleted file mode 100644 index ad6d1b0dedd9..000000000000 --- a/sc/source/filter/inc/fdumperole.hxx +++ /dev/null @@ -1,186 +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: fdumperole.hxx,v $ - * $Revision: 1.7 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SC_FDUMPEROLE_HXX -#define SC_FDUMPEROLE_HXX - -#include -#include -#include "fdumper.hxx" - -#if SCF_INCL_DUMPER - -namespace scf { -namespace dump { - -// ============================================================================ -// ============================================================================ - -class OleStorageObject : public ObjectBase -{ -public: - explicit OleStorageObject( const OleStorageObject& rParentStrg, const String& rStrgName ); - explicit OleStorageObject( const ObjectBase& rParent, SotStorageRef xRootStrg ); - explicit OleStorageObject( const ObjectBase& rParent, SvStream& rRootStrm ); - explicit OleStorageObject( const ObjectBase& rParent ); - virtual ~OleStorageObject(); - - inline SotStorageRef GetStorage() const { return mxStrg; } - inline const String& GetStoragePath() const { return maPath; } - inline const String& GetStorageName() const { return maName; } - String GetFullName() const; - - void ExtractStorageToFileSystem(); - -protected: - inline explicit OleStorageObject() {} - void Construct( const ObjectBase& rParent, SotStorageRef xStrg, const String& rPath ); - void Construct( const OleStorageObject& rParentStrg, const String& rStrgName ); - void Construct( const ObjectBase& rParent, SvStream& rRootStrm ); - void Construct( const ObjectBase& rParent ); - - virtual bool ImplIsValid() const; - virtual void ImplDumpHeader(); - virtual void ImplDumpFooter(); - - using ObjectBase::Construct; - -private: - void DumpStorageInfo( bool bExtended ); - -private: - SotStorageRef mxStrg; - String maPath; - String maName; -}; - -typedef ScfRef< OleStorageObject > OleStorageObjectRef; - -// ============================================================================ - -class OleStorageIterator : public Base -{ -public: - explicit OleStorageIterator( const OleStorageObject& rStrg ); - explicit OleStorageIterator( SotStorageRef xStrg ); - ~OleStorageIterator(); - - ULONG GetSize() const; - - OleStorageIterator& operator++(); - const SvStorageInfo* operator->() const; - -protected: - void Construct( SotStorageRef xStrg ); - -private: - virtual bool ImplIsValid() const; - -private: - typedef ScfRef< SvStorageInfoList > SvStorageInfoListRef; - SvStorageInfoListRef mxInfoList; - ULONG mnIndex; -}; - -// ============================================================================ -// ============================================================================ - -class OleStreamObject : public StreamObjectBase -{ -public: - explicit OleStreamObject( const OleStorageObject& rParentStrg, const String& rStrmName ); - virtual ~OleStreamObject(); - -protected: - inline explicit OleStreamObject() {} - void Construct( const OleStorageObject& rParentStrg, const String& rStrmName ); - - virtual bool ImplIsValid() const; - - using StreamObjectBase::Construct; - -private: - SotStorageStreamRef mxStrm; -}; - -typedef ScfRef< OleStreamObject > OleStreamObjectRef; - -// ============================================================================ - -class OlePropertyStreamObject : public OleStreamObject -{ -public: - explicit OlePropertyStreamObject( const OleStorageObject& rParentStrg, const String& rStrmName ); - -protected: - inline explicit OlePropertyStreamObject() {} - void Construct( const OleStorageObject& rParentStrg, const String& rStrmName ); - - virtual void ImplDumpBody(); - - using OleStreamObject::Construct; - -private: - void DumpSection( const String& rGuid, sal_uInt32 nStartPos ); - - void DumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos ); - void DumpCodePageProperty( sal_uInt32 nStartPos ); - void DumpDictionaryProperty( sal_uInt32 nStartPos ); - - void DumpPropertyContents( sal_Int32 nPropId ); - void DumpPropertyValue( sal_Int32 nPropId, sal_Int32 nBaseType ); - - sal_Int32 DumpPropertyType(); - void DumpBlob( const sal_Char* pcName ); - String DumpString8( const sal_Char* pcName ); - String DumpCharArray8( const sal_Char* pcName, sal_Int32 nCharCount ); - String DumpString16( const sal_Char* pcName ); - String DumpCharArray16( const sal_Char* pcName, sal_Int32 nCharCount ); - DateTime DumpFileTime( const sal_Char* pcName ); - - bool StartElement( sal_uInt32 nStartPos ); - void WriteSectionHeader( const String& rGuid, sal_uInt32 nStartPos ); - void WritePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos ); - -private: - NameListRef mxPropIds; - rtl_TextEncoding meTextEnc; - bool mbIsUnicode; -}; - -// ============================================================================ -// ============================================================================ - -} // namespace dump -} // namespace scf - -#endif -#endif - diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx index f8dad9a45c48..ab5513ead1ed 100644 --- a/sc/source/filter/inc/imp_op.hxx +++ b/sc/source/filter/inc/imp_op.hxx @@ -119,6 +119,8 @@ protected: // Abschneiden von Zellen fuehrt // Record-Funktionen + void ReadFileSharing(); + sal_uInt16 ReadXFIndex( bool bBiff2 ); void ReadDimensions(); diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx index 676b0d550875..44e02d075317 100644 --- a/sc/source/filter/inc/xestream.hxx +++ b/sc/source/filter/inc/xestream.hxx @@ -211,9 +211,6 @@ private: bool mbInRec; /// true = currently writing inside of a record. }; -// ---------------------------------------------------------------------------- - - // ============================================================================ class XclExpBiff8Encrypter diff --git a/sc/source/filter/inc/xiroot.hxx b/sc/source/filter/inc/xiroot.hxx index 915f9610a1f3..f331683988ab 100644 --- a/sc/source/filter/inc/xiroot.hxx +++ b/sc/source/filter/inc/xiroot.hxx @@ -117,9 +117,6 @@ struct XclImpRootData : public XclRootData XclImpTabProtectRef mxTabProtect; /// Sheet protection options for current sheet. XclImpDocProtectRef mxDocProtect; /// Document protection options. - String maPassw; /// Entered password for stream decryption. - bool mbPassQueried; /// true = Password already querried. - bool mbHasCodePage; /// true = CODEPAGE record exists. explicit XclImpRootData( XclBiff eBiff, SfxMedium& rMedium, @@ -205,9 +202,6 @@ public: /** Returns the Calc add-in function name for an Excel function name. */ String GetScAddInName( const String& rXclName ) const; - /** Queries a password from the user and returns it (empty string -> input cancelled). */ - const String& QueryPassword() const; - private: mutable XclImpRootData& mrImpData; /// Reference to the global import data struct. }; diff --git a/sc/source/filter/inc/xistream.hxx b/sc/source/filter/inc/xistream.hxx index ccaaccdc0357..3ee461f163fe 100644 --- a/sc/source/filter/inc/xistream.hxx +++ b/sc/source/filter/inc/xistream.hxx @@ -31,6 +31,7 @@ #ifndef SC_XISTREAM_HXX #define SC_XISTREAM_HXX +#include #include #include "xlstream.hxx" #include "xlconst.hxx" @@ -52,7 +53,7 @@ class XclImpDecrypter; typedef ScfRef< XclImpDecrypter > XclImpDecrypterRef; /** Base class for BIFF stream decryption. */ -class XclImpDecrypter +class XclImpDecrypter : public ::comphelper::IDocPasswordVerifier { public: explicit XclImpDecrypter(); @@ -60,40 +61,39 @@ public: /** Returns the current error code of the decrypter. */ inline ErrCode GetError() const { return mnError; } - /** Returns true, if the decrypter has been constructed successfully. - This means especially that construction happened with a valid password. */ + /** Returns true, if the decoder has been initialized correctly. */ inline bool IsValid() const { return mnError == ERRCODE_NONE; } /** Creates a (ref-counted) copy of this decrypter object. */ XclImpDecrypterRef Clone() const; + /** Implementation of the ::comphelper::IDocPasswordVerifier interface, + calls the new virtual function implVerify(). */ + virtual ::comphelper::DocPasswordVerifierResult + verifyPassword( const ::rtl::OUString& rPassword ); + /** Updates the decrypter on start of a new record or after seeking stream. */ void Update( SvStream& rStrm, sal_uInt16 nRecSize ); /** Reads and decrypts nBytes bytes and stores data into the existing(!) buffer pData. @return Count of bytes really read. */ sal_uInt16 Read( SvStream& rStrm, void* pData, sal_uInt16 nBytes ); - const String GetPassword() const; - protected: /** Protected copy c'tor for OnClone(). */ explicit XclImpDecrypter( const XclImpDecrypter& rSrc ); - /** Sets the decrypter to a state showing whether the password was correct. */ - void SetHasValidPassword( bool bValid ); - - void SetPassword( const String& rPass ); - private: /** Implementation of cloning this object. */ virtual XclImpDecrypter* OnClone() const = 0; + /** Derived classes implement password verification and initialization of + the decoder. */ + virtual bool OnVerify( const ::rtl::OUString& rPassword ) = 0; /** Implementation of updating the decrypter. */ virtual void OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 nRecSize ) = 0; /** Implementation of the decryption. */ virtual sal_uInt16 OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes ) = 0; private: - String maPass; /// Stored password (needed for export) ErrCode mnError; /// Decrypter error code. sal_Size mnOldPos; /// Last known stream position. sal_uInt16 mnRecSize; /// Current record size. @@ -105,12 +105,7 @@ private: class XclImpBiff5Decrypter : public XclImpDecrypter { public: - /** Constructs the decrypter. - @descr Checks if the passed key and hash specify workbook protection. - Asks for a password otherwise. - @param nKey Password key from FILEPASS record to verify password. - @param nHash Password hash value from FILEPASS record to verify password. */ - explicit XclImpBiff5Decrypter( const XclImpRoot& rRoot, sal_uInt16 nKey, sal_uInt16 nHash ); + explicit XclImpBiff5Decrypter( sal_uInt16 nKey, sal_uInt16 nHash ); private: /** Private copy c'tor for OnClone(). */ @@ -118,18 +113,18 @@ private: /** Implementation of cloning this object. */ virtual XclImpBiff5Decrypter* OnClone() const; + /** Implements password verification and initialization of the decoder. */ + virtual bool OnVerify( const ::rtl::OUString& rPassword ); /** Implementation of updating the decrypter. */ virtual void OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 nRecSize ); /** Implementation of the decryption. */ virtual sal_uInt16 OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes ); - /** Initializes the members. - @postcond Internal status is set and can be querried with IsValid(). */ - void Init( const ByteString& rPass, sal_uInt16 nKey, sal_uInt16 nHash ); - private: ::svx::MSCodec_XorXLS95 maCodec; /// Crypto algorithm implementation. - sal_uInt8 mpnPassw[ 16 ]; /// Cached password data for copy construction. + ::std::vector< sal_uInt8 > maPassword; + sal_uInt16 mnKey; + sal_uInt16 mnHash; }; // ---------------------------------------------------------------------------- @@ -138,14 +133,8 @@ private: class XclImpBiff8Decrypter : public XclImpDecrypter { public: - /** Constructs the decrypter. - @descr Checks if the passed salt data specifies workbook protection. - Asks for a password otherwise. - @param pnDocId Unique document identifier from FILEPASS record. - @param pnSaltData Salt data from FILEPASS record. - @param pnSaltHash Salt hash value from FILEPASS record. */ - explicit XclImpBiff8Decrypter( const XclImpRoot& rRoot, sal_uInt8 pnDocId[ 16 ], - sal_uInt8 pnSaltData[ 16 ], sal_uInt8 pnSaltHash[ 16 ] ); + explicit XclImpBiff8Decrypter( sal_uInt8 pnSalt[ 16 ], + sal_uInt8 pnVerifier[ 16 ], sal_uInt8 pnVerifierHash[ 16 ] ); private: /** Private copy c'tor for OnClone(). */ @@ -153,16 +142,13 @@ private: /** Implementation of cloning this object. */ virtual XclImpBiff8Decrypter* OnClone() const; + /** Implements password verification and initialization of the decoder. */ + virtual bool OnVerify( const ::rtl::OUString& rPassword ); /** Implementation of updating the decrypter. */ virtual void OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 nRecSize ); /** Implementation of the decryption. */ virtual sal_uInt16 OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes ); - /** Initializes the internal codec. - @postcond Internal status is set and can be querried with IsValid(). */ - void Init( const String& rPass, sal_uInt8 pnDocId[ 16 ], - sal_uInt8 pnSaltData[ 16 ], sal_uInt8 pnSaltHash[ 16 ] ); - /** Returns the block number corresponding to the passed stream position. */ sal_uInt32 GetBlock( sal_Size nStrmPos ) const; /** Returns the block offset corresponding to the passed stream position. */ @@ -170,8 +156,10 @@ private: private: ::svx::MSCodec_Std97 maCodec; /// Crypto algorithm implementation. - sal_uInt16 mpnPassw[ 16 ]; /// Cached password data for copy construction. - sal_uInt8 mpnDocId[ 16 ]; /// Cached document ID for copy construction. + ::std::vector< sal_uInt16 > maPassword; + ::std::vector< sal_uInt8 > maSalt; + ::std::vector< sal_uInt8 > maVerifier; + ::std::vector< sal_uInt8 > maVerifierHash; }; // ============================================================================ diff --git a/sc/source/filter/inc/xlcontent.hxx b/sc/source/filter/inc/xlcontent.hxx index 32803987f5c4..6c86e0be68b7 100644 --- a/sc/source/filter/inc/xlcontent.hxx +++ b/sc/source/filter/inc/xlcontent.hxx @@ -35,6 +35,10 @@ // Constants ================================================================== +// (0x005B) FILESHARING ------------------------------------------------------- + +const sal_uInt16 EXC_ID_FILESHARING = 0x005B; + // (0x00E5) MERGEDCELLS ------------------------------------------------------- const sal_uInt16 EXC_ID_MERGEDCELLS = 0x00E5; diff --git a/sc/source/filter/inc/xldumper.hxx b/sc/source/filter/inc/xldumper.hxx deleted file mode 100644 index b35482955f71..000000000000 --- a/sc/source/filter/inc/xldumper.hxx +++ /dev/null @@ -1,683 +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: xldumper.hxx,v $ - * $Revision: 1.12 $ - * - * 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SC_XLDUMPER_HXX -#define SC_XLDUMPER_HXX - -#include "fdumper.hxx" - -#include -#include "fdumperdff.hxx" -#include "fdumperole.hxx" -#include "xlconst.hxx" -#include "xlstring.hxx" -#include "xlstyle.hxx" - -#if SCF_INCL_DUMPER - -class SfxMedium; -class SfxObjectShell; -class ScDocument; -struct XclImpRootData; -class XclImpRoot; -class XclImpStream; -class XclFunctionProvider; - -namespace scf { -namespace dump { -namespace xls { - -// ============================================================================ -// ============================================================================ - -struct Address -{ - sal_Int32 mnCol; - sal_Int32 mnRow; - inline explicit Address() : mnCol( 0 ), mnRow( 0 ) {} - void Read( XclImpStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ); -}; - -// ---------------------------------------------------------------------------- - -struct Range -{ - Address maFirst; - Address maLast; - inline explicit Range() {} - void Read( XclImpStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ); -}; - -// ---------------------------------------------------------------------------- - -struct RangeList : public ::std::vector< Range > -{ - inline explicit RangeList() {} - void Read( XclImpStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false ); -}; - -// ============================================================================ - -struct FormulaAddress : public Address -{ - bool mbRelCol; - bool mbRelRow; - inline explicit FormulaAddress() : mbRelCol( false ), mbRelRow( false ) {} -}; - -// ---------------------------------------------------------------------------- - -struct FormulaRange -{ - FormulaAddress maFirst; - FormulaAddress maLast; - inline explicit FormulaRange() {} -}; - -// ============================================================================ - -class StringHelper : public ::scf::dump::StringHelper -{ -public: - static void AppendAddrCol( String& rStr, sal_Int32 nCol, bool bRel ); - static void AppendAddrRow( String& rStr, sal_Int32 nRow, bool bRel ); - static void AppendAddrName( String& rStr, sal_Unicode cPrefix, sal_Int32 nColRow, bool bRel ); - - static void AppendAddress( String& rStr, const Address& rPos ); - static void AppendRange( String& rStr, const Range& rRange ); - static void AppendRangeList( String& rStr, const RangeList& rRanges ); - - static void AppendAddress( String& rStr, const FormulaAddress& rPos, bool bNameMode ); - static void AppendRange( String& rStr, const FormulaRange& rRange, bool bNameMode ); -}; - -// ============================================================================ -// ============================================================================ - -class RecordHeaderObject : public RecordHeaderBase -{ -public: - explicit RecordHeaderObject( const InputObjectBase& rParent ); - - inline bool IsMergeContRec() const { return mbMergeContRec; } - inline bool HasRecName( sal_uInt16 nRecId ) const { return GetRecNames()->HasName( nRecId ); } - - void DumpRecordHeader( XclImpStream& rStrm ); - -protected: - virtual bool ImplIsValid() const; - -private: - bool mbMergeContRec; -}; - -typedef ScfRef< RecordHeaderObject > RecHeaderObjectRef; - -// ============================================================================ -// ============================================================================ - -class BiffConfig : public Config -{ -public: - explicit BiffConfig( const Config& rParent, XclBiff eBiff ); - -protected: - virtual bool ImplIsValid() const; - virtual NameListRef ImplGetNameList( const String& rKey ) const; - -private: - XclBiff meBiff; -}; - -typedef ScfRef< BiffConfig > BiffConfigRef; - -// ============================================================================ - -class RootData : public Base -{ -public: - explicit RootData( SfxMedium& rMedium, XclBiff eBiff ); - virtual ~RootData(); - - inline const XclImpRoot& GetRoot() const { return *mxRoot; } - - rtl_TextEncoding GetTextEncoding() const; - void SetTextEncoding( rtl_TextEncoding eTextEnc ); - -protected: - virtual bool ImplIsValid() const; - -private: - typedef ScfRef< ScDocument > ScDocumentRef; - typedef ScfRef< XclImpRootData > XclImpRootDataRef; - typedef ScfRef< XclImpRoot > XclImpRootRef; - - ScDocumentRef mxDoc; - XclImpRootDataRef mxRootData; - XclImpRootRef mxRoot; -}; - -typedef ScfRef< RootData > RootDataRef; - -// ============================================================================ - -class RootObjectBase : public WrappedStreamObject -{ -public: - virtual ~RootObjectBase(); - - inline RootData& Root() const { return *mxRootData; } - inline const XclImpRoot& GetXclRoot() const { return mxRootData->GetRoot(); } - inline XclImpStream& GetXclStream() const { return *mxStrm; } - inline XclBiff GetBiff() const { return meBiff; } - -protected: - explicit RootObjectBase(); - void Construct( const ObjectBase& rParent, SvStream& rStrm, XclBiff eBiff ); - void Construct( const OleStorageObject& rParentStrg, const String& rStrmName, XclBiff eBiff ); - void Construct( const RootObjectBase& rParent ); - - virtual bool ImplIsValid() const; - virtual void ImplDumpExtendedHeader(); - virtual ConfigRef ImplReconstructConfig(); - virtual InputRef ImplReconstructInput(); - - String GetErrorName( sal_uInt8 nErrCode ) const; - - // ------------------------------------------------------------------------ - - double WriteRkItem( const sal_Char* pcName, sal_Int32 nRk ); - void WriteBooleanItem( const sal_Char* pcName, sal_uInt8 nBool ); - void WriteErrorCodeItem( const sal_Char* pcName, sal_uInt8 nErrCode ); - - void WriteColIndexItem( const sal_Char* pcName, sal_Int32 nCol ); - void WriteColRangeItem( const sal_Char* pcName, sal_Int32 nCol1, sal_Int32 nCol2 ); - void WriteRowIndexItem( const sal_Char* pcName, sal_Int32 nRow ); - void WriteRowRangeItem( const sal_Char* pcName, sal_Int32 nRow1, sal_Int32 nRow2 ); - - void WriteAddressItem( const sal_Char* pcName, const Address& rPos ); - void WriteRangeItem( const sal_Char* pcName, const Range& rRange ); - void WriteRangeListItem( const sal_Char* pcName, const RangeList& rRanges ); - - template< typename Type > - void WriteRectItem( const sal_Char* pcName, - Type nLeft, Type nTop, Type nWidth, Type nHeight, - const NameListWrapper& rListWrp = NO_LIST, - FormatType eFmtType = FORMATTYPE_DEC ); - - // ------------------------------------------------------------------------ - - String DumpString( const sal_Char* pcName = 0, XclStrFlags nFlags = EXC_STR_DEFAULT ); - double DumpRk( const sal_Char* pcName = 0 ); - sal_uInt8 DumpBoolean( const sal_Char* pcName = 0 ); - sal_uInt8 DumpErrorCode( const sal_Char* pcName = 0 ); - - Color DumpRgbColor( const sal_Char* pcName = 0 ); - rtl_TextEncoding DumpCodePage( const sal_Char* pcName = 0 ); - void DumpFormulaResult( const sal_Char* pcName = 0 ); - - sal_Int32 DumpColIndex( const sal_Char* pcName = 0, bool bCol16Bit = true ); - sal_Int32 DumpColRange( const sal_Char* pcName = 0, bool bCol16Bit = true ); - sal_Int32 DumpRowIndex( const sal_Char* pcName = 0, bool bRow32Bit = false ); - sal_Int32 DumpRowRange( const sal_Char* pcName = 0, bool bRow32Bit = false ); - - Address DumpAddress( const sal_Char* pcName = 0, bool bCol16Bit = true, bool bRow32Bit = false ); - Range DumpRange( const sal_Char* pcName = 0, bool bCol16Bit = true, bool bRow32Bit = false ); - void DumpRangeList( const sal_Char* pcName = 0, bool bCol16Bit = true, bool bRow32Bit = false ); - - void DumpConstArrayHeader( sal_uInt32& rnCols, sal_uInt32& rnRows ); - String DumpConstValue(); - - template< typename Type > - void DumpRect( const sal_Char* pcName, - const NameListWrapper& rListWrp = NO_LIST, - FormatType eFmtType = FORMATTYPE_DEC ); - - // ------------------------------------------------------------------------ - - using WrappedStreamObject::Construct; - -private: - void ConstructRootObjBase( XclBiff eBiff ); - -private: - typedef ScfRef< XclImpStream > XclImpStreamRef; - - RootDataRef mxRootData; - BiffConfigRef mxBiffCfg; - XclImpStreamRef mxStrm; - XclBiff meBiff; - NameListRef mxBoolean; - NameListRef mxErrCodes; - NameListRef mxConstType; - NameListRef mxResultType; -}; - -// ---------------------------------------------------------------------------- - -template< typename Type > -void RootObjectBase::WriteRectItem( const sal_Char* pcName, - Type nLeft, Type nTop, Type nWidth, Type nHeight, - const NameListWrapper& rListWrp, FormatType eFmtType ) -{ - MultiItemsGuard aMultiGuard( Out() ); - WriteEmptyItem( pcName ); - WriteValueItem( "x-pos", nLeft, eFmtType, rListWrp ); - WriteValueItem( "y-pos", nTop, eFmtType, rListWrp ); - WriteValueItem( "x-size", nWidth, eFmtType, rListWrp ); - WriteValueItem( "y-size", nHeight, eFmtType, rListWrp ); -} - -template< typename Type > -void RootObjectBase::DumpRect( const sal_Char* pcName, - const NameListWrapper& rListWrp, FormatType eFmtType ) -{ - Type nLeft, nTop, nWidth, nHeight; - *mxStrm >> nLeft >> nTop >> nWidth >> nHeight; - WriteRectItem( pcName, nLeft, nTop, nWidth, nHeight, rListWrp, eFmtType ); -} - -// ============================================================================ -// ============================================================================ - -class SimpleObjectBase : public RootObjectBase -{ -public: - virtual ~SimpleObjectBase(); - -protected: - inline explicit SimpleObjectBase() {} - void Construct( const RootObjectBase& rParent ); - - virtual void ImplDumpHeader(); - virtual void ImplDumpFooter(); - - using RootObjectBase::Construct; -}; - -// ============================================================================ -// ============================================================================ - -/** Stack to create a human readable formula string from a UPN token array. */ -class FormulaStack -{ -public: - explicit FormulaStack(); - - inline const String& GetFormulaString() const { return GetString( maFmlaStack ); } - inline const String& GetClassesString() const { return GetString( maClassStack ); } - - void PushOperand( const StringWrapper& rOp, const String& rTokClass ); - void PushOperand( const StringWrapper& rOp ); - void PushUnaryOp( const StringWrapper& rLOp, const StringWrapper& rROp ); - void PushBinaryOp( const StringWrapper& rOp ); - void PushFuncOp( const StringWrapper& rFunc, const String& rTokClass, sal_uInt8 nParamCount ); - - inline void SetError() { mbError = true; } - void ReplaceOnTop( const String& rOld, const String& rNew ); - -private: - typedef ::std::stack< String > StringStack; - - inline bool Check( bool bCond ) { return (mbError |= !bCond) == false; } - - const String& GetString( const StringStack& rStack ) const; - void PushUnaryOp( StringStack& rStack, const String& rLOp, const String& rROp ); - void PushBinaryOp( StringStack& rStack, const String& rOp ); - void PushFuncOp( StringStack& rStack, const String& rOp, sal_uInt8 nParamCount ); - -private: - StringStack maFmlaStack; - StringStack maClassStack; - bool mbError; -}; - -// ============================================================================ - -class FormulaObject : public SimpleObjectBase -{ -public: - explicit FormulaObject( const RootObjectBase& rParent ); - virtual ~FormulaObject(); - - sal_uInt16 ReadFormulaSize(); - sal_uInt16 DumpFormulaSize( const sal_Char* pcName = 0 ); - - void DumpCellFormula( const sal_Char* pcName, sal_uInt16 nSize ); - void DumpCellFormula( const sal_Char* pcName = 0 ); - void DumpNameFormula( const sal_Char* pcName, sal_uInt16 nSize ); - void DumpNameFormula( const sal_Char* pcName = 0 ); - -protected: - virtual void ImplDumpHeader(); - virtual void ImplDumpBody(); - -private: - void ConstructFmlaObj(); - - void DumpFormula( const sal_Char* pcName, sal_uInt16 nSize, bool bNameMode ); - void DumpFormula( const sal_Char* pcName, bool bNameMode ); - - FormulaAddress CreateTokenAddress( sal_uInt16 nCol, sal_uInt16 nRow, bool bRelC, bool bRelR, bool bNameMode ) const; - String CreateFunc( sal_uInt16 nFuncIdx ) const; - String CreateRef( const String& rData ) const; - String CreateName( sal_uInt16 nNameIdx ) const; - String CreatePlaceHolder( size_t nIdx ) const; - String CreatePlaceHolder() const; - - void WriteTokenAddressItem( const sal_Char* pcName, const FormulaAddress& rPos, bool bNameMode ); - void WriteTokenAddress3dItem( const sal_Char* pcName, const String& rRef, const FormulaAddress& rPos, bool bNameMode ); - void WriteTokenRangeItem( const sal_Char* pcName, const FormulaRange& rRange, bool bNameMode ); - void WriteTokenRange3dItem( const sal_Char* pcName, const String& rRef, const FormulaRange& rRange, bool bNameMode ); - - sal_uInt16 DumpTokenFuncIdx(); - sal_uInt16 DumpTokenCol( const sal_Char* pcName, bool& rbRelC, bool& rbRelR ); - sal_uInt16 DumpTokenRow( const sal_Char* pcName, bool& rbRelC, bool& rbRelR ); - FormulaAddress DumpTokenAddress( bool bNameMode ); - FormulaRange DumpTokenRange( bool bNameMode ); - String DumpTokenRefIdx(); - void DumpTokenRefTabIdxs(); - - void DumpIntToken(); - void DumpDoubleToken(); - void DumpStringToken(); - void DumpBoolToken(); - void DumpErrorToken(); - void DumpMissArgToken(); - - void DumpArrayToken( const String& rTokClass ); - void DumpNameToken( const String& rTokClass ); - void DumpNameXToken( const String& rTokClass ); - void DumpRefToken( const String& rTokClass, bool bNameMode ); - void DumpAreaToken( const String& rTokClass, bool bNameMode ); - void DumpRefErrToken( const String& rTokClass, bool bArea ); - void DumpRef3dToken( const String& rTokClass, bool bNameMode ); - void DumpArea3dToken( const String& rTokClass, bool bNameMode ); - void DumpRefErr3dToken( const String& rTokClass, bool bArea ); - void DumpMemFuncToken( const String& rTokClass ); - void DumpMemAreaToken( const String& rTokClass, bool bAddData ); - - void DumpExpToken( const StringWrapper& rName ); - void DumpUnaryOpToken( const StringWrapper& rLOp, const StringWrapper& rROp ); - void DumpBinaryOpToken( const StringWrapper& rOp ); - void DumpFuncToken( const String& rTokClass ); - void DumpFuncVarToken( const String& rTokClass ); - void DumpCmdToken( const String& rTokClass ); - - void DumpSheetToken(); - void DumpEndSheetToken(); - bool DumpAttrToken(); - - bool DumpNlrToken(); - void DumpNlrErrToken(); - void DumpNlrColRowToken( const String& rTokClass, bool bAddData ); - void DumpNlrRangeToken( const String& rTokClass, bool bAddData ); - void DumpNlrRangeErrToken(); - - void DumpAddTokenData(); - void DumpAddDataNlr( size_t nIdx ); - void DumpAddDataArray( size_t nIdx ); - void DumpAddDataMemArea( size_t nIdx ); - -private: - enum AddDataType { ADDDATA_NLR, ADDDATA_ARRAY, ADDDATA_MEMAREA }; - - typedef ScfRef< FormulaStack > FormulaStackRef; - typedef ScfRef< XclFunctionProvider > XclFuncProvRef; - typedef ::std::vector< AddDataType > AddDataTypeVec; - - NameListRef mxTokens; - NameListRef mxClasses; - NameListRef mxFuncNames; - NameListRef mxParamCnt; - NameListRef mxRelFlags; - NameListRef mxNlrTypes; - NameListRef mxAttrTypes; - NameListRef mxSpTypes; - - FormulaStackRef mxStack; - XclFuncProvRef mxFuncProv; - AddDataTypeVec maAddData; - String maRefPrefix; - const sal_Char* mpcName; - sal_uInt16 mnSize; - bool mbNameMode; -}; - -typedef ScfRef< FormulaObject > FormulaObjectRef; - -// ============================================================================ -// ============================================================================ - -class RecordStreamObject : public RootObjectBase -{ -public: - explicit RecordStreamObject( const ObjectBase& rParent, SvStream& rStrm, XclBiff eBiff = EXC_BIFF_UNKNOWN ); - explicit RecordStreamObject( const OleStorageObject& rParentStrg, const String& rStrmName, XclBiff eBiff = EXC_BIFF_UNKNOWN ); - virtual ~RecordStreamObject(); - -protected: - inline explicit RecordStreamObject() {} - void Construct( const ObjectBase& rParent, SvStream& rStrm, XclBiff eBiff ); - void Construct( const OleStorageObject& rParentStrg, const String& rStrmName, XclBiff eBiff ); - - virtual bool ImplIsValid() const; - virtual void ImplDumpBody(); - - virtual void ImplPreProcessRecord(); - virtual void ImplDumpRecord(); - virtual void ImplPostProcessRecord(); - - inline RecordHeaderObject& GetRecordHeader() const { return *mxHdrObj; } - inline FormulaObject& GetFormulaDumper() const { return *mxFmlaObj; } - inline DffDumpObject& GetDffDumper() const { return *mxDffObj; } - - void DumpRepeatedRecordId(); - - using RootObjectBase::Construct; - -private: - void ConstructRecStrmObj(); - - void DumpRecordBody(); - void DumpSimpleRecord( const String& rRecData ); - -private: - String maProgressName; - RecHeaderObjectRef mxHdrObj; - FormulaObjectRef mxFmlaObj; - DffDumpObjectRef mxDffObj; - NameListRef mxSimpleRecs; -}; - -// ============================================================================ - -class WorkbookStreamObject : public RecordStreamObject -{ -public: - explicit WorkbookStreamObject( const ObjectBase& rParent, SvStream& rStrm ); - explicit WorkbookStreamObject( const OleStorageObject& rParentStrg, const String& rStrmName ); - virtual ~WorkbookStreamObject(); - -protected: - virtual void ImplPreProcessRecord(); - virtual void ImplDumpRecord(); - virtual void ImplPostProcessRecord(); - -private: - void ConstructWbStrmObj(); - - const XclFontData* GetFontData( sal_uInt16 nFontIdx ) const; - sal_uInt16 GetXfData( sal_uInt16 nXfIdx ) const; - rtl_TextEncoding GetFontEncoding( sal_uInt16 nXfIdx ) const; - String CreateFontName( const XclFontData& rFontData ) const; - - template< typename Type > - Type DumpPatternIdx( const sal_Char* pcName = 0 ); - template< typename Type > - Type DumpColorIdx( const sal_Char* pcName = 0 ); - - sal_uInt16 DumpFontIdx( const sal_Char* pcName = 0 ); - sal_uInt16 DumpFormatIdx( const sal_Char* pcName = 0 ); - sal_uInt16 DumpXfIdx( const sal_Char* pcName = 0, bool bBiff2Style = false ); - - sal_uInt16 DumpCellHeader( bool bBiff2Style = false ); - void DumpBoolErr(); - - void DumpFontRec(); - void DumpFormatRec(); - void DumpXfRec(); - - void DumpObjRec(); - void DumpObjRec5(); - void DumpObjRec8(); - -private: - typedef ::std::vector< XclFontData > XclFontDataVec; - - NameListRef mxColors; - NameListRef mxBorderStyles; - NameListRef mxFillPatterns; - NameListRef mxFontNames; - NameListRef mxFormats; - XclFontDataVec maFontDatas; - ScfUInt16Vec maXfDatas; - sal_uInt16 mnFormatIdx; - sal_uInt16 mnPTRowFields; - sal_uInt16 mnPTColFields; - sal_uInt16 mnPTSxliIdx; - bool mbHasCodePage; -}; - -// ---------------------------------------------------------------------------- - -template< typename Type > -Type WorkbookStreamObject::DumpPatternIdx( const sal_Char* pcName ) -{ - return DumpDec< Type >( pcName ? pcName : "fill-pattern", mxFillPatterns ); -} - -template< typename Type > -Type WorkbookStreamObject::DumpColorIdx( const sal_Char* pcName ) -{ - return DumpDec< Type >( pcName ? pcName : "color-idx", mxColors ); -} - -// ============================================================================ - -class PivotCacheStreamObject : public RecordStreamObject -{ -public: - explicit PivotCacheStreamObject( const ObjectBase& rParent, SvStream& rStrm ); - explicit PivotCacheStreamObject( const OleStorageObject& rParentStrg, const String& rStrmName ); - virtual ~PivotCacheStreamObject(); - -protected: - virtual void ImplDumpRecord(); -}; - -// ============================================================================ - -class VbaProjectStreamObject : public OleStreamObject -{ -public: - explicit VbaProjectStreamObject( const OleStorageObject& rParentStrg ); - -protected: - virtual void ImplDumpBody(); -}; - -// ============================================================================ -// ============================================================================ - -class PivotCacheStorageObject : public OleStorageObject -{ -public: - explicit PivotCacheStorageObject( const OleStorageObject& rParentStrg ); - -protected: - virtual void ImplDumpBody(); -}; - -// ============================================================================ - -class VbaProjectStorageObject : public OleStorageObject -{ -public: - explicit VbaProjectStorageObject( const OleStorageObject& rParentStrg ); - -protected: - virtual void ImplDumpBody(); -}; - -// ============================================================================ - -class VbaStorageObject : public OleStorageObject -{ -public: - explicit VbaStorageObject( const OleStorageObject& rParentStrg ); - -protected: - virtual void ImplDumpBody(); -}; - -// ============================================================================ - -class RootStorageObject : public OleStorageObject -{ -public: - explicit RootStorageObject( const ObjectBase& rParent ); - -protected: - virtual void ImplDumpBody(); -}; - -// ============================================================================ -// ============================================================================ - -class Dumper : public DumperBase -{ -public: - explicit Dumper( SfxMedium& rMedium, SfxObjectShell* pDocShell ); - -protected: - virtual void ImplDumpBody(); -}; - -// ============================================================================ -// ============================================================================ - -} // namespace xls -} // namespace dump -} // namespace scf - -#endif -#endif - diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx index 36056ead2fe2..8571dafcbc74 100644 --- a/sc/source/filter/inc/xlroot.hxx +++ b/sc/source/filter/inc/xlroot.hxx @@ -36,6 +36,8 @@ #include "xlconst.hxx" #include "xltools.hxx" +namespace comphelper { class IDocPasswordVerifier; } + // Forward declarations of objects in public use ============================== class DateTime; @@ -92,6 +94,7 @@ struct XclRootData ScDocument& mrDoc; /// The source or destination document. String maDocUrl; /// Document URL of imported/exported file. String maBasePath; /// Base path of imported/exported file (path of maDocUrl). + const String maDefPassword; /// The default password used for stream encryption. rtl_TextEncoding meTextEnc; /// Text encoding to import/export byte strings. LanguageType meSysLang; /// System language. LanguageType meDocLang; /// Document language (import: from file, export: from system). @@ -183,6 +186,11 @@ public: /** Returns the base path of the imported/exported file. */ inline const String& GetBasePath() const { return mrData.maBasePath; } + /** Returns the default password used for stream encryption. */ + inline const String& GetDefaultPassword() const { return mrData.maDefPassword; } + /** Requests and verifies a password from the medium or the user. */ + String RequestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const; + /** Returns the OLE2 root storage of the imported/exported file. @return Pointer to root storage or 0, if the file is a simple stream. */ inline SotStorageRef GetRootStorage() const { return mrData.mxRootStrg; } diff --git a/sc/source/filter/inc/xlstream.hxx b/sc/source/filter/inc/xlstream.hxx index ffdd74d5f218..603a4cfab3fc 100644 --- a/sc/source/filter/inc/xlstream.hxx +++ b/sc/source/filter/inc/xlstream.hxx @@ -50,19 +50,6 @@ const sal_uInt16 EXC_ENCR_BLOCKSIZE = 1024; const sal_uInt16 EXC_ID_UNKNOWN = SAL_MAX_UINT16; const sal_uInt16 EXC_ID_CONT = 0x003C; -// Encryption/decryption ====================================================== - -/** Helper class for BIFF stream en-/decryption. */ -class XclCryptoHelper : ScfNoInstance -{ -public: - /** Returns the fixed password for workbook protection. */ - static const ByteString GetBiff5WbProtPassword(); - - /** Returns the fixed password for workbook protection. */ - static const String GetBiff8WbProtPassword(); -}; - // ============================================================================ #endif diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx index e20542bfedf6..4d3c478d9068 100644 --- a/sc/source/ui/dbgui/fieldwnd.cxx +++ b/sc/source/ui/dbgui/fieldwnd.cxx @@ -31,12 +31,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - - #include #include #include - +#include +#include #include #include "fieldwnd.hxx" @@ -44,10 +43,7 @@ #include "pvglob.hxx" #include "AccessibleDataPilotControl.hxx" #include "scresid.hxx" -#ifndef SC_SC_HRC #include "sc.hrc" -#endif -#include const size_t INVALID_INDEX = static_cast< size_t >( -1 ); @@ -238,27 +234,44 @@ void ScDPFieldWindow::DrawBackground( OutputDevice& rDev ) } void ScDPFieldWindow::DrawField( - OutputDevice& rDev, const Rectangle& rRect, const String& rText, bool bFocus ) + OutputDevice& rDev, const Rectangle& rRect, FieldString& rText, bool bFocus ) { VirtualDevice aVirDev( rDev ); // #i97623# VirtualDevice is always LTR while other windows derive direction from parent aVirDev.EnableRTL( IsRTLEnabled() ); + String aText = rText.first; Size aDevSize( rRect.GetSize() ); long nWidth = aDevSize.Width(); long nHeight = aDevSize.Height(); - long nLabelWidth = rDev.GetTextWidth( rText ); + long nLabelWidth = rDev.GetTextWidth( aText ); long nLabelHeight = rDev.GetTextHeight(); - Point aLabelPos( - ((nWidth > nLabelWidth + 6) ? (nWidth - nLabelWidth) / 2 : 3), - ((nHeight > nLabelHeight + 6) ? (nHeight - nLabelHeight) / 2 : 3) ); + + // #i31600# if text is too long, cut and add ellipsis + rText.second = nLabelWidth + 6 <= nWidth; + if( !rText.second ) + { + xub_StrLen nMinLen = 0; + xub_StrLen nMaxLen = aText.Len(); + bool bFits = false; + do + { + xub_StrLen nCurrLen = (nMinLen + nMaxLen) / 2; + aText = String( rText.first, 0, nCurrLen ).AppendAscii( "..." ); + nLabelWidth = rDev.GetTextWidth( aText ); + bFits = nLabelWidth + 6 <= nWidth; + (bFits ? nMinLen : nMaxLen) = nCurrLen; + } + while( !bFits || (nMinLen + 1 < nMaxLen) ); + } + Point aLabelPos( (nWidth - nLabelWidth) / 2, ::std::max< long >( (nHeight - nLabelHeight) / 2, 3 ) ); aVirDev.SetOutputSizePixel( aDevSize ); aVirDev.SetFont( rDev.GetFont() ); DecorationView aDecoView( &aVirDev ); aDecoView.DrawButton( Rectangle( Point( 0, 0 ), aDevSize ), bFocus ? BUTTON_DRAW_DEFAULT : 0 ); aVirDev.SetTextColor( aTextColor ); - aVirDev.DrawText( aLabelPos, rText ); + aVirDev.DrawText( aLabelPos, aText ); rDev.DrawBitmap( rRect.TopLeft(), aVirDev.GetBitmap( Point( 0, 0 ), aDevSize ) ); } @@ -292,7 +305,7 @@ void ScDPFieldWindow::Redraw() if( HasFocus() && (nFieldSelected < aFieldArr.size()) ) { long nFieldWidth = aFieldRect.GetWidth(); - long nSelectionWidth = Min( GetTextWidth( aFieldArr[ nFieldSelected ] ) + 4, nFieldWidth - 6 ); + long nSelectionWidth = Min( GetTextWidth( aFieldArr[ nFieldSelected ].first ) + 4, nFieldWidth - 6 ); Rectangle aSelection( GetFieldPosition( nFieldSelected ) + Point( (nFieldWidth - nSelectionWidth) / 2, 3 ), Size( nSelectionWidth, aFieldRect.GetHeight() - 6 ) ); @@ -320,6 +333,11 @@ bool ScDPFieldWindow::IsExistingIndex( size_t nIndex ) const return nIndex < aFieldArr.size(); } +bool ScDPFieldWindow::IsShortenedText( size_t nIndex ) const +{ + return (nIndex < aFieldArr.size()) && !aFieldArr[ nIndex ].second; +} + size_t ScDPFieldWindow::CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const { size_t nNewField = nFieldSelected; @@ -513,6 +531,14 @@ void __EXPORT ScDPFieldWindow::MouseMove( const MouseEvent& rMEvt ) PointerStyle ePtr = pDlg->NotifyMouseMove( OutputToScreenPixel( rMEvt.GetPosPixel() ) ); SetPointer( Pointer( ePtr ) ); } + size_t nIndex = 0; + if( GetFieldIndex( rMEvt.GetPosPixel(), nIndex ) && IsShortenedText( nIndex ) ) + { + Point aPos = OutputToScreenPixel( rMEvt.GetPosPixel() ); + Rectangle aRect( aPos, GetSizePixel() ); + String aHelpText = GetFieldText(nIndex); + Help::ShowQuickHelp( this, aRect, aHelpText ); + } } void __EXPORT ScDPFieldWindow::KeyInput( const KeyEvent& rKEvt ) @@ -598,7 +624,7 @@ void ScDPFieldWindow::AddField( const String& rText, size_t nNewIndex ) DBG_ASSERT( nNewIndex == aFieldArr.size(), "ScDPFieldWindow::AddField - invalid index" ); if( IsValidIndex( nNewIndex ) ) { - aFieldArr.push_back( rText ); + aFieldArr.push_back( FieldString( rText, true ) ); if (pAccessible) { com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible; @@ -646,7 +672,7 @@ void ScDPFieldWindow::SetFieldText( const String& rText, size_t nIndex ) { if( IsExistingIndex( nIndex ) ) { - aFieldArr[ nIndex ] = rText; + aFieldArr[ nIndex ] = FieldString( rText, true ); Redraw(); if (pAccessible) @@ -663,7 +689,7 @@ void ScDPFieldWindow::SetFieldText( const String& rText, size_t nIndex ) const String& ScDPFieldWindow::GetFieldText( size_t nIndex ) const { if( IsExistingIndex( nIndex ) ) - return aFieldArr[ nIndex ]; + return aFieldArr[ nIndex ].first; return EMPTY_STRING; } @@ -680,7 +706,7 @@ bool ScDPFieldWindow::AddField( const String& rText, const Point& rPos, size_t& if( nNewIndex > aFieldArr.size() ) nNewIndex = aFieldArr.size(); - aFieldArr.insert( aFieldArr.begin() + nNewIndex, rText ); + aFieldArr.insert( aFieldArr.begin() + nNewIndex, FieldString( rText, true ) ); nFieldSelected = nNewIndex; Redraw(); rnIndex = nNewIndex; diff --git a/sc/source/ui/inc/fieldwnd.hxx b/sc/source/ui/inc/fieldwnd.hxx index 5b24b5fea3df..ae2dbf1ffb52 100644 --- a/sc/source/ui/inc/fieldwnd.hxx +++ b/sc/source/ui/inc/fieldwnd.hxx @@ -68,12 +68,14 @@ enum ScDPFieldType class ScDPFieldWindow : public Control { private: + typedef ::std::pair< String, bool > FieldString; // true = text fits into button + String aName; /// name of the control, used in Accessibility ScDPLayoutDlg* pDlg; /// Parent dialog. Rectangle aWndRect; /// Area rectangle in pixels. FixedText* pFtCaption; /// FixedText containing the name of the control. Point aTextPos; /// Position of the caption text. - std::vector< String > aFieldArr; /// Pointer to string array of the field names. + std::vector< FieldString > aFieldArr; /// String array of the field names and flags, if text fits into button. ScDPFieldType eType; /// Type of this area. Color aFaceColor; /// Color for dialog background. Color aWinColor; /// Color for window background. @@ -97,13 +99,16 @@ private: void DrawField( OutputDevice& rDev, const Rectangle& rRect, - const String& rText, + FieldString& rText, bool bFocus ); /** @return TRUE, if the field index is inside of the control area. */ bool IsValidIndex( size_t nIndex ) const; /** @return TRUE, if the field with the given index exists. */ bool IsExistingIndex( size_t nIndex ) const; + /** @return TRUE, if the field with the given index exists and the text is + too long for the button control. */ + bool IsShortenedText( size_t nIndex ) const; /** @return The new selection index after moving to the given direction. */ size_t CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const; diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index e41bd4941d9c..dd76058756a1 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1358,11 +1358,13 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic ) } if (bDoCell && !bNeedEdit) { - if ( pCell->GetCellType() == CELLTYPE_FORMULA ) + BOOL bFormulaCell = (pCell->GetCellType() == CELLTYPE_FORMULA ); + if ( bFormulaCell ) lcl_CreateInterpretProgress( bProgress, pDoc, (ScFormulaCell*)pCell ); if ( aVars.SetText(pCell) ) pOldPattern = NULL; - bNeedEdit = aVars.HasEditCharacters(); + bNeedEdit = aVars.HasEditCharacters() || + (bFormulaCell && ((ScFormulaCell*)pCell)->IsMultilineResult()); } if (bDoCell && !bNeedEdit) { -- cgit From fbeb3ce4a4fc1cf2a4a171709cfeb677971cf577 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Mon, 7 Sep 2009 15:38:19 +0000 Subject: CWS-TOOLING: integrate CWS calcsheetdata 2009-08-13 16:18:48 +0200 nn r274950 : #i102616# shared/remote files, better handling of formula results 2009-08-12 11:17:30 +0200 nn r274884 : CWS-TOOLING: rebase CWS calcsheetdata to trunk@274622 (milestone: DEV300:m54) 2009-08-12 10:30:47 +0200 nn r274881 : #i102616# some clean-up 2009-08-11 19:01:18 +0200 nn r274876 : #i102616# store loaded namespaces, so prefixes remain valid 2009-08-11 19:00:49 +0200 nn r274875 : #i102616# store loaded namespaces, so prefixes remain valid 2009-08-10 19:12:04 +0200 nn r274835 : #i102616# detective, notes, encoding, error handling 2009-08-07 11:18:46 +0200 nn r274751 : #i102616# use new method SvXMLAutoStylePoolP::AddNamed 2009-08-07 11:18:15 +0200 nn r274750 : #i102616# new method SvXMLAutoStylePoolP::AddNamed 2009-08-06 18:02:42 +0200 nn r274740 : #i102616# modification: shapes, notes, pending row heights; skip sheets in export iterator 2009-08-05 18:41:59 +0200 nn r274694 : #i102616# handle text styles in notes 2009-08-03 18:55:59 +0200 nn r274594 : #i102616# handle text styles in cells 2009-07-31 19:00:06 +0200 nn r274548 : #i102616# handle styles for notes 2009-07-28 16:46:20 +0200 nn r274414 : missed a conflict 2009-07-28 14:01:56 +0200 nn r274404 : CWS-TOOLING: rebase CWS calcsheetdata to trunk@274203 (milestone: DEV300:m53) 2009-07-23 18:28:47 +0200 nn r274278 : #i102616# handle table styles 2009-07-22 15:40:24 +0200 nn r274244 : #i102616# handle row styles 2009-07-21 20:09:37 +0200 nn r274211 : #i102616# handle column styles 2009-07-16 13:00:18 +0200 nn r274043 : #i102616# invalidate all stream positions when inserting/deleting sheets 2009-07-15 17:41:15 +0200 nn r274021 : #i102616# don't collect cell styles twice for copied sheets 2009-07-14 18:36:11 +0200 nn r273985 : #i102616# allow to query stream position, clear buffer 2009-07-14 18:32:10 +0200 nn r273984 : #i102616# allow to specify a name for an autostyle 2009-07-09 22:01:23 +0200 nn r273870 : #i102616# copy stream for unchanged sheets 2009-07-08 18:11:42 +0200 nn r273844 : #i102616# store stream positions of sheets 2009-06-24 19:08:18 +0200 nn r273363 : #i102616# detect changed sheets since loading 2009-06-09 15:53:32 +0200 nn r272774 : #i102616# store automatic cell style information after loading --- sc/inc/detfunc.hxx | 1 + sc/inc/document.hxx | 5 + sc/inc/docuno.hxx | 2 + sc/inc/sheetdata.hxx | 183 +++++ sc/inc/table.hxx | 6 +- sc/inc/textuno.hxx | 11 + sc/source/core/data/attarray.cxx | 12 + sc/source/core/data/cell.cxx | 59 +- sc/source/core/data/documen2.cxx | 1 + sc/source/core/data/documen7.cxx | 7 + sc/source/core/data/documen8.cxx | 5 + sc/source/core/data/documen9.cxx | 2 +- sc/source/core/data/document.cxx | 22 + sc/source/core/data/table1.cxx | 19 + sc/source/core/data/table2.cxx | 7 +- sc/source/core/data/table5.cxx | 3 + sc/source/core/tool/detfunc.cxx | 16 + sc/source/filter/xml/XMLExportIterator.cxx | 70 ++ sc/source/filter/xml/XMLExportIterator.hxx | 8 + sc/source/filter/xml/XMLStylesExportHelper.cxx | 4 +- sc/source/filter/xml/XMLTableShapeImportHelper.cxx | 39 +- sc/source/filter/xml/XMLTableShapeImportHelper.hxx | 2 + sc/source/filter/xml/makefile.mk | 51 +- sc/source/filter/xml/sheetdata.cxx | 275 +++++++ sc/source/filter/xml/xmlannoi.cxx | 10 +- sc/source/filter/xml/xmlannoi.hxx | 23 +- sc/source/filter/xml/xmlbodyi.cxx | 38 + sc/source/filter/xml/xmlbodyi.hxx | 1 + sc/source/filter/xml/xmlcelli.cxx | 18 + sc/source/filter/xml/xmlcoli.cxx | 12 +- sc/source/filter/xml/xmlexprt.cxx | 842 +++++++++++++++++---- sc/source/filter/xml/xmlexprt.hxx | 25 +- sc/source/filter/xml/xmlimprt.cxx | 50 ++ sc/source/filter/xml/xmlimprt.hxx | 2 + sc/source/filter/xml/xmlrowi.cxx | 11 + sc/source/filter/xml/xmlstyli.cxx | 72 +- sc/source/filter/xml/xmlstyli.hxx | 30 + sc/source/filter/xml/xmlsubti.cxx | 10 + sc/source/filter/xml/xmltabi.cxx | 17 + sc/source/filter/xml/xmltabi.hxx | 1 + sc/source/filter/xml/xmlwrap.cxx | 63 +- sc/source/ui/docshell/docfunc.cxx | 18 + sc/source/ui/docshell/docsh.cxx | 41 + sc/source/ui/docshell/docsh4.cxx | 7 + sc/source/ui/docshell/docsh5.cxx | 2 + sc/source/ui/drawfunc/futext3.cxx | 8 + sc/source/ui/inc/docsh.hxx | 6 + sc/source/ui/unoobj/docuno.cxx | 7 + sc/source/ui/unoobj/textuno.cxx | 41 + sc/source/ui/view/formatsh.cxx | 5 + 50 files changed, 1945 insertions(+), 225 deletions(-) create mode 100644 sc/inc/sheetdata.hxx create mode 100644 sc/source/filter/xml/sheetdata.cxx diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx index edfff3c8dc7c..98922c1776b8 100644 --- a/sc/inc/detfunc.hxx +++ b/sc/inc/detfunc.hxx @@ -132,6 +132,7 @@ class SC_DLLPUBLIC ScDetectiveFunc BOOL FindFrameForObject( SdrObject* pObject, ScRange& rRange ); + void Modified(); public: ScDetectiveFunc(ScDocument* pDocument, SCTAB nTable) : pDoc(pDocument),nTab(nTable) {} diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 69c3d6140431..566bd07b6223 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -411,6 +411,7 @@ private: bool mbAdjustHeightEnabled; bool mbExecuteLinkEnabled; bool mbChangeReadOnlyEnabled; // allow changes in read-only document (for API import filters) + bool mbStreamValidLocked; sal_Int16 mnNamedRangesLockCount; @@ -571,6 +572,10 @@ public: SC_DLLPUBLIC void TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos); SC_DLLPUBLIC void SetVisible( SCTAB nTab, BOOL bVisible ); SC_DLLPUBLIC BOOL IsVisible( SCTAB nTab ) const; + BOOL IsStreamValid( SCTAB nTab ) const; + void SetStreamValid( SCTAB nTab, BOOL bSet, BOOL bIgnoreLock = FALSE ); + void LockStreamValid( bool bLock ); + bool IsStreamValidLocked() const { return mbStreamValidLocked; } BOOL IsPendingRowHeights( SCTAB nTab ) const; void SetPendingRowHeights( SCTAB nTab, BOOL bSet ); SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, BOOL bRTL ); diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index c4b6413c7d58..e46decce34ed 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -75,6 +75,7 @@ class ScTableSheetObj; class SvxFmDrawPage; class SvxDrawPage; class ScRangeList; +class ScSheetSaveData; class SC_DLLPUBLIC ScModelObj : public SfxBaseModel, public com::sun::star::sheet::XSpreadsheetDocument, @@ -129,6 +130,7 @@ public: void BeforeXMLLoading(); void AfterXMLLoading(sal_Bool bRet); + ScSheetSaveData* GetSheetSaveData(); bool HasChangesListeners() const; diff --git a/sc/inc/sheetdata.hxx b/sc/inc/sheetdata.hxx new file mode 100644 index 000000000000..63853f6bc675 --- /dev/null +++ b/sc/inc/sheetdata.hxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * 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: sheetdata.hxx,v $ + * $Revision: 1.16.32.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SC_SHEETDATA_HXX +#define SC_SHEETDATA_HXX + +#include +#include +#include +#include + +#include "address.hxx" + +class ScAddress; +class SvXMLNamespaceMap; + + +struct ScStreamEntry +{ + sal_Int32 mnStartOffset; + sal_Int32 mnEndOffset; + + ScStreamEntry() : + mnStartOffset(-1), + mnEndOffset(-1) + { + } + + ScStreamEntry( sal_Int32 nStart, sal_Int32 nEnd ) : + mnStartOffset(nStart), + mnEndOffset(nEnd) + { + } +}; + +struct ScCellStyleEntry +{ + rtl::OUString maName; + ScAddress maCellPos; + + ScCellStyleEntry( const rtl::OUString& rName, const ScAddress& rPos ) : + maName(rName), + maCellPos(rPos) + { + } +}; + +struct ScNoteStyleEntry +{ + rtl::OUString maStyleName; + rtl::OUString maTextStyle; + ScAddress maCellPos; + + ScNoteStyleEntry( const rtl::OUString& rStyle, const rtl::OUString& rText, const ScAddress& rPos ) : + maStyleName(rStyle), + maTextStyle(rText), + maCellPos(rPos) + { + } +}; + +struct ScTextStyleEntry +{ + rtl::OUString maName; + ScAddress maCellPos; + ESelection maSelection; + + ScTextStyleEntry( const rtl::OUString& rName, const ScAddress& rPos, const ESelection& rSel ) : + maName(rName), + maCellPos(rPos), + maSelection(rSel) + { + } +}; + +struct ScLoadedNamespaceEntry +{ + rtl::OUString maPrefix; + rtl::OUString maName; + sal_uInt16 mnKey; + + ScLoadedNamespaceEntry( const rtl::OUString& rPrefix, const rtl::OUString& rName, sal_uInt16 nKey ) : + maPrefix(rPrefix), + maName(rName), + mnKey(nKey) + { + } +}; + +class ScSheetSaveData +{ + std::hash_set maInitialPrefixes; + std::vector maLoadedNamespaces; + + std::vector maCellStyles; + std::vector maColumnStyles; + std::vector maRowStyles; + std::vector maTableStyles; + std::vector maNoteStyles; + std::vector maNoteParaStyles; + std::vector maNoteTextStyles; + std::vector maTextStyles; + std::vector maBlocked; + std::vector maStreamEntries; + std::vector maSaveEntries; + sal_Int32 mnStartTab; + sal_Int32 mnStartOffset; + + ScNoteStyleEntry maPreviousNote; + +public: + ScSheetSaveData(); + ~ScSheetSaveData(); + + void AddCellStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + void AddColumnStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + void AddRowStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + void AddTableStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + + void HandleNoteStyles( const rtl::OUString& rStyleName, const rtl::OUString& rTextName, const ScAddress& rCellPos ); + void AddNoteContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection ); + + void AddTextStyle( const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection ); + + void BlockSheet( sal_Int32 nTab ); + bool IsSheetBlocked( sal_Int32 nTab ) const; + + void AddStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset ); + void GetStreamPos( sal_Int32 nTab, sal_Int32& rStartOffset, sal_Int32& rEndOffset ) const; + bool HasStreamPos( sal_Int32 nTab ) const; + + void StartStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset ); + void EndStreamPos( sal_Int32 nEndOffset ); + + bool HasStartPos() const { return mnStartTab >= 0; } + + void ResetSaveEntries(); + void AddSavePos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset ); + void UseSaveEntries(); + + void StoreInitialNamespaces( const SvXMLNamespaceMap& rNamespaces ); + void StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespaces ); + bool AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) const; + + const std::vector& GetCellStyles() const { return maCellStyles; } + const std::vector& GetColumnStyles() const { return maColumnStyles; } + const std::vector& GetRowStyles() const { return maRowStyles; } + const std::vector& GetTableStyles() const { return maTableStyles; } + const std::vector& GetNoteStyles() const { return maNoteStyles; } + const std::vector& GetNoteParaStyles() const { return maNoteParaStyles; } + const std::vector& GetNoteTextStyles() const { return maNoteTextStyles; } + const std::vector& GetTextStyles() const { return maTextStyles; } +}; + +#endif + diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index bacd4d207cca..1deaa8f334a6 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -127,6 +127,7 @@ private: // interne Verwaltung ------------------ BOOL bVisible; + BOOL bStreamValid; BOOL bPendingRowHeights; SCTAB nTab; @@ -193,6 +194,9 @@ public: BOOL IsVisible() const { return bVisible; } void SetVisible( BOOL bVis ); + BOOL IsStreamValid() const { return bStreamValid; } + void SetStreamValid( BOOL bSet, BOOL bIgnoreLock = FALSE ); + BOOL IsPendingRowHeights() const { return bPendingRowHeights; } void SetPendingRowHeights( BOOL bSet ); @@ -726,7 +730,7 @@ private: BOOL GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, BOOL bInSel, const ScMarkData& rMark) const; BOOL GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ); - void SetDrawPageSize(); + void SetDrawPageSize(bool bResetStreamValid = true); BOOL TestTabRefAbs(SCTAB nTable); void CompileDBFormula(); void CompileDBFormula( BOOL bCreateFormulaString ); diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx index fdad032b8300..8ec7707874be 100644 --- a/sc/inc/textuno.hxx +++ b/sc/inc/textuno.hxx @@ -259,6 +259,8 @@ public: ScCellTextCursor(ScCellObj& rText); virtual ~ScCellTextCursor() throw(); + ScCellObj& GetCellObj() const { return rTextObj; } + // SvxUnoTextCursor methods reimplemented here: virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException); @@ -324,6 +326,15 @@ public: getStart() throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence& getUnoTunnelId(); + static ScDrawTextCursor* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface> xObj ); }; diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index c00cc111a7cd..1a466d231459 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -170,6 +170,9 @@ void ScAttrArray::Reset( const ScPatternAttr* pPattern, BOOL bAlloc ) } delete[] pData; + if (pDocument->IsStreamValid(nTab)) + pDocument->SetStreamValid(nTab, FALSE); + if (bAlloc) { nCount = nLimit = 1; @@ -472,6 +475,9 @@ void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPattern pData[nInsert].pPattern = pPattern; nCount++; } + + if (pDocument->IsStreamValid(nTab)) + pDocument->SetStreamValid(nTab, FALSE); } } // InfoBox(0, String(nCount) + String(" Eintraege") ).Execute(); @@ -550,6 +556,9 @@ void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* delete pNewPattern; } while ((nStart <= nEndRow) && (nPos < nCount)); + + if (pDocument->IsStreamValid(nTab)) + pDocument->SetStreamValid(nTab, FALSE); } #ifdef DBG_UTIL @@ -789,6 +798,9 @@ void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac } } while (nStart <= nEndRow); + + if (pDocument->IsStreamValid(nTab)) + pDocument->SetStreamValid(nTab, FALSE); } #ifdef DBG_UTIL diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx index 364d8b1b3c52..aea2bf4ff276 100644 --- a/sc/source/core/data/cell.cxx +++ b/sc/source/core/data/cell.cxx @@ -1559,6 +1559,10 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam ) } bRunning = bOldRunning; + // #i102616# For single-sheet saving consider only content changes, not format type, + // because format type isn't set on loading (might be changed later) + BOOL bContentChanged = FALSE; + // Do not create a HyperLink() cell if the formula results in an error. if( p->GetError() && pCode->IsHyperLink()) pCode->SetHyperLink(FALSE); @@ -1597,7 +1601,12 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam ) // New error code? if( p->GetError() != nOldErrCode ) + { bChanged = TRUE; + // bContentChanged only has to be set if the file content would be changed + if ( aResult.GetCellResultType() != svUnknown ) + bContentChanged = TRUE; + } // Different number format? if( nFormatType != p->GetRetFormatType() ) { @@ -1613,7 +1622,33 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam ) // In case of changes just obtain the result, no temporary and // comparison needed anymore. if (bChanged) + { + // #i102616# Compare anyway if the sheet is still marked unchanged for single-sheet saving + // Also handle special cases of initial results after loading. + + if ( !bContentChanged && pDocument->IsStreamValid(aPos.Tab()) ) + { + ScFormulaResult aNewResult( p->GetResultToken()); + StackVar eOld = aResult.GetCellResultType(); + StackVar eNew = aNewResult.GetCellResultType(); + if ( eOld == svUnknown && ( eNew == svError || ( eNew == svDouble && aNewResult.GetDouble() == 0.0 ) ) ) + { + // ScXMLTableRowCellContext::EndElement doesn't call SetFormulaResultDouble for 0 + // -> no change + } + else + { + if ( eOld == svHybridCell ) // string result from SetFormulaResultString? + eOld = svString; // ScHybridCellToken has a valid GetString method + + bContentChanged = (eOld != eNew || + (eNew == svDouble && aResult.GetDouble() != aNewResult.GetDouble()) || + (eNew == svString && aResult.GetString() != aNewResult.GetString())); + } + } + aResult.SetToken( p->GetResultToken() ); + } else { ScFormulaResult aNewResult( p->GetResultToken()); @@ -1622,6 +1657,19 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam ) bChanged = (eOld != eNew || (eNew == svDouble && aResult.GetDouble() != aNewResult.GetDouble()) || (eNew == svString && aResult.GetString() != aNewResult.GetString())); + + // #i102616# handle special cases of initial results after loading (only if the sheet is still marked unchanged) + if ( bChanged && !bContentChanged && pDocument->IsStreamValid(aPos.Tab()) ) + { + if ( ( eOld == svUnknown && ( eNew == svError || ( eNew == svDouble && aNewResult.GetDouble() == 0.0 ) ) ) || + ( eOld == svHybridCell && eNew == svString && aResult.GetString() == aNewResult.GetString() ) ) + { + // no change, see above + } + else + bContentChanged = TRUE; + } + aResult.Assign( aNewResult); } @@ -1658,13 +1706,19 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam ) // Coded double error may occur via filter import. USHORT nErr = GetDoubleErrorValue( aResult.GetDouble()); aResult.SetResultError( nErr); - bChanged = true; + bChanged = bContentChanged = true; } if( bChanged ) { SetTextWidth( TEXTWIDTH_DIRTY ); SetScriptType( SC_SCRIPTTYPE_UNKNOWN ); } + if (bContentChanged && pDocument->IsStreamValid(aPos.Tab())) + { + // pass bIgnoreLock=TRUE, because even if called from pending row height update, + // a changed result must still reset the stream flag + pDocument->SetStreamValid(aPos.Tab(), FALSE, TRUE); + } if ( !pCode->IsRecalcModeAlways() ) pDocument->RemoveFromFormulaTree( this ); @@ -1789,6 +1843,9 @@ void ScFormulaCell::SetDirty() pDocument->TrackFormulas(); } } + + if (pDocument->IsStreamValid(aPos.Tab())) + pDocument->SetStreamValid(aPos.Tab(), FALSE); } } diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 482aedbc7940..ae1f087a23a8 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -217,6 +217,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, mbAdjustHeightEnabled( true ), mbExecuteLinkEnabled( true ), mbChangeReadOnlyEnabled( false ), + mbStreamValidLocked( false ), mnNamedRangesLockCount( 0 ) { SetStorageGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT); diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index c0ae477ed96b..9527089ebde3 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -125,6 +125,13 @@ void ScDocument::Broadcast( const ScHint& rHint ) // Repaint fuer bedingte Formate mit relativen Referenzen: if ( pCondFormList && rHint.GetAddress() != BCA_BRDCST_ALWAYS ) pCondFormList->SourceChanged( rHint.GetAddress() ); + + if ( rHint.GetAddress() != BCA_BRDCST_ALWAYS ) + { + SCTAB nTab = rHint.GetAddress().Tab(); + if (pTab[nTab] && pTab[nTab]->IsStreamValid()) + pTab[nTab]->SetStreamValid(FALSE); + } } diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index c34e93f10d66..b337cc902aef 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -271,6 +271,11 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet, if ( ScGlobal::CheckWidthInvalidate( bNumFormatChanged, rSet, rChanges ) ) InvalidateTextWidth( NULL, NULL, bNumFormatChanged ); + + for (SCTAB nTab=0; nTab<=MAXTAB; ++nTab) + if (pTab[nTab] && pTab[nTab]->IsStreamValid()) + pTab[nTab]->SetStreamValid( FALSE ); + ULONG nOldFormat = ((const SfxUInt32Item*)&rSet.Get( ATTR_VALUE_FORMAT ))->GetValue(); diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 06a683b0bf72..793be9a8c2e9 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -245,7 +245,7 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell ) pTab[nTab]->GetName(aTabName); pDrawLayer->ScRenamePage( nTab, aTabName ); - pTab[nTab]->SetDrawPageSize(); // #54782# sofort die richtige Groesse + pTab[nTab]->SetDrawPageSize(false); // #54782# set the right size immediately #if 0 ULONG nx = (ULONG) ((double) (MAXCOL+1) * STD_COL_WIDTH * HMM_PER_TWIPS ); ULONG ny = (ULONG) ((double) (MAXROW+1) * ScGlobal::nStdRowHeight * HMM_PER_TWIPS ); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index b1d19d4b3dae..e5af00781cff 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -497,6 +497,28 @@ BOOL ScDocument::IsVisible( SCTAB nTab ) const } +BOOL ScDocument::IsStreamValid( SCTAB nTab ) const +{ + if ( ValidTab(nTab) && pTab[nTab] ) + return pTab[nTab]->IsStreamValid(); + + return FALSE; +} + + +void ScDocument::SetStreamValid( SCTAB nTab, BOOL bSet, BOOL bIgnoreLock ) +{ + if ( ValidTab(nTab) && pTab[nTab] ) + pTab[nTab]->SetStreamValid( bSet, bIgnoreLock ); +} + + +void ScDocument::LockStreamValid( bool bLock ) +{ + mbStreamValidLocked = bLock; +} + + BOOL ScDocument::IsPendingRowHeights( SCTAB nTab ) const { if ( ValidTab(nTab) && pTab[nTab] ) diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index ff6caa2da1bd..1f1d82023f45 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -141,6 +141,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName, pOutlineTable( NULL ), bTableAreaValid( FALSE ), bVisible( TRUE ), + bStreamValid( FALSE ), bPendingRowHeights( FALSE ), nTab( nNewTab ), nRecalcLvl( 0 ), @@ -248,9 +249,18 @@ const String& ScTable::GetUpperName() const void ScTable::SetVisible( BOOL bVis ) { + if (bVisible != bVis && IsStreamValid()) + SetStreamValid(FALSE); + bVisible = bVis; } +void ScTable::SetStreamValid( BOOL bSet, BOOL bIgnoreLock ) +{ + if ( bIgnoreLock || !pDocument->IsStreamValidLocked() ) + bStreamValid = bSet; +} + void ScTable::SetPendingRowHeights( BOOL bSet ) { bPendingRowHeights = bSet; @@ -1247,6 +1257,9 @@ void ScTable::UpdateInsertTab(SCTAB nTable) { if (nTab >= nTable) nTab++; for (SCCOL i=0; i <= MAXCOL; i++) aCol[i].UpdateInsertTab(nTable); + + if (IsStreamValid()) + SetStreamValid(FALSE); } //UNUSED2008-05 void ScTable::UpdateInsertTabOnlyCells(SCTAB nTable) @@ -1263,6 +1276,9 @@ void ScTable::UpdateDeleteTab( SCTAB nTable, BOOL bIsMove, ScTable* pRefUndo ) for (i=0; i <= MAXCOL; i++) aCol[i].UpdateDeleteTab(nTable, bIsMove, &pRefUndo->aCol[i]); else for (i=0; i <= MAXCOL; i++) aCol[i].UpdateDeleteTab(nTable, bIsMove, NULL); + + if (IsStreamValid()) + SetStreamValid(FALSE); } void ScTable::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, @@ -1274,6 +1290,9 @@ void ScTable::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, aCol[i].UpdateMoveTab( nOldPos, nNewPos, nTabNo ); rProgress.SetState( rProgress.GetState() + aCol[i].GetCodeCount() ); } + + if (IsStreamValid()) + SetStreamValid(FALSE); } void ScTable::UpdateCompile( BOOL bForceIfNameInUse ) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index daaf2d56b193..104fb46b4495 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2837,7 +2837,7 @@ void ScTable::GetUpperCellString(SCCOL nCol, SCROW nRow, String& rStr) // Berechnen der Groesse der Tabelle und setzen der Groesse an der DrawPage -void ScTable::SetDrawPageSize() +void ScTable::SetDrawPageSize(bool bResetStreamValid) { ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer(); if( pDrawLayer ) @@ -2852,6 +2852,11 @@ void ScTable::SetDrawPageSize() pDrawLayer->SetPageSize( static_cast(nTab), Size( x, y ) ); } + + // #i102616# actions that modify the draw page size count as sheet modification + // (exception: InitDrawLayer) + if (bResetStreamValid && IsStreamValid()) + SetStreamValid(FALSE); } diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index 021385678160..eb959dfb2ffa 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -353,6 +353,9 @@ void ScTable::SetPageStyle( const String& rName ) if ( pNewStyle ) // auch ohne den alten (fuer UpdateStdNames) aPageStyle = aStrNew; + + if (IsStreamValid()) + SetStreamValid(FALSE); } } } diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 2d337eab2eb3..a08b81a1917c 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -290,6 +290,12 @@ void ScCommentData::UpdateCaptionSet( const SfxItemSet& rItemSet ) //------------------------------------------------------------------------ +void ScDetectiveFunc::Modified() +{ + if (pDoc->IsStreamValid(nTab)) + pDoc->SetStreamValid(nTab, FALSE); +} + inline BOOL Intersect( SCCOL nStartCol1, SCROW nStartRow1, SCCOL nEndCol1, SCROW nEndRow1, SCCOL nStartCol2, SCROW nStartRow2, SCCOL nEndCol2, SCROW nEndRow2 ) { @@ -547,6 +553,7 @@ BOOL ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow, pData->maEnd.Set( nCol, nRow, nTab); + Modified(); return TRUE; } @@ -609,6 +616,7 @@ BOOL ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow, pData->maStart.Set( nStartCol, nStartRow, nTab); pData->maEnd.SetInvalid(); + Modified(); return TRUE; } @@ -676,6 +684,8 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData ScDrawObjData* pData = ScDrawLayer::GetObjData( pCircle, TRUE ); pData->maStart.Set( nCol, nRow, nTab); pData->maEnd.SetInvalid(); + + Modified(); } void ScDetectiveFunc::DeleteArrowsAt( SCCOL nCol, SCROW nRow, BOOL bDestPnt ) @@ -716,6 +726,8 @@ void ScDetectiveFunc::DeleteArrowsAt( SCCOL nCol, SCROW nRow, BOOL bDestPnt ) pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() ); delete[] ppObj; + + Modified(); } } @@ -791,6 +803,8 @@ void ScDetectiveFunc::DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nR pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() ); delete[] ppObj; + + Modified(); } } @@ -1333,6 +1347,8 @@ BOOL ScDetectiveFunc::DeleteAll( ScDetectiveDelete eWhat ) pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() ); delete[] ppObj; + + Modified(); } return ( nDelCount != 0 ); diff --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx index 72194c8be11c..c0b50a06b45a 100644 --- a/sc/source/filter/xml/XMLExportIterator.cxx +++ b/sc/source/filter/xml/XMLExportIterator.cxx @@ -130,6 +130,13 @@ void ScMyShapesContainer::SetCellData( ScMyCell& rMyCell ) rMyCell.bHasShape = !rMyCell.aShapeList.empty(); } +void ScMyShapesContainer::SkipTable(SCTAB nSkip) +{ + ScMyShapeList::iterator aItr = aShapeList.begin(); + while( (aItr != aShapeList.end()) && (aItr->aAddress.Tab() == nSkip) ) + aItr = aShapeList.erase(aItr); +} + void ScMyShapesContainer::Sort() { aShapeList.sort(); @@ -184,6 +191,13 @@ void ScMyNoteShapesContainer::SetCellData( ScMyCell& rMyCell ) } } +void ScMyNoteShapesContainer::SkipTable(SCTAB nSkip) +{ + ScMyNoteShapeList::iterator aItr = aNoteShapeList.begin(); + while( (aItr != aNoteShapeList.end()) && (aItr->aPos.Tab() == nSkip) ) + aItr = aNoteShapeList.erase(aItr); +} + void ScMyNoteShapesContainer::Sort() { aNoteShapeList.sort(); @@ -269,6 +283,13 @@ void ScMyMergedRangesContainer::SetCellData( ScMyCell& rMyCell ) } } +void ScMyMergedRangesContainer::SkipTable(SCTAB nSkip) +{ + ScMyMergedRangeList::iterator aItr = aRangeList.begin(); + while( (aItr != aRangeList.end()) && (aItr->aCellRange.Sheet == nSkip) ) + aItr = aRangeList.erase(aItr); +} + void ScMyMergedRangesContainer::Sort() { aRangeList.sort(); @@ -344,6 +365,13 @@ void ScMyAreaLinksContainer::SetCellData( ScMyCell& rMyCell ) } } +void ScMyAreaLinksContainer::SkipTable(SCTAB nSkip) +{ + ScMyAreaLinkList::iterator aItr = aAreaLinkList.begin(); + while( (aItr != aAreaLinkList.end()) && (aItr->aDestRange.Sheet == nSkip) ) + aItr = aAreaLinkList.erase(aItr); +} + void ScMyAreaLinksContainer::Sort() { aAreaLinkList.sort(); @@ -417,6 +445,13 @@ void ScMyEmptyDatabaseRangesContainer::SetCellData( ScMyCell& rMyCell ) } } +void ScMyEmptyDatabaseRangesContainer::SkipTable(SCTAB nSkip) +{ + ScMyEmptyDatabaseRangeList::iterator aItr = aDatabaseList.begin(); + while( (aItr != aDatabaseList.end()) && (aItr->Sheet == nSkip) ) + aItr = aDatabaseList.erase(aItr); +} + void ScMyEmptyDatabaseRangesContainer::Sort() { aDatabaseList.sort(); @@ -498,6 +533,13 @@ void ScMyDetectiveObjContainer::SetCellData( ScMyCell& rMyCell ) rMyCell.bHasDetectiveObj = (rMyCell.aDetectiveObjVec.size() != 0); } +void ScMyDetectiveObjContainer::SkipTable(SCTAB nSkip) +{ + ScMyDetectiveObjList::iterator aItr = aDetectiveObjList.begin(); + while( (aItr != aDetectiveObjList.end()) && (aItr->aPosition.Sheet == nSkip) ) + aItr = aDetectiveObjList.erase(aItr); +} + void ScMyDetectiveObjContainer::Sort() { aDetectiveObjList.sort(); @@ -557,6 +599,13 @@ void ScMyDetectiveOpContainer::SetCellData( ScMyCell& rMyCell ) rMyCell.bHasDetectiveOp = (rMyCell.aDetectiveOpVec.size() != 0); } +void ScMyDetectiveOpContainer::SkipTable(SCTAB nSkip) +{ + ScMyDetectiveOpList::iterator aItr = aDetectiveOpList.begin(); + while( (aItr != aDetectiveOpList.end()) && (aItr->aPosition.Sheet == nSkip) ) + aItr = aDetectiveOpList.erase(aItr); +} + void ScMyDetectiveOpContainer::Sort() { aDetectiveOpList.sort(); @@ -766,6 +815,27 @@ void ScMyNotEmptyCellsIterator::SetCurrentTable(const SCTAB nTable, } } +void ScMyNotEmptyCellsIterator::SkipTable(SCTAB nSkip) +{ + // Skip entries for a sheet that is copied instead of saving normally. + // Cells (including aAnnotations) are handled separately in SetCurrentTable. + + if( pShapes ) + pShapes->SkipTable(nSkip); + if( pNoteShapes ) + pNoteShapes->SkipTable(nSkip); + if( pEmptyDatabaseRanges ) + pEmptyDatabaseRanges->SkipTable(nSkip); + if( pMergedRanges ) + pMergedRanges->SkipTable(nSkip); + if( pAreaLinks ) + pAreaLinks->SkipTable(nSkip); + if( pDetectiveObj ) + pDetectiveObj->SkipTable(nSkip); + if( pDetectiveOp ) + pDetectiveOp->SkipTable(nSkip); +} + sal_Bool ScMyNotEmptyCellsIterator::GetNext(ScMyCell& aCell, ScFormatRangeStyles* pCellStyles) { table::CellAddress aAddress( nCurrentTable, MAXCOL + 1, MAXROW + 1 ); diff --git a/sc/source/filter/xml/XMLExportIterator.hxx b/sc/source/filter/xml/XMLExportIterator.hxx index d15ef94f99e6..92c61ca060e9 100644 --- a/sc/source/filter/xml/XMLExportIterator.hxx +++ b/sc/source/filter/xml/XMLExportIterator.hxx @@ -96,6 +96,7 @@ public: const ScMyShapeList* GetShapes() { return &aShapeList; } virtual void SetCellData( ScMyCell& rMyCell ); virtual void Sort(); + void SkipTable(SCTAB nSkip); }; struct ScMyNoteShape @@ -124,6 +125,7 @@ public: const ScMyNoteShapeList* GetNotes() { return &aNoteShapeList; } virtual void SetCellData( ScMyCell& rMyCell ); virtual void Sort(); + void SkipTable(SCTAB nSkip); }; //============================================================================== @@ -152,6 +154,7 @@ public: using ScMyIteratorBase::UpdateAddress; virtual void SetCellData( ScMyCell& rMyCell ); virtual void Sort(); // + remove doublets + void SkipTable(SCTAB nSkip); }; //============================================================================== @@ -192,6 +195,7 @@ public: using ScMyIteratorBase::UpdateAddress; virtual void SetCellData( ScMyCell& rMyCell ); virtual void Sort(); + void SkipTable(SCTAB nSkip); }; //============================================================================== @@ -218,6 +222,7 @@ public: using ScMyIteratorBase::UpdateAddress; virtual void SetCellData( ScMyCell& rMyCell ); virtual void Sort(); + void SkipTable(SCTAB nSkip); }; //============================================================================== @@ -254,6 +259,7 @@ public: using ScMyIteratorBase::UpdateAddress; virtual void SetCellData( ScMyCell& rMyCell ); virtual void Sort(); + void SkipTable(SCTAB nSkip); }; //============================================================================== @@ -284,6 +290,7 @@ public: using ScMyIteratorBase::UpdateAddress; virtual void SetCellData( ScMyCell& rMyCell ); virtual void Sort(); + void SkipTable(SCTAB nSkip); }; //============================================================================== @@ -400,6 +407,7 @@ public: void SetCurrentTable(const SCTAB nTable, com::sun::star::uno::Reference& rxTable); + void SkipTable(SCTAB nSkip); sal_Bool GetNext(ScMyCell& aCell, ScFormatRangeStyles* pCellStyles); }; diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx index 6482fe571b62..98100f4b3646 100644 --- a/sc/source/filter/xml/XMLStylesExportHelper.cxx +++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx @@ -878,7 +878,7 @@ sal_Int32 ScFormatRangeStyles::GetIndexOfStyleName(const rtl::OUString& rString, sal_Int32 nPrefixLength(rPrefix.getLength()); rtl::OUString sTemp(rString.copy(nPrefixLength)); sal_Int32 nIndex(sTemp.toInt32()); - if (aAutoStyleNames.at(nIndex - 1)->equals(rString)) + if (nIndex > 0 && static_cast(nIndex-1) < aAutoStyleNames.size() && aAutoStyleNames.at(nIndex - 1)->equals(rString)) { bIsAutoStyle = sal_True; return nIndex - 1; @@ -1111,7 +1111,7 @@ sal_Int32 ScColumnRowStylesBase::GetIndexOfStyleName(const rtl::OUString& rStrin sal_Int32 nPrefixLength(rPrefix.getLength()); rtl::OUString sTemp(rString.copy(nPrefixLength)); sal_Int32 nIndex(sTemp.toInt32()); - if (aStyleNames.at(nIndex - 1)->equals(rString)) + if (nIndex > 0 && static_cast(nIndex-1) < aStyleNames.size() && aStyleNames.at(nIndex - 1)->equals(rString)) return nIndex - 1; else { diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx index 48def752b038..f498faf93e5b 100644 --- a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx +++ b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx @@ -36,6 +36,8 @@ #include "drwlayer.hxx" #include "xmlannoi.hxx" #include "rangeutl.hxx" +#include "docuno.hxx" +#include "sheetdata.hxx" #include #include #include @@ -80,9 +82,11 @@ void XMLTableShapeImportHelper::finishShape( const uno::Reference< xml::sax::XAttributeList >& xAttrList, uno::Reference< drawing::XShapes >& rShapes ) { + bool bNote = false; XMLShapeImportHelper::finishShape( rShape, xAttrList, rShapes ); static_cast(mrImporter).LockSolarMutex(); - if (rShapes == static_cast(mrImporter).GetTables().GetCurrentXShapes()) + ScMyTables& rTables = static_cast(mrImporter).GetTables(); + if (rShapes == rTables.GetCurrentXShapes()) { if (!pAnnotationContext) { @@ -126,7 +130,7 @@ void XMLTableShapeImportHelper::finishShape( if (!bOnTable) { - static_cast(mrImporter).GetTables().AddShape(rShape, + rTables.AddShape(rShape, pRangeList, aStartCell, aEndCell, nEndX, nEndY); SvxShape* pShapeImp = SvxShape::getImplementation(rShape); if (pShapeImp) @@ -145,7 +149,7 @@ void XMLTableShapeImportHelper::finishShape( // -> call AddShape with invalid cell position (checked in ScMyShapeResizer::ResizeShapes) table::CellAddress aInvalidPos( -1, -1, -1 ); - static_cast(mrImporter).GetTables().AddShape(rShape, + rTables.AddShape(rShape, pRangeList, aInvalidPos, aInvalidPos, 0, 0); } @@ -160,7 +164,26 @@ void XMLTableShapeImportHelper::finishShape( } else // shape is annotation { - pAnnotationContext->SetShape(rShape, rShapes); + // get the style names for stream copying + rtl::OUString aStyleName; + rtl::OUString aTextStyle; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for( sal_Int16 i=0; i < nAttrCount; ++i ) + { + const rtl::OUString& rAttrName(xAttrList->getNameByIndex( i )); + rtl::OUString aLocalName; + sal_uInt16 nPrefix(static_cast(mrImporter).GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName )); + if(nPrefix == XML_NAMESPACE_DRAW) + { + if (IsXMLToken(aLocalName, XML_STYLE_NAME)) + aStyleName = xAttrList->getValueByIndex( i ); + else if (IsXMLToken(aLocalName, XML_TEXT_STYLE_NAME)) + aTextStyle = xAttrList->getValueByIndex( i ); + } + } + + pAnnotationContext->SetShape(rShape, rShapes, aStyleName, aTextStyle); + bNote = true; } } else //#99532# this are grouped shapes which should also get the layerid @@ -183,5 +206,13 @@ void XMLTableShapeImportHelper::finishShape( } SetLayer(rShape, nLayerID, rShape->getShapeType()); } + + if (!bNote) + { + // any shape other than a note prevents copying the sheet + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(mrImporter.GetModel())->GetSheetSaveData(); + pSheetData->BlockSheet( rTables.GetCurrentSheet() ); + } + static_cast(mrImporter).UnlockSolarMutex(); } diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.hxx b/sc/source/filter/xml/XMLTableShapeImportHelper.hxx index 4299649427e4..06d49dc4beed 100644 --- a/sc/source/filter/xml/XMLTableShapeImportHelper.hxx +++ b/sc/source/filter/xml/XMLTableShapeImportHelper.hxx @@ -57,6 +57,8 @@ public: void SetCell (const ::com::sun::star::table::CellAddress& rAddress) { aStartCell = rAddress; } void SetOnTable (const sal_Bool bTempOnTable) { bOnTable = bTempOnTable; } void SetAnnotation(ScXMLAnnotationContext* pAnnotation) { pAnnotationContext = pAnnotation; } + + ScXMLAnnotationContext* GetAnnotationContext() const { return pAnnotationContext; } }; diff --git a/sc/source/filter/xml/makefile.mk b/sc/source/filter/xml/makefile.mk index 19d8a99f789c..c1e7e215e199 100644 --- a/sc/source/filter/xml/makefile.mk +++ b/sc/source/filter/xml/makefile.mk @@ -51,57 +51,8 @@ PROJECTPCHSOURCE=..\pch\filt_pch # --- Files -------------------------------------------------------- -CXXFILES = \ - xmlwrap.cxx \ - xmlimprt.cxx \ - xmlexprt.cxx \ - xmlbodyi.cxx \ - xmltabi.cxx \ - xmlexternaltabi.cxx \ - xmlrowi.cxx \ - xmlcelli.cxx \ - xmlconti.cxx \ - xmlcoli.cxx \ - xmlsubti.cxx \ - xmlnexpi.cxx \ - xmldrani.cxx \ - xmlfilti.cxx \ - xmlsorti.cxx \ - xmlstyle.cxx \ - xmlstyli.cxx \ - xmldpimp.cxx \ - xmlannoi.cxx \ - xmlsceni.cxx \ - xmlcvali.cxx \ - XMLTableMasterPageExport.cxx \ - xmllabri.cxx \ - XMLTableHeaderFooterContext.cxx \ - XMLDetectiveContext.cxx \ - XMLCellRangeSourceContext.cxx \ - XMLConsolidationContext.cxx \ - XMLConverter.cxx \ - XMLExportIterator.cxx \ - XMLColumnRowGroupExport.cxx \ - XMLStylesExportHelper.cxx \ - XMLStylesImportHelper.cxx \ - XMLExportDataPilot.cxx \ - XMLExportDatabaseRanges.cxx \ - XMLTableShapeImportHelper.cxx \ - XMLTableShapesContext.cxx \ - XMLExportDDELinks.cxx \ - XMLDDELinksContext.cxx \ - XMLCalculationSettingsContext.cxx \ - XMLTableSourceContext.cxx \ - XMLTextPContext.cxx \ - XMLTableShapeResizer.cxx \ - XMLChangeTrackingExportHelper.cxx \ - xmlfonte.cxx \ - XMLChangeTrackingImportHelper.cxx \ - XMLTrackedChangesContext.cxx \ - XMLExportSharedData.cxx \ - XMLEmptyContext.cxx - SLOFILES = \ + $(SLO)$/sheetdata.obj \ $(SLO)$/xmlwrap.obj \ $(SLO)$/xmlimprt.obj \ $(SLO)$/xmlexprt.obj \ diff --git a/sc/source/filter/xml/sheetdata.cxx b/sc/source/filter/xml/sheetdata.cxx new file mode 100644 index 000000000000..a8b96eb6d768 --- /dev/null +++ b/sc/source/filter/xml/sheetdata.cxx @@ -0,0 +1,275 @@ +/************************************************************************* + * + * 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: sheetdata.cxx,v $ + * $Revision: 1.69.32.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" + +// INCLUDE --------------------------------------------------------------- + +#include +#include +#include +#include +#include + +#include "sheetdata.hxx" + +// ----------------------------------------------------------------------- + +ScSheetSaveData::ScSheetSaveData() : + mnStartTab( -1 ), + mnStartOffset( -1 ), + maPreviousNote( rtl::OUString(), rtl::OUString(), ScAddress(ScAddress::INITIALIZE_INVALID) ) +{ +} + +ScSheetSaveData::~ScSheetSaveData() +{ +} + +void ScSheetSaveData::AddCellStyle( const rtl::OUString& rName, const ScAddress& rCellPos ) +{ + maCellStyles.push_back( ScCellStyleEntry( rName, rCellPos ) ); +} + +void ScSheetSaveData::AddColumnStyle( const rtl::OUString& rName, const ScAddress& rCellPos ) +{ + maColumnStyles.push_back( ScCellStyleEntry( rName, rCellPos ) ); +} + +void ScSheetSaveData::AddRowStyle( const rtl::OUString& rName, const ScAddress& rCellPos ) +{ + maRowStyles.push_back( ScCellStyleEntry( rName, rCellPos ) ); +} + +void ScSheetSaveData::AddTableStyle( const rtl::OUString& rName, const ScAddress& rCellPos ) +{ + maTableStyles.push_back( ScCellStyleEntry( rName, rCellPos ) ); +} + +void ScSheetSaveData::HandleNoteStyles( const rtl::OUString& rStyleName, const rtl::OUString& rTextName, const ScAddress& rCellPos ) +{ + // only consecutive duplicates (most common case) are filtered out here, + // the others are found when the styles are created + + if ( rStyleName == maPreviousNote.maStyleName && + rTextName == maPreviousNote.maTextStyle && + rCellPos.Tab() == maPreviousNote.maCellPos.Tab() ) + { + // already stored for the same sheet - ignore + return; + } + + ScNoteStyleEntry aNewEntry( rStyleName, rTextName, rCellPos ); + maPreviousNote = aNewEntry; + maNoteStyles.push_back( aNewEntry ); +} + +void ScSheetSaveData::AddNoteContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection ) +{ + if ( nFamily == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) + maNoteParaStyles.push_back( ScTextStyleEntry( rName, rCellPos, rSelection ) ); + else + maNoteTextStyles.push_back( ScTextStyleEntry( rName, rCellPos, rSelection ) ); +} + +void ScSheetSaveData::AddTextStyle( const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection ) +{ + maTextStyles.push_back( ScTextStyleEntry( rName, rCellPos, rSelection ) ); +} + +void ScSheetSaveData::BlockSheet( sal_Int32 nTab ) +{ + if ( nTab >= (sal_Int32)maBlocked.size() ) + maBlocked.resize( nTab + 1, false ); // fill vector with "false" entries + + maBlocked[nTab] = true; +} + +bool ScSheetSaveData::IsSheetBlocked( sal_Int32 nTab ) const +{ + if ( nTab < (sal_Int32)maBlocked.size() ) + return maBlocked[nTab]; + else + return false; +} + +void ScSheetSaveData::AddStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset ) +{ + if ( nTab >= (sal_Int32)maStreamEntries.size() ) + maStreamEntries.resize( nTab + 1 ); + + maStreamEntries[nTab] = ScStreamEntry( nStartOffset, nEndOffset ); +} + +void ScSheetSaveData::StartStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset ) +{ + DBG_ASSERT( mnStartTab < 0, "StartStreamPos without EndStreamPos" ); + + mnStartTab = nTab; + mnStartOffset = nStartOffset; +} + +void ScSheetSaveData::EndStreamPos( sal_Int32 nEndOffset ) +{ + if ( mnStartTab >= 0 ) + { + AddStreamPos( mnStartTab, mnStartOffset, nEndOffset ); + mnStartTab = -1; + mnStartOffset = -1; + } +} + +void ScSheetSaveData::GetStreamPos( sal_Int32 nTab, sal_Int32& rStartOffset, sal_Int32& rEndOffset ) const +{ + if ( nTab < (sal_Int32)maStreamEntries.size() ) + { + const ScStreamEntry& rEntry = maStreamEntries[nTab]; + rStartOffset = rEntry.mnStartOffset; + rEndOffset = rEntry.mnEndOffset; + } + else + rStartOffset = rEndOffset = -1; +} + +bool ScSheetSaveData::HasStreamPos( sal_Int32 nTab ) const +{ + sal_Int32 nStartOffset = -1; + sal_Int32 nEndOffset = -1; + GetStreamPos( nTab, nStartOffset, nEndOffset ); + return ( nStartOffset >= 0 && nEndOffset >= 0 ); +} + +void ScSheetSaveData::ResetSaveEntries() +{ + maSaveEntries.clear(); +} + +void ScSheetSaveData::AddSavePos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset ) +{ + if ( nTab >= (sal_Int32)maSaveEntries.size() ) + maSaveEntries.resize( nTab + 1 ); + + maSaveEntries[nTab] = ScStreamEntry( nStartOffset, nEndOffset ); +} + +void ScSheetSaveData::UseSaveEntries() +{ + maStreamEntries = maSaveEntries; +} + +void ScSheetSaveData::StoreInitialNamespaces( const SvXMLNamespaceMap& rNamespaces ) +{ + // the initial namespaces are just removed from the list of loaded namespaces, + // so only a hash_set of the prefixes is needed. + + const NameSpaceHash& rNameHash = rNamespaces.GetAllEntries(); + NameSpaceHash::const_iterator aIter = rNameHash.begin(), aEnd = rNameHash.end(); + while (aIter != aEnd) + { + maInitialPrefixes.insert( aIter->first ); + ++aIter; + } +} + +void ScSheetSaveData::StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespaces ) +{ + // store the loaded namespaces, so the prefixes in copied stream fragments remain valid + + const NameSpaceHash& rNameHash = rNamespaces.GetAllEntries(); + NameSpaceHash::const_iterator aIter = rNameHash.begin(), aEnd = rNameHash.end(); + while (aIter != aEnd) + { + // ignore the initial namespaces + if ( maInitialPrefixes.find( aIter->first ) == maInitialPrefixes.end() ) + { + const NameSpaceEntry& rEntry = aIter->second.getBody(); + maLoadedNamespaces.push_back( ScLoadedNamespaceEntry( rEntry.sPrefix, rEntry.sName, rEntry.nKey ) ); + } + ++aIter; + } +} + +bool lcl_NameInHash( const NameSpaceHash& rNameHash, const rtl::OUString& rName ) +{ + NameSpaceHash::const_iterator aIter = rNameHash.begin(), aEnd = rNameHash.end(); + while (aIter != aEnd) + { + if ( aIter->second->sName == rName ) + return true; + + ++aIter; + } + return false; // not found +} + +bool ScSheetSaveData::AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) const +{ + // Add the loaded namespaces to the name space map. + + // first loop: only look for conflicts + // (if the loaded namespaces were added first, this might not be necessary) + const NameSpaceHash& rNameHash = rNamespaces.GetAllEntries(); + std::vector::const_iterator aIter = maLoadedNamespaces.begin(); + std::vector::const_iterator aEnd = maLoadedNamespaces.end(); + while (aIter != aEnd) + { + NameSpaceHash::const_iterator aHashIter = rNameHash.find( aIter->maPrefix ); + if ( aHashIter == rNameHash.end() ) + { + if ( lcl_NameInHash( rNameHash, aIter->maName ) ) + { + // a second prefix for the same name would confuse SvXMLNamespaceMap lookup, + // so this is also considered a conflict + return false; + } + } + else if ( aHashIter->second->sName != aIter->maName ) + { + // same prefix, but different name: loaded namespaces can't be used + return false; + } + ++aIter; + } + + // only if there were no conflicts, add the entries that aren't in the map already + // (the key is needed if the same namespace is added later within an element) + aIter = maLoadedNamespaces.begin(); + while (aIter != aEnd) + { + NameSpaceHash::const_iterator aHashIter = rNameHash.find( aIter->maPrefix ); + if ( aHashIter == rNameHash.end() ) + rNamespaces.Add( aIter->maPrefix, aIter->maName, aIter->mnKey ); + ++aIter; + } + + return true; // success +} + diff --git a/sc/source/filter/xml/xmlannoi.cxx b/sc/source/filter/xml/xmlannoi.cxx index f8081b7b8f48..294a335033c1 100644 --- a/sc/source/filter/xml/xmlannoi.cxx +++ b/sc/source/filter/xml/xmlannoi.cxx @@ -207,9 +207,17 @@ void ScXMLAnnotationContext::EndElement() pTableShapeImport->SetAnnotation(NULL); } -void ScXMLAnnotationContext::SetShape( const uno::Reference< drawing::XShape >& rxShape, const uno::Reference< drawing::XShapes >& rxShapes ) +void ScXMLAnnotationContext::SetShape( const uno::Reference< drawing::XShape >& rxShape, const uno::Reference< drawing::XShapes >& rxShapes, + const rtl::OUString& rStyleName, const rtl::OUString& rTextStyle ) { mrAnnotationData.mxShape = rxShape; mrAnnotationData.mxShapes = rxShapes; + mrAnnotationData.maStyleName = rStyleName; + mrAnnotationData.maTextStyle = rTextStyle; +} + +void ScXMLAnnotationContext::AddContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ESelection& rSelection ) +{ + mrAnnotationData.maContentStyles.push_back( ScXMLAnnotationStyleEntry( nFamily, rName, rSelection ) ); } diff --git a/sc/source/filter/xml/xmlannoi.hxx b/sc/source/filter/xml/xmlannoi.hxx index c509b72124ed..41b206bd4380 100644 --- a/sc/source/filter/xml/xmlannoi.hxx +++ b/sc/source/filter/xml/xmlannoi.hxx @@ -34,12 +34,27 @@ #include #include #include +#include #include #include class ScXMLImport; class ScXMLTableRowCellContext; +struct ScXMLAnnotationStyleEntry +{ + sal_uInt16 mnFamily; + rtl::OUString maName; + ESelection maSelection; + + ScXMLAnnotationStyleEntry( sal_uInt16 nFam, const rtl::OUString& rNam, const ESelection& rSel ) : + mnFamily( nFam ), + maName( rNam ), + maSelection( rSel ) + { + } +}; + struct ScXMLAnnotationData { ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > @@ -49,8 +64,11 @@ struct ScXMLAnnotationData ::rtl::OUString maAuthor; ::rtl::OUString maCreateDate; ::rtl::OUString maSimpleText; + ::rtl::OUString maStyleName; + ::rtl::OUString maTextStyle; bool mbUseShapePos; bool mbShown; + std::vector maContentStyles; explicit ScXMLAnnotationData(); ~ScXMLAnnotationData(); @@ -82,7 +100,10 @@ public: void SetShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ); + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, + const ::rtl::OUString& rStyleName, const ::rtl::OUString& rTextStyle ); + + void AddContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ESelection& rSelection ); private: ScXMLAnnotationData& mrAnnotationData; diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx index 048f1ec0c549..a301ddbf27e6 100644 --- a/sc/source/filter/xml/xmlbodyi.cxx +++ b/sc/source/filter/xml/xmlbodyi.cxx @@ -36,6 +36,8 @@ #include #include "document.hxx" +#include "docuno.hxx" +#include "sheetdata.hxx" #include "xmlbodyi.hxx" #include "xmltabi.hxx" @@ -136,6 +138,14 @@ SvXMLImportContext *ScXMLBodyContext::CreateChildContext( USHORT nPrefix, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) { + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData(); + if ( pSheetData && pSheetData->HasStartPos() ) + { + // stream part to copy ends before the next child element + sal_Int32 nEndOffset = GetScImport().GetByteOffset(); + pSheetData->EndStreamPos( nEndOffset ); + } + SvXMLImportContext *pContext = 0; const SvXMLTokenMap& rTokenMap = GetScImport().GetBodyElemTokenMap(); @@ -218,8 +228,36 @@ SvXMLImportContext *ScXMLBodyContext::CreateChildContext( USHORT nPrefix, return pContext; } +void ScXMLBodyContext::Characters( const OUString& ) +{ + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData(); + if ( pSheetData && pSheetData->HasStartPos() ) + { + // stream part to copy ends before any content (whitespace) within the spreadsheet element + sal_Int32 nEndOffset = GetScImport().GetByteOffset(); + pSheetData->EndStreamPos( nEndOffset ); + } + // otherwise ignore +} + void ScXMLBodyContext::EndElement() { + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData(); + if ( pSheetData && pSheetData->HasStartPos() ) + { + // stream part to copy ends before the closing tag of spreadsheet element + sal_Int32 nEndOffset = GetScImport().GetByteOffset(); + pSheetData->EndStreamPos( nEndOffset ); + } + + if ( pSheetData ) + { + // store the loaded namespaces (for the office:spreadsheet element), + // so the prefixes in copied stream fragments remain valid + const SvXMLNamespaceMap& rNamespaces = GetImport().GetNamespaceMap(); + pSheetData->StoreLoadedNamespaces( rNamespaces ); + } + if (!bHadCalculationSettings) { // #111055#; set calculation settings defaults if there is no calculation settings element diff --git a/sc/source/filter/xml/xmlbodyi.hxx b/sc/source/filter/xml/xmlbodyi.hxx index d57af40eaf25..2c489418bfff 100644 --- a/sc/source/filter/xml/xmlbodyi.hxx +++ b/sc/source/filter/xml/xmlbodyi.hxx @@ -57,6 +57,7 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); virtual void EndElement(); + virtual void Characters( const ::rtl::OUString& rChars ); }; #endif diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index f0a4569cc86e..6a42d505cdc8 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -44,6 +44,7 @@ #include "docuno.hxx" #include "unonames.hxx" #include "postit.hxx" +#include "sheetdata.hxx" #include "XMLTableShapeImportHelper.hxx" #include "XMLTextPContext.hxx" @@ -550,6 +551,11 @@ void ScXMLTableRowCellContext::SetContentValidation(com::sun::star::uno::Referen } } xPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_VALIXML)), uno::makeAny(xPropertySet)); + + // For now, any sheet with validity is blocked from stream-copying. + // Later, the validation names could be stored along with the style names. + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetImport().GetModel())->GetSheetSaveData(); + pSheetData->BlockSheet( GetScImport().GetTables().GetCurrentSheet() ); } } } @@ -676,6 +682,18 @@ void ScXMLTableRowCellContext::SetAnnotation(const table::CellAddress& aCellAddr uno::Reference< drawing::XShape > xShape; rXMLImport.GetShapeImport()->shapeWithZIndexAdded( xShape, xShapesIA->getCount() ); } + + // store the style names for stream copying + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData(); + pSheetData->HandleNoteStyles( mxAnnotationData->maStyleName, mxAnnotationData->maTextStyle, aPos ); + + std::vector::const_iterator aIter = mxAnnotationData->maContentStyles.begin(); + std::vector::const_iterator aEnd = mxAnnotationData->maContentStyles.end(); + while (aIter != aEnd) + { + pSheetData->AddNoteContentStyle( aIter->mnFamily, aIter->maName, aPos, aIter->maSelection ); + ++aIter; + } } // core implementation diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx index 31662f4e68dd..73c06f23a7bf 100644 --- a/sc/source/filter/xml/xmlcoli.cxx +++ b/sc/source/filter/xml/xmlcoli.cxx @@ -42,6 +42,7 @@ #include "document.hxx" #include "docuno.hxx" #include "olinetab.hxx" +#include "sheetdata.hxx" #include "unonames.hxx" #include @@ -145,7 +146,7 @@ SvXMLImportContext *ScXMLTableColContext::CreateChildContext( USHORT nPrefix, void ScXMLTableColContext::EndElement() { ScXMLImport& rXMLImport = GetScImport(); - //sal_Int32 nSheet = rXMLImport.GetTables().GetCurrentSheet(); + sal_Int32 nSheet = rXMLImport.GetTables().GetCurrentSheet(); sal_Int32 nCurrentColumn = rXMLImport.GetTables().GetCurrentColumn(); uno::Reference xSheet(rXMLImport.GetTables().GetCurrentXSheet()); if(xSheet.is()) @@ -169,7 +170,16 @@ void ScXMLTableColContext::EndElement() XMLTableStyleContext* pStyle = (XMLTableStyleContext *)pStyles->FindStyleChildContext( XML_STYLE_FAMILY_TABLE_COLUMN, sStyleName, sal_True); if (pStyle) + { pStyle->FillPropertySet(xColumnProperties); + + if ( nSheet != pStyle->GetLastSheet() ) + { + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData(); + pSheetData->AddColumnStyle( sStyleName, ScAddress( (SCCOL)nCurrentColumn, 0, (SCTAB)nSheet ) ); + pStyle->SetLastSheet(nSheet); + } + } } } rtl::OUString sVisible(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLVIS)); diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 98965cba07bc..a35a426e4831 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -53,10 +53,12 @@ #include "XMLColumnRowGroupExport.hxx" #include "XMLStylesExportHelper.hxx" #include "XMLChangeTrackingExportHelper.hxx" +#include "sheetdata.hxx" #include "docoptio.hxx" #include "XMLExportSharedData.hxx" #include "chgviset.hxx" #include "docuno.hxx" +#include "textuno.hxx" #include "chartlis.hxx" #include "unoguard.hxx" #include "scitems.hxx" @@ -80,6 +82,7 @@ #include #include #include +#include #include @@ -122,6 +125,8 @@ #include #include #include +#include +#include #include #include @@ -452,6 +457,7 @@ ScXMLExport::ScXMLExport( const sal_uInt16 nExportFlag) : SvXMLExport( xServiceFactory, SvXMLUnitConverter::GetMapUnit(GetFieldUnit()), XML_SPREADSHEET, nExportFlag ), pDoc(NULL), + nSourceStreamPos(0), pNumberFormatAttributesExportHelper(NULL), pSharedData(NULL), pColumnStyles(NULL), @@ -567,6 +573,45 @@ ScXMLExport::~ScXMLExport() delete pNumberFormatAttributesExportHelper; } +void ScXMLExport::SetSourceStream( const uno::Reference& xNewStream ) +{ + xSourceStream = xNewStream; + + if ( xSourceStream.is() ) + { + // make sure it's a plain UTF-8 stream as written by OOo itself + + const sal_Char pXmlHeader[] = ""; + sal_Int32 nLen = strlen(pXmlHeader); + + uno::Sequence aFileStart(nLen); + sal_Int32 nRead = xSourceStream->readBytes( aFileStart, nLen ); + + if ( nRead != nLen || rtl_compareMemory( aFileStart.getConstArray(), pXmlHeader, nLen ) != 0 ) + { + // invalid - ignore stream, save normally + xSourceStream.clear(); + } + else + { + // keep track of the bytes already read + nSourceStreamPos = nRead; + + const ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData(); + if (pSheetData) + { + // add the loaded namespaces to the name space map + + if ( !pSheetData->AddLoadedNamespaces( _GetNamespaceMap() ) ) + { + // conflicts in the namespaces - ignore the stream, save normally + xSourceStream.clear(); + } + } + } + } +} + sal_Int32 ScXMLExport::GetNumberFormatStyleIndex(sal_Int32 nNumFmt) const { NumberFormatIndexMap::const_iterator itr = aNumFmtIndexMap.find(nNumFmt); @@ -803,7 +848,7 @@ void ScXMLExport::_ExportFontDecls() SvXMLExport::_ExportFontDecls(); } -table::CellRangeAddress ScXMLExport::GetEndAddress(uno::Reference& xTable, const sal_Int32 /* nTable */) +table::CellRangeAddress ScXMLExport::GetEndAddress(const uno::Reference& xTable, const sal_Int32 /* nTable */) { table::CellRangeAddress aCellAddress; uno::Reference xCursor(xTable->createCursor()); @@ -1481,6 +1526,95 @@ void ScXMLExport::SetBodyAttributes() } } +static bool lcl_CopyStreamElement( const uno::Reference< io::XInputStream >& xInput, + const uno::Reference< io::XOutputStream >& xOutput, + sal_Int32 nCount ) +{ + const sal_Int32 nBufSize = 16*1024; + uno::Sequence aSequence(nBufSize); + + sal_Int32 nRemaining = nCount; + bool bFirst = true; + + while ( nRemaining > 0 ) + { + sal_Int32 nRead = xInput->readBytes( aSequence, std::min( nRemaining, nBufSize ) ); + if (bFirst) + { + // safety check: Make sure the copied part actually points to the start of an element + if ( nRead < 1 || aSequence[0] != static_cast('<') ) + { + return false; // abort and set an error + } + bFirst = false; + } + if (nRead == nRemaining) + { + // safety check: Make sure the copied part also ends at the end of an element + if ( aSequence[nRead-1] != static_cast('>') ) + { + return false; // abort and set an error + } + } + + if ( nRead == nBufSize ) + { + xOutput->writeBytes( aSequence ); + nRemaining -= nRead; + } + else + { + if ( nRead > 0 ) + { + uno::Sequence aTempBuf( aSequence.getConstArray(), nRead ); + xOutput->writeBytes( aTempBuf ); + } + nRemaining = 0; + } + } + return true; // successful +} + +void ScXMLExport::CopySourceStream( sal_Int32 nStartOffset, sal_Int32 nEndOffset, sal_Int32& rNewStart, sal_Int32& rNewEnd ) +{ + uno::Reference xHandler = GetDocHandler(); + uno::Reference xDestSource( xHandler, uno::UNO_QUERY ); + if ( xDestSource.is() ) + { + uno::Reference xDestStream = xDestSource->getOutputStream(); + uno::Reference xDestSeek( xDestStream, uno::UNO_QUERY ); + if ( xDestSeek.is() ) + { + // temporary: set same stream again to clear buffer + xDestSource->setOutputStream( xDestStream ); + + if ( getExportFlags() & EXPORT_PRETTY ) + { + ByteString aOutStr("\n "); + uno::Sequence aOutSeq( (sal_Int8*)aOutStr.GetBuffer(), aOutStr.Len() ); + xDestStream->writeBytes( aOutSeq ); + } + + rNewStart = (sal_Int32)xDestSeek->getPosition(); + + if ( nStartOffset > nSourceStreamPos ) + xSourceStream->skipBytes( nStartOffset - nSourceStreamPos ); + + if ( !lcl_CopyStreamElement( xSourceStream, xDestStream, nEndOffset - nStartOffset ) ) + { + // If copying went wrong, set an error. + // ScXMLImportWrapper then resets all stream flags, so the next save attempt will use normal saving. + + uno::Sequence aEmptySeq; + SetError(XMLERROR_CANCEL|XMLERROR_FLAG_SEVERE, aEmptySeq); + } + nSourceStreamPos = nEndOffset; + + rNewEnd = (sal_Int32)xDestSeek->getPosition(); + } + } +} + void ScXMLExport::_ExportContent() { nCurrentTable = 0; @@ -1500,6 +1634,10 @@ void ScXMLExport::_ExportContent() if ( !xSpreadDoc.is() ) return; + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xSpreadDoc)->GetSheetSaveData(); + if (pSheetData) + pSheetData->ResetSaveEntries(); + uno::Reference xIndex( xSpreadDoc->getSheets(), uno::UNO_QUERY ); if ( xIndex.is() ) { @@ -1531,6 +1669,27 @@ void ScXMLExport::_ExportContent() WriteTheLabelRanges( xSpreadDoc ); for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable) { + sal_Int32 nStartOffset = -1; + sal_Int32 nEndOffset = -1; + if (pSheetData && pDoc && pDoc->IsStreamValid((SCTAB)nTable)) + pSheetData->GetStreamPos( nTable, nStartOffset, nEndOffset ); + + if ( nStartOffset >= 0 && nEndOffset >= 0 && xSourceStream.is() ) + { + sal_Int32 nNewStart = -1; + sal_Int32 nNewEnd = -1; + CopySourceStream( nStartOffset, nEndOffset, nNewStart, nNewEnd ); + + // store position of copied sheet in output + pSheetData->AddSavePos( nTable, nNewStart, nNewEnd ); + + // skip iterator entries for this sheet + pCellsItr->SkipTable(static_cast(nTable)); + } + else + { + //! indent after rebasing to m52 + uno::Reference xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY); if (xTable.is()) { @@ -1653,6 +1812,8 @@ void ScXMLExport::_ExportContent() nEqualCells = 0; } } + + } IncrementProgressBar(sal_False); } } @@ -1729,6 +1890,245 @@ void ScXMLExport::_ExportStyles( sal_Bool bUsed ) SvXMLExport::_ExportStyles(bUsed); } +void ScXMLExport::AddStyleFromCells(const uno::Reference& xProperties, + const uno::Reference& xTable, + sal_Int32 nTable, const rtl::OUString* pOldName) +{ + //! pass xCellRanges instead + uno::Reference xCellRanges( xProperties, uno::UNO_QUERY ); + + rtl::OUString SC_SCELLPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX)); + rtl::OUString SC_NUMBERFORMAT(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_NUMFMT)); + + rtl::OUString sStyleName; + sal_Int32 nNumberFormat(-1); + sal_Int32 nValidationIndex(-1); + std::vector< XMLPropertyState > xPropStates(xCellStylesExportPropertySetMapper->Filter( xProperties )); + std::vector< XMLPropertyState >::iterator aItr(xPropStates.begin()); + std::vector< XMLPropertyState >::iterator aEndItr(xPropStates.end()); + sal_Int32 nCount(0); + while (aItr != aEndItr) + { + if (aItr->mnIndex != -1) + { + switch (xCellStylesPropertySetMapper->GetEntryContextId(aItr->mnIndex)) + { + case CTF_SC_VALIDATION : + { + pValidationsContainer->AddValidation(aItr->maValue, nValidationIndex); + // this is not very slow, because it is most the last property or + // if it is not the last property it is the property before the last property, + // so in the worst case only one property has to be copied, but in the best case no + // property has to be copied + aItr = xPropStates.erase(aItr); + aEndItr = xPropStates.end(); // #120346# old aEndItr is invalidated! + } + break; + case CTF_SC_CELLSTYLE : + { + aItr->maValue >>= sStyleName; + aItr->mnIndex = -1; + ++aItr; + ++nCount; + } + break; + case CTF_SC_NUMBERFORMAT : + { + if (aItr->maValue >>= nNumberFormat) + addDataStyle(nNumberFormat); + ++aItr; + ++nCount; + } + break; + default: + { + ++aItr; + ++nCount; + } + break; + } + } + else + { + ++aItr; + ++nCount; + } + } + if (nCount == 1) // this is the CellStyle and should be removed if alone + xPropStates.clear(); + if (nNumberFormat == -1) + xProperties->getPropertyValue(SC_NUMBERFORMAT) >>= nNumberFormat; + if (sStyleName.getLength()) + { + if (xPropStates.size()) + { + sal_Int32 nIndex; + if (pOldName) + { + if (GetAutoStylePool()->AddNamed(*pOldName, XML_STYLE_FAMILY_TABLE_CELL, sStyleName, xPropStates)) + { + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_CELL, *pOldName); + // add to pCellStyles, so the name is found for normal sheets + rtl::OUString* pTemp(new rtl::OUString(*pOldName)); + if (!pCellStyles->AddStyleName(pTemp, nIndex)) + delete pTemp; + } + } + else + { + rtl::OUString sName; + sal_Bool bIsAutoStyle(sal_True); + if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_CELL, sStyleName, xPropStates)) + { + rtl::OUString* pTemp(new rtl::OUString(sName)); + if (!pCellStyles->AddStyleName(pTemp, nIndex)) + delete pTemp; + } + else + nIndex = pCellStyles->GetIndexOfStyleName(sName, SC_SCELLPREFIX, bIsAutoStyle); + + uno::Sequence aAddresses(xCellRanges->getRangeAddresses()); + table::CellRangeAddress* pAddresses(aAddresses.getArray()); + sal_Bool bGetMerge(sal_True); + for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses) + { + pSharedData->SetLastColumn(nTable, pAddresses->EndColumn); + pSharedData->SetLastRow(nTable, pAddresses->EndRow); + pCellStyles->AddRangeStyleName(*pAddresses, nIndex, bIsAutoStyle, nValidationIndex, nNumberFormat); + if (bGetMerge) + bGetMerge = GetMerged(pAddresses, xTable); + } + } + } + else + { + rtl::OUString* pTemp(new rtl::OUString(EncodeStyleName(sStyleName))); + sal_Int32 nIndex(0); + if (!pCellStyles->AddStyleName(pTemp, nIndex, sal_False)) + { + delete pTemp; + pTemp = NULL; + } + if ( !pOldName ) + { + uno::Sequence aAddresses(xCellRanges->getRangeAddresses()); + table::CellRangeAddress* pAddresses(aAddresses.getArray()); + sal_Bool bGetMerge(sal_True); + for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses) + { + if (bGetMerge) + bGetMerge = GetMerged(pAddresses, xTable); + pCellStyles->AddRangeStyleName(*pAddresses, nIndex, sal_False, nValidationIndex, nNumberFormat); + if (!sStyleName.equalsAsciiL("Default", 7) || nValidationIndex != -1) + { + pSharedData->SetLastColumn(nTable, pAddresses->EndColumn); + pSharedData->SetLastRow(nTable, pAddresses->EndRow); + } + } + } + } + } +} + +void ScXMLExport::AddStyleFromColumn(const uno::Reference& xColumnProperties, + const rtl::OUString* pOldName, sal_Int32& rIndex, sal_Bool& rIsVisible) +{ + rtl::OUString SC_SCOLUMNPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX)); + + std::vector xPropStates(xColumnStylesExportPropertySetMapper->Filter(xColumnProperties)); + if(xPropStates.size()) + { + std::vector< XMLPropertyState >::iterator aItr(xPropStates.begin()); + std::vector< XMLPropertyState >::iterator aEndItr(xPropStates.end()); + while (aItr != aEndItr) + { + if (xColumnStylesPropertySetMapper->GetEntryContextId(aItr->mnIndex) == CTF_SC_ISVISIBLE) + { + aItr->maValue >>= rIsVisible; + break; + } + ++aItr; + } + + rtl::OUString sParent; + if (pOldName) + { + if (GetAutoStylePool()->AddNamed(*pOldName, XML_STYLE_FAMILY_TABLE_COLUMN, sParent, xPropStates)) + { + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_COLUMN, *pOldName); + // add to pColumnStyles, so the name is found for normal sheets + rtl::OUString* pTemp(new rtl::OUString(*pOldName)); + rIndex = pColumnStyles->AddStyleName(pTemp); + } + } + else + { + rtl::OUString sName; + if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_COLUMN, sParent, xPropStates)) + { + rtl::OUString* pTemp(new rtl::OUString(sName)); + rIndex = pColumnStyles->AddStyleName(pTemp); + } + else + rIndex = pColumnStyles->GetIndexOfStyleName(sName, SC_SCOLUMNPREFIX); + } + } +} + +void ScXMLExport::AddStyleFromRow(const uno::Reference& xRowProperties, + const rtl::OUString* pOldName, sal_Int32& rIndex) +{ + rtl::OUString SC_SROWPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX)); + + std::vector xPropStates(xRowStylesExportPropertySetMapper->Filter(xRowProperties)); + if(xPropStates.size()) + { + rtl::OUString sParent; + if (pOldName) + { + if (GetAutoStylePool()->AddNamed(*pOldName, XML_STYLE_FAMILY_TABLE_ROW, sParent, xPropStates)) + { + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_ROW, *pOldName); + // add to pRowStyles, so the name is found for normal sheets + rtl::OUString* pTemp(new rtl::OUString(*pOldName)); + rIndex = pRowStyles->AddStyleName(pTemp); + } + } + else + { + rtl::OUString sName; + if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_ROW, sParent, xPropStates)) + { + rtl::OUString* pTemp(new rtl::OUString(sName)); + rIndex = pRowStyles->AddStyleName(pTemp); + } + else + rIndex = pRowStyles->GetIndexOfStyleName(sName, SC_SROWPREFIX); + } + } +} + +uno::Any lcl_GetEnumerated( uno::Reference xEnumAccess, sal_Int32 nIndex ) +{ + uno::Any aRet; + uno::Reference xEnum( xEnumAccess->createEnumeration() ); + try + { + sal_Int32 nSkip = nIndex; + while ( nSkip > 0 ) + { + (void) xEnum->nextElement(); + --nSkip; + } + aRet = xEnum->nextElement(); + } + catch (container::NoSuchElementException&) + { + // leave aRet empty + } + return aRet; +} + void ScXMLExport::_ExportAutoStyles() { if (GetModel().is()) @@ -1741,6 +2141,272 @@ void ScXMLExport::_ExportAutoStyles() { if (getExportFlags() & EXPORT_CONTENT) { + // re-create automatic styles with old names from stored data + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xSpreadDoc)->GetSheetSaveData(); + if (pSheetData && pDoc) + { + // formulas have to be calculated now, to detect changed results + // (during normal save, they will be calculated anyway) + SCTAB nTabCount = pDoc->GetTableCount(); + for (SCTAB nTab=0; nTabIsStreamValid(nTab)) + { + ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab ); + ScBaseCell* pCell = aIter.GetFirst(); + while (pCell) + { + if (pCell->GetCellType() == CELLTYPE_FORMULA) + static_cast(pCell)->IsValue(); // interpret if dirty + pCell = aIter.GetNext(); + } + } + + // stored cell styles + const std::vector& rCellEntries = pSheetData->GetCellStyles(); + std::vector::const_iterator aCellIter = rCellEntries.begin(); + std::vector::const_iterator aCellEnd = rCellEntries.end(); + while (aCellIter != aCellEnd) + { + ScAddress aPos = aCellIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast(nTable) ); + if (bCopySheet) + { + uno::Reference xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY); + uno::Reference xProperties( + xTable->getCellByPosition( aPos.Col(), aPos.Row() ), uno::UNO_QUERY ); + + AddStyleFromCells(xProperties, xTable, nTable, &aCellIter->maName); + } + ++aCellIter; + } + + // stored column styles + const std::vector& rColumnEntries = pSheetData->GetColumnStyles(); + std::vector::const_iterator aColumnIter = rColumnEntries.begin(); + std::vector::const_iterator aColumnEnd = rColumnEntries.end(); + while (aColumnIter != aColumnEnd) + { + ScAddress aPos = aColumnIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast(nTable) ); + if (bCopySheet) + { + uno::Reference xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY); + uno::Reference xTableColumns(xColumnRowRange->getColumns()); + uno::Reference xColumnProperties(xTableColumns->getByIndex( aPos.Col() ), uno::UNO_QUERY); + + sal_Int32 nIndex(-1); + sal_Bool bIsVisible(sal_True); + AddStyleFromColumn( xColumnProperties, &aColumnIter->maName, nIndex, bIsVisible ); + } + ++aColumnIter; + } + + // stored row styles + const std::vector& rRowEntries = pSheetData->GetRowStyles(); + std::vector::const_iterator aRowIter = rRowEntries.begin(); + std::vector::const_iterator aRowEnd = rRowEntries.end(); + while (aRowIter != aRowEnd) + { + ScAddress aPos = aRowIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast(nTable) ); + if (bCopySheet) + { + uno::Reference xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY); + uno::Reference xTableRows(xColumnRowRange->getRows()); + uno::Reference xRowProperties(xTableRows->getByIndex( aPos.Row() ), uno::UNO_QUERY); + + sal_Int32 nIndex(-1); + AddStyleFromRow( xRowProperties, &aRowIter->maName, nIndex ); + } + ++aRowIter; + } + + // stored table styles + const std::vector& rTableEntries = pSheetData->GetTableStyles(); + std::vector::const_iterator aTableIter = rTableEntries.begin(); + std::vector::const_iterator aTableEnd = rTableEntries.end(); + while (aTableIter != aTableEnd) + { + ScAddress aPos = aTableIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast(nTable) ); + if (bCopySheet) + { + //! separate method AddStyleFromTable needed? + uno::Reference xTableProperties(xIndex->getByIndex(nTable), uno::UNO_QUERY); + if (xTableProperties.is()) + { + std::vector xPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties)); + rtl::OUString sParent; + rtl::OUString sName( aTableIter->maName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TABLE_TABLE, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_TABLE, sName); + } + } + ++aTableIter; + } + + // stored styles for notes + + UniReference xShapeMapper = XMLShapeExport::CreateShapePropMapper( *this ); + GetShapeExport(); // make sure the graphics styles family is added + + const std::vector& rNoteEntries = pSheetData->GetNoteStyles(); + std::vector::const_iterator aNoteIter = rNoteEntries.begin(); + std::vector::const_iterator aNoteEnd = rNoteEntries.end(); + while (aNoteIter != aNoteEnd) + { + ScAddress aPos = aNoteIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast(nTable) ); + if (bCopySheet) + { + //! separate method AddStyleFromNote needed? + + ScPostIt* pNote = pDoc->GetNote( aPos ); + DBG_ASSERT( pNote, "note not found" ); + if (pNote) + { + SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); + // all uno shapes are created anyway in CollectSharedData + uno::Reference xShapeProperties( pDrawObj->getUnoShape(), uno::UNO_QUERY ); + if (xShapeProperties.is()) + { + if ( aNoteIter->maStyleName.getLength() ) + { + std::vector xPropStates(xShapeMapper->Filter(xShapeProperties)); + rtl::OUString sParent; + rtl::OUString sName( aNoteIter->maStyleName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_SD_GRAPHICS_ID, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_SD_GRAPHICS_ID, sName); + } + if ( aNoteIter->maTextStyle.getLength() ) + { + std::vector xPropStates( + GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter(xShapeProperties)); + rtl::OUString sParent; + rtl::OUString sName( aNoteIter->maTextStyle ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName); + } + } + } + } + ++aNoteIter; + } + + // note paragraph styles + + //UniReference xParaPropMapper = XMLTextParagraphExport::CreateParaExtPropMapper( *this ); + UniReference xParaPropMapper = GetTextParagraphExport()->GetParagraphPropertyMapper(); + + const std::vector& rNoteParaEntries = pSheetData->GetNoteParaStyles(); + std::vector::const_iterator aNoteParaIter = rNoteParaEntries.begin(); + std::vector::const_iterator aNoteParaEnd = rNoteParaEntries.end(); + while (aNoteParaIter != aNoteParaEnd) + { + ScAddress aPos = aNoteParaIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast(nTable) ); + if (bCopySheet) + { + ScPostIt* pNote = pDoc->GetNote( aPos ); + DBG_ASSERT( pNote, "note not found" ); + if (pNote) + { + SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); + uno::Reference xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY); + uno::Reference xParaProp( + lcl_GetEnumerated( xCellText, aNoteParaIter->maSelection.nStartPara ), uno::UNO_QUERY ); + if ( xParaProp.is() ) + { + std::vector xPropStates(xParaPropMapper->Filter(xParaProp)); + rtl::OUString sParent; + rtl::OUString sName( aNoteParaIter->maName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName); + } + } + } + ++aNoteParaIter; + } + + // note text styles + + UniReference xTextPropMapper = XMLTextParagraphExport::CreateCharExtPropMapper( *this ); + + const std::vector& rNoteTextEntries = pSheetData->GetNoteTextStyles(); + std::vector::const_iterator aNoteTextIter = rNoteTextEntries.begin(); + std::vector::const_iterator aNoteTextEnd = rNoteTextEntries.end(); + while (aNoteTextIter != aNoteTextEnd) + { + ScAddress aPos = aNoteTextIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast(nTable) ); + if (bCopySheet) + { + ScPostIt* pNote = pDoc->GetNote( aPos ); + DBG_ASSERT( pNote, "note not found" ); + if (pNote) + { + SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); + uno::Reference xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY); + uno::Reference xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY); + ScDrawTextCursor* pCursor = ScDrawTextCursor::getImplementation( xCursorProp ); + if (pCursor) + { + pCursor->SetSelection( aNoteTextIter->maSelection ); + + std::vector xPropStates(xTextPropMapper->Filter(xCursorProp)); + rtl::OUString sParent; + rtl::OUString sName( aNoteTextIter->maName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_TEXT, sName); + } + } + } + ++aNoteTextIter; + } + + // stored text styles + + //UniReference xTextPropMapper = XMLTextParagraphExport::CreateCharExtPropMapper( *this ); + + const std::vector& rTextEntries = pSheetData->GetTextStyles(); + std::vector::const_iterator aTextIter = rTextEntries.begin(); + std::vector::const_iterator aTextEnd = rTextEntries.end(); + while (aTextIter != aTextEnd) + { + ScAddress aPos = aTextIter->maCellPos; + sal_Int32 nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( static_cast(nTable) ); + if (bCopySheet) + { + //! separate method AddStyleFromText needed? + //! cache sheet object + + uno::Reference xCellRange(xIndex->getByIndex(nTable), uno::UNO_QUERY); + uno::Reference xCellText(xCellRange->getCellByPosition(aPos.Col(), aPos.Row()), uno::UNO_QUERY); + uno::Reference xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY); + ScCellTextCursor* pCursor = ScCellTextCursor::getImplementation( xCursorProp ); + if (pCursor) + { + pCursor->SetSelection( aTextIter->maSelection ); + + std::vector xPropStates(xTextPropMapper->Filter(xCursorProp)); + rtl::OUString sParent; + rtl::OUString sName( aTextIter->maName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_TEXT, sName); + } + } + ++aTextIter; + } + } + ExportExternalRefCacheStyles(); if (!pSharedData) @@ -1751,18 +2417,18 @@ void ScXMLExport::_ExportAutoStyles() CollectSharedData(nTableCount, nShapesCount, nCellCount); //DBG_ERROR("no shared data setted"); } - rtl::OUString SC_SCOLUMNPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX)); - rtl::OUString SC_SROWPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX)); - rtl::OUString SC_SCELLPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX)); - rtl::OUString SC_NUMBERFORMAT(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_NUMFMT)); sal_Int32 nTableCount(xIndex->getCount()); pCellStyles->AddNewTable(nTableCount - 1); CollectShapesAutoStyles(nTableCount); for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable) { + bool bUseStream = pSheetData && pDoc && pDoc->IsStreamValid((SCTAB)nTable) && + pSheetData->HasStreamPos(nTable) && xSourceStream.is(); + uno::Reference xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY); if (xTable.is()) { + // table styles array must be complete, including copied tables - Add should find the stored style uno::Reference xTableProperties(xTable, uno::UNO_QUERY); if (xTableProperties.is()) { @@ -1775,7 +2441,11 @@ void ScXMLExport::_ExportAutoStyles() aTableStyles.push_back(sName); } } - uno::Reference xCellFormatRanges ( xTableProperties, uno::UNO_QUERY ); + } + // collect other auto-styles only for non-copied sheets + if (xTable.is() && !bUseStream) + { + uno::Reference xCellFormatRanges ( xTable, uno::UNO_QUERY ); if ( xCellFormatRanges.is() ) { uno::Reference xFormatRangesIndex(xCellFormatRanges->getUniqueCellFormatRanges()); @@ -1791,123 +2461,14 @@ void ScXMLExport::_ExportAutoStyles() uno::Reference xProperties (xCellRanges, uno::UNO_QUERY); if (xProperties.is()) { - rtl::OUString sStyleName; - sal_Int32 nNumberFormat(-1); - sal_Int32 nValidationIndex(-1); - std::vector< XMLPropertyState > xPropStates(xCellStylesExportPropertySetMapper->Filter( xProperties )); - std::vector< XMLPropertyState >::iterator aItr(xPropStates.begin()); - std::vector< XMLPropertyState >::iterator aEndItr(xPropStates.end()); - sal_Int32 nCount(0); - while (aItr != aEndItr) - { - if (aItr->mnIndex != -1) - { - switch (xCellStylesPropertySetMapper->GetEntryContextId(aItr->mnIndex)) - { - case CTF_SC_VALIDATION : - { - pValidationsContainer->AddValidation(aItr->maValue, nValidationIndex); - // this is not very slow, because it is most the last property or - // if it is not the last property it is the property before the last property, - // so in the worst case only one property has to be copied, but in the best case no - // property has to be copied - aItr = xPropStates.erase(aItr); - aEndItr = xPropStates.end(); // #120346# old aEndItr is invalidated! - } - break; - case CTF_SC_CELLSTYLE : - { - aItr->maValue >>= sStyleName; - aItr->mnIndex = -1; - ++aItr; - ++nCount; - } - break; - case CTF_SC_NUMBERFORMAT : - { - if (aItr->maValue >>= nNumberFormat) - addDataStyle(nNumberFormat); - ++aItr; - ++nCount; - } - break; - default: - { - ++aItr; - ++nCount; - } - break; - } - } - else - { - ++aItr; - ++nCount; - } - } - if (nCount == 1) // this is the CellStyle and should be removed if alone - xPropStates.clear(); - if (nNumberFormat == -1) - xProperties->getPropertyValue(SC_NUMBERFORMAT) >>= nNumberFormat; - if (sStyleName.getLength()) - { - if (xPropStates.size()) - { - sal_Int32 nIndex; - rtl::OUString sName; - sal_Bool bIsAutoStyle(sal_True); - if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_CELL, sStyleName, xPropStates)) - { - rtl::OUString* pTemp(new rtl::OUString(sName)); - if (!pCellStyles->AddStyleName(pTemp, nIndex)) - delete pTemp; - } - else - nIndex = pCellStyles->GetIndexOfStyleName(sName, SC_SCELLPREFIX, bIsAutoStyle); - uno::Sequence aAddresses(xCellRanges->getRangeAddresses()); - table::CellRangeAddress* pAddresses(aAddresses.getArray()); - sal_Bool bGetMerge(sal_True); - for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses) - { - pSharedData->SetLastColumn(nTable, pAddresses->EndColumn); - pSharedData->SetLastRow(nTable, pAddresses->EndRow); - pCellStyles->AddRangeStyleName(*pAddresses, nIndex, bIsAutoStyle, nValidationIndex, nNumberFormat); - if (bGetMerge) - bGetMerge = GetMerged(pAddresses, xTable); - } - } - else - { - rtl::OUString* pTemp(new rtl::OUString(EncodeStyleName(sStyleName))); - sal_Int32 nIndex(0); - if (!pCellStyles->AddStyleName(pTemp, nIndex, sal_False)) - { - delete pTemp; - pTemp = NULL; - } - uno::Sequence aAddresses(xCellRanges->getRangeAddresses()); - table::CellRangeAddress* pAddresses(aAddresses.getArray()); - sal_Bool bGetMerge(sal_True); - for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses) - { - if (bGetMerge) - bGetMerge = GetMerged(pAddresses, xTable); - pCellStyles->AddRangeStyleName(*pAddresses, nIndex, sal_False, nValidationIndex, nNumberFormat); - if (!sStyleName.equalsAsciiL("Default", 7) || nValidationIndex != -1) - { - pSharedData->SetLastColumn(nTable, pAddresses->EndColumn); - pSharedData->SetLastRow(nTable, pAddresses->EndRow); - } - } - } - } + AddStyleFromCells(xProperties, xTable, nTable, NULL); IncrementProgressBar(sal_False); } } } } } - uno::Reference xColumnRowRange (xTableProperties, uno::UNO_QUERY); + uno::Reference xColumnRowRange (xTable, uno::UNO_QUERY); if (xColumnRowRange.is()) { if (pDoc) @@ -1935,31 +2496,9 @@ void ScXMLExport::_ExportAutoStyles() uno::Reference xColumnProperties(xTableColumns->getByIndex(nColumn), uno::UNO_QUERY); if (xColumnProperties.is()) { - std::vector xPropStates(xColumnStylesExportPropertySetMapper->Filter(xColumnProperties)); - if(xPropStates.size()) - { - std::vector< XMLPropertyState >::iterator aItr(xPropStates.begin()); - std::vector< XMLPropertyState >::iterator aEndItr(xPropStates.end()); - while (aItr != aEndItr) - { - if (xColumnStylesPropertySetMapper->GetEntryContextId(aItr->mnIndex) == CTF_SC_ISVISIBLE) - { - aItr->maValue >>= bIsVisible; - break; - } - ++aItr; - } - rtl::OUString sParent; - rtl::OUString sName; - if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_COLUMN, sParent, xPropStates)) - { - rtl::OUString* pTemp(new rtl::OUString(sName)); - nIndex = pColumnStyles->AddStyleName(pTemp); - } - else - nIndex = pColumnStyles->GetIndexOfStyleName(sName, SC_SCOLUMNPREFIX); - pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex, bIsVisible); - } + AddStyleFromColumn( xColumnProperties, NULL, nIndex, bIsVisible ); + //if(xPropStates.size()) + pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex, bIsVisible); } sal_Int32 nOld(nColumn); nColumn = pDoc->GetNextDifferentChangedCol(sal::static_int_cast(nTable), static_cast(nColumn)); @@ -1996,20 +2535,9 @@ void ScXMLExport::_ExportAutoStyles() uno::Reference xRowProperties(xTableRows->getByIndex(nRow), uno::UNO_QUERY); if(xRowProperties.is()) { - std::vector xPropStates(xRowStylesExportPropertySetMapper->Filter(xRowProperties)); - if(xPropStates.size()) - { - rtl::OUString sParent; - rtl::OUString sName; - if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_ROW, sParent, xPropStates)) - { - rtl::OUString* pTemp(new rtl::OUString(sName)); - nIndex = pRowStyles->AddStyleName(pTemp); - } - else - nIndex = pRowStyles->GetIndexOfStyleName(sName, SC_SROWPREFIX); - pRowStyles->AddFieldStyleName(nTable, nRow, nIndex); - } + AddStyleFromRow( xRowProperties, NULL, nIndex ); + //if(xPropStates.size()) + pRowStyles->AddFieldStyleName(nTable, nRow, nIndex); } sal_Int32 nOld(nRow); nRow = pDoc->GetNextDifferentChangedRow(sal::static_int_cast(nTable), static_cast(nRow), false); @@ -2025,7 +2553,7 @@ void ScXMLExport::_ExportAutoStyles() } } } - uno::Reference xCellRangesQuery (xTableProperties, uno::UNO_QUERY); + uno::Reference xCellRangesQuery (xTable, uno::UNO_QUERY); if (xCellRangesQuery.is()) { uno::Reference xSheetCellRanges(xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMATTED)); diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx index d38bd7b23970..b71886c1871e 100644 --- a/sc/source/filter/xml/xmlexprt.hxx +++ b/sc/source/filter/xml/xmlexprt.hxx @@ -38,6 +38,10 @@ #include #include +namespace com { namespace sun { namespace star { + namespace beans { class XPropertySet; } +} } } + #include class ScOutlineArray; @@ -72,6 +76,9 @@ class ScXMLExport : public SvXMLExport com::sun::star::uno::Reference xCurrentTable; com::sun::star::uno::Reference xCurrentTableCellRange; + com::sun::star::uno::Reference xSourceStream; + sal_Int32 nSourceStreamPos; + UniReference < XMLPropertyHandlerFactory > xScPropHdlFactory; UniReference < XMLPropertySetMapper > xCellStylesPropertySetMapper; UniReference < XMLPropertySetMapper > xColumnStylesPropertySetMapper; @@ -139,7 +146,7 @@ class ScXMLExport : public SvXMLExport void CollectInternalShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ); - com::sun::star::table::CellRangeAddress GetEndAddress(com::sun::star::uno::Reference& xTable, + com::sun::star::table::CellRangeAddress GetEndAddress(const com::sun::star::uno::Reference& xTable, const sal_Int32 nTable); // ScMyEmptyDatabaseRangesContainer GetEmptyDatabaseRanges(); void GetAreaLinks( com::sun::star::uno::Reference< com::sun::star::sheet::XSpreadsheetDocument>& xSpreadDoc, ScMyAreaLinksContainer& rAreaLinks ); @@ -207,7 +214,21 @@ class ScXMLExport : public SvXMLExport void CollectUserDefinedNamespaces(const SfxItemPool* pPool, sal_uInt16 nAttrib); + void AddStyleFromCells( + const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xProperties, + const com::sun::star::uno::Reference< com::sun::star::sheet::XSpreadsheet >& xTable, + sal_Int32 nTable, const rtl::OUString* pOldName ); + void AddStyleFromColumn( + const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xColumnProperties, + const rtl::OUString* pOldName, sal_Int32& rIndex, sal_Bool& rIsVisible ); + void AddStyleFromRow( + const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xRowProperties, + const rtl::OUString* pOldName, sal_Int32& rIndex ); + void IncrementProgressBar(sal_Bool bEditCell, sal_Int32 nInc = 1); + + void CopySourceStream( sal_Int32 nStartOffset, sal_Int32 nEndOffset, sal_Int32& rNewStart, sal_Int32& rNewEnd ); + protected: virtual SvXMLAutoStylePoolP* CreateAutoStylePool(); virtual XMLPageExport* CreatePageExport(); @@ -234,6 +255,8 @@ public: UniReference < XMLPropertySetMapper > GetCellStylesPropertySetMapper() { return xCellStylesPropertySetMapper; } UniReference < XMLPropertySetMapper > GetTableStylesPropertySetMapper() { return xTableStylesPropertySetMapper; } + void SetSourceStream( const com::sun::star::uno::Reference& xNewStream ); + void GetChangeTrackViewSettings(com::sun::star::uno::Sequence& rProps); virtual void GetViewSettings(com::sun::star::uno::Sequence& rProps); virtual void GetConfigurationSettings(com::sun::star::uno::Sequence& rProps); diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 200e33743020..8e3f4b421a6c 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -71,6 +71,7 @@ #include "XMLChangeTrackingImportHelper.hxx" #include "chgviset.hxx" #include "XMLStylesImportHelper.hxx" +#include "sheetdata.hxx" #include "unonames.hxx" #include "rangeutl.hxx" #include "postit.hxx" @@ -93,6 +94,7 @@ #include #include #include +#include #define SC_LOCALE "Locale" #define SC_STANDARDFORMAT "StandardFormat" @@ -2416,6 +2418,20 @@ void ScXMLImport::SetStyleToRanges() pStyle->FillPropertySet(xProperties); sal_Int32 nNumberFormat(pStyle->GetNumberFormat()); SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency); + + // store first cell of first range for each style, once per sheet + uno::Sequence aAddresses(xSheetCellRanges->getRangeAddresses()); + if ( aAddresses.getLength() > 0 ) + { + const table::CellRangeAddress& rRange = aAddresses[0]; + if ( rRange.Sheet != pStyle->GetLastSheet() ) + { + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData(); + pSheetData->AddCellStyle( sPrevStyleName, + ScAddress( (SCCOL)rRange.StartColumn, (SCROW)rRange.StartRow, (SCTAB)rRange.Sheet ) ); + pStyle->SetLastSheet(rRange.Sheet); + } + } } else { @@ -2569,6 +2585,17 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE if ( ( nFlags & IMPORT_CONTENT ) && !( nFlags & IMPORT_STYLES ) ) ExamineDefaultStyle(); + if (getImportFlags() & IMPORT_CONTENT) + { + if (GetModel().is()) + { + // store initial namespaces, to find the ones that were added from the file later + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData(); + const SvXMLNamespaceMap& rNamespaces = GetNamespaceMap(); + pSheetData->StoreInitialNamespaces(rNamespaces); + } + } + UnlockSolarMutex(); } @@ -2772,6 +2799,19 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE GetProgressBarHelper()->End(); // make room for subsequent SfxProgressBars if (pDoc) pDoc->CompileXML(); + + if (pDoc && GetModel().is()) + { + // set "valid stream" flags after loading (before UpdateRowHeights, so changed formula results + // in UpdateRowHeights can already clear the flags again) + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData(); + + SCTAB nTabCount = pDoc->GetTableCount(); + for (SCTAB nTab=0; nTabIsSheetBlocked( nTab )) + pDoc->SetStreamValid( nTab, TRUE ); + } + aTables.UpdateRowHeights(); aTables.ResizeShapes(); } @@ -2831,6 +2871,16 @@ void ScXMLImport::UnlockSolarMutex() } } +sal_Int32 ScXMLImport::GetByteOffset() +{ + sal_Int32 nOffset = -1; + uno::Reference xLocator = GetLocator(); + uno::Reference xSeek( xLocator, uno::UNO_QUERY ); //! should use different interface + if ( xSeek.is() ) + nOffset = (sal_Int32)xSeek->getPosition(); + return nOffset; +} + void ScXMLImport::SetRangeOverflowType(sal_uInt32 nType) { // #i31130# Overflow is stored in the document, because the ScXMLImport object diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx index f96d34c40ca5..c108642d0b68 100644 --- a/sc/source/filter/xml/xmlimprt.hxx +++ b/sc/source/filter/xml/xmlimprt.hxx @@ -980,6 +980,8 @@ public: void LockSolarMutex(); void UnlockSolarMutex(); + sal_Int32 GetByteOffset(); + void SetRangeOverflowType(sal_uInt32 nType); sal_Int32 GetRangeType(const rtl::OUString sRangeType) const; diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx index 079691944481..f62208cdd2ff 100644 --- a/sc/source/filter/xml/xmlrowi.cxx +++ b/sc/source/filter/xml/xmlrowi.cxx @@ -43,6 +43,7 @@ #include "document.hxx" #include "docuno.hxx" #include "olinetab.hxx" +#include "sheetdata.hxx" #include #include @@ -170,6 +171,7 @@ void ScXMLTableRowContext::EndElement() GetScImport().GetTables().AddRow(); DBG_ERRORFILE("it seems here is a nonvalid file; possible missing of table:table-cell element"); } + sal_Int32 nSheet = rXMLImport.GetTables().GetCurrentSheet(); sal_Int32 nCurrentRow(rXMLImport.GetTables().GetCurrentRow()); uno::Reference xSheet(rXMLImport.GetTables().GetCurrentXSheet()); if(xSheet.is()) @@ -196,7 +198,16 @@ void ScXMLTableRowContext::EndElement() XMLTableStyleContext* pStyle((XMLTableStyleContext *)pStyles->FindStyleChildContext( XML_STYLE_FAMILY_TABLE_ROW, sStyleName, sal_True)); if (pStyle) + { pStyle->FillPropertySet(xRowProperties); + + if ( nSheet != pStyle->GetLastSheet() ) + { + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData(); + pSheetData->AddRowStyle( sStyleName, ScAddress( 0, (SCROW)nFirstRow, (SCTAB)nSheet ) ); + pStyle->SetLastSheet(nSheet); + } + } } } sal_Bool bVisible (sal_True); diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 79ba79f0e689..20158d1f13db 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -50,6 +50,11 @@ #include #include "XMLTableHeaderFooterContext.hxx" #include "XMLConverter.hxx" +#include "XMLTableShapeImportHelper.hxx" +#include "sheetdata.hxx" +#include "xmlannoi.hxx" +#include "textuno.hxx" +#include "cellsuno.hxx" #include "docuno.hxx" #include "unonames.hxx" @@ -461,6 +466,7 @@ XMLTableStyleContext::XMLTableStyleContext( ScXMLImport& rImport, sNumberFormat(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberFormat"))), pStyles(&rStyles), nNumberFormat(-1), + nLastSheet(-1), bConditionalFormatCreated(sal_False), bParentSet(sal_False) { @@ -609,15 +615,22 @@ sal_Int32 XMLTableStyleContext::GetNumberFormat() } return nNumberFormat; } + // ---------------------------------------------------------------------------- SvXMLStyleContext *XMLTableStylesContext::CreateStyleStyleChildContext( sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { - SvXMLStyleContext *pStyle(SvXMLStylesContext::CreateStyleStyleChildContext( nFamily, nPrefix, - rLocalName, - xAttrList )); + SvXMLStyleContext *pStyle; + // use own wrapper for text and paragraph, to record style usage + if (nFamily == XML_STYLE_FAMILY_TEXT_PARAGRAPH || nFamily == XML_STYLE_FAMILY_TEXT_TEXT) + pStyle = new ScCellTextStyleContext( GetImport(), nPrefix, rLocalName, + xAttrList, *this, nFamily ); + else + pStyle = SvXMLStylesContext::CreateStyleStyleChildContext( + nFamily, nPrefix, rLocalName, xAttrList ); + if (!pStyle) { switch( nFamily ) @@ -1013,3 +1026,56 @@ void ScMasterPageContext::Finish( sal_Bool bOverwrite ) ClearContent(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_PAGE_RIGHTHDRCON))); } +// --------------------------------------------------------------------------- + +ScCellTextStyleContext::ScCellTextStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const rtl::OUString& rLName, const uno::Reference & xAttrList, + SvXMLStylesContext& rStyles, sal_uInt16 nFamily, sal_Bool bDefaultStyle ) : + XMLTextStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, bDefaultStyle ), + nLastSheet(-1) +{ +} + +ScCellTextStyleContext::~ScCellTextStyleContext() +{ +} + +void ScCellTextStyleContext::FillPropertySet( const uno::Reference& xPropSet ) +{ + XMLTextStyleContext::FillPropertySet( xPropSet ); + + ScXMLImport& rXMLImport = GetScImport(); + + ScCellTextCursor* pCellImp = ScCellTextCursor::getImplementation( xPropSet ); + if (pCellImp) + { + ScAddress aPos = pCellImp->GetCellObj().GetPosition(); + if ( static_cast(aPos.Tab()) != nLastSheet ) + { + ESelection aSel = pCellImp->GetSelection(); + + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetImport().GetModel())->GetSheetSaveData(); + pSheetData->AddTextStyle( GetName(), aPos, aSel ); + + nLastSheet = static_cast(aPos.Tab()); + } + } + else if ( rXMLImport.GetTables().GetCurrentSheet() != nLastSheet ) + { + ScDrawTextCursor* pDrawImp = ScDrawTextCursor::getImplementation( xPropSet ); + if (pDrawImp) + { + XMLTableShapeImportHelper* pTableShapeImport = (XMLTableShapeImportHelper*)GetScImport().GetShapeImport().get(); + ScXMLAnnotationContext* pAnnotationContext = pTableShapeImport->GetAnnotationContext(); + if (pAnnotationContext) + { + pAnnotationContext->AddContentStyle( GetFamily(), GetName(), pDrawImp->GetSelection() ); + nLastSheet = rXMLImport.GetTables().GetCurrentSheet(); + } + } + + // if it's a different shape, BlockSheet is called from XMLTableShapeImportHelper::finishShape + // formatted text in page headers/footers can be ignored + } +} + diff --git a/sc/source/filter/xml/xmlstyli.hxx b/sc/source/filter/xml/xmlstyli.hxx index 272ec0151134..c80ea8b5c92d 100644 --- a/sc/source/filter/xml/xmlstyli.hxx +++ b/sc/source/filter/xml/xmlstyli.hxx @@ -40,9 +40,12 @@ #include #include #include +#include #include #include "xmlimprt.hxx" +class ScSheetSaveData; + class ScXMLCellImportPropertyMapper : public SvXMLImportPropertyMapper { protected: @@ -101,6 +104,7 @@ class XMLTableStyleContext : public XMLPropStyleContext std::vector aMaps; com::sun::star::uno::Any aConditionalFormat; sal_Int32 nNumberFormat; + sal_Int32 nLastSheet; sal_Bool bConditionalFormatCreated; sal_Bool bParentSet; @@ -158,6 +162,9 @@ public: sal_Int32 GetNumberFormat();// { return nNumberFormat; } + sal_Int32 GetLastSheet() const { return nLastSheet; } + void SetLastSheet(sal_Int32 nNew) { nLastSheet = nNew; } + private: using XMLPropStyleContext::SetStyle; }; @@ -298,5 +305,28 @@ public: virtual void Finish( sal_Bool bOverwrite ); }; +class ScCellTextStyleContext : public XMLTextStyleContext +{ + sal_Int32 nLastSheet; + + const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } + ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } + +public: + ScCellTextStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const ::rtl::OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList, + SvXMLStylesContext& rStyles, sal_uInt16 nFamily, + sal_Bool bDefaultStyle = sal_False ); + virtual ~ScCellTextStyleContext(); + + // overload FillPropertySet to store style information + virtual void FillPropertySet( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & rPropSet ); +}; + + #endif diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx index 231839b9f946..0f980c4a9608 100644 --- a/sc/source/filter/xml/xmlsubti.cxx +++ b/sc/source/filter/xml/xmlsubti.cxx @@ -43,6 +43,7 @@ #include "docuno.hxx" #include "cellsuno.hxx" #include "XMLStylesImportHelper.hxx" +#include "sheetdata.hxx" #include "tabprotection.hxx" #include @@ -269,7 +270,12 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString& XMLTableStyleContext* pStyle = (XMLTableStyleContext *)pStyles->FindStyleChildContext( XML_STYLE_FAMILY_TABLE_TABLE, sStyleName, sal_True); if (pStyle) + { pStyle->FillPropertySet(xProperties); + + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rImport.GetModel())->GetSheetSaveData(); + pSheetData->AddTableStyle( sStyleName, ScAddress( 0, 0, (SCTAB)nCurrentSheet ) ); + } } } } @@ -609,7 +615,11 @@ void ScMyTables::UpdateRowHeights() } if (aUpdateSheets.GetSelectCount()) + { + pDoc->LockStreamValid( true ); // ignore draw page size (but not formula results) ScModelObj::getImplementation(rImport.GetModel())->UpdateAllRowHeights(&aUpdateSheets); + pDoc->LockStreamValid( false ); + } } rImport.UnlockSolarMutex(); diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx index cc95e01be821..8ea9701ecd32 100644 --- a/sc/source/filter/xml/xmltabi.cxx +++ b/sc/source/filter/xml/xmltabi.cxx @@ -50,6 +50,7 @@ #include "XMLStylesImportHelper.hxx" #include "rangeutl.hxx" #include "externalrefmgr.hxx" +#include "sheetdata.hxx" #include #include @@ -147,9 +148,13 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport, const sal_Int32 nSpannedCols) : SvXMLImportContext( rImport, nPrfx, rLName ), pExternalRefInfo(NULL), + nStartOffset(-1), bStartFormPage(sal_False), bPrintEntireSheet(sal_True) { + // get start offset in file (if available) + nStartOffset = GetScImport().GetByteOffset(); + if (!bTempIsSubTable) { sal_Bool bProtection(sal_False); @@ -326,6 +331,9 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( USHORT nPrefix, void ScXMLTableContext::EndElement() { + // get end offset in file (if available) +// sal_Int32 nEndOffset = GetScImport().GetByteOffset(); + GetScImport().LockSolarMutex(); GetScImport().GetStylesImportHelper()->EndTable(); ScDocument* pDoc(GetScImport().GetDocument()); @@ -386,6 +394,15 @@ void ScXMLTableContext::EndElement() GetScImport().GetTables().DeleteTable(); GetScImport().ProgressBarIncrement(sal_False); + + // store stream positions + if (!pExternalRefInfo.get() && nStartOffset >= 0 /* && nEndOffset >= 0 */) + { + ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData(); + sal_Int32 nTab = GetScImport().GetTables().GetCurrentSheet(); + // pSheetData->AddStreamPos( nTab, nStartOffset, nEndOffset ); + pSheetData->StartStreamPos( nTab, nStartOffset ); + } } GetScImport().UnlockSolarMutex(); } diff --git a/sc/source/filter/xml/xmltabi.hxx b/sc/source/filter/xml/xmltabi.hxx index 7b8c9878f2d5..1a4438b28955 100644 --- a/sc/source/filter/xml/xmltabi.hxx +++ b/sc/source/filter/xml/xmltabi.hxx @@ -52,6 +52,7 @@ class ScXMLTableContext : public SvXMLImportContext { rtl::OUString sPrintRanges; ::std::auto_ptr pExternalRefInfo; + sal_Int32 nStartOffset; sal_Bool bStartFormPage; sal_Bool bPrintEntireSheet; diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 960d78ada163..dbf672993310 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -624,6 +624,25 @@ sal_Bool ScXMLImportWrapper::Import(sal_Bool bStylesOnly, ErrCode& nError) return sal_False; } +bool lcl_HasValidStream(ScDocument& rDoc) +{ + SfxObjectShell* pObjSh = rDoc.GetDocumentShell(); + if ( pObjSh->IsDocShared() ) + return false; // never copy stream from shared file + + // don't read remote file again + // (could instead re-use medium directly in that case) + SfxMedium* pSrcMed = rDoc.GetDocumentShell()->GetMedium(); + if ( !pSrcMed || pSrcMed->IsRemote() ) + return false; + + SCTAB nTabCount = rDoc.GetTableCount(); + for (SCTAB nTab=0; nTab& xServiceFactory, uno::Reference& xModel, uno::Reference& xWriter, uno::Sequence& aDescriptor, const rtl::OUString& sName, @@ -691,7 +710,49 @@ sal_Bool ScXMLImportWrapper::ExportToComponent(uno::Reference(SvXMLExport::getImplementation(xFilter)); pExport->SetSharedData(pSharedData); - bRet = xFilter->filter( aDescriptor ); + + // if there are sheets to copy, get the source stream + if ( sName.equalsAscii("content.xml") && lcl_HasValidStream(rDoc) && + ( pExport->getExportFlags() & EXPORT_OASIS ) ) + { + // old stream is still in this file's storage - open read-only + + SfxMedium* pSrcMed = rDoc.GetDocumentShell()->GetMedium(); + String aSrcURL = pSrcMed->GetOrigURL(); + + // SfxMedium must not be read-only, or it will create a temp file in GetStorage + SfxMedium aTmpMedium( aSrcURL, STREAM_READWRITE, FALSE, NULL, NULL ); + uno::Reference xTmpStorage = aTmpMedium.GetStorage(); + uno::Reference xSrcStream; + uno::Reference xSrcInput; + try + { + if (xTmpStorage.is()) + xSrcStream = xTmpStorage->openStreamElement( sName, embed::ElementModes::READ ); + if (xSrcStream.is()) + xSrcInput = xSrcStream->getInputStream(); + } + catch (uno::Exception&) + { + // stream not available (for example, password protected) - save normally (xSrcInput is null) + } + + pExport->SetSourceStream( xSrcInput ); + bRet = xFilter->filter( aDescriptor ); + pExport->SetSourceStream( uno::Reference() ); + + // If there was an error, reset all stream flags, so the next save attempt will use normal saving. + if (!bRet) + { + SCTAB nTabCount = rDoc.GetTableCount(); + for (SCTAB nTab=0; nTabfilter( aDescriptor ); + pSharedData = pExport->GetSharedData(); //stream is closed by SAX parser diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 61bd4f7bf0e9..424e4731a324 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -113,6 +113,14 @@ IMPL_LINK( ScDocFunc, NotifyDrawUndo, SdrUndoAction*, pUndoAction ) else rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDraw( pUndoAction, &rDocShell ) ); rDocShell.SetDrawModified(); + + // the affected sheet isn't known, so all stream positions are invalidated + ScDocument* pDoc = rDocShell.GetDocument(); + SCTAB nTabCount = pDoc->GetTableCount(); + for (SCTAB nTab=0; nTabIsStreamValid(nTab)) + pDoc->SetStreamValid(nTab, FALSE); + return 0; } @@ -1061,6 +1069,9 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow ) if( rDoc.IsUndoEnabled() ) rDocShell.GetUndoManager()->AddUndoAction( new ScUndoShowHideNote( rDocShell, rPos, bShow ) ); + if (rDoc.IsStreamValid(rPos.Tab())) + rDoc.SetStreamValid(rPos.Tab(), FALSE); + rDocShell.SetDocumentModified(); return true; @@ -1089,6 +1100,9 @@ bool ScDocFunc::SetNoteText( const ScAddress& rPos, const String& rText, BOOL bA //! Undo !!! + if (pDoc->IsStreamValid(rPos.Tab())) + pDoc->SetStreamValid(rPos.Tab(), FALSE); + rDocShell.PostPaintCell( rPos ); aModificator.SetDocumentModified(); @@ -1142,6 +1156,10 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, con // repaint cell (to make note marker visible) rDocShell.PostPaintCell( rPos ); + + if (rDoc.IsStreamValid(rPos.Tab())) + rDoc.SetStreamValid(rPos.Tab(), FALSE); + aModificator.SetDocumentModified(); bDone = true; } diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c62c2dc41fdf..c8a41e81497d 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -120,6 +120,7 @@ #include "cfgids.hxx" #include "warnpassword.hxx" #include "optsolver.hxx" +#include "sheetdata.hxx" #include "tabprotection.hxx" #include "docsh.hxx" @@ -755,8 +756,13 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) if ( IsDocShared() && !SC_MOD()->IsInSharedDocSaving() ) { } + UseSheetSaveEntries(); // use positions from saved file for next saving } break; + case SFX_EVENT_SAVEASDOCDONE: + // new positions are used after "save" and "save as", but not "save to" + UseSheetSaveEntries(); // use positions from saved file for next saving + break; default: { } @@ -2212,6 +2218,7 @@ BOOL ScDocShell::HasAutomaticTableName( const String& rFilter ) // static pPaintLockData ( NULL ), \ pOldJobSetup ( NULL ), \ pSolverSaveData ( NULL ), \ + pSheetSaveData ( NULL ), \ pModificator ( NULL ) //------------------------------------------------------------------ @@ -2305,6 +2312,7 @@ __EXPORT ScDocShell::~ScDocShell() delete pOldJobSetup; // gesetzt nur bei Fehler in StartJob() delete pSolverSaveData; + delete pSheetSaveData; delete pOldAutoDBRange; if (pModificator) @@ -2475,6 +2483,39 @@ void ScDocShell::SetSolverSaveData( const ScOptSolverSave& rData ) pSolverSaveData = new ScOptSolverSave( rData ); } +ScSheetSaveData* ScDocShell::GetSheetSaveData() +{ + if (!pSheetSaveData) + pSheetSaveData = new ScSheetSaveData; + + return pSheetSaveData; +} + +void ScDocShell::UseSheetSaveEntries() +{ + if (pSheetSaveData) + { + pSheetSaveData->UseSaveEntries(); // use positions from saved file for next saving + + bool bHasEntries = false; + SCTAB nTabCount = aDocument.GetTableCount(); + SCTAB nTab; + for (nTab = 0; nTab < nTabCount; ++nTab) + if (pSheetSaveData->HasStreamPos(nTab)) + bHasEntries = true; + + if (!bHasEntries) + { + // if no positions were set (for example, export to other format), + // reset all "valid" flags + + for (nTab = 0; nTab < nTabCount; ++nTab) + if (aDocument.IsStreamValid(nTab)) + aDocument.SetStreamValid(nTab, FALSE); + } + } +} + // --- ScDocShellModificator ------------------------------------------ ScDocShellModificator::ScDocShellModificator( ScDocShell& rDS ) diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index d4df2863eec5..80b0c76a64be 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1300,6 +1300,13 @@ void ScDocShell::DoHardRecalc( BOOL /* bApi */ ) aDocument.BroadcastUno( SfxSimpleHint( SC_HINT_CALCALL ) ); aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); + // use hard recalc also to disable stream-copying of all sheets + // (somewhat consistent with charts) + SCTAB nTabCount = aDocument.GetTableCount(); + for (SCTAB nTab=0; nTabSetComment( ScGlobal::GetRscString( bNewNote ? STR_UNDO_INSERTNOTE : STR_UNDO_DELETENOTE ) ); } } + + // invalidate stream positions only for the affected sheet + rDoc.LockStreamValid(false); + if (rDoc.IsStreamValid(aNotePos.Tab())) + rDoc.SetStreamValid(aNotePos.Tab(), FALSE); } } diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 4e6cf05ddd0d..9556b4ad8138 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -72,6 +72,7 @@ class VirtualDevice; class ScImportOptions; class ScDocShellModificator; class ScOptSolverSave; +class ScSheetSaveData; namespace sfx2 { class FileDialogHelper; } struct DocShell_Impl; @@ -123,6 +124,7 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener ScPaintLockData* pPaintLockData; ScJobSetup* pOldJobSetup; ScOptSolverSave* pSolverSaveData; + ScSheetSaveData* pSheetSaveData; ScDocShellModificator* pModificator; // #109979#; is used to load XML (created in BeforeXMLLoading and destroyed in AfterXMLLoading) @@ -167,6 +169,8 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener SC_DLLPRIVATE void EnableSharedSettings( bool bEnable ); SC_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > LoadSharedDocument(); + SC_DLLPRIVATE void UseSheetSaveEntries(); + protected: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); @@ -414,6 +418,8 @@ public: const ScOptSolverSave* GetSolverSaveData() const { return pSolverSaveData; } // may be null void SetSolverSaveData( const ScOptSolverSave& rData ); + + ScSheetSaveData* GetSheetSaveData(); }; SO2_DECL_REF(ScDocShell) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index a4370f6665fb..ec706252a737 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -289,6 +289,13 @@ void ScModelObj::AfterXMLLoading(sal_Bool bRet) pDocShell->AfterXMLLoading(bRet); } +ScSheetSaveData* ScModelObj::GetSheetSaveData() +{ + if (pDocShell) + return pDocShell->GetSheetSaveData(); + return NULL; +} + uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException) { diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index bd481dfc49f0..a9e6a799e010 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -897,6 +897,47 @@ uno::Reference SAL_CALL ScDrawTextCursor::getEnd() throw(uno:: return xRange; } +// XUnoTunnel + +sal_Int64 SAL_CALL ScDrawTextCursor::getSomething( + const uno::Sequence& rId ) throw(uno::RuntimeException) +{ + if ( rId.getLength() == 16 && + 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast(reinterpret_cast(this)); + } + return SvxUnoTextCursor::getSomething( rId ); +} + +// static +const uno::Sequence& ScDrawTextCursor::getUnoTunnelId() +{ + static uno::Sequence * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +// static +ScDrawTextCursor* ScDrawTextCursor::getImplementation( const uno::Reference xObj ) +{ + ScDrawTextCursor* pRet = NULL; + uno::Reference xUT( xObj, uno::UNO_QUERY ); + if (xUT.is()) + pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); + return pRet; +} + //------------------------------------------------------------------------ ScSimpleEditSourceHelper::ScSimpleEditSourceHelper() diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index b2f3e12d1ee6..36f6c682832f 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -824,6 +824,11 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq ) bNumFormatChanged, aOldSet, rNewSet ) ) pDoc->InvalidateTextWidth( NULL, NULL, bNumFormatChanged ); + SCTAB nTabCount = pDoc->GetTableCount(); + for (SCTAB nTab=0; nTabIsStreamValid(nTab)) + pDoc->SetStreamValid(nTab, FALSE); + ULONG nOldFormat = ((const SfxUInt32Item&)aOldSet. Get( ATTR_VALUE_FORMAT )).GetValue(); ULONG nNewFormat = ((const SfxUInt32Item&)rNewSet. -- cgit From 69fc8dc7847e22a4139ed59e9873c08a32edf092 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Tue, 8 Sep 2009 04:57:32 +0000 Subject: CWS-TOOLING: integrate CWS oj18 2009-08-21 15:08:49 +0200 oj r275263 : wrong check 2009-08-21 08:56:01 +0200 oj r275215 : missing not 2009-08-20 07:27:13 +0200 oj r275164 : use new method from global 2009-08-19 10:22:35 +0200 oj r275138 : call GetLocale instead of pLocale 2009-08-18 10:39:32 +0200 oj r275082 : missing header include 2009-08-18 10:09:44 +0200 oj r275081 : new methods at global 2009-08-18 10:09:00 +0200 oj r275080 : unused var 2009-08-18 08:59:04 +0200 oj r275078 : move files from classes to xml 2009-08-17 14:58:16 +0200 oj r275056 : CWS-TOOLING: rebase CWS oj18 to trunk@275001 (milestone: DEV300:m55) 2009-08-17 13:29:44 +0200 oj r275047 : compile error 2009-08-17 13:27:47 +0200 oj r275045 : compile error 2009-08-17 11:44:54 +0200 oj r275040 : add dep 2009-07-22 14:26:05 +0200 oj r274240 : move unused services into fwl 2009-07-22 14:25:35 +0200 oj r274239 : move unused services into fwl 2009-07-22 13:47:45 +0200 oj r274233 : remove some unused code 2009-07-22 09:06:20 +0200 oj r274219 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 08:48:58 +0200 oj r274218 : create NumberFormatter on demand 2009-07-22 08:39:23 +0200 oj r274217 : change char to sal_Char 2009-07-22 07:33:34 +0200 oj r274214 : export dbtoolsclient dbcharsethelper for sc 2009-07-22 07:30:04 +0200 oj r274213 : late init of numberformatter and breakiterator 2009-07-22 07:28:55 +0200 oj r274212 : export dbtoolsclient dbcharsethelper for sc 2009-07-21 13:43:28 +0200 oj r274196 : check if quick start is enbaled 2009-07-21 13:40:09 +0200 oj r274195 : check config entry for UiEventsLogger 2009-07-21 13:37:40 +0200 oj r274194 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:35:38 +0200 oj r274193 : code refactoring, remove of duplicate code and some late inits and removale of not needed files 2009-07-21 13:33:41 +0200 oj r274192 : doc meta data will now be created on demand 2009-07-21 13:13:40 +0200 oj r274187 : load ldap functions on demand 2009-07-21 13:03:17 +0200 oj r274183 : late init of TransliterationImpl 2009-07-21 12:36:10 +0200 oj r274180 : late init of charClass --- sc/inc/collect.hxx | 3 +- sc/inc/document.hxx | 6 +- sc/inc/docuno.hxx | 1 + sc/inc/global.hxx | 20 ++-- sc/source/core/data/autonamecache.cxx | 2 +- sc/source/core/data/conditio.cxx | 10 +- sc/source/core/data/dociter.cxx | 4 +- sc/source/core/data/docpool.cxx | 4 +- sc/source/core/data/documen2.cxx | 11 +- sc/source/core/data/documen3.cxx | 7 +- sc/source/core/data/documen8.cxx | 39 ++++--- sc/source/core/data/documen9.cxx | 2 +- sc/source/core/data/document.cxx | 9 +- sc/source/core/data/dpgroup.cxx | 2 +- sc/source/core/data/dpobject.cxx | 4 +- sc/source/core/data/dpoutput.cxx | 8 +- sc/source/core/data/dptabdat.cxx | 4 +- sc/source/core/data/dptabsrc.cxx | 4 +- sc/source/core/data/global.cxx | 80 ++++++++++--- sc/source/core/data/pivot2.cxx | 1 - sc/source/core/data/poolhelp.cxx | 59 +++++++--- sc/source/core/data/stlpool.cxx | 11 +- sc/source/core/data/stlsheet.cxx | 15 ++- sc/source/core/data/table3.cxx | 14 +-- sc/source/core/data/table6.cxx | 2 +- sc/source/core/inc/poolhelp.hxx | 17 ++- sc/source/core/tool/autoform.cxx | 6 +- sc/source/core/tool/callform.cxx | 4 +- sc/source/core/tool/collect.cxx | 19 +-- sc/source/core/tool/compiler.cxx | 4 +- sc/source/core/tool/dbcolect.cxx | 2 +- sc/source/core/tool/interpr1.cxx | 23 ++-- sc/source/core/tool/interpr5.cxx | 2 +- sc/source/core/tool/rangelst.cxx | 4 +- sc/source/core/tool/rangenam.cxx | 2 +- sc/source/core/tool/userlist.cxx | 4 +- sc/source/filter/excel/xelink.cxx | 2 +- sc/source/ui/dbgui/scuiasciiopt.cxx | 2 +- sc/source/ui/docshell/docsh8.cxx | 199 +++++++++++++------------------- sc/source/ui/docshell/tablink.cxx | 2 +- sc/source/ui/miscdlgs/acredlin.cxx | 2 +- sc/source/ui/miscdlgs/solveroptions.cxx | 2 +- sc/source/ui/unoobj/docuno.cxx | 60 ++++++---- sc/source/ui/view/output2.cxx | 21 ++-- sc/source/ui/view/tabvwsh4.cxx | 2 +- sc/source/ui/view/tabvwsha.cxx | 48 ++++---- sc/util/makefile.mk | 1 - 47 files changed, 417 insertions(+), 333 deletions(-) diff --git a/sc/inc/collect.hxx b/sc/inc/collect.hxx index 8f6388a86040..dc7778d12da3 100644 --- a/sc/inc/collect.hxx +++ b/sc/inc/collect.hxx @@ -80,7 +80,7 @@ public: ScDataObject* At(USHORT nIndex) const; virtual USHORT IndexOf(ScDataObject* pScDataObject) const; - USHORT GetCount() const { return nCount; } + USHORT GetCount() const; ScDataObject* operator[]( const USHORT nIndex) const {return At(nIndex);} ScCollection& operator=( const ScCollection& rCol ); @@ -192,6 +192,7 @@ public: TypedScStrCollection( const TypedScStrCollection& rCpy ) : ScSortedCollection( rCpy ) { bCaseSensitive = rCpy.bCaseSensitive; } + ~TypedScStrCollection(); virtual ScDataObject* Clone() const; virtual short Compare( ScDataObject* pKey1, ScDataObject* pKey2 ) const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 566bd07b6223..6711a2c974ad 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -258,7 +258,7 @@ private: ScChartCollection* pChartCollection; std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock; ScPatternAttr* pSelectionAttr; // Attribute eines Blocks - SvxLinkManager* pLinkManager; + mutable SvxLinkManager* pLinkManager; ScFormulaCell* pFormulaTree; // Berechnungsbaum Start ScFormulaCell* pEOFormulaTree; // Berechnungsbaum Ende, letzte Zelle ScFormulaCell* pFormulaTrack; // BroadcastTrack Start @@ -440,7 +440,7 @@ public: SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL ); XColorTable* GetColorTable(); - SvxLinkManager* GetLinkManager() { return pLinkManager; } + SC_DLLPUBLIC SvxLinkManager* GetLinkManager() const; SC_DLLPUBLIC const ScDocOptions& GetDocOptions() const; SC_DLLPUBLIC void SetDocOptions( const ScDocOptions& rOpt ); @@ -512,7 +512,7 @@ public: ::com::sun::star::embed::XEmbeddedObject > FindOleObjectByName( const String& rName ); - SC_DLLPUBLIC void MakeTable( SCTAB nTab ); + SC_DLLPUBLIC void MakeTable( SCTAB nTab,bool _bNeedsNameCheck = true ); SCTAB GetVisibleTab() const { return nVisibleTab; } SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab) { nVisibleTab = nTab; } diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index e46decce34ed..0d69c9f68670 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -111,6 +111,7 @@ private: BOOL FillRenderMarkData( const com::sun::star::uno::Any& aSelection, ScMarkData& rMark, ScPrintSelectionStatus& rStatus ) const; + com::sun::star::uno::Reference GetFormatter(); rtl::OUString maBuildId; protected: diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 7bdff1d0592e..1f6dc13d04ce 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -541,9 +541,15 @@ class ScGlobal static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XOrdinalSuffix> xOrdinalSuffix; + static CalendarWrapper* pCalendar; + static CollatorWrapper* pCaseCollator; + static CollatorWrapper* pCollator; + static ::utl::TransliterationWrapper* pTransliteration; + static ::utl::TransliterationWrapper* pCaseTransliteration; + static IntlWrapper* pScIntlWrapper; + static ::com::sun::star::lang::Locale* pLocale; public: - static ::com::sun::star::lang::Locale* pLocale; static SvtSysLocale* pSysLocale; // for faster access a pointer to the single instance provided by SvtSysLocale SC_DLLPUBLIC static const CharClass* pCharClass; @@ -551,15 +557,15 @@ public: SC_DLLPUBLIC static const LocaleDataWrapper* pLocaleData; SC_DLLPUBLIC static const LocaleDataWrapper* GetpLocaleData(); - static CalendarWrapper* pCalendar; - SC_DLLPUBLIC static CollatorWrapper* pCollator; - static CollatorWrapper* pCaseCollator; + static CalendarWrapper* GetCalendar(); + SC_DLLPUBLIC static CollatorWrapper* GetCollator(); + static CollatorWrapper* GetCaseCollator(); + static IntlWrapper* GetScIntlWrapper(); + static ::com::sun::star::lang::Locale* GetLocale(); - static ::utl::TransliterationWrapper* pTransliteration; SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration(); //CHINA001 + static ::utl::TransliterationWrapper* GetCaseTransliteration(); - static ::utl::TransliterationWrapper* pCaseTransliteration; - static IntlWrapper* pScIntlWrapper; SC_DLLPUBLIC static LanguageType eLnge; static sal_Unicode cListDelimiter; diff --git a/sc/source/core/data/autonamecache.cxx b/sc/source/core/data/autonamecache.cxx index d106e5824571..2daa10fa29d4 100644 --- a/sc/source/core/data/autonamecache.cxx +++ b/sc/source/core/data/autonamecache.cxx @@ -99,7 +99,7 @@ const ScAutoNameAddresses& ScAutoNameCache::GetNameOccurences( const String& rNa ; // nothing, prevent compiler warning break; } - if ( ScGlobal::pTransliteration->isEqual( aStr, rName ) ) + if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rName ) ) { rAddresses.push_back( ScAddress( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ) ); } diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index b4d8a5972211..45ead48d0f35 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -786,7 +786,7 @@ BOOL ScConditionEntry::IsValidStr( const String& rArg ) const String aUpVal2( aStrVal2 ); if ( eOp == SC_COND_BETWEEN || eOp == SC_COND_NOTBETWEEN ) - if ( ScGlobal::pCollator->compareString( aUpVal1, aUpVal2 ) + if ( ScGlobal::GetCollator()->compareString( aUpVal1, aUpVal2 ) == COMPARE_GREATER ) { // richtige Reihenfolge fuer Wertebereich @@ -797,16 +797,16 @@ BOOL ScConditionEntry::IsValidStr( const String& rArg ) const switch ( eOp ) { case SC_COND_EQUAL: - bValid = (ScGlobal::pCollator->compareString( + bValid = (ScGlobal::GetCollator()->compareString( rArg, aUpVal1 ) == COMPARE_EQUAL); break; case SC_COND_NOTEQUAL: - bValid = (ScGlobal::pCollator->compareString( + bValid = (ScGlobal::GetCollator()->compareString( rArg, aUpVal1 ) != COMPARE_EQUAL); break; default: { - sal_Int32 nCompare = ScGlobal::pCollator->compareString( + sal_Int32 nCompare = ScGlobal::GetCollator()->compareString( rArg, aUpVal1 ); switch ( eOp ) { @@ -826,7 +826,7 @@ BOOL ScConditionEntry::IsValidStr( const String& rArg ) const case SC_COND_NOTBETWEEN: // Test auf NOTBETWEEN: bValid = ( nCompare == COMPARE_LESS || - ScGlobal::pCollator->compareString( rArg, + ScGlobal::GetCollator()->compareString( rArg, aUpVal2 ) == COMPARE_GREATER ); if ( eOp == SC_COND_BETWEEN ) bValid = !bValid; diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 3b650f5d8ca4..b88cd49a6a8c 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1074,8 +1074,8 @@ ScBaseCell* ScQueryCellIterator::BinarySearch() ScBaseCell* pCell; SCSIZE nHi, nLo; - CollatorWrapper* pCollator = (aParam.bCaseSens ? ScGlobal::pCaseCollator : - ScGlobal::pCollator); + CollatorWrapper* pCollator = (aParam.bCaseSens ? ScGlobal::GetCaseCollator() : + ScGlobal::GetCollator()); SvNumberFormatter& rFormatter = *(pDoc->GetFormatTable()); const ScQueryEntry& rEntry = aParam.GetEntry(0); bool bLessEqual = rEntry.eOp == SC_LESS_EQUAL; diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index c2a77a0d0ede..fce83f25cd93 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -741,7 +741,7 @@ SfxItemPresentation lcl_HFPresentation default: if ( !pIntl ) - pIntl = ScGlobal::pScIntlWrapper; + pIntl = ScGlobal::GetScIntlWrapper(); pItem->GetPresentation( ePresentation, eCoreMetric, ePresentationMetric, aText, pIntl ); } @@ -1018,7 +1018,7 @@ SfxItemPresentation __EXPORT ScDocumentPool::GetPresentation( default: if ( !pIntl ) - pIntl = ScGlobal::pScIntlWrapper; + pIntl = ScGlobal::GetScIntlWrapper(); ePresentation = rItem.GetPresentation( ePresentation, GetMetric( nW ), ePresentationMetric, rText, pIntl ); break; } diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index ae1f087a23a8..4949254b7ab8 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -262,6 +262,15 @@ ScDocument::ScDocument( ScDocumentMode eMode, aTrackTimer.SetTimeout( 100 ); } +SvxLinkManager* ScDocument::GetLinkManager() const +{ + if ( bAutoCalc && !pLinkManager && pShell) + { + pLinkManager = new SvxLinkManager( pShell ); + } + return pLinkManager; +} + void ScDocument::SetStorageGrammar( formula::FormulaGrammar::Grammar eGram ) { @@ -372,7 +381,7 @@ ScDocument::~ScDocument() // Links aufrauemen - if ( pLinkManager ) + if ( GetLinkManager() ) { // BaseLinks freigeben for ( USHORT n = pLinkManager->GetServers().Count(); n; ) diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index dba29553462e..7355fb5241ce 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -428,7 +428,7 @@ BOOL ScDocument::LinkExternalTab( SCTAB& rTab, const String& aDocTab, { ScTableLink* pLink = new ScTableLink( pShell, aFileName, aFilterName, aOptions, nRefreshDelay ); pLink->SetInCreate( TRUE ); - pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aFileName, + GetLinkManager()->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aFileName, &aFilterName ); pLink->Update(); pLink->SetInCreate( FALSE ); @@ -1735,10 +1735,7 @@ void ScDocument::SetDocOptions( const ScDocOptions& rOpt ) *pDocOptions = rOpt; rOpt.GetDate( d,m,y ); - SvNumberFormatter* pFormatter = xPoolHelper->GetFormTable(); - pFormatter->ChangeNullDate( d,m,y ); - pFormatter->ChangeStandardPrec( (USHORT)rOpt.GetStdPrecision() ); - pFormatter->SetYear2000( rOpt.GetYear2000() ); + xPoolHelper->SetFormTableOpt(rOpt); } const ScViewOptions& ScDocument::GetViewOptions() const diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index b337cc902aef..620a8a6a3e13 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -925,7 +925,7 @@ BOOL ScDocument::IdleCheckLinks() // TRUE = demnaechst wieder versuche { BOOL bAnyLeft = FALSE; - if (pLinkManager) + if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); USHORT nCount = rLinks.Count(); @@ -953,7 +953,7 @@ void ScDocument::SaveDdeLinks(SvStream& rStream) const // bei 4.0-Export alle mit Modus != DEFAULT weglassen BOOL bExport40 = ( rStream.GetVersion() <= SOFFICE_FILEFORMAT_40 ); - const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); + const ::sfx2::SvBaseLinks& rLinks = GetLinkManager()->GetLinks(); USHORT nCount = rLinks.Count(); // erstmal zaehlen... @@ -991,6 +991,7 @@ void ScDocument::LoadDdeLinks(SvStream& rStream) { ScMultipleReadHeader aHdr( rStream ); + GetLinkManager(); USHORT nCount; rStream >> nCount; for (USHORT i=0; iGetLinks(); USHORT nCount = rLinks.Count(); @@ -1030,7 +1031,7 @@ BOOL ScDocument::IsInLinkUpdate() const void ScDocument::UpdateExternalRefLinks() { - if (!pLinkManager) + if (!GetLinkManager()) return; const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); @@ -1069,7 +1070,7 @@ void ScDocument::UpdateExternalRefLinks() void ScDocument::UpdateDdeLinks() { - if (pLinkManager) + if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); USHORT nCount = rLinks.Count(); @@ -1115,7 +1116,7 @@ BOOL ScDocument::UpdateDdeLink( const String& rAppl, const String& rTopic, const //! wenn's mal alles asynchron wird, aber auch hier BOOL bFound = FALSE; - if (pLinkManager) + if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); USHORT nCount = rLinks.Count(); @@ -1140,7 +1141,7 @@ BOOL ScDocument::UpdateDdeLink( const String& rAppl, const String& rTopic, const void ScDocument::DisconnectDdeLinks() { - if (pLinkManager) + if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); USHORT nCount = rLinks.Count(); @@ -1163,7 +1164,7 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const pDestDoc->LoadDdeLinks(*pClipData); } } - else if (pLinkManager) // Links direkt kopieren + else if (GetLinkManager()) // Links direkt kopieren { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); USHORT nCount = rLinks.Count(); @@ -1184,7 +1185,7 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const USHORT ScDocument::GetDdeLinkCount() const { USHORT nDdeCount = 0; - if (pLinkManager) + if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); USHORT nCount = rLinks.Count(); @@ -1260,12 +1261,12 @@ ScDdeLink* lclGetDdeLink( const SvxLinkManager* pLinkManager, USHORT nDdePos ) bool ScDocument::FindDdeLink( const String& rAppl, const String& rTopic, const String& rItem, BYTE nMode, USHORT& rnDdePos ) { - return lclGetDdeLink( pLinkManager, rAppl, rTopic, rItem, nMode, &rnDdePos ) != NULL; + return lclGetDdeLink( GetLinkManager(), rAppl, rTopic, rItem, nMode, &rnDdePos ) != NULL; } bool ScDocument::GetDdeLinkData( USHORT nDdePos, String& rAppl, String& rTopic, String& rItem ) const { - if( const ScDdeLink* pDdeLink = lclGetDdeLink( pLinkManager, nDdePos ) ) + if( const ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos ) ) { rAppl = pDdeLink->GetAppl(); rTopic = pDdeLink->GetTopic(); @@ -1277,7 +1278,7 @@ bool ScDocument::GetDdeLinkData( USHORT nDdePos, String& rAppl, String& rTopic, bool ScDocument::GetDdeLinkMode( USHORT nDdePos, BYTE& rnMode ) const { - if( const ScDdeLink* pDdeLink = lclGetDdeLink( pLinkManager, nDdePos ) ) + if( const ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos ) ) { rnMode = pDdeLink->GetMode(); return true; @@ -1287,7 +1288,7 @@ bool ScDocument::GetDdeLinkMode( USHORT nDdePos, BYTE& rnMode ) const const ScMatrix* ScDocument::GetDdeLinkResultMatrix( USHORT nDdePos ) const { - const ScDdeLink* pDdeLink = lclGetDdeLink( pLinkManager, nDdePos ); + const ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos ); return pDdeLink ? pDdeLink->GetResult() : NULL; } @@ -1298,7 +1299,7 @@ bool ScDocument::CreateDdeLink( const String& rAppl, const String& rTopic, const on existing and new links. */ //! store DDE links additionally at document (for efficiency)? DBG_ASSERT( nMode != SC_DDE_IGNOREMODE, "ScDocument::CreateDdeLink - SC_DDE_IGNOREMODE not allowed here" ); - if( pLinkManager && (nMode != SC_DDE_IGNOREMODE) ) + if( GetLinkManager() && (nMode != SC_DDE_IGNOREMODE) ) { ScDdeLink* pDdeLink = lclGetDdeLink( pLinkManager, rAppl, rTopic, rItem, nMode ); if( !pDdeLink ) @@ -1319,7 +1320,7 @@ bool ScDocument::CreateDdeLink( const String& rAppl, const String& rTopic, const bool ScDocument::SetDdeLinkResultMatrix( USHORT nDdePos, ScMatrix* pResults ) { - if( ScDdeLink* pDdeLink = lclGetDdeLink( pLinkManager, nDdePos ) ) + if( ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos ) ) { pDdeLink->SetResult( pResults ); return true; @@ -1331,7 +1332,7 @@ bool ScDocument::SetDdeLinkResultMatrix( USHORT nDdePos, ScMatrix* pResults ) BOOL ScDocument::HasAreaLinks() const { - if (pLinkManager) // Clipboard z.B. hat keinen LinkManager + if (GetLinkManager()) // Clipboard z.B. hat keinen LinkManager { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); USHORT nCount = rLinks.Count(); @@ -1345,7 +1346,7 @@ BOOL ScDocument::HasAreaLinks() const void ScDocument::UpdateAreaLinks() { - if (pLinkManager) + if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); USHORT nCount = rLinks.Count(); @@ -1360,7 +1361,7 @@ void ScDocument::UpdateAreaLinks() void ScDocument::DeleteAreaLinksOnTab( SCTAB nTab ) { - if (pLinkManager) + if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); USHORT nPos = 0; @@ -1379,7 +1380,7 @@ void ScDocument::DeleteAreaLinksOnTab( SCTAB nTab ) void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ) { - if (pLinkManager) + if (GetLinkManager()) { bool bAnyUpdate = false; diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 793be9a8c2e9..de27a80b17ee 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -223,7 +223,7 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell ) if ( pShell && !pShell->IsLoading() ) // #88438# don't call GetTitle while loading aName = pShell->GetTitle(); pDrawLayer = new ScDrawLayer( this, aName ); - if (pLinkManager) + if (GetLinkManager()) pDrawLayer->SetLinkManager( pLinkManager ); // Drawing pages are accessed by table number, so they must also be present diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index e5af00781cff..0150593fa6ef 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -115,13 +115,14 @@ struct ScLessDefaultAttr typedef std::set ScDefaultAttrSet; -void ScDocument::MakeTable( SCTAB nTab ) +void ScDocument::MakeTable( SCTAB nTab,bool _bNeedsNameCheck ) { if ( ValidTab(nTab) && !pTab[nTab] ) { String aString = ScGlobal::GetRscString(STR_TABLE_DEF); //"Tabelle" aString += String::CreateFromInt32(nTab+1); - CreateValidTabName( aString ); // keine doppelten + if ( _bNeedsNameCheck ) + CreateValidTabName( aString ); // keine doppelten pTab[nTab] = new ScTable(this, nTab, aString); ++nMaxTableNumber; @@ -219,7 +220,7 @@ BOOL ScDocument::ValidNewTabName( const String& rName ) const { String aOldName; pTab[i]->GetName(aOldName); - bValid = !ScGlobal::pTransliteration->isEqual( rName, aOldName ); + bValid = !ScGlobal::GetpTransliteration()->isEqual( rName, aOldName ); } return bValid; } @@ -464,7 +465,7 @@ BOOL ScDocument::RenameTab( SCTAB nTab, const String& rName, BOOL /* bUpdateRef { String aOldName; pTab[i]->GetName(aOldName); - bValid = !ScGlobal::pTransliteration->isEqual( rName, aOldName ); + bValid = !ScGlobal::GetpTransliteration()->isEqual( rName, aOldName ); } if (bValid) { diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx index a92d1681ec0e..a2d21079826d 100644 --- a/sc/source/core/data/dpgroup.cxx +++ b/sc/source/core/data/dpgroup.cxx @@ -250,7 +250,7 @@ String lcl_GetDateGroupName( sal_Int32 nDatePart, sal_Int32 nValue, SvNumberForm break; case com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS: //! cache getMonths() result? - aRet = ScGlobal::pCalendar->getDisplayName( + aRet = ScGlobal::GetCalendar()->getDisplayName( ::com::sun::star::i18n::CalendarDisplayIndex::MONTH, sal_Int16(nValue-1), 0 ); // 0-based, get short name break; diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 1f1ebbc45d18..787875fcb5ff 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -1098,7 +1098,7 @@ bool lcl_IsAtStart( const String& rList, const String& rSearch, sal_Int32& rMatc } } - if ( bParsed && ScGlobal::pTransliteration->isEqual( aDequoted, rSearch ) ) + if ( bParsed && ScGlobal::GetpTransliteration()->isEqual( aDequoted, rSearch ) ) { nMatchList = nQuoteEnd; // match count in the list string, including quotes nMatchSearch = rSearch.Len(); @@ -1107,7 +1107,7 @@ bool lcl_IsAtStart( const String& rList, const String& rSearch, sal_Int32& rMatc else { // otherwise look for search string at the start of rList - ScGlobal::pTransliteration->equals( rList, 0, rList.Len(), nMatchList, + ScGlobal::GetpTransliteration()->equals( rList, 0, rList.Len(), nMatchList, rSearch, 0, rSearch.Len(), nMatchSearch ); } diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 63acede160c9..d1fad68f16a2 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -1192,20 +1192,20 @@ bool ScDPOutput::GetDataResultPositionData(vector& bool lcl_IsNamedDataField( const ScDPGetPivotDataField& rTarget, const String& rSourceName, const String& rGivenName ) { // match one of the names, ignoring case - return ScGlobal::pTransliteration->isEqual( rTarget.maFieldName, rSourceName ) || - ScGlobal::pTransliteration->isEqual( rTarget.maFieldName, rGivenName ); + return ScGlobal::GetpTransliteration()->isEqual( rTarget.maFieldName, rSourceName ) || + ScGlobal::GetpTransliteration()->isEqual( rTarget.maFieldName, rGivenName ); } bool lcl_IsNamedCategoryField( const ScDPGetPivotDataField& rFilter, const ScDPOutLevelData& rField ) { //! name from source instead of caption? - return ScGlobal::pTransliteration->isEqual( rFilter.maFieldName, rField.aCaption ); + return ScGlobal::GetpTransliteration()->isEqual( rFilter.maFieldName, rField.aCaption ); } bool lcl_IsCondition( const sheet::MemberResult& rResultEntry, const ScDPGetPivotDataField& rFilter ) { //! handle numeric conditions? - return ScGlobal::pTransliteration->isEqual( rResultEntry.Name, rFilter.maValStr ); + return ScGlobal::GetpTransliteration()->isEqual( rResultEntry.Name, rFilter.maValStr ); } bool lcl_CheckPageField( const ScDPOutLevelData& rField, diff --git a/sc/source/core/data/dptabdat.cxx b/sc/source/core/data/dptabdat.cxx index a58241cea416..41e44f84b647 100644 --- a/sc/source/core/data/dptabdat.cxx +++ b/sc/source/core/data/dptabdat.cxx @@ -66,7 +66,7 @@ BOOL ScDPItemData::IsCaseInsEqual( const ScDPItemData& r ) const //! inline? return bHasValue ? ( r.bHasValue && rtl::math::approxEqual( fValue, r.fValue ) ) : ( !r.bHasValue && - ScGlobal::pTransliteration->isEqual( aString, r.aString ) ); + ScGlobal::GetpTransliteration()->isEqual( aString, r.aString ) ); } size_t ScDPItemData::Hash() const @@ -115,7 +115,7 @@ sal_Int32 ScDPItemData::Compare( const ScDPItemData& rA, else if ( rB.bHasValue ) return 1; // values first else - return ScGlobal::pCollator->compareString( rA.aString, rB.aString ); + return ScGlobal::GetCollator()->compareString( rA.aString, rB.aString ); } // --------------------------------------------------------------------------- diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index 959e0342fe38..3e9a7586fd1a 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -2505,14 +2505,14 @@ ScDPMember* ScDPMembers::getByIndex(long nIndex) const else if ( nHier == SC_DAPI_HIERARCHY_WEEK && nLev == SC_DAPI_LEVEL_WEEKDAY ) { nVal = nIndex; // DayOfWeek is 0-based - aName = ScGlobal::pCalendar->getDisplayName( + aName = ScGlobal::GetCalendar()->getDisplayName( ::com::sun::star::i18n::CalendarDisplayIndex::DAY, sal::static_int_cast(nVal), 0 ); } else if ( nHier == SC_DAPI_HIERARCHY_QUARTER && nLev == SC_DAPI_LEVEL_MONTH ) { nVal = nIndex; // Month is 0-based - aName = ScGlobal::pCalendar->getDisplayName( + aName = ScGlobal::GetCalendar()->getDisplayName( ::com::sun::star::i18n::CalendarDisplayIndex::MONTH, sal::static_int_cast(nVal), 0 ); } diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 3320e9a9a95c..88ff065572b4 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -559,24 +559,9 @@ void ScGlobal::Init() //! Wenn Sortierung etc. von der Sprache der installierten Offfice-Version //! abhaengen sollen, hier "Application::GetSettings().GetUILanguage()" - LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage(); - pLocale = new ::com::sun::star::lang::Locale( Application::GetSettings().GetLocale()); pSysLocale = new SvtSysLocale; pCharClass = pSysLocale->GetCharClassPtr(); pLocaleData = pSysLocale->GetLocaleDataPtr(); - pCalendar = new CalendarWrapper( ::comphelper::getProcessServiceFactory() ); - pCalendar->loadDefaultCalendar( *pLocale ); - pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() ); - pCollator->loadDefaultCollator( *pLocale, SC_COLLATOR_IGNORES ); - pCaseCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() ); - pCaseCollator->loadDefaultCollator( *pLocale, 0 ); - pTransliteration = new ::utl::TransliterationWrapper( - ::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_IGNORECASE ); - pTransliteration->loadModuleIfNeeded( eOfficeLanguage ); - pCaseTransliteration = new ::utl::TransliterationWrapper( - ::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_CASESENSE ); - pCaseTransliteration->loadModuleIfNeeded( eOfficeLanguage ); - pScIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), *pLocale ); ppRscString = new String *[ STR_COUNT ]; for( USHORT nC = 0 ; nC < STR_COUNT ; nC++ ) ppRscString[ nC ] = NULL; @@ -1766,6 +1751,7 @@ ScFunctionMgr::ScFunctionMgr() aCatLists[i] = new List; pRootList = aCatLists[0]; // Gesamtliste ("Alle") erstellen + CollatorWrapper* pCaseCollator = ScGlobal::GetCaseCollator(); for ( n=0; nGetObject(nTmpCnt); - if ( ScGlobal::pCaseCollator->compareString( - *pDesc->pFuncName, *pTmpDesc->pFuncName ) == COMPARE_LESS ) + if ( pCaseCollator->compareString(*pDesc->pFuncName, *pTmpDesc->pFuncName ) == COMPARE_LESS ) break; } pRootList->Insert((void*)pDesc, nTmpCnt); // Einsortieren @@ -1949,6 +1934,13 @@ sal_uInt32 ScFunctionCategory::getNumber() const utl::TransliterationWrapper* ScGlobal::GetpTransliteration() //add by CHINA001 { + if ( !pTransliteration ) + { + const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage(); + pTransliteration = new ::utl::TransliterationWrapper( + ::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_IGNORECASE ); + pTransliteration->loadModuleIfNeeded( eOfficeLanguage ); + } DBG_ASSERT( pTransliteration, "ScGlobal::GetpTransliteration() called before ScGlobal::Init()"); @@ -1962,3 +1954,57 @@ const LocaleDataWrapper* ScGlobal::GetpLocaleData() "ScGlobal::GetpLocaleData() called before ScGlobal::Init()"); return pLocaleData; } +CalendarWrapper* ScGlobal::GetCalendar() +{ + if ( !pCalendar ) + { + pCalendar = new CalendarWrapper( ::comphelper::getProcessServiceFactory() ); + pCalendar->loadDefaultCalendar( *GetLocale() ); + } + return pCalendar; +} +CollatorWrapper* ScGlobal::GetCollator() +{ + if ( !pCollator ) + { + pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() ); + pCollator->loadDefaultCollator( *GetLocale(), SC_COLLATOR_IGNORES ); + } // if ( !pCollator ) + return pCollator; +} +CollatorWrapper* ScGlobal::GetCaseCollator() +{ + if ( !pCaseCollator ) + { + pCaseCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() ); + pCaseCollator->loadDefaultCollator( *GetLocale(), 0 ); + } // if ( !pCaseCollator ) + return pCaseCollator; +} +::utl::TransliterationWrapper* ScGlobal::GetCaseTransliteration() +{ + if ( !pCaseTransliteration ) + { + const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage(); + pCaseTransliteration = new ::utl::TransliterationWrapper(::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_CASESENSE ); + pCaseTransliteration->loadModuleIfNeeded( eOfficeLanguage ); + } // if ( !pCaseTransliteration ) + return pCaseTransliteration; +} +IntlWrapper* ScGlobal::GetScIntlWrapper() +{ + if ( !pScIntlWrapper ) + { + pScIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), *GetLocale() ); + } + return pScIntlWrapper; +} +::com::sun::star::lang::Locale* ScGlobal::GetLocale() +{ + if ( !pLocale ) + { + pLocale = new ::com::sun::star::lang::Locale( Application::GetSettings().GetLocale()); + } + return pLocale; +} + diff --git a/sc/source/core/data/pivot2.cxx b/sc/source/core/data/pivot2.cxx index db02c921be98..e12df0cda6e5 100644 --- a/sc/source/core/data/pivot2.cxx +++ b/sc/source/core/data/pivot2.cxx @@ -63,7 +63,6 @@ using ::com::sun::star::sheet::DataPilotFieldReference; // STATIC DATA ----------------------------------------------------------- - // ============================================================================ LabelData::LabelData( const String& rName, short nCol, bool bIsValue ) : diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx index 0121eca685e4..ff8f7bb76c5c 100644 --- a/sc/source/core/data/poolhelp.cxx +++ b/sc/source/core/data/poolhelp.cxx @@ -46,26 +46,16 @@ // ----------------------------------------------------------------------- ScPoolHelper::ScPoolHelper( ScDocument* pSourceDoc ) +:pFormTable(NULL) +,pEditPool(NULL) +,pEnginePool(NULL) +,m_pSourceDoc(pSourceDoc) { DBG_ASSERT( pSourceDoc, "ScPoolHelper: no document" ); - pDocPool = new ScDocumentPool; pDocPool->FreezeIdRanges(); mxStylePool = new ScStyleSheetPool( *pDocPool, pSourceDoc ); - - pFormTable = new SvNumberFormatter( pSourceDoc->GetServiceManager(), ScGlobal::eLnge ); - pFormTable->SetColorLink( LINK( pSourceDoc, ScDocument, GetUserDefinedColor ) ); - pFormTable->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT ); - - pEditPool = EditEngine::CreatePool(); - pEditPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); - pEditPool->FreezeIdRanges(); - pEditPool->SetFileFormatVersion( SOFFICE_FILEFORMAT_50 ); // used in ScGlobal::EETextObjEqual - - pEnginePool = EditEngine::CreatePool(); - pEnginePool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); - pEnginePool->FreezeIdRanges(); } ScPoolHelper::~ScPoolHelper() @@ -76,12 +66,49 @@ ScPoolHelper::~ScPoolHelper() mxStylePool.clear(); SfxItemPool::Free(pDocPool); } - +SfxItemPool* ScPoolHelper::GetEditPool() const +{ + if ( !pEditPool ) + { + pEditPool = EditEngine::CreatePool(); + pEditPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); + pEditPool->FreezeIdRanges(); + pEditPool->SetFileFormatVersion( SOFFICE_FILEFORMAT_50 ); // used in ScGlobal::EETextObjEqual + } + return pEditPool; +} +SfxItemPool* ScPoolHelper::GetEnginePool() const +{ + if ( !pEnginePool ) + { + pEnginePool = EditEngine::CreatePool(); + pEnginePool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); + pEnginePool->FreezeIdRanges(); + } // ifg ( pEnginePool ) + return pEnginePool; +} +SvNumberFormatter* ScPoolHelper::GetFormTable() const +{ + if ( !pFormTable ) + { + pFormTable = new SvNumberFormatter( m_pSourceDoc->GetServiceManager(), ScGlobal::eLnge ); + pFormTable->SetColorLink( LINK( m_pSourceDoc, ScDocument, GetUserDefinedColor ) ); + pFormTable->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT ); + + USHORT d,m,y; + aOpt.GetDate( d,m,y ); + pFormTable->ChangeNullDate( d,m,y ); + pFormTable->ChangeStandardPrec( (USHORT)aOpt.GetStdPrecision() ); + pFormTable->SetYear2000( aOpt.GetYear2000() ); + } + return pFormTable; +} void ScPoolHelper::SourceDocumentGone() { // reset all pointers to the source document mxStylePool->SetDocument( NULL ); - pFormTable->SetColorLink( Link() ); + if ( pFormTable ) + pFormTable->SetColorLink( Link() ); } // ----------------------------------------------------------------------- diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx index ca78acc8a1e0..260385d6feac 100644 --- a/sc/source/core/data/stlpool.cxx +++ b/sc/source/core/data/stlpool.cxx @@ -263,7 +263,7 @@ void ScStyleSheetPool::CreateStandardStyles() String aStr; xub_StrLen nStrLen; String aHelpFile;//XXX JN welcher Text??? - ULONG nNumFmt = 0L; + //ULONG nNumFmt = 0L; SfxItemSet* pSet = NULL; SfxItemSet* pHFSet = NULL; SvxSetItem* pHFSetItem = NULL; @@ -345,10 +345,11 @@ void ScStyleSheetPool::CreateStandardStyles() pSheet->SetParent( SCSTR( STR_STYLENAME_RESULT ) ); pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_CELL_ERG1 ); - pSet = &pSheet->GetItemSet(); - nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_CURRENCY, - ScGlobal::eLnge ); - pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) ); + // will now be done in GetItemSet(); + // pSet = &pSheet->GetItemSet(); + // nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_CURRENCY, + // ScGlobal::eLnge ); + // pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) ); //---------------- // 4. Ueberschrift diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index bad2c664cc4d..4452cd357132 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -53,10 +53,11 @@ #include #include "attrib.hxx" + #include // GetSettings() #include "globstr.hrc" - +#include "sc.hrc" //------------------------------------------------------------------------ TYPEINIT1(ScStyleSheet, SfxStyleSheet); @@ -247,6 +248,18 @@ SfxItemSet& __EXPORT ScStyleSheet::GetItemSet() break; } bMySet = TRUE; + } // if ( !pSet ) + if ( nHelpId == HID_SC_SHEET_CELL_ERG1 ) + { + if ( !pSet->Count() ) + { + ScDocument* pDoc = ((ScStyleSheetPool&)GetPool()).GetDocument(); + if ( pDoc ) + { + ULONG nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_CURRENCY,ScGlobal::eLnge ); + pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) ); + } // if ( pDoc && pDoc->IsLoadingDone() ) + } } return *pSet; diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index ae299fdf5fca..01dc74f8644e 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -171,8 +171,8 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 ) BOOL ScTable::IsSortCollatorGlobal() const { - return pSortCollator == ScGlobal::pCollator || - pSortCollator == ScGlobal::pCaseCollator; + return pSortCollator == ScGlobal::GetCollator() || + pSortCollator == ScGlobal::GetCaseCollator(); } @@ -188,8 +188,8 @@ void ScTable::InitSortCollator( const ScSortParam& rPar ) else { // SYSTEM DestroySortCollator(); - pSortCollator = (rPar.bCaseSens ? ScGlobal::pCaseCollator : - ScGlobal::pCollator); + pSortCollator = (rPar.bCaseSens ? ScGlobal::GetCaseCollator() : + ScGlobal::GetCollator()); } } @@ -948,10 +948,10 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam, long nPos = -1; SCSIZE i = 0; BOOL bMatchWholeCell = pDocument->GetDocOptions().IsMatchWholeCell(); - CollatorWrapper* pCollator = (rParam.bCaseSens ? ScGlobal::pCaseCollator : - ScGlobal::pCollator); + CollatorWrapper* pCollator = (rParam.bCaseSens ? ScGlobal::GetCaseCollator() : + ScGlobal::GetCollator()); ::utl::TransliterationWrapper* pTransliteration = (rParam.bCaseSens ? - ScGlobal::pCaseTransliteration : ScGlobal::pTransliteration); + ScGlobal::GetCaseTransliteration() : ScGlobal::GetpTransliteration()); while ( (i < nEntryCount) && rParam.GetEntry(i).bDoQuery ) { diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx index 9ca7b29b745e..09362b9996ed 100644 --- a/sc/source/core/data/table6.cxx +++ b/sc/source/core/data/table6.cxx @@ -658,7 +658,7 @@ BOOL ScTable::SearchAndReplace(const SvxSearchItem& rSearchItem, { // SearchParam no longer needed - SearchOptions contains all settings com::sun::star::util::SearchOptions aSearchOptions = rSearchItem.GetSearchOptions(); - aSearchOptions.Locale = *ScGlobal::pLocale; + aSearchOptions.Locale = *ScGlobal::GetLocale(); // #107259# reflect UseAsianOptions flag in SearchOptions // (use only ignore case and width if asian options are disabled). diff --git a/sc/source/core/inc/poolhelp.hxx b/sc/source/core/inc/poolhelp.hxx index 0d43278978b8..a60b8db462ab 100644 --- a/sc/source/core/inc/poolhelp.hxx +++ b/sc/source/core/inc/poolhelp.hxx @@ -34,6 +34,7 @@ #include #include #include +#include "docoptio.hxx" class ScDocument; class ScDocumentPool; @@ -45,11 +46,13 @@ class SfxItemPool; class ScPoolHelper : public vos::OReference { private: + ScDocOptions aOpt; ScDocumentPool* pDocPool; rtl::Reference< ScStyleSheetPool > mxStylePool; - SvNumberFormatter* pFormTable; - SfxItemPool* pEditPool; // EditTextObjectPool - SfxItemPool* pEnginePool; // EditEnginePool + mutable SvNumberFormatter* pFormTable; + mutable SfxItemPool* pEditPool; // EditTextObjectPool + mutable SfxItemPool* pEnginePool; // EditEnginePool + ScDocument* m_pSourceDoc; public: ScPoolHelper( ScDocument* pSourceDoc ); @@ -61,9 +64,11 @@ public: // access to pointers (are never 0): ScDocumentPool* GetDocPool() const { return pDocPool; } ScStyleSheetPool* GetStylePool() const { return mxStylePool.get(); } - SvNumberFormatter* GetFormTable() const { return pFormTable; } - SfxItemPool* GetEditPool() const { return pEditPool; } - SfxItemPool* GetEnginePool() const { return pEnginePool; } + SvNumberFormatter* GetFormTable() const; + SfxItemPool* GetEditPool() const; + SfxItemPool* GetEnginePool() const; + + void SetFormTableOpt(const ScDocOptions& rOpt) { aOpt = rOpt; } }; #endif diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index 05af63a2ff2f..3b8a88c47e2f 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -1026,11 +1026,11 @@ short ScAutoFormat::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const ((ScAutoFormatData*)pKey1)->GetName(aStr1); ((ScAutoFormatData*)pKey2)->GetName(aStr2); String aStrStandard = ScGlobal::GetRscString(STR_STYLENAME_STANDARD); - if ( ScGlobal::pTransliteration->isEqual( aStr1, aStrStandard ) ) + if ( ScGlobal::GetpTransliteration()->isEqual( aStr1, aStrStandard ) ) return -1; - if ( ScGlobal::pTransliteration->isEqual( aStr2, aStrStandard ) ) + if ( ScGlobal::GetpTransliteration()->isEqual( aStr2, aStrStandard ) ) return 1; - return (short) ScGlobal::pTransliteration->compareString( aStr1, aStr2 ); + return (short) ScGlobal::GetpTransliteration()->compareString( aStr1, aStr2 ); } BOOL ScAutoFormat::Load() diff --git a/sc/source/core/tool/callform.cxx b/sc/source/core/tool/callform.cxx index c3634db854a6..b98525e45968 100644 --- a/sc/source/core/tool/callform.cxx +++ b/sc/source/core/tool/callform.cxx @@ -156,7 +156,7 @@ FuncData::FuncData(const FuncData& rData) : short FuncCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const { - return (short) ScGlobal::pTransliteration->compareString( + return (short) ScGlobal::GetpTransliteration()->compareString( ((FuncData*)pKey1)->aInternalName, ((FuncData*)pKey2)->aInternalName ); } @@ -205,7 +205,7 @@ static ModuleCollection aModuleCollection; short ModuleCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const { - return (short) ScGlobal::pTransliteration->compareString( + return (short) ScGlobal::GetpTransliteration()->compareString( ((ModuleData*)pKey1)->aName, ((ModuleData*)pKey2)->aName ); } diff --git a/sc/source/core/tool/collect.cxx b/sc/source/core/tool/collect.cxx index c5d4df22ccea..e66c14ee0317 100644 --- a/sc/source/core/tool/collect.cxx +++ b/sc/source/core/tool/collect.cxx @@ -96,7 +96,7 @@ ScCollection::~ScCollection() } //------------------------------------------------------------------------ - +USHORT ScCollection::GetCount() const { return nCount; } void ScCollection::AtFree(USHORT nIndex) { if ((pItems) && (nIndex < nCount)) @@ -359,7 +359,8 @@ ScDataObject* TypedStrData::Clone() const { return new TypedStrData(*this); } - +TypedScStrCollection::~TypedScStrCollection() +{} ScDataObject* TypedScStrCollection::Clone() const { return new TypedScStrCollection(*this); @@ -396,10 +397,10 @@ short TypedScStrCollection::Compare( ScDataObject* pKey1, ScDataObject* pKey2 ) // Strings vergleichen: //--------------------- if ( bCaseSensitive ) - nResult = (short) ScGlobal::pCaseTransliteration->compareString( + nResult = (short) ScGlobal::GetCaseTransliteration()->compareString( rData1.aStrValue, rData2.aStrValue ); else - nResult = (short) ScGlobal::pTransliteration->compareString( + nResult = (short) ScGlobal::GetpTransliteration()->compareString( rData1.aStrValue, rData2.aStrValue ); } } @@ -435,12 +436,12 @@ BOOL TypedScStrCollection::FindText( const String& rStart, String& rResult, TypedStrData* pData = (TypedStrData*) pItems[i]; if (pData->nStrType) { - if ( ScGlobal::pTransliteration->isMatch( rStart, pData->aStrValue ) ) + if ( ScGlobal::GetpTransliteration()->isMatch( rStart, pData->aStrValue ) ) { // If the collection is case sensitive, it may contain several entries // that are equal when compared case-insensitive. They are skipped here. if ( !bCaseSensitive || !aOldResult.Len() || - !ScGlobal::pTransliteration->isEqual( + !ScGlobal::GetpTransliteration()->isEqual( pData->aStrValue, aOldResult ) ) { rResult = pData->aStrValue; @@ -463,12 +464,12 @@ BOOL TypedScStrCollection::FindText( const String& rStart, String& rResult, TypedStrData* pData = (TypedStrData*) pItems[i]; if (pData->nStrType) { - if ( ScGlobal::pTransliteration->isMatch( rStart, pData->aStrValue ) ) + if ( ScGlobal::GetpTransliteration()->isMatch( rStart, pData->aStrValue ) ) { // If the collection is case sensitive, it may contain several entries // that are equal when compared case-insensitive. They are skipped here. if ( !bCaseSensitive || !aOldResult.Len() || - !ScGlobal::pTransliteration->isEqual( + !ScGlobal::GetpTransliteration()->isEqual( pData->aStrValue, aOldResult ) ) { rResult = pData->aStrValue; @@ -491,7 +492,7 @@ BOOL TypedScStrCollection::GetExactMatch( String& rString ) const for (USHORT i=0; inStrType && ScGlobal::pTransliteration->isEqual( + if ( pData->nStrType && ScGlobal::GetpTransliteration()->isEqual( pData->aStrValue, rString ) ) { rString = pData->aStrValue; // String anpassen diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 599d7c63d68b..0da842e6ca5a 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2973,7 +2973,7 @@ BOOL ScCompiler::IsColRowName( const String& rName ) ; // nothing, prevent compiler warning break; } - if ( ScGlobal::pTransliteration->isEqual( aStr, aName ) ) + if ( ScGlobal::GetpTransliteration()->isEqual( aStr, aName ) ) { aRef.InitFlags(); aRef.nCol = aIter.GetCol(); @@ -3102,7 +3102,7 @@ BOOL ScCompiler::IsColRowName( const String& rName ) ; // nothing, prevent compiler warning break; } - if ( ScGlobal::pTransliteration->isEqual( aStr, aName ) ) + if ( ScGlobal::GetpTransliteration()->isEqual( aStr, aName ) ) { SCCOL nCol = aIter.GetCol(); SCROW nRow = aIter.GetRow(); diff --git a/sc/source/core/tool/dbcolect.cxx b/sc/source/core/tool/dbcolect.cxx index e6c039b5d79f..61ca8ee00195 100644 --- a/sc/source/core/tool/dbcolect.cxx +++ b/sc/source/core/tool/dbcolect.cxx @@ -701,7 +701,7 @@ short ScDBCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const { const String& rStr1 = ((ScDBData*)pKey1)->GetName(); const String& rStr2 = ((ScDBData*)pKey2)->GetName(); - return (short) ScGlobal::pTransliteration->compareString( rStr1, rStr2 ); + return (short) ScGlobal::GetpTransliteration()->compareString( rStr1, rStr2 ); } // IsEqual - alles gleich diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 195366271f0d..1145fe2ed3c4 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -734,8 +734,8 @@ double ScInterpreter::CompareFunc( const ScCompare& rComp, ScCompareOptions* pOp else if (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL) { ::utl::TransliterationWrapper* pTransliteration = - (pOptions->bIgnoreCase ? ScGlobal::pTransliteration : - ScGlobal::pCaseTransliteration); + (pOptions->bIgnoreCase ? ScGlobal::GetpTransliteration() : + ScGlobal::GetCaseTransliteration()); bool bMatch; if (pOptions->bMatchWholeCell) bMatch = pTransliteration->isEqual( *rComp.pVal[0], *rComp.pVal[1]); @@ -752,17 +752,17 @@ double ScInterpreter::CompareFunc( const ScCompare& rComp, ScCompareOptions* pOp fRes = (bMatch ? 0 : 1); } else if (pOptions->bIgnoreCase) - fRes = (double) ScGlobal::pCollator->compareString( + fRes = (double) ScGlobal::GetCollator()->compareString( *rComp.pVal[ 0 ], *rComp.pVal[ 1 ] ); else - fRes = (double) ScGlobal::pCaseCollator->compareString( + fRes = (double) ScGlobal::GetCaseCollator()->compareString( *rComp.pVal[ 0 ], *rComp.pVal[ 1 ] ); } else if (pDok->GetDocOptions().IsIgnoreCase()) - fRes = (double) ScGlobal::pCollator->compareString( + fRes = (double) ScGlobal::GetCollator()->compareString( *rComp.pVal[ 0 ], *rComp.pVal[ 1 ] ); else - fRes = (double) ScGlobal::pCaseCollator->compareString( + fRes = (double) ScGlobal::GetCaseCollator()->compareString( *rComp.pVal[ 0 ], *rComp.pVal[ 1 ] ); } return fRes; @@ -1876,7 +1876,7 @@ void ScInterpreter::ScCell() String aFuncResult; ScBaseCell* pCell = GetCell( aCellPos ); - ScCellKeywordTranslator::transKeyword(aInfoType, ScGlobal::pLocale, ocCell); + ScCellKeywordTranslator::transKeyword(aInfoType, ScGlobal::GetLocale(), ocCell); // *** ADDRESS INFO *** if( aInfoType.EqualsAscii( "COL" ) ) @@ -3975,7 +3975,7 @@ static sal_Int32 lcl_CompareMatrix2Query( SCSIZE i, const ScMatrix& rMat, const String& rStr1 = rMat.GetString(i); const String& rStr2 = *rEntry.pStr; - return ScGlobal::pCollator->compareString( rStr1, rStr2); // case-insensitive + return ScGlobal::GetCollator()->compareString( rStr1, rStr2); // case-insensitive } /** returns the last item with the identical value as the original item @@ -5375,12 +5375,13 @@ void ScInterpreter::CalculateLookup(BOOL HLookup) String aParamStr = *rEntry.pStr; if ( bSorted ) { + static CollatorWrapper* pCollator = ScGlobal::GetCollator(); for (SCSIZE i = 0; i < nMatCount; i++) { if (HLookup ? pMat->IsString(i, 0) : pMat->IsString(0, i)) { sal_Int32 nRes = - ScGlobal::pCollator->compareString( HLookup ? pMat->GetString(i,0) : pMat->GetString(0,i), aParamStr); + pCollator->compareString( HLookup ? pMat->GetString(i,0) : pMat->GetString(0,i), aParamStr); if (nRes <= 0) nDelta = i; else if (i>0) // #i2168# ignore first mismatch @@ -5396,7 +5397,7 @@ void ScInterpreter::CalculateLookup(BOOL HLookup) { if (HLookup ? pMat->IsString(i, 0) : pMat->IsString(0, i)) { - if ( ScGlobal::pTransliteration->isEqual( + if ( ScGlobal::GetpTransliteration()->isEqual( HLookup ? pMat->GetString(i,0) : pMat->GetString(0,i), aParamStr ) ) { nDelta = i; @@ -5734,7 +5735,7 @@ BOOL ScInterpreter::GetDBParams(SCTAB& rTab, ScQueryParam& rParam, { ScBaseCell* pCell = GetCell( aLook ); GetCellString( aCellStr, pCell ); - bFound = ScGlobal::pTransliteration->isEqual( aCellStr, aStr ); + bFound = ScGlobal::GetpTransliteration()->isEqual( aCellStr, aStr ); if (!bFound) aLook.IncCol(); } diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 41ddf3dc0aa0..5fb45755eb7c 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -2796,7 +2796,7 @@ void ScInterpreter::ScInfo() if( MustHaveParamCount( GetByte(), 1 ) ) { String aStr = GetString(); - ScCellKeywordTranslator::transKeyword(aStr, ScGlobal::pLocale, ocInfo); + ScCellKeywordTranslator::transKeyword(aStr, ScGlobal::GetLocale(), ocInfo); if( aStr.EqualsAscii( "SYSTEM" ) ) PushString( String( RTL_CONSTASCII_USTRINGPARAM( SC_INFO_OSVERSION ) ) ); else if( aStr.EqualsAscii( "OSVERSION" ) ) diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 5c11249ef6be..775b0207be59 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -624,7 +624,7 @@ ScRangePairList_QsortNameCompare( const void* p1, const void* p2 ) { ps1->pDoc->GetName( rStartPos1.Tab(), aStr1 ); ps2->pDoc->GetName( rStartPos2.Tab(), aStr2 ); - nComp = ScGlobal::pCollator->compareString( aStr1, aStr2 ); + nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 ); } switch ( nComp ) { @@ -655,7 +655,7 @@ ScRangePairList_QsortNameCompare( const void* p1, const void* p2 ) { ps1->pDoc->GetName( rEndPos1.Tab(), aStr1 ); ps2->pDoc->GetName( rEndPos2.Tab(), aStr2 ); - nComp = ScGlobal::pCollator->compareString( aStr1, aStr2 ); + nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 ); } switch ( nComp ) { diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index 24ed502e33b1..0f2475bc2f65 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -683,7 +683,7 @@ __cdecl #endif ScRangeData_QsortNameCompare( const void* p1, const void* p2 ) { - return (int) ScGlobal::pCollator->compareString( + return (int) ScGlobal::GetCollator()->compareString( (*(const ScRangeData**)p1)->GetName(), (*(const ScRangeData**)p2)->GetName() ); } diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx index bc3537d1c94a..24dd852c6a5f 100644 --- a/sc/source/core/tool/userlist.cxx +++ b/sc/source/core/tool/userlist.cxx @@ -153,7 +153,7 @@ StringCompare ScUserListData::Compare(const String& rSubStr1, const String& rSub else if (bFound2) return COMPARE_GREATER; else - return (StringCompare) ScGlobal::pCaseTransliteration->compareString( rSubStr1, rSubStr2 ); + return (StringCompare) ScGlobal::GetCaseTransliteration()->compareString( rSubStr1, rSubStr2 ); } StringCompare ScUserListData::ICompare(const String& rSubStr1, const String& rSubStr2) const @@ -179,7 +179,7 @@ StringCompare ScUserListData::ICompare(const String& rSubStr1, const String& rSu else if (bFound2) return COMPARE_GREATER; else - return (StringCompare) ScGlobal::pTransliteration->compareString( rSubStr1, rSubStr2 ); + return (StringCompare) ScGlobal::GetpTransliteration()->compareString( rSubStr1, rSubStr2 ); } ScUserList::ScUserList(USHORT nLim, USHORT nDel) : diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 2c6741811f3f..47f101f4c351 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -903,7 +903,7 @@ typedef ::std::vector< XclExpTabName > XclExpTabNameVec; inline bool operator<( const XclExpTabName& rArg1, const XclExpTabName& rArg2 ) { // compare the sheet names only - return ScGlobal::pCollator->compareString( rArg1.first, rArg2.first ) == COMPARE_LESS; + return ScGlobal::GetCollator()->compareString( rArg1.first, rArg2.first ) == COMPARE_LESS; } void XclExpTabInfo::CalcSortedIndexes() diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 6bc96c13d5b6..773862088155 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -82,7 +82,7 @@ sal_Unicode lcl_CharFromCombo( ComboBox& rCombo, const String& rList ) xub_StrLen nCount = rList.GetTokenCount('\t'); for ( xub_StrLen i=0; iisEqual( aStr, rList.GetToken(i,'\t') ) )//CHINA001 if ( ScGlobal::pTransliteration->isEqual( aStr, rList.GetToken(i,'\t') ) ) + if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rList.GetToken(i,'\t') ) )//CHINA001 if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rList.GetToken(i,'\t') ) ) c = (sal_Unicode)rList.GetToken(i+1,'\t').ToInt32(); } if (!c && aStr.Len()) diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 149856b4aa6b..d58777b9b5d5 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -43,13 +43,14 @@ #include #include #include -#include #include +#include #include #include #include #include +#include #include #include #include @@ -104,6 +105,61 @@ using namespace com::sun::star; #define SC_ROWCOUNT_ERROR (-1) +namespace +{ + ULONG lcl_getDBaseConnection(uno::Reference& _rDrvMgr,uno::Reference& _rConnection,String& _rTabName,const String& rFullFileName,rtl_TextEncoding eCharSet) + { + INetURLObject aURL; + aURL.SetSmartProtocol( INET_PROT_FILE ); + aURL.SetSmartURL( rFullFileName ); + _rTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true, + INetURLObject::DECODE_UNAMBIGUOUS ); + String aExtension = aURL.getExtension(); + aURL.removeSegment(); + aURL.removeFinalSlash(); + String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE); + uno::Reference xFactory = comphelper::getProcessServiceFactory(); + if (!xFactory.is()) return SCERR_EXPORT_CONNECT; + + _rDrvMgr.set( xFactory->createInstance( + rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ), + uno::UNO_QUERY); + DBG_ASSERT( _rDrvMgr.is(), "can't get DriverManager" ); + if (!_rDrvMgr.is()) return SCERR_EXPORT_CONNECT; + + // get connection + + String aConnUrl = String::CreateFromAscii("sdbc:dbase:"); + aConnUrl += aPath; + + svxform::ODataAccessCharsetHelper aHelper; + ::std::vector< rtl_TextEncoding > aEncodings; + aHelper.getSupportedTextEncodings( aEncodings ); + ::std::vector< rtl_TextEncoding >::iterator aIter = ::std::find(aEncodings.begin(),aEncodings.end(),(rtl_TextEncoding) eCharSet); + if ( aIter == aEncodings.end() ) + { + DBG_ERRORFILE( "DBaseImport: dbtools::OCharsetMap doesn't know text encoding" ); + return SCERR_IMPORT_CONNECT; + } // if ( aIter == aMap.end() ) + rtl::OUString aCharSetStr; + if ( RTL_TEXTENCODING_DONTKNOW != *aIter ) + { // it's not the virtual "system charset" + const char* pIanaName = rtl_getMimeCharsetFromTextEncoding( *aIter ); + OSL_ENSURE( pIanaName, "invalid mime name!" ); + if ( pIanaName ) + aCharSetStr = ::rtl::OUString::createFromAscii( pIanaName ); + } + + uno::Sequence aProps(2); + aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION); + aProps[0].Value <<= rtl::OUString( aExtension ); + aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET); + aProps[1].Value <<= aCharSetStr; + + _rConnection = _rDrvMgr->getConnectionWithInfo( aConnUrl, aProps ); + return 0L; + } +} // ----------------------------------------------------------------------- // MoveFile/KillFile/IsDocument: similar to SfxContentHelper @@ -201,48 +257,13 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet, try { - INetURLObject aURL; - aURL.SetSmartProtocol( INET_PROT_FILE ); - aURL.SetSmartURL( rFullFileName ); - String aTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true, - INetURLObject::DECODE_UNAMBIGUOUS ); - String aExtension = aURL.getExtension(); - aURL.removeSegment(); - aURL.removeFinalSlash(); - String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE); - - uno::Reference xFactory = comphelper::getProcessServiceFactory(); - if (!xFactory.is()) - return ERRCODE_IO_GENERAL; - - uno::Reference xDrvMan( xFactory->createInstance( - rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ), - uno::UNO_QUERY); - DBG_ASSERT( xDrvMan.is(), "can't get DriverManager" ); - if (!xDrvMan.is()) return SCERR_IMPORT_CONNECT; - - String aConnUrl = String::CreateFromAscii("sdbc:dbase:"); - aConnUrl += aPath; - - dbtools::OCharsetMap aMap; - dbtools::OCharsetMap::CharsetIterator aIter = aMap.find( (rtl_TextEncoding) eCharSet ); - if ( aIter == aMap.end() ) - { - DBG_ERRORFILE( "DBaseImport: dbtools::OCharsetMap doesn't know text encoding" ); - return SCERR_IMPORT_CONNECT; - } - rtl::OUString aCharSetStr = (*aIter).getIanaName(); - - uno::Sequence aProps(2); - aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION); - aProps[0].Value <<= rtl::OUString( aExtension ); - aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET); - aProps[1].Value <<= aCharSetStr; - - uno::Reference xConnection = - xDrvMan->getConnectionWithInfo( aConnUrl, aProps ); - DBG_ASSERT( xConnection.is(), "can't get Connection" ); - if (!xConnection.is()) return SCERR_IMPORT_CONNECT; + String aTabName; + uno::Reference xDrvMan; + uno::Reference xConnection; + ULONG nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet); + if ( !xConnection.is() || !xDrvMan.is() ) + return nRet; + ::utl::DisposableComponent aConnectionHelper(xConnection); long nRowCount = 0; if ( nRowCount < 0 ) @@ -252,10 +273,11 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet, } ScProgress aProgress( this, ScGlobal::GetRscString( STR_LOAD_DOC ), nRowCount ); - + uno::Reference xFactory = comphelper::getProcessServiceFactory(); uno::Reference xRowSet( xFactory->createInstance( rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ), uno::UNO_QUERY); + ::utl::DisposableComponent aRowSetHelper(xRowSet); uno::Reference xRowProp( xRowSet, uno::UNO_QUERY ); DBG_ASSERT( xRowProp.is(), "can't get RowSet" ); if (!xRowProp.is()) return SCERR_IMPORT_CONNECT; @@ -369,9 +391,6 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet, if ( nRowCount ) aProgress.SetStateOnPercent( nRow ); } - - comphelper::disposeComponent( xRowSet ); - comphelper::disposeComponent( xConnection ); } catch ( sdbc::SQLException& ) { @@ -733,91 +752,29 @@ ULONG ScDocShell::DBaseExport( const String& rFullFileName, CharSet eCharSet, BO aColNames.getArray(), aColTypes.getArray(), aColLengths.getArray(), aColScales.getArray(), bHasMemo, eCharSet ); - - INetURLObject aURL; - aURL.SetSmartProtocol( INET_PROT_FILE ); - aURL.SetSmartURL( rFullFileName ); - String aTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true, - INetURLObject::DECODE_UNAMBIGUOUS ); - String aExtension = aURL.getExtension(); - aURL.removeSegment(); - aURL.removeFinalSlash(); - String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE); - // also needed for exception catch SCROW nDocRow = 0; ScFieldEditEngine aEditEngine( aDocument.GetEditPool() ); String aString; + String aTabName; try { - uno::Reference xFactory = comphelper::getProcessServiceFactory(); - if (!xFactory.is()) return SCERR_EXPORT_CONNECT; - - uno::Reference xDrvMan( xFactory->createInstance( - rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ), - uno::UNO_QUERY); - DBG_ASSERT( xDrvMan.is(), "can't get DriverManager" ); - if (!xDrvMan.is()) return SCERR_EXPORT_CONNECT; - - // get connection - - String aConnUrl = String::CreateFromAscii("sdbc:dbase:"); - aConnUrl += aPath; - - dbtools::OCharsetMap aMap; - dbtools::OCharsetMap::CharsetIterator aIter = aMap.find( (rtl_TextEncoding) eCharSet ); - if ( aIter == aMap.end() ) - { - DBG_ERRORFILE( "DBaseExport: dbtools::OCharsetMap doesn't know text encoding" ); - return SCERR_EXPORT_CONNECT; - } - rtl::OUString aCharSetStr = (*aIter).getIanaName(); - - uno::Sequence aProps(2); - aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION); - aProps[0].Value <<= rtl::OUString( aExtension ); - aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET); - aProps[1].Value <<= aCharSetStr; - - uno::Reference xConnection = - xDrvMan->getConnectionWithInfo( aConnUrl, aProps ); - DBG_ASSERT( xConnection.is(), "can't get Connection" ); - if (!xConnection.is()) return SCERR_EXPORT_CONNECT; + uno::Reference xDrvMan; + uno::Reference xConnection; + ULONG nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet); + if ( !xConnection.is() || !xDrvMan.is() ) + return nRet; ::utl::DisposableComponent aConnectionHelper(xConnection); // get dBase driver - - uno::Reference xDriver; - BOOL bDriverFound = FALSE; - - uno::Reference xEnAcc( xDrvMan, uno::UNO_QUERY ); - DBG_ASSERT( xEnAcc.is(), "can't get DriverManager EnumerationAccess" ); - if (!xEnAcc.is()) return SCERR_EXPORT_CONNECT; - - uno::Reference xEnum = xEnAcc->createEnumeration(); - DBG_ASSERT( xEnum.is(), "can't get DriverManager Enumeration" ); - if (!xEnum.is()) return SCERR_EXPORT_CONNECT; - - while ( xEnum->hasMoreElements() && !bDriverFound ) - { - uno::Any aElement = xEnum->nextElement(); - if ( aElement >>= xDriver ) - if ( xDriver.is() && xDriver->acceptsURL( aConnUrl ) ) - bDriverFound = TRUE; - } - - DBG_ASSERT( bDriverFound, "can't get dBase driver" ); - if (!bDriverFound) return SCERR_EXPORT_CONNECT; + uno::Reference< sdbc::XDriverAccess> xAccess(xDrvMan,uno::UNO_QUERY); + uno::Reference< sdbcx::XDataDefinitionSupplier > xDDSup( xAccess->getDriverByURL( xConnection->getMetaData()->getURL() ), uno::UNO_QUERY ); + if ( !xDDSup.is() ) + return SCERR_EXPORT_CONNECT; // create table - - uno::Reference xDDSup( xDriver, uno::UNO_QUERY ); - DBG_ASSERT( xDDSup.is(), "can't get XDataDefinitionSupplier" ); - if (!xDDSup.is()) return SCERR_EXPORT_CONNECT; - - uno::Reference xTablesSupp = - xDDSup->getDataDefinitionByConnection( xConnection ); + uno::Reference xTablesSupp =xDDSup->getDataDefinitionByConnection( xConnection ); DBG_ASSERT( xTablesSupp.is(), "can't get Data Definition" ); if (!xTablesSupp.is()) return SCERR_EXPORT_CONNECT; @@ -893,7 +850,7 @@ ULONG ScDocShell::DBaseExport( const String& rFullFileName, CharSet eCharSet, BO // if (!xConnection.is()) return SCERR_EXPORT_CONNECT; // get row set for writing - + uno::Reference xFactory = comphelper::getProcessServiceFactory(); uno::Reference xRowSet( xFactory->createInstance( rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ), uno::UNO_QUERY); diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index 9f7c201c8aca..570d41f7885d 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -280,7 +280,7 @@ BOOL ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter, { String aName; pDoc->GetName( nTab, aName ); - if ( ScGlobal::pTransliteration->isEqual( + if ( ScGlobal::GetpTransliteration()->isEqual( ScGlobal::GetDocTabName( aFileName, aTabName ), aName ) ) { pDoc->RenameTab( nTab, diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 2faf148e5ac1..76330036b1f5 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -2127,7 +2127,7 @@ IMPL_LINK( ScAcceptChgDlg, ColCompareHdl, SvSortData*, pSortData ) if(nRightKind == SV_ITEM_ID_LBOXSTRING && nLeftKind == SV_ITEM_ID_LBOXSTRING ) { - eCompare= (StringCompare) ScGlobal::pCaseCollator->compareString( + eCompare= (StringCompare) ScGlobal::GetCaseCollator()->compareString( ((SvLBoxString*)pLeftItem)->GetText(), ((SvLBoxString*)pRightItem)->GetText()); diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 5f38fbf5c049..08dbd00de0f9 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -66,7 +66,7 @@ struct ScSolverOptionsEntry bool operator< (const ScSolverOptionsEntry& rOther) const { - return ( ScGlobal::pCollator->compareString( aDescription, rOther.aDescription ) == COMPARE_LESS ); + return ( ScGlobal::GetCollator()->compareString( aDescription, rOther.aDescription ) == COMPARE_LESS ); } }; diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index ec706252a737..cd63adc33989 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -60,6 +60,9 @@ #include #include #include +#include +#include +#include #include #include "docuno.hxx" @@ -224,15 +227,30 @@ ScModelObj::ScModelObj( ScDocShell* pDocSh ) : if ( pDocShell ) { pDocShell->GetDocument()->AddUnoObject(*this); // SfxModel is derived from SfxListener + } +} +ScModelObj::~ScModelObj() +{ + if (pDocShell) + pDocShell->GetDocument()->RemoveUnoObject(*this); + + if (xNumberAgg.is()) + xNumberAgg->setDelegator(uno::Reference()); + + delete pPrintFuncCache; +} + +uno::Reference< uno::XAggregation> ScModelObj::GetFormatter() +{ + if ( !xNumberAgg.is() ) + { // setDelegator veraendert den RefCount, darum eine Referenz selber halten // (direkt am m_refCount, um sich beim release nicht selbst zu loeschen) comphelper::increment( m_refCount ); - // waehrend des queryInterface braucht man ein Ref auf das // SvNumberFormatsSupplierObj, sonst wird es geloescht. - uno::Reference xFormatter(new SvNumberFormatsSupplierObj( - pDocShell->GetDocument()->GetFormatTable() )); + uno::Reference xFormatter(new SvNumberFormatsSupplierObj(pDocShell->GetDocument()->GetFormatTable() )); { xNumberAgg.set(uno::Reference( xFormatter, uno::UNO_QUERY )); // extra block to force deletion of the temporary before setDelegator @@ -243,20 +261,9 @@ ScModelObj::ScModelObj( ScDocShell* pDocSh ) : if (xNumberAgg.is()) xNumberAgg->setDelegator( (cppu::OWeakObject*)this ); - comphelper::decrement( m_refCount ); - } -} - -ScModelObj::~ScModelObj() -{ - if (pDocShell) - pDocShell->GetDocument()->RemoveUnoObject(*this); - - if (xNumberAgg.is()) - xNumberAgg->setDelegator(uno::Reference()); - - delete pPrintFuncCache; + } // if ( !xNumberAgg.is() ) + return xNumberAgg; } ScDocument* ScModelObj::GetDocument() const @@ -316,8 +323,19 @@ uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) SC_QUERYINTERFACE( util::XChangesNotifier ) uno::Any aRet(SfxBaseModel::queryInterface( rType )); - if ( !aRet.hasValue() && xNumberAgg.is() ) - aRet = xNumberAgg->queryAggregation( rType ); + if ( !aRet.hasValue() + && rType != ::getCppuType((uno::Reference< com::sun::star::document::XDocumentEventBroadcaster>*)0) + && rType != ::getCppuType((uno::Reference< com::sun::star::frame::XController>*)0) + && rType != ::getCppuType((uno::Reference< com::sun::star::frame::XFrame>*)0) + && rType != ::getCppuType((uno::Reference< com::sun::star::script::XInvocation>*)0) + && rType != ::getCppuType((uno::Reference< com::sun::star::reflection::XIdlClassProvider>*)0) + && rType != ::getCppuType((uno::Reference< com::sun::star::beans::XFastPropertySet>*)0) + && rType != ::getCppuType((uno::Reference< com::sun::star::awt::XWindow>*)0)) + { + GetFormatter(); + if ( xNumberAgg.is() ) + aRet = xNumberAgg->queryAggregation( rType ); + } return aRet; } @@ -342,7 +360,7 @@ uno::Sequence SAL_CALL ScModelObj::getTypes() throw(uno::RuntimeExcep const uno::Type* pParentPtr = aParentTypes.getConstArray(); uno::Sequence aAggTypes; - if ( xNumberAgg.is() ) + if ( GetFormatter().is() ) { const uno::Type& rProvType = ::getCppuType((uno::Reference*) 0); uno::Any aNumProv(xNumberAgg->queryAggregation(rProvType)); @@ -433,7 +451,7 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { // NumberFormatter-Pointer am Uno-Objekt neu setzen - if (xNumberAgg.is()) + if (GetFormatter().is()) { SvNumberFormatsSupplierObj* pNumFmt = SvNumberFormatsSupplierObj::getImplementation( @@ -1760,7 +1778,7 @@ sal_Int64 SAL_CALL ScModelObj::getSomething( if ( nRet ) return nRet; - if ( xNumberAgg.is() ) + if ( GetFormatter().is() ) { const uno::Type& rTunnelType = ::getCppuType((uno::Reference*) 0); uno::Any aNumTunnel(xNumberAgg->queryAggregation(rTunnelType)); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index dd76058756a1..f5688171b145 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -94,7 +94,6 @@ const USHORT SC_SHRINKAGAIN_MAX = 7; class ScDrawStringsVars { ScOutputData* pOutput; // Verbindung - SvNumberFormatter* pFormatter; const ScPatternAttr* pPattern; // Attribute const SfxItemSet* pCondSet; // aus bedingter Formatierung @@ -187,8 +186,6 @@ ScDrawStringsVars::ScDrawStringsVars(ScOutputData* pData, BOOL bPTL) : bShrink ( FALSE ), bPixelToLogic( bPTL ) { - pFormatter = pData->pDoc->GetFormatTable(); - ScModule* pScMod = SC_MOD(); // #105733# SvtAccessibilityOptions::GetIsForBorders is no longer used (always assumed TRUE) bCellContrast = pOutput->bUseStyleColor && @@ -373,7 +370,7 @@ void ScDrawStringsVars::SetPattern( const ScPatternAttr* pNew, const SfxItemSet* // Zahlenformat // ULONG nOld = nValueFormat; - nValueFormat = pPattern->GetNumberFormat( pFormatter, pCondSet ); + nValueFormat = pPattern->GetNumberFormat( pOutput->pDoc->GetFormatTable(), pCondSet ); /* s.u. if (nValueFormat != nOld) @@ -414,7 +411,7 @@ void ScDrawStringsVars::SetPatternSimple( const ScPatternAttr* pNew, const SfxIt const SfxPoolItem* pLangItem; if ( !pCondSet || pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT,TRUE,&pLangItem) != SFX_ITEM_SET ) pLangItem = &pPattern->GetItem(ATTR_LANGUAGE_FORMAT); - nValueFormat = pFormatter->GetFormatForLanguageIfBuiltIn( + nValueFormat = pOutput->pDoc->GetFormatTable()->GetFormatForLanguageIfBuiltIn( ((SfxUInt32Item*)pFormItem)->GetValue(), ((SvxLanguageItem*)pLangItem)->GetLanguage() ); @@ -456,7 +453,7 @@ BOOL ScDrawStringsVars::SetText( ScBaseCell* pCell ) ULONG nFormat = GetValueFormat(); ScCellFormat::GetString( pCell, nFormat, aString, &pColor, - *pFormatter, + *pOutput->pDoc->GetFormatTable(), pOutput->bShowNullValues, pOutput->bShowFormulas, ftCheck ); @@ -1916,8 +1913,6 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic) Size aMinSize = pRefDevice->PixelToLogic(Size(0,100)); // erst darueber wird ausgegeben // UINT32 nMinHeight = aMinSize.Height() / 200; // 1/2 Pixel - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); - ScModule* pScMod = SC_MOD(); sal_Int32 nConfBackColor = pScMod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; // #105733# SvtAccessibilityOptions::GetIsForBorders is no longer used (always assumed TRUE) @@ -2321,12 +2316,12 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic) else { ULONG nFormat = pPattern->GetNumberFormat( - pFormatter, pCondSet ); + pDoc->GetFormatTable(), pCondSet ); String aString; Color* pColor; ScCellFormat::GetString( pCell, nFormat,aString, &pColor, - *pFormatter, + *pDoc->GetFormatTable(), bShowNullValues, bShowFormulas, ftCheck ); @@ -2812,8 +2807,6 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic) nRotMax = pRowInfo[nRotY].nRotMaxCol; - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); - ScModule* pScMod = SC_MOD(); sal_Int32 nConfBackColor = pScMod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; // #105733# SvtAccessibilityOptions::GetIsForBorders is no longer used (always assumed TRUE) @@ -3102,12 +3095,12 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic) else { ULONG nFormat = pPattern->GetNumberFormat( - pFormatter, pCondSet ); + pDoc->GetFormatTable(), pCondSet ); String aString; Color* pColor; ScCellFormat::GetString( pCell, nFormat,aString, &pColor, - *pFormatter, + *pDoc->GetFormatTable(), bShowNullValues, bShowFormulas, ftCheck ); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index d8449ebc3699..29ebede481b9 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1806,7 +1806,7 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode ) { SCTAB nInitTabCount = 3; //! konfigurierbar !!! for (SCTAB i=1; iMakeTable(i); + pDoc->MakeTable(i,false); } pDocSh->SetEmpty( FALSE ); // #i6232# make sure this is done only once diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 766785d5ffc8..72fb7bfdf06f 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -104,30 +104,38 @@ BOOL ScTabViewShell::GetFunction( String& rFuncStr ) aStr = ScGlobal::GetRscString(nGlobStrId); aStr += '='; - // Anzahl im Standardformat, die anderen nach Cursorposition - sal_uInt32 nNumFmt = 0; - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); - if ( eFunc != SUBTOTAL_FUNC_CNT && eFunc != SUBTOTAL_FUNC_CNT2 ) - { - // Zahlformat aus Attributen oder Formel - pDoc->GetNumberFormat( nPosX, nPosY, nTab, nNumFmt ); - if ( (nNumFmt % SV_COUNTRY_LANGUAGE_OFFSET) == 0 ) - { - ScBaseCell* pCell; - pDoc->GetCell( nPosX, nPosY, nTab, pCell ); - if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA) - nNumFmt = ((ScFormulaCell*)pCell)->GetStandardFormat( - *pFormatter, nNumFmt ); - } - } ScAddress aCursor( nPosX, nPosY, nTab ); double nVal; if ( pDoc->GetSelectionFunction( eFunc, aCursor, rMark, nVal ) ) { - String aValStr; - Color* pDummy; - pFormatter->GetOutputString( nVal, nNumFmt, aValStr, &pDummy ); - aStr += aValStr; + if ( nVal == 0.0 ) + aStr += '0'; + else + { + // Anzahl im Standardformat, die anderen nach Cursorposition + SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + sal_uInt32 nNumFmt = 0; + if ( eFunc != SUBTOTAL_FUNC_CNT && eFunc != SUBTOTAL_FUNC_CNT2 ) + { + // Zahlformat aus Attributen oder Formel + pDoc->GetNumberFormat( nPosX, nPosY, nTab, nNumFmt ); + if ( (nNumFmt % SV_COUNTRY_LANGUAGE_OFFSET) == 0 ) + { + ScBaseCell* pCell; + pDoc->GetCell( nPosX, nPosY, nTab, pCell ); + if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA) + { + + nNumFmt = ((ScFormulaCell*)pCell)->GetStandardFormat(*pFormatter, nNumFmt ); + } + } + } + + String aValStr; + Color* pDummy; + pFormatter->GetOutputString( nVal, nNumFmt, aValStr, &pDummy ); + aStr += aValStr; + } } rFuncStr = aStr; diff --git a/sc/util/makefile.mk b/sc/util/makefile.mk index 49eb10b7e8b4..c06071ff6324 100644 --- a/sc/util/makefile.mk +++ b/sc/util/makefile.mk @@ -100,7 +100,6 @@ SHL1STDLIBS= \ $(UNOTOOLSLIB) \ $(SOTLIB) \ $(XMLOFFLIB) \ - $(DBTOOLSLIB) \ $(AVMEDIALIB) \ $(FORLIB) \ $(FORUILIB) -- cgit From fbb3c82a81750cf7744e25af48a3372b8aafbd53 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Tue, 8 Sep 2009 10:44:42 +0000 Subject: CWS-TOOLING: integrate CWS vcl104 --- sc/source/ui/view/tabvwshb.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index f2bc65a66ba8..37dc2c11da7f 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -465,7 +465,10 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) case SID_INSERT_SOUND: case SID_INSERT_VIDEO: - if ( bOle || bTabProt || !SvxPluginFileDlg::IsAvailable(nWhich) || bShared ) + /* #i102735# discussed with NN: removed for performance reasons + || !SvxPluginFileDlg::IsAvailable(nWhich) + */ + if ( bOle || bTabProt || bShared ) rSet.DisableItem( nWhich ); break; -- cgit From c24ab8def12f8a7a305e35d39c91976e345dd3b0 Mon Sep 17 00:00:00 2001 From: Oliver Bolte Date: Wed, 9 Sep 2009 07:31:32 +0000 Subject: CWS-TOOLING: integrate CWS koheimultirangecopy 2009-08-29 08:19:57 +0200 kohei r275558 : A bit of cleanup & comments. 2009-08-29 08:10:31 +0200 kohei r275557 : removed duplicated code block. 2009-08-29 07:30:33 +0200 kohei r275556 : #i104551# fixed it. 2009-08-28 17:23:28 +0200 kohei r275541 : #i104553# fixed a crash on pasting over existing data. This also fixes notes being destroyed as originally reported in the IZ entry. 2009-08-27 23:36:17 +0200 kohei r275510 : #i104550# fixed. All I had to do was to call MarkToSimple() before examining the geometry of the marked ranges. 2009-08-27 18:04:11 +0200 kohei r275501 : CWS-TOOLING: rebase CWS koheimultirangecopy to trunk@275331 (milestone: DEV300:m56) 2009-08-21 11:37:20 +0200 dr r275228 : #i10000# another wntmsci12 warning 2009-08-21 09:33:32 +0200 dr r275218 : #i10000# sunncc warnings 2009-08-20 20:01:15 +0200 kohei r275196 : Let's not initialize a variable with itself, which is not yet initialized. This was obviously a silly human error. 2009-08-05 23:24:16 +0200 kohei r274702 : correct error message on matrix fragment. 2009-08-05 20:00:12 +0200 kohei r274699 : removed header includes for indexmap.hxx. 2009-08-05 19:54:24 +0200 kohei r274698 : removed ScIndexMap entirely - we don't need this any more. 2009-08-05 19:53:01 +0200 kohei r274697 : Removed duplicated methods that use ScIndexMap. We should now use ScRangeData::IndexMap across the board. 2009-08-05 18:45:17 +0200 kohei r274695 : Refactored code to remove redundant ScDocument::CopyToClip method. 2009-07-21 18:03:54 +0200 kohei r274209 : #i25855# initial commit of the patch from ooo-build. It's buildable. --- sc/inc/cell.hxx | 5 +- sc/inc/clipparam.hxx | 91 +++++ sc/inc/column.hxx | 5 +- sc/inc/document.hxx | 48 ++- sc/inc/indexmap.hxx | 59 ---- sc/inc/rangenam.hxx | 7 +- sc/inc/table.hxx | 5 +- sc/source/core/data/cell2.cxx | 8 +- sc/source/core/data/clipparam.cxx | 203 ++++++++++++ sc/source/core/data/column.cxx | 3 +- sc/source/core/data/documen2.cxx | 38 +-- sc/source/core/data/documen3.cxx | 8 +- sc/source/core/data/documen8.cxx | 14 +- sc/source/core/data/document.cxx | 656 +++++++++++++++++++++++++------------ sc/source/core/data/makefile.mk | 2 + sc/source/core/data/table1.cxx | 2 +- sc/source/core/data/table2.cxx | 10 + sc/source/core/tool/indexmap.cxx | 80 ----- sc/source/core/tool/makefile.mk | 1 - sc/source/core/tool/rangenam.cxx | 13 +- sc/source/ui/docshell/arealink.cxx | 6 +- sc/source/ui/docshell/docfunc.cxx | 5 +- sc/source/ui/inc/cellsh.hxx | 3 + sc/source/ui/inc/viewfunc.hxx | 5 + sc/source/ui/navipi/content.cxx | 6 +- sc/source/ui/undo/undoblk.cxx | 6 +- sc/source/ui/unoobj/funcuno.cxx | 6 +- sc/source/ui/view/cellsh.cxx | 1 - sc/source/ui/view/cellsh1.cxx | 84 +++-- sc/source/ui/view/tabcont.cxx | 4 +- sc/source/ui/view/tabvwsh4.cxx | 2 +- sc/source/ui/view/viewfun3.cxx | 382 +++++++++++++++++++-- sc/source/ui/view/viewfun5.cxx | 9 +- 33 files changed, 1272 insertions(+), 505 deletions(-) create mode 100644 sc/inc/clipparam.hxx delete mode 100644 sc/inc/indexmap.hxx create mode 100644 sc/source/core/data/clipparam.cxx delete mode 100644 sc/source/core/tool/indexmap.cxx diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx index 1e9a8618800e..1f2bff35ce98 100644 --- a/sc/inc/cell.hxx +++ b/sc/inc/cell.hxx @@ -37,6 +37,7 @@ #include #include #include "global.hxx" +#include "rangenam.hxx" #include "formula/grammar.hxx" #include "tokenarray.hxx" #include "formularesult.hxx" @@ -289,8 +290,6 @@ enum ScMatrixMode { MM_FAKE = 3 // Interpret "as-if" matrix formula (legacy) }; -class ScIndexMap; - class SC_DLLPUBLIC ScFormulaCell : public ScBaseCell, public SvtListener { private: @@ -413,7 +412,7 @@ public: void UpdateCompile( BOOL bForceIfNameInUse = FALSE ); BOOL IsRangeNameInUse(USHORT nIndex) const; void FindRangeNamesInUse(std::set& rIndexes) const; - void ReplaceRangeNamesInUse( const ScIndexMap& rMap ); + void ReplaceRangeNamesInUse( const ScRangeData::IndexMap& rMap ); BOOL IsSubTotal() const { return bSubTotal; } BOOL IsChanged() const { return bChanged; } void ResetChanged() { bChanged = FALSE; } diff --git a/sc/inc/clipparam.hxx b/sc/inc/clipparam.hxx new file mode 100644 index 000000000000..896117bdef69 --- /dev/null +++ b/sc/inc/clipparam.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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: document.hxx,v $ + * $Revision: 1.115.36.9 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SC_CLIPPARAM_HXX +#define SC_CLIPPARAM_HXX + +#include "rangelst.hxx" +#include "rangenam.hxx" + +#include + +/** + * This struct stores general clipboard parameters associated with a + * ScDocument instance created in clipboard mode. + */ +struct ScClipParam +{ + enum Direction { Unspecified, Column, Row }; + + ScRangeList maRanges; + Direction meDirection; + bool mbCutMode; + + ScClipParam(); + ScClipParam(const ScRange& rRange, bool bCutMode); + explicit ScClipParam(const ScClipParam& r); + + bool isMultiRange() const; + + /** + * Get the column size of a pasted range. Note that when the range is + * non-contiguous, we first compress all individual ranges into a single + * range, and the size of that compressed range is returned. + */ + SCCOL getPasteColSize(); + + /** + * Same as the above method, but returns the row size of the compressed + * range. + */ + SCROW getPasteRowSize(); + + /** + * Return a single range that encompasses all individual ranges. + */ + ScRange getWholeRange() const; + + void transpose(); +}; + +// ============================================================================ + +struct ScClipRangeNameData +{ + ScRangeData::IndexMap maRangeMap; + ::std::vector mpRangeNames; + bool mbReplace; + + ScClipRangeNameData(); + ~ScClipRangeNameData(); + void insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex); +}; + +#endif diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 816a8ade4628..3f1fbfc1c88f 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -35,6 +35,7 @@ #include "global.hxx" #include "compressedarray.hxx" #include "address.hxx" +#include "rangenam.hxx" #include #include @@ -97,8 +98,6 @@ struct ColEntry }; -class ScIndexMap; - class ScColumn { private: @@ -297,7 +296,7 @@ public: void SetTabNo(SCTAB nNewTab); BOOL IsRangeNameInUse(SCROW nRow1, SCROW nRow2, USHORT nIndex) const; void FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set& rIndexes) const; - void ReplaceRangeNamesInUse( SCROW nRow1, SCROW nRow2, const ScIndexMap& rMap ); + void ReplaceRangeNamesInUse( SCROW nRow1, SCROW nRow2, const ScRangeData::IndexMap& rMap ); const SfxPoolItem* GetAttr( SCROW nRow, USHORT nWhich ) const; const ScPatternAttr* GetPattern( SCROW nRow ) const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 6711a2c974ad..67d36861d10a 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -136,6 +136,8 @@ class ScLookupCache; struct ScLookupCacheMapImpl; class SfxUndoManager; class ScFormulaParserPool; +struct ScClipParam; +struct ScClipRangeNameData; namespace com { namespace sun { namespace star { namespace lang { @@ -280,6 +282,7 @@ private: ScFieldEditEngine* pCacheFieldEditEngine; ::std::auto_ptr pDocProtection; + ::std::auto_ptr mpClipParam; ::std::auto_ptr pExternalRefMgr; @@ -306,7 +309,6 @@ private: sal_uInt32 nRangeOverflowType; // used in (xml) loading for overflow warnings - ScRange aClipRange; ScRange aEmbedRange; ScAddress aCurTextWidthCalcPos; ScAddress aOnlineSpellPos; // within whole document @@ -356,7 +358,6 @@ private: BOOL bForcedFormulaPending; BOOL bCalculatingFormulaTree; BOOL bIsClip; - BOOL bCutMode; BOOL bIsUndo; BOOL bIsVisible; // set from view ctor @@ -962,12 +963,11 @@ public: void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, USHORT nDelFlag); void DeleteAreaTab(const ScRange& rRange, USHORT nDelFlag); - void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - BOOL bCut, ScDocument* pClipDoc, BOOL bAllTabs, - const ScMarkData* pMarks = NULL, - BOOL bKeepScenarioFlags = FALSE, - BOOL bIncludeObjects = FALSE, - BOOL bCloneNoteCaptions = TRUE); + + void CopyToClip(const ScClipParam& rClipParam, ScDocument* pClipDoc, + const ScMarkData* pMarks = NULL, bool bAllTabs = false, bool bKeepScenarioFlags = false, + bool bIncludeObjects = false, bool bCloneNoteCaptions = true); + void CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, ScDocument* pClipDoc = NULL); void CopyBlockFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, @@ -995,6 +995,12 @@ public: BOOL bSkipAttrForEmpty = FALSE, const ScRangeList * pDestRanges = NULL ); + void CopyMultiRangeFromClip(const ScAddress& rDestPos, const ScMarkData& rMark, + sal_uInt16 nInsFlag, ScDocument* pClipDoc, + bool bResetCut = true, bool bAsLink = false, + bool bIncludeFiltered = true, + bool bSkipAttrForEmpty = false); + void GetClipArea(SCCOL& nClipX, SCROW& nClipY, BOOL bIncludeFiltered); void GetClipStart(SCCOL& nClipX, SCROW& nClipY); @@ -1004,6 +1010,9 @@ public: SC_DLLPUBLIC void TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsLink ); + ScClipParam& GetClipParam(); + void SetClipParam(const ScClipParam& rParam); + void MixDocument( const ScRange& rRange, USHORT nFunction, BOOL bSkipEmpty, ScDocument* pSrcDoc ); @@ -1701,6 +1710,23 @@ public: SfxUndoManager* GetUndoManager(); private: // CLOOK-Impl-Methoden + /** + * Use this class as a locale variable to merge number formatter from + * another document, and set NULL pointer to pFormatExchangeList when + * done. + */ + class NumFmtMergeHandler + { + public: + explicit NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc); + ~NumFmtMergeHandler(); + + private: + ScDocument* mpDoc; + }; + + void MergeNumberFormatter(ScDocument* pSrcDoc); + void ImplCreateOptions(); // bei Gelegenheit auf on-demand umstellen? void ImplDeleteOptions(); @@ -1722,6 +1748,12 @@ private: // CLOOK-Impl-Methoden void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode, const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs); + void CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames); + void UpdateRangeNamesInFormulas( + ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark, + SCCOL nXw, SCROW nYw); + BOOL HasPartOfMerged( const ScRange& rRange ); std::map< SCTAB, ScSortParam > mSheetSortParams; diff --git a/sc/inc/indexmap.hxx b/sc/inc/indexmap.hxx deleted file mode 100644 index 4db5deb78d4e..000000000000 --- a/sc/inc/indexmap.hxx +++ /dev/null @@ -1,59 +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: indexmap.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SC_INDEXMAP_HXX -#define _SC_INDEXMAP_HXX - - -#include - - -class ScIndexMap -{ - // not implemented - ScIndexMap( const ScIndexMap& ); - ScIndexMap& operator=( const ScIndexMap& ); - -private: - USHORT* pMap; - USHORT nCount; - -public: - ScIndexMap( USHORT nEntries ); - ~ScIndexMap(); - - void SetPair( USHORT nEntry, USHORT nIndex1, USHORT nIndex2 ); - /// returns nIndex2 if found, else nIndex1 - USHORT Find( USHORT nIndex1 ) const; -}; - - -#endif // _SC_INDEXMAP_HXX - diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx index 2c6f706ff403..9963cf65c895 100644 --- a/sc/inc/rangenam.hxx +++ b/sc/inc/rangenam.hxx @@ -37,6 +37,8 @@ #include "formula/grammar.hxx" #include "scdllapi.h" +#include + //------------------------------------------------------------------------ class ScDocument; @@ -65,7 +67,6 @@ typedef USHORT RangeType; //------------------------------------------------------------------------ class ScTokenArray; -class ScIndexMap; class ScRangeData : public ScDataObject { @@ -87,6 +88,8 @@ private: friend class ScRangeName; ScRangeData( USHORT nIndex ); public: + typedef ::std::map IndexMap; + SC_DLLPUBLIC ScRangeData( ScDocument* pDoc, const String& rName, const String& rSymbol, @@ -152,7 +155,7 @@ public: void ValidateTabRefs(); - void ReplaceRangeNamesInUse( const ScIndexMap& rMap ); + void ReplaceRangeNamesInUse( const IndexMap& rMap ); static void MakeValidName( String& rName ); SC_DLLPUBLIC static BOOL IsNameValid( const String& rName, ScDocument* pDoc ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 1deaa8f334a6..9fda5d522fdc 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -71,7 +71,6 @@ class ScStyleSheet; class ScTableLink; class ScTableProtection; class ScUserListData; -class ScIndexMap; struct RowInfo; struct ScFunctionData; struct ScLineFlags; @@ -322,6 +321,8 @@ public: void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nDelFlag); void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable, BOOL bKeepScenarioFlags, BOOL bCloneNoteCaptions); + void CopyToClip(const ScRangeList& rRanges, ScTable* pTable, + bool bKeepScenarioFlags, bool bCloneNoteCaptions); void CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, USHORT nInsFlag, BOOL bAsLink, BOOL bSkipAttrForEmpty, ScTable* pTable); void StartListeningInArea( SCCOL nCol1, SCROW nRow1, @@ -439,7 +440,7 @@ public: void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, std::set& rIndexes) const; void ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - const ScIndexMap& rMap ); + const ScRangeData::IndexMap& rMap ); void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ULONG nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, double nStepValue, double nMaxValue); diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx index a0e776458ca2..0b2a5a551ccb 100644 --- a/sc/source/core/data/cell2.cxx +++ b/sc/source/core/data/cell2.cxx @@ -53,7 +53,6 @@ #include "scmatrix.hxx" #include "editutil.hxx" #include "chgtrack.hxx" -#include "indexmap.hxx" #include "externalrefmgr.hxx" using namespace formula; @@ -1480,14 +1479,15 @@ void ScFormulaCell::FindRangeNamesInUse(std::set& rIndexes) const lcl_FindRangeNamesInUse( rIndexes, pCode, pDocument->GetRangeName() ); } -void ScFormulaCell::ReplaceRangeNamesInUse( const ScIndexMap& rMap ) +void ScFormulaCell::ReplaceRangeNamesInUse( const ScRangeData::IndexMap& rMap ) { for( FormulaToken* p = pCode->First(); p; p = pCode->Next() ) { if( p->GetOpCode() == ocName ) { - USHORT nIndex = p->GetIndex(); - USHORT nNewIndex = rMap.Find( nIndex ); + sal_uInt16 nIndex = p->GetIndex(); + ScRangeData::IndexMap::const_iterator itr = rMap.find(nIndex); + sal_uInt16 nNewIndex = itr == rMap.end() ? nIndex : itr->second; if ( nIndex != nNewIndex ) { p->SetIndex( nNewIndex ); diff --git a/sc/source/core/data/clipparam.cxx b/sc/source/core/data/clipparam.cxx new file mode 100644 index 000000000000..b2ec555a0d5c --- /dev/null +++ b/sc/source/core/data/clipparam.cxx @@ -0,0 +1,203 @@ +/************************************************************************* + * + * 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: document.cxx,v $ + * $Revision: 1.90.36.8 $ + * + * 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" + +// INCLUDE --------------------------------------------------------------- + +#include "clipparam.hxx" + +using ::std::vector; + +ScClipParam::ScClipParam() : + meDirection(Unspecified), + mbCutMode(false) +{ +} + +ScClipParam::ScClipParam(const ScRange& rRange, bool bCutMode) : + meDirection(Unspecified), + mbCutMode(bCutMode) +{ + maRanges.Append(rRange); +} + +ScClipParam::ScClipParam(const ScClipParam& r) : + maRanges(r.maRanges), + meDirection(r.meDirection), + mbCutMode(r.mbCutMode) +{ +} + +bool ScClipParam::isMultiRange() const +{ + return maRanges.Count() > 1; +} + +SCCOL ScClipParam::getPasteColSize() +{ + if (!maRanges.Count()) + return 0; + + switch (meDirection) + { + case ScClipParam::Column: + { + SCCOL nColSize = 0; + for (ScRangePtr p = maRanges.First(); p; p = maRanges.Next()) + nColSize += p->aEnd.Col() - p->aStart.Col() + 1; + return nColSize; + } + case ScClipParam::Row: + { + // We assume that all ranges have identical column size. + const ScRange& rRange = *maRanges.First(); + return rRange.aEnd.Col() - rRange.aStart.Col() + 1; + } + case ScClipParam::Unspecified: + default: + ; + } + return 0; +} + +SCROW ScClipParam::getPasteRowSize() +{ + if (!maRanges.Count()) + return 0; + + switch (meDirection) + { + case ScClipParam::Column: + { + // We assume that all ranges have identical row size. + const ScRange& rRange = *maRanges.First(); + return rRange.aEnd.Row() - rRange.aStart.Row() + 1; + } + case ScClipParam::Row: + { + SCROW nRowSize = 0; + for (ScRangePtr p = maRanges.First(); p; p = maRanges.Next()) + nRowSize += p->aEnd.Row() - p->aStart.Row() + 1; + return nRowSize; + } + case ScClipParam::Unspecified: + default: + ; + } + return 0; +} + +ScRange ScClipParam::getWholeRange() const +{ + ScRange aWhole; + bool bFirst = true; + ScRangeList aRanges = maRanges; + for (ScRange* p = aRanges.First(); p; p = aRanges.Next()) + { + if (bFirst) + { + aWhole = *p; + bFirst = false; + continue; + } + + if (aWhole.aStart.Col() > p->aStart.Col()) + aWhole.aStart.SetCol(p->aStart.Col()); + + if (aWhole.aStart.Row() > p->aStart.Row()) + aWhole.aStart.SetRow(p->aStart.Row()); + + if (aWhole.aEnd.Col() < p->aEnd.Col()) + aWhole.aEnd.SetCol(p->aEnd.Col()); + + if (aWhole.aEnd.Row() < p->aEnd.Row()) + aWhole.aEnd.SetRow(p->aEnd.Row()); + } + return aWhole; +} + +void ScClipParam::transpose() +{ + switch (meDirection) + { + case Column: + meDirection = ScClipParam::Row; + break; + case Row: + meDirection = ScClipParam::Column; + break; + case Unspecified: + default: + ; + } + + ScRangeList aNewRanges; + if (maRanges.Count()) + { + ScRange* p = maRanges.First(); + SCCOL nColOrigin = p->aStart.Col(); + SCROW nRowOrigin = p->aStart.Row(); + for (; p; p = maRanges.Next()) + { + SCCOL nColDelta = p->aStart.Col() - nColOrigin; + SCROW nRowDelta = p->aStart.Row() - nRowOrigin; + SCCOL nCol1 = 0; + SCCOL nCol2 = static_cast(p->aEnd.Row() - p->aStart.Row()); + SCROW nRow1 = 0; + SCROW nRow2 = static_cast(p->aEnd.Col() - p->aStart.Col()); + nCol1 += static_cast(nRowDelta); + nCol2 += static_cast(nRowDelta); + nRow1 += static_cast(nColDelta); + nRow2 += static_cast(nColDelta); + ScRange aNew(nCol1, nRow1, p->aStart.Tab(), nCol2, nRow2, p->aStart.Tab()); + aNewRanges.Append(aNew); + } + } + maRanges = aNewRanges; +} + +// ============================================================================ + +ScClipRangeNameData::ScClipRangeNameData() : + mbReplace(false) +{ +} + +ScClipRangeNameData::~ScClipRangeNameData() +{ +} + +void ScClipRangeNameData::insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex) +{ + maRangeMap.insert( + ScRangeData::IndexMap::value_type(nOldIndex, nNewIndex)); +} diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 33b3404faec6..0afc4fb1347c 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1874,7 +1874,7 @@ void ScColumn::FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set& r } void ScColumn::ReplaceRangeNamesInUse(SCROW nRow1, SCROW nRow2, - const ScIndexMap& rMap ) + const ScRangeData::IndexMap& rMap ) { if (pItems) for (SCSIZE i = 0; i < nCount; i++) @@ -1891,7 +1891,6 @@ void ScColumn::ReplaceRangeNamesInUse(SCROW nRow1, SCROW nRow2, } } - void ScColumn::SetDirtyVar() { for (SCSIZE i=0; iGetAutoCalc(); pSrcDoc->SetAutoCalc( TRUE ); // falls was berechnet werden muss } - SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable(); - SvNumberFormatter* pOtherFormatter = pSrcDoc->xPoolHelper->GetFormTable(); - if (pOtherFormatter && pOtherFormatter != pThisFormatter) + { - SvNumberFormatterIndexTable* pExchangeList = - pThisFormatter->MergeFormatter(*(pOtherFormatter)); - if (pExchangeList->Count() > 0) - pFormatExchangeList = pExchangeList; - } - nDestPos = Min(nDestPos, (SCTAB)(GetTableCount() - 1)); - { // scope for bulk broadcast - ScBulkBroadcast aBulkBroadcast( pBASM); - pSrcDoc->pTab[nSrcPos]->CopyToTable(0, 0, MAXCOL, MAXROW, - ( bResultsOnly ? IDF_ALL & ~IDF_FORMULA : IDF_ALL), - FALSE, pTab[nDestPos] ); + NumFmtMergeHandler aNumFmtMergeHdl(this, pSrcDoc); + + nDestPos = Min(nDestPos, (SCTAB)(GetTableCount() - 1)); + { // scope for bulk broadcast + ScBulkBroadcast aBulkBroadcast( pBASM); + pSrcDoc->pTab[nSrcPos]->CopyToTable(0, 0, MAXCOL, MAXROW, + ( bResultsOnly ? IDF_ALL & ~IDF_FORMULA : IDF_ALL), + FALSE, pTab[nDestPos] ); + } } - pFormatExchangeList = NULL; pTab[nDestPos]->SetTabNo(nDestPos); if ( !bResultsOnly ) @@ -998,7 +994,7 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos, // array containing range names which might need update of indices ScRangeData** pSrcRangeNames = nSrcRangeNames ? new ScRangeData* [nSrcRangeNames] : NULL; // the index mapping thereof - ScIndexMap aSrcRangeMap( nSrcRangeNames ); + ScRangeData::IndexMap aSrcRangeMap; BOOL bRangeNameReplace = FALSE; // find named ranges that are used in the source sheet @@ -1023,7 +1019,8 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos, USHORT nExistingIndex = pExistingData->GetIndex(); pSrcRangeNames[i] = NULL; // don't modify the named range - aSrcRangeMap.SetPair( i, nOldIndex, nExistingIndex ); + aSrcRangeMap.insert( + ScRangeData::IndexMap::value_type(nOldIndex, nExistingIndex)); bRangeNameReplace = TRUE; bNamesLost = TRUE; } @@ -1043,7 +1040,8 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos, pData->TransferTabRef( nSrcPos, nDestPos ); pSrcRangeNames[i] = pData; USHORT nNewIndex = pData->GetIndex(); - aSrcRangeMap.SetPair( i, nOldIndex, nNewIndex ); + aSrcRangeMap.insert( + ScRangeData::IndexMap::value_type(nOldIndex, nNewIndex)); if ( !bRangeNameReplace ) bRangeNameReplace = ( nOldIndex != nNewIndex ); } diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 7355fb5241ce..4ba4a225c21f 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -80,6 +80,7 @@ #include "listenercalls.hxx" #include "tabprotection.hxx" #include "formulaparserpool.hxx" +#include "clipparam.hxx" #include @@ -854,7 +855,7 @@ void ScDocument::UpdateReference( UpdateRefMode eUpdateRefMode, { ScDocument* pClipDoc = SC_MOD()->GetClipDoc(); if (pClipDoc) - pClipDoc->bCutMode = FALSE; + pClipDoc->GetClipParam().mbCutMode = false; } } } @@ -864,7 +865,10 @@ void ScDocument::UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDo { DBG_ASSERT(pClipDoc->bIsClip, "UpdateTranspose: kein Clip"); - ScRange aSource = pClipDoc->aClipRange; // Tab wird noch angepasst + ScRange aSource; + ScClipParam& rClipParam = GetClipParam(); + if (rClipParam.maRanges.Count()) + aSource = *rClipParam.maRanges.First(); ScAddress aDest = rDestPos; SCTAB nClipTab = 0; diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 620a8a6a3e13..64433a30297a 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -324,20 +324,8 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet, void ScDocument::CopyStdStylesFrom( ScDocument* pSrcDoc ) { // #b5017505# number format exchange list has to be handled here, too - - SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable(); - SvNumberFormatter* pOtherFormatter = pSrcDoc->xPoolHelper->GetFormTable(); - if (pOtherFormatter && pOtherFormatter != pThisFormatter) - { - SvNumberFormatterIndexTable* pExchangeList = - pThisFormatter->MergeFormatter(*(pOtherFormatter)); - if (pExchangeList->Count() > 0) - pFormatExchangeList = pExchangeList; - } - + NumFmtMergeHandler aNumFmtMergeHdl(this, pSrcDoc); xPoolHelper->GetStylePool()->CopyStdStylesFrom( pSrcDoc->xPoolHelper->GetStylePool() ); - - pFormatExchangeList = NULL; } //------------------------------------------------------------------------ diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 0150593fa6ef..c74d804de352 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -84,7 +84,6 @@ #include "detdata.hxx" #include "cell.hxx" #include "dpobject.hxx" -#include "indexmap.hxx" #include "detfunc.hxx" // for UpdateAllComments #include "scmod.hxx" #include "dociter.hxx" @@ -94,6 +93,9 @@ #include "postit.hxx" #include "externalrefmgr.hxx" #include "tabprotection.hxx" +#include "clipparam.hxx" + +#include namespace WritingMode2 = ::com::sun::star::text::WritingMode2; @@ -1367,7 +1369,7 @@ void ScDocument::AddUndoTab( SCTAB nTab1, SCTAB nTab2, BOOL bColInfo, BOOL bRowI void ScDocument::SetCutMode( BOOL bVal ) { if (bIsClip) - bCutMode = bVal; + GetClipParam().mbCutMode = bVal; else { DBG_ERROR("SetCutMode without bIsClip"); @@ -1378,7 +1380,7 @@ void ScDocument::SetCutMode( BOOL bVal ) BOOL ScDocument::IsCutMode() { if (bIsClip) - return bCutMode; + return GetClipParam().mbCutMode; else { DBG_ERROR("IsCutMode ohne bIsClip"); @@ -1490,70 +1492,50 @@ void ScDocument::UndoToDocument(const ScRange& rRange, pDestDoc->SetAutoCalc( bOldAutoCalc ); } - -void ScDocument::CopyToClip(SCCOL nCol1, SCROW nRow1, - SCCOL nCol2, SCROW nRow2, - BOOL bCut, ScDocument* pClipDoc, - BOOL bAllTabs, const ScMarkData* pMarks, - BOOL bKeepScenarioFlags, BOOL bIncludeObjects, BOOL bCloneNoteCaptions) +void ScDocument::CopyToClip(const ScClipParam& rClipParam, + ScDocument* pClipDoc, const ScMarkData* pMarks, + bool bAllTabs, bool bKeepScenarioFlags, bool bIncludeObjects, bool bCloneNoteCaptions) { DBG_ASSERT( bAllTabs || pMarks, "CopyToClip: ScMarkData fehlt" ); - if (!bIsClip) + if (bIsClip) + return; + + if (!pClipDoc) { - PutInOrder( nCol1, nCol2 ); - PutInOrder( nRow1, nRow2 ); - if (!pClipDoc) - { - DBG_ERROR("CopyToClip: no ClipDoc"); - pClipDoc = SC_MOD()->GetClipDoc(); - } + DBG_ERROR("CopyToClip: no ClipDoc"); + pClipDoc = SC_MOD()->GetClipDoc(); + } - pClipDoc->aDocName = aDocName; - pClipDoc->aClipRange = ScRange( nCol1,nRow1,0, nCol2,nRow2,0 ); - pClipDoc->ResetClip( this, pMarks ); - USHORT i; - SCTAB j; - - std::set aUsedNames; // indexes of named ranges that are used in the copied cells - for (j = 0; j <= MAXTAB; j++) - if (pTab[j] && pClipDoc->pTab[j]) - if ( bAllTabs || !pMarks || pMarks->GetTableSelect(j) ) - pTab[j]->FindRangeNamesInUse( nCol1, nRow1, nCol2, nRow2, aUsedNames ); - - pClipDoc->pRangeName->FreeAll(); - for (i = 0; i < pRangeName->GetCount(); i++) //! DB-Bereiche Pivot-Bereiche auch !!! - { - USHORT nIndex = ((ScRangeData*)((*pRangeName)[i]))->GetIndex(); - bool bInUse = ( aUsedNames.find(nIndex) != aUsedNames.end() ); - if (bInUse) - { - ScRangeData* pData = new ScRangeData(*((*pRangeName)[i])); - if (!pClipDoc->pRangeName->Insert(pData)) - delete pData; - else - pData->SetIndex(nIndex); - } - } - for (j = 0; j <= MAXTAB; j++) - if (pTab[j] && pClipDoc->pTab[j]) - if ( bAllTabs || !pMarks || pMarks->GetTableSelect(j) ) - { - pTab[j]->CopyToClip(nCol1, nRow1, nCol2, nRow2, pClipDoc->pTab[j], bKeepScenarioFlags, bCloneNoteCaptions); + pClipDoc->aDocName = aDocName; + pClipDoc->SetClipParam(rClipParam); + pClipDoc->ResetClip(this, pMarks); - if ( pDrawLayer && bIncludeObjects ) - { - // also copy drawing objects + ScRange aClipRange = rClipParam.getWholeRange(); + CopyRangeNamesToClip(pClipDoc, aClipRange, pMarks, bAllTabs); - Rectangle aObjRect = GetMMRect( nCol1, nRow1, nCol2, nRow2, j ); - pDrawLayer->CopyToClip( pClipDoc, j, aObjRect ); - } - } + for (SCTAB i = 0; i <= MAXTAB; ++i) + { + if (!pTab[i] || !pClipDoc->pTab[i]) + continue; + + if (pMarks && !pMarks->GetTableSelect(i)) + continue; + + pTab[i]->CopyToClip(rClipParam.maRanges, pClipDoc->pTab[i], bKeepScenarioFlags, bCloneNoteCaptions); - pClipDoc->bCutMode = bCut; + if (pDrawLayer && bIncludeObjects) + { + // also copy drawing objects + Rectangle aObjRect = GetMMRect( + aClipRange.aStart.Col(), aClipRange.aStart.Row(), aClipRange.aEnd.Col(), aClipRange.aEnd.Row(), i); + pDrawLayer->CopyToClip(pClipDoc, i, aObjRect); + } } -} + // Make sure to mark overlapped cells. + pClipDoc->ExtendMerge(aClipRange, true); +} void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, @@ -1569,14 +1551,16 @@ void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1, pClipDoc = SC_MOD()->GetClipDoc(); } + ScClipParam& rClipParam = pClipDoc->GetClipParam(); pClipDoc->aDocName = aDocName; - pClipDoc->aClipRange = ScRange( nCol1,nRow1,0, nCol2,nRow2,0 ); + rClipParam.maRanges.RemoveAll(); + rClipParam.maRanges.Append(ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0)); pClipDoc->ResetClip( this, nTab ); if (pTab[nTab] && pClipDoc->pTab[nTab]) pTab[nTab]->CopyToClip(nCol1, nRow1, nCol2, nRow2, pClipDoc->pTab[nTab], FALSE, TRUE); - pClipDoc->bCutMode = FALSE; + pClipDoc->GetClipParam().mbCutMode = false; } } @@ -1606,6 +1590,7 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsL // Daten + ScRange aClipRange = GetClipParam().getWholeRange(); if ( ValidRow(aClipRange.aEnd.Row()-aClipRange.aStart.Row()) ) { for (SCTAB i=0; i<=MAXTAB; i++) @@ -1634,10 +1619,8 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsL } } - pTransClip->aClipRange = ScRange( 0, 0, aClipRange.aStart.Tab(), - static_cast(aClipRange.aEnd.Row() - aClipRange.aStart.Row()), - static_cast(aClipRange.aEnd.Col() - aClipRange.aStart.Col()), - aClipRange.aEnd.Tab() ); + pTransClip->SetClipParam(GetClipParam()); + pTransClip->GetClipParam().transpose(); } else { @@ -1646,9 +1629,184 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsL // Dies passiert erst beim Einfuegen... - bCutMode = FALSE; + GetClipParam().mbCutMode = false; +} + +void ScDocument::CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs) +{ + std::set aUsedNames; // indexes of named ranges that are used in the copied cells + for (SCTAB i = 0; i <= MAXTAB; ++i) + if (pTab[i] && pClipDoc->pTab[i]) + if ( bAllTabs || !pMarks || pMarks->GetTableSelect(i) ) + pTab[i]->FindRangeNamesInUse( + rClipRange.aStart.Col(), rClipRange.aStart.Row(), + rClipRange.aEnd.Col(), rClipRange.aEnd.Row(), aUsedNames); + + pClipDoc->pRangeName->FreeAll(); + for (USHORT i = 0; i < pRangeName->GetCount(); i++) //! DB-Bereiche Pivot-Bereiche auch !!! + { + USHORT nIndex = ((ScRangeData*)((*pRangeName)[i]))->GetIndex(); + bool bInUse = ( aUsedNames.find(nIndex) != aUsedNames.end() ); + if (bInUse) + { + ScRangeData* pData = new ScRangeData(*((*pRangeName)[i])); + if (!pClipDoc->pRangeName->Insert(pData)) + delete pData; + else + pData->SetIndex(nIndex); + } + } +} + +ScDocument::NumFmtMergeHandler::NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc) : + mpDoc(pDoc) +{ + mpDoc->MergeNumberFormatter(pSrcDoc); +} + +ScDocument::NumFmtMergeHandler::~NumFmtMergeHandler() +{ + mpDoc->pFormatExchangeList = NULL; +} + +void ScDocument::MergeNumberFormatter(ScDocument* pSrcDoc) +{ + SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable(); + SvNumberFormatter* pOtherFormatter = pSrcDoc->xPoolHelper->GetFormTable(); + if (pOtherFormatter && pOtherFormatter != pThisFormatter) + { + SvNumberFormatterIndexTable* pExchangeList = + pThisFormatter->MergeFormatter(*(pOtherFormatter)); + if (pExchangeList->Count() > 0) + pFormatExchangeList = pExchangeList; + } +} + +void ScDocument::CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames) +{ + sal_uInt16 nClipRangeNameCount = pClipDoc->pRangeName->GetCount(); + ScClipRangeNameData aClipRangeNames; + + // array containing range names which might need update of indices + aClipRangeNames.mpRangeNames.resize(nClipRangeNameCount, NULL); + + for (sal_uInt16 i = 0; i < nClipRangeNameCount; ++i) //! DB-Bereiche Pivot-Bereiche auch + { + /* Copy only if the name doesn't exist in this document. + If it exists we use the already existing name instead, + another possibility could be to create new names if + documents differ. + A proper solution would ask the user how to proceed. + The adjustment of the indices in the formulas is done later. + */ + ScRangeData* pClipRangeData = (*pClipDoc->pRangeName)[i]; + USHORT k; + if ( pRangeName->SearchName( pClipRangeData->GetName(), k ) ) + { + aClipRangeNames.mpRangeNames[i] = NULL; // range name not inserted + USHORT nOldIndex = pClipRangeData->GetIndex(); + USHORT nNewIndex = ((*pRangeName)[k])->GetIndex(); + aClipRangeNames.insert(nOldIndex, nNewIndex); + if ( !aClipRangeNames.mbReplace ) + aClipRangeNames.mbReplace = ( nOldIndex != nNewIndex ); + } + else + { + ScRangeData* pData = new ScRangeData( *pClipRangeData ); + pData->SetDocument(this); + if ( pRangeName->FindIndex( pData->GetIndex() ) ) + pData->SetIndex(0); // need new index, done in Insert + if ( pRangeName->Insert( pData ) ) + { + aClipRangeNames.mpRangeNames[i] = pData; + USHORT nOldIndex = pClipRangeData->GetIndex(); + USHORT nNewIndex = pData->GetIndex(); + aClipRangeNames.insert(nOldIndex, nNewIndex); + if ( !aClipRangeNames.mbReplace ) + aClipRangeNames.mbReplace = ( nOldIndex != nNewIndex ); + } + else + { // must be an overflow + delete pData; + aClipRangeNames.mpRangeNames[i] = NULL; + aClipRangeNames.insert(pClipRangeData->GetIndex(), 0); + aClipRangeNames.mbReplace = true; + } + } + } + rRangeNames = aClipRangeNames; +} + +void ScDocument::UpdateRangeNamesInFormulas( + ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark, + SCCOL nXw, SCROW nYw) +{ + // nXw and nYw are the extra width and height of the destination range + // extended due to presence of merged cell(s). + + if (!rRangeNames.mbReplace) + return; + + // first update all inserted named formulas if they contain other + // range names and used indices changed + size_t nRangeNameCount = rRangeNames.mpRangeNames.size(); + for (size_t i = 0; i < nRangeNameCount; ++i) //! DB-Bereiche Pivot-Bereiche auch + { + if ( rRangeNames.mpRangeNames[i] ) + rRangeNames.mpRangeNames[i]->ReplaceRangeNamesInUse(rRangeNames.maRangeMap); + } + // then update the formulas, they might need just the updated range names + for (ULONG nRange = 0; nRange < rDestRanges.Count(); ++nRange) + { + const ScRange* pRange = rDestRanges.GetObject( nRange); + SCCOL nCol1 = pRange->aStart.Col(); + SCROW nRow1 = pRange->aStart.Row(); + SCCOL nCol2 = pRange->aEnd.Col(); + SCROW nRow2 = pRange->aEnd.Row(); + + SCCOL nC1 = nCol1; + SCROW nR1 = nRow1; + SCCOL nC2 = nC1 + nXw; + if (nC2 > nCol2) + nC2 = nCol2; + SCROW nR2 = nR1 + nYw; + if (nR2 > nRow2) + nR2 = nRow2; + do + { + do + { + for (SCTAB k = 0; k <= MAXTAB; k++) + { + if ( pTab[k] && rMark.GetTableSelect(k) ) + pTab[k]->ReplaceRangeNamesInUse(nC1, nR1, + nC2, nR2, rRangeNames.maRangeMap); + } + nC1 = nC2 + 1; + nC2 = Min((SCCOL)(nC1 + nXw), nCol2); + } while (nC1 <= nCol2); + nC1 = nCol1; + nC2 = nC1 + nXw; + if (nC2 > nCol2) + nC2 = nCol2; + nR1 = nR2 + 1; + nR2 = Min((SCROW)(nR1 + nYw), nRow2); + } while (nR1 <= nRow2); + } } +ScClipParam& ScDocument::GetClipParam() +{ + if (!mpClipParam.get()) + mpClipParam.reset(new ScClipParam); + + return *mpClipParam; +} + +void ScDocument::SetClipParam(const ScClipParam& rParam) +{ + mpClipParam.reset(new ScClipParam(rParam)); +} BOOL ScDocument::IsClipboardSource() const { @@ -1748,7 +1906,7 @@ void ScDocument::CopyBlockFromClip( SCCOL nCol1, SCROW nRow1, && ppClipTab[nClipTab + nFollow + 1] ) ++nFollow; - if ( pCBFCP->pClipDoc->bCutMode ) + if ( pCBFCP->pClipDoc->GetClipParam().mbCutMode ) { BOOL bOldInserting = IsInsertingFromOtherDoc(); SetInsertingFromOtherDoc( TRUE); @@ -1790,7 +1948,9 @@ void ScDocument::CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1, pCBFCP->pClipDoc->GetRowFlagsArray( nFlagTab); SCROW nSourceRow = rClipStartRow; - SCROW nSourceEnd = pCBFCP->pClipDoc->aClipRange.aEnd.Row(); + SCROW nSourceEnd = 0; + if (pCBFCP->pClipDoc->GetClipParam().maRanges.Count()) + nSourceEnd = pCBFCP->pClipDoc->GetClipParam().maRanges.First()->aEnd.Row(); SCROW nDestRow = nRow1; while ( nSourceRow <= nSourceEnd && nDestRow <= nRow2 ) @@ -1836,67 +1996,11 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar BOOL bOldAutoCalc = GetAutoCalc(); SetAutoCalc( FALSE ); // avoid multiple recalculations - SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable(); - SvNumberFormatter* pOtherFormatter = pClipDoc->xPoolHelper->GetFormTable(); - if (pOtherFormatter && pOtherFormatter != pThisFormatter) - { - SvNumberFormatterIndexTable* pExchangeList = - pThisFormatter->MergeFormatter(*(pOtherFormatter)); - if (pExchangeList->Count() > 0) - pFormatExchangeList = pExchangeList; - } + NumFmtMergeHandler aNumFmtMergeHdl(this, pClipDoc); - USHORT nClipRangeNames = pClipDoc->pRangeName->GetCount(); - // array containing range names which might need update of indices - ScRangeData** pClipRangeNames = nClipRangeNames ? new ScRangeData* [nClipRangeNames] : NULL; - // the index mapping thereof - ScIndexMap aClipRangeMap( nClipRangeNames ); - BOOL bRangeNameReplace = FALSE; + ScClipRangeNameData aClipRangeNames; + CopyRangeNamesFromClip(pClipDoc, aClipRangeNames); - for (USHORT i = 0; i < nClipRangeNames; i++) //! DB-Bereiche Pivot-Bereiche auch - { - /* Copy only if the name doesn't exist in this document. - If it exists we use the already existing name instead, - another possibility could be to create new names if - documents differ. - A proper solution would ask the user how to proceed. - The adjustment of the indices in the formulas is done later. - */ - ScRangeData* pClipRangeData = (*pClipDoc->pRangeName)[i]; - USHORT k; - if ( pRangeName->SearchName( pClipRangeData->GetName(), k ) ) - { - pClipRangeNames[i] = NULL; // range name not inserted - USHORT nOldIndex = pClipRangeData->GetIndex(); - USHORT nNewIndex = ((*pRangeName)[k])->GetIndex(); - aClipRangeMap.SetPair( i, nOldIndex, nNewIndex ); - if ( !bRangeNameReplace ) - bRangeNameReplace = ( nOldIndex != nNewIndex ); - } - else - { - ScRangeData* pData = new ScRangeData( *pClipRangeData ); - pData->SetDocument(this); - if ( pRangeName->FindIndex( pData->GetIndex() ) ) - pData->SetIndex(0); // need new index, done in Insert - if ( pRangeName->Insert( pData ) ) - { - pClipRangeNames[i] = pData; - USHORT nOldIndex = pClipRangeData->GetIndex(); - USHORT nNewIndex = pData->GetIndex(); - aClipRangeMap.SetPair( i, nOldIndex, nNewIndex ); - if ( !bRangeNameReplace ) - bRangeNameReplace = ( nOldIndex != nNewIndex ); - } - else - { // must be an overflow - delete pData; - pClipRangeNames[i] = NULL; - aClipRangeMap.SetPair( i, pClipRangeData->GetIndex(), 0 ); - bRangeNameReplace = TRUE; - } - } - } SCCOL nAllCol1 = rDestRange.aStart.Col(); SCROW nAllRow1 = rDestRange.aStart.Row(); SCCOL nAllCol2 = rDestRange.aEnd.Col(); @@ -1904,17 +2008,18 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar SCCOL nXw = 0; SCROW nYw = 0; + ScRange aClipRange = pClipDoc->GetClipParam().getWholeRange(); for (SCTAB nTab = 0; nTab <= MAXTAB; nTab++) // find largest merge overlap if (pClipDoc->pTab[nTab]) // all sheets of the clipboard content { - SCCOL nThisEndX = pClipDoc->aClipRange.aEnd.Col(); - SCROW nThisEndY = pClipDoc->aClipRange.aEnd.Row(); - pClipDoc->ExtendMerge( pClipDoc->aClipRange.aStart.Col(), - pClipDoc->aClipRange.aStart.Row(), + SCCOL nThisEndX = aClipRange.aEnd.Col(); + SCROW nThisEndY = aClipRange.aEnd.Row(); + pClipDoc->ExtendMerge( aClipRange.aStart.Col(), + aClipRange.aStart.Row(), nThisEndX, nThisEndY, nTab ); // only extra value from ExtendMerge - nThisEndX = sal::static_int_cast( nThisEndX - pClipDoc->aClipRange.aEnd.Col() ); - nThisEndY = sal::static_int_cast( nThisEndY - pClipDoc->aClipRange.aEnd.Row() ); + nThisEndX = sal::static_int_cast( nThisEndX - aClipRange.aEnd.Col() ); + nThisEndY = sal::static_int_cast( nThisEndY - aClipRange.aEnd.Row() ); if ( nThisEndX > nXw ) nXw = nThisEndX; if ( nThisEndY > nYw ) @@ -1981,10 +2086,10 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar if (bDoDouble) ScColumn::bDoubleAlloc = TRUE; - SCCOL nClipStartCol = pClipDoc->aClipRange.aStart.Col(); - SCROW nClipStartRow = pClipDoc->aClipRange.aStart.Row(); + SCCOL nClipStartCol = aClipRange.aStart.Col(); + SCROW nClipStartRow = aClipRange.aStart.Row(); // WaE: commented because unused: SCCOL nClipEndCol = pClipDoc->aClipRange.aEnd.Col(); - SCROW nClipEndRow = pClipDoc->aClipRange.aEnd.Row(); + SCROW nClipEndRow = aClipRange.aEnd.Row(); for (ULONG nRange = 0; nRange < pDestRanges->Count(); ++nRange) { const ScRange* pRange = pDestRanges->GetObject( nRange); @@ -2035,7 +2140,7 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar nC2 = Min((SCCOL)(nC1 + nXw), nCol2); } while (nC1 <= nCol2); if (nClipStartRow > nClipEndRow) - nClipStartRow = pClipDoc->aClipRange.aStart.Row(); + nClipStartRow = aClipRange.aStart.Row(); nC1 = nCol1; nC2 = nC1 + nXw; if (nC2 > nCol2) @@ -2052,75 +2157,168 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar pTab[k]->DecRecalcLevel(); bInsertingFromOtherDoc = FALSE; - pFormatExchangeList = NULL; - if ( bRangeNameReplace ) - { - // first update all inserted named formulas if they contain other - // range names and used indices changed - for (USHORT i = 0; i < nClipRangeNames; i++) //! DB-Bereiche Pivot-Bereiche auch - { - if ( pClipRangeNames[i] ) - pClipRangeNames[i]->ReplaceRangeNamesInUse( aClipRangeMap ); - } - // then update the formulas, they might need the just updated range names - for (ULONG nRange = 0; nRange < pDestRanges->Count(); ++nRange) - { - const ScRange* pRange = pDestRanges->GetObject( nRange); - SCCOL nCol1 = pRange->aStart.Col(); - SCROW nRow1 = pRange->aStart.Row(); - SCCOL nCol2 = pRange->aEnd.Col(); - SCROW nRow2 = pRange->aEnd.Row(); - - SCCOL nC1 = nCol1; - SCROW nR1 = nRow1; - SCCOL nC2 = nC1 + nXw; - if (nC2 > nCol2) - nC2 = nCol2; - SCROW nR2 = nR1 + nYw; - if (nR2 > nRow2) - nR2 = nRow2; - do - { - do - { - for (SCTAB k = 0; k <= MAXTAB; k++) - { - if ( pTab[k] && rMark.GetTableSelect(k) ) - pTab[k]->ReplaceRangeNamesInUse(nC1, nR1, - nC2, nR2, aClipRangeMap ); - } - nC1 = nC2 + 1; - nC2 = Min((SCCOL)(nC1 + nXw), nCol2); - } while (nC1 <= nCol2); - nC1 = nCol1; - nC2 = nC1 + nXw; - if (nC2 > nCol2) - nC2 = nCol2; - nR1 = nR2 + 1; - nR2 = Min((SCROW)(nR1 + nYw), nRow2); - } while (nR1 <= nRow2); - } - } - if ( pClipRangeNames ) - delete [] pClipRangeNames; + + UpdateRangeNamesInFormulas(aClipRangeNames, *pDestRanges, rMark, nXw, nYw); + // Listener aufbauen nachdem alles inserted wurde StartListeningFromClip( nAllCol1, nAllRow1, nAllCol2, nAllRow2, rMark, nInsFlag ); // nachdem alle Listener aufgebaut wurden, kann gebroadcastet werden BroadcastFromClip( nAllCol1, nAllRow1, nAllCol2, nAllRow2, rMark, nInsFlag ); if (bResetCut) - pClipDoc->bCutMode = FALSE; + pClipDoc->GetClipParam().mbCutMode = false; SetAutoCalc( bOldAutoCalc ); } } } +static SCROW lcl_getLastNonFilteredRow( + const ScBitMaskCompressedArray& rFlags, SCROW nBegRow, SCROW nEndRow, + SCROW nRowCount) +{ + SCROW nFilteredRow = rFlags.GetFirstForCondition( + nBegRow, nEndRow, CR_FILTERED, CR_FILTERED); + + SCROW nRow = nFilteredRow - 1; + if (nRow - nBegRow + 1 > nRowCount) + // make sure the row range stays within the data size. + nRow = nBegRow + nRowCount - 1; + + return nRow; +} + +void ScDocument::CopyMultiRangeFromClip( + const ScAddress& rDestPos, const ScMarkData& rMark, sal_uInt16 nInsFlag, ScDocument* pClipDoc, + bool bResetCut, bool bAsLink, bool /*bIncludeFiltered*/, bool bSkipAttrForEmpty) +{ + if (bIsClip) + return; + + if (!pClipDoc->bIsClip || !pClipDoc->GetTableCount()) + // There is nothing in the clip doc to copy. + return; + + BOOL bOldAutoCalc = GetAutoCalc(); + SetAutoCalc( FALSE ); // avoid multiple recalculations + + NumFmtMergeHandler aNumFmtMergeHdl(this, pClipDoc); + + ScClipRangeNameData aClipRangeNames; + CopyRangeNamesFromClip(pClipDoc, aClipRangeNames); + + SCCOL nCol1 = rDestPos.Col(); + SCROW nRow1 = rDestPos.Row(); + ScClipParam& rClipParam = pClipDoc->GetClipParam(); + + ScCopyBlockFromClipParams aCBFCP; + aCBFCP.pRefUndoDoc = NULL; + aCBFCP.pClipDoc = pClipDoc; + aCBFCP.nInsFlag = nInsFlag; + aCBFCP.bAsLink = bAsLink; + aCBFCP.bSkipAttrForEmpty = bSkipAttrForEmpty; + aCBFCP.nTabStart = MAXTAB; + aCBFCP.nTabEnd = 0; + + for (SCTAB j = 0; j <= MAXTAB; ++j) + { + if (pTab[j] && rMark.GetTableSelect(j)) + { + if ( j < aCBFCP.nTabStart ) + aCBFCP.nTabStart = j; + aCBFCP.nTabEnd = j; + pTab[j]->IncRecalcLevel(); + } + } + + ScRange aDestRange; + rMark.GetMarkArea(aDestRange); + SCROW nLastMarkedRow = aDestRange.aEnd.Row(); + + bInsertingFromOtherDoc = TRUE; // kein Broadcast/Listener aufbauen bei Insert + + SCROW nBegRow = nRow1; + sal_uInt16 nDelFlag = IDF_CONTENTS; + const ScBitMaskCompressedArray& rFlags = GetRowFlagsArray(aCBFCP.nTabStart); + + for (ScRange* p = rClipParam.maRanges.First(); p; p = rClipParam.maRanges.Next()) + { + // The begin row must not be filtered. + + SCROW nRowCount = p->aEnd.Row() - p->aStart.Row() + 1; + + SCsCOL nDx = static_cast(nCol1 - p->aStart.Col()); + SCsROW nDy = static_cast(nBegRow - p->aStart.Row()); + SCCOL nCol2 = nCol1 + p->aEnd.Col() - p->aStart.Col(); + + SCROW nEndRow = lcl_getLastNonFilteredRow(rFlags, nBegRow, nLastMarkedRow, nRowCount); + + if (!bSkipAttrForEmpty) + DeleteArea(nCol1, nBegRow, nCol2, nEndRow, rMark, nDelFlag); + + CopyBlockFromClip(nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP); + nRowCount -= nEndRow - nBegRow + 1; + + while (nRowCount > 0) + { + // Get the first non-filtered row. + SCROW nNonFilteredRow = rFlags.GetFirstForCondition(nEndRow+1, nLastMarkedRow, CR_FILTERED, 0); + if (nNonFilteredRow > nLastMarkedRow) + return; + + SCROW nRowsSkipped = nNonFilteredRow - nEndRow - 1; + nDy += nRowsSkipped; + + nBegRow = nNonFilteredRow; + nEndRow = lcl_getLastNonFilteredRow(rFlags, nBegRow, nLastMarkedRow, nRowCount); + + if (!bSkipAttrForEmpty) + DeleteArea(nCol1, nBegRow, nCol2, nEndRow, rMark, nDelFlag); + + CopyBlockFromClip(nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP); + nRowCount -= nEndRow - nBegRow + 1; + } + + if (rClipParam.meDirection == ScClipParam::Row) + // Begin row for the next range being pasted. + nBegRow = rFlags.GetFirstForCondition(nEndRow+1, nLastMarkedRow, CR_FILTERED, 0); + else + nBegRow = nRow1; + + if (rClipParam.meDirection == ScClipParam::Column) + nCol1 += p->aEnd.Col() - p->aStart.Col() + 1; + } + + for (SCTAB i = 0; i <= MAXTAB; i++) + if (pTab[i] && rMark.GetTableSelect(i)) + pTab[i]->DecRecalcLevel(); + + bInsertingFromOtherDoc = FALSE; + + ScRangeList aRanges; + aRanges.Append(aDestRange); + SCCOL nCols = aDestRange.aEnd.Col() - aDestRange.aStart.Col() + 1; + SCROW nRows = aDestRange.aEnd.Row() - aDestRange.aStart.Row() + 1; + UpdateRangeNamesInFormulas(aClipRangeNames, aRanges, rMark, nCols-1, nRows-1); + + // Listener aufbauen nachdem alles inserted wurde + StartListeningFromClip(aDestRange.aStart.Col(), aDestRange.aStart.Row(), + aDestRange.aEnd.Col(), aDestRange.aEnd.Row(), rMark, nInsFlag ); + // nachdem alle Listener aufgebaut wurden, kann gebroadcastet werden + BroadcastFromClip(aDestRange.aStart.Col(), aDestRange.aStart.Row(), + aDestRange.aEnd.Col(), aDestRange.aEnd.Row(), rMark, nInsFlag ); + + if (bResetCut) + pClipDoc->GetClipParam().mbCutMode = false; + SetAutoCalc( bOldAutoCalc ); +} void ScDocument::SetClipArea( const ScRange& rArea, BOOL bCut ) { if (bIsClip) { - aClipRange = rArea; - bCutMode = bCut; + ScClipParam& rClipParam = GetClipParam(); + rClipParam.maRanges.RemoveAll(); + rClipParam.maRanges.Append(rArea); + rClipParam.mbCutMode = bCut; } else { @@ -2131,33 +2329,53 @@ void ScDocument::SetClipArea( const ScRange& rArea, BOOL bCut ) void ScDocument::GetClipArea(SCCOL& nClipX, SCROW& nClipY, BOOL bIncludeFiltered) { - if (bIsClip) + if (!bIsClip) { - nClipX = aClipRange.aEnd.Col() - aClipRange.aStart.Col(); + DBG_ERROR("GetClipArea: kein Clip"); + return; + } - if ( bIncludeFiltered ) - nClipY = aClipRange.aEnd.Row() - aClipRange.aStart.Row(); - else - { - // count non-filtered rows - // count on first used table in clipboard - SCTAB nCountTab = 0; - while ( nCountTab < MAXTAB && !pTab[nCountTab] ) - ++nCountTab; - - SCROW nResult = GetRowFlagsArray( nCountTab).CountForCondition( - aClipRange.aStart.Row(), aClipRange.aEnd.Row(), - CR_FILTERED, 0); - - if ( nResult > 0 ) - nClipY = nResult - 1; - else - nClipY = 0; // always return at least 1 row - } + ScRangeList& rClipRanges = GetClipParam().maRanges; + if (!rClipRanges.Count()) + // No clip range. Bail out. + return; + + ScRangePtr p = rClipRanges.First(); + SCCOL nStartCol = p->aStart.Col(); + SCCOL nEndCol = p->aEnd.Col(); + SCROW nStartRow = p->aStart.Row(); + SCROW nEndRow = p->aEnd.Row(); + for (p = rClipRanges.Next(); p; p = rClipRanges.Next()) + { + if (p->aStart.Col() < nStartCol) + nStartCol = p->aStart.Col(); + if (p->aStart.Row() < nStartRow) + nStartRow = p->aStart.Row(); + if (p->aEnd.Col() > nEndCol) + nEndCol = p->aEnd.Col(); + if (p->aEnd.Row() < nEndRow) + nEndRow = p->aEnd.Row(); } + + nClipX = nEndCol - nStartCol; + + if ( bIncludeFiltered ) + nClipY = nEndRow - nStartRow; else { - DBG_ERROR("GetClipArea: kein Clip"); + // count non-filtered rows + // count on first used table in clipboard + SCTAB nCountTab = 0; + while ( nCountTab < MAXTAB && !pTab[nCountTab] ) + ++nCountTab; + + SCROW nResult = GetRowFlagsArray( nCountTab).CountForCondition( + nStartRow, nEndRow, CR_FILTERED, 0); + + if ( nResult > 0 ) + nClipY = nResult - 1; + else + nClipY = 0; // always return at least 1 row } } @@ -2166,8 +2384,12 @@ void ScDocument::GetClipStart(SCCOL& nClipX, SCROW& nClipY) { if (bIsClip) { - nClipX = aClipRange.aStart.Col(); - nClipY = aClipRange.aStart.Row(); + ScRangeList& rClipRanges = GetClipParam().maRanges; + if (rClipRanges.Count()) + { + nClipX = rClipRanges.First()->aStart.Col(); + nClipY = rClipRanges.First()->aStart.Row(); + } } else { @@ -2183,8 +2405,12 @@ BOOL ScDocument::HasClipFilteredRows() while ( nCountTab < MAXTAB && !pTab[nCountTab] ) ++nCountTab; - return GetRowFlagsArray( nCountTab).HasCondition( aClipRange.aStart.Row(), - aClipRange.aEnd.Row(), CR_FILTERED, CR_FILTERED); + ScRangeList& rClipRanges = GetClipParam().maRanges; + if (!rClipRanges.Count()) + return false; + + return GetRowFlagsArray( nCountTab).HasCondition( rClipRanges.First()->aStart.Row(), + rClipRanges.First()->aEnd.Row(), CR_FILTERED, CR_FILTERED); } diff --git a/sc/source/core/data/makefile.mk b/sc/source/core/data/makefile.mk index 29618da6630b..d2c700c5f95d 100644 --- a/sc/source/core/data/makefile.mk +++ b/sc/source/core/data/makefile.mk @@ -56,6 +56,7 @@ SLOFILES = \ $(SLO)$/bcaslot.obj \ $(SLO)$/cell.obj \ $(SLO)$/cell2.obj \ + $(SLO)$/clipparam.obj \ $(SLO)$/column.obj \ $(SLO)$/column2.obj \ $(SLO)$/column3.obj \ @@ -117,6 +118,7 @@ EXCEPTIONSFILES= \ $(SLO)$/autonamecache.obj \ $(SLO)$/bcaslot.obj \ $(SLO)$/cell2.obj \ + $(SLO)$/clipparam.obj \ $(SLO)$/column.obj \ $(SLO)$/column3.obj \ $(SLO)$/documen2.obj \ diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 1f1d82023f45..10197e3a9ad5 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1327,7 +1327,7 @@ void ScTable::FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n void ScTable::ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - const ScIndexMap& rMap ) + const ScRangeData::IndexMap& rMap ) { for (SCCOL i = nCol1; i <= nCol2 && (ValidCol(i)); i++) { diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 104fb46b4495..c8a25fbe0ec1 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -371,6 +371,16 @@ void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, } } +void ScTable::CopyToClip(const ScRangeList& rRanges, ScTable* pTable, + bool bKeepScenarioFlags, bool bCloneNoteCaptions) +{ + ScRangeList aRanges(rRanges); + for (ScRangePtr p = aRanges.First(); p; p = aRanges.Next()) + { + CopyToClip(p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), + pTable, bKeepScenarioFlags, bCloneNoteCaptions); + } +} void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, USHORT nInsFlag, diff --git a/sc/source/core/tool/indexmap.cxx b/sc/source/core/tool/indexmap.cxx deleted file mode 100644 index 50d0347a0aa9..000000000000 --- a/sc/source/core/tool/indexmap.cxx +++ /dev/null @@ -1,80 +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: indexmap.cxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sc.hxx" - - - - - -#include - -#include "indexmap.hxx" - - -ScIndexMap::ScIndexMap( USHORT nEntries ) -{ - nCount = nEntries; - ULONG nC = nEntries ? ((ULONG) nEntries * 2) : 2; - pMap = new USHORT [ nC ]; - memset( pMap, 0, nC * sizeof(USHORT) ); -} - - -ScIndexMap::~ScIndexMap() -{ - delete [] pMap; -} - - -void ScIndexMap::SetPair( USHORT nEntry, USHORT nIndex1, USHORT nIndex2 ) -{ - if ( nEntry < nCount ) - { - ULONG nOff = (ULONG) nEntry * 2; - pMap[nOff] = nIndex1; - pMap[nOff+1] = nIndex2; - } -} - - -USHORT ScIndexMap::Find( USHORT nIndex1 ) const -{ - USHORT* pStop = pMap + (ULONG) nCount * 2; - for ( USHORT* pOff = pMap; pOff < pStop; pOff += 2 ) - { - if ( *pOff == nIndex1 ) - return *(pOff+1); - } - return nIndex1; -} - - diff --git a/sc/source/core/tool/makefile.mk b/sc/source/core/tool/makefile.mk index ac0aa23fc044..52d9bad7c18c 100644 --- a/sc/source/core/tool/makefile.mk +++ b/sc/source/core/tool/makefile.mk @@ -80,7 +80,6 @@ SLOFILES = \ $(SLO)$/filtopt.obj \ $(SLO)$/formulaparserpool.obj \ $(SLO)$/hints.obj \ - $(SLO)$/indexmap.obj \ $(SLO)$/inputopt.obj \ $(SLO)$/interpr1.obj \ $(SLO)$/interpr2.obj \ diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index 0f2475bc2f65..3f0cadbadb7f 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -49,7 +49,6 @@ #include "rechead.hxx" #include "refupdat.hxx" #include "document.hxx" -#include "indexmap.hxx" using namespace formula; @@ -588,20 +587,20 @@ void ScRangeData::TransferTabRef( SCTAB nOldTab, SCTAB nNewTab ) } } - -void ScRangeData::ReplaceRangeNamesInUse( const ScIndexMap& rMap ) +void ScRangeData::ReplaceRangeNamesInUse( const IndexMap& rMap ) { - BOOL bCompile = FALSE; + bool bCompile = false; for ( FormulaToken* p = pCode->First(); p; p = pCode->Next() ) { if ( p->GetOpCode() == ocName ) { - const USHORT nOldIndex = p->GetIndex(); - const USHORT nNewIndex = rMap.Find( nOldIndex ); + const sal_uInt16 nOldIndex = p->GetIndex(); + IndexMap::const_iterator itr = rMap.find(nOldIndex); + const sal_uInt16 nNewIndex = itr == rMap.end() ? nOldIndex : itr->second; if ( nOldIndex != nNewIndex ) { p->SetIndex( nNewIndex ); - bCompile = TRUE; + bCompile = true; } } } diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index a290a81d9078..a9e5f7ce8218 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -63,6 +63,7 @@ #include "sc.hrc" //CHINA001 #include "scabstdlg.hxx" //CHINA001 +#include "clipparam.hxx" struct AreaLink_Impl { @@ -389,9 +390,8 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter, aSourceMark.SelectOneTable( nSrcTab ); // selektieren fuer CopyToClip aSourceMark.SetMarkArea( aTokenRange ); - pSrcDoc->CopyToClip( aTokenRange.aStart.Col(), aTokenRange.aStart.Row(), - aTokenRange.aEnd.Col(), aTokenRange.aEnd.Row(), - FALSE, &aClipDoc, FALSE, &aSourceMark ); + ScClipParam aClipParam(aTokenRange, false); + pSrcDoc->CopyToClip(aClipParam, &aClipDoc, &aSourceMark); if ( aClipDoc.HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab, HASATTR_MERGED | HASATTR_OVERLAPPED ) ) diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 424e4731a324..608c1c688ea9 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -94,6 +94,7 @@ #include "compiler.hxx" #include "scui_def.hxx" //CHINA001 #include "tabprotection.hxx" +#include "clipparam.hxx" #include @@ -2276,8 +2277,8 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, } ScDrawLayer::SetGlobalDrawPersist(aDragShellRef); - pDoc->CopyToClip( nStartCol, nStartRow, nEndCol, nEndRow, bCut, pClipDoc, - FALSE, &aSourceMark, bScenariosAdded, TRUE ); + ScClipParam aClipParam(ScRange(nStartCol, nStartRow, 0, nEndCol, nEndRow, 0), false); + pDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bScenariosAdded, true); ScDrawLayer::SetGlobalDrawPersist(NULL); diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx index 8e09b7350bb1..90adbe40d2d2 100644 --- a/sc/source/ui/inc/cellsh.hxx +++ b/sc/source/ui/inc/cellsh.hxx @@ -42,6 +42,7 @@ class SvxClipboardFmtItem; class TransferableDataHelper; class TransferableClipboardListener; class AbstractScLinkedAreaDlg; +class ScTabViewShell; struct CellShell_Impl { @@ -101,6 +102,8 @@ public: void ExecutePageSel( SfxRequest& rReq ); void ExecuteMove( SfxRequest& rReq ); void GetStateCursor( SfxItemSet& rSet ); + + static void PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, bool bShowDialog ); }; #endif diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 228c4b4c1489..066aadca817a 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -348,6 +348,11 @@ private: void PasteRTF( SCCOL nCol, SCROW nStartRow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable ); + bool PasteMultiRangesFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, sal_uInt16 nFunction, + bool bSkipEmpty, bool bTranspos, bool bAsLink, bool bAllowDialogs, + InsCellCmd eMoveMode, sal_uInt16 nCondFlags, sal_uInt16 nUndoFlags ); + void PostPasteFromClip(const ScRange& rPasteRange, const ScMarkData& rMark); + USHORT GetOptimalColWidth( SCCOL nCol, SCTAB nTab, BOOL bFormula ); void StartFormatArea(); diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index a2db7e4e48f0..af3b5f0dee5e 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -71,6 +71,7 @@ #include "navicfg.hxx" #include "navsett.hxx" #include "postit.hxx" +#include "clipparam.hxx" using namespace com::sun::star; @@ -1103,9 +1104,8 @@ void lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, USHORT nFlag aMark ) ) { ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP ); - pSrcDoc->CopyToClip( rRange.aStart.Col(), rRange.aStart.Row(), - rRange.aEnd.Col(), rRange.aEnd.Row(), - FALSE, pClipDoc, FALSE, &aMark ); + ScClipParam aClipParam(rRange, false); + pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark); // pClipDoc->ExtendMerge( rRange, TRUE ); TransferableObjectDescriptor aObjDesc; diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index e44f5e7a6478..3df8e99348c0 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -64,6 +64,7 @@ #include "transobj.hxx" #include "refundo.hxx" #include "undoolk.hxx" +#include "clipparam.hxx" #include "sc.hrc" @@ -1316,9 +1317,8 @@ void __EXPORT ScUndoDragDrop::Redo() aSourceMark.SelectTable( nTab, TRUE ); // do not clone objects and note captions into clipdoc (see above) - pDoc->CopyToClip( aSrcRange.aStart.Col(), aSrcRange.aStart.Row(), - aSrcRange.aEnd.Col(), aSrcRange.aEnd.Row(), - bCut, pClipDoc, FALSE, &aSourceMark, bKeepScenarioFlags, FALSE, FALSE ); + ScClipParam aClipParam(aSrcRange, bCut); + pDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bKeepScenarioFlags, false, false); if (bCut) { diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 1d9f3a1d9213..a50b4003b0ac 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -57,6 +57,7 @@ #include "patattr.hxx" #include "docpool.hxx" #include "attrib.hxx" +#include "clipparam.hxx" using namespace com::sun::star; @@ -175,9 +176,8 @@ BOOL lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange, ScMarkData aSourceMark; aSourceMark.SelectOneTable( nSrcTab ); // for CopyToClip aSourceMark.SetMarkArea( rSrcRange ); - pSrcDoc->CopyToClip( rSrcRange.aStart.Col(),rSrcRange.aStart.Row(), - rSrcRange.aEnd.Col(),rSrcRange.aEnd.Row(), - FALSE, pClipDoc, FALSE, &aSourceMark ); + ScClipParam aClipParam(rSrcRange, false); + pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false); if ( pClipDoc->HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab, HASATTR_MERGED | HASATTR_OVERLAPPED ) ) diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 54c8ff12e189..722885363346 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -206,7 +206,6 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet ) break; case SID_COPY: // Kopieren - bDisable = (!bSimpleArea && eMarkType != SC_MARK_SIMPLE_FILTERED); // nur wegen Matrix nicht editierbar? Matrix nicht zerreissen //! schlaegt nicht zu, wenn geschuetzt UND Matrix, aber damit //! muss man leben.. wird in Copy-Routine abgefangen, sonst diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index e5bb702402d8..7f632f62c2ba 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -104,6 +104,7 @@ #include "dpgroup.hxx" // for ScDPNumGroupInfo #include "spellparam.hxx" #include "postit.hxx" +#include "clipparam.hxx" #include "globstr.hrc" #include "scui_def.hxx" //CHINA001 @@ -1182,41 +1183,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) case SID_PASTE: { - Window* pWin = GetViewData()->GetActiveWin(); - ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); - ScDocument* pThisDoc = GetViewData()->GetDocument(); - ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); - if ( pOwnClip && pDPObj ) - { - // paste from Calc into DataPilot table: sort (similar to drag & drop) - - ScDocument* pClipDoc = pOwnClip->GetDocument(); - SCTAB nSourceTab = pOwnClip->GetVisibleTab(); - - SCCOL nClipStartX; - SCROW nClipStartY; - SCCOL nClipEndX; - SCROW nClipEndY; - pClipDoc->GetClipStart( nClipStartX, nClipStartY ); - pClipDoc->GetClipArea( nClipEndX, nClipEndY, TRUE ); - nClipEndX = nClipEndX + nClipStartX; - nClipEndY = nClipEndY + nClipStartY; // GetClipArea returns the difference - - ScRange aSource( nClipStartX, nClipStartY, nSourceTab, nClipEndX, nClipEndY, nSourceTab ); - BOOL bDone = pTabViewShell->DataPilotMove( aSource, GetViewData()->GetCurPos() ); - if ( !bDone ) - pTabViewShell->ErrorMessage( STR_ERR_DATAPILOT_INPUT ); - } - else - { - // normal paste - WaitObject aWait( GetViewData()->GetDialogParent() ); - pTabViewShell->PasteFromSystem(); - } + PasteFromClipboard ( GetViewData(), pTabViewShell, true ); rReq.Done(); } - pTabViewShell->CellContentChanged(); // => PasteFromSystem() ??? break; case SID_CLIPBOARD_FORMAT_ITEMS: @@ -2226,3 +2195,52 @@ IMPL_LINK( ScCellShell, DialogClosed, AbstractScLinkedAreaDlg*, EMPTYARG ) return 0; } +void ScCellShell::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, bool bShowDialog ) +{ + Window* pWin = pViewData->GetActiveWin(); + ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); + ScDocument* pThisDoc = pViewData->GetDocument(); + ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( pViewData->GetCurX(), + pViewData->GetCurY(), pViewData->GetTabNo() ); + if ( pOwnClip && pDPObj ) + { + // paste from Calc into DataPilot table: sort (similar to drag & drop) + + ScDocument* pClipDoc = pOwnClip->GetDocument(); + SCTAB nSourceTab = pOwnClip->GetVisibleTab(); + + SCCOL nClipStartX; + SCROW nClipStartY; + SCCOL nClipEndX; + SCROW nClipEndY; + pClipDoc->GetClipStart( nClipStartX, nClipStartY ); + pClipDoc->GetClipArea( nClipEndX, nClipEndY, TRUE ); + nClipEndX = nClipEndX + nClipStartX; + nClipEndY = nClipEndY + nClipStartY; // GetClipArea returns the difference + + ScRange aSource( nClipStartX, nClipStartY, nSourceTab, nClipEndX, nClipEndY, nSourceTab ); + BOOL bDone = pTabViewShell->DataPilotMove( aSource, pViewData->GetCurPos() ); + if ( !bDone ) + pTabViewShell->ErrorMessage( STR_ERR_DATAPILOT_INPUT ); + } + else + { + // normal paste + WaitObject aWait( pViewData->GetDialogParent() ); + if (!pOwnClip) + pTabViewShell->PasteFromSystem(); + else + { + ScDocument* pClipDoc = pOwnClip->GetDocument(); + sal_uInt16 nFlags = IDF_ALL; + if (pClipDoc->GetClipParam().isMultiRange()) + // For multi-range paste, we paste values by default. + nFlags &= ~IDF_FORMULA; + + pTabViewShell->PasteFromClip( nFlags, pClipDoc, + PASTE_NOFUNC, FALSE, FALSE, FALSE, INS_NONE, IDF_NONE, + bShowDialog ); // allow warning dialog + } + } + pTabViewShell->CellContentChanged(); // => PasteFromSystem() ??? +} diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 3bfb8729cd37..db1a8952aeef 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -49,6 +49,7 @@ #include "sc.hrc" #include "globstr.hrc" #include "transobj.hxx" +#include "clipparam.hxx" // STATIC DATA ----------------------------------------------------------- @@ -447,7 +448,8 @@ void ScTabControl::DoDrag( const Region& /* rRegion */ ) aTabMark.SetMarkArea( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab) ); ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP ); - pDoc->CopyToClip( 0,0, MAXCOL,MAXROW, FALSE, pClipDoc, FALSE, &aTabMark ); + ScClipParam aClipParam(ScRange(0, 0, 0, MAXCOL, MAXROW, 0), false); + pDoc->CopyToClip(aClipParam, pClipDoc, &aTabMark, false); TransferableObjectDescriptor aObjDesc; pDocSh->FillTransferableObjectDescriptor( aObjDesc ); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 29ebede481b9..e34741ba4c6b 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1510,7 +1510,7 @@ BOOL ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt) // #51889# Spezialfall: Copy/Cut bei Mehrfachselektion -> Fehlermeldung // (Slot ist disabled, SfxViewShell::KeyInput wuerde also kommentarlos verschluckt) KeyFuncType eFunc = aCode.GetFunction(); - if ( eFunc == KEYFUNC_COPY || eFunc == KEYFUNC_CUT ) + if ( eFunc == KEYFUNC_CUT ) { ScRange aDummy; ScMarkType eMarkType = GetViewData()->GetSimpleArea( aDummy ); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 9dda9a097395..4b5d59b80284 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -212,6 +212,7 @@ #include "transobj.hxx" #include "drwtrans.hxx" #include "docuno.hxx" +#include "clipparam.hxx" using namespace com::sun::star; @@ -312,10 +313,10 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI ScRange aRange; ScMarkType eMarkType = GetViewData()->GetSimpleArea( aRange ); + ScDocument* pDoc = GetViewData()->GetDocument(); + ScMarkData& rMark = GetViewData()->GetMarkData(); if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED ) { - ScDocument* pDoc = GetViewData()->GetDocument(); - ScMarkData& rMark = GetViewData()->GetMarkData(); if ( !pDoc->HasSelectedBlockMatrixFragment( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), @@ -342,9 +343,8 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) ); } - pDoc->CopyToClip( aRange.aStart.Col(), aRange.aStart.Row(), - aRange.aEnd.Col(), aRange.aEnd.Row(), - bCut, pClipDoc, FALSE, &rMark, FALSE, bIncludeObjects ); + ScClipParam aClipParam(aRange, bCut); + pDoc->CopyToClip(aClipParam, pClipDoc, &rMark, false, false, bIncludeObjects); if (bSysClip) { ScDrawLayer::SetGlobalDrawPersist(NULL); @@ -382,6 +382,124 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI ErrorMessage(STR_MATRIXFRAGMENTERR); } } + else if (eMarkType == SC_MARK_MULTI) + { + bool bSuccess = false; + ScClipParam aClipParam; + aClipParam.mbCutMode = false; + rMark.MarkToSimple(); + rMark.FillRangeListWithMarks(&aClipParam.maRanges, false); + + do + { + if (bCut) + // We con't support cutting of multi-selections. + break; + + if (pClipDoc) + // TODO: What's this for? + break; + + ::std::auto_ptr pDocClip(new ScDocument(SCDOCMODE_CLIP)); + + // Check for geometrical feasibility of the ranges. + bool bValidRanges = true; + ScRangePtr p = aClipParam.maRanges.First(); + SCCOL nPrevColDelta = 0; + SCROW nPrevRowDelta = 0; + SCCOL nPrevCol = p->aStart.Col(); + SCROW nPrevRow = p->aStart.Row(); + SCCOL nPrevColSize = p->aEnd.Col() - p->aStart.Col() + 1; + SCROW nPrevRowSize = p->aEnd.Row() - p->aStart.Row() + 1; + for (p = aClipParam.maRanges.Next(); p; p = aClipParam.maRanges.Next()) + { + if (pDoc->HasSelectedBlockMatrixFragment( + p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), rMark)) + { + if (!bApi) + ErrorMessage(STR_MATRIXFRAGMENTERR); + return false; + } + + SCCOL nColDelta = p->aStart.Col() - nPrevCol; + SCROW nRowDelta = p->aStart.Row() - nPrevRow; + + if ((nColDelta && nRowDelta) || (nPrevColDelta && nRowDelta) || (nPrevRowDelta && nColDelta)) + { + bValidRanges = false; + break; + } + + if (aClipParam.meDirection == ScClipParam::Unspecified) + { + if (nColDelta) + aClipParam.meDirection = ScClipParam::Column; + if (nRowDelta) + aClipParam.meDirection = ScClipParam::Row; + } + + SCCOL nColSize = p->aEnd.Col() - p->aStart.Col() + 1; + SCROW nRowSize = p->aEnd.Row() - p->aStart.Row() + 1; + + if (aClipParam.meDirection == ScClipParam::Column && nRowSize != nPrevRowSize) + { + // column-oriented ranges must have identical row size. + bValidRanges = false; + break; + } + if (aClipParam.meDirection == ScClipParam::Row && nColSize != nPrevColSize) + { + // likewise, row-oriented ranges must have identical + // column size. + bValidRanges = false; + break; + } + + nPrevCol = p->aStart.Col(); + nPrevRow = p->aStart.Row(); + nPrevColDelta = nColDelta; + nPrevRowDelta = nRowDelta; + nPrevColSize = nColSize; + nPrevRowSize = nRowSize; + } + if (!bValidRanges) + break; + + pDoc->CopyToClip(aClipParam, pDocClip.get(), false, &rMark, false, bIncludeObjects); + + ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack(); + if ( pChangeTrack ) + pChangeTrack->ResetLastCut(); // kein CutMode mehr + + { + ScDocShell* pDocSh = GetViewData()->GetDocShell(); + TransferableObjectDescriptor aObjDesc; + pDocSh->FillTransferableObjectDescriptor( aObjDesc ); + aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass(); + // maSize is set in ScTransferObj ctor + + ScTransferObj* pTransferObj = new ScTransferObj( pDocClip.release(), aObjDesc ); + uno::Reference xTransferable( pTransferObj ); + + if ( ScGlobal::pDrawClipDocShellRef ) + { + SfxObjectShellRef aPersistRef( &(*ScGlobal::pDrawClipDocShellRef) ); + pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive + } + + pTransferObj->CopyToClipboard( GetActiveWin() ); // system clipboard + SC_MOD()->SetClipObject( pTransferObj, NULL ); // internal clipboard + } + + bSuccess = true; + } + while (false); + + if (!bSuccess && !bApi) + ErrorMessage(STR_NOMULTISELECT); + + bDone = bSuccess; + } else { if (!bApi) @@ -408,9 +526,8 @@ ScTransferObj* ScViewFunc::CopyToTransferable() BOOL bAnyOle = pDoc->HasOLEObjectsInArea( aRange, &rMark ); ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) ); - pDoc->CopyToClip( aRange.aStart.Col(), aRange.aStart.Row(), - aRange.aEnd.Col(), aRange.aEnd.Row(), - FALSE, pClipDoc, FALSE, &rMark, FALSE, TRUE ); + ScClipParam aClipParam(aRange, false); + pDoc->CopyToClip(aClipParam, pClipDoc, &rMark, false, false, true); ScDrawLayer::SetGlobalDrawPersist(NULL); pClipDoc->ExtendMerge( aRange, TRUE ); @@ -739,6 +856,52 @@ BOOL lcl_SelHasAttrib( ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, // internes Paste +namespace { + +class CursorSwitcher +{ +public: + CursorSwitcher(ScViewFunc* pViewFunc) : + mpViewFunc(pViewFunc) + { + mpViewFunc->HideCursor(); + } + + ~CursorSwitcher() + { + mpViewFunc->ShowCursor(); + } +private: + ScViewFunc* mpViewFunc; +}; + +bool lcl_checkDestRangeForOverwrite(const ScRange& rDestRange, const ScDocument* pDoc, const ScMarkData& rMark, Window* pParentWnd) +{ + bool bIsEmpty = true; + SCTAB nTabCount = pDoc->GetTableCount(); + for (SCTAB nTab=0; nTab < nTabCount && bIsEmpty; ++nTab) + { + if (!rMark.GetTableSelect(nTab)) + continue; + + bIsEmpty = pDoc->IsBlockEmpty(nTab, rDestRange.aStart.Col(), rDestRange.aStart.Row(), + rDestRange.aEnd.Col(), rDestRange.aEnd.Row()); + } + + if (!bIsEmpty) + { + ScReplaceWarnBox aBox(pParentWnd); + if (aBox.Execute() != RET_YES) + { + // changing the configuration is within the ScReplaceWarnBox + return false; + } + } + return true; +} + +} + BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc, USHORT nFunction, BOOL bSkipEmpty, BOOL bTranspose, BOOL bAsLink, @@ -764,6 +927,12 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc, // do not copy note captions into undo document nUndoFlags |= IDF_NOCAPTIONS; + ScClipParam& rClipParam = pClipDoc->GetClipParam(); + if (rClipParam.isMultiRange()) + return PasteMultiRangesFromClip( + nFlags, pClipDoc, nFunction, bSkipEmpty, bTranspose, bAsLink, bAllowDialogs, + eMoveMode, nContFlags, nUndoFlags); + BOOL bCutMode = pClipDoc->IsCutMode(); // if transposing, take from original clipdoc BOOL bIncludeFiltered = bCutMode; @@ -992,23 +1161,8 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc, SC_MOD()->GetInputOptions().GetReplaceCellsWarn(); if ( bAskIfNotEmpty ) { - BOOL bIsEmpty = TRUE; - SCTAB nTabCount = pDoc->GetTableCount(); - for (SCTAB nTab=0; nTabIsBlockEmpty( nTab, aUserRange.aStart.Col(), aUserRange.aStart.Row(), - aUserRange.aEnd.Col(), aUserRange.aEnd.Row() ) ) - bIsEmpty = FALSE; - - if ( !bIsEmpty ) - { - ScReplaceWarnBox aBox( GetViewData()->GetDialogParent() ); - if ( aBox.Execute() != RET_YES ) - { - // changing the configuration is within the ScReplaceWarnBox - return FALSE; - } - } + if (!lcl_checkDestRangeForOverwrite(aUserRange, pDoc, aFilteredMark, GetViewData()->GetDialogParent())) + return false; } } @@ -1302,7 +1456,179 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc, // AdjustBlockHeight has already been called above aModificator.SetDocumentModified(); - pDocSh->UpdateOle(GetViewData()); + PostPasteFromClip(aUserRange, rMark); + return TRUE; +} + +bool ScViewFunc::PasteMultiRangesFromClip( + sal_uInt16 nFlags, ScDocument* pClipDoc, sal_uInt16 nFunction, + bool bSkipEmpty, bool bTranspose, bool bAsLink, bool bAllowDialogs, + InsCellCmd eMoveMode, sal_uInt16 /*nContFlags*/, sal_uInt16 nUndoFlags) +{ + ScViewData& rViewData = *GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); + ScDocShell* pDocSh = rViewData.GetDocShell(); + ScMarkData aMark(rViewData.GetMarkData()); + const ScAddress& rCurPos = rViewData.GetCurPos(); + ScClipParam& rClipParam = pClipDoc->GetClipParam(); + SCCOL nColSize = rClipParam.getPasteColSize(); + SCROW nRowSize = rClipParam.getPasteRowSize(); + + if (bTranspose) + { + if (static_cast(rCurPos.Col()) + nRowSize-1 > static_cast(MAXCOL)) + { + ErrorMessage(STR_PASTE_FULL); + return false; + } + + ::std::auto_ptr pTransClip(new ScDocument(SCDOCMODE_CLIP)); + pClipDoc->TransposeClip(pTransClip.get(), nFlags, bAsLink); + pClipDoc = pTransClip.release(); + SCCOL nTempColSize = nColSize; + nColSize = static_cast(nRowSize); + nRowSize = static_cast(nTempColSize); + } + + if (!ValidCol(rCurPos.Col()+nColSize-1) || !ValidRow(rCurPos.Row()+nRowSize-1)) + { + ErrorMessage(STR_PASTE_FULL); + return false; + } + + // Determine the first and last selected sheet numbers. + SCTAB nTab1 = aMark.GetFirstSelected(); + SCTAB nTab2 = nTab1; + for (SCTAB i = nTab1+1; i <= MAXTAB; ++i) + if (aMark.GetTableSelect(i)) + nTab2 = i; + + ScDocShellModificator aModificator(*pDocSh); + + // For multi-selection paste, we don't support cell duplication for larger + // destination range. In case the destination is marked, we reset it to + // the clip size. + ScRange aMarkedRange(rCurPos.Col(), rCurPos.Row(), nTab1, + rCurPos.Col()+nColSize-1, rCurPos.Row()+nRowSize-1, nTab2); + + // Extend the marked range to account for filtered rows in the destination + // area. + if (ScViewUtil::HasFiltered(aMarkedRange, pDoc)) + { + if (!ScViewUtil::FitToUnfilteredRows(aMarkedRange, pDoc, nRowSize)) + return false; + } + + bool bAskIfNotEmpty = + bAllowDialogs && (nFlags & IDF_CONTENTS) && + nFunction == PASTE_NOFUNC && SC_MOD()->GetInputOptions().GetReplaceCellsWarn(); + + if (bAskIfNotEmpty) + { + if (!lcl_checkDestRangeForOverwrite(aMarkedRange, pDoc, aMark, rViewData.GetDialogParent())) + return false; + } + + aMark.SetMarkArea(aMarkedRange); + MarkRange(aMarkedRange); + + bool bInsertCells = (eMoveMode != INS_NONE); + if (bInsertCells) + { + if (!InsertCells(eMoveMode, pDoc->IsUndoEnabled(), true)) + return false; + } + + ::std::auto_ptr pUndoDoc; + if (pDoc->IsUndoEnabled()) + { + pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO)); + pUndoDoc->InitUndoSelected(pDoc, aMark, false, false); + pDoc->CopyToDocument(aMarkedRange, nUndoFlags, false, pUndoDoc.get(), &aMark, true); + } + + ::std::auto_ptr pMixDoc; + if ( bSkipEmpty || nFunction ) + { + if ( nFlags & IDF_CONTENTS ) + { + pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO)); + pMixDoc->InitUndoSelected(pDoc, aMark, false, false); + pDoc->CopyToDocument(aMarkedRange, IDF_CONTENTS, false, pMixDoc.get(), &aMark, true); + } + } + + /* Make draw layer and start drawing undo. + - Needed before AdjustBlockHeight to track moved drawing objects. + - Needed before pDoc->CopyFromClip to track inserted note caption objects. + */ + if (nFlags & IDF_OBJECTS) + pDocSh->MakeDrawLayer(); + if (pDoc->IsUndoEnabled()) + pDoc->BeginDrawUndo(); + + CursorSwitcher aCursorSwitch(this); + sal_uInt16 nNoObjFlags = nFlags & ~IDF_OBJECTS; + pDoc->CopyMultiRangeFromClip(rCurPos, aMark, nNoObjFlags, pClipDoc, + true, bAsLink, false, bSkipEmpty); + + if (pMixDoc.get()) + pDoc->MixDocument(aMarkedRange, nFunction, bSkipEmpty, pMixDoc.get()); + + AdjustBlockHeight(); // update row heights before pasting objects + + if (nFlags & IDF_OBJECTS) + { + // Paste the drawing objects after the row heights have been updated. + pDoc->CopyMultiRangeFromClip(rCurPos, aMark, IDF_OBJECTS, pClipDoc, + true, false, false, true); + } + + pDocSh->PostPaint( + aMarkedRange.aStart.Col(), aMarkedRange.aStart.Row(), nTab1, + aMarkedRange.aEnd.Col(), aMarkedRange.aEnd.Row(), nTab1, PAINT_GRID); + + if (pDoc->IsUndoEnabled()) + { + SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager(); + String aUndo = ScGlobal::GetRscString( + pClipDoc->IsCutMode() ? STR_UNDO_CUT : STR_UNDO_COPY); + pUndoMgr->EnterListAction(aUndo, aUndo); + + ScUndoPasteOptions aOptions; // store options for repeat + aOptions.nFunction = nFunction; + aOptions.bSkipEmpty = bSkipEmpty; + aOptions.bTranspose = bTranspose; + aOptions.bAsLink = bAsLink; + aOptions.eMoveMode = eMoveMode; + + ScUndoPaste* pUndo = new ScUndoPaste(pDocSh, + aMarkedRange.aStart.Col(), + aMarkedRange.aStart.Row(), + aMarkedRange.aStart.Tab(), + aMarkedRange.aEnd.Col(), + aMarkedRange.aEnd.Row(), + aMarkedRange.aEnd.Tab(), + aMark, pUndoDoc.release(), NULL, nFlags|nUndoFlags, NULL, NULL, NULL, NULL, false, &aOptions); + + if (bInsertCells) + pUndoMgr->AddUndoAction(new ScUndoWrapper(pUndo), true); + else + pUndoMgr->AddUndoAction(pUndo, false); + + pUndoMgr->LeaveListAction(); + } + aModificator.SetDocumentModified(); + PostPasteFromClip(aMarkedRange, aMark); + return true; +} + +void ScViewFunc::PostPasteFromClip(const ScRange& rPasteRange, const ScMarkData& rMark) +{ + ScViewData* pViewData = GetViewData(); + ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocument* pDoc = pViewData->GetDocument(); + pDocSh->UpdateOle(pViewData); SelectionChanged(); @@ -1316,7 +1642,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc, { if ( rMark.GetTableSelect( i ) ) { - ScRange aChangeRange( aUserRange ); + ScRange aChangeRange(rPasteRange); aChangeRange.aStart.SetTab( i ); aChangeRange.aEnd.SetTab( i ); aChangeRanges.Append( aChangeRange ); @@ -1324,8 +1650,6 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc, } pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges ); } - - return TRUE; } diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index f8b89a85e11c..35af3ee2a2e3 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -79,6 +79,7 @@ #include "asciiopt.hxx" #include "scabstdlg.hxx" +#include "clipparam.hxx" #include #include #include @@ -163,12 +164,12 @@ BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId, if ( pSrcDoc->GetDataStart( nSrcTab, nFirstCol, nFirstRow ) ) pSrcDoc->GetCellArea( nSrcTab, nLastCol, nLastRow ); else - { + { nFirstCol = nLastCol = 0; nFirstRow = nLastRow = 0; - } - pSrcDoc->CopyToClip( nFirstCol, nFirstRow, nLastCol, nLastRow, - FALSE, pClipDoc, FALSE, &aSrcMark ); + } + ScClipParam aClipParam(ScRange(nFirstCol, nFirstRow, 0, nLastCol, nLastRow, 0), false); + pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aSrcMark); ScGlobal::SetClipDocName( xDocShRef->GetTitle( SFX_TITLE_FULLNAME ) ); SetCursor( nPosX, nPosY ); -- cgit From 921ff4b99a018c4d45c6d8d810fc96130c1b3a70 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Fri, 11 Sep 2009 16:06:18 +0000 Subject: CWS-TOOLING: integrate CWS chartuseability01 2009-09-07 17:26:44 +0200 iha r275906 : CWS-TOOLING: rebase CWS chartuseability01 to trunk@275801 (milestone: DEV300:m57) 2009-08-27 13:48:16 +0200 iha r275481 : #7049# listbox to select chart elements 2009-08-27 11:54:53 +0200 iha r275464 : #i58163# #i69422# #i102820# enhance chart context menu 2009-08-26 16:49:58 +0200 iha r275435 : #i102820# added missing case 'floor' 2009-08-26 15:33:51 +0200 iha r275427 : #i102820# make 'insert legend' work properly 2009-08-25 16:35:00 +0200 ufi r275369 : i104087 2009-08-25 15:12:17 +0200 iha r275360 : #i104087# 'Object Properties' -> 'Format Selection' 2009-08-25 15:11:31 +0200 iha r275359 : #i104087# 'Object Properties' -> 'Format Selection' 2009-08-25 15:11:15 +0200 iha r275358 : #i104087# 'Object Properties' -> 'Format Selection' 2009-08-25 11:57:43 +0200 iha r275344 : #i104087# changed behavior of insert menu 2009-08-18 12:53:54 +0200 oc r275093 : #i104082,104086,104089# multiple changes because of changed chartUI 2009-08-10 16:46:17 +0200 ufi r274824 : i104083 i104087 i104090 2009-08-07 14:04:34 +0200 iha r274763 : #7049# listbox to select chart elements 2009-08-07 13:06:05 +0200 iha r274760 : #7049# listbox to select chart elements 2009-08-07 13:05:06 +0200 iha r274759 : #7049# listbox to select chart elements 2009-08-07 12:32:31 +0200 iha r274756 : #i58163# #i69422# #i102820# enhance chart context menu 2009-08-07 12:31:54 +0200 iha r274755 : #i58163# #i69422# #i102820# enhance chart context menu 2009-08-06 19:00:48 +0200 iha r274742 : #i103593# make insert menu behavior selection dependent 2009-08-06 19:00:14 +0200 iha r274741 : #i103593# make insert menu behavior selection dependent 2009-08-06 15:34:01 +0200 iha r274731 : #i58163# #i69422# #i102820# enhance chart context menu 2009-08-06 14:39:20 +0200 iha r274728 : #i86146# ease adding R-squared value with an equation 2009-08-06 14:37:02 +0200 iha r274727 : #i86146# ease adding R-squared value with an equation 2009-08-06 13:37:54 +0200 iha r274724 : #i86146# ease adding R-squared value with an equation 2009-08-06 13:37:15 +0200 iha r274723 : #i86146# ease adding R-squared value with an equation 2009-08-06 13:04:27 +0200 iha r274722 : #i103593# make insert menu behavior selection dependent 2009-08-06 13:03:35 +0200 iha r274721 : #i103593# make insert menu behavior selection dependent 2009-08-05 18:26:31 +0200 iha r274693 : #i104033# inconsistent wording 'error indicator' <-> 'error bar' 2009-08-05 16:51:45 +0200 iha r274688 : #i104028# rename font tabpage 'Characters'->'Font' 2009-08-05 16:30:21 +0200 iha r274685 : #i58163# #i69422# #i102820# enhance chart context menu 2009-08-05 15:34:11 +0200 iha r274680 : #i58163# #i69422# #i102820# enhance chart context menu 2009-08-05 15:32:43 +0200 iha r274679 : #i58163# #i69422# #i102820# enhance chart context menu 2009-08-05 15:31:26 +0200 iha r274678 : #i58163# #i69422# #i102820# enhance chart context menu 2009-08-05 15:17:51 +0200 iha r274676 : #i58163# #i69422# #i102820# enhance chart context menu 2009-08-05 15:16:22 +0200 iha r274675 : #i58163# #i69422# #i102820# enhance chart context menu 2009-08-05 14:58:59 +0200 iha r274674 : #7049# listbox to select chart elements 2009-08-05 14:33:54 +0200 iha r274669 : #7049# listbox to select chart elements 2009-08-05 14:22:17 +0200 iha r274665 : #7049# listbox to select chart elements 2009-08-05 13:21:05 +0200 iha r274656 : #i102820# offer insertion of several elements in context menu also if nothing is selected 2009-08-05 11:56:06 +0200 iha r274647 : #7049# listbox to select chart elements 2009-08-05 11:43:40 +0200 iha r274645 : #7049# listbox to select chart elements 2009-07-24 19:46:50 +0200 iha r274318 : #i58163# #i69422# #i102820# enhance chart context menu 2009-07-24 16:23:13 +0200 iha r274313 : #i58163# #i69422# #i102820# enhance chart context menu 2009-07-24 16:13:22 +0200 iha r274311 : #i58163# #i69422# #i102820# enhance chart context menu --- .../controller/dialogs/ObjectNameProvider.cxx | 176 ++++++--- chart2/source/controller/dialogs/Strings.src | 32 +- .../controller/dialogs/dlg_InsertDataLabel.cxx | 3 +- .../controller/dialogs/dlg_InsertErrorBars.cxx | 4 +- .../controller/dialogs/dlg_InsertTrendline.cxx | 3 +- .../controller/dialogs/dlg_ObjectProperties.cxx | 74 ++-- chart2/source/controller/inc/ObjectHierarchy.hxx | 3 +- .../source/controller/inc/ObjectNameProvider.hxx | 9 + chart2/source/controller/main/ChartController.cxx | 148 ++++++-- chart2/source/controller/main/ChartController.hxx | 58 ++- .../controller/main/ChartController_Insert.cxx | 422 +++++++++++++++++++-- .../controller/main/ChartController_Properties.cxx | 279 +++++++++++--- .../controller/main/ChartController_Tools.cxx | 2 +- .../controller/main/ChartController_Window.cxx | 362 ++++++++++++++++-- .../controller/main/ControllerCommandDispatch.cxx | 173 +++++++-- chart2/source/controller/main/ElementSelector.cxx | 328 ++++++++++++++++ chart2/source/controller/main/ElementSelector.hxx | 125 ++++++ chart2/source/controller/main/ObjectHierarchy.cxx | 272 ++++++++----- .../main/_serviceregistration_controller.cxx | 9 + chart2/source/controller/main/makefile.mk | 1 + chart2/source/inc/AxisHelper.hxx | 8 +- chart2/source/inc/DataSeriesHelper.hxx | 21 + chart2/source/inc/LegendHelper.hxx | 10 + chart2/source/inc/RegressionCurveHelper.hxx | 8 + chart2/source/inc/Strings.hrc | 12 +- chart2/source/model/inc/DataSeries.hxx | 4 + chart2/source/model/main/DataSeries.cxx | 25 ++ chart2/source/tools/DataSeriesHelper.cxx | 182 +++++++++ chart2/source/tools/LegendHelper.cxx | 48 +++ chart2/source/tools/RegressionCurveHelper.cxx | 51 +++ chart2/uiconfig/menubar/menubar.xml | 20 +- chart2/uiconfig/toolbar/toolbar.xml | 3 + 32 files changed, 2494 insertions(+), 381 deletions(-) create mode 100644 chart2/source/controller/main/ElementSelector.cxx create mode 100644 chart2/source/controller/main/ElementSelector.hxx diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index 1ed974814ea7..24b717adba7f 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -87,6 +87,16 @@ OUString lcl_getDataSeriesName( const rtl::OUString& rObjectCID, const Reference return aRet; } +OUString lcl_getFullSeriesName( const rtl::OUString& rObjectCID, const Reference< frame::XModel >& xChartModel ) +{ + OUString aRet = String(SchResId(STR_TIP_DATASERIES)); + OUString aWildcard( C2U("%SERIESNAME") ); + sal_Int32 nIndex = aRet.indexOf( aWildcard ); + if( nIndex != -1 ) + aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), lcl_getDataSeriesName( rObjectCID, xChartModel ) ); + return aRet; +} + void lcl_addText( OUString& rOut, const OUString& rSeparator, const OUString& rNext ) { if( rOut.getLength() && rNext.getLength() ) @@ -288,22 +298,27 @@ rtl::OUString ObjectNameProvider::getName( ObjectType eObjectType, bool bPlural aRet=String(SchResId(STR_OBJECT_LABEL)); break; case OBJECTTYPE_DATA_ERRORS: - aRet=String(SchResId(STR_OBJECT_ERROR_INDICATOR));//@todo? maybe distinguish plural singular + aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe distinguish plural singular break; case OBJECTTYPE_DATA_ERRORS_X: - aRet=String(SchResId(STR_OBJECT_ERROR_INDICATOR));//@todo? maybe specialize in future + aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future break; case OBJECTTYPE_DATA_ERRORS_Y: - aRet=String(SchResId(STR_OBJECT_ERROR_INDICATOR));//@todo? maybe specialize in future + aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future break; case OBJECTTYPE_DATA_ERRORS_Z: - aRet=String(SchResId(STR_OBJECT_ERROR_INDICATOR));//@todo? maybe specialize in future + aRet=String(SchResId(STR_OBJECT_ERROR_BARS));//@todo? maybe specialize in future break; case OBJECTTYPE_DATA_AVERAGE_LINE: aRet=String(SchResId(STR_OBJECT_AVERAGE_LINE)); break; case OBJECTTYPE_DATA_CURVE: - aRet=String(SchResId(STR_OBJECT_CURVE)); + { + if(bPlural) + aRet=String(SchResId(STR_OBJECT_CURVES)); + else + aRet=String(SchResId(STR_OBJECT_CURVE)); + } break; case OBJECTTYPE_DATA_STOCK_RANGE: //aRet=String(SchResId()); @@ -333,15 +348,24 @@ rtl::OUString ObjectNameProvider::getAxisName( const rtl::OUString& rObjectCID Reference< XAxis > xAxis( ObjectIdentifier::getObjectPropertySet( rObjectCID , xChartModel ), uno::UNO_QUERY ); - sal_Int32 nDimensionIndex = AxisHelper::getDimensionIndexOfAxis( xAxis, ChartModelHelper::findDiagram( xChartModel ) ); + sal_Int32 nCooSysIndex = 0; + sal_Int32 nDimensionIndex = 0; + sal_Int32 nAxisIndex = 0; + AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram( xChartModel ), nCooSysIndex, nDimensionIndex, nAxisIndex ); switch(nDimensionIndex) { case 0://x-axis - aRet=String(SchResId(STR_OBJECT_AXIS_X)); + if( nAxisIndex == 0 ) + aRet=String(SchResId(STR_OBJECT_AXIS_X)); + else + aRet=String(SchResId(STR_OBJECT_SECONDARY_X_AXIS)); break; case 1://y-axis - aRet=String(SchResId(STR_OBJECT_AXIS_Y)); + if( nAxisIndex == 0 ) + aRet=String(SchResId(STR_OBJECT_AXIS_Y)); + else + aRet=String(SchResId(STR_OBJECT_SECONDARY_Y_AXIS)); break; case 2://z-axis aRet=String(SchResId(STR_OBJECT_AXIS_Z)); @@ -354,6 +378,45 @@ rtl::OUString ObjectNameProvider::getAxisName( const rtl::OUString& rObjectCID return aRet; } +//static +OUString ObjectNameProvider::getTitleNameByType( TitleHelper::eTitleType eType ) +{ + OUString aRet; + + switch(eType) + { + case TitleHelper::MAIN_TITLE: + aRet=String(SchResId(STR_OBJECT_TITLE_MAIN)); + break; + case TitleHelper::SUB_TITLE: + aRet=String(SchResId(STR_OBJECT_TITLE_SUB)); + break; + case TitleHelper::X_AXIS_TITLE: + aRet=String(SchResId(STR_OBJECT_TITLE_X_AXIS)); + break; + case TitleHelper::Y_AXIS_TITLE: + aRet=String(SchResId(STR_OBJECT_TITLE_Y_AXIS)); + break; + case TitleHelper::Z_AXIS_TITLE: + aRet=String(SchResId(STR_OBJECT_TITLE_Z_AXIS)); + break; + case TitleHelper::SECONDARY_X_AXIS_TITLE: + aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_X_AXIS)); + break; + case TitleHelper::SECONDARY_Y_AXIS_TITLE: + aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_Y_AXIS)); + break; + default: + DBG_ERROR("unknown title type"); + break; + } + + if( !aRet.getLength() ) + aRet=String(SchResId(STR_OBJECT_TITLE)); + + return aRet; +} + //static OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID , const Reference< frame::XModel >& xChartModel ) @@ -366,35 +429,7 @@ OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID { TitleHelper::eTitleType eType; if( TitleHelper::getTitleType( eType, xTitle, xChartModel ) ) - { - switch(eType) - { - case TitleHelper::MAIN_TITLE: - aRet=String(SchResId(STR_OBJECT_TITLE_MAIN)); - break; - case TitleHelper::SUB_TITLE: - aRet=String(SchResId(STR_OBJECT_TITLE_SUB)); - break; - case TitleHelper::X_AXIS_TITLE: - aRet=String(SchResId(STR_OBJECT_TITLE_X_AXIS)); - break; - case TitleHelper::Y_AXIS_TITLE: - aRet=String(SchResId(STR_OBJECT_TITLE_Y_AXIS)); - break; - case TitleHelper::Z_AXIS_TITLE: - aRet=String(SchResId(STR_OBJECT_TITLE_Z_AXIS)); - break; - case TitleHelper::SECONDARY_X_AXIS_TITLE: - aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_X_AXIS)); - break; - case TitleHelper::SECONDARY_Y_AXIS_TITLE: - aRet=String(SchResId(STR_OBJECT_TITLE_SECONDARY_Y_AXIS)); - break; - default: - DBG_ERROR("unknown title type"); - break; - } - } + aRet = ObjectNameProvider::getTitleNameByType( eType ); } if( !aRet.getLength() ) aRet=String(SchResId(STR_OBJECT_TITLE)); @@ -481,12 +516,7 @@ rtl::OUString ObjectNameProvider::getHelpText( const rtl::OUString& rObjectCID, } else if( OBJECTTYPE_DATA_SERIES == eObjectType ) { - aRet=String(SchResId(STR_TIP_DATASERIES)); - - OUString aWildcard( C2U("%SERIESNAME") ); - sal_Int32 nIndex = aRet.indexOf( aWildcard ); - if( nIndex != -1 ) - aRet = aRet.replaceAt( nIndex, aWildcard.getLength(), lcl_getDataSeriesName( rObjectCID, xChartModel ) ); + aRet = lcl_getFullSeriesName( rObjectCID, xChartModel ); } else if( OBJECTTYPE_DATA_POINT == eObjectType ) { @@ -753,7 +783,41 @@ rtl::OUString ObjectNameProvider::getNameForCID( case OBJECTTYPE_TITLE: return getTitleName( rObjectCID, xModel ); case OBJECTTYPE_GRID: + case OBJECTTYPE_SUBGRID: return getGridName( rObjectCID, xModel ); + case OBJECTTYPE_DATA_SERIES: + return lcl_getFullSeriesName( rObjectCID, xModel ); + //case OBJECTTYPE_LEGEND_ENTRY: + case OBJECTTYPE_DATA_POINT: + case OBJECTTYPE_DATA_LABELS: + case OBJECTTYPE_DATA_LABEL: + case OBJECTTYPE_DATA_ERRORS: + case OBJECTTYPE_DATA_ERRORS_X: + case OBJECTTYPE_DATA_ERRORS_Y: + case OBJECTTYPE_DATA_ERRORS_Z: + case OBJECTTYPE_DATA_CURVE: + case OBJECTTYPE_DATA_AVERAGE_LINE: + case OBJECTTYPE_DATA_CURVE_EQUATION: + { + rtl::OUString aRet = lcl_getFullSeriesName( rObjectCID, xModel ); + aRet += C2U(" "); + if( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL ) + { + aRet += getName( OBJECTTYPE_DATA_POINT ); + sal_Int32 nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( rObjectCID ); + aRet += C2U(" "); + aRet += OUString::valueOf(nPointIndex+1); + + if( eType == OBJECTTYPE_DATA_LABEL ) + { + aRet += C2U(" "); + aRet += getName( OBJECTTYPE_DATA_LABEL ); + } + } + else + aRet += getName( eType ); + return aRet; + } default: break; } @@ -761,6 +825,32 @@ rtl::OUString ObjectNameProvider::getNameForCID( return getName( eType ); } +//static +rtl::OUString ObjectNameProvider::getName_ObjectForSeries( + ObjectType eObjectType, + const rtl::OUString& rSeriesCID, + const uno::Reference< chart2::XChartDocument >& xChartDocument ) +{ + uno::Reference< frame::XModel> xChartModel( xChartDocument, uno::UNO_QUERY ); + Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rSeriesCID , xChartModel ), uno::UNO_QUERY ); + if( xSeries.is() ) + { + OUString aRet = String(SchResId(STR_OBJECT_FOR_SERIES)); + replaceParamterInString( aRet, C2U("%OBJECTNAME"), getName( eObjectType, false /*bPlural*/ ) ); + replaceParamterInString( aRet, C2U("%SERIESNAME"), lcl_getDataSeriesName( rSeriesCID, xChartModel ) ); + return aRet; + } + else + return ObjectNameProvider::getName_ObjectForAllSeries( eObjectType ); +} + +//static +rtl::OUString ObjectNameProvider::getName_ObjectForAllSeries( ObjectType eObjectType ) +{ + OUString aRet = String(SchResId(STR_OBJECT_FOR_ALL_SERIES)); + replaceParamterInString( aRet, C2U("%OBJECTNAME"), getName( eObjectType, true /*bPlural*/ ) ); + return aRet; +} //............................................................................. } //namespace chart diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src index 3b384915f2d0..b7ef643e3ff3 100644 --- a/chart2/source/controller/dialogs/Strings.src +++ b/chart2/source/controller/dialogs/Strings.src @@ -84,9 +84,9 @@ String STR_PAGE_TRANSPARENCY Text [ en-US ] = "Transparency"; }; -String STR_PAGE_CHARACTERS +String STR_PAGE_FONT { - Text [ en-US ] = "Characters" ; + Text [ en-US ] = "Font" ; }; String STR_PAGE_FONT_EFFECTS @@ -183,6 +183,14 @@ String STR_OBJECT_AXIS_Z { Text [ en-US ] = "Z Axis" ; }; +String STR_OBJECT_SECONDARY_X_AXIS +{ + Text [ en-US ] = "Secondary X Axis" ; +}; +String STR_OBJECT_SECONDARY_Y_AXIS +{ + Text [ en-US ] = "Secondary Y Axis" ; +}; String STR_OBJECT_AXES { @@ -312,18 +320,18 @@ String STR_OBJECT_CURVE_EQUATION Text[ en-US ] = "Equation"; }; -String STR_OBJECT_ERROR_INDICATOR +String STR_OBJECT_ERROR_BARS { - Text [ en-US ] = "Error Indicator"; + Text [ en-US ] = "Error Bars"; }; String STR_OBJECT_STOCK_LOSS { - Text [ en-US ] = "Negative Deviation"; + Text [ en-US ] = "Stock Loss"; }; String STR_OBJECT_STOCK_GAIN { - Text [ en-US ] = "Positive Deviation"; + Text [ en-US ] = "Stock Gain"; }; String STR_OBJECT_PAGE @@ -403,6 +411,18 @@ String STR_STATUS_PIE_SEGMENT_EXPLODED Text [ en-US ] = "Pie exploded by %PERCENTVALUE percent"; }; +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +String STR_OBJECT_FOR_SERIES +{ + Text [ en-US ] = "%OBJECTNAME for Data Series '%SERIESNAME'" ; +}; + +String STR_OBJECT_FOR_ALL_SERIES +{ + Text [ en-US ] = "%OBJECTNAME for all Data Series" ; +}; + //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- String STR_ACTION_EDIT_CHARTTYPE diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx index 638a8f5f2994..d7eb3357e6e8 100644 --- a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx @@ -51,7 +51,8 @@ DataLabelsDialog::DataLabelsDialog(Window* pWindow, const SfxItemSet& rInAttrs, m_rInAttrs(rInAttrs) { FreeResource(); - SetText( ObjectNameProvider::getName(OBJECTTYPE_DATA_LABELS) ); + this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_LABELS ) ); + m_apDataLabelResources->SetNumberFormatter( pFormatter ); Reset(); } diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx index e6b74c8e660a..535b07a7df38 100644 --- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx @@ -42,6 +42,7 @@ #include "ObjectIdentifier.hxx" #include "DiagramHelper.hxx" #include "AxisHelper.hxx" +#include "ObjectNameProvider.hxx" #include #include @@ -70,7 +71,8 @@ InsertErrorBarsDialog::InsertErrorBarsDialog( /* bNoneAvailable = */ true, eType )) { FreeResource(); - this->SetText( String( SchResId( STR_PAGE_YERROR_BARS ))); + this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) ); + m_apErrorBarResources->SetChartDocumentForRangeChoosing( xChartDocument ); } diff --git a/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx b/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx index 95c9754f3b7e..042baa292f65 100644 --- a/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertTrendline.cxx @@ -42,6 +42,7 @@ #include "ObjectIdentifier.hxx" #include "DiagramHelper.hxx" #include "AxisHelper.hxx" +#include "ObjectNameProvider.hxx" #include #include @@ -74,7 +75,7 @@ InsertTrendlineDialog::InsertTrendlineDialog( Window* pParent, const SfxItemSet& m_apTrendlineResources( new TrendlineResources( this, rInAttrs, true )) { FreeResource(); - this->SetText( String( SchResId( STR_OBJECT_CURVES ))); + this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) ); } InsertTrendlineDialog::~InsertTrendlineDialog() diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index fdc7c3766644..097c6c1d0107 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -143,7 +143,7 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries ); sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); - bool bHasSeriesProperties = (OBJECTTYPE_DATA_SERIES==m_eObjectType || OBJECTTYPE_DATA_LABELS==m_eObjectType); + bool bHasSeriesProperties = (OBJECTTYPE_DATA_SERIES==m_eObjectType); bool bHasDataPointproperties = (OBJECTTYPE_DATA_POINT==m_eObjectType); if( bHasSeriesProperties || bHasDataPointproperties ) @@ -222,14 +222,37 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel { m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel ); } + else if( !m_bAffectsMultipleObjects && ( OBJECTTYPE_GRID == m_eObjectType || OBJECTTYPE_SUBGRID == m_eObjectType ) ) + { + m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel ); + } + else if( !m_bAffectsMultipleObjects && OBJECTTYPE_TITLE == m_eObjectType ) + { + m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel ); + } else { - ObjectType eType = m_eObjectType; - if( OBJECTTYPE_DATA_LABEL == eType ) - eType = OBJECTTYPE_DATA_POINT; - else if( OBJECTTYPE_DATA_LABELS == eType ) - eType = OBJECTTYPE_DATA_SERIES; - m_aLocalizedName = ObjectNameProvider::getName(eType,m_bAffectsMultipleObjects); + switch( m_eObjectType ) + { + case OBJECTTYPE_DATA_POINT: + case OBJECTTYPE_DATA_LABEL: + case OBJECTTYPE_DATA_LABELS: + case OBJECTTYPE_DATA_ERRORS: + case OBJECTTYPE_DATA_ERRORS_X: + case OBJECTTYPE_DATA_ERRORS_Y: + case OBJECTTYPE_DATA_ERRORS_Z: + case OBJECTTYPE_DATA_AVERAGE_LINE: + case OBJECTTYPE_DATA_CURVE: + case OBJECTTYPE_DATA_CURVE_EQUATION: + if( m_bAffectsMultipleObjects ) + m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType ); + else + m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument ); + break; + default: + m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects); + break; + } } } } @@ -355,7 +378,7 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent, AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER))); AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA))); AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY))); - AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS))); + AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT))); AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS))); AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::Create, NULL); if( aCJKOptions.IsAsianTypographyEnabled() ) @@ -366,7 +389,7 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent, AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER))); AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA))); AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY))); - AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS))); + AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT))); AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS))); AddTabPage(TP_LEGEND_POS, String(SchResId(STR_PAGE_POSITION)), SchLegendPosTabPage::Create, NULL); if( aCJKOptions.IsAsianTypographyEnabled() ) @@ -375,27 +398,30 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent, case OBJECTTYPE_DATA_SERIES: case OBJECTTYPE_DATA_POINT: - case OBJECTTYPE_DATA_LABEL: - case OBJECTTYPE_DATA_LABELS: - AddTabPage(RID_SVXPAGE_LINE, String(SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE ))); + if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() ) + AddTabPage(TP_OPTIONS, String(SchResId(STR_PAGE_OPTIONS)),SchOptionTabPage::Create, NULL); + if( m_pParameter->ProvidesStartingAngle()) + AddTabPage(TP_POLAROPTIONS, String(SchResId(STR_PAGE_OPTIONS)),PolarOptionsTabPage::Create, NULL); + + if( m_pParameter->HasGeometryProperties() ) + AddTabPage(TP_LAYOUT, String(SchResId(STR_PAGE_LAYOUT)),SchLayoutTabPage::Create, NULL); + if(m_pParameter->HasAreaProperties()) { AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA))); AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY))); } - AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS))); + AddTabPage(RID_SVXPAGE_LINE, String(SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE ))); + break; + + case OBJECTTYPE_DATA_LABEL: + case OBJECTTYPE_DATA_LABELS: + AddTabPage(TP_DATA_DESCR, String(SchResId(STR_OBJECT_DATALABELS)), DataLabelsTabPage::Create, NULL); + AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT))); AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS))); if( aCJKOptions.IsAsianTypographyEnabled() ) AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN))); - AddTabPage(TP_DATA_DESCR, String(SchResId(STR_OBJECT_DATALABELS)), DataLabelsTabPage::Create, NULL); -// if( m_pParameter->HasStatisticProperties() ) -// AddTabPage(TP_YERRORBAR, String(SchResId(STR_PAGE_YERROR_BARS)), ErrorBarsTabPage::Create, NULL); - if( m_pParameter->HasGeometryProperties() ) - AddTabPage(TP_LAYOUT, String(SchResId(STR_PAGE_LAYOUT)),SchLayoutTabPage::Create, NULL); - if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() ) - AddTabPage(TP_OPTIONS, String(SchResId(STR_PAGE_OPTIONS)),SchOptionTabPage::Create, NULL); - if( m_pParameter->ProvidesStartingAngle()) - AddTabPage(TP_POLAROPTIONS, String(SchResId(STR_PAGE_OPTIONS)),PolarOptionsTabPage::Create, NULL); + break; case OBJECTTYPE_AXIS: @@ -409,7 +435,7 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent, AddTabPage(TP_AXIS_LABEL, String(SchResId(STR_OBJECT_LABEL)), SchAxisLabelTabPage::Create, NULL); if( m_pParameter->HasNumberProperties() ) AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS))); - AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS))); + AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT))); AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS))); if( aCJKOptions.IsAsianTypographyEnabled() ) AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN))); @@ -456,7 +482,7 @@ SchAttribTabDlg::SchAttribTabDlg(Window* pParent, AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER))); AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA))); AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY))); - AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS))); + AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT))); AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS))); AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS))); if( SvtLanguageOptions().IsCTLFontEnabled() ) diff --git a/chart2/source/controller/inc/ObjectHierarchy.hxx b/chart2/source/controller/inc/ObjectHierarchy.hxx index f0614f7a6d86..3281181c5be7 100644 --- a/chart2/source/controller/inc/ObjectHierarchy.hxx +++ b/chart2/source/controller/inc/ObjectHierarchy.hxx @@ -62,7 +62,8 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDocument, ExplicitValueProvider * pExplicitValueProvider = 0, - bool bFlattenDiagram = false ); + bool bFlattenDiagram = false, + bool bOrderingForElementSelector = false ); ~ObjectHierarchy(); static tCID getRootNodeCID(); diff --git a/chart2/source/controller/inc/ObjectNameProvider.hxx b/chart2/source/controller/inc/ObjectNameProvider.hxx index 2892c769c7a0..529f253fc20a 100644 --- a/chart2/source/controller/inc/ObjectNameProvider.hxx +++ b/chart2/source/controller/inc/ObjectNameProvider.hxx @@ -32,6 +32,7 @@ #define _CHART2_OBJECTNAME_PROVIDER_HXX #include "ObjectIdentifier.hxx" +#include "TitleHelper.hxx" #include #include @@ -57,12 +58,20 @@ public: static rtl::OUString getTitleName( const rtl::OUString& rObjectCID , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel ); + static rtl::OUString getTitleNameByType( TitleHelper::eTitleType eType ); static rtl::OUString getNameForCID( const rtl::OUString& rObjectCID, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument ); + static rtl::OUString getName_ObjectForSeries( + ObjectType eObjectType, + const rtl::OUString& rSeriesCID, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument >& xChartDocument ); + static rtl::OUString getName_ObjectForAllSeries( ObjectType eObjectType ); + /** Provides help texts for the various chart elements. The parameter rObjectCID has to be a ClassifiedIdentifier - see class ObjectIdentifier. */ diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 7728104afc0f..bda0108c8ce8 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -576,6 +576,9 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent xMBroadcaster->addModifyListener( this ); #endif + //select chart area per default: + select( uno::makeAny( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, rtl::OUString() ) ) ); + uno::Reference< lang::XMultiServiceFactory > xFact( m_aModel->getModel(), uno::UNO_QUERY ); if( xFact.is()) { @@ -974,7 +977,7 @@ namespace { bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) { - if( aCommand.equals("MainTitle") + if( aCommand.equals("MainTitle") || aCommand.equals("SubTitle") || aCommand.equals("XTitle") || aCommand.equals("YTitle") @@ -982,7 +985,6 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) || aCommand.equals("SecondaryXTitle") || aCommand.equals("SecondaryYTitle") || aCommand.equals("AllTitles") - || aCommand.equals("Legend") || aCommand.equals("DiagramAxisX") || aCommand.equals("DiagramAxisY") || aCommand.equals("DiagramAxisZ") @@ -996,9 +998,31 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) || aCommand.equals("DiagramGridYHelp") || aCommand.equals("DiagramGridZHelp") || aCommand.equals("DiagramGridAll") + || aCommand.equals("DiagramWall") || aCommand.equals("DiagramFloor") || aCommand.equals("DiagramArea") + || aCommand.equals("Legend") + + || aCommand.equals("FormatWall") + || aCommand.equals("FormatFloor") + || aCommand.equals("FormatChartArea") + || aCommand.equals("FormatLegend") + + || aCommand.equals("FormatTitle") + || aCommand.equals("FormatAxis") + || aCommand.equals("FormatDataSeries") + || aCommand.equals("FormatDataPoint") + || aCommand.equals("FormatDataLabels") + || aCommand.equals("FormatDataLabel") + || aCommand.equals("FormatYErrorBars") + || aCommand.equals("FormatMeanValue") + || aCommand.equals("FormatTrendline") + || aCommand.equals("FormatTrendlineEquation") + || aCommand.equals("FormatStockLoss") + || aCommand.equals("FormatStockGain") + || aCommand.equals("FormatMajorGrid") + || aCommand.equals("FormatMinorGrid") ) return true; @@ -1064,24 +1088,28 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) else if(aCommand.equals("DiagramData")) this->executeDispatch_EditData(); //insert objects - else if( aCommand.equals("InsertTitle")) - this->executeDispatch_InsertTitle(); - else if( aCommand.equals("InsertLegend")) + else if( aCommand.equals("InsertTitles") + || aCommand.equals("InsertMenuTitles") ) + this->executeDispatch_InsertTitles(); + else if( aCommand.equals("InsertMenuLegend") ) + this->executeDispatch_OpenLegendDialog(); + else if( aCommand.equals("InsertLegend") ) this->executeDispatch_InsertLegend(); - else if( aCommand.equals("InsertDescription")) - this->executeDispatch_InsertDataLabel(); - else if( aCommand.equals("InsertAxis")) - this->executeDispatch_InsertAxis(); - else if( aCommand.equals("InsertGrids")) + else if( aCommand.equals("DeleteLegend") ) + this->executeDispatch_DeleteLegend(); + else if( aCommand.equals("InsertMenuDataLabels")) + this->executeDispatch_InsertMenu_DataLabels(); + else if( aCommand.equals("InsertMenuAxes") + || aCommand.equals("InsertRemoveAxes") ) + this->executeDispatch_InsertAxes(); + else if( aCommand.equals("InsertMenuGrids")) this->executeDispatch_InsertGrid(); -// else if( aCommand.equals("InsertStatistics")) -// this->executeDispatch_InsertStatistic(); - else if( aCommand.equals("InsertTrendlines")) - this->executeDispatch_InsertTrendlines(); - else if( aCommand.equals("InsertMeanValues")) - this->executeDispatch_InsertMeanValues(); - else if( aCommand.equals("InsertYErrorbars")) - this->executeDispatch_InsertYErrorbars(); + else if( aCommand.equals("InsertMenuTrendlines")) + this->executeDispatch_InsertMenu_Trendlines(); + else if( aCommand.equals("InsertMenuMeanValues")) + this->executeDispatch_InsertMenu_MeanValues(); + else if( aCommand.equals("InsertMenuYErrorBars")) + this->executeDispatch_InsertMenu_YErrorBars(); else if( aCommand.equals("InsertSymbol")) this->executeDispatch_InsertSpecialCharacter(); else if( aCommand.equals("InsertTrendline")) @@ -1092,14 +1120,48 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) this->executeDispatch_InsertMeanValue(); else if( aCommand.equals("DeleteMeanValue")) this->executeDispatch_DeleteMeanValue(); - else if( aCommand.equals("InsertYErrorbar")) - this->executeDispatch_InsertYErrorbar(); - else if( aCommand.equals("DeleteYErrorbar")) - this->executeDispatch_DeleteYErrorbar(); + else if( aCommand.equals("InsertYErrorBars")) + this->executeDispatch_InsertYErrorBars(); + else if( aCommand.equals("DeleteYErrorBars")) + this->executeDispatch_DeleteYErrorBars(); else if( aCommand.equals("InsertTrendlineEquation")) this->executeDispatch_InsertTrendlineEquation(); + else if( aCommand.equals("DeleteTrendlineEquation")) + this->executeDispatch_DeleteTrendlineEquation(); + else if( aCommand.equals("InsertTrendlineEquationAndR2")) + this->executeDispatch_InsertTrendlineEquation( true ); + else if( aCommand.equals("InsertR2Value")) + this->executeDispatch_InsertR2Value(); + else if( aCommand.equals("DeleteR2Value")) + this->executeDispatch_DeleteR2Value(); + else if( aCommand.equals("InsertDataLabels") ) + this->executeDispatch_InsertDataLabels(); + else if( aCommand.equals("InsertDataLabel") ) + this->executeDispatch_InsertDataLabel(); + else if( aCommand.equals("DeleteDataLabels") ) + this->executeDispatch_DeleteDataLabels(); + else if( aCommand.equals("DeleteDataLabel") ) + this->executeDispatch_DeleteDataLabel(); + else if( aCommand.equals("ResetAllDataPoints") ) + this->executeDispatch_ResetAllDataPoints(); + else if( aCommand.equals("ResetDataPoint") ) + this->executeDispatch_ResetDataPoint(); + else if( aCommand.equals("InsertAxis") ) + this->executeDispatch_InsertAxis(); + else if( aCommand.equals("InsertMajorGrid") ) + this->executeDispatch_InsertMajorGrid(); + else if( aCommand.equals("InsertMinorGrid") ) + this->executeDispatch_InsertMinorGrid(); + else if( aCommand.equals("InsertAxisTitle") ) + this->executeDispatch_InsertAxisTitle(); + else if( aCommand.equals("DeleteAxis") ) + this->executeDispatch_DeleteAxis(); + else if( aCommand.equals("DeleteMajorGrid") ) + this->executeDispatch_DeleteMajorGrid(); + else if( aCommand.equals("DeleteMinorGrid") ) + this->executeDispatch_DeleteMinorGrid(); //format objects - else if( aCommand.equals("DiagramObjects")) + else if( aCommand.equals("FormatSelection") ) this->executeDispatch_ObjectProperties(); else if( aCommand.equals("TransformDialog")) this->executeDispatch_PositionAndSize(); @@ -1405,15 +1467,23 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn ( C2U("Cut") ) ( C2U("Copy") ) ( C2U("Paste") ) ( C2U("DataRanges") ) ( C2U("DiagramData") ) // insert objects - ( C2U("InsertTitle") ) ( C2U("InsertLegend") ) ( C2U("InsertDescription") ) - ( C2U("InsertAxis") ) ( C2U("InsertGrids") ) ( C2U("InsertStatistics") ) - ( C2U("InsertSymbol") ) ( C2U("InsertTrendline") ) ( C2U("InsertTrendlineEquation") ) - ( C2U("InsertTrendlines") ) ( C2U("InsertMeanValue") ) ( C2U("InsertMeanValues") ) - ( C2U("InsertYErrorbars") ) ( C2U("InsertYErrorbar") ) - ( C2U("DeleteTrendline") ) ( C2U("DeleteMeanValue") ) ( C2U("DeleteYErrorbar") ) + ( C2U("InsertMenuTitles") ) ( C2U("InsertTitles") ) + ( C2U("InsertMenuLegend") ) ( C2U("InsertLegend") ) ( C2U("DeleteLegend") ) + ( C2U("InsertMenuDataLabels") ) + ( C2U("InsertMenuAxes") ) ( C2U("InsertRemoveAxes") ) ( C2U("InsertMenuGrids") ) + ( C2U("InsertSymbol") ) + ( C2U("InsertTrendlineEquation") ) ( C2U("InsertTrendlineEquationAndR2") ) + ( C2U("InsertR2Value") ) ( C2U("DeleteR2Value") ) + ( C2U("InsertMenuTrendlines") ) ( C2U("InsertTrendline") ) + ( C2U("InsertMenuMeanValues") ) ( C2U("InsertMeanValue") ) + ( C2U("InsertMenuYErrorBars") ) ( C2U("InsertYErrorBars") ) + ( C2U("InsertDataLabels") ) ( C2U("InsertDataLabel") ) + ( C2U("DeleteTrendline") ) ( C2U("DeleteMeanValue") ) ( C2U("DeleteTrendlineEquation") ) + ( C2U("DeleteYErrorBars") ) + ( C2U("DeleteDataLabels") ) ( C2U("DeleteDataLabel") ) //format objects //MENUCHANGE ( C2U("SelectSourceRanges") ) - ( C2U("DiagramObjects") ) ( C2U("TransformDialog") ) + ( C2U("FormatSelection") ) ( C2U("TransformDialog") ) ( C2U("DiagramType") ) ( C2U("View3D") ) ( C2U("Forward") ) ( C2U("Backward") ) ( C2U("MainTitle") ) ( C2U("SubTitle") ) @@ -1426,12 +1496,30 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn ( C2U("DiagramGridXHelp") ) ( C2U("DiagramGridYHelp") ) ( C2U("DiagramGridZHelp") ) ( C2U("DiagramGridAll") ) ( C2U("DiagramWall") ) ( C2U("DiagramFloor") ) ( C2U("DiagramArea") ) + + //context menu - format objects entries + ( C2U("FormatWall") ) ( C2U("FormatFloor") ) ( C2U("FormatChartArea") ) + ( C2U("FormatLegend") ) + + ( C2U("FormatAxis") ) ( C2U("FormatTitle") ) + ( C2U("FormatDataSeries") ) ( C2U("FormatDataPoint") ) + ( C2U("ResetAllDataPoints") ) ( C2U("ResetDataPoint") ) + ( C2U("FormatDataLabels") ) ( C2U("FormatDataLabel") ) + ( C2U("FormatMeanValue") ) ( C2U("FormatTrendline") ) ( C2U("FormatTrendlineEquation") ) + ( C2U("FormatYErrorBars") ) + ( C2U("FormatStockLoss") ) ( C2U("FormatStockGain") ) + + ( C2U("FormatMajorGrid") ) ( C2U("InsertMajorGrid") ) ( C2U("DeleteMajorGrid") ) + ( C2U("FormatMinorGrid") ) ( C2U("InsertMinorGrid") ) ( C2U("DeleteMinorGrid") ) + ( C2U("InsertAxis") ) ( C2U("DeleteAxis") ) ( C2U("InsertAxisTitle") ) + // toolbar commands ( C2U("ToggleGridHorizontal"))( C2U("ToggleLegend") ) ( C2U("ScaleText") ) ( C2U("NewArrangement") ) ( C2U("Update") ) ( C2U("DefaultColors") ) ( C2U("BarWidth") ) ( C2U("NumberOfLines") ) ( C2U("ArrangeRow") ) ( C2U("StatusBarVisible") ) + ( C2U("ChartElementSelector") ) ; } diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index 0b81df0a2367..edf94fb7aae8 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -594,26 +594,50 @@ private: void SAL_CALL executeDispatch_ObjectProperties(); void SAL_CALL executeDispatch_FormatObject( const ::rtl::OUString& rDispatchCommand ); void SAL_CALL executeDlg_ObjectProperties( const ::rtl::OUString& rObjectCID ); + bool executeDlg_ObjectProperties_withoutUndoGuard( const ::rtl::OUString& rObjectCID, bool bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso ); void SAL_CALL executeDispatch_ChartType(); - void SAL_CALL executeDispatch_InsertTitle(); - void SAL_CALL executeDispatch_InsertLegend(); - void SAL_CALL executeDispatch_InsertDataLabel(); - void SAL_CALL executeDispatch_InsertAxis(); - void SAL_CALL executeDispatch_InsertGrid(); -// void SAL_CALL executeDispatch_InsertStatistic(); - void SAL_CALL executeDispatch_InsertYErrorbars(); - void SAL_CALL executeDispatch_InsertTrendlines(); - void SAL_CALL executeDispatch_InsertMeanValue(); - void SAL_CALL executeDispatch_InsertMeanValues(); - void SAL_CALL executeDispatch_InsertTrendline(); - void SAL_CALL executeDispatch_InsertTrendlineEquation(); - void SAL_CALL executeDispatch_InsertYErrorbar(); - - void SAL_CALL executeDispatch_DeleteMeanValue(); - void SAL_CALL executeDispatch_DeleteTrendline(); - void SAL_CALL executeDispatch_DeleteYErrorbar(); + void executeDispatch_InsertTitles(); + void executeDispatch_InsertLegend(); + void executeDispatch_DeleteLegend(); + void executeDispatch_OpenLegendDialog(); + void executeDispatch_InsertAxes(); + void executeDispatch_InsertGrid(); + + void executeDispatch_InsertMenu_DataLabels(); + void executeDispatch_InsertMenu_YErrorBars(); + void executeDispatch_InsertMenu_Trendlines(); + void executeDispatch_InsertMenu_MeanValues(); + + void executeDispatch_InsertMeanValue(); + void executeDispatch_InsertTrendline(); + void executeDispatch_InsertTrendlineEquation( bool bInsertR2=false ); + void executeDispatch_InsertYErrorBars(); + + void executeDispatch_InsertR2Value(); + void executeDispatch_DeleteR2Value(); + + void executeDispatch_DeleteMeanValue(); + void executeDispatch_DeleteTrendline(); + void executeDispatch_DeleteTrendlineEquation(); + void executeDispatch_DeleteYErrorBars(); + + void executeDispatch_InsertDataLabels(); + void executeDispatch_InsertDataLabel(); + void executeDispatch_DeleteDataLabels(); + void executeDispatch_DeleteDataLabel(); + + void executeDispatch_ResetAllDataPoints(); + void executeDispatch_ResetDataPoint(); + + void executeDispatch_InsertAxis(); + void executeDispatch_InsertAxisTitle(); + void executeDispatch_InsertMajorGrid(); + void executeDispatch_InsertMinorGrid(); + void executeDispatch_DeleteAxis(); + void executeDispatch_DeleteMajorGrid(); + void executeDispatch_DeleteMinorGrid(); void SAL_CALL executeDispatch_InsertSpecialCharacter(); void SAL_CALL executeDispatch_EditText(); diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index d847965b6022..45213a4473dc 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -61,6 +61,9 @@ #include "StatisticsHelper.hxx" #include "ErrorBarItemConverter.hxx" #include "MultipleItemConverter.hxx" +#include "DataSeriesHelper.hxx" +#include "ObjectNameProvider.hxx" +#include "LegendHelper.hxx" #include #include @@ -80,6 +83,9 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::rtl::OUString; //............................................................................. @@ -114,7 +120,7 @@ namespace chart { //............................................................................. -void SAL_CALL ChartController::executeDispatch_InsertAxis() +void ChartController::executeDispatch_InsertAxes() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( @@ -152,7 +158,7 @@ void SAL_CALL ChartController::executeDispatch_InsertAxis() } } -void SAL_CALL ChartController::executeDispatch_InsertGrid() +void ChartController::executeDispatch_InsertGrid() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( @@ -189,7 +195,7 @@ void SAL_CALL ChartController::executeDispatch_InsertGrid() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void SAL_CALL ChartController::executeDispatch_InsertTitle() +void ChartController::executeDispatch_InsertTitles() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( @@ -220,7 +226,29 @@ void SAL_CALL ChartController::executeDispatch_InsertTitle() } } -void SAL_CALL ChartController::executeDispatch_InsertLegend() +void ChartController::executeDispatch_DeleteLegend() +{ + UndoGuard aUndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))), + m_xUndoManager, m_aModel->getModel() ); + + LegendHelper::hideLegend( m_aModel->getModel() ); + aUndoGuard.commitAction(); +} + +void ChartController::executeDispatch_InsertLegend() +{ + UndoGuard aUndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))), + m_xUndoManager, m_aModel->getModel() ); + + Reference< chart2::XLegend > xLegend = LegendHelper::showLegend( m_aModel->getModel(), m_xCC ); + aUndoGuard.commitAction(); +} + +void ChartController::executeDispatch_OpenLegendDialog() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( @@ -251,13 +279,32 @@ void SAL_CALL ChartController::executeDispatch_InsertLegend() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void SAL_CALL ChartController::executeDispatch_InsertDataLabel() +void ChartController::executeDispatch_InsertMenu_DataLabels() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))), m_xUndoManager, m_aModel->getModel() ); + //if a series is selected insert labels for that series only: + uno::Reference< chart2::XDataSeries > xSeries( + ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( xSeries.is() ) + { + // add labels + DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints( xSeries ); + + rtl::OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) ); + aChildParticle+=(C2U("=")); + rtl::OUString aObjectCID = ObjectIdentifier::createClassifiedIdentifierForParticles( + ObjectIdentifier::getSeriesParticleFromCID(m_aSelection.getSelectedCID()), aChildParticle ); + + bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, true ); + if( bSuccess ) + aUndoGuard.commitAction(); + return; + } + try { wrapper::AllDataLabelItemConverter aItemConverter( @@ -295,11 +342,21 @@ void SAL_CALL ChartController::executeDispatch_InsertDataLabel() } } -void SAL_CALL ChartController::executeDispatch_InsertYErrorbars() +void ChartController::executeDispatch_InsertMenu_YErrorBars() { + //if a series is selected insert error bars for that series only: + uno::Reference< chart2::XDataSeries > xSeries( + ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( xSeries.is()) + { + executeDispatch_InsertYErrorBars(); + return; + } + + //if no series is selected insert error bars for all series UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_PAGE_YERROR_BARS )))), + ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) ), m_xUndoManager, m_aModel->getModel() ); try @@ -335,7 +392,7 @@ void SAL_CALL ChartController::executeDispatch_InsertYErrorbars() } } -void SAL_CALL ChartController::executeDispatch_InsertMeanValue() +void ChartController::executeDispatch_InsertMeanValue() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( @@ -346,23 +403,43 @@ void SAL_CALL ChartController::executeDispatch_InsertMeanValue() aUndoGuard.commitAction(); } -void SAL_CALL ChartController::executeDispatch_InsertMeanValues() +void ChartController::executeDispatch_InsertMenu_MeanValues() { - ::std::vector< uno::Reference< chart2::XDataSeries > > aSeries( - DiagramHelper::getDataSeriesFromDiagram( ChartModelHelper::findDiagram( m_aModel->getModel()))); UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))), m_xUndoManager, m_aModel->getModel() ); - ::std::for_each( aSeries.begin(), aSeries.end(), lcl_InsertMeanValueLine( m_xCC )); + + uno::Reference< chart2::XDataSeries > xSeries( + ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( xSeries.is() ) + { + //if a series is selected insert mean value only for that series: + lcl_InsertMeanValueLine( m_xCC ).operator()(xSeries); + } + else + { + ::std::vector< uno::Reference< chart2::XDataSeries > > aSeries( + DiagramHelper::getDataSeriesFromDiagram( ChartModelHelper::findDiagram( m_aModel->getModel()))); + ::std::for_each( aSeries.begin(), aSeries.end(), lcl_InsertMeanValueLine( m_xCC )); + } aUndoGuard.commitAction(); } -void SAL_CALL ChartController::executeDispatch_InsertTrendlines() +void ChartController::executeDispatch_InsertMenu_Trendlines() { + //if a series is selected insert only for that series: + uno::Reference< chart2::XDataSeries > xSeries( + ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( xSeries.is()) + { + executeDispatch_InsertTrendline(); + return; + } + UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVES )))), + ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) ), m_xUndoManager, m_aModel->getModel() ); try @@ -395,7 +472,7 @@ void SAL_CALL ChartController::executeDispatch_InsertTrendlines() } } -void SAL_CALL ChartController::executeDispatch_InsertTrendline() +void ChartController::executeDispatch_InsertTrendline() { uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); @@ -449,7 +526,7 @@ void SAL_CALL ChartController::executeDispatch_InsertTrendline() } } -void SAL_CALL ChartController::executeDispatch_InsertYErrorbar() +void ChartController::executeDispatch_InsertYErrorBars() { uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); @@ -457,7 +534,7 @@ void SAL_CALL ChartController::executeDispatch_InsertYErrorbar() { UndoLiveUpdateGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_INDICATOR )))), + ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_BARS )))), m_xUndoManager, m_aModel->getModel() ); // add error bars with standard deviation @@ -499,10 +576,16 @@ void SAL_CALL ChartController::executeDispatch_InsertYErrorbar() } } -void SAL_CALL ChartController::executeDispatch_InsertTrendlineEquation() +void ChartController::executeDispatch_InsertTrendlineEquation( bool bInsertR2 ) { uno::Reference< chart2::XRegressionCurve > xRegCurve( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( !xRegCurve.is() ) + { + uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( + ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + xRegCurve.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) ); + } if( xRegCurve.is()) { uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties()); @@ -514,13 +597,43 @@ void SAL_CALL ChartController::executeDispatch_InsertTrendlineEquation() ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))), m_xUndoManager, m_aModel->getModel() ); xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( true )); - xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false )); + xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( bInsertR2 )); aUndoGuard.commitAction(); } } } -void SAL_CALL ChartController::executeDispatch_DeleteMeanValue() +void ChartController::executeDispatch_InsertR2Value() +{ + uno::Reference< beans::XPropertySet > xEqProp( + ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( xEqProp.is()) + { + UndoGuard aUndoGuard = UndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))), + m_xUndoManager, m_aModel->getModel() ); + xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( true )); + aUndoGuard.commitAction(); + } +} + +void ChartController::executeDispatch_DeleteR2Value() +{ + uno::Reference< beans::XPropertySet > xEqProp( + ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( xEqProp.is()) + { + UndoGuard aUndoGuard = UndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))), + m_xUndoManager, m_aModel->getModel() ); + xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false )); + aUndoGuard.commitAction(); + } +} + +void ChartController::executeDispatch_DeleteMeanValue() { uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); @@ -535,7 +648,7 @@ void SAL_CALL ChartController::executeDispatch_DeleteMeanValue() } } -void SAL_CALL ChartController::executeDispatch_DeleteTrendline() +void ChartController::executeDispatch_DeleteTrendline() { uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); @@ -550,7 +663,22 @@ void SAL_CALL ChartController::executeDispatch_DeleteTrendline() } } -void SAL_CALL ChartController::executeDispatch_DeleteYErrorbar() +void ChartController::executeDispatch_DeleteTrendlineEquation() +{ + uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( + ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( xRegCurveCnt.is()) + { + UndoGuard aUndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))), + m_xUndoManager, m_aModel->getModel()); + RegressionCurveHelper::removeEquations( xRegCurveCnt ); + aUndoGuard.commitAction(); + } +} + +void ChartController::executeDispatch_DeleteYErrorBars() { uno::Reference< chart2::XDataSeries > xDataSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel())); @@ -565,6 +693,256 @@ void SAL_CALL ChartController::executeDispatch_DeleteYErrorbar() } } +void ChartController::executeDispatch_InsertDataLabels() +{ + uno::Reference< chart2::XDataSeries > xSeries( + ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( xSeries.is() ) + { + UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, + ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))), + m_xUndoManager, m_aModel->getModel() ); + DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints( xSeries ); + aUndoGuard.commitAction(); + } +} + +void ChartController::executeDispatch_InsertDataLabel() +{ + UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, + ::rtl::OUString( String( SchResId( STR_OBJECT_LABEL )))), + m_xUndoManager, m_aModel->getModel() ); + DataSeriesHelper::insertDataLabelToPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), m_aModel->getModel() ) ); + aUndoGuard.commitAction(); +} + +void ChartController::executeDispatch_DeleteDataLabels() +{ + uno::Reference< chart2::XDataSeries > xSeries( + ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( xSeries.is() ) + { + UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, + ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))), + m_xUndoManager, m_aModel->getModel()); + DataSeriesHelper::deleteDataLabelsFromSeriesAndAllPoints( xSeries ); + aUndoGuard.commitAction(); + } +} + +void ChartController::executeDispatch_DeleteDataLabel() +{ + UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, + ::rtl::OUString( String( SchResId( STR_OBJECT_LABEL )))), + m_xUndoManager, m_aModel->getModel()); + DataSeriesHelper::deleteDataLabelsFromPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), m_aModel->getModel() ) ); + aUndoGuard.commitAction(); +} + +void ChartController::executeDispatch_ResetAllDataPoints() +{ + UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT, + ::rtl::OUString( String( SchResId( STR_OBJECT_DATAPOINTS )))), + m_xUndoManager, m_aModel->getModel()); + uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( xSeries.is() ) + xSeries->resetAllDataPoints(); + aUndoGuard.commitAction(); +} +void ChartController::executeDispatch_ResetDataPoint() +{ + UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT, + ::rtl::OUString( String( SchResId( STR_OBJECT_DATAPOINT )))), + m_xUndoManager, m_aModel->getModel()); + uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel()), uno::UNO_QUERY ); + if( xSeries.is() ) + { + sal_Int32 nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() ); + xSeries->resetDataPoint( nPointIndex ); + } + aUndoGuard.commitAction(); +} + +void ChartController::executeDispatch_InsertAxisTitle() +{ + try + { + uno::Reference< XTitle > xTitle; + { + UndoGuard aUndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_TITLE )))), + m_xUndoManager, m_aModel->getModel() ); + + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); + sal_Int32 nDimensionIndex = -1; + sal_Int32 nCooSysIndex = -1; + sal_Int32 nAxisIndex = -1; + AxisHelper::getIndicesForAxis( xAxis, ChartModelHelper::findDiagram(m_aModel->getModel()), nCooSysIndex, nDimensionIndex, nAxisIndex ); + + TitleHelper::eTitleType eTitleType = TitleHelper::X_AXIS_TITLE; + if( nDimensionIndex==0 ) + eTitleType = nAxisIndex==0 ? TitleHelper::X_AXIS_TITLE : TitleHelper::SECONDARY_X_AXIS_TITLE; + else if( nDimensionIndex==1 ) + eTitleType = nAxisIndex==0 ? TitleHelper::Y_AXIS_TITLE : TitleHelper::SECONDARY_Y_AXIS_TITLE; + else + eTitleType = TitleHelper::Z_AXIS_TITLE; + + ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProvider( impl_createReferenceSizeProvider()); + xTitle = TitleHelper::createTitle( eTitleType, ObjectNameProvider::getTitleNameByType(eTitleType), m_aModel->getModel(), m_xCC, apRefSizeProvider.get() ); + aUndoGuard.commitAction(); + } + + /* + if( xTitle.is() ) + { + OUString aTitleCID = ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, m_aModel->getModel() ); + select( uno::makeAny(aTitleCID) ); + executeDispatch_EditText(); + } + */ + } + catch( uno::RuntimeException& e) + { + ASSERT_EXCEPTION( e ); + } +} + +void ChartController::executeDispatch_InsertAxis() +{ + UndoGuard aUndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AXIS )))), + m_xUndoManager, m_aModel->getModel() ); + + try + { + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); + if( xAxis.is() ) + { + AxisHelper::makeAxisVisible( xAxis ); + aUndoGuard.commitAction(); + } + } + catch( uno::RuntimeException& e) + { + ASSERT_EXCEPTION( e ); + } +} + +void ChartController::executeDispatch_DeleteAxis() +{ + UndoGuard aUndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_AXIS )))), + m_xUndoManager, m_aModel->getModel() ); + + try + { + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); + if( xAxis.is() ) + { + AxisHelper::makeAxisInvisible( xAxis ); + aUndoGuard.commitAction(); + } + } + catch( uno::RuntimeException& e) + { + ASSERT_EXCEPTION( e ); + } +} + +void ChartController::executeDispatch_InsertMajorGrid() +{ + UndoGuard aUndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))), + m_xUndoManager, m_aModel->getModel() ); + + try + { + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); + if( xAxis.is() ) + { + AxisHelper::makeGridVisible( xAxis->getGridProperties() ); + aUndoGuard.commitAction(); + } + } + catch( uno::RuntimeException& e) + { + ASSERT_EXCEPTION( e ); + } +} + +void ChartController::executeDispatch_DeleteMajorGrid() +{ + UndoGuard aUndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))), + m_xUndoManager, m_aModel->getModel() ); + + try + { + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); + if( xAxis.is() ) + { + AxisHelper::makeGridInvisible( xAxis->getGridProperties() ); + aUndoGuard.commitAction(); + } + } + catch( uno::RuntimeException& e) + { + ASSERT_EXCEPTION( e ); + } +} + +void ChartController::executeDispatch_InsertMinorGrid() +{ + UndoGuard aUndoGuard( + ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))), + m_xUndoManager, m_aModel->getModel() ); + + try + { + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); + if( xAxis.is() ) + { + Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); + for( sal_Int32 nN=0; nNgetModel() ); + + try + { + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); + if( xAxis.is() ) + { + Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); + for( sal_Int32 nN=0; nN //for auto_ptr @@ -80,6 +81,8 @@ namespace chart //............................................................................. using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using ::com::sun::star::uno::Reference; +using ::rtl::OUString; namespace { @@ -437,34 +440,37 @@ rtl::OUString lcl_getGridCIDForCommand( const ::rtl::OString& rDispatchCommand, rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, nSubGridIndex ) ); return aCID; } -rtl::OUString lcl_getObjectCIDForCommand( const ::rtl::OString& rDispatchCommand, const uno::Reference< XChartDocument > & xChartDocument ) +rtl::OUString lcl_getObjectCIDForCommand( const ::rtl::OString& rDispatchCommand, const uno::Reference< XChartDocument > & xChartDocument, const rtl::OUString& rSelectedCID ) { ObjectType eObjectType = OBJECTTYPE_UNKNOWN; rtl::OUString aParticleID; uno::Reference< frame::XModel > xChartModel( xChartDocument, uno::UNO_QUERY ); + const ObjectType eSelectedType = ObjectIdentifier::getObjectType( rSelectedCID ); + uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSelectedCID, xChartModel ); + uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( xSeries, uno::UNO_QUERY ); //------------------------------------------------------------------------- //legend - if( rDispatchCommand.equals("Legend")) + if( rDispatchCommand.equals("Legend") || rDispatchCommand.equals("FormatLegend") ) { eObjectType = OBJECTTYPE_LEGEND; //@todo set particular aParticleID if we have more than one legend } //------------------------------------------------------------------------- //wall floor area - else if( rDispatchCommand.equals("DiagramWall")) + else if( rDispatchCommand.equals("DiagramWall") || rDispatchCommand.equals("FormatWall") ) { //OBJECTTYPE_DIAGRAM; eObjectType = OBJECTTYPE_DIAGRAM_WALL; //@todo set particular aParticleID if we have more than one diagram } - else if( rDispatchCommand.equals("DiagramFloor")) + else if( rDispatchCommand.equals("DiagramFloor") || rDispatchCommand.equals("FormatFloor") ) { eObjectType = OBJECTTYPE_DIAGRAM_FLOOR; //@todo set particular aParticleID if we have more than one diagram } - else if( rDispatchCommand.equals("DiagramArea")) + else if( rDispatchCommand.equals("DiagramArea") || rDispatchCommand.equals("FormatChartArea") ) { eObjectType = OBJECTTYPE_PAGE; } @@ -507,6 +513,163 @@ rtl::OUString lcl_getObjectCIDForCommand( const ::rtl::OString& rDispatchCommand { return lcl_getGridCIDForCommand( rDispatchCommand, xChartModel ); } + //------------------------------------------------------------------------- + //data series + else if( rDispatchCommand.equals("FormatDataSeries") ) + { + if( eSelectedType == OBJECTTYPE_DATA_SERIES ) + return rSelectedCID; + else + return ObjectIdentifier::createClassifiedIdentifier( + OBJECTTYPE_DATA_SERIES, ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ) ); + } + //------------------------------------------------------------------------- + //data point + else if( rDispatchCommand.equals("FormatDataPoint") ) + { + return rSelectedCID; + } + //------------------------------------------------------------------------- + //data labels + else if( rDispatchCommand.equals("FormatDataLabels") ) + { + if( eSelectedType == OBJECTTYPE_DATA_LABELS ) + return rSelectedCID; + else + return ObjectIdentifier::createClassifiedIdentifierWithParent( + OBJECTTYPE_DATA_LABELS, ::rtl::OUString(), rSelectedCID ); + } + //------------------------------------------------------------------------- + //data labels + else if( rDispatchCommand.equals("FormatDataLabel") ) + { + if( eSelectedType == OBJECTTYPE_DATA_LABEL ) + return rSelectedCID; + else + { + sal_Int32 nPointIndex = ObjectIdentifier::getParticleID( rSelectedCID ).toInt32(); + if( nPointIndex>=0 ) + { + OUString aSeriesParticle = ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ); + OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) ); + aChildParticle+=(C2U("=")); + OUString aLabelsCID = ObjectIdentifier::createClassifiedIdentifierForParticles( aSeriesParticle, aChildParticle ); + OUString aLabelCID_Stub = ObjectIdentifier::createClassifiedIdentifierWithParent( + OBJECTTYPE_DATA_LABEL, ::rtl::OUString(), aLabelsCID ); + + return ObjectIdentifier::createPointCID( aLabelCID_Stub, nPointIndex ); + } + } + } + //------------------------------------------------------------------------- + //mean value line + else if( rDispatchCommand.equals("FormatMeanValue") ) + { + if( eSelectedType == OBJECTTYPE_DATA_AVERAGE_LINE ) + return rSelectedCID; + else + return ObjectIdentifier::createDataCurveCID( + ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ), + RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt, + RegressionCurveHelper::getMeanValueLine( xRegCurveCnt ) ), true ); + } + //------------------------------------------------------------------------- + //trend line + else if( rDispatchCommand.equals("FormatTrendline") ) + { + if( eSelectedType == OBJECTTYPE_DATA_CURVE ) + return rSelectedCID; + else + return ObjectIdentifier::createDataCurveCID( + ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ), + RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt, + RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) ), false ); + } + //------------------------------------------------------------------------- + //trend line equation + else if( rDispatchCommand.equals("FormatTrendlineEquation") ) + { + if( eSelectedType == OBJECTTYPE_DATA_CURVE_EQUATION ) + return rSelectedCID; + else + return ObjectIdentifier::createDataCurveEquationCID( + ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ), + RegressionCurveHelper::getRegressionCurveIndex( xRegCurveCnt, + RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) ) ); + } + //------------------------------------------------------------------------- + // y error bars + else if( rDispatchCommand.equals("FormatYErrorBars") ) + { + if( eSelectedType == OBJECTTYPE_DATA_ERRORS ) + return rSelectedCID; + else + return ObjectIdentifier::createClassifiedIdentifierWithParent( + OBJECTTYPE_DATA_ERRORS, ::rtl::OUString(), rSelectedCID ); + } + //------------------------------------------------------------------------- + // axis + else if( rDispatchCommand.equals("FormatAxis") ) + { + if( eSelectedType == OBJECTTYPE_AXIS ) + return rSelectedCID; + else + { + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel ); + return ObjectIdentifier::createClassifiedIdentifierForObject( xAxis , xChartModel ); + } + } + //------------------------------------------------------------------------- + // major grid + else if( rDispatchCommand.equals("FormatMajorGrid") ) + { + if( eSelectedType == OBJECTTYPE_GRID ) + return rSelectedCID; + else + { + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel ); + return ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel ); + } + + } + //------------------------------------------------------------------------- + // minor grid + else if( rDispatchCommand.equals("FormatMinorGrid") ) + { + if( eSelectedType == OBJECTTYPE_SUBGRID ) + return rSelectedCID; + else + { + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( rSelectedCID, xChartModel ); + return ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartModel, 0 /*sub grid index*/ ); + } + } + //------------------------------------------------------------------------- + // title + else if( rDispatchCommand.equals("FormatTitle") ) + { + if( eSelectedType == OBJECTTYPE_TITLE ) + return rSelectedCID; + } + //------------------------------------------------------------------------- + // stock loss + else if( rDispatchCommand.equals("FormatStockLoss") ) + { + if( eSelectedType == OBJECTTYPE_DATA_STOCK_LOSS ) + return rSelectedCID; + else + return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DATA_STOCK_LOSS, rtl::OUString()); + } + //------------------------------------------------------------------------- + // stock gain + else if( rDispatchCommand.equals("FormatStockGain") ) + { + if( eSelectedType == OBJECTTYPE_DATA_STOCK_GAIN ) + return rSelectedCID; + else + return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DATA_STOCK_GAIN, rtl::OUString() ); + } + return ObjectIdentifier::createClassifiedIdentifier( eObjectType, aParticleID ); } @@ -518,7 +681,7 @@ void SAL_CALL ChartController::executeDispatch_FormatObject(const ::rtl::OUStrin { uno::Reference< XChartDocument > xChartDocument( m_aModel->getModel(), uno::UNO_QUERY ); rtl::OString aCommand( rtl::OUStringToOString( rDispatchCommand, RTL_TEXTENCODING_ASCII_US ) ); - rtl::OUString rObjectCID = lcl_getObjectCIDForCommand( aCommand, xChartDocument ); + rtl::OUString rObjectCID = lcl_getObjectCIDForCommand( aCommand, xChartDocument, m_aSelection.getSelectedCID() ); executeDlg_ObjectProperties( rObjectCID ); } @@ -527,55 +690,73 @@ void SAL_CALL ChartController::executeDispatch_ObjectProperties() executeDlg_ObjectProperties( m_aSelection.getSelectedCID() ); } -void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUString& rObjectCID ) +namespace +{ + +rtl::OUString lcl_getFormatCIDforSelectedCID( const ::rtl::OUString& rSelectedCID ) +{ + ::rtl::OUString aFormatCID(rSelectedCID); + + //get type of selected object + ObjectType eObjectType = ObjectIdentifier::getObjectType( aFormatCID ); + + // some legend entries are handled as if they were data series + if( OBJECTTYPE_LEGEND_ENTRY==eObjectType ) + { + rtl::OUString aParentParticle( ObjectIdentifier::getFullParentParticle( rSelectedCID ) ); + aFormatCID = ObjectIdentifier::createClassifiedIdentifierForParticle( aParentParticle ); + } + + // treat diagram as wall + if( OBJECTTYPE_DIAGRAM==eObjectType ) + aFormatCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() ); + + return aFormatCID; +} + +}//end anonymous namespace + +void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUString& rSelectedObjectCID ) +{ + rtl::OUString aObjectCID = lcl_getFormatCIDforSelectedCID( rSelectedObjectCID ); + + UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( + ActionDescriptionProvider::FORMAT, + ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aObjectCID ))), + m_xUndoManager, m_aModel->getModel() ); + + bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, false ); + if( bSuccess ) + aUndoGuard.commitAction(); +} + +bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( const ::rtl::OUString& rObjectCID, bool bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso ) { + //return true if the properties were changed successfully + bool bRet = false; if( !rObjectCID.getLength() ) { //DBG_ERROR("empty ObjectID"); - return; + return bRet; } try { - ::rtl::OUString aObjectCID(rObjectCID); NumberFormatterWrapper aNumberFormatterWrapper( uno::Reference< util::XNumberFormatsSupplier >(m_aModel->getModel(), uno::UNO_QUERY) ); //------------------------------------------------------------- - //get type of selected object - ObjectType eObjectType = ObjectIdentifier::getObjectType( aObjectCID ); + //get type of object + ObjectType eObjectType = ObjectIdentifier::getObjectType( rObjectCID ); if( OBJECTTYPE_UNKNOWN==eObjectType ) { //DBG_ERROR("unknown ObjectType"); - return; - } - - // some legend entries are handled as if they were data series - if( OBJECTTYPE_LEGEND_ENTRY==eObjectType ) - { - rtl::OUString aParentParticle( ObjectIdentifier::getFullParentParticle( aObjectCID ) ); - eObjectType = ObjectIdentifier::getObjectType( aParentParticle ); - aObjectCID = ObjectIdentifier::createClassifiedIdentifierForParticle( aParentParticle ); + return bRet; } - - // treat diagram as wall - if( OBJECTTYPE_DIAGRAM==eObjectType ) - { - aObjectCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() ); - eObjectType = OBJECTTYPE_DIAGRAM_WALL; - } - if( OBJECTTYPE_DIAGRAM_WALL==eObjectType || OBJECTTYPE_DIAGRAM_FLOOR==eObjectType ) { if( !DiagramHelper::isSupportingFloorAndWall( ChartModelHelper::findDiagram( m_aModel->getModel() ) ) ) - return; + return bRet; } - //------------------------------------------------------------- - UndoGuard aUndoGuard( - ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::FORMAT, - ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aObjectCID ))), - m_xUndoManager, m_aModel->getModel() ); - //------------------------------------------------------------- //convert properties to ItemSet @@ -584,20 +765,20 @@ void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUStrin ::std::auto_ptr< ReferenceSizeProvider > pRefSizeProv( impl_createReferenceSizeProvider()); ::std::auto_ptr< ::comphelper::ItemConverter > apItemConverter( - createItemConverter( aObjectCID, m_aModel->getModel(), m_xCC, + createItemConverter( rObjectCID, m_aModel->getModel(), m_xCC, m_pDrawModelWrapper->getSdrModel(), &aNumberFormatterWrapper, ExplicitValueProvider::getExplicitValueProvider(m_xChartView), pRefSizeProv )); if(!apItemConverter.get()) - return; + return bRet; SfxItemSet aItemSet = apItemConverter->CreateEmptyItemSet(); apItemConverter->FillItemSet( aItemSet ); //------------------------------------------------------------- //prepare dialog - ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter( aObjectCID ); + ObjectPropertiesDialogParameter aDialogParameter = ObjectPropertiesDialogParameter( rObjectCID ); aDialogParameter.init( m_aModel->getModel() ); ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get() ); @@ -609,9 +790,9 @@ void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUStrin { SfxItemSet* pSymbolShapeProperties=NULL; uno::Reference< beans::XPropertySet > xObjectProperties = - ObjectIdentifier::getObjectPropertySet( aObjectCID, m_aModel->getModel() ); + ObjectIdentifier::getObjectPropertySet( rObjectCID, m_aModel->getModel() ); wrapper::DataPointItemConverter aSymbolItemConverter( m_aModel->getModel(), m_xCC - , xObjectProperties, ObjectIdentifier::getDataSeriesForCID( aObjectCID, m_aModel->getModel() ) + , xObjectProperties, ObjectIdentifier::getDataSeriesForCID( rObjectCID, m_aModel->getModel() ) , m_pDrawModelWrapper->getSdrModel().GetItemPool() , m_pDrawModelWrapper->getSdrModel() , &aNumberFormatterWrapper @@ -629,24 +810,19 @@ void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUStrin if( aDialogParameter.HasStatisticProperties() ) { aDlg.SetAxisMinorStepWidthForErrorBarDecimals( - InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( m_aModel->getModel(), m_xChartView, aObjectCID ) ); + InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( m_aModel->getModel(), m_xChartView, rObjectCID ) ); } //------------------------------------------------------------- //open the dialog - if( aDlg.Execute() == RET_OK ) + if( aDlg.Execute() == RET_OK || (bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso && aDlg.DialogWasClosedWithOK()) ) { const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet(); if(pOutItemSet) { - bool bChanged = false; - { - ControllerLockGuard aCLGuard( m_aModel->getModel()); - bChanged = apItemConverter->ApplyItemSet( *pOutItemSet );//model should be changed now - } - - if( bChanged ) - aUndoGuard.commitAction(); + ControllerLockGuard aCLGuard( m_aModel->getModel()); + apItemConverter->ApplyItemSet( *pOutItemSet );//model should be changed now + bRet = true; } } } @@ -656,6 +832,7 @@ void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUStrin catch( uno::RuntimeException& ) { } + return bRet; } void SAL_CALL ChartController::executeDispatch_View3D() diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index fdbda4589abd..8dca62d93ee1 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -656,7 +656,7 @@ bool ChartController::executeDispatch_Delete() // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_INDICATOR )))), + ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_BARS )))), m_xUndoManager, xModel ); { ControllerLockGuard aCtlLockGuard( xModel ); diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 2288bb602296..951bb127f117 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -51,9 +51,17 @@ #include "chartview/ExplicitValueProvider.hxx" #include "RelativePositionHelper.hxx" #include "chartview/DrawModelWrapper.hxx" +#include "RegressionCurveHelper.hxx" +#include "StatisticsHelper.hxx" +#include "DataSeriesHelper.hxx" +#include "ContainerHelper.hxx" +#include "AxisHelper.hxx" +#include "LegendHelper.hxx" +#include "servicenames_charttypes.hxx" #include #include +#include #include #include @@ -85,6 +93,13 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using ::com::sun::star::uno::Reference; +using ::rtl::OUString; + +//............................................................................. +namespace chart +{ +//............................................................................. namespace { @@ -138,13 +153,86 @@ void lcl_insertMenuCommand( xMenuEx->setCommand( nId, rCommand ); } -} // anonymous namespace +OUString lcl_getFormatCommandForObjectCID( const OUString& rCID ) +{ + OUString aDispatchCommand( C2U(".uno:FormatSelection") ); + ObjectType eObjectType = ObjectIdentifier::getObjectType( rCID ); -//............................................................................. -namespace chart -{ -//............................................................................. + switch(eObjectType) + { + case OBJECTTYPE_DIAGRAM: + case OBJECTTYPE_DIAGRAM_WALL: + aDispatchCommand = C2U(".uno:FormatWall"); + break; + case OBJECTTYPE_DIAGRAM_FLOOR: + aDispatchCommand = C2U(".uno:FormatFloor"); + break; + case OBJECTTYPE_PAGE: + aDispatchCommand = C2U(".uno:FormatChartArea"); + break; + case OBJECTTYPE_LEGEND: + aDispatchCommand = C2U(".uno:FormatLegend"); + break; + case OBJECTTYPE_TITLE: + aDispatchCommand = C2U(".uno:FormatTitle"); + break; + case OBJECTTYPE_LEGEND_ENTRY: + aDispatchCommand = C2U(".uno:FormatDataSeries"); + break; + case OBJECTTYPE_AXIS: + case OBJECTTYPE_AXIS_UNITLABEL: + aDispatchCommand = C2U(".uno:FormatAxis"); + break; + case OBJECTTYPE_GRID: + aDispatchCommand = C2U(".uno:FormatMajorGrid"); + break; + case OBJECTTYPE_SUBGRID: + aDispatchCommand = C2U(".uno:FormatMinorGrid"); + break; + case OBJECTTYPE_DATA_LABELS: + aDispatchCommand = C2U(".uno:FormatDataLabels"); + break; + case OBJECTTYPE_DATA_SERIES: + aDispatchCommand = C2U(".uno:FormatDataSeries"); + break; + case OBJECTTYPE_DATA_LABEL: + aDispatchCommand = C2U(".uno:FormatDataLabel"); + break; + case OBJECTTYPE_DATA_POINT: + aDispatchCommand = C2U(".uno:FormatDataPoint"); + break; + case OBJECTTYPE_DATA_AVERAGE_LINE: + aDispatchCommand = C2U(".uno:FormatMeanValue"); + break; + case OBJECTTYPE_DATA_ERRORS: + case OBJECTTYPE_DATA_ERRORS_X: + case OBJECTTYPE_DATA_ERRORS_Y: + case OBJECTTYPE_DATA_ERRORS_Z: + aDispatchCommand = C2U(".uno:FormatYErrorBars"); + break; + case OBJECTTYPE_DATA_CURVE: + aDispatchCommand = C2U(".uno:FormatTrendline"); + break; + case OBJECTTYPE_DATA_CURVE_EQUATION: + aDispatchCommand = C2U(".uno:FormatTrendlineEquation"); + break; + case OBJECTTYPE_DATA_STOCK_RANGE: + aDispatchCommand = C2U(".uno:FormatSelection"); + break; + case OBJECTTYPE_DATA_STOCK_LOSS: + aDispatchCommand = C2U(".uno:FormatStockLoss"); + break; + case OBJECTTYPE_DATA_STOCK_GAIN: + aDispatchCommand = C2U(".uno:FormatStockGain"); + break; + default: //OBJECTTYPE_UNKNOWN + break; + } + return aDispatchCommand; +} + +} // anonymous namespace const short HITPIX=2; //hit-tolerance in pixel @@ -830,36 +918,254 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) if( xPopupMenu.is() && xMenuEx.is()) { sal_Int16 nUniqueId = 1; - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramObjects")); + ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ); + Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( m_aModel->getModel() ); + + OUString aFormatCommand( lcl_getFormatCommandForObjectCID( m_aSelection.getSelectedCID() ) ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, aFormatCommand ); + + //some commands for dataseries and points: + //----- + if( OBJECTTYPE_DATA_SERIES == eObjectType || OBJECTTYPE_DATA_POINT == eObjectType ) + { + bool bIsPoint = ( OBJECTTYPE_DATA_POINT == eObjectType ); + uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); + uno::Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY ); + Reference< chart2::XRegressionCurve > xTrendline( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xCurveCnt ) ); + bool bHasEquation = RegressionCurveHelper::hasEquation( xTrendline ); + Reference< chart2::XRegressionCurve > xMeanValue( RegressionCurveHelper::getMeanValueLine( xCurveCnt ) ); + bool bHasYErrorBars = StatisticsHelper::hasErrorBars( xSeries, true ); + bool bHasDataLabelsAtSeries = DataSeriesHelper::hasDataLabelsAtSeries( xSeries ); + bool bHasDataLabelsAtPoints = DataSeriesHelper::hasDataLabelsAtPoints( xSeries ); + bool bHasDataLabelAtPoint = false; + sal_Int32 nPointIndex = -1; + if( bIsPoint ) + { + nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() ); + bHasDataLabelAtPoint = DataSeriesHelper::hasDataLabelAtPoint( xSeries, nPointIndex ); + } + bool bSelectedPointIsFormatted = false; + bool bHasFormattedDataPointsOtherThanSelected = false; + + Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY ); + if( xSeriesProperties.is() ) + { + uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; + if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList ) + { + if( aAttributedDataPointIndexList.hasElements() ) + { + if( bIsPoint ) + { + ::std::vector< sal_Int32 > aIndices( ContainerHelper::SequenceToVector( aAttributedDataPointIndexList ) ); + ::std::vector< sal_Int32 >::iterator aIt = ::std::find( aIndices.begin(), aIndices.end(), nPointIndex ); + if( aIt != aIndices.end()) + bSelectedPointIsFormatted = true; + else + bHasFormattedDataPointsOtherThanSelected = true; + } + else + bHasFormattedDataPointsOtherThanSelected = true; + } + } + } + + //const sal_Int32 nIdBeforeFormat = nUniqueId; + if( bIsPoint ) + { + if( bHasDataLabelAtPoint ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabel") ); + if( !bHasDataLabelAtPoint ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabel") ); + else + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabel") ); + if( bSelectedPointIsFormatted ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetDataPoint")); + + xPopupMenu->insertSeparator( -1 ); + + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataSeries") ); + } + + Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) ); + if( xChartType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) + { + try + { + Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY ); + if( xChartTypeProp.is() ) + { + bool bJapaneseStyle = false; + xChartTypeProp->getPropertyValue( C2U( "Japanese" ) ) >>= bJapaneseStyle; + + if( bJapaneseStyle ) + { + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") ); + } + } + } + catch( const uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + } + } + + if( bHasDataLabelsAtSeries ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatDataLabels") ); + if( xTrendline.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendline") ); + if( bHasEquation ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendlineEquation") ); + if( xMeanValue.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMeanValue") ); + if( bHasYErrorBars ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatYErrorBars") ); + + //if( nIdBeforeFormat != nUniqueId ) + xPopupMenu->insertSeparator( -1 ); + + //const sal_Int32 nIdBeforeInsert = nUniqueId; + + if( !bHasDataLabelsAtSeries ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertDataLabels") ); + if( !xTrendline.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendline") ); + else if( !bHasEquation ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation") ); + if( !xMeanValue.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMeanValue") ); + if( !bHasYErrorBars ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertYErrorBars") ); + + //if( nIdBeforeInsert != nUniqueId ) + // xPopupMenu->insertSeparator( -1 ); + + //const sal_Int32 nIdBeforeDelete = nUniqueId; + + if( bHasDataLabelsAtSeries || ( bHasDataLabelsAtPoints && bHasFormattedDataPointsOtherThanSelected ) ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteDataLabels") ); + if( xTrendline.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendline") ); + if( bHasEquation ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") ); + if( xMeanValue.is() ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMeanValue") ); + if( bHasYErrorBars ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteYErrorBars") ); + + if( bHasFormattedDataPointsOtherThanSelected ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:ResetAllDataPoints")); + + //if( nIdBeforeDelete != nUniqueId ) + xPopupMenu->insertSeparator( -1 ); + + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId, C2U(".uno:ArrangeRow")); + uno::Reference< awt::XPopupMenu > xArrangePopupMenu( + m_xCC->getServiceManager()->createInstanceWithContext( + C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY ); + uno::Reference< awt::XMenuExtended > xArrangeMenuEx( xArrangePopupMenu, uno::UNO_QUERY ); + if( xArrangePopupMenu.is() && xArrangeMenuEx.is()) + { + sal_Int16 nSubId = nUniqueId + 1; + lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId++, C2U(".uno:Forward") ); + lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId, C2U(".uno:Backward") ); + xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu ); + nUniqueId = nSubId; + } + ++nUniqueId; + } + else if( OBJECTTYPE_DATA_CURVE == eObjectType ) + { + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatTrendlineEquation") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquationAndR2") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendlineEquation") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") ); + } + else if( OBJECTTYPE_DATA_CURVE_EQUATION == eObjectType ) + { + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertR2Value") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteR2Value") ); + } + + //some commands for axes: and grids + //----- + else if( OBJECTTYPE_AXIS == eObjectType || OBJECTTYPE_GRID == eObjectType || OBJECTTYPE_SUBGRID == eObjectType ) + { + Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), m_aModel->getModel() ); + if( xAxis.is() && xDiagram.is() ) + { + sal_Int32 nDimensionIndex = -1; + sal_Int32 nCooSysIndex = -1; + sal_Int32 nAxisIndex = -1; + AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ); + bool bIsSecondaryAxis = nAxisIndex!=0; + bool bIsAxisVisible = AxisHelper::isAxisVisible( xAxis ); + bool bIsMajorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, true /*bMainGrid*/, xDiagram ); + bool bIsMinorGridVisible = AxisHelper::isGridShown( nDimensionIndex, nCooSysIndex, false /*bMainGrid*/, xDiagram ); + bool bHasTitle = false; + uno::Reference< XTitled > xTitled( xAxis, uno::UNO_QUERY ); + if( xTitled.is()) + bHasTitle = TitleHelper::getCompleteString( xTitled->getTitleObject() ).getLength()>0; + + if( OBJECTTYPE_AXIS != eObjectType && bIsAxisVisible ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatAxis") ); + if( OBJECTTYPE_GRID != eObjectType && bIsMajorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMajorGrid") ); + if( OBJECTTYPE_SUBGRID != eObjectType && bIsMinorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatMinorGrid") ); + + xPopupMenu->insertSeparator( -1 ); + + if( OBJECTTYPE_AXIS != eObjectType && !bIsAxisVisible ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxis") ); + if( OBJECTTYPE_GRID != eObjectType && !bIsMajorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMajorGrid") ); + if( OBJECTTYPE_SUBGRID != eObjectType && !bIsMinorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMinorGrid") ); + if( !bHasTitle ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertAxisTitle") ); + + if( bIsAxisVisible ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteAxis") ); + if( bIsMajorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMajorGrid") ); + if( bIsMinorGridVisible && !bIsSecondaryAxis ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMinorGrid") ); + } + } + + if( OBJECTTYPE_DATA_STOCK_LOSS == eObjectType ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockGain") ); + else if( OBJECTTYPE_DATA_STOCK_GAIN == eObjectType ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:FormatStockLoss") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:TransformDialog")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId, C2U(".uno:ArrangeRow")); - uno::Reference< awt::XPopupMenu > xArrangePopupMenu( - m_xCC->getServiceManager()->createInstanceWithContext( - C2U("com.sun.star.awt.PopupMenu"), m_xCC ), uno::UNO_QUERY ); - uno::Reference< awt::XMenuExtended > xArrangeMenuEx( xArrangePopupMenu, uno::UNO_QUERY ); - if( xArrangePopupMenu.is() && xArrangeMenuEx.is()) + + if( OBJECTTYPE_PAGE == eObjectType || OBJECTTYPE_DIAGRAM == eObjectType + || OBJECTTYPE_DIAGRAM_WALL == eObjectType + || OBJECTTYPE_DIAGRAM_FLOOR == eObjectType + || OBJECTTYPE_UNKNOWN == eObjectType ) { - sal_Int16 nSubId = nUniqueId + 1; - lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId++, C2U(".uno:Forward")); - lcl_insertMenuCommand( xArrangePopupMenu, xArrangeMenuEx, nSubId, C2U(".uno:Backward")); - xPopupMenu->setPopupMenu( nUniqueId, xArrangePopupMenu ); - nUniqueId = nSubId; + if( OBJECTTYPE_UNKNOWN != eObjectType ) + xPopupMenu->insertSeparator( -1 ); + bool bHasLegend = LegendHelper::hasLegend( xDiagram ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTitles") ); + if( !bHasLegend ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertLegend") ); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertRemoveAxes") ); + if( bHasLegend ) + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteLegend") ); } - ++nUniqueId; + //----- + xPopupMenu->insertSeparator( -1 ); lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramType")); lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DataRanges")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:View3D")); - xPopupMenu->insertSeparator( -1 ); lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DiagramData")); - xPopupMenu->insertSeparator( -1 ); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertYErrorbar")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteYErrorbar")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertMeanValue")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteMeanValue")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendline")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:DeleteTrendline")); - lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:InsertTrendlineEquation")); + lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:View3D")); xPopupMenu->insertSeparator( -1 ); lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Cut")); lcl_insertMenuCommand( xPopupMenu, xMenuEx, nUniqueId++, C2U(".uno:Copy")); diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index bde946fac5b6..d7e0514dee08 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -120,7 +120,7 @@ struct ControllerState // -- State variables ------- bool bHasSelectedObject; - bool bIsDraggableObject; + bool bIsPositionableObject; bool bIsTextObject; bool bIsDeleteableObjectSelected; bool bIsFormateableObjectSelected; @@ -133,18 +133,26 @@ struct ControllerState // trendlines bool bMayAddTrendline; bool bMayAddTrendlineEquation; + bool bMayAddR2Value; bool bMayAddMeanValue; bool bMayAddYErrorBars; bool bMayDeleteTrendline; + bool bMayDeleteTrendlineEquation; + bool bMayDeleteR2Value; bool bMayDeleteMeanValue; bool bMayDeleteYErrorBars; + + bool bMayFormatTrendline; + bool bMayFormatTrendlineEquation; + bool bMayFormatMeanValue; + bool bMayFormatYErrorBars; }; ControllerState::ControllerState() : bHasSelectedObject( false ), - bIsDraggableObject( false ), + bIsPositionableObject( false ), bIsTextObject(false), bIsDeleteableObjectSelected(false), bIsFormateableObjectSelected(false), @@ -152,11 +160,18 @@ ControllerState::ControllerState() : bMayMoveSeriesBackward( false ), bMayAddTrendline( false ), bMayAddTrendlineEquation( false ), + bMayAddR2Value( false ), bMayAddMeanValue( false ), bMayAddYErrorBars( false ), bMayDeleteTrendline( false ), + bMayDeleteTrendlineEquation( false ), + bMayDeleteR2Value( false ), bMayDeleteMeanValue( false ), - bMayDeleteYErrorBars( false ) + bMayDeleteYErrorBars( false ), + bMayFormatTrendline( false ), + bMayFormatTrendlineEquation( false ), + bMayFormatMeanValue( false ), + bMayFormatYErrorBars( false ) {} void ControllerState::update( @@ -175,9 +190,9 @@ void ControllerState::update( bHasSelectedObject = ((aSelObj >>= aSelObjCID) && aSelObjCID.getLength() > 0); - bIsDraggableObject = ObjectIdentifier::isDragableObject( aSelObjCID ); - ObjectType aObjectType(ObjectIdentifier::getObjectType( aSelObjCID )); + + bIsPositionableObject = (OBJECTTYPE_DATA_POINT != aObjectType) && ObjectIdentifier::isDragableObject( aSelObjCID ); bIsTextObject = OBJECTTYPE_TITLE == aObjectType; uno::Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel )); @@ -191,23 +206,30 @@ void ControllerState::update( bIsDeleteableObjectSelected = ChartController::isObjectDeleteable( aSelObj ); - bMayMoveSeriesForward = DiagramHelper::isSeriesMoveable( + bMayMoveSeriesForward = (OBJECTTYPE_DATA_POINT!=aObjectType) && DiagramHelper::isSeriesMoveable( ChartModelHelper::findDiagram( xModel ), xGivenDataSeries, MOVE_SERIES_FORWARD ); - bMayMoveSeriesBackward = DiagramHelper::isSeriesMoveable( + bMayMoveSeriesBackward = (OBJECTTYPE_DATA_POINT!=aObjectType) && DiagramHelper::isSeriesMoveable( ChartModelHelper::findDiagram( xModel ), xGivenDataSeries, MOVE_SERIES_BACKWARD ); bMayAddTrendline = false; bMayAddTrendlineEquation = false; + bMayAddR2Value = false; bMayAddMeanValue = false; bMayAddYErrorBars = false; bMayDeleteTrendline = false; + bMayDeleteTrendlineEquation = false; + bMayDeleteR2Value = false; bMayDeleteMeanValue = false; bMayDeleteYErrorBars = false; + bMayFormatTrendline = false; + bMayFormatTrendlineEquation = false; + bMayFormatMeanValue = false; + bMayFormatYErrorBars = false; if( bHasSelectedObject ) { if( xGivenDataSeries.is()) @@ -217,46 +239,63 @@ void ControllerState::update( DataSeriesHelper::getChartTypeOfSeries( xGivenDataSeries, xDiagram )); // trend lines/mean value line - if( ChartTypeHelper::isSupportingRegressionProperties( - xFirstChartType, nDimensionCount )) + if( (OBJECTTYPE_DATA_SERIES == aObjectType || OBJECTTYPE_DATA_POINT == aObjectType) + && ChartTypeHelper::isSupportingRegressionProperties( xFirstChartType, nDimensionCount )) { uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( xGivenDataSeries, uno::UNO_QUERY ); if( xRegCurveCnt.is()) { - bMayDeleteTrendline = RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ).is(); - bMayDeleteMeanValue = RegressionCurveHelper::hasMeanValueLine( xRegCurveCnt ); + uno::Reference< chart2::XRegressionCurve > xRegCurve( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCurveCnt ) ); + bMayFormatTrendline = bMayDeleteTrendline = xRegCurve.is(); + bMayFormatMeanValue = bMayDeleteMeanValue = RegressionCurveHelper::hasMeanValueLine( xRegCurveCnt ); bMayAddTrendline = ! bMayDeleteTrendline; bMayAddMeanValue = ! bMayDeleteMeanValue; + bMayFormatTrendlineEquation = bMayDeleteTrendlineEquation = RegressionCurveHelper::hasEquation( xRegCurve ); + bMayAddTrendlineEquation = !bMayDeleteTrendlineEquation; } } // error bars - if( ChartTypeHelper::isSupportingStatisticProperties( - xFirstChartType, nDimensionCount )) + if( (OBJECTTYPE_DATA_SERIES == aObjectType || OBJECTTYPE_DATA_POINT == aObjectType) + && ChartTypeHelper::isSupportingStatisticProperties( xFirstChartType, nDimensionCount )) { - bMayDeleteYErrorBars = StatisticsHelper::hasErrorBars( xGivenDataSeries ); + bMayFormatYErrorBars = bMayDeleteYErrorBars = StatisticsHelper::hasErrorBars( xGivenDataSeries ); bMayAddYErrorBars = ! bMayDeleteYErrorBars; } } + if( aObjectType == OBJECTTYPE_DATA_AVERAGE_LINE ) + bMayFormatMeanValue = true; + + if( aObjectType == OBJECTTYPE_DATA_ERRORS_Y || aObjectType == OBJECTTYPE_DATA_ERRORS ) + bMayFormatYErrorBars = true; + if( aObjectType == OBJECTTYPE_DATA_CURVE ) { + bMayFormatTrendline = true; uno::Reference< chart2::XRegressionCurve > xRegCurve( ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel ), uno::UNO_QUERY ); - if( xRegCurve.is()) + bMayFormatTrendlineEquation = bMayDeleteTrendlineEquation = RegressionCurveHelper::hasEquation( xRegCurve ); + bMayAddTrendlineEquation = !bMayDeleteTrendlineEquation; + } + else if( aObjectType == OBJECTTYPE_DATA_CURVE_EQUATION ) + { + bMayFormatTrendlineEquation = true; + bool bHasR2Value = false; + try { - uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties()); - bool bShowEq = false; - bool bShowCorr = false; + uno::Reference< beans::XPropertySet > xEqProp( + ObjectIdentifier::getObjectPropertySet( aSelObjCID, xModel ), uno::UNO_QUERY ); if( xEqProp.is()) - { - xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq; - xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCorr; - - bMayAddTrendlineEquation = ! (bShowEq || bShowCorr); - } + xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient") ) >>= bHasR2Value; } + catch( uno::RuntimeException& e) + { + ASSERT_EXCEPTION( e ); + } + bMayAddR2Value = !bHasR2Value; + bMayDeleteR2Value = bHasR2Value; } } } @@ -504,32 +543,52 @@ void ControllerCommandDispatch::updateCommandAvailability() m_aCommandAvailability[ C2U(".uno:DefaultColors")] = bIsWritable; m_aCommandAvailability[ C2U(".uno:BarWidth")] = bIsWritable; m_aCommandAvailability[ C2U(".uno:NumberOfLines")] = bIsWritable; - m_aCommandAvailability[ C2U(".uno:ArrangeRow")] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:ArrangeRow")] = m_apControllerState->bMayMoveSeriesForward || m_apControllerState->bMayMoveSeriesBackward; // insert objects - m_aCommandAvailability[ C2U(".uno:InsertTitle")] = bIsWritable; - m_aCommandAvailability[ C2U(".uno:InsertLegend")] = bIsWritable; - m_aCommandAvailability[ C2U(".uno:InsertDescription")] = bIsWritable; - m_aCommandAvailability[ C2U(".uno:InsertAxis")] = bIsWritable && m_apModelState->bSupportsAxes; - m_aCommandAvailability[ C2U(".uno:InsertGrids")] = bIsWritable && m_apModelState->bSupportsAxes; -// m_aCommandAvailability[ C2U(".uno:InsertStatistics")] = bIsWritable && m_apModelState->bSupportsStatistics; - m_aCommandAvailability[ C2U(".uno:InsertTrendlines")] = bIsWritable && m_apModelState->bSupportsStatistics; - m_aCommandAvailability[ C2U(".uno:InsertMeanValues")] = bIsWritable && m_apModelState->bSupportsStatistics; - m_aCommandAvailability[ C2U(".uno:InsertYErrorbars")] = bIsWritable && m_apModelState->bSupportsStatistics; + m_aCommandAvailability[ C2U(".uno:InsertTitles")] = m_aCommandAvailability[ C2U(".uno:InsertMenuTitles")] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:InsertLegend")] = m_aCommandAvailability[ C2U(".uno:InsertMenuLegend")] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:DeleteLegend")] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:InsertMenuDataLabels")] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:InsertRemoveAxes")] = m_aCommandAvailability[ C2U(".uno:InsertMenuAxes")] = bIsWritable && m_apModelState->bSupportsAxes; + m_aCommandAvailability[ C2U(".uno:InsertMenuGrids")] = bIsWritable && m_apModelState->bSupportsAxes; + m_aCommandAvailability[ C2U(".uno:InsertMenuTrendlines")] = bIsWritable && m_apModelState->bSupportsStatistics; + m_aCommandAvailability[ C2U(".uno:InsertMenuMeanValues")] = bIsWritable && m_apModelState->bSupportsStatistics; + m_aCommandAvailability[ C2U(".uno:InsertMenuYErrorBars")] = bIsWritable && m_apModelState->bSupportsStatistics; m_aCommandAvailability[ C2U(".uno:InsertSymbol")] = bIsWritable && m_apControllerState->bIsTextObject; // format objects - m_aCommandAvailability[ C2U(".uno:DiagramObjects")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsFormateableObjectSelected; + bool bFormatObjectAvailable = bIsWritable && bControllerStateIsValid && m_apControllerState->bIsFormateableObjectSelected; + m_aCommandAvailability[ C2U(".uno:FormatSelection")] = bFormatObjectAvailable; + m_aCommandAvailability[ C2U(".uno:FormatAxis")] = bFormatObjectAvailable; + m_aCommandAvailability[ C2U(".uno:FormatTitle")] = bFormatObjectAvailable; + m_aCommandAvailability[ C2U(".uno:FormatDataSeries")] = bFormatObjectAvailable; + m_aCommandAvailability[ C2U(".uno:FormatDataPoint")] = bFormatObjectAvailable; + m_aCommandAvailability[ C2U(".uno:FormatDataLabels")] = bFormatObjectAvailable; + m_aCommandAvailability[ C2U(".uno:FormatDataLabel")] = bFormatObjectAvailable; + m_aCommandAvailability[ C2U(".uno:FormatYErrorBars")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatYErrorBars; + m_aCommandAvailability[ C2U(".uno:FormatMeanValue")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatMeanValue; + m_aCommandAvailability[ C2U(".uno:FormatTrendline")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayFormatTrendline; + m_aCommandAvailability[ C2U(".uno:FormatTrendlineEquation")] = bFormatObjectAvailable && bControllerStateIsValid && m_apControllerState->bMayFormatTrendlineEquation; + m_aCommandAvailability[ C2U(".uno:FormatStockLoss")] = bFormatObjectAvailable; + m_aCommandAvailability[ C2U(".uno:FormatStockGain")] = bFormatObjectAvailable; + m_aCommandAvailability[ C2U(".uno:DiagramType")] = bIsWritable; m_aCommandAvailability[ C2U(".uno:Legend")] = bIsWritable && m_apModelState->bHasLegend; m_aCommandAvailability[ C2U(".uno:DiagramWall")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasWall; m_aCommandAvailability[ C2U(".uno:DiagramArea")] = bIsWritable; - m_aCommandAvailability[ C2U(".uno:TransformDialog")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bHasSelectedObject && m_apControllerState->bIsDraggableObject; + m_aCommandAvailability[ C2U(".uno:TransformDialog")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bHasSelectedObject && m_apControllerState->bIsPositionableObject; // 3d commands m_aCommandAvailability[ C2U(".uno:View3D")] = bIsWritable && bModelStateIsValid && m_apModelState->bIsThreeD; m_aCommandAvailability[ C2U(".uno:DiagramFloor")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasFloor; + //some mor format commands with different ui text + m_aCommandAvailability[ C2U(".uno:FormatWall")] = m_aCommandAvailability[ C2U(".uno:DiagramWall")]; + m_aCommandAvailability[ C2U(".uno:FormatFloor")] = m_aCommandAvailability[ C2U(".uno:DiagramFloor")]; + m_aCommandAvailability[ C2U(".uno:FormatChartArea")] = m_aCommandAvailability[ C2U(".uno:DiagramArea")]; + m_aCommandAvailability[ C2U(".uno:FormatLegend")] = m_aCommandAvailability[ C2U(".uno:Legend")]; + // depending on own data m_aCommandAvailability[ C2U(".uno:DataRanges")] = bIsWritable && bModelStateIsValid && (! m_apModelState->bHasOwnData); m_aCommandAvailability[ C2U(".uno:DiagramData")] = bIsWritable && bModelStateIsValid && m_apModelState->bHasOwnData; @@ -570,14 +629,36 @@ void ControllerCommandDispatch::updateCommandAvailability() m_aCommandAvailability[ C2U(".uno:Forward")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesForward; m_aCommandAvailability[ C2U(".uno:Backward")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesBackward; + m_aCommandAvailability[ C2U(".uno:InsertDataLabels")] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:InsertDataLabel")] = bIsWritable; m_aCommandAvailability[ C2U(".uno:InsertMeanValue")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddMeanValue; m_aCommandAvailability[ C2U(".uno:InsertTrendline")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddTrendline; m_aCommandAvailability[ C2U(".uno:InsertTrendlineEquation")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddTrendlineEquation; - m_aCommandAvailability[ C2U(".uno:InsertYErrorbar")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddYErrorBars; - - m_aCommandAvailability[ C2U(".uno:DeleteTrendline")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteTrendline; - m_aCommandAvailability[ C2U(".uno:DeleteMeanValue")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteMeanValue; - m_aCommandAvailability[ C2U(".uno:DeleteYErrorbar")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteYErrorBars; + m_aCommandAvailability[ C2U(".uno:InsertTrendlineEquationAndR2")] = m_aCommandAvailability[ C2U(".uno:InsertTrendlineEquation")]; + m_aCommandAvailability[ C2U(".uno:InsertR2Value")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddR2Value; + m_aCommandAvailability[ C2U(".uno:DeleteR2Value")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteR2Value; + + m_aCommandAvailability[ C2U(".uno:InsertYErrorBars")] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayAddYErrorBars; + + m_aCommandAvailability[ C2U(".uno:DeleteDataLabels")] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:DeleteDataLabel") ] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:DeleteTrendline") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteTrendline; + m_aCommandAvailability[ C2U(".uno:DeleteTrendlineEquation") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteTrendlineEquation; + m_aCommandAvailability[ C2U(".uno:DeleteMeanValue") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteMeanValue; + m_aCommandAvailability[ C2U(".uno:DeleteYErrorBars") ] = bIsWritable && bControllerStateIsValid && m_apControllerState->bMayDeleteYErrorBars; + + m_aCommandAvailability[ C2U(".uno:ResetDataPoint") ] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:ResetAllDataPoints") ] = bIsWritable; + + m_aCommandAvailability[ C2U(".uno:InsertAxis") ] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:DeleteAxis") ] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:InsertAxisTitle") ] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:FormatMajorGrid") ] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:InsertMajorGrid") ] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:DeleteMajorGrid") ] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:FormatMinorGrid") ] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:InsertMinorGrid") ] = bIsWritable; + m_aCommandAvailability[ C2U(".uno:DeleteMinorGrid") ] = bIsWritable; } bool ControllerCommandDispatch::commandAvailable( const OUString & rCommand ) @@ -593,11 +674,19 @@ void ControllerCommandDispatch::fireStatusEvent( const OUString & rURL, const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ ) { + bool bIsChartSelectorURL = rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:ChartElementSelector") ); + if( rURL.getLength() == 0 || bIsChartSelectorURL ) + { + uno::Any aArg; + aArg <<= m_xController; + fireStatusEventForURL( C2U(".uno:ChartElementSelector"), aArg, true, xSingleListener ); + } + if( rURL.getLength() == 0 ) for( ::std::map< OUString, bool >::const_iterator aIt( m_aCommandAvailability.begin()); aIt != m_aCommandAvailability.end(); ++aIt ) fireStatusEventForURLImpl( aIt->first, xSingleListener ); - else + else if( !bIsChartSelectorURL ) fireStatusEventForURLImpl( rURL, xSingleListener ); // statusbar. Should be handled by base implementation diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx new file mode 100644 index 000000000000..a79a256e3e4f --- /dev/null +++ b/chart2/source/controller/main/ElementSelector.cxx @@ -0,0 +1,328 @@ +/************************************************************************* + * + * 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: ElementSelector.cxx,v $ + * $Revision: 1.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_chart2.hxx" + +#include "ElementSelector.hxx" +#include "macros.hxx" +#include "ObjectNameProvider.hxx" +#include "ObjectHierarchy.hxx" +#include "servicenames.hxx" +#include + +#include +#include +#include + +#include +#include +#include +#include + +namespace chart +{ + +using namespace com::sun::star; +using namespace com::sun::star::uno; +using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; + +namespace +{ +static const ::rtl::OUString lcl_aServiceName( + RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ElementSelectorToolbarController" )); +} + +//------------------------------------------------------------------------------ + +SelectorListBox::SelectorListBox( Window* pParent, WinBits nStyle ) + : ListBox( pParent, nStyle ) + , m_bReleaseFocus( true ) +{ +} + +SelectorListBox::~SelectorListBox() +{ +} + +void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectHierarchy::tCID & rParent, std::vector< ListBoxEntryData >& rEntries + , const sal_Int32 nHierarchyDepth, const Reference< chart2::XChartDocument >& xChartDoc ) +{ + ObjectHierarchy::tChildContainer aChildren( rHierarchy.getChildren(rParent) ); + ObjectHierarchy::tChildContainer::const_iterator aIt( aChildren.begin()); + while( aIt != aChildren.end() ) + { + ::rtl::OUString aCID = *aIt; + ListBoxEntryData aEntry; + aEntry.CID = aCID; + aEntry.UIName += ObjectNameProvider::getNameForCID( aCID, xChartDoc ); + aEntry.nHierarchyDepth = nHierarchyDepth; + rEntries.push_back(aEntry); + lcl_addObjectsToList( rHierarchy, aCID, rEntries, nHierarchyDepth+1, xChartDoc ); + ++aIt; + } +} + +void SelectorListBox::SetChartController( const Reference< frame::XController >& xChartController ) +{ + m_xChartController = xChartController; +} + +void SelectorListBox::UpdateChartElementsListAndSelection() +{ + Clear(); + m_aEntries.clear(); + + Reference< frame::XController > xChartController( m_xChartController ); + if( xChartController.is() ) + { + Reference< view::XSelectionSupplier > xSelectionSupplier( xChartController, uno::UNO_QUERY); + rtl::OUString aSelectedCID; + if( xSelectionSupplier.is() ) + xSelectionSupplier->getSelection() >>= aSelectedCID; + + Reference< chart2::XChartDocument > xChartDoc( xChartController->getModel(), uno::UNO_QUERY ); + ObjectType eType( ObjectIdentifier::getObjectType( aSelectedCID )); + bool bAddSelectionToList = false; + if( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL ) + bAddSelectionToList = true; + + Reference< uno::XInterface > xChartView; + Reference< lang::XMultiServiceFactory > xFact( xChartController->getModel(), uno::UNO_QUERY ); + if( xFact.is() ) + xChartView = xFact->createInstance( CHART_VIEW_SERVICE_NAME ); + ExplicitValueProvider* pExplicitValueProvider = 0;//ExplicitValueProvider::getExplicitValueProvider(xChartView); dies erzeugt alle sichtbaren datenpinkte, das ist zu viel + ObjectHierarchy aHierarchy( xChartDoc, pExplicitValueProvider, true /*bFlattenDiagram*/, true /*bOrderingForElementSelector*/ ); + lcl_addObjectsToList( aHierarchy, aHierarchy.getRootNodeCID(), m_aEntries, 0, xChartDoc ); + + std::vector< ListBoxEntryData >::iterator aIt( m_aEntries.begin() ); + if( bAddSelectionToList ) + { + rtl::OUString aSeriesCID = ObjectIdentifier::createClassifiedIdentifierForParticle( ObjectIdentifier::getSeriesParticleFromCID( aSelectedCID ) ); + for( aIt = m_aEntries.begin(); aIt != m_aEntries.end(); ++aIt ) + { + if( aIt->CID.match( aSeriesCID ) ) + { + ListBoxEntryData aEntry; + aEntry.UIName = ObjectNameProvider::getNameForCID( aSelectedCID, xChartDoc ); + aEntry.CID = aSelectedCID; + ++aIt; + if( aIt != m_aEntries.end() ) + m_aEntries.insert(aIt, aEntry); + else + m_aEntries.push_back( aEntry ); + break; + } + } + } + + USHORT nEntryPosToSelect = 0; bool bSelectionFound = false; + aIt = m_aEntries.begin(); + for( USHORT nN=0; aIt != m_aEntries.end(); ++aIt, ++nN ) + { + InsertEntry( aIt->UIName ); + if( !bSelectionFound && aSelectedCID.equals( aIt->CID ) ) + { + nEntryPosToSelect = nN; + bSelectionFound = true; + } + } + + if( bSelectionFound ) + SelectEntryPos(nEntryPosToSelect); + + USHORT nEntryCount = GetEntryCount(); + if( nEntryCount > 100 ) + nEntryCount = 100; + SetDropDownLineCount( nEntryCount ); + } + SaveValue();//remind current selection pos +} + +void SelectorListBox::ReleaseFocus_Impl() +{ + if ( !m_bReleaseFocus ) + { + m_bReleaseFocus = true; + return; + } + + Reference< frame::XController > xController( m_xChartController ); + Reference< frame::XFrame > xFrame( xController->getFrame() ); + if ( xFrame.is() && xFrame->getContainerWindow().is() ) + xFrame->getContainerWindow()->setFocus(); +} + +void SelectorListBox::Select() +{ + ListBox::Select(); + + if ( !IsTravelSelect() ) + { + USHORT nPos = GetSelectEntryPos(); + if( nPos < m_aEntries.size() ) + { + rtl::OUString aCID = m_aEntries[nPos].CID; + uno::Any aASelection( uno::makeAny(aCID) ); + Reference< view::XSelectionSupplier > xSelectionSupplier( m_xChartController.get(), uno::UNO_QUERY ); + if( xSelectionSupplier.is() ) + xSelectionSupplier->select(aASelection); + } + ReleaseFocus_Impl(); + } +} + +long SelectorListBox::Notify( NotifyEvent& rNEvt ) +{ + long nHandled = 0; + + if ( rNEvt.GetType() == EVENT_KEYINPUT ) + { + USHORT nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); + + switch ( nCode ) + { + case KEY_RETURN: + case KEY_TAB: + { + if ( KEY_TAB == nCode ) + m_bReleaseFocus = false; + else + nHandled = 1; + Select(); + break; + } + + case KEY_ESCAPE: + SelectEntryPos( GetSavedValue() ); //restore saved selection + ReleaseFocus_Impl(); + break; + } + } + else if ( EVENT_LOSEFOCUS == rNEvt.GetType() ) + { + if ( !HasFocus() ) + SelectEntryPos( GetSavedValue() ); + } + + return nHandled ? nHandled : ListBox::Notify( rNEvt ); +} + +Reference< ::com::sun::star::accessibility::XAccessible > SelectorListBox::CreateAccessible() +{ + UpdateChartElementsListAndSelection(); + return ListBox::CreateAccessible(); +} + +// implement XServiceInfo methods basing upon getSupportedServiceNames_Static +APPHELPER_XSERVICEINFO_IMPL( ElementSelectorToolbarController, lcl_aServiceName ); + +//------------------------------------------------------------------------------ +Sequence< ::rtl::OUString > ElementSelectorToolbarController::getSupportedServiceNames_Static() +{ + Sequence< ::rtl::OUString > aServices(1); + aServices[ 0 ] = C2U( "com.sun.star.frame.ToolbarController" ); + return aServices; +} +// ----------------------------------------------------------------------------- +ElementSelectorToolbarController::ElementSelectorToolbarController( const uno::Reference< uno::XComponentContext > & xContext ) + : m_xCC( xContext ) +{ +} +// ----------------------------------------------------------------------------- +ElementSelectorToolbarController::~ElementSelectorToolbarController() +{ +} +// ----------------------------------------------------------------------------- +// XInterface +Any SAL_CALL ElementSelectorToolbarController::queryInterface( const Type& _rType ) throw (RuntimeException) +{ + Any aReturn = ToolboxController::queryInterface(_rType); + if (!aReturn.hasValue()) + aReturn = ElementSelectorToolbarController_BASE::queryInterface(_rType); + return aReturn; +} +// ----------------------------------------------------------------------------- +void SAL_CALL ElementSelectorToolbarController::acquire() throw () +{ + ToolboxController::acquire(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL ElementSelectorToolbarController::release() throw () +{ + ToolboxController::release(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL ElementSelectorToolbarController::initialize( const Sequence< Any >& rArguments ) throw (Exception, RuntimeException) +{ + ToolboxController::initialize(rArguments); +} +// ----------------------------------------------------------------------------- +void SAL_CALL ElementSelectorToolbarController::statusChanged( const frame::FeatureStateEvent& rEvent ) throw ( RuntimeException ) +{ + if( m_apSelectorListBox.get() ) + { + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + if( rEvent.FeatureURL.Path.equalsAscii( "ChartElementSelector" ) ) + { + Reference< frame::XController > xChartController; + rEvent.State >>= xChartController; + m_apSelectorListBox->SetChartController( xChartController ); + m_apSelectorListBox->UpdateChartElementsListAndSelection(); + } + } +} +// ----------------------------------------------------------------------------- +uno::Reference< awt::XWindow > SAL_CALL ElementSelectorToolbarController::createItemWindow( const uno::Reference< awt::XWindow >& xParent ) + throw (uno::RuntimeException) +{ + uno::Reference< awt::XWindow > xItemWindow; + if( !m_apSelectorListBox.get() ) + { + Window* pParent = VCLUnoHelper::GetWindow( xParent ); + if( pParent ) + { + m_apSelectorListBox = ::std::auto_ptr< SelectorListBox >( new SelectorListBox( pParent, WB_DROPDOWN|WB_AUTOHSCROLL|WB_BORDER ) ); + ::Size aLogicalSize( 95, 160 ); + ::Size aPixelSize = m_apSelectorListBox->LogicToPixel( aLogicalSize, MAP_APPFONT ); + m_apSelectorListBox->SetSizePixel( aPixelSize ); + m_apSelectorListBox->SetDropDownLineCount( 5 ); + } + } + if( m_apSelectorListBox.get() ) + xItemWindow = VCLUnoHelper::GetInterface( m_apSelectorListBox.get() ); + return xItemWindow; +} + +//.......................................................................... +} // chart2 +//.......................................................................... diff --git a/chart2/source/controller/main/ElementSelector.hxx b/chart2/source/controller/main/ElementSelector.hxx new file mode 100644 index 000000000000..3992745c9f02 --- /dev/null +++ b/chart2/source/controller/main/ElementSelector.hxx @@ -0,0 +1,125 @@ +/************************************************************************* + * + * 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: ElementSelector.hxx,v $ + * $Revision: 1.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CHART_ELEMENTSELECTOR_HXX +#define _CHART_ELEMENTSELECTOR_HXX + +#include "ServiceMacros.hxx" +#include +#include +#include + +#include +#include + +#include + +//............................................................................. +namespace chart +{ +//............................................................................. + +struct ListBoxEntryData +{ + rtl::OUString UIName; + rtl::OUString CID; + sal_Int32 nHierarchyDepth; + + ListBoxEntryData() : nHierarchyDepth(0) + { + } +}; + +class SelectorListBox : public ListBox +{ + public: + SelectorListBox( Window* pParent, WinBits nStyle ); + virtual ~SelectorListBox(); + + virtual void Select(); + virtual long Notify( NotifyEvent& rNEvt ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); + + void ReleaseFocus_Impl(); + + void SetChartController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xChartController ); + void UpdateChartElementsListAndSelection(); + + private: + ::com::sun::star::uno::WeakReference< + ::com::sun::star::frame::XController > m_xChartController; + + ::std::vector< ListBoxEntryData > m_aEntries; + + bool m_bReleaseFocus; +}; + +// ------------------------------------------------------------------ +// ------------------------------------------------------------------ + +typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XServiceInfo> ElementSelectorToolbarController_BASE; + +class ElementSelectorToolbarController : public ::svt::ToolboxController + , ElementSelectorToolbarController_BASE +{ +public: + ElementSelectorToolbarController( ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > const & xContext ); + virtual ~ElementSelectorToolbarController(); + + // XServiceInfo + APPHELPER_XSERVICEINFO_DECL() + APPHELPER_SERVICE_FACTORY_HELPER(ElementSelectorToolbarController) + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + // XToolbarController + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + +private: + //no default constructor + ElementSelectorToolbarController(){} + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xCC; + ::std::auto_ptr< SelectorListBox > m_apSelectorListBox; +}; + +//............................................................................. +} //namespace chart +//............................................................................. + +#endif diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index 67297197cacc..5912847e4bfe 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -41,6 +41,8 @@ #include "macros.hxx" #include "LineProperties.hxx" #include "ChartTypeHelper.hxx" +#include "DataSeriesHelper.hxx" +#include "LegendHelper.hxx" #include #include @@ -109,6 +111,18 @@ void lcl_getChildCIDs( } } +void lcl_addAxisTitle( const Reference< XAxis >& xAxis, ::chart::ObjectHierarchy::tChildContainer& rContainer, const Reference< frame::XModel >& xChartModel ) +{ + Reference< XTitled > xAxisTitled( xAxis, uno::UNO_QUERY ); + if( xAxisTitled.is()) + { + Reference< XTitle > xAxisTitle( xAxisTitled->getTitleObject()); + if( xAxisTitle.is()) + rContainer.push_back( + ::chart::ObjectIdentifier::createClassifiedIdentifierForObject( xAxisTitle, xChartModel )); + } +} + } // anonymous namespace @@ -123,7 +137,7 @@ public: explicit ImplObjectHierarchy( const Reference< XChartDocument > & xChartDocument, ExplicitValueProvider * pExplicitValueProvider, - bool bFlattenDiagram ); + bool bFlattenDiagram, bool bOrderingForElementSelector ); bool hasChildren( const OUString & rParent ); ObjectHierarchy::tChildContainer getChildren( const OUString & rParent ); @@ -133,13 +147,25 @@ public: private: void createTree( const Reference< XChartDocument > & xChartDocument ); + void createAxesTree( + ObjectHierarchy::tChildContainer & rContainer, + const Reference< XChartDocument > & xChartDoc, + const Reference< XDiagram > & xDiagram ); void createDiagramTree( ObjectHierarchy::tChildContainer & rContainer, const Reference< XChartDocument > & xChartDoc, const Reference< XDiagram > & xDiagram ); void createDataSeriesTree( ObjectHierarchy::tChildContainer & rOutDiagramSubContainer, - const Reference< XCoordinateSystemContainer > & xCooSysCnt ); + const Reference< XDiagram > & xDiagram ); + void createWallAndFloor( + ObjectHierarchy::tChildContainer & rContainer, + const Reference< XDiagram > & xDiagram ); + void createLegendTree( + ObjectHierarchy::tChildContainer & rContainer, + const Reference< XChartDocument > & xChartDoc, + const Reference< XDiagram > & xDiagram ); + ObjectHierarchy::tCID getParentImpl( const ObjectHierarchy::tCID & rParentCID, const ObjectHierarchy::tCID & rCID ); @@ -149,14 +175,17 @@ private: tChildMap m_aChildMap; ExplicitValueProvider * m_pExplicitValueProvider; bool m_bFlattenDiagram; + bool m_bOrderingForElementSelector; }; ImplObjectHierarchy::ImplObjectHierarchy( const Reference< XChartDocument > & xChartDocument, ExplicitValueProvider * pExplicitValueProvider, - bool bFlattenDiagram ) : + bool bFlattenDiagram, + bool bOrderingForElementSelector ) : m_pExplicitValueProvider( pExplicitValueProvider ), - m_bFlattenDiagram( bFlattenDiagram ) + m_bFlattenDiagram( bFlattenDiagram ), + m_bOrderingForElementSelector( bOrderingForElementSelector ) { createTree( xChartDocument ); // don't remember this helper to avoid access after lifetime @@ -170,10 +199,21 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument > & xChart //@todo: change ObjectIdentifier to take an XChartDocument rather than XModel Reference< frame::XModel > xModel( xChartDocument, uno::UNO_QUERY ); + Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDocument ) ); + OUString aDiaCID( ObjectIdentifier::createClassifiedIdentifierForObject( xDiagram, xModel )); ObjectHierarchy::tChildContainer aTopLevelContainer; // First Level + // Chart Area + if( m_bOrderingForElementSelector ) + { + aTopLevelContainer.push_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) ); + aTopLevelContainer.push_back( aDiaCID ); + createWallAndFloor( aTopLevelContainer, xDiagram ); + createLegendTree( aTopLevelContainer, xChartDocument, xDiagram ); + } + // Main Title Reference< XTitled > xDocTitled( xChartDocument, uno::UNO_QUERY ); if( xDocTitled.is()) @@ -184,7 +224,6 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument > & xChart ObjectIdentifier::createClassifiedIdentifierForObject( xMainTitle, xModel )); } - Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartDocument )); if( xDiagram.is()) { // Sub Title. Note: This is interpreted of being top level @@ -197,24 +236,17 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument > & xChart ObjectIdentifier::createClassifiedIdentifierForObject( xSubTitle, xModel )); } - // Axis Titles. Note: These are interpreted of being top level - Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); - for( sal_Int32 i=0; i xAxisTitled( aAxes[i], uno::UNO_QUERY ); - if( xAxisTitled.is()) - { - Reference< XTitle > xAxisTitle( xAxisTitled->getTitleObject()); - if( xAxisTitle.is()) - aTopLevelContainer.push_back( - ObjectIdentifier::createClassifiedIdentifierForObject( xAxisTitle, xModel )); - } + // Axis Titles. Note: These are interpreted of being top level + Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); + for( sal_Int32 i=0; i & xChart m_aChildMap[ aDiaCID ] = aSubContainer; } - - // Legend. Note: This is interpreted of being top level - Reference< XLegend > xLegend( xDiagram->getLegend()); - if( xLegend.is()) - { - Reference< beans::XPropertySet > xLegendProp( xLegend, uno::UNO_QUERY ); - bool bShow = false; - if( xLegendProp.is() && - (xLegendProp->getPropertyValue( C2U("Show")) >>= bShow) && - bShow ) - { - OUString aLegendCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, xModel )); - aTopLevelContainer.push_back( aLegendCID ); - - // iterate over child shapes of legend and search for matching CIDs - if( m_pExplicitValueProvider ) - { - Reference< container::XIndexAccess > xLegendShapeContainer( - m_pExplicitValueProvider->getShapeForCID( aLegendCID ), uno::UNO_QUERY ); - ObjectHierarchy::tChildContainer aLegendEntryCIDs; - lcl_getChildCIDs( aLegendEntryCIDs, xLegendShapeContainer ); - - m_aChildMap[ aLegendCID ] = aLegendEntryCIDs; - } - } - } + if( !m_bOrderingForElementSelector ) + createLegendTree( aTopLevelContainer, xChartDocument, xDiagram ); } // Chart Area - aTopLevelContainer.push_back( - ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) ); + if( !m_bOrderingForElementSelector ) + aTopLevelContainer.push_back( + ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) ); if( ! aTopLevelContainer.empty()) m_aChildMap[ ObjectHierarchy::getRootNodeCID() ] = aTopLevelContainer; } -void ImplObjectHierarchy::createDiagramTree( +void ImplObjectHierarchy::createLegendTree( ObjectHierarchy::tChildContainer & rContainer, const Reference< XChartDocument > & xChartDoc, - const Reference< XDiagram > & xDiagram ) + const Reference< XDiagram > & xDiagram ) { - // Data Series - Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); - createDataSeriesTree( rContainer, xCooSysCnt ); + if( xDiagram.is() && LegendHelper::hasLegend( xDiagram ) ) + { + OUString aLegendCID( ObjectIdentifier::createClassifiedIdentifierForObject( xDiagram->getLegend(), Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ) )); + rContainer.push_back( aLegendCID ); + + // iterate over child shapes of legend and search for matching CIDs + if( m_pExplicitValueProvider ) + { + Reference< container::XIndexAccess > xLegendShapeContainer( + m_pExplicitValueProvider->getShapeForCID( aLegendCID ), uno::UNO_QUERY ); + ObjectHierarchy::tChildContainer aLegendEntryCIDs; + lcl_getChildCIDs( aLegendEntryCIDs, xLegendShapeContainer ); - // Axes + m_aChildMap[ aLegendCID ] = aLegendEntryCIDs; + } + } +} + +void ImplObjectHierarchy::createAxesTree( + ObjectHierarchy::tChildContainer & rContainer, + const Reference< XChartDocument > & xChartDoc, + const Reference< XDiagram > & xDiagram ) +{ + Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); bool bSupportsAxesGrids = ChartTypeHelper::isSupportingMainAxis( xChartType, nDimensionCount, 0 ); - bool bIsThreeD = ( nDimensionCount == 3 ); - bool bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram ); if( bSupportsAxesGrids ) { Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram, /* bOnlyVisible = */ true ) ); - ::std::transform( aAxes.getConstArray(), aAxes.getConstArray() + aAxes.getLength(), + if( !m_bOrderingForElementSelector ) + ::std::transform( aAxes.getConstArray(), aAxes.getConstArray() + aAxes.getLength(), ::std::back_inserter( rContainer ), lcl_ObjectToCID( xChartDoc )); @@ -293,6 +320,24 @@ void ImplObjectHierarchy::createDiagramTree( if(!xAxis.is()) continue; + sal_Int32 nCooSysIndex = 0; + sal_Int32 nDimensionIndex = 0; + sal_Int32 nAxisIndex = 0; + AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ); + if( nAxisIndex>0 && !ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, nDimensionIndex ) ) + continue; + + if( m_bOrderingForElementSelector ) + { + // axis + if( AxisHelper::isAxisVisible( xAxis ) ) + rContainer.push_back( + ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, xChartModel ) ); + + // axis title + lcl_addAxisTitle( aAxes[nA], rContainer, xChartModel ); + } + Reference< beans::XPropertySet > xGridProperties( xAxis->getGridProperties() ); if( AxisHelper::isGridVisible( xGridProperties ) ) { @@ -315,31 +360,56 @@ void ImplObjectHierarchy::createDiagramTree( } } } +} - // Wall - if( bHasWall ) +void ImplObjectHierarchy::createWallAndFloor( + ObjectHierarchy::tChildContainer & rContainer, + const Reference< XDiagram > & xDiagram ) +{ + sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); + bool bIsThreeD = ( nDimensionCount == 3 ); + bool bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram ); + if( bHasWall && bIsThreeD ) { rContainer.push_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString())); - } - // Floor - if( bHasWall && bIsThreeD ) - { Reference< beans::XPropertySet > xFloor( xDiagram->getFloor()); if( xFloor.is()) rContainer.push_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_FLOOR, rtl::OUString())); } + +} + +void ImplObjectHierarchy::createDiagramTree( + ObjectHierarchy::tChildContainer & rContainer, + const Reference< XChartDocument > & xChartDoc, + const Reference< XDiagram > & xDiagram ) +{ + if( !m_bOrderingForElementSelector ) + { + createDataSeriesTree( rContainer, xDiagram ); + createAxesTree( rContainer, xChartDoc, xDiagram ); + createWallAndFloor( rContainer, xDiagram ); + } + else + { + createAxesTree( rContainer, xChartDoc, xDiagram ); + createDataSeriesTree( rContainer, xDiagram ); + } } void ImplObjectHierarchy::createDataSeriesTree( ObjectHierarchy::tChildContainer & rOutDiagramSubContainer, - const Reference< XCoordinateSystemContainer > & xCooSysCnt ) + const Reference< XDiagram > & xDiagram ) { + Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); + try { sal_Int32 nDiagramIndex = 0; + sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); Sequence< Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); for( sal_Int32 nCooSysIdx=0; nCooSysIdx > aChartTypeSeq( xCTCnt->getChartTypes()); for( sal_Int32 nCTIdx=0; nCTIdx xDSCnt( aChartTypeSeq[nCTIdx], uno::UNO_QUERY_THROW ); + Reference< XChartType > xChartType( aChartTypeSeq[nCTIdx] ); + Reference< XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY_THROW ); Sequence< Reference< XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries() ); const sal_Int32 nNumberOfSeries = - ChartTypeHelper::getNumberOfDisplayedSeries( aChartTypeSeq[nCTIdx], aSeriesSeq.getLength()); + ChartTypeHelper::getNumberOfDisplayedSeries( xChartType, aSeriesSeq.getLength()); for( sal_Int32 nSeriesIdx=0; nSeriesIdx xSeries( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ); + + // data lablels + if( DataSeriesHelper::hasDataLabelsAtSeries( xSeries ) ) + { + rtl::OUString aChildParticle( ObjectIdentifier::getStringForType( OBJECTTYPE_DATA_LABELS ) ); + aChildParticle+=(C2U("=")); + aSeriesSubContainer.push_back( + ObjectIdentifier::createClassifiedIdentifierForParticles( aSeriesParticle, aChildParticle )); + } + // Statistics - Reference< chart2::XRegressionCurveContainer > xCurveCnt( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ); - if( xCurveCnt.is()) + if( ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount ) ) { - Sequence< Reference< chart2::XRegressionCurve > > aCurves( xCurveCnt->getRegressionCurves()); - for( sal_Int32 nCurveIdx=0; nCurveIdx xCurveCnt( xSeries, uno::UNO_QUERY ); + if( xCurveCnt.is()) { - bool bIsAverageLine = RegressionCurveHelper::isMeanValueLine( aCurves[nCurveIdx] ); - aSeriesSubContainer.push_back( - ObjectIdentifier::createDataCurveCID( aSeriesParticle, nCurveIdx, bIsAverageLine )); - Reference< beans::XPropertySet > xEqProp( aCurves[nCurveIdx]->getEquationProperties()); - bool bShowEq = false; - bool bShowCoeff = false; - if( xEqProp.is() && - ( (xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq) || - (xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff) ) && - ( bShowEq || bShowCoeff ) ) + Sequence< Reference< chart2::XRegressionCurve > > aCurves( xCurveCnt->getRegressionCurves()); + for( sal_Int32 nCurveIdx=0; nCurveIdx xSeriesProp( aSeriesSeq[nSeriesIdx], uno::UNO_QUERY ); - Reference< beans::XPropertySet > xErrorBarProp; - if( xSeriesProp.is() && - (xSeriesProp->getPropertyValue( C2U("ErrorBarY")) >>= xErrorBarProp) && - xErrorBarProp.is()) - { - sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE; - if( ( xErrorBarProp->getPropertyValue( C2U("ErrorBarStyle")) >>= nStyle ) && - ( nStyle != ::com::sun::star::chart::ErrorBarStyle::NONE ) ) + Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY ); + Reference< beans::XPropertySet > xErrorBarProp; + if( xSeriesProp.is() && + (xSeriesProp->getPropertyValue( C2U("ErrorBarY")) >>= xErrorBarProp) && + xErrorBarProp.is()) { - aSeriesSubContainer.push_back( - ObjectIdentifier::createClassifiedIdentifierWithParent( - OBJECTTYPE_DATA_ERRORS, OUString(), aSeriesParticle )); + sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE; + if( ( xErrorBarProp->getPropertyValue( C2U("ErrorBarStyle")) >>= nStyle ) && + ( nStyle != ::com::sun::star::chart::ErrorBarStyle::NONE ) ) + { + aSeriesSubContainer.push_back( + ObjectIdentifier::createClassifiedIdentifierWithParent( + OBJECTTYPE_DATA_ERRORS, OUString(), aSeriesParticle )); + } } } } @@ -500,8 +579,9 @@ ObjectHierarchy::tCID ImplObjectHierarchy::getParent( ObjectHierarchy::ObjectHierarchy( const Reference< XChartDocument > & xChartDocument, ExplicitValueProvider * pExplicitValueProvider /* = 0 */, - bool bFlattenDiagram /* = false */ ) : - m_apImpl( new impl::ImplObjectHierarchy( xChartDocument, pExplicitValueProvider, bFlattenDiagram )) + bool bFlattenDiagram /* = false */, + bool bOrderingForElementSelector /* = false */) : + m_apImpl( new impl::ImplObjectHierarchy( xChartDocument, pExplicitValueProvider, bFlattenDiagram, bOrderingForElementSelector )) {} ObjectHierarchy::~ObjectHierarchy() diff --git a/chart2/source/controller/main/_serviceregistration_controller.cxx b/chart2/source/controller/main/_serviceregistration_controller.cxx index 7507aa9dd0cf..7de2e8fa8588 100644 --- a/chart2/source/controller/main/_serviceregistration_controller.cxx +++ b/chart2/source/controller/main/_serviceregistration_controller.cxx @@ -36,6 +36,7 @@ #include "dlg_ChartType_UNO.hxx" #include "ChartDocumentWrapper.hxx" #include "AccessibleChartView.hxx" +#include "ElementSelector.hxx" #include static struct ::cppu::ImplementationEntry g_entries_chart2_controller[] = @@ -88,6 +89,14 @@ static struct ::cppu::ImplementationEntry g_entries_chart2_controller[] = , 0 , 0 } + ,{ + ::chart::ElementSelectorToolbarController::create + , ::chart::ElementSelectorToolbarController::getImplementationName_Static + , ::chart::ElementSelectorToolbarController::getSupportedServiceNames_Static + , ::cppu::createSingleComponentFactory + , 0 + , 0 + } ,{ 0, 0, 0, 0, 0, 0 } }; diff --git a/chart2/source/controller/main/makefile.mk b/chart2/source/controller/main/makefile.mk index 6ee09d8c7c72..5d0ecadc0ae0 100644 --- a/chart2/source/controller/main/makefile.mk +++ b/chart2/source/controller/main/makefile.mk @@ -46,6 +46,7 @@ VISIBILITY_HIDDEN=TRUE #object files to build and link together to lib $(SLB)$/$(TARGET).lib SLOFILES = \ $(SLO)$/ConfigurationAccess.obj \ + $(SLO)$/ElementSelector.obj \ $(SLO)$/SelectionHelper.obj \ $(SLO)$/PositionAndSizeHelper.obj \ $(SLO)$/ChartWindow.obj \ diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx index d6d7e14bc7d3..15d5e9cb4ae5 100644 --- a/chart2/source/inc/AxisHelper.hxx +++ b/chart2/source/inc/AxisHelper.hxx @@ -98,14 +98,14 @@ public: static sal_Bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram ); - SAL_DLLPRIVATE static void makeAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); + static void makeAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); static void makeGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties ); - SAL_DLLPRIVATE static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); - SAL_DLLPRIVATE static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties ); + static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); + static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties ); SAL_DLLPRIVATE static sal_Bool areAxisLabelsVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProperties ); - SAL_DLLPRIVATE static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); + static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); static sal_Bool isGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties ); static ::com::sun::star::uno::Reference< diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx index ae179e5c5e83..317c92849fb7 100644 --- a/chart2/source/inc/DataSeriesHelper.hxx +++ b/chart2/source/inc/DataSeriesHelper.hxx @@ -188,6 +188,27 @@ OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xDataSequence, bool bTranslate ); +OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtSeries( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtPoints( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelAtPoint( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex ); + +OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelsToSeriesAndAllPoints( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelToPoint( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xPointPropertySet ); + +OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromSeriesAndAllPoints( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromPoint( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xPointPropertySet ); + } // namespace DataSeriesHelper } // namespace chart diff --git a/chart2/source/inc/LegendHelper.hxx b/chart2/source/inc/LegendHelper.hxx index f6c792ab48f1..f88e2cba0aae 100644 --- a/chart2/source/inc/LegendHelper.hxx +++ b/chart2/source/inc/LegendHelper.hxx @@ -50,6 +50,16 @@ namespace chart class OOO_DLLPUBLIC_CHARTTOOLS LegendHelper { public: + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XLegend > + showLegend( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel + , const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext >& xContext ); + + static void hideLegend( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel ); + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XLegend > getLegend( const ::com::sun::star::uno::Reference< diff --git a/chart2/source/inc/RegressionCurveHelper.hxx b/chart2/source/inc/RegressionCurveHelper.hxx index 3f18fa6c46c8..7dbc9e33bf3d 100644 --- a/chart2/source/inc/RegressionCurveHelper.hxx +++ b/chart2/source/inc/RegressionCurveHelper.hxx @@ -151,6 +151,10 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt ); + static void removeEquations( + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt ); + /** adds the given regression curve if there was none before. If there are regression curves, the first one is replaced by the one given by the type. All remaining curves are remnoved. @@ -225,6 +229,10 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XRegressionCurve > & xCurve ); + static bool hasEquation( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve > & xCurve ); + private: // not implemented RegressionCurveHelper(); diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc index 1092efe6e900..fea8bb867057 100644 --- a/chart2/source/inc/Strings.hrc +++ b/chart2/source/inc/Strings.hrc @@ -33,7 +33,7 @@ // this includes no link dependency #include -//next free is 286 +//next free is 290 //single free is: 134 //#define RID_APP_START 30000 @@ -231,8 +231,11 @@ #define STR_OBJECT_DATASERIES (RID_APP_START + 204) #define STR_OBJECT_DATASERIES_PLURAL (RID_APP_START + 205) +#define STR_OBJECT_FOR_SERIES (RID_APP_START + 288) +#define STR_OBJECT_FOR_ALL_SERIES (RID_APP_START + 289) + #define STR_OBJECT_AVERAGE_LINE (RID_APP_START + 174) -#define STR_OBJECT_ERROR_INDICATOR (RID_APP_START + 175) +#define STR_OBJECT_ERROR_BARS (RID_APP_START + 175) #define STR_OBJECT_CURVE (RID_APP_START + 176) #define STR_OBJECT_CURVES (RID_APP_START + 130) @@ -245,6 +248,9 @@ #define STR_OBJECT_AXIS_Y (RID_APP_START + 212) #define STR_OBJECT_AXIS_Z (RID_APP_START + 213) +#define STR_OBJECT_SECONDARY_X_AXIS (RID_APP_START + 286) +#define STR_OBJECT_SECONDARY_Y_AXIS (RID_APP_START + 287) + #define STR_OBJECT_GRID (RID_APP_START + 214) #define STR_OBJECT_GRIDS (RID_APP_START + 215) @@ -268,7 +274,7 @@ #define STR_PAGE_BORDER (RID_APP_START + 217) #define STR_PAGE_AREA (RID_APP_START + 218) #define STR_PAGE_TRANSPARENCY (RID_APP_START + 219) -#define STR_PAGE_CHARACTERS (RID_APP_START + 220) +#define STR_PAGE_FONT (RID_APP_START + 220) #define STR_PAGE_FONT_EFFECTS (RID_APP_START + 221) #define STR_PAGE_LAYOUT (RID_APP_START + 222) #define STR_PAGE_OPTIONS (RID_APP_START + 223) diff --git a/chart2/source/model/inc/DataSeries.hxx b/chart2/source/model/inc/DataSeries.hxx index 387d69d1f9ab..e483cc96e5b5 100644 --- a/chart2/source/model/inc/DataSeries.hxx +++ b/chart2/source/model/inc/DataSeries.hxx @@ -111,6 +111,10 @@ protected: SAL_CALL getDataPointByIndex( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL resetDataPoint( sal_Int32 nIndex ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL resetAllDataPoints() + throw (::com::sun::star::uno::RuntimeException); // ____ XDataSink ____ // ___________________ diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx index 9f331ce2a215..0d76aab40366 100644 --- a/chart2/source/model/main/DataSeries.cxx +++ b/chart2/source/model/main/DataSeries.cxx @@ -419,6 +419,31 @@ Reference< beans::XPropertySet > // \-- } +void SAL_CALL DataSeries::resetDataPoint( sal_Int32 nIndex ) + throw (uno::RuntimeException) +{ + MutexGuard aGuard( GetMutex() ); + tDataPointAttributeContainer::iterator aIt( m_aAttributedDataPoints.find( nIndex )); + if( aIt != m_aAttributedDataPoints.end()) + { + Reference< beans::XPropertySet > xDataPointProp( (*aIt).second ); + Reference< util::XModifyBroadcaster > xBroadcaster( xDataPointProp, uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xModifyEventForwarder.is()) + xBroadcaster->removeModifyListener( m_xModifyEventForwarder ); + m_aAttributedDataPoints.erase(aIt); + fireModifyEvent(); + } +} + +void SAL_CALL DataSeries::resetAllDataPoints() + throw (uno::RuntimeException) +{ + MutexGuard aGuard( GetMutex() ); + ModifyListenerHelper::removeListenerFromAllMapElements( m_aAttributedDataPoints, m_xModifyEventForwarder ); + m_aAttributedDataPoints.clear(); + fireModifyEvent(); +} + // ____ XDataSink ____ void SAL_CALL DataSeries::setData( const uno::Sequence< Reference< chart2::data::XLabeledDataSequence > >& aData ) throw (uno::RuntimeException) diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index 61fecf18b5e7..7203f9ad6e63 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -36,6 +36,7 @@ #include "macros.hxx" #include "ContainerHelper.hxx" #include +#include #include #include #include @@ -57,6 +58,7 @@ #include using namespace ::com::sun::star; +using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; @@ -155,6 +157,50 @@ void lcl_getCooSysAndChartTypeOfSeries( } } +void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries, bool bInsert ) +{ + try + { + Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY ); + if( xSeriesProperties.is() ) + { + DataPointLabel aLabelAtSeries; + xSeriesProperties->getPropertyValue( C2U( "Label" ) ) >>= aLabelAtSeries; + aLabelAtSeries.ShowNumber = bInsert; + if( !bInsert ) + { + aLabelAtSeries.ShowNumberInPercent = false; + aLabelAtSeries.ShowCategoryName = false; + } + xSeriesProperties->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabelAtSeries ) ); + uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; + if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList ) + { + for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) + { + Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]) ); + if( xPointProp.is() ) + { + DataPointLabel aLabel; + xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel; + aLabel.ShowNumber = bInsert; + if( !bInsert ) + { + aLabel.ShowNumberInPercent = false; + aLabel.ShowCategoryName = false; + } + xPointProp->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ) ); + } + } + } + } + } + catch( uno::Exception &e) + { + ASSERT_EXCEPTION( e ); + } +} + } // anonymous namespace // ---------------------------------------- @@ -735,5 +781,141 @@ sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nIndex, const Refere return nIndex; } +bool hasDataLabelsAtSeries( const Reference< chart2::XDataSeries >& xSeries ) +{ + bool bRet = false; + try + { + Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY ); + if( xProp.is() ) + { + DataPointLabel aLabel; + if( (xProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel) ) + bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName; + } + } + catch( uno::Exception &e) + { + ASSERT_EXCEPTION( e ); + } + return bRet; +} + +bool hasDataLabelsAtPoints( const Reference< chart2::XDataSeries >& xSeries ) +{ + bool bRet = false; + try + { + Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY ); + if( xSeriesProperties.is() ) + { + uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; + if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList ) + { + for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) + { + Reference< beans::XPropertySet > xPointProp( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]) ); + if( xPointProp.is() ) + { + DataPointLabel aLabel; + if( (xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel) ) + bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName; + if( bRet ) + break; + } + } + } + } + } + catch( uno::Exception &e) + { + ASSERT_EXCEPTION( e ); + } + return bRet; +} + +bool hasDataLabelAtPoint( const Reference< chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex ) +{ + bool bRet = false; + try + { + Reference< beans::XPropertySet > xProp; + Reference< beans::XPropertySet > xSeriesProperties( xSeries, uno::UNO_QUERY ); + if( xSeriesProperties.is() ) + { + uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; + if( xSeriesProperties->getPropertyValue( C2U( "AttributedDataPoints" ) ) >>= aAttributedDataPointIndexList ) + { + ::std::vector< sal_Int32 > aIndices( ContainerHelper::SequenceToVector( aAttributedDataPointIndexList ) ); + ::std::vector< sal_Int32 >::iterator aIt = ::std::find( aIndices.begin(), aIndices.end(), nPointIndex ); + if( aIt != aIndices.end()) + xProp = xSeries->getDataPointByIndex(nPointIndex); + else + xProp = xSeriesProperties; + } + if( xProp.is() ) + { + DataPointLabel aLabel; + if( (xProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel) ) + bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName; + } + } + } + catch( uno::Exception &e) + { + ASSERT_EXCEPTION( e ); + } + return bRet; +} + +void insertDataLabelsToSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries ) +{ + lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( xSeries, true /*bInsert*/ ); +} + +void deleteDataLabelsFromSeriesAndAllPoints( const Reference< chart2::XDataSeries >& xSeries ) +{ + lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( xSeries, false /*bInsert*/ ); +} + + +void insertDataLabelToPoint( const Reference< beans::XPropertySet >& xPointProp ) +{ + try + { + if( xPointProp.is() ) + { + DataPointLabel aLabel; + xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel; + aLabel.ShowNumber = true; + xPointProp->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ) ); + } + } + catch( uno::Exception &e) + { + ASSERT_EXCEPTION( e ); + } +} + +void deleteDataLabelsFromPoint( const Reference< beans::XPropertySet >& xPointProp ) +{ + try + { + if( xPointProp.is() ) + { + DataPointLabel aLabel; + xPointProp->getPropertyValue( C2U( "Label" ) ) >>= aLabel; + aLabel.ShowNumber = false; + aLabel.ShowNumberInPercent = false; + aLabel.ShowCategoryName = false; + xPointProp->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ) ); + } + } + catch( uno::Exception &e) + { + ASSERT_EXCEPTION( e ); + } +} + } // namespace DataSeriesHelper } // namespace chart diff --git a/chart2/source/tools/LegendHelper.cxx b/chart2/source/tools/LegendHelper.cxx index 6d21d13f0dc7..60da06f2b638 100644 --- a/chart2/source/tools/LegendHelper.cxx +++ b/chart2/source/tools/LegendHelper.cxx @@ -32,18 +32,66 @@ #include "precompiled_chart2.hxx" #include "LegendHelper.hxx" #include "macros.hxx" +#include +#include +#include #include #include #include #include using namespace ::com::sun::star; +using ::com::sun::star::uno::Reference; //............................................................................. namespace chart { //............................................................................. + +//static +Reference< chart2::XLegend > LegendHelper::showLegend( const Reference< frame::XModel >& xModel + , const uno::Reference< uno::XComponentContext >& xContext ) +{ + uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( xModel, xContext, true ); + uno::Reference< beans::XPropertySet > xProp( xLegend, uno::UNO_QUERY ); + if( xProp.is()) + { + xProp->setPropertyValue( C2U("Show"), uno::makeAny(sal_True) ); + + chart2::RelativePosition aRelativePosition; + if( !(xProp->getPropertyValue( C2U( "RelativePosition" )) >>= aRelativePosition) ) + { + chart2::LegendPosition ePos = chart2::LegendPosition_LINE_END; + if( !(xProp->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos ) ) + xProp->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( ePos )); + + chart2::LegendExpansion eExpansion = + ( ePos == chart2::LegendPosition_LINE_END || + ePos == chart2::LegendPosition_LINE_START ) + ? chart2::LegendExpansion_HIGH + : chart2::LegendExpansion_WIDE; + if( !(xProp->getPropertyValue( C2U( "Expansion" )) >>= eExpansion ) ) + xProp->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eExpansion )); + + xProp->setPropertyValue( C2U( "RelativePosition" ), uno::Any()); + } + + } + return xLegend; +} + +//static +void LegendHelper::hideLegend( const Reference< frame::XModel >& xModel ) +{ + uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( xModel, 0, false ); + uno::Reference< beans::XPropertySet > xProp( xLegend, uno::UNO_QUERY ); + if( xProp.is()) + { + xProp->setPropertyValue( C2U("Show"), uno::makeAny(sal_False) ); + } +} + // static uno::Reference< chart2::XLegend > LegendHelper::getLegend( const uno::Reference< frame::XModel >& xModel diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 7686b2c7009d..8a4fd8ce4f7e 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -457,6 +457,39 @@ bool RegressionCurveHelper::removeAllExceptMeanValueLine( return bRemovedSomething; } +void RegressionCurveHelper::removeEquations( + uno::Reference< chart2::XRegressionCurveContainer > & xRegCnt ) +{ + if( xRegCnt.is()) + { + try + { + uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves( + xRegCnt->getRegressionCurves()); + for( sal_Int32 i = 0; i < aCurves.getLength(); ++i ) + { + if( !isMeanValueLine( aCurves[i] ) ) + { + uno::Reference< chart2::XRegressionCurve > xRegCurve( aCurves[ i ] ); + if( xRegCurve.is() ) + { + uno::Reference< beans::XPropertySet > xEqProp( xRegCurve->getEquationProperties() ) ; + if( xEqProp.is()) + { + xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( false )); + xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false )); + } + } + } + } + } + catch( uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + } + } +} + // static void RegressionCurveHelper::replaceOrAddCurveAndReduceToOne( tRegressionType eType, @@ -683,6 +716,24 @@ sal_Int32 RegressionCurveHelper::getRegressionCurveIndex( return -1; } +bool RegressionCurveHelper::hasEquation( const Reference< chart2::XRegressionCurve > & xCurve ) +{ + bool bHasEquation = false; + if( xCurve.is()) + { + uno::Reference< beans::XPropertySet > xEquationProp( xCurve->getEquationProperties()); + if( xEquationProp.is()) + { + bool bShowEquation = false; + bool bShowCoefficient = false; + xEquationProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEquation; + xEquationProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoefficient; + bHasEquation = bShowEquation || bShowCoefficient; + } + } + return bHasEquation; +} + //............................................................................. } //namespace chart //............................................................................. diff --git a/chart2/uiconfig/menubar/menubar.xml b/chart2/uiconfig/menubar/menubar.xml index 63f72f67d592..788dac2fc90b 100644 --- a/chart2/uiconfig/menubar/menubar.xml +++ b/chart2/uiconfig/menubar/menubar.xml @@ -43,22 +43,22 @@ - - - - + + + + - - - - + + + + - + @@ -82,6 +82,7 @@ + @@ -107,7 +108,6 @@ - diff --git a/chart2/uiconfig/toolbar/toolbar.xml b/chart2/uiconfig/toolbar/toolbar.xml index 042dc7fbe973..41d5bd41ab63 100644 --- a/chart2/uiconfig/toolbar/toolbar.xml +++ b/chart2/uiconfig/toolbar/toolbar.xml @@ -1,6 +1,9 @@ + + + -- cgit From 6c08543a370b759d495b0f4a593b1f7cd329de64 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Fri, 11 Sep 2009 18:55:06 +0000 Subject: CWS-TOOLING: integrate CWS odff06 2009-09-10 18:58:49 +0200 dr r276042 : #i104954# excel export: fixed broken handling of unary operators 2009-09-06 19:30:43 +0200 er r275861 : warnings 2009-09-05 19:48:41 +0200 er r275849 : warnings; wntmsci12 tries to be too smart 2009-09-05 19:37:47 +0200 er r275848 : warnings 2009-09-03 22:45:42 +0200 er r275776 : #i5658# GetCellValueOrZero: missed the formula cell case 2009-09-03 14:28:41 +0200 er r275752 : #i90759# better description of ZTEST 2009-09-03 03:34:03 +0200 er r275739 : warnings 2009-09-03 03:31:19 +0200 er r275738 : warnings 2009-09-03 03:16:46 +0200 er r275737 : warnings 2009-09-03 03:11:42 +0200 er r275736 : CELLTYPE_DESTROYED only if DBG_UTIL 2009-09-03 03:06:31 +0200 er r275735 : warnings 2009-09-03 03:00:30 +0200 er r275734 : warnings 2009-09-03 02:32:35 +0200 er r275733 : fix broken rebase merge 2009-09-02 22:27:53 +0200 er r275730 : CWS-TOOLING: rebase CWS odff06 to trunk@275331 (milestone: DEV300:m56) 2009-09-02 14:45:05 +0200 er r275712 : #i5658# calculate with string operands as long as they unambiguously represent an integer or ISO 8601 date and/or time value 2009-08-29 22:05:31 +0200 er r275559 : #i99140# CONVERT_ADD new conversions as per ODFF; patch from , slightly changed 2009-08-25 13:23:59 +0200 er r275349 : #i90759# rewording of ZTEST description 2009-08-21 00:10:22 +0200 er r275204 : #i82007# correct description of POWER and parameters; patch from 2009-08-20 23:58:20 +0200 er r275203 : #i74704# B correct calculation for SP arguments 0 and 1; patch from 2009-08-20 22:58:57 +0200 er r275201 : #i90759# ZTEST correct calculation using the 3rd parameter sigma 2009-08-14 17:55:45 +0200 er r275000 : #i81214# LOOKUP with single values, data arrays and result arrays; based on a patch from 2009-08-11 00:47:48 +0200 er r274845 : unxlngi6 compiler warnings 2009-08-11 00:43:06 +0200 er r274844 : unxlngi6 compiler warnings 2009-08-10 23:59:05 +0200 er r274843 : #91351# make HYPERLINK accept and return numeric values, propagate errors 2009-07-08 18:46:00 +0200 dr r273846 : #i102022# export 3D refs to cond. formats and data validation 2009-07-02 17:59:40 +0200 dr r273667 : #i102702# adapt changes from sc/source/filter/excel 2009-07-02 15:20:37 +0200 dr r273656 : #i102702# reimplementation of formula token class export 2009-07-02 14:41:02 +0200 er r273653 : a surrogate with value 0x10000 is also valid (ran into when testing #i99900# Calc's UNICHAR function), and Unicode ends at 0x10ffff 2009-07-01 00:10:16 +0200 er r273536 : #i99900# iterateCodePoints: check index against string length to avoid assertion; caught this when testing Calc's new UNICHAR function, with the result of a surrogate pair forming one character. 2009-07-01 00:03:57 +0200 er r273535 : #i99900# new UNICODE and UNICHAR functions; patch from 2009-06-15 16:42:06 +0200 er r272999 : merge patch from #i102701 2009-06-15 11:15:16 +0200 dr r272970 : #i102702# in BIFF, the SKIP flag may be missing for the tAttrSkip token 2009-06-11 13:27:46 +0200 er r272867 : CWS-TOOLING: rebase CWS odff06 to trunk@272827 (milestone: DEV300:m50) 2009-04-30 18:28:02 +0200 er r271423 : #i94618# on status bar, ignore error of cell for COUNT and COUNTA if selection; patch from 2009-04-30 13:58:44 +0200 er r271413 : get rid of that ugly mail address thingie in RTL_LOGFILE_CONTEXT_AUTHOR introduced by CWS frmdlg ... 2009-04-30 12:32:44 +0200 er r271411 : #i94618# do not display error of cell for COUNT and COUNTA status bar functions 2009-04-30 01:32:38 +0200 er r271399 : #i101316# improve accuracy of STDEV on equal values; patch from 2009-04-30 01:18:54 +0200 er r271398 : #i97605# improve accuracy of ASINH and ACOSH; patch from 2009-04-30 00:46:00 +0200 er r271397 : #i59153# improve accuracy of MOD; patch from 2009-04-30 00:29:43 +0200 er r271396 : #i69069# improve accuracy of NORMSDIST and POISSON; patch from 2009-04-29 23:53:28 +0200 er r271395 : #i100119# NORMDIST and LOGNORMDIST optional parameters, plus improvement in accuracy also of NORMSDIST (part of i69069); patch from 2009-04-28 18:22:07 +0200 er r271337 : #i97052# REPLACE with no length of text to be removed simply inserts new text; patch from , slightly modified 2009-03-24 17:29:36 +0100 er r269982 : #i97091# moved implementation of erf() and erfc() from scaddins to sal to provide C99 functions for compilers lacking it --- sc/source/core/inc/interpre.hxx | 16 +- sc/source/core/inc/parclass.hxx | 11 +- sc/source/core/tool/interpr1.cxx | 565 +++++--- sc/source/core/tool/interpr2.cxx | 281 ++-- sc/source/core/tool/interpr3.cxx | 315 +++-- sc/source/core/tool/interpr4.cxx | 397 ++++-- sc/source/core/tool/interpr5.cxx | 82 +- sc/source/core/tool/interpr6.cxx | 12 +- sc/source/core/tool/parclass.cxx | 263 ++-- sc/source/filter/excel/xeformula.cxx | 2032 ++++++++++++++------------- sc/source/filter/excel/xlformula.cxx | 569 ++++---- sc/source/filter/inc/xlformula.hxx | 173 ++- sc/source/ui/inc/tabvwsh.hxx | 2 +- sc/source/ui/src/scfuncs.src | 42 +- sc/source/ui/view/cellsh.cxx | 12 +- sc/source/ui/view/tabvwsha.cxx | 16 +- scaddins/source/analysis/analysishelper.cxx | 380 ++--- scaddins/source/analysis/analysishelper.hxx | 19 +- 18 files changed, 2953 insertions(+), 2234 deletions(-) diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 9fcf743c1e85..659884dfd5de 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -193,6 +193,7 @@ void ReplaceCell( ScAddress& ); // for TableOp void ReplaceCell( SCCOL& rCol, SCROW& rRow, SCTAB& rTab ); // for TableOp BOOL IsTableOpInRange( const ScRange& ); ULONG GetCellNumberFormat( const ScAddress&, const ScBaseCell* ); +double ConvertStringToValue( const String& ); double GetCellValue( const ScAddress&, const ScBaseCell* ); double GetCellValueOrZero( const ScAddress&, const ScBaseCell* ); double GetValueCellValue( const ScAddress&, const ScValueCell* ); @@ -453,6 +454,8 @@ void ScClean(); void ScChar(); void ScJis(); void ScAsc(); +void ScUnicode(); +void ScUnichar(); void ScMin( BOOL bTextAsZero = FALSE ); void ScMax( BOOL bTextAsZero = FALSE ); double IterateParameters( ScIterFunc, BOOL bTextAsZero = FALSE ); @@ -542,7 +545,17 @@ void ScSpewFunc(); void ScGame(); //----------------Funktionen in interpr2.cxx--------------- -double GetDate(INT16 nYear, INT16 nMonth, INT16 nDay); + +/** Obtain the date serial number for a given date. + @param bStrict + If FALSE, nYear < 100 takes the two-digit year setting into account, + and rollover of invalid calendar dates takes place, e.g. 1999-02-31 => + 1999-03-03. + If TRUE, the date passed must be a valid Gregorian calendar date. No + two-digit expanding or rollover is done. + */ +double GetDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, bool bStrict ); + void ScGetActDate(); void ScGetActTime(); void ScGetYear(); @@ -682,6 +695,7 @@ void ScNoName(); void ScBadName(); // Statistik: double phi(double x); +double integralPhi(double x); double taylor(double* pPolynom, USHORT nMax, double x); double gauss(double x); double gaussinv(double x); diff --git a/sc/source/core/inc/parclass.hxx b/sc/source/core/inc/parclass.hxx index be66587b4c0e..c72bcece7f19 100644 --- a/sc/source/core/inc/parclass.hxx +++ b/sc/source/core/inc/parclass.hxx @@ -72,7 +72,14 @@ public: /** Area reference must be converted to array in any case, and must also be propagated to subsequent operators and functions being part of a parameter of this function. */ - ForceArray + ForceArray, + + /** Area reference is not converted to array, but ForceArray must be + propagated to subsequent operators and functions being part of a + parameter of this function. Used with functions that treat + references separately from arrays, but need the forced array + calculation of parameters that are not references.*/ + ReferenceOrForceArray }; /// MUST be called once before any other method. @@ -87,7 +94,7 @@ public: USHORT nParameter); /** Whether OpCode has a parameter of type - ForceArray. */ + ForceArray or ReferenceOrForceArray. */ static inline bool HasForceArray( OpCode eOp) { return 0 <= (short)eOp && diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 1145fe2ed3c4..9c604d9a07e4 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -45,6 +45,7 @@ #include #include #include +#include #include #include "interpre.hxx" @@ -89,7 +90,7 @@ using namespace formula; void ScInterpreter::ScIfJump() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIfJump" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIfJump" ); const short* pJump = pCur->GetJump(); short nJumpCount = pJump[ 0 ]; MatrixDoubleRefToMatrix(); @@ -219,7 +220,7 @@ void ScInterpreter::ScIfJump() void ScInterpreter::ScChoseJump() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScChoseJump" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScChoseJump" ); // We have to set a jump, if there was none chosen because of an error set // it to endpoint. bool bHaveJump = false; @@ -350,7 +351,7 @@ void lcl_AdjustJumpMatrix( ScJumpMatrix* pJumpM, ScMatrixRef& pResMat, SCSIZE nP bool ScInterpreter::JumpMatrix( short nStackLevel ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::JumpMatrix" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::JumpMatrix" ); pJumpMatrix = static_cast(pStack[sp-nStackLevel])->GetJumpMatrix(); ScMatrixRef pResMat = pJumpMatrix->GetResultMatrix(); SCSIZE nC, nR; @@ -642,7 +643,7 @@ ScCompareOptions::ScCompareOptions( ScDocument* pDoc, const ScQueryEntry& rEntry double ScInterpreter::CompareFunc( const ScCompare& rComp, ScCompareOptions* pOptions ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CompareFunc" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CompareFunc" ); // Keep DoubleError if encountered // #i40539# if bEmpty is set, bVal/nVal are uninitialized if ( !rComp.bEmpty[0] && rComp.bVal[0] && !::rtl::math::isFinite( rComp.nVal[0])) @@ -771,7 +772,7 @@ double ScInterpreter::CompareFunc( const ScCompare& rComp, ScCompareOptions* pOp double ScInterpreter::Compare() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Compare" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Compare" ); String aVal1, aVal2; ScCompare aComp( &aVal1, &aVal2 ); for( short i = 1; i >= 0; i-- ) @@ -825,7 +826,7 @@ double ScInterpreter::Compare() ScMatrixRef ScInterpreter::CompareMat( ScCompareOptions* pOptions ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CompareMat" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CompareMat" ); String aVal1, aVal2; ScCompare aComp( &aVal1, &aVal2 ); ScMatrixRef pMat[2]; @@ -1002,7 +1003,7 @@ ScMatrixRef ScInterpreter::QueryMat( ScMatrix* pMat, ScCompareOptions& rOptions void ScInterpreter::ScEqual() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScEqual" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScEqual" ); if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix ) { ScMatrixRef pMat = CompareMat(); @@ -1021,7 +1022,7 @@ void ScInterpreter::ScEqual() void ScInterpreter::ScNotEqual() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNotEqual" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNotEqual" ); if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix ) { ScMatrixRef pMat = CompareMat(); @@ -1040,7 +1041,7 @@ void ScInterpreter::ScNotEqual() void ScInterpreter::ScLess() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLess" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLess" ); if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix ) { ScMatrixRef pMat = CompareMat(); @@ -1059,7 +1060,7 @@ void ScInterpreter::ScLess() void ScInterpreter::ScGreater() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGreater" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGreater" ); if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix ) { ScMatrixRef pMat = CompareMat(); @@ -1078,7 +1079,7 @@ void ScInterpreter::ScGreater() void ScInterpreter::ScLessEqual() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLessEqual" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLessEqual" ); if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix ) { ScMatrixRef pMat = CompareMat(); @@ -1097,7 +1098,7 @@ void ScInterpreter::ScLessEqual() void ScInterpreter::ScGreaterEqual() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGreaterEqual" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGreaterEqual" ); if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix ) { ScMatrixRef pMat = CompareMat(); @@ -1116,7 +1117,7 @@ void ScInterpreter::ScGreaterEqual() void ScInterpreter::ScAnd() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAnd" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAnd" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; short nParamCount = GetByte(); if ( MustHaveParamCountMin( nParamCount, 1 ) ) @@ -1214,7 +1215,7 @@ void ScInterpreter::ScAnd() void ScInterpreter::ScOr() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScOr" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScOr" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; short nParamCount = GetByte(); if ( MustHaveParamCountMin( nParamCount, 1 ) ) @@ -1313,7 +1314,7 @@ void ScInterpreter::ScOr() void ScInterpreter::ScNeg() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNeg" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNeg" ); // Simple negation doesn't change current format type to number, keep // current type. nFuncFmtType = nCurFmtType; @@ -1355,7 +1356,7 @@ void ScInterpreter::ScNeg() void ScInterpreter::ScPercentSign() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPercentSign" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPercentSign" ); nFuncFmtType = NUMBERFORMAT_PERCENT; const FormulaToken* pSaveCur = pCur; BYTE nSavePar = cPar; @@ -1371,7 +1372,7 @@ void ScInterpreter::ScPercentSign() void ScInterpreter::ScNot() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNot" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNot" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; switch ( GetStackType() ) { @@ -1411,21 +1412,21 @@ void ScInterpreter::ScNot() void ScInterpreter::ScPi() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPi" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPi" ); PushDouble(F_PI); } void ScInterpreter::ScRandom() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRandom" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRandom" ); PushDouble((double)rand() / ((double)RAND_MAX+1.0)); } void ScInterpreter::ScTrue() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTrue" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTrue" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; PushInt(1); } @@ -1433,7 +1434,7 @@ void ScInterpreter::ScTrue() void ScInterpreter::ScFalse() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFalse" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFalse" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; PushInt(0); } @@ -1441,124 +1442,121 @@ void ScInterpreter::ScFalse() void ScInterpreter::ScDeg() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDeg" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDeg" ); PushDouble((GetDouble() / F_PI) * 180.0); } void ScInterpreter::ScRad() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRad" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRad" ); PushDouble(GetDouble() * (F_PI / 180)); } void ScInterpreter::ScSin() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSin" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSin" ); PushDouble(::rtl::math::sin(GetDouble())); } void ScInterpreter::ScCos() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCos" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCos" ); PushDouble(::rtl::math::cos(GetDouble())); } void ScInterpreter::ScTan() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTan" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTan" ); PushDouble(::rtl::math::tan(GetDouble())); } void ScInterpreter::ScCot() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCot" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCot" ); PushDouble(1.0 / ::rtl::math::tan(GetDouble())); } void ScInterpreter::ScArcSin() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcSin" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcSin" ); PushDouble(asin(GetDouble())); } void ScInterpreter::ScArcCos() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcCos" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcCos" ); PushDouble(acos(GetDouble())); } void ScInterpreter::ScArcTan() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcTan" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcTan" ); PushDouble(atan(GetDouble())); } void ScInterpreter::ScArcCot() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcCot" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcCot" ); PushDouble((F_PI2) - atan(GetDouble())); } void ScInterpreter::ScSinHyp() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSinHyp" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSinHyp" ); PushDouble(sinh(GetDouble())); } void ScInterpreter::ScCosHyp() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCosHyp" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCosHyp" ); PushDouble(cosh(GetDouble())); } void ScInterpreter::ScTanHyp() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTanHyp" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTanHyp" ); PushDouble(tanh(GetDouble())); } void ScInterpreter::ScCotHyp() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCotHyp" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCotHyp" ); PushDouble(1.0 / tanh(GetDouble())); } void ScInterpreter::ScArcSinHyp() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcSinHyp" ); - double nVal = GetDouble(); - PushDouble(log(nVal + sqrt((nVal * nVal) + 1.0))); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcSinHyp" ); + PushDouble( ::rtl::math::asinh( GetDouble())); } - void ScInterpreter::ScArcCosHyp() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcCosHyp" ); - double nVal = GetDouble(); - if (nVal < 1.0) + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcCosHyp" ); + double fVal = GetDouble(); + if (fVal < 1.0) PushIllegalArgument(); else - PushDouble(log(nVal + sqrt((nVal * nVal) - 1.0))); + PushDouble( ::rtl::math::acosh( fVal)); } - void ScInterpreter::ScArcTanHyp() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcTanHyp" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcTanHyp" ); double fVal = GetDouble(); if (fabs(fVal) >= 1.0) PushIllegalArgument(); @@ -1569,7 +1567,7 @@ void ScInterpreter::ScArcTanHyp() void ScInterpreter::ScArcCotHyp() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcCotHyp" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcCotHyp" ); double nVal = GetDouble(); if (fabs(nVal) <= 1.0) PushIllegalArgument(); @@ -1580,14 +1578,14 @@ void ScInterpreter::ScArcCotHyp() void ScInterpreter::ScExp() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScExp" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScExp" ); PushDouble(exp(GetDouble())); } void ScInterpreter::ScSqrt() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSqrt" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSqrt" ); double fVal = GetDouble(); if (fVal >= 0.0) PushDouble(sqrt(fVal)); @@ -1598,7 +1596,7 @@ void ScInterpreter::ScSqrt() void ScInterpreter::ScIsEmpty() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsEmpty" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsEmpty" ); short nRes = 0; nFuncFmtType = NUMBERFORMAT_LOGICAL; switch ( GetRawStackType() ) @@ -1653,7 +1651,7 @@ void ScInterpreter::ScIsEmpty() short ScInterpreter::IsString() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::IsString" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::IsString" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; short nRes = 0; switch ( GetRawStackType() ) @@ -1714,21 +1712,21 @@ short ScInterpreter::IsString() void ScInterpreter::ScIsString() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsString" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsString" ); PushInt( IsString() ); } void ScInterpreter::ScIsNonString() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsNonString" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsNonString" ); PushInt( !IsString() ); } void ScInterpreter::ScIsLogical() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsLogical" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsLogical" ); short nRes = 0; switch ( GetStackType() ) { @@ -1767,7 +1765,7 @@ void ScInterpreter::ScIsLogical() void ScInterpreter::ScType() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScType" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScType" ); short nType = 0; switch ( GetStackType() ) { @@ -2065,7 +2063,7 @@ void ScInterpreter::ScCell() void ScInterpreter::ScIsRef() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCell" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCell" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; short nRes = 0; switch ( GetStackType() ) @@ -2103,7 +2101,7 @@ void ScInterpreter::ScIsRef() void ScInterpreter::ScIsValue() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsValue" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsValue" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; short nRes = 0; switch ( GetRawStackType() ) @@ -2167,7 +2165,7 @@ void ScInterpreter::ScIsValue() void ScInterpreter::ScIsFormula() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsFormula" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsFormula" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; short nRes = 0; switch ( GetStackType() ) @@ -2191,7 +2189,7 @@ void ScInterpreter::ScIsFormula() void ScInterpreter::ScFormula() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFormula" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFormula" ); String aFormula; switch ( GetStackType() ) { @@ -2223,7 +2221,7 @@ void ScInterpreter::ScFormula() void ScInterpreter::ScIsNV() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsNV" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsNV" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; short nRes = 0; switch ( GetStackType() ) @@ -2272,7 +2270,7 @@ void ScInterpreter::ScIsNV() void ScInterpreter::ScIsErr() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsErr" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsErr" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; short nRes = 0; switch ( GetStackType() ) @@ -2327,7 +2325,7 @@ void ScInterpreter::ScIsErr() void ScInterpreter::ScIsError() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsError" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsError" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; short nRes = 0; switch ( GetStackType() ) @@ -2379,7 +2377,7 @@ void ScInterpreter::ScIsError() short ScInterpreter::IsEven() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::IsEven" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::IsEven" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; short nRes = 0; double fVal = 0.0; @@ -2462,21 +2460,21 @@ short ScInterpreter::IsEven() void ScInterpreter::ScIsEven() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsEven" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsEven" ); PushInt( IsEven() ); } void ScInterpreter::ScIsOdd() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsOdd" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsOdd" ); PushInt( !IsEven() ); } void ScInterpreter::ScN() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScN" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScN" ); USHORT nErr = nGlobalError; nGlobalError = 0; double fVal; @@ -2515,7 +2513,7 @@ void ScInterpreter::ScTrim() void ScInterpreter::ScUpper() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTrim" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTrim" ); String aString = GetString(); ScGlobal::pCharClass->toUpper(aString); PushString(aString); @@ -2524,7 +2522,7 @@ void ScInterpreter::ScUpper() void ScInterpreter::ScPropper() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPropper" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPropper" ); //2do: what to do with I18N-CJK ?!? String aStr( GetString() ); const xub_StrLen nLen = aStr.Len(); @@ -2557,7 +2555,7 @@ void ScInterpreter::ScPropper() void ScInterpreter::ScLower() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLower" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLower" ); String aString( GetString() ); ScGlobal::pCharClass->toLower(aString); PushString(aString); @@ -2566,7 +2564,7 @@ void ScInterpreter::ScLower() void ScInterpreter::ScLen() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLen" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLen" ); String aStr( GetString() ); PushDouble( aStr.Len() ); } @@ -2574,7 +2572,7 @@ void ScInterpreter::ScLen() void ScInterpreter::ScT() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScT" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScT" ); switch ( GetStackType() ) { case svDoubleRef : @@ -2629,7 +2627,7 @@ void ScInterpreter::ScT() void ScInterpreter::ScValue() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScValue" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScValue" ); String aInputString; double fVal; @@ -2711,7 +2709,7 @@ inline BOOL lcl_ScInterpreter_IsPrintable( sal_Unicode c ) void ScInterpreter::ScClean() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScClean" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScClean" ); String aStr( GetString() ); for ( xub_StrLen i = 0; i < aStr.Len(); i++ ) { @@ -2724,7 +2722,7 @@ void ScInterpreter::ScClean() void ScInterpreter::ScCode() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCode" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCode" ); //2do: make it full range unicode? const String& rStr = GetString(); PushInt( (sal_uChar) ByteString::ConvertFromUnicode( rStr.GetChar(0), gsl_getSystemTextEncoding() ) ); @@ -2733,7 +2731,7 @@ void ScInterpreter::ScCode() void ScInterpreter::ScChar() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScChar" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScChar" ); //2do: make it full range unicode? double fVal = GetDouble(); if (fVal < 0.0 || fVal >= 256.0) @@ -2793,7 +2791,7 @@ static ::rtl::OUString lcl_convertIntoFullWidth( const ::rtl::OUString & rStr ) */ void ScInterpreter::ScJis() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScJis" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScJis" ); if (MustHaveParamCount( GetByte(), 1)) PushString( lcl_convertIntoFullWidth( GetString())); } @@ -2807,15 +2805,48 @@ void ScInterpreter::ScJis() */ void ScInterpreter::ScAsc() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAsc" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAsc" ); if (MustHaveParamCount( GetByte(), 1)) PushString( lcl_convertIntoHalfWidth( GetString())); } +void ScInterpreter::ScUnicode() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScUnicode" ); + if ( MustHaveParamCount( GetByte(), 1 ) ) + { + const rtl::OUString& rStr = GetString(); + if (rStr.getLength() <= 0) + PushIllegalParameter(); + else + { + sal_Int32 i = 0; + PushDouble( rStr.iterateCodePoints(&i) ); + } + } +} + +void ScInterpreter::ScUnichar() +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScUnichar" ); + if ( MustHaveParamCount( GetByte(), 1 ) ) + { + double dVal = ::rtl::math::approxFloor( GetDouble() ); + if ((dVal < 0x000000) || (dVal > 0x10FFFF)) + PushIllegalArgument(); + else + { + sal_uInt32 nCodePoint = static_cast( dVal ); + rtl::OUString aStr( &nCodePoint, 1 ); + PushString( aStr ); + } + } +} + void ScInterpreter::ScMin( BOOL bTextAsZero ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMin" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMin" ); short nParamCount = GetByte(); if (!MustHaveParamCountMin( nParamCount, 1)) return; @@ -2940,7 +2971,7 @@ void ScInterpreter::ScMin( BOOL bTextAsZero ) void ScInterpreter::ScMax( BOOL bTextAsZero ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMax" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMax" ); short nParamCount = GetByte(); if (!MustHaveParamCountMin( nParamCount, 1)) return; @@ -3065,7 +3096,7 @@ void ScInterpreter::ScMax( BOOL bTextAsZero ) double ScInterpreter::IterateParameters( ScIterFunc eFunc, BOOL bTextAsZero ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::IterateParameters" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::IterateParameters" ); short nParamCount = GetByte(); double fRes = ( eFunc == ifPRODUCT ) ? 1.0 : 0.0; double fVal = 0.0; @@ -3377,42 +3408,42 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, BOOL bTextAsZero ) void ScInterpreter::ScSumSQ() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumSQ" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumSQ" ); PushDouble( IterateParameters( ifSUMSQ ) ); } void ScInterpreter::ScSum() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSum" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSum" ); PushDouble( IterateParameters( ifSUM ) ); } void ScInterpreter::ScProduct() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScProduct" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScProduct" ); PushDouble( IterateParameters( ifPRODUCT ) ); } void ScInterpreter::ScAverage( BOOL bTextAsZero ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAverage" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAverage" ); PushDouble( IterateParameters( ifAVERAGE, bTextAsZero ) ); } void ScInterpreter::ScCount() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCount" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCount" ); PushDouble( IterateParameters( ifCOUNT ) ); } void ScInterpreter::ScCount2() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCount2" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCount2" ); PushDouble( IterateParameters( ifCOUNT2 ) ); } @@ -3420,7 +3451,7 @@ void ScInterpreter::ScCount2() void ScInterpreter::GetStVarParams( double& rVal, double& rValCount, BOOL bTextAsZero ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetStVarParams" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetStVarParams" ); short nParamCount = GetByte(); std::vector values; @@ -3529,15 +3560,14 @@ void ScInterpreter::GetStVarParams( double& rVal, double& rValCount, ::std::vector::size_type n = values.size(); vMean = fSum / n; for (::std::vector::size_type i = 0; i < n; i++) - vSum += (values[i] - vMean) * (values[i] - vMean); - + vSum += ::rtl::math::approxSub( values[i], vMean) * ::rtl::math::approxSub( values[i], vMean); rVal = vSum; } void ScInterpreter::ScVar( BOOL bTextAsZero ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVar" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVar" ); double nVal; double nValCount; GetStVarParams( nVal, nValCount, bTextAsZero ); @@ -3551,7 +3581,7 @@ void ScInterpreter::ScVar( BOOL bTextAsZero ) void ScInterpreter::ScVarP( BOOL bTextAsZero ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVarP" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVarP" ); double nVal; double nValCount; GetStVarParams( nVal, nValCount, bTextAsZero ); @@ -3562,7 +3592,7 @@ void ScInterpreter::ScVarP( BOOL bTextAsZero ) void ScInterpreter::ScStDev( BOOL bTextAsZero ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScStDev" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScStDev" ); double nVal; double nValCount; GetStVarParams( nVal, nValCount, bTextAsZero ); @@ -3575,7 +3605,7 @@ void ScInterpreter::ScStDev( BOOL bTextAsZero ) void ScInterpreter::ScStDevP( BOOL bTextAsZero ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScStDevP" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScStDevP" ); double nVal; double nValCount; GetStVarParams( nVal, nValCount, bTextAsZero ); @@ -3605,7 +3635,7 @@ void ScInterpreter::ScStDevP( BOOL bTextAsZero ) void ScInterpreter::ScColumns() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScColumns" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScColumns" ); BYTE nParamCount = GetByte(); ULONG nVal = 0; SCCOL nCol1; @@ -3649,7 +3679,7 @@ void ScInterpreter::ScColumns() void ScInterpreter::ScRows() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRows" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRows" ); BYTE nParamCount = GetByte(); ULONG nVal = 0; SCCOL nCol1; @@ -3692,7 +3722,7 @@ void ScInterpreter::ScRows() void ScInterpreter::ScTables() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTables" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTables" ); BYTE nParamCount = GetByte(); ULONG nVal; if ( nParamCount == 0 ) @@ -3734,7 +3764,7 @@ void ScInterpreter::ScTables() void ScInterpreter::ScColumn() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScColumn" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScColumn" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 0, 1 ) ) { @@ -3810,7 +3840,7 @@ void ScInterpreter::ScColumn() void ScInterpreter::ScRow() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRow" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRow" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 0, 1 ) ) { @@ -3885,7 +3915,7 @@ void ScInterpreter::ScRow() void ScInterpreter::ScTable() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTable" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTable" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 0, 1 ) ) { @@ -4034,7 +4064,7 @@ static void lcl_GetLastMatch( SCSIZE& rIndex, const ScMatrix& rMat, void ScInterpreter::ScMatch() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatch" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatch" ); ScMatrixRef pMatSrc = NULL; BYTE nParamCount = GetByte(); @@ -4293,7 +4323,7 @@ void ScInterpreter::ScMatch() void ScInterpreter::ScCountEmptyCells() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCountEmptyCells" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCountEmptyCells" ); if ( MustHaveParamCount( GetByte(), 1 ) ) { ULONG nMaxCount = 0, nCount = 0; @@ -4346,7 +4376,7 @@ void ScInterpreter::ScCountEmptyCells() void ScInterpreter::ScCountIf() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCountIf" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCountIf" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { String rString; @@ -4538,7 +4568,7 @@ void ScInterpreter::ScCountIf() void ScInterpreter::ScSumIf() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumIf" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumIf" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 2, 3 ) ) { @@ -4905,7 +4935,7 @@ void ScInterpreter::ScSumIf() void ScInterpreter::ScLookup() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLookup" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLookup" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 2, 3 ) ) return ; @@ -4917,9 +4947,16 @@ void ScInterpreter::ScLookup() SCSIZE nLenMajor = 0; // length of major direction bool bVertical = true; // whether to lookup vertically or horizontally + // The third parameter, result array, for double, string and single reference. + double fResVal = 0.0; + String aResStr; + ScAddress aResAdr; + StackVar eResArrayType = svUnknown; + if (nParamCount == 3) { - switch (GetStackType()) + eResArrayType = GetStackType(); + switch (eResArrayType) { case svDoubleRef: { @@ -4953,16 +4990,32 @@ void ScInterpreter::ScLookup() } } break; + case svDouble: + fResVal = GetDouble(); + break; + case svString: + aResStr = GetString(); + break; + case svSingleRef: + PopSingleRef( aResAdr ); + break; default: PushIllegalParameter(); return; } } + // For double, string and single reference. + double fDataVal = 0.0; + String aDataStr; + ScAddress aDataAdr; + bool bValueData = false; + // Get the data-result range and also determine whether this is vertical // lookup or horizontal lookup. - switch (GetStackType()) + StackVar eDataArrayType = GetStackType(); + switch (eDataArrayType) { case svDoubleRef: { @@ -4992,15 +5045,43 @@ void ScInterpreter::ScLookup() nLenMajor = bVertical ? nR : nC; } break; + case svDouble: + { + fDataVal = GetDouble(); + bValueData = true; + } + break; + case svString: + { + aDataStr = GetString(); + } + break; + case svSingleRef: + { + PopSingleRef( aDataAdr ); + const ScBaseCell* pDataCell = GetCell( aDataAdr ); + if (HasCellEmptyData( pDataCell)) + { + // Empty cells aren't found anywhere, bail out early. + SetError( NOTAVAILABLE); + } + else if (HasCellValueData( pDataCell)) + { + fDataVal = GetCellValue( aDataAdr, pDataCell ); + bValueData = true; + } + else + GetCellString( aDataStr, pDataCell ); + } + break; default: - PushIllegalParameter(); - return; + SetError( errIllegalParameter); } if (nGlobalError) { - PushIllegalParameter(); + PushError( nGlobalError); return; } @@ -5011,6 +5092,84 @@ void ScInterpreter::ScLookup() if ( !FillEntry(rEntry) ) return; + if ( eDataArrayType == svDouble || eDataArrayType == svString || + eDataArrayType == svSingleRef ) + { + // Delta position for a single value is always 0. + + // Found if data <= query, but not if query is string and found data is + // numeric or vice versa. This is how Excel does it but doesn't + // document it. + + bool bFound = false; + if ( bValueData ) + { + if ( rEntry.bQueryByString ) + bFound = false; + else + bFound = (fDataVal <= rEntry.nVal); + } + else + { + if ( !rEntry.bQueryByString ) + bFound = false; + else + bFound = (ScGlobal::pCollator->compareString( aDataStr, *rEntry.pStr) <= 0); + } + + if (!bFound) + { + PushNA(); + return; + } + + if (pResMat) + { + if (pResMat->IsValue( 0 )) + PushDouble(pResMat->GetDouble( 0 )); + else + PushString(pResMat->GetString( 0 )); + } + else if (nParamCount == 3) + { + switch (eResArrayType) + { + case svDouble: + PushDouble( fResVal ); + break; + case svString: + PushString( aResStr ); + break; + case svDoubleRef: + aResAdr.Set( nResCol1, nResRow1, nResTab); + // fallthru + case svSingleRef: + PushCellResultToken( true, aResAdr, NULL, NULL); + break; + default: + DBG_ERRORFILE( "ScInterpreter::ScLookup: unhandled eResArrayType, single value data"); + } + } + else + { + switch (eDataArrayType) + { + case svDouble: + PushDouble( fDataVal ); + break; + case svString: + PushString( aDataStr ); + break; + case svSingleRef: + PushCellResultToken( true, aDataAdr, NULL, NULL); + break; + default: + DBG_ERRORFILE( "ScInterpreter::ScLookup: unhandled eDataArrayType, single value data"); + } + } + return; + } + // Now, perform the search to compute the delta position (nDelta). if (pDataMat) @@ -5096,6 +5255,20 @@ void ScInterpreter::ScLookup() bFound = true; } + // With 0-9 < A-Z, if query is numeric and data found is string, or + // vice versa, the (yet another undocumented) Excel behavior is to + // return #N/A instead. + + if (bFound) + { + SCCOLROW i = nDelta; + SCSIZE n = pDataMat->GetElementCount(); + if (static_cast(i) >= n) + i = static_cast(n); + if (bool(rEntry.bQueryByString) == bool(pDataMat->IsValue(i))) + bFound = false; + } + if (!bFound) { PushNA(); @@ -5208,35 +5381,69 @@ void ScInterpreter::ScLookup() } else if (nParamCount == 3) { - // Use the result array vector. Note that the result array is assumed - // to be a vector (i.e. 1-dimensinoal array). - - ScAddress aAdr; - aAdr.SetTab(nResTab); - bool bResVertical = (nResRow2 - nResRow1) > 0; - if (bResVertical) + switch (eResArrayType) { - SCROW nTempRow = static_cast(nResRow1 + nDelta); - if (nTempRow > MAXROW) + case svDoubleRef: { - PushDouble(0); - return; + // Use the result array vector. Note that the result array is assumed + // to be a vector (i.e. 1-dimensinoal array). + + ScAddress aAdr; + aAdr.SetTab(nResTab); + bool bResVertical = (nResRow2 - nResRow1) > 0; + if (bResVertical) + { + SCROW nTempRow = static_cast(nResRow1 + nDelta); + if (nTempRow > MAXROW) + { + PushDouble(0); + return; + } + aAdr.SetCol(nResCol1); + aAdr.SetRow(nTempRow); + } + else + { + SCCOL nTempCol = static_cast(nResCol1 + nDelta); + if (nTempCol > MAXCOL) + { + PushDouble(0); + return; + } + aAdr.SetCol(nTempCol); + aAdr.SetRow(nResRow1); + } + PushCellResultToken( true, aAdr, NULL, NULL); } - aAdr.SetCol(nResCol1); - aAdr.SetRow(nTempRow); - } - else - { - SCCOL nTempCol = static_cast(nResCol1 + nDelta); - if (nTempCol > MAXCOL) + break; + case svDouble: + case svString: + case svSingleRef: { - PushDouble(0); - return; + if (nDelta != 0) + PushNA(); + else + { + switch (eResArrayType) + { + case svDouble: + PushDouble( fResVal ); + break; + case svString: + PushString( aResStr ); + break; + case svSingleRef: + PushCellResultToken( true, aResAdr, NULL, NULL); + break; + default: + ; // nothing + } + } } - aAdr.SetCol(nTempCol); - aAdr.SetRow(nResRow1); + break; + default: + DBG_ERRORFILE( "ScInterpreter::ScLookup: unhandled eResArrayType, range search"); } - PushCellResultToken(true, aAdr, NULL, NULL); } else { @@ -5274,12 +5481,12 @@ void ScInterpreter::ScLookup() void ScInterpreter::ScHLookup() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScHLookup" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScHLookup" ); CalculateLookup(TRUE); } void ScInterpreter::CalculateLookup(BOOL HLookup) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateLookup" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateLookup" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 3, 4 ) ) { @@ -5503,7 +5710,7 @@ void ScInterpreter::CalculateLookup(BOOL HLookup) bool ScInterpreter::FillEntry(ScQueryEntry& rEntry) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::FillEntry" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::FillEntry" ); switch ( GetStackType() ) { case svDouble: @@ -5567,7 +5774,7 @@ bool ScInterpreter::FillEntry(ScQueryEntry& rEntry) } void ScInterpreter::ScVLookup() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVLookup" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVLookup" ); CalculateLookup(FALSE); } @@ -5577,7 +5784,7 @@ void ScInterpreter::ScVLookup() void ScInterpreter::ScSubTotal() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSubTotal" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSubTotal" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCountMin( nParamCount, 2 ) ) { @@ -5622,7 +5829,7 @@ void ScInterpreter::ScSubTotal() BOOL ScInterpreter::GetDBParams(SCTAB& rTab, ScQueryParam& rParam, BOOL& rMissingField ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDBParams" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDBParams" ); BOOL bRet = FALSE; BOOL bAllowMissingField = FALSE; if ( rMissingField ) @@ -5791,7 +5998,7 @@ BOOL ScInterpreter::GetDBParams(SCTAB& rTab, ScQueryParam& rParam, void ScInterpreter::DBIterator( ScIterFunc eFunc ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::DBIterator" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::DBIterator" ); SCTAB nTab1; double nErg = 0.0; double fMem = 0.0; @@ -5854,14 +6061,14 @@ void ScInterpreter::DBIterator( ScIterFunc eFunc ) void ScInterpreter::ScDBSum() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBSum" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBSum" ); DBIterator( ifSUM ); } void ScInterpreter::ScDBCount() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBCount" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBCount" ); SCTAB nTab; ScQueryParam aQueryParam; BOOL bMissingField = TRUE; @@ -5910,7 +6117,7 @@ void ScInterpreter::ScDBCount() void ScInterpreter::ScDBCount2() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBCount2" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBCount2" ); SCTAB nTab; ScQueryParam aQueryParam; BOOL bMissingField = TRUE; @@ -5934,35 +6141,35 @@ void ScInterpreter::ScDBCount2() void ScInterpreter::ScDBAverage() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBAverage" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBAverage" ); DBIterator( ifAVERAGE ); } void ScInterpreter::ScDBMax() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBMax" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBMax" ); DBIterator( ifMAX ); } void ScInterpreter::ScDBMin() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBMin" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBMin" ); DBIterator( ifMIN ); } void ScInterpreter::ScDBProduct() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBProduct" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBProduct" ); DBIterator( ifPRODUCT ); } void ScInterpreter::GetDBStVarParams( double& rVal, double& rValCount ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDBStVarParams" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDBStVarParams" ); std::vector values; double vSum = 0.0; double vMean = 0.0; @@ -6003,7 +6210,7 @@ void ScInterpreter::GetDBStVarParams( double& rVal, double& rValCount ) void ScInterpreter::ScDBStdDev() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBStdDev" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBStdDev" ); double fVal, fCount; GetDBStVarParams( fVal, fCount ); PushDouble( sqrt(fVal/(fCount-1))); @@ -6012,7 +6219,7 @@ void ScInterpreter::ScDBStdDev() void ScInterpreter::ScDBStdDevP() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBStdDevP" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBStdDevP" ); double fVal, fCount; GetDBStVarParams( fVal, fCount ); PushDouble( sqrt(fVal/fCount)); @@ -6021,7 +6228,7 @@ void ScInterpreter::ScDBStdDevP() void ScInterpreter::ScDBVar() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBVar" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBVar" ); double fVal, fCount; GetDBStVarParams( fVal, fCount ); PushDouble(fVal/(fCount-1)); @@ -6030,7 +6237,7 @@ void ScInterpreter::ScDBVar() void ScInterpreter::ScDBVarP() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBVarP" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBVarP" ); double fVal, fCount; GetDBStVarParams( fVal, fCount ); PushDouble(fVal/fCount); @@ -6085,7 +6292,7 @@ ScTokenArray* lcl_CreateExternalRefTokenArray( const ScAddress& rPos, ScDocument void ScInterpreter::ScIndirect() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIndirect" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIndirect" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { @@ -6194,7 +6401,7 @@ void ScInterpreter::ScIndirect() void ScInterpreter::ScAddressFunc() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAddressFunc" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAddressFunc" ); String sTabStr; BYTE nParamCount = GetByte(); @@ -6269,7 +6476,7 @@ void ScInterpreter::ScAddressFunc() void ScInterpreter::ScOffset() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScOffset" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScOffset" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 3, 5 ) ) { @@ -6345,7 +6552,7 @@ void ScInterpreter::ScOffset() void ScInterpreter::ScIndex() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIndex" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIndex" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 4 ) ) { @@ -6551,7 +6758,7 @@ void ScInterpreter::ScIndex() void ScInterpreter::ScMultiArea() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMultiArea" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMultiArea" ); // Legacy support, convert to RefList BYTE nParamCount = GetByte(); if (MustHaveParamCountMin( nParamCount, 1)) @@ -6566,7 +6773,7 @@ void ScInterpreter::ScMultiArea() void ScInterpreter::ScAreas() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAreas" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAreas" ); BYTE nParamCount = GetByte(); if (MustHaveParamCount( nParamCount, 1)) { @@ -6604,7 +6811,7 @@ void ScInterpreter::ScAreas() void ScInterpreter::ScCurrency() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCurrency" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCurrency" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { @@ -6665,17 +6872,25 @@ void ScInterpreter::ScCurrency() void ScInterpreter::ScReplace() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScReplace" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScReplace" ); if ( MustHaveParamCount( GetByte(), 4 ) ) { String aNewStr( GetString() ); - short nCount = (short) GetDouble(); - short nPos = (short) GetDouble(); + double fCount = ::rtl::math::approxFloor( GetDouble()); + double fPos = ::rtl::math::approxFloor( GetDouble()); String aOldStr( GetString() ); - if( nPos < 1 || nCount < 1 ) + if (fPos < 1.0 || fPos > static_cast(STRING_MAXLEN) + || fCount < 0.0 || fCount > static_cast(STRING_MAXLEN)) PushIllegalArgument(); else { + xub_StrLen nCount = static_cast(fCount); + xub_StrLen nPos = static_cast(fPos); + xub_StrLen nLen = aOldStr.Len(); + if (nPos > nLen + 1) + nPos = nLen + 1; + if (nCount > nLen - nPos + 1) + nCount = nLen - nPos + 1; aOldStr.Erase( nPos-1, nCount ); if ( CheckStringResultLen( aOldStr, aNewStr ) ) aOldStr.Insert( aNewStr, nPos-1 ); @@ -6687,7 +6902,7 @@ void ScInterpreter::ScReplace() void ScInterpreter::ScFixed() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFixed" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFixed" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 3 ) ) { @@ -6747,7 +6962,7 @@ void ScInterpreter::ScFixed() void ScInterpreter::ScFind() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFind" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFind" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 2, 3 ) ) { @@ -6773,7 +6988,7 @@ void ScInterpreter::ScFind() void ScInterpreter::ScExact() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScExact" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScExact" ); nFuncFmtType = NUMBERFORMAT_LOGICAL; if ( MustHaveParamCount( GetByte(), 2 ) ) { @@ -6786,7 +7001,7 @@ void ScInterpreter::ScExact() void ScInterpreter::ScLeft() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLeft" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLeft" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { @@ -6813,7 +7028,7 @@ void ScInterpreter::ScLeft() void ScInterpreter::ScRight() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRight" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRight" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { @@ -6841,7 +7056,7 @@ void ScInterpreter::ScRight() void ScInterpreter::ScSearch() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSearch" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSearch" ); double fAnz; BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 2, 3 ) ) @@ -6882,7 +7097,7 @@ void ScInterpreter::ScSearch() void ScInterpreter::ScMid() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMid" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMid" ); if ( MustHaveParamCount( GetByte(), 3 ) ) { double fAnz = ::rtl::math::approxFloor(GetDouble()); @@ -6898,7 +7113,7 @@ void ScInterpreter::ScMid() void ScInterpreter::ScText() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScText" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScText" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { String sFormatString = GetString(); @@ -6924,7 +7139,7 @@ void ScInterpreter::ScText() void ScInterpreter::ScSubstitute() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSubstitute" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSubstitute" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 3, 4 ) ) { @@ -6979,7 +7194,7 @@ void ScInterpreter::ScSubstitute() void ScInterpreter::ScRept() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRept" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRept" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { double fAnz = ::rtl::math::approxFloor(GetDouble()); @@ -7012,7 +7227,7 @@ void ScInterpreter::ScRept() void ScInterpreter::ScConcat() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScConcat" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScConcat" ); BYTE nParamCount = GetByte(); String aRes; while( nParamCount-- > 0) @@ -7026,7 +7241,7 @@ void ScInterpreter::ScConcat() void ScInterpreter::ScErrorType() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScErrorType" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScErrorType" ); USHORT nErr; USHORT nOldError = nGlobalError; nGlobalError = 0; @@ -7108,7 +7323,7 @@ void ScInterpreter::ScErrorType() BOOL ScInterpreter::MayBeRegExp( const String& rStr, const ScDocument* pDoc ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::MayBeRegExp" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::MayBeRegExp" ); if ( pDoc && !pDoc->GetDocOptions().IsFormulaRegexEnabled() ) return FALSE; if ( !rStr.Len() || (rStr.Len() == 1 && rStr.GetChar(0) != '.') ) @@ -7178,7 +7393,7 @@ static struct LookupCacheDebugCounter bool ScInterpreter::LookupQueryWithCache( ScAddress & o_rResultPos, const ScQueryParam & rParam ) const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::LookupQueryWithCache" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::LookupQueryWithCache" ); bool bFound = false; const ScQueryEntry& rEntry = rParam.GetEntry(0); bool bColumnsMatch = (rParam.nCol1 == rEntry.nField); diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index d4d938d482ed..fc0f085706c5 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -69,24 +69,33 @@ using namespace formula; // Datum und Zeit //----------------------------------------------------------------------------- -double ScInterpreter::GetDate(INT16 nYear, INT16 nMonth, INT16 nDay) +double ScInterpreter::GetDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, bool bStrict ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDate" ); - if ( nYear < 100 ) + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDateSerial" ); + if ( nYear < 100 && !bStrict ) nYear = pFormatter->ExpandTwoDigitYear( nYear ); - INT16 nY, nM; - if (nMonth > 0) - { - nY = nYear + (nMonth-1) / 12; - nM = ((nMonth-1) % 12) + 1; - } + // Do not use a default Date ctor here because it asks system time with a + // performance penalty. + INT16 nY, nM, nD; + if (bStrict) + nY = nYear, nM = nMonth, nD = nDay; else { - nY = nYear + (nMonth-12) / 12; - nM = 12 - (-nMonth) % 12; + if (nMonth > 0) + { + nY = nYear + (nMonth-1) / 12; + nM = ((nMonth-1) % 12) + 1; + } + else + { + nY = nYear + (nMonth-12) / 12; + nM = 12 - (-nMonth) % 12; + } + nD = 1; } - Date aDate(1, nM, nY); - aDate += nDay - 1; + Date aDate( nD, nM, nY); + if (!bStrict) + aDate += nDay - 1; if (aDate.IsValid()) return (double) (aDate - *(pFormatter->GetNullDate())); else @@ -102,7 +111,7 @@ double ScInterpreter::GetDate(INT16 nYear, INT16 nMonth, INT16 nDay) void ScInterpreter::ScGetActDate() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetActDate" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetActDate" ); nFuncFmtType = NUMBERFORMAT_DATE; Date aActDate; long nDiff = aActDate - *(pFormatter->GetNullDate()); @@ -111,7 +120,7 @@ void ScInterpreter::ScGetActDate() void ScInterpreter::ScGetActTime() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetActTime" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetActTime" ); nFuncFmtType = NUMBERFORMAT_DATETIME; Date aActDate; long nDiff = aActDate - *(pFormatter->GetNullDate()); @@ -125,7 +134,7 @@ void ScInterpreter::ScGetActTime() void ScInterpreter::ScGetYear() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetYear" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetYear" ); Date aDate = *(pFormatter->GetNullDate()); aDate += (long) ::rtl::math::approxFloor(GetDouble()); PushDouble( (double) aDate.GetYear() ); @@ -133,7 +142,7 @@ void ScInterpreter::ScGetYear() void ScInterpreter::ScGetMonth() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetMonth" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetMonth" ); Date aDate = *(pFormatter->GetNullDate()); aDate += (long) ::rtl::math::approxFloor(GetDouble()); PushDouble( (double) aDate.GetMonth() ); @@ -141,7 +150,7 @@ void ScInterpreter::ScGetMonth() void ScInterpreter::ScGetDay() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDay" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDay" ); Date aDate = *(pFormatter->GetNullDate()); aDate += (long)::rtl::math::approxFloor(GetDouble()); PushDouble((double) aDate.GetDay()); @@ -149,7 +158,7 @@ void ScInterpreter::ScGetDay() void ScInterpreter::ScGetMin() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetMin" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetMin" ); double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg long nVal = (long)::rtl::math::approxFloor(fTime*D_TIMEFACTOR+0.5) % 3600; @@ -158,7 +167,7 @@ void ScInterpreter::ScGetMin() void ScInterpreter::ScGetSec() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetSec" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetSec" ); double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg long nVal = (long)::rtl::math::approxFloor(fTime*D_TIMEFACTOR+0.5) % 60; @@ -167,7 +176,7 @@ void ScInterpreter::ScGetSec() void ScInterpreter::ScGetHour() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetHour" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetHour" ); double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg long nVal = (long)::rtl::math::approxFloor(fTime*D_TIMEFACTOR+0.5) / 3600; @@ -176,7 +185,7 @@ void ScInterpreter::ScGetHour() void ScInterpreter::ScGetDateValue() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDateValue" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDateValue" ); String aInputString = GetString(); sal_uInt32 nFIndex = 0; // damit default Land/Spr. double fVal; @@ -194,7 +203,7 @@ void ScInterpreter::ScGetDateValue() void ScInterpreter::ScGetDayOfWeek() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDayOfWeek" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDayOfWeek" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { @@ -222,7 +231,7 @@ void ScInterpreter::ScGetDayOfWeek() void ScInterpreter::ScGetWeekOfYear() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetWeekOfYear" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetWeekOfYear" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { short nFlag = (short) ::rtl::math::approxFloor(GetDouble()); @@ -235,7 +244,7 @@ void ScInterpreter::ScGetWeekOfYear() void ScInterpreter::ScEasterSunday() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScEasterSunday" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScEasterSunday" ); nFuncFmtType = NUMBERFORMAT_DATE; if ( MustHaveParamCount( GetByte(), 1 ) ) { @@ -260,13 +269,13 @@ void ScInterpreter::ScEasterSunday() O = H + L - 7 * M + 114; nDay = sal::static_int_cast( O % 31 + 1 ); nMonth = sal::static_int_cast( int(O / 31) ); - PushDouble( GetDate( nYear, nMonth, nDay ) ); + PushDouble( GetDateSerial( nYear, nMonth, nDay, true ) ); } } void ScInterpreter::ScGetDate() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDate" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDate" ); nFuncFmtType = NUMBERFORMAT_DATE; if ( MustHaveParamCount( GetByte(), 3 ) ) { @@ -277,14 +286,14 @@ void ScInterpreter::ScGetDate() PushIllegalArgument(); else { - PushDouble(GetDate(nYear, nMonth, nDay)); + PushDouble(GetDateSerial(nYear, nMonth, nDay, false)); } } } void ScInterpreter::ScGetTime() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetTime" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetTime" ); nFuncFmtType = NUMBERFORMAT_TIME; if ( MustHaveParamCount( GetByte(), 3 ) ) { @@ -297,7 +306,7 @@ void ScInterpreter::ScGetTime() void ScInterpreter::ScGetDiffDate() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDiffDate" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDiffDate" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { double nDate2 = GetDouble(); @@ -308,7 +317,7 @@ void ScInterpreter::ScGetDiffDate() void ScInterpreter::ScGetDiffDate360() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDiffDate360" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDiffDate360" ); /* Implementation follows * http://www.bondmarkets.com/eCommerce/SMD_Fields_030802.pdf * Appendix B: Day-Count Bases, there are 7 different ways to calculate the @@ -403,7 +412,7 @@ void ScInterpreter::ScGetDiffDate360() void ScInterpreter::ScGetTimeValue() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetTimeValue" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetTimeValue" ); String aInputString = GetString(); sal_uInt32 nFIndex = 0; // damit default Land/Spr. double fVal; @@ -425,7 +434,7 @@ void ScInterpreter::ScGetTimeValue() void ScInterpreter::ScPlusMinus() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPlusMinus" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPlusMinus" ); double nVal = GetDouble(); short n = 0; if (nVal < 0.0) @@ -437,20 +446,20 @@ void ScInterpreter::ScPlusMinus() void ScInterpreter::ScAbs() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAbs" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAbs" ); PushDouble(fabs(GetDouble())); } void ScInterpreter::ScInt() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScInt" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScInt" ); PushDouble(::rtl::math::approxFloor(GetDouble())); } void ScInterpreter::RoundNumber( rtl_math_RoundingMode eMode ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::RoundNumber" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::RoundNumber" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { @@ -471,25 +480,25 @@ void ScInterpreter::RoundNumber( rtl_math_RoundingMode eMode ) void ScInterpreter::ScRound() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRound" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRound" ); RoundNumber( rtl_math_RoundingMode_Corrected ); } void ScInterpreter::ScRoundDown() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRoundDown" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRoundDown" ); RoundNumber( rtl_math_RoundingMode_Down ); } void ScInterpreter::ScRoundUp() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRoundUp" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRoundUp" ); RoundNumber( rtl_math_RoundingMode_Up ); } void ScInterpreter::ScCeil() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCeil" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCeil" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 2, 3 ) ) { @@ -512,7 +521,7 @@ void ScInterpreter::ScCeil() void ScInterpreter::ScFloor() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFloor" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFloor" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 2, 3 ) ) { @@ -535,7 +544,7 @@ void ScInterpreter::ScFloor() void ScInterpreter::ScEven() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScEven" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScEven" ); double fVal = GetDouble(); if (fVal < 0.0) PushDouble(::rtl::math::approxFloor(fVal/2.0) * 2.0); @@ -545,7 +554,7 @@ void ScInterpreter::ScEven() void ScInterpreter::ScOdd() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScOdd" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScOdd" ); double fVal = GetDouble(); if (fVal >= 0.0) { @@ -564,7 +573,7 @@ void ScInterpreter::ScOdd() void ScInterpreter::ScArcTan2() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcTan2" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcTan2" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { double nVal2 = GetDouble(); @@ -575,7 +584,7 @@ void ScInterpreter::ScArcTan2() void ScInterpreter::ScLog() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLog" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLog" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { @@ -594,7 +603,7 @@ void ScInterpreter::ScLog() void ScInterpreter::ScLn() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLn" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLn" ); double fVal = GetDouble(); if (fVal > 0.0) PushDouble(log(fVal)); @@ -604,7 +613,7 @@ void ScInterpreter::ScLn() void ScInterpreter::ScLog10() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLog10" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLog10" ); double fVal = GetDouble(); if (fVal > 0.0) PushDouble(log10(fVal)); @@ -614,7 +623,7 @@ void ScInterpreter::ScLog10() void ScInterpreter::ScNPV() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNPV" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNPV" ); nFuncFmtType = NUMBERFORMAT_CURRENCY; short nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 2, 31 ) ) @@ -682,7 +691,7 @@ void ScInterpreter::ScNPV() void ScInterpreter::ScIRR() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIRR" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIRR" ); double fSchaetzwert; nFuncFmtType = NUMBERFORMAT_PERCENT; BYTE nParamCount = GetByte(); @@ -825,7 +834,7 @@ void ScInterpreter::ScISPMT() double ScInterpreter::ScGetBw(double fZins, double fZzr, double fRmz, double fZw, double fF) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMIRR" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMIRR" ); double fBw; if (fZins == 0.0) fBw = fZw + fRmz * fZzr; @@ -841,7 +850,7 @@ double ScInterpreter::ScGetBw(double fZins, double fZzr, double fRmz, void ScInterpreter::ScBW() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBW" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBW" ); nFuncFmtType = NUMBERFORMAT_CURRENCY; double nRmz, nZzr, nZins, nZw = 0, nFlag = 0; BYTE nParamCount = GetByte(); @@ -859,7 +868,7 @@ void ScInterpreter::ScBW() void ScInterpreter::ScDIA() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDIA" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDIA" ); nFuncFmtType = NUMBERFORMAT_CURRENCY; if ( MustHaveParamCount( GetByte(), 4 ) ) { @@ -876,7 +885,7 @@ void ScInterpreter::ScDIA() double ScInterpreter::ScGetGDA(double fWert, double fRest, double fDauer, double fPeriode, double fFaktor) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetGDA" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetGDA" ); double fGda, fZins, fAlterWert, fNeuerWert; fZins = fFaktor / fDauer; if (fZins >= 1.0) @@ -902,7 +911,7 @@ double ScInterpreter::ScGetGDA(double fWert, double fRest, double fDauer, void ScInterpreter::ScGDA() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGDA" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGDA" ); nFuncFmtType = NUMBERFORMAT_CURRENCY; BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 4, 5 ) ) @@ -926,7 +935,7 @@ void ScInterpreter::ScGDA() void ScInterpreter::ScGDA2() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGDA2" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGDA2" ); nFuncFmtType = NUMBERFORMAT_CURRENCY; BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 4, 5 ) ) @@ -973,7 +982,7 @@ void ScInterpreter::ScGDA2() double ScInterpreter::ScInterVDB(double fWert,double fRest,double fDauer, double fDauer1,double fPeriode,double fFaktor) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScInterVDB" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScInterVDB" ); double fVdb=0; double fIntEnd = ::rtl::math::approxCeil(fPeriode); ULONG nLoopEnd = (ULONG) fIntEnd; @@ -1024,7 +1033,7 @@ inline double DblMin( double a, double b ) void ScInterpreter::ScVDB() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVDB" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVDB" ); nFuncFmtType = NUMBERFORMAT_CURRENCY; BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 5, 7 ) ) @@ -1101,7 +1110,7 @@ void ScInterpreter::ScVDB() void ScInterpreter::ScLaufz() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLaufz" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLaufz" ); if ( MustHaveParamCount( GetByte(), 3 ) ) { double nZukunft = GetDouble(); @@ -1113,7 +1122,7 @@ void ScInterpreter::ScLaufz() void ScInterpreter::ScLIA() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLIA" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLIA" ); nFuncFmtType = NUMBERFORMAT_CURRENCY; if ( MustHaveParamCount( GetByte(), 3 ) ) { @@ -1127,7 +1136,7 @@ void ScInterpreter::ScLIA() double ScInterpreter::ScGetRmz(double fZins, double fZzr, double fBw, double fZw, double fF) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetRmz" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetRmz" ); double fRmz; if (fZins == 0.0) fRmz = (fBw + fZw) / fZzr; @@ -1146,7 +1155,7 @@ double ScInterpreter::ScGetRmz(double fZins, double fZzr, double fBw, void ScInterpreter::ScRMZ() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRMZ" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRMZ" ); double nZins, nZzr, nBw, nZw = 0, nFlag = 0; nFuncFmtType = NUMBERFORMAT_CURRENCY; BYTE nParamCount = GetByte(); @@ -1164,7 +1173,7 @@ void ScInterpreter::ScRMZ() void ScInterpreter::ScZGZ() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZGZ" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZGZ" ); nFuncFmtType = NUMBERFORMAT_PERCENT; if ( MustHaveParamCount( GetByte(), 3 ) ) { @@ -1178,7 +1187,7 @@ void ScInterpreter::ScZGZ() double ScInterpreter::ScGetZw(double fZins, double fZzr, double fRmz, double fBw, double fF) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetZw" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetZw" ); double fZw; if (fZins == 0.0) fZw = fBw + fRmz * fZzr; @@ -1195,7 +1204,7 @@ double ScInterpreter::ScGetZw(double fZins, double fZzr, double fRmz, void ScInterpreter::ScZW() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZW" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZW" ); double nZins, nZzr, nRmz, nBw = 0, nFlag = 0; nFuncFmtType = NUMBERFORMAT_CURRENCY; BYTE nParamCount = GetByte(); @@ -1213,7 +1222,7 @@ void ScInterpreter::ScZW() void ScInterpreter::ScZZR() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZZR" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZZR" ); double nZins, nRmz, nBw, nZw = 0, nFlag = 0; BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 3, 5 ) ) @@ -1237,7 +1246,7 @@ void ScInterpreter::ScZZR() bool ScInterpreter::RateIteration( double fNper, double fPayment, double fPv, double fFv, double fPayType, double & fGuess ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::RateIteration" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::RateIteration" ); // See also #i15090# // Newton-Raphson method: x(i+1) = x(i) - f(x(i)) / f'(x(i)) // This solution handles integer and non-integer values of Nper different. @@ -1331,7 +1340,7 @@ bool ScInterpreter::RateIteration( double fNper, double fPayment, double fPv, // In Calc UI it is the function RATE(Nper;Pmt;Pv;Fv;Type;Guess) void ScInterpreter::ScZins() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZins" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZins" ); double fPv, fPayment, fNper; // defaults for missing arguments, see ODFF spec double fFv = 0, fPayType = 0, fGuess = 0.1; @@ -1366,7 +1375,7 @@ void ScInterpreter::ScZins() double ScInterpreter::ScGetZinsZ(double fZins, double fZr, double fZzr, double fBw, double fZw, double fF, double& fRmz) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetZinsZ" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetZinsZ" ); fRmz = ScGetRmz(fZins, fZzr, fBw, fZw, fF); // fuer kapz auch bei fZr == 1 double fZinsZ; nFuncFmtType = NUMBERFORMAT_CURRENCY; @@ -1389,7 +1398,7 @@ double ScInterpreter::ScGetZinsZ(double fZins, double fZr, double fZzr, double f void ScInterpreter::ScZinsZ() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZinsZ" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZinsZ" ); double nZins, nZr, nRmz, nZzr, nBw, nZw = 0, nFlag = 0; nFuncFmtType = NUMBERFORMAT_CURRENCY; BYTE nParamCount = GetByte(); @@ -1411,7 +1420,7 @@ void ScInterpreter::ScZinsZ() void ScInterpreter::ScKapz() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKapz" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKapz" ); double nZins, nZr, nZzr, nBw, nZw = 0, nFlag = 0, nRmz, nZinsz; nFuncFmtType = NUMBERFORMAT_CURRENCY; BYTE nParamCount = GetByte(); @@ -1436,7 +1445,7 @@ void ScInterpreter::ScKapz() void ScInterpreter::ScKumZinsZ() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKumZinsZ" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKumZinsZ" ); nFuncFmtType = NUMBERFORMAT_CURRENCY; if ( MustHaveParamCount( GetByte(), 6 ) ) { @@ -1477,7 +1486,7 @@ void ScInterpreter::ScKumZinsZ() void ScInterpreter::ScKumKapZ() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKumKapZ" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKumKapZ" ); nFuncFmtType = NUMBERFORMAT_CURRENCY; if ( MustHaveParamCount( GetByte(), 6 ) ) { @@ -1519,7 +1528,7 @@ void ScInterpreter::ScKumKapZ() void ScInterpreter::ScEffektiv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScEffektiv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScEffektiv" ); nFuncFmtType = NUMBERFORMAT_PERCENT; if ( MustHaveParamCount( GetByte(), 2 ) ) { @@ -1537,7 +1546,7 @@ void ScInterpreter::ScEffektiv() void ScInterpreter::ScNominal() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNominal" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNominal" ); nFuncFmtType = NUMBERFORMAT_PERCENT; if ( MustHaveParamCount( GetByte(), 2 ) ) { @@ -1555,13 +1564,24 @@ void ScInterpreter::ScNominal() void ScInterpreter::ScMod() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMod" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMod" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { - double nVal2 = GetDouble(); - double nVal1 = GetDouble(); - PushDouble( ::rtl::math::approxSub( nVal1, - ::rtl::math::approxFloor(nVal1 / nVal2) * nVal2)); + double fVal2 = GetDouble(); // Denominator + double fVal1 = GetDouble(); // Numerator + if (fVal2 == floor(fVal2)) // a pure integral number stored in double + { + double fResult = fmod(fVal1,fVal2); + if ( (fResult != 0.0) && + ((fVal1 > 0.0 && fVal2 < 0.0) || (fVal1 < 0.0 && fVal2 > 0.0))) + fResult += fVal2 ; + PushDouble( fResult ); + } + else + { + PushDouble( ::rtl::math::approxSub( fVal1, + ::rtl::math::approxFloor(fVal1 / fVal2) * fVal2)); + } } } @@ -1582,7 +1602,7 @@ void ScInterpreter::ScMod() */ void ScInterpreter::ScBackSolver() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBackSolver" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBackSolver" ); if ( MustHaveParamCount( GetByte(), 3 ) ) { BOOL bDoneIteration = FALSE; @@ -1786,7 +1806,7 @@ void ScInterpreter::ScBackSolver() void ScInterpreter::ScIntersect() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIntersect" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIntersect" ); formula::FormulaTokenRef p2nd = PopToken(); formula::FormulaTokenRef p1st = PopToken(); @@ -1934,7 +1954,7 @@ void ScInterpreter::ScIntersect() void ScInterpreter::ScRangeFunc() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRangeFunc" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRangeFunc" ); formula::FormulaTokenRef x2 = PopToken(); formula::FormulaTokenRef x1 = PopToken(); @@ -1953,7 +1973,7 @@ void ScInterpreter::ScRangeFunc() void ScInterpreter::ScUnionFunc() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScUnionFunc" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScUnionFunc" ); formula::FormulaTokenRef p2nd = PopToken(); formula::FormulaTokenRef p1st = PopToken(); @@ -2031,7 +2051,7 @@ void ScInterpreter::ScUnionFunc() void ScInterpreter::ScCurrent() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCurrent" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCurrent" ); FormulaTokenRef xTok( PopToken()); if (xTok) { @@ -2044,7 +2064,7 @@ void ScInterpreter::ScCurrent() void ScInterpreter::ScStyle() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScStyle" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScStyle" ); BYTE nParamCount = GetByte(); if (nParamCount >= 1 && nParamCount <= 3) { @@ -2105,7 +2125,7 @@ ScDdeLink* lcl_GetDdeLink( SvxLinkManager* pLinkMgr, void ScInterpreter::ScDde() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDde" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDde" ); // Applikation, Datei, Bereich // Application, Topic, Item @@ -2471,7 +2491,7 @@ void ScInterpreter::ScRoman() BOOL lcl_GetArabicValue( sal_Unicode cChar, USHORT& rnValue, BOOL& rbIsDec ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBase" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBase" ); switch( cChar ) { case 'M': rnValue = 1000; rbIsDec = TRUE; break; @@ -2489,7 +2509,7 @@ BOOL lcl_GetArabicValue( sal_Unicode cChar, USHORT& rnValue, BOOL& rbIsDec ) void ScInterpreter::ScArabic() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArabic" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArabic" ); String aRoman( GetString() ); if( nGlobalError ) PushError( nGlobalError); @@ -2546,18 +2566,89 @@ void ScInterpreter::ScArabic() void ScInterpreter::ScHyperLink() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScHyperLink" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScHyperLink" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { - String aCellText = GetString(); - ScMatrixRef pResMat = GetNewMat(1,2); - pResMat->PutString(aCellText,0); - pResMat->PutString((nParamCount == 2) ? GetString() : aCellText, 1); + double fVal = 0.0; + String aStr; + ScMatValType nResultType = SC_MATVAL_STRING; + + if ( nParamCount == 2 ) + { + switch ( GetStackType() ) + { + case svDouble: + fVal = GetDouble(); + nResultType = SC_MATVAL_VALUE; + break; + case svString: + aStr = GetString(); + break; + case svSingleRef: + case svDoubleRef: + { + ScAddress aAdr; + if ( !PopDoubleRefOrSingleRef( aAdr ) ) + break; + ScBaseCell* pCell = GetCell( aAdr ); + if (HasCellEmptyData( pCell)) + nResultType = SC_MATVAL_EMPTY; + else + { + USHORT nErr = GetCellErrCode( pCell ); + if (nErr) + SetError( nErr); + else if (HasCellValueData( pCell)) + { + fVal = GetCellValue( aAdr, pCell ); + nResultType = SC_MATVAL_VALUE; + } + else + GetCellString( aStr, pCell ); + } + } + break; + case svMatrix: + nResultType = GetDoubleOrStringFromMatrix( fVal, aStr); + break; + case svMissing: + case svEmptyCell: + Pop(); + // mimic xcl + fVal = 0.0; + nResultType = SC_MATVAL_VALUE; + break; + default: + PopError(); + SetError( errIllegalArgument); + } + } + String aUrl = GetString(); + ScMatrixRef pResMat = GetNewMat( 1, 2); + if (nGlobalError) + { + fVal = CreateDoubleError( nGlobalError); + nResultType = SC_MATVAL_VALUE; + } + if (nParamCount == 2 || nGlobalError) + { + if (ScMatrix::IsValueType( nResultType)) + pResMat->PutDouble( fVal, 0); + else if (ScMatrix::IsRealStringType( nResultType)) + pResMat->PutString( aStr, 0); + else // EmptyType, EmptyPathType, mimic xcl + pResMat->PutDouble( 0.0, 0 ); + } + else + pResMat->PutString( aUrl, 0 ); + pResMat->PutString( aUrl, 1 ); bMatrixFormula = true; PushMatrix(pResMat); } } + + BOOL lclConvertMoney( const String& aSearchUnit, double& rfRate, int& rnDec ) { struct ConvertInfo @@ -2782,7 +2873,7 @@ void lclAppendBlock( ByteString& rText, sal_Int32 nValue ) void ScInterpreter::ScBahtText() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBahtText" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBahtText" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1 ) ) { @@ -2851,7 +2942,7 @@ void ScInterpreter::ScBahtText() void ScInterpreter::ScGetPivotData() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetPivotData" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetPivotData" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 2, 30 ) ) diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index e7435c4a1546..4d4a59509fca 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -188,13 +188,13 @@ double lcl_IterateInverse( const ScDistFunc& rFunction, double fAx, double fBx, void ScInterpreter::ScNoName() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNoName" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNoName" ); PushError(errNoName); } void ScInterpreter::ScBadName() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBadName" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBadName" ); short nParamCount = GetByte(); while (nParamCount-- > 0) { @@ -205,13 +205,18 @@ void ScInterpreter::ScBadName() double ScInterpreter::phi(double x) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::phi" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::phi" ); return 0.39894228040143268 * exp(-(x * x) / 2.0); } +double ScInterpreter::integralPhi(double x) +{ // Using gauss(x)+0.5 has severe cancellation errors for x<-4 + return 0.5 * ::rtl::math::erfc(-x * 0.7071067811865475); // * 1/sqrt(2) +} + double ScInterpreter::taylor(double* pPolynom, USHORT nMax, double x) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::taylor" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::taylor" ); double nVal = pPolynom[nMax]; for (short i = nMax-1; i >= 0; i--) { @@ -222,7 +227,7 @@ double ScInterpreter::taylor(double* pPolynom, USHORT nMax, double x) double ScInterpreter::gauss(double x) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::gauss" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::gauss" ); double t0[] = { 0.39894228040143268, -0.06649038006690545, 0.00997355701003582, -0.00118732821548045, 0.00011543468761616, -0.00000944465625950, @@ -270,7 +275,7 @@ double ScInterpreter::gauss(double x) double ScInterpreter::gaussinv(double x) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::gaussinv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::gaussinv" ); double q,t,z; q=x-0.5; @@ -442,7 +447,7 @@ double ScInterpreter::gaussinv(double x) double ScInterpreter::Fakultaet(double x) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Fakultaet" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Fakultaet" ); x = ::rtl::math::approxFloor(x); if (x < 0.0) return 0.0; @@ -468,7 +473,7 @@ double ScInterpreter::Fakultaet(double x) double ScInterpreter::BinomKoeff(double n, double k) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::BinomKoeff" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::BinomKoeff" ); double nVal = 0.0; k = ::rtl::math::approxFloor(k); if (n < k) @@ -606,7 +611,7 @@ double lcl_GetLogGammaHelper(double fZ) /** You must ensure non integer arguments for fZ<1 */ double ScInterpreter::GetGamma(double fZ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetGamma" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGamma" ); const double fLogPi = log(F_PI); const double fLogDblMax = log( ::std::numeric_limits::max()); @@ -652,7 +657,7 @@ double ScInterpreter::GetGamma(double fZ) /** You must ensure fZ>0 */ double ScInterpreter::GetLogGamma(double fZ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetLogGamma" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetLogGamma" ); if (fZ >= fMaxGammaArgument) return lcl_GetLogGammaHelper(fZ); if (fZ >= 1.0) @@ -664,7 +669,7 @@ double ScInterpreter::GetLogGamma(double fZ) double ScInterpreter::GetFDist(double x, double fF1, double fF2) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetFDist" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetFDist" ); double arg = fF2/(fF2+fF1*x); double alpha = fF2/2.0; double beta = fF1/2.0; @@ -678,7 +683,7 @@ double ScInterpreter::GetFDist(double x, double fF1, double fF2) double ScInterpreter::GetTDist(double T, double fDF) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetTDist" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetTDist" ); return 0.5 * GetBetaDist(fDF/(fDF+T*T), fDF/2.0, 0.5); /* USHORT DF = (USHORT) fDF; @@ -717,7 +722,7 @@ double ScInterpreter::GetTDist(double T, double fDF) /** You must ensure fDF>0.0 */ double ScInterpreter::GetChiDist(double fX, double fDF) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetChiDist" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetChiDist" ); if (fX <= 0.0) return 1.0; // see ODFF else @@ -730,7 +735,7 @@ double ScInterpreter::GetChiDist(double fX, double fDF) /** You must ensure fDF>0.0 */ double ScInterpreter::GetChiSqDistCDF(double fX, double fDF) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetChiSqDistCDF" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetChiSqDistCDF" ); if (fX <= 0.0) return 0.0; // see ODFF else @@ -801,7 +806,7 @@ void ScInterpreter::ScChiSqDist() void ScInterpreter::ScGamma() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGamma" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGamma" ); double x = GetDouble(); double fResult; if (x <= 0.0 && x == ::rtl::math::approxFloor(x)) @@ -821,7 +826,7 @@ void ScInterpreter::ScGamma() void ScInterpreter::ScLogGamma() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLogGamma" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLogGamma" ); double x = GetDouble(); if (x > 0.0) // constraint from ODFF PushDouble( GetLogGamma(x)); @@ -1125,19 +1130,19 @@ double ScInterpreter::GetBetaDist(double fXin, double fAlpha, double fBeta) void ScInterpreter::ScPhi() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPhi" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPhi" ); PushDouble(phi(GetDouble())); } void ScInterpreter::ScGauss() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGauss" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGauss" ); PushDouble(gauss(GetDouble())); } void ScInterpreter::ScFisher() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFisher" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFisher" ); double fVal = GetDouble(); if (fabs(fVal) >= 1.0) PushIllegalArgument(); @@ -1147,13 +1152,13 @@ void ScInterpreter::ScFisher() void ScInterpreter::ScFisherInv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFisherInv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFisherInv" ); PushDouble( tanh( GetDouble())); } void ScInterpreter::ScFact() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFact" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFact" ); double nVal = GetDouble(); if (nVal < 0.0) PushIllegalArgument(); @@ -1163,7 +1168,7 @@ void ScInterpreter::ScFact() void ScInterpreter::ScKombin() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKombin" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKombin" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { double k = ::rtl::math::approxFloor(GetDouble()); @@ -1177,7 +1182,7 @@ void ScInterpreter::ScKombin() void ScInterpreter::ScKombin2() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKombin2" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKombin2" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { double k = ::rtl::math::approxFloor(GetDouble()); @@ -1191,7 +1196,7 @@ void ScInterpreter::ScKombin2() void ScInterpreter::ScVariationen() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVariationen" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVariationen" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { double k = ::rtl::math::approxFloor(GetDouble()); @@ -1212,7 +1217,7 @@ void ScInterpreter::ScVariationen() void ScInterpreter::ScVariationen2() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVariationen2" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVariationen2" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { double k = ::rtl::math::approxFloor(GetDouble()); @@ -1226,7 +1231,7 @@ void ScInterpreter::ScVariationen2() void ScInterpreter::ScB() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScB" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScB" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 3, 4 ) ) return ; @@ -1279,8 +1284,8 @@ void ScInterpreter::ScB() // double nVal = fabs(gauss(xs / Varianz) - gauss(xe / Varianz)); // PushDouble(nVal); // } - if (xe <= n && xs <= xe && - p < 1.0 && p > 0.0 && n >= 0.0 && xs >= 0.0 ) + bool bIsValidX = ( 0.0 <= xs && xs <= xe && xe <= n); + if ( bIsValidX && 0.0 < p && p < 1.0 ) { double q = 1.0 - p; double fFactor = pow(q, n); @@ -1342,13 +1347,25 @@ void ScInterpreter::ScB() } } else - PushIllegalArgument(); + { + if ( bIsValidX ) // not(0= 3 ? GetDouble() : 1.0; // standard deviation + double mue = nParamCount >= 2 ? GetDouble() : 0.0; // mean + double x = GetDouble(); // x + if (sigma <= 0.0) { - double sigma = GetDouble(); // Stdabw - double mue = GetDouble(); // Mittelwert - double x = GetDouble(); // x - if (sigma < 0.0) - PushError( errIllegalArgument); - else if (sigma == 0.0) - PushError( errDivisionByZero); - else if (x <= 0.0) + PushIllegalArgument(); + return; + } + if (bCumulative) + { // cumulative + if (x <= 0.0) + PushDouble(0.0); + else + PushDouble(integralPhi((log(x)-mue)/sigma)); + } + else + { // density + if (x <= 0.0) PushIllegalArgument(); else - PushDouble(0.5 + gauss((log(x)-mue)/sigma)); + PushDouble(phi((log(x)-mue)/sigma)/sigma/x); } } void ScInterpreter::ScStdNormDist() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScStdNormDist" ); - PushDouble(0.5 + gauss(GetDouble())); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScStdNormDist" ); + PushDouble(integralPhi(GetDouble())); } void ScInterpreter::ScExpDist() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScExpDist" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScExpDist" ); if ( MustHaveParamCount( GetByte(), 3 ) ) { double kum = GetDouble(); // 0 oder 1 @@ -1570,7 +1600,7 @@ void ScInterpreter::ScExpDist() void ScInterpreter::ScTDist() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTDist" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTDist" ); if ( !MustHaveParamCount( GetByte(), 3 ) ) return; double fFlag = ::rtl::math::approxFloor(GetDouble()); @@ -1590,7 +1620,7 @@ void ScInterpreter::ScTDist() void ScInterpreter::ScFDist() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFDist" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFDist" ); if ( !MustHaveParamCount( GetByte(), 3 ) ) return; double fF2 = ::rtl::math::approxFloor(GetDouble()); @@ -1606,7 +1636,7 @@ void ScInterpreter::ScFDist() void ScInterpreter::ScChiDist() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScChiDist" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScChiDist" ); double fResult; if ( !MustHaveParamCount( GetByte(), 2 ) ) return; @@ -1628,7 +1658,7 @@ void ScInterpreter::ScChiDist() void ScInterpreter::ScWeibull() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScWeibull" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScWeibull" ); if ( MustHaveParamCount( GetByte(), 4 ) ) { double kum = GetDouble(); // 0 oder 1 @@ -1647,43 +1677,61 @@ void ScInterpreter::ScWeibull() void ScInterpreter::ScPoissonDist() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPoissonDist" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPoissonDist" ); BYTE nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 2, 3 ) ) { - double kum = (nParamCount == 3 ? GetDouble() : 1); // 0 oder 1 - double lambda = GetDouble(); // Mittelwert - double x = ::rtl::math::approxFloor(GetDouble()); // x + bool bCumulative = (nParamCount == 3 ? GetBool() : true); // default cumulative + double lambda = GetDouble(); // Mean + double x = ::rtl::math::approxFloor(GetDouble()); // discrete distribution if (lambda < 0.0 || x < 0.0) PushIllegalArgument(); - else if (kum == 0.0) // Dichte + else if (!bCumulative) // Probability mass function { if (lambda == 0.0) PushInt(0); else { - double fPoissonVar = 1.0; - for ( double f = 0.0; f < x; ++f ) - fPoissonVar *= lambda / ( f + 1.0 ); - PushDouble( fPoissonVar*exp( -lambda ) ); + if (lambda >712) // underflow in exp(-lambda) + { // accuracy 11 Digits + PushDouble( exp(x*log(lambda)-lambda-GetLogGamma(x+1.0))); + } + else + { + double fPoissonVar = 1.0; + for ( double f = 0.0; f < x; ++f ) + fPoissonVar *= lambda / ( f + 1.0 ); + PushDouble( fPoissonVar * exp( -lambda ) ); + } } } - else // Verteilung + else // Cumulative distribution function { if (lambda == 0.0) PushInt(1); else { - double sum = 1.0; - double fFak = 1.0; - ULONG nEnd = (ULONG) x; - for (ULONG i = 1; i <= nEnd; i++) + if (lambda > 712 ) // underflow in exp(-lambda) + { // accuracy 12 Digits + PushDouble(GetUpRegIGamma(x+1.0,lambda)); + } + else { - fFak *= (double)i; - sum += pow( lambda, (double)i ) / fFak; + if (x >= 936.0) // result is always undistinghable from 1 + PushDouble (1.0); + else + { + double fSummand = exp(-lambda); + double fSum = fSummand; + int nEnd = sal::static_int_cast( x ); + for (int i = 1; i <= nEnd; i++) + { + fSummand = (fSummand * lambda)/(double)i; + fSum += fSummand; + } + PushDouble(fSum); + } } - sum *= exp(-lambda); - PushDouble(sum); } } } @@ -1716,7 +1764,7 @@ void lcl_PutFactorialElements( ::std::vector< double >& cn, double fLower, doubl */ void ScInterpreter::ScHypGeomDist() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScHypGeomDist" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScHypGeomDist" ); const size_t nMaxArraySize = 500000; // arbitrary max array size if ( !MustHaveParamCount( GetByte(), 4 ) ) @@ -1931,7 +1979,7 @@ void ScInterpreter::ScHypGeomDist() void ScInterpreter::ScGammaDist() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGammaDist" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGammaDist" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 3, 4 ) ) return; @@ -1956,7 +2004,7 @@ void ScInterpreter::ScGammaDist() void ScInterpreter::ScNormInv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNormInv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNormInv" ); if ( MustHaveParamCount( GetByte(), 3 ) ) { double sigma = GetDouble(); @@ -1973,7 +2021,7 @@ void ScInterpreter::ScNormInv() void ScInterpreter::ScSNormInv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSNormInv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSNormInv" ); double x = GetDouble(); if (x < 0.0 || x > 1.0) PushIllegalArgument(); @@ -1985,7 +2033,7 @@ void ScInterpreter::ScSNormInv() void ScInterpreter::ScLogNormInv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLogNormInv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLogNormInv" ); if ( MustHaveParamCount( GetByte(), 3 ) ) { double sigma = GetDouble(); // Stdabw @@ -2012,7 +2060,7 @@ public: void ScInterpreter::ScGammaInv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGammaInv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGammaInv" ); if ( !MustHaveParamCount( GetByte(), 3 ) ) return; double fBeta = GetDouble(); @@ -2051,7 +2099,7 @@ public: void ScInterpreter::ScBetaInv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBetaInv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBetaInv" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 3, 5 ) ) return; @@ -2105,7 +2153,7 @@ public: void ScInterpreter::ScTInv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTInv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTInv" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; double fDF = ::rtl::math::approxFloor(GetDouble()); @@ -2138,7 +2186,7 @@ public: void ScInterpreter::ScFInv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFInv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFInv" ); if ( !MustHaveParamCount( GetByte(), 3 ) ) return; double fF2 = ::rtl::math::approxFloor(GetDouble()); @@ -2172,7 +2220,7 @@ public: void ScInterpreter::ScChiInv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScChiInv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScChiInv" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; double fDF = ::rtl::math::approxFloor(GetDouble()); @@ -2228,7 +2276,7 @@ void ScInterpreter::ScChiSqInv() void ScInterpreter::ScConfidence() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScConfidence" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScConfidence" ); if ( MustHaveParamCount( GetByte(), 3 ) ) { double n = ::rtl::math::approxFloor(GetDouble()); @@ -2243,7 +2291,7 @@ void ScInterpreter::ScConfidence() void ScInterpreter::ScZTest() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZTest" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZTest" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 2, 3 ) ) return; @@ -2352,9 +2400,12 @@ void ScInterpreter::ScZTest() { mue = fSum/rValCount; if (nParamCount != 3) + { sigma = (fSumSqr - fSum*fSum/rValCount)/(rValCount-1.0); - - PushDouble(0.5 - gauss((mue-x)/sqrt(sigma/rValCount))); + PushDouble(0.5 - gauss((mue-x)/sqrt(sigma/rValCount))); + } + else + PushDouble(0.5 - gauss((mue-x)*sqrt(rValCount)/sigma)); } } bool ScInterpreter::CalculateTest(BOOL _bTemplin @@ -2362,7 +2413,7 @@ bool ScInterpreter::CalculateTest(BOOL _bTemplin ,const ScMatrixRef& pMat1,const ScMatrixRef& pMat2 ,double& fT,double& fF) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateTest" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateTest" ); double fCount1 = 0.0; double fCount2 = 0.0; double fSum1 = 0.0; @@ -2430,7 +2481,7 @@ bool ScInterpreter::CalculateTest(BOOL _bTemplin } void ScInterpreter::ScTTest() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTTest" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTTest" ); if ( !MustHaveParamCount( GetByte(), 4 ) ) return; double fTyp = ::rtl::math::approxFloor(GetDouble()); @@ -2510,7 +2561,7 @@ void ScInterpreter::ScTTest() void ScInterpreter::ScFTest() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFTest" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFTest" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; ScMatrixRef pMat2 = GetMatrix(); @@ -2589,7 +2640,7 @@ void ScInterpreter::ScFTest() void ScInterpreter::ScChiTest() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScChiTest" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScChiTest" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; ScMatrixRef pMat2 = GetMatrix(); @@ -2662,7 +2713,7 @@ void ScInterpreter::ScChiTest() void ScInterpreter::ScKurt() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKurt" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKurt" ); double fSum,fCount,vSum; std::vector values; if ( !CalculateSkew(fSum,fCount,vSum,values) ) @@ -2704,7 +2755,7 @@ void ScInterpreter::ScKurt() void ScInterpreter::ScHarMean() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScHarMean" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScHarMean" ); short nParamCount = GetByte(); double nVal = 0.0; double nValCount = 0.0; @@ -2824,7 +2875,7 @@ void ScInterpreter::ScHarMean() void ScInterpreter::ScGeoMean() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGeoMean" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGeoMean" ); short nParamCount = GetByte(); double nVal = 0.0; double nValCount = 0.0; @@ -2945,7 +2996,7 @@ void ScInterpreter::ScGeoMean() void ScInterpreter::ScStandard() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScStandard" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScStandard" ); if ( MustHaveParamCount( GetByte(), 3 ) ) { double sigma = GetDouble(); @@ -2961,7 +3012,7 @@ void ScInterpreter::ScStandard() } bool ScInterpreter::CalculateSkew(double& fSum,double& fCount,double& vSum,std::vector& values) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateSkew" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateSkew" ); short nParamCount = GetByte(); if ( !MustHaveParamCountMin( nParamCount, 1 ) ) return false; @@ -3066,7 +3117,7 @@ bool ScInterpreter::CalculateSkew(double& fSum,double& fCount,double& vSum,std:: void ScInterpreter::ScSkew() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSkew" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSkew" ); double fSum,fCount,vSum; std::vector values; if ( !CalculateSkew(fSum,fCount,vSum,values) ) @@ -3123,7 +3174,7 @@ double ScInterpreter::GetMedian( vector & rArray ) void ScInterpreter::ScMedian() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMedian" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMedian" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCountMin( nParamCount, 1 ) ) return; @@ -3165,7 +3216,7 @@ double ScInterpreter::GetPercentile( vector & rArray, double fPercentile void ScInterpreter::ScPercentile() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPercentile" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPercentile" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; double alpha = GetDouble(); @@ -3181,7 +3232,7 @@ void ScInterpreter::ScPercentile() void ScInterpreter::ScQuartile() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScQuartile" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScQuartile" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; double fFlag = ::rtl::math::approxFloor(GetDouble()); @@ -3197,7 +3248,7 @@ void ScInterpreter::ScQuartile() void ScInterpreter::ScModalValue() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScModalValue" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScModalValue" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCountMin( nParamCount, 1 ) ) return; @@ -3243,7 +3294,7 @@ void ScInterpreter::ScModalValue() void ScInterpreter::CalculateSmallLarge(BOOL bSmall) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateSmallLarge" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateSmallLarge" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; double f = ::rtl::math::approxFloor(GetDouble()); @@ -3274,19 +3325,19 @@ void ScInterpreter::CalculateSmallLarge(BOOL bSmall) void ScInterpreter::ScLarge() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLarge" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLarge" ); CalculateSmallLarge(FALSE); } void ScInterpreter::ScSmall() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSmall" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSmall" ); CalculateSmallLarge(TRUE); } void ScInterpreter::ScPercentrank() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPercentrank" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPercentrank" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 2 ) ) return; @@ -3361,7 +3412,7 @@ void ScInterpreter::ScPercentrank() void ScInterpreter::ScTrimMean() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTrimMean" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTrimMean" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; double alpha = GetDouble(); @@ -3391,7 +3442,7 @@ void ScInterpreter::ScTrimMean() void ScInterpreter::GetNumberSequenceArray( BYTE nParamCount, vector& rArray ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetSortArray" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetSortArray" ); ScAddress aAdr; ScRange aRange; short nParam = nParamCount; @@ -3537,7 +3588,7 @@ static void lcl_QuickSort( long nLo, long nHi, vector& rSortArray, vecto void ScInterpreter::QuickSort( vector& rSortArray, vector* pIndexOrder ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::QuickSort" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::QuickSort" ); long n = static_cast(rSortArray.size()); if (pIndexOrder) @@ -3565,7 +3616,7 @@ void ScInterpreter::QuickSort( vector& rSortArray, vector* pIndexO void ScInterpreter::ScRank() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRank" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRank" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 2, 3 ) ) return; @@ -3685,7 +3736,7 @@ void ScInterpreter::ScRank() void ScInterpreter::ScAveDev() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAveDev" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAveDev" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCountMin( nParamCount, 1 ) ) return; @@ -3840,7 +3891,7 @@ void ScInterpreter::ScAveDev() void ScInterpreter::ScDevSq() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDevSq" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDevSq" ); double nVal; double nValCount; GetStVarParams(nVal, nValCount); @@ -3849,7 +3900,7 @@ void ScInterpreter::ScDevSq() void ScInterpreter::ScProbability() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScProbability" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScProbability" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 3, 4 ) ) return; @@ -3913,25 +3964,25 @@ void ScInterpreter::ScProbability() void ScInterpreter::ScCorrel() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCorrel" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCorrel" ); // This is identical to ScPearson() ScPearson(); } void ScInterpreter::ScCovar() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCovar" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCovar" ); CalculatePearsonCovar(FALSE,FALSE); } void ScInterpreter::ScPearson() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPearson" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPearson" ); CalculatePearsonCovar(TRUE,FALSE); } void ScInterpreter::CalculatePearsonCovar(BOOL _bPearson,BOOL _bStexy) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculatePearsonCovar" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculatePearsonCovar" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; ScMatrixRef pMat1 = GetMatrix(); @@ -4017,7 +4068,7 @@ void ScInterpreter::CalculatePearsonCovar(BOOL _bPearson,BOOL _bStexy) void ScInterpreter::ScRSQ() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRSQ" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRSQ" ); // Same as ScPearson()*ScPearson() ScPearson(); if (!nGlobalError) @@ -4039,12 +4090,12 @@ void ScInterpreter::ScRSQ() void ScInterpreter::ScSTEXY() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSTEXY" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSTEXY" ); CalculatePearsonCovar(TRUE,TRUE); } void ScInterpreter::CalculateSlopeIntercept(BOOL bSlope) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateSlopeIntercept" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateSlopeIntercept" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; ScMatrixRef pMat1 = GetMatrix(); @@ -4116,19 +4167,19 @@ void ScInterpreter::CalculateSlopeIntercept(BOOL bSlope) void ScInterpreter::ScSlope() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSlope" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSlope" ); CalculateSlopeIntercept(TRUE); } void ScInterpreter::ScIntercept() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIntercept" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIntercept" ); CalculateSlopeIntercept(FALSE); } void ScInterpreter::ScForecast() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScForecast" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScForecast" ); if ( !MustHaveParamCount( GetByte(), 3 ) ) return; ScMatrixRef pMat1 = GetMatrix(); diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index a73fe62998a6..a5644985206f 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -99,7 +99,7 @@ ScSpew ScInterpreter::theSpew; void ScInterpreter::ReplaceCell( ScAddress& rPos ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ReplaceCell" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ReplaceCell" ); ScInterpreterTableOpParams* pTOp = pDok->aTableOpList.First(); while (pTOp) { @@ -121,7 +121,7 @@ void ScInterpreter::ReplaceCell( ScAddress& rPos ) void ScInterpreter::ReplaceCell( SCCOL& rCol, SCROW& rRow, SCTAB& rTab ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ReplaceCell" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ReplaceCell" ); ScAddress aCellPos( rCol, rRow, rTab ); ScInterpreterTableOpParams* pTOp = pDok->aTableOpList.First(); while (pTOp) @@ -148,7 +148,7 @@ void ScInterpreter::ReplaceCell( SCCOL& rCol, SCROW& rRow, SCTAB& rTab ) BOOL ScInterpreter::IsTableOpInRange( const ScRange& rRange ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::IsTableOpInRange" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::IsTableOpInRange" ); if ( rRange.aStart == rRange.aEnd ) return FALSE; // not considered to be a range in TableOp sense @@ -168,7 +168,7 @@ BOOL ScInterpreter::IsTableOpInRange( const ScRange& rRange ) ULONG ScInterpreter::GetCellNumberFormat( const ScAddress& rPos, const ScBaseCell* pCell) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetCellNumberFormat" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetCellNumberFormat" ); ULONG nFormat; USHORT nErr; if ( pCell ) @@ -193,10 +193,10 @@ ULONG ScInterpreter::GetCellNumberFormat( const ScAddress& rPos, const ScBaseCel } -// nur ValueCell, Formelzellen speichern das Ergebnis bereits gerundet +/// Only ValueCell, formula cells already store the result rounded. double ScInterpreter::GetValueCellValue( const ScAddress& rPos, const ScValueCell* pCell ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetValueCellValue" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetValueCellValue" ); double fVal = pCell->GetValue(); if ( bCalcAsShown && fVal != 0.0 ) { @@ -207,9 +207,207 @@ double ScInterpreter::GetValueCellValue( const ScAddress& rPos, const ScValueCel } +/** Convert string content to numeric value. + + Converted are only integer numbers including exponent, and ISO 8601 dates + and times in their extended formats with separators. Anything else, + especially fractional numeric values with decimal separators or dates other + than ISO 8601 would be locale dependent and is a no-no. Leading and + trailing blanks are ignored. + + The following ISO 8601 formats are converted: + + CCYY-MM-DD + CCYY-MM-DDThh:mm + CCYY-MM-DDThh:mm:ss + CCYY-MM-DDThh:mm:ss,s + CCYY-MM-DDThh:mm:ss.s + hh:mm + hh:mm:ss + hh:mm:ss,s + hh:mm:ss.s + + The century CC may not be omitted and the two-digit year setting is not + taken into account. Instead of the T date and time separator exactly one + blank may be used. + + If a date is given, it must be a valid Gregorian calendar date. In this + case the optional time must be in the range 00:00 to 23:59:59.99999... + If only time is given, it may have any value for hours, taking elapsed time + into account; minutes and seconds are limited to the value 59 as well. + */ + +double ScInterpreter::ConvertStringToValue( const String& rStr ) +{ + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ConvertStringToValue" ); + double fValue = 0.0; + ::rtl::OUString aStr( rStr); + rtl_math_ConversionStatus eStatus; + sal_Int32 nParseEnd; + // Decimal and group separator 0 => only integer and possibly exponent, + // stops at first non-digit non-sign. + fValue = ::rtl::math::stringToDouble( aStr, 0, 0, &eStatus, &nParseEnd); + sal_Int32 nLen; + if (eStatus == rtl_math_ConversionStatus_Ok && nParseEnd < (nLen = aStr.getLength())) + { + // Not at string end, check for trailing blanks or switch to date or + // time parsing or bail out. + const sal_Unicode* const pStart = aStr.getStr(); + const sal_Unicode* p = pStart + nParseEnd; + const sal_Unicode* const pStop = pStart + nLen; + switch (*p++) + { + case ' ': + while (p < pStop && *p == ' ') + ++p; + if (p < pStop) + SetError( errNoValue); + break; + case '-': + case ':': + { + bool bDate = (*(p-1) == '-'); + enum State { year = 0, month, day, hour, minute, second, fraction, done, blank, stop }; + sal_Int32 nUnit[done] = {0,0,0,0,0,0,0}; + const sal_Int32 nLimit[done] = {0,12,31,0,59,59,0}; + State eState = (bDate ? month : minute); + nCurFmtType = (bDate ? NUMBERFORMAT_DATE : NUMBERFORMAT_TIME); + nUnit[eState-1] = aStr.copy( 0, nParseEnd).toInt32(); + const sal_Unicode* pLastStart = p; + // Ensure there's no preceding sign. Negative dates + // currently aren't handled correctly. Also discard + // +CCYY-MM-DD + p = pStart; + while (p < pStop && *p == ' ') + ++p; + if (p < pStop && !CharClass::isAsciiDigit(*p)) + SetError( errNoValue); + p = pLastStart; + while (p < pStop && !nGlobalError && eState < blank) + { + if (eState == minute) + nCurFmtType |= NUMBERFORMAT_TIME; + if (CharClass::isAsciiDigit(*p)) + { + // Maximum 2 digits per unit, except fractions. + if (p - pLastStart >= 2 && eState != fraction) + SetError( errNoValue); + } + else if (p > pLastStart) + { + // We had at least one digit. + if (eState < done) + { + nUnit[eState] = aStr.copy( pLastStart - pStart, p - pLastStart).toInt32(); + if (nLimit[eState] && nLimit[eState] < nUnit[eState]) + SetError( errNoValue); + } + pLastStart = p + 1; // hypothetical next start + // Delimiters must match, a trailing delimiter + // yields an invalid date/time. + switch (eState) + { + case month: + // Month must be followed by separator and + // day, no trailing blanks. + if (*p != '-' || (p+1 == pStop)) + SetError( errNoValue); + break; + case day: + if ((*p != 'T' || (p+1 == pStop)) && *p != ' ') + SetError( errNoValue); + // Take one blank as a valid delimiter + // between date and time. + break; + case hour: + // Hour must be followed by separator and + // minute, no trailing blanks. + if (*p != ':' || (p+1 == pStop)) + SetError( errNoValue); + break; + case minute: + if ((*p != ':' || (p+1 == pStop)) && *p != ' ') + SetError( errNoValue); + if (*p == ' ') + eState = done; + break; + case second: + if (((*p != ',' && *p != '.') || (p+1 == pStop)) && *p != ' ') + SetError( errNoValue); + if (*p == ' ') + eState = done; + break; + case fraction: + eState = done; + break; + case year: + case done: + case blank: + case stop: + SetError( errNoValue); + break; + } + eState = static_cast(eState + 1); + } + else + SetError( errNoValue); + ++p; + } + if (eState == blank) + { + while (p < pStop && *p == ' ') + ++p; + if (p < pStop) + SetError( errNoValue); + eState = stop; + } + + // Month without day, or hour without minute. + if (eState == month || (eState == day && p <= pLastStart) || + eState == hour || (eState == minute && p <= pLastStart)) + SetError( errNoValue); + + if (!nGlobalError) + { + // Catch the very last unit at end of string. + if (p > pLastStart && eState < done) + { + nUnit[eState] = aStr.copy( pLastStart - pStart, p - pLastStart).toInt32(); + if (nLimit[eState] && nLimit[eState] < nUnit[eState]) + SetError( errNoValue); + } + if (bDate && nUnit[hour] > 23) + SetError( errNoValue); + if (!nGlobalError) + { + if (bDate && nUnit[day] == 0) + nUnit[day] = 1; + double fFraction = (nUnit[fraction] <= 0 ? 0.0 : + ::rtl::math::pow10Exp( nUnit[fraction], + static_cast( -ceil( log10( static_cast( nUnit[fraction])))))); + fValue = (bDate ? GetDateSerial( + sal::static_int_cast(nUnit[year]), + sal::static_int_cast(nUnit[month]), + sal::static_int_cast(nUnit[day]), + true) : 0.0); + fValue += ((nUnit[hour] * 3600) + (nUnit[minute] * 60) + nUnit[second] + fFraction) / 86400.0; + } + } + } + break; + default: + SetError( errNoValue); + } + if (nGlobalError) + fValue = 0.0; + } + return fValue; +} + + double ScInterpreter::GetCellValue( const ScAddress& rPos, const ScBaseCell* pCell ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetCellValue" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetCellValue" ); USHORT nErr = nGlobalError; nGlobalError = 0; double nVal = GetCellValueOrZero( rPos, pCell ); @@ -221,8 +419,8 @@ double ScInterpreter::GetCellValue( const ScAddress& rPos, const ScBaseCell* pCe double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCell* pCell ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetCellValueOrZero" ); - double fValue; + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetCellValueOrZero" ); + double fValue = 0.0; if (pCell) { CellType eType = pCell->GetCellType(); @@ -242,8 +440,9 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCel } else { - SetError(errCellNoValue); - fValue = 0.0; + String aStr; + pFCell->GetString( aStr ); + fValue = ConvertStringToValue( aStr ); } } else @@ -264,26 +463,28 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCel break; case CELLTYPE_STRING: case CELLTYPE_EDIT: -#if 0 -// Xcl does it, but SUM(A1:A2) differs from A1+A2. No good. { + // SUM(A1:A2) differs from A1+A2. No good. But people insist on + // it ... #i5658# String aStr; if ( eType == CELLTYPE_STRING ) ((ScStringCell*)pCell)->GetString( aStr ); else ((ScEditCell*)pCell)->GetString( aStr ); - sal_uInt32 nFIndex = 0; // damit default Land/Spr. - if ( !pFormatter->IsNumberFormat( aStr, nFIndex, fValue ) ) - { - SetError(errNoValue); - fValue = 0.0; - } + fValue = ConvertStringToValue( aStr ); } break; + case CELLTYPE_NONE: + case CELLTYPE_NOTE: + fValue = 0.0; // empty or broadcaster cell + break; + case CELLTYPE_SYMBOLS: +#if DBG_UTIL + case CELLTYPE_DESTROYED: #endif - default: SetError(errCellNoValue); fValue = 0.0; + break; } } else @@ -294,7 +495,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCel void ScInterpreter::GetCellString( String& rStr, const ScBaseCell* pCell ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetCellString" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetCellString" ); USHORT nErr = 0; if (pCell) { @@ -345,7 +546,7 @@ void ScInterpreter::GetCellString( String& rStr, const ScBaseCell* pCell ) BOOL ScInterpreter::CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, BYTE* pCellArr) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CreateDoubleArr" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CreateDoubleArr" ); #if SC_ROWLIMIT_MORE_THAN_64K #error row limit 64k #endif @@ -426,7 +627,7 @@ BOOL ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, BYTE* pCellArr) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CreateStringArr" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CreateStringArr" ); #if SC_ROWLIMIT_MORE_THAN_64K #error row limit 64k #endif @@ -521,7 +722,7 @@ BOOL ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, BYTE* pCellArr) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CreateCellArr" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CreateCellArr" ); #if SC_ROWLIMIT_MORE_THAN_64K #error row limit 64k #endif @@ -642,7 +843,7 @@ BOOL ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, void ScInterpreter::PushWithoutError( FormulaToken& r ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushWithoutError" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushWithoutError" ); if ( sp >= MAXSTACK ) SetError( errStackOverflow ); else @@ -660,7 +861,7 @@ void ScInterpreter::PushWithoutError( FormulaToken& r ) void ScInterpreter::Push( FormulaToken& r ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Push" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Push" ); if ( sp >= MAXSTACK ) SetError( errStackOverflow ); else @@ -683,7 +884,7 @@ void ScInterpreter::Push( FormulaToken& r ) void ScInterpreter::PushTempToken( FormulaToken* p ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushTempToken" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushTempToken" ); if ( sp >= MAXSTACK ) { SetError( errStackOverflow ); @@ -716,7 +917,7 @@ void ScInterpreter::PushTempToken( FormulaToken* p ) void ScInterpreter::PushTempTokenWithoutError( FormulaToken* p ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushTempTokenWithoutError" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushTempTokenWithoutError" ); p->IncRef(); if ( sp >= MAXSTACK ) { @@ -738,7 +939,7 @@ void ScInterpreter::PushTempTokenWithoutError( FormulaToken* p ) void ScInterpreter::PushTempToken( const FormulaToken& r ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushTempToken" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushTempToken" ); if (!IfErrorPushError()) PushTempTokenWithoutError( r.Clone()); } @@ -747,7 +948,7 @@ void ScInterpreter::PushTempToken( const FormulaToken& r ) void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString, const ScAddress & rAddress, short * pRetTypeExpr, ULONG * pRetIndexExpr ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushCellResultToken" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushCellResultToken" ); ScBaseCell* pCell = pDok->GetCell( rAddress); if (!pCell || pCell->HasEmptyData()) { @@ -792,7 +993,7 @@ void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString, void ScInterpreter::Pop() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Pop" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Pop" ); if( sp ) sp--; else @@ -804,7 +1005,7 @@ void ScInterpreter::Pop() void ScInterpreter::PopError() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopError" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopError" ); if( sp ) { sp--; @@ -818,7 +1019,7 @@ void ScInterpreter::PopError() FormulaTokenRef ScInterpreter::PopToken() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopToken" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopToken" ); if (sp) { sp--; @@ -835,7 +1036,7 @@ FormulaTokenRef ScInterpreter::PopToken() double ScInterpreter::PopDouble() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDouble" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDouble" ); nCurFmtType = NUMBERFORMAT_NUMBER; nCurFmtIndex = 0; if( sp ) @@ -864,7 +1065,7 @@ double ScInterpreter::PopDouble() const String& ScInterpreter::PopString() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopString" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopString" ); nCurFmtType = NUMBERFORMAT_TEXT; nCurFmtIndex = 0; if( sp ) @@ -893,7 +1094,7 @@ const String& ScInterpreter::PopString() void ScInterpreter::ValidateRef( const ScSingleRefData & rRef ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ValidateRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ValidateRef" ); SCCOL nCol; SCROW nRow; SCTAB nTab; @@ -903,7 +1104,7 @@ void ScInterpreter::ValidateRef( const ScSingleRefData & rRef ) void ScInterpreter::ValidateRef( const ScComplexRefData & rRef ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ValidateRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ValidateRef" ); ValidateRef( rRef.Ref1); ValidateRef( rRef.Ref2); } @@ -911,7 +1112,7 @@ void ScInterpreter::ValidateRef( const ScComplexRefData & rRef ) void ScInterpreter::ValidateRef( const ScRefList & rRefList ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ValidateRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ValidateRef" ); ScRefList::const_iterator it( rRefList.begin()); ScRefList::const_iterator end( rRefList.end()); for ( ; it != end; ++it) @@ -924,7 +1125,7 @@ void ScInterpreter::ValidateRef( const ScRefList & rRefList ) void ScInterpreter::SingleRefToVars( const ScSingleRefData & rRef, SCCOL & rCol, SCROW & rRow, SCTAB & rTab ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::SingleRefToVars" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::SingleRefToVars" ); if ( rRef.IsColRel() ) rCol = aPos.Col() + rRef.nRelCol; else @@ -948,7 +1149,7 @@ void ScInterpreter::SingleRefToVars( const ScSingleRefData & rRef, void ScInterpreter::PopSingleRef(SCCOL& rCol, SCROW &rRow, SCTAB& rTab) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopSingleRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopSingleRef" ); if( sp ) { --sp; @@ -974,7 +1175,7 @@ void ScInterpreter::PopSingleRef(SCCOL& rCol, SCROW &rRow, SCTAB& rTab) void ScInterpreter::PopSingleRef( ScAddress& rAdr ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopSingleRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopSingleRef" ); if( sp ) { --sp; @@ -1009,7 +1210,7 @@ void ScInterpreter::DoubleRefToVars( const ScToken* p, SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2, BOOL bDontCheckForTableOp ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::DoubleRefToVars" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::DoubleRefToVars" ); const ScComplexRefData& rCRef = p->GetDoubleRef(); SingleRefToVars( rCRef.Ref1, rCol1, rRow1, rTab1); SingleRefToVars( rCRef.Ref2, rCol2, rRow2, rTab2); @@ -1026,7 +1227,7 @@ void ScInterpreter::PopDoubleRef(SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1, SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2, BOOL bDontCheckForTableOp ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDoubleRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDoubleRef" ); if( sp ) { --sp; @@ -1052,7 +1253,7 @@ void ScInterpreter::PopDoubleRef(SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1, void ScInterpreter::DoubleRefToRange( const ScComplexRefData & rCRef, ScRange & rRange, BOOL bDontCheckForTableOp ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::DoubleRefToRange" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::DoubleRefToRange" ); SCCOL nCol; SCROW nRow; SCTAB nTab; @@ -1070,7 +1271,7 @@ void ScInterpreter::DoubleRefToRange( const ScComplexRefData & rCRef, void ScInterpreter::PopDoubleRef( ScRange & rRange, short & rParam, size_t & rRefInList ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDoubleRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDoubleRef" ); if (sp) { formula::FormulaToken* pToken = pStack[ sp-1 ]; @@ -1117,7 +1318,7 @@ void ScInterpreter::PopDoubleRef( ScRange & rRange, short & rParam, size_t & rRe void ScInterpreter::PopDoubleRef( ScRange& rRange, BOOL bDontCheckForTableOp ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDoubleRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDoubleRef" ); if( sp ) { --sp; @@ -1141,7 +1342,7 @@ void ScInterpreter::PopDoubleRef( ScRange& rRange, BOOL bDontCheckForTableOp ) BOOL ScInterpreter::PopDoubleRefOrSingleRef( ScAddress& rAdr ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDoubleRefOrSingleRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDoubleRefOrSingleRef" ); switch ( GetStackType() ) { case svDoubleRef : @@ -1167,7 +1368,7 @@ BOOL ScInterpreter::PopDoubleRefOrSingleRef( ScAddress& rAdr ) void ScInterpreter::PopDoubleRefPushMatrix() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDoubleRefPushMatrix" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDoubleRefPushMatrix" ); if ( GetStackType() == svDoubleRef ) { ScMatrixRef pMat = GetMatrix(); @@ -1183,14 +1384,14 @@ void ScInterpreter::PopDoubleRefPushMatrix() ScTokenMatrixMap* ScInterpreter::CreateTokenMatrixMap() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CreateTokenMatrixMap" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CreateTokenMatrixMap" ); return new ScTokenMatrixMap; } bool ScInterpreter::ConvertMatrixParameters() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ConvertMatrixParameters" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ConvertMatrixParameters" ); USHORT nParams = pCur->GetParamCount(); DBG_ASSERT( nParams <= sp, "ConvertMatrixParameters: stack/param count mismatch"); SCSIZE nJumpCols = 0, nJumpRows = 0; @@ -1237,7 +1438,8 @@ bool ScInterpreter::ConvertMatrixParameters() { ScParameterClassification::Type eType = ScParameterClassification::GetParameterType( pCur, nParams - i); - if ( eType != ScParameterClassification::Reference ) + if ( eType != ScParameterClassification::Reference && + eType != ScParameterClassification::ReferenceOrForceArray) { SCCOL nCol1, nCol2; SCROW nRow1, nRow2; @@ -1268,7 +1470,8 @@ bool ScInterpreter::ConvertMatrixParameters() { ScParameterClassification::Type eType = ScParameterClassification::GetParameterType( pCur, nParams - i); - if ( eType != ScParameterClassification::Reference ) + if ( eType != ScParameterClassification::Reference && + eType != ScParameterClassification::ReferenceOrForceArray) { // can't convert to matrix SetError( errNoValue); @@ -1320,7 +1523,7 @@ bool ScInterpreter::ConvertMatrixParameters() ScMatrixRef ScInterpreter::PopMatrix() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopMatrix" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopMatrix" ); if( sp ) { --sp; @@ -1351,7 +1554,7 @@ ScMatrixRef ScInterpreter::PopMatrix() void ScInterpreter::PushDouble(double nVal) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushDouble" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushDouble" ); TreatDoubleError( nVal ); if (!IfErrorPushError()) PushTempTokenWithoutError( new FormulaDoubleToken( nVal ) ); @@ -1360,7 +1563,7 @@ void ScInterpreter::PushDouble(double nVal) void ScInterpreter::PushInt(int nVal) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushInt" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushInt" ); if (!IfErrorPushError()) PushTempTokenWithoutError( new FormulaDoubleToken( nVal ) ); } @@ -1368,7 +1571,7 @@ void ScInterpreter::PushInt(int nVal) void ScInterpreter::PushStringBuffer( const sal_Unicode* pString ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushStringBuffer" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushStringBuffer" ); if ( pString ) PushString( String( pString ) ); else @@ -1378,7 +1581,7 @@ void ScInterpreter::PushStringBuffer( const sal_Unicode* pString ) void ScInterpreter::PushString( const String& rString ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushString" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushString" ); if (!IfErrorPushError()) PushTempTokenWithoutError( new FormulaStringToken( rString ) ); } @@ -1386,7 +1589,7 @@ void ScInterpreter::PushString( const String& rString ) void ScInterpreter::PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushSingleRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushSingleRef" ); if (!IfErrorPushError()) { ScSingleRefData aRef; @@ -1402,7 +1605,7 @@ void ScInterpreter::PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab) void ScInterpreter::PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushDoubleRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushDoubleRef" ); if (!IfErrorPushError()) { ScComplexRefData aRef; @@ -1420,7 +1623,7 @@ void ScInterpreter::PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, void ScInterpreter::PushMatrix(ScMatrix* pMat) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushMatrix" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushMatrix" ); pMat->SetErrorInterpreter( NULL); // No if (!IfErrorPushError()) because ScMatrix stores errors itself, // but with notifying ScInterpreter via nGlobalError, substituting it would @@ -1433,56 +1636,56 @@ void ScInterpreter::PushMatrix(ScMatrix* pMat) void ScInterpreter::PushError( USHORT nError ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushError" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushError" ); SetError( nError ); // only sets error if not already set PushTempTokenWithoutError( new FormulaErrorToken( nGlobalError)); } void ScInterpreter::PushParameterExpected() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushParameterExpected" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushParameterExpected" ); PushError( errParameterExpected); } void ScInterpreter::PushIllegalParameter() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushIllegalParameter" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushIllegalParameter" ); PushError( errIllegalParameter); } void ScInterpreter::PushIllegalArgument() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushIllegalArgument" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushIllegalArgument" ); PushError( errIllegalArgument); } void ScInterpreter::PushNA() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushNA" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushNA" ); PushError( NOTAVAILABLE); } void ScInterpreter::PushNoValue() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushNoValue" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushNoValue" ); PushError( errNoValue); } BOOL ScInterpreter::IsMissing() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::IsMissing" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::IsMissing" ); return sp && pStack[sp - 1]->GetType() == svMissing; } StackVar ScInterpreter::GetRawStackType() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetRawStackType" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetRawStackType" ); StackVar eRes; if( sp ) { @@ -1499,7 +1702,7 @@ StackVar ScInterpreter::GetRawStackType() StackVar ScInterpreter::GetStackType() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetStackType" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetStackType" ); StackVar eRes; if( sp ) { @@ -1518,7 +1721,7 @@ StackVar ScInterpreter::GetStackType() StackVar ScInterpreter::GetStackType( BYTE nParam ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetStackType" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetStackType" ); StackVar eRes; if( sp > nParam-1 ) { @@ -1534,7 +1737,7 @@ StackVar ScInterpreter::GetStackType( BYTE nParam ) BOOL ScInterpreter::DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& rAdr ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::DoubleRefToPosSingleRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::DoubleRefToPosSingleRef" ); // Check for a singleton first - no implicit intersection for them. if( rRange.aStart == rRange.aEnd ) { @@ -1623,7 +1826,7 @@ BOOL ScInterpreter::DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& r double ScInterpreter::GetDouble() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDouble" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDouble" ); double nVal; switch( GetRawStackType() ) { @@ -1631,15 +1834,7 @@ double ScInterpreter::GetDouble() nVal = PopDouble(); break; case svString: - { - String aStr(PopString()); - sal_uInt32 nFIndex = 0; // damit default Land/Spr. - if(!pFormatter->IsNumberFormat( aStr, nFIndex, nVal ) ) - { - SetError( errIllegalArgument); //! fit to ScN() - nVal = 0.0; - } - } + nVal = ConvertStringToValue( PopString()); break; case svSingleRef: { @@ -1707,7 +1902,7 @@ double ScInterpreter::GetDouble() double ScInterpreter::GetDoubleWithDefault(double nDefault) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDoubleWithDefault" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDoubleWithDefault" ); bool bMissing = IsMissing(); double nResultVal = GetDouble(); if ( bMissing ) @@ -1718,7 +1913,7 @@ double ScInterpreter::GetDoubleWithDefault(double nDefault) const String& ScInterpreter::GetString() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetString" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetString" ); switch (GetRawStackType()) { case svError: @@ -1809,7 +2004,7 @@ const String& ScInterpreter::GetString() ScMatValType ScInterpreter::GetDoubleOrStringFromMatrix( double& rDouble, String& rString ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDoubleOrStringFromMatrix" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDoubleOrStringFromMatrix" ); ScMatValType nMatValType = SC_MATVAL_EMPTY; switch ( GetStackType() ) { @@ -1859,7 +2054,7 @@ ScMatValType ScInterpreter::GetDoubleOrStringFromMatrix( double& rDouble, void ScInterpreter::ScDBGet() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBGet" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBGet" ); SCTAB nTab; ScQueryParam aQueryParam; BOOL bMissingField = FALSE; @@ -1937,7 +2132,7 @@ void ScInterpreter::ScDBGet() void ScInterpreter::ScExternal() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScExternal" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScExternal" ); USHORT nIndex; BYTE nParamCount = GetByte(); String aUnoName; @@ -2484,14 +2679,14 @@ void ScInterpreter::ScExternal() void ScInterpreter::ScMissing() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMissing" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMissing" ); PushTempToken( new FormulaMissingToken ); } void ScInterpreter::ScMacro() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMacro" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMacro" ); SbxBase::ResetError(); BYTE nParamCount = GetByte(); @@ -2720,7 +2915,7 @@ void ScInterpreter::ScMacro() BOOL ScInterpreter::SetSbxVariable( SbxVariable* pVar, const ScAddress& rPos ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::SetSbxVariable" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::SetSbxVariable" ); BOOL bOk = TRUE; ScBaseCell* pCell = pDok->GetCell( rPos ); if (pCell) @@ -2778,7 +2973,7 @@ BOOL ScInterpreter::SetSbxVariable( SbxVariable* pVar, const ScAddress& rPos ) void ScInterpreter::ScTableOp() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTableOp" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTableOp" ); BYTE nParamCount = GetByte(); if (nParamCount != 3 && nParamCount != 5) { @@ -2874,7 +3069,7 @@ void ScInterpreter::ScTableOp() void ScInterpreter::ScErrCell() { -RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScErrCell" ); +RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScErrCell" ); double fErrNum = GetDouble(); PushError((USHORT) fErrNum); } @@ -2882,7 +3077,7 @@ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter void ScInterpreter::ScDBArea() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBArea" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBArea" ); ScDBData* pDBData = pDok->GetDBCollection()->FindIndex( pCur->GetIndex()); if (pDBData) { @@ -2904,7 +3099,7 @@ void ScInterpreter::ScDBArea() void ScInterpreter::ScColRowNameAuto() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScColRowNameAuto" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScColRowNameAuto" ); ScComplexRefData aRefData( static_cast(pCur)->GetDoubleRef() ); aRefData.CalcAbsIfRel( aPos ); if ( aRefData.Valid() ) @@ -3065,7 +3260,7 @@ void ScInterpreter::ScExternalRef() void ScInterpreter::ScAnswer() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAnswer" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAnswer" ); String aStr( GetString() ); if( aStr.EqualsIgnoreCaseAscii( "Das Leben, das Universum und der ganze Rest" ) ) { @@ -3079,7 +3274,7 @@ void ScInterpreter::ScAnswer() void ScInterpreter::ScCalcTeam() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCalcTeam" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCalcTeam" ); static BOOL bShown = FALSE; if( !bShown ) { @@ -3097,7 +3292,7 @@ void ScInterpreter::ScCalcTeam() void ScInterpreter::ScSpewFunc() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSpewFunc" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSpewFunc" ); BOOL bRefresh = FALSE; BOOL bClear = FALSE; // Stack aufraeumen @@ -3145,7 +3340,7 @@ extern "C" { static void SAL_CALL thisModule() {} } void ScInterpreter::ScGame() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGame" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGame" ); enum GameType { SC_GAME_NONE, SC_GAME_ONCE, @@ -3374,7 +3569,7 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc, pFormatter( pDoc->GetFormatTable() ), bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTTT" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTTT" ); // pStack = new ScToken*[ MAXSTACK ]; BYTE cMatFlag = pMyFormulaCell->GetMatrixFlag(); @@ -3408,7 +3603,7 @@ ScInterpreter::~ScInterpreter() void ScInterpreter::GlobalExit() // static { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GlobalExit" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GlobalExit" ); DBG_ASSERT(!bGlobalStackInUse, "wer benutzt noch den TokenStack?"); DELETEZ(pGlobalStack); } @@ -3416,7 +3611,7 @@ void ScInterpreter::GlobalExit() // static StackVar ScInterpreter::Interpret() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Interpret" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Interpret" ); short nRetTypeExpr = NUMBERFORMAT_UNDEFINED; ULONG nRetIndexExpr = 0; USHORT nErrorFunction = 0; @@ -3803,6 +3998,8 @@ StackVar ScInterpreter::Interpret() case ocGetPivotData : ScGetPivotData(); break; case ocJis : ScJis(); break; case ocAsc : ScAsc(); break; + case ocUnicode : ScUnicode(); break; + case ocUnichar : ScUnichar(); break; case ocAnswer : ScAnswer(); break; case ocTeam : ScCalcTeam(); break; case ocTTT : ScTTT(); break; diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 5fb45755eb7c..7da4778bfe1a 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -106,7 +106,7 @@ const double fInvEpsilon = 1.0E-7; double ScInterpreter::ScGetGCD(double fx, double fy) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::div" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::div" ); // By ODFF definition GCD(0,a) => a. This is also vital for the code in // ScGCD() to work correctly with a preset fy=0.0 if (fy == 0.0) @@ -128,7 +128,7 @@ double ScInterpreter::ScGetGCD(double fx, double fy) void ScInterpreter::ScGCD() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGCD" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGCD" ); short nParamCount = GetByte(); if ( MustHaveParamCountMin( nParamCount, 1 ) ) { @@ -310,7 +310,7 @@ void ScInterpreter:: ScLCM() ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetNewMat" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetNewMat" ); ScMatrix* pMat = new ScMatrix( nC, nR); pMat->SetErrorInterpreter( this); SCSIZE nCols, nRows; @@ -328,7 +328,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2 ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CreateMatrixFromDoubleRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CreateMatrixFromDoubleRef" ); ScMatrixRef pMat = NULL; if (nTab1 == nTab2 && !nGlobalError) { @@ -449,7 +449,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken ScMatrixRef ScInterpreter::GetMatrix() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetMatrix" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetMatrix" ); ScMatrixRef pMat = NULL; switch (GetRawStackType()) { @@ -532,7 +532,7 @@ ScMatrixRef ScInterpreter::GetMatrix() void ScInterpreter::ScMatValue() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatValue" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatValue" ); if ( MustHaveParamCount( GetByte(), 3 ) ) { // 0 to count-1 @@ -604,7 +604,7 @@ void ScInterpreter::ScMatValue() } void ScInterpreter::CalculateMatrixValue(const ScMatrix* pMat,SCSIZE nC,SCSIZE nR) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateMatrixValue" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateMatrixValue" ); if (pMat) { SCSIZE nCl, nRw; @@ -628,7 +628,7 @@ void ScInterpreter::CalculateMatrixValue(const ScMatrix* pMat,SCSIZE nC,SCSIZE n void ScInterpreter::ScEMat() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScEMat" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScEMat" ); if ( MustHaveParamCount( GetByte(), 1 ) ) { SCSIZE nDim = static_cast(::rtl::math::approxFloor(GetDouble())); @@ -650,7 +650,7 @@ void ScInterpreter::ScEMat() void ScInterpreter::MEMat(ScMatrix* mM, SCSIZE n) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::MEMat" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::MEMat" ); mM->FillDouble(0.0, 0, 0, n-1, n-1); for (SCSIZE i = 0; i < n; i++) mM->PutDouble(1.0, i, i); @@ -660,7 +660,7 @@ void ScInterpreter::MFastMult(ScMatrix* pA, ScMatrix* pB, ScMatrix* pR, SCSIZE n, SCSIZE m, SCSIZE l) // Multipliziert n x m Mat a mit m x l Mat b nach Mat r { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::MFastMult" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::MFastMult" ); double sum; for (SCSIZE i = 0; i < n; i++) { @@ -830,7 +830,7 @@ static void lcl_LUP_solve( const ScMatrix* mLU, const SCSIZE n, void ScInterpreter::ScMatDet() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatDet" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatDet" ); if ( MustHaveParamCount( GetByte(), 1 ) ) { ScMatrixRef pMat = GetMatrix(); @@ -877,7 +877,7 @@ void ScInterpreter::ScMatDet() void ScInterpreter::ScMatInv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatInv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatInv" ); if ( MustHaveParamCount( GetByte(), 1 ) ) { ScMatrixRef pMat = GetMatrix(); @@ -979,7 +979,7 @@ void ScInterpreter::ScMatInv() void ScInterpreter::ScMatMult() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatMult" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatMult" ); if ( MustHaveParamCount( GetByte(), 2 ) ) { ScMatrixRef pMat2 = GetMatrix(); @@ -1029,7 +1029,7 @@ void ScInterpreter::ScMatMult() void ScInterpreter::ScMatTrans() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatTrans" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatTrans" ); if ( MustHaveParamCount( GetByte(), 1 ) ) { ScMatrixRef pMat = GetMatrix(); @@ -1102,7 +1102,7 @@ ScMatrixRef lcl_MatrixCalculation(const _Function& _pOperation,ScMatrix* pMat1, ScMatrixRef ScInterpreter::MatConcat(ScMatrix* pMat1, ScMatrix* pMat2) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::MatConcat" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::MatConcat" ); SCSIZE nC1, nC2, nMinC; SCSIZE nR1, nR2, nMinR; SCSIZE i, j; @@ -1166,12 +1166,12 @@ void lcl_GetDiffDateTimeFmtType( short& nFuncFmt, short nFmt1, short nFmt2 ) void ScInterpreter::ScAdd() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAdd" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAdd" ); CalculateAddSub(FALSE); } void ScInterpreter::CalculateAddSub(BOOL _bSub) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateAddSub" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateAddSub" ); ScMatrixRef pMat1 = NULL; ScMatrixRef pMat2 = NULL; double fVal1 = 0.0, fVal2 = 0.0; @@ -1306,7 +1306,7 @@ void ScInterpreter::CalculateAddSub(BOOL _bSub) void ScInterpreter::ScAmpersand() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAmpersand" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAmpersand" ); ScMatrixRef pMat1 = NULL; ScMatrixRef pMat2 = NULL; String sStr1, sStr2; @@ -1398,13 +1398,13 @@ void ScInterpreter::ScAmpersand() void ScInterpreter::ScSub() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSub" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSub" ); CalculateAddSub(TRUE); } void ScInterpreter::ScMul() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMul" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMul" ); ScMatrixRef pMat1 = NULL; ScMatrixRef pMat2 = NULL; double fVal1 = 0.0, fVal2 = 0.0; @@ -1483,7 +1483,7 @@ void ScInterpreter::ScMul() void ScInterpreter::ScDiv() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDiv" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDiv" ); ScMatrixRef pMat1 = NULL; ScMatrixRef pMat2 = NULL; double fVal1 = 0.0, fVal2 = 0.0; @@ -1574,14 +1574,14 @@ void ScInterpreter::ScDiv() void ScInterpreter::ScPower() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPower" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPower" ); if ( MustHaveParamCount( GetByte(), 2 ) ) ScPow(); } void ScInterpreter::ScPow() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPow" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPow" ); ScMatrixRef pMat1 = NULL; ScMatrixRef pMat2 = NULL; double fVal1 = 0.0, fVal2 = 0.0; @@ -1649,7 +1649,7 @@ void ScInterpreter::ScPow() void ScInterpreter::ScSumProduct() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumProduct" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumProduct" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 1, 30 ) ) return; @@ -1703,12 +1703,12 @@ void ScInterpreter::ScSumProduct() void ScInterpreter::ScSumX2MY2() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumX2MY2" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumX2MY2" ); CalculateSumX2MY2SumX2DY2(FALSE); } void ScInterpreter::CalculateSumX2MY2SumX2DY2(BOOL _bSumX2DY2) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateSumX2MY2SumX2DY2" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateSumX2MY2SumX2DY2" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; @@ -1749,13 +1749,13 @@ void ScInterpreter::CalculateSumX2MY2SumX2DY2(BOOL _bSumX2DY2) void ScInterpreter::ScSumX2DY2() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumX2DY2" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumX2DY2" ); CalculateSumX2MY2SumX2DY2(TRUE); } void ScInterpreter::ScSumXMY2() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumXMY2" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumXMY2" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; @@ -1799,7 +1799,7 @@ void ScInterpreter::ScSumXMY2() void ScInterpreter::ScFrequency() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFrequency" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFrequency" ); if ( !MustHaveParamCount( GetByte(), 2 ) ) return; @@ -1959,7 +1959,7 @@ BOOL ScInterpreter::RGetVariances( ScMatrix* pV, ScMatrix* pX, // ----------------------------------------------------------------------------- void ScInterpreter::Calculate(ScMatrixRef& pResMat,ScMatrixRef& pE,ScMatrixRef& pQ,ScMatrixRef& pV,ScMatrixRef& pMatX,BOOL bConstant,SCSIZE N,SCSIZE M,BYTE nCase) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::RGetVariances" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::RGetVariances" ); // pE[0] := Sigma i=1...n (Yi) // pE[k] := Sigma i=1...n (Xki*Yi) // pE[M+1] := Sigma i=1...n (Yi**2) @@ -2053,7 +2053,7 @@ void ScInterpreter::Calculate(ScMatrixRef& pResMat,ScMatrixRef& pE,ScMatrixRef& void ScInterpreter::ScRGP() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRGP" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRGP" ); CalulateRGPRKP(FALSE); } bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE& nCX,SCSIZE& nCY,SCSIZE& nRX,SCSIZE& nRY,SCSIZE& M,SCSIZE& N,ScMatrixRef& pMatX,ScMatrixRef& pMatY) @@ -2154,7 +2154,7 @@ bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE } void ScInterpreter::CalulateRGPRKP(BOOL _bRKP) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CheckMatrix" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CheckMatrix" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 1, 4 ) ) return; @@ -2353,13 +2353,13 @@ void ScInterpreter::CalulateRGPRKP(BOOL _bRKP) void ScInterpreter::ScRKP() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRKP" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRKP" ); CalulateRGPRKP(TRUE); } // ----------------------------------------------------------------------------- bool ScInterpreter::Calculate4(BOOL _bExp,ScMatrixRef& pResMat,ScMatrixRef& pQ,BOOL bConstant,SCSIZE N,SCSIZE M) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Calculate4" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Calculate4" ); pQ->PutDouble((double)N, 0, 0); if (bConstant) { @@ -2412,7 +2412,7 @@ bool ScInterpreter::Calculate4(BOOL _bExp,ScMatrixRef& pResMat,ScMatrixRef& pQ,B ScMatrixRef ScInterpreter::Calculate2(const BOOL bConstant,const SCSIZE M ,const SCSIZE N,ScMatrixRef& pMatX,ScMatrixRef& pMatY,BYTE nCase) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Calculate2" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Calculate2" ); SCSIZE i, j, k; ScMatrixRef pQ = GetNewMat(M+1, M+2); ScMatrixRef pE = GetNewMat(M+2, 1); @@ -2511,7 +2511,7 @@ ScMatrixRef ScInterpreter::Calculate2(const BOOL bConstant,const SCSIZE M ,const } bool ScInterpreter::Calculate3(const SCSIZE M ,ScMatrixRef& pQ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Calculate3" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Calculate3" ); SCSIZE S, L; for (S = 1; S < M+1; S++) { @@ -2550,12 +2550,12 @@ bool ScInterpreter::Calculate3(const SCSIZE M ,ScMatrixRef& pQ) void ScInterpreter::ScTrend() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTrend" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTrend" ); CalculateTrendGrowth(FALSE); } void ScInterpreter::CalculateTrendGrowth(BOOL _bGrowth) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateTrendGrowth" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateTrendGrowth" ); BYTE nParamCount = GetByte(); if ( !MustHaveParamCount( nParamCount, 1, 4 ) ) return; @@ -2716,13 +2716,13 @@ void ScInterpreter::CalculateTrendGrowth(BOOL _bGrowth) void ScInterpreter::ScGrowth() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGrowth" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGrowth" ); CalculateTrendGrowth(TRUE); } void ScInterpreter::ScMatRef() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatRef" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatRef" ); // Falls Deltarefs drin sind... Push( (FormulaToken&)*pCur ); ScAddress aAdr; @@ -2792,7 +2792,7 @@ void ScInterpreter::ScMatRef() void ScInterpreter::ScInfo() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScInfo" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScInfo" ); if( MustHaveParamCount( GetByte(), 1 ) ) { String aStr = GetString(); diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx index 118b5f0ece68..e8b69a4e6eda 100644 --- a/sc/source/core/tool/interpr6.cxx +++ b/sc/source/core/tool/interpr6.cxx @@ -48,7 +48,7 @@ double const fHalfMachEps = 0.5 * ::std::numeric_limits::epsilon(); uses continued fraction with odd items */ double ScInterpreter::GetGammaContFraction( double fA, double fX ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetGammaContFraction" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGammaContFraction" ); double const fBigInv = ::std::numeric_limits::epsilon(); double const fBig = 1.0/fBigInv; @@ -105,7 +105,7 @@ double ScInterpreter::GetGammaContFraction( double fA, double fX ) uses power series */ double ScInterpreter::GetGammaSeries( double fA, double fX ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetGammaSeries" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGammaSeries" ); double fDenomfactor = fA; double fSummand = 1.0/fA; double fSum = fSummand; @@ -129,7 +129,7 @@ double ScInterpreter::GetGammaSeries( double fA, double fX ) /** You must ensure fA>0.0 && fX>0.0) */ double ScInterpreter::GetLowRegIGamma( double fA, double fX ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetLowRegIGamma" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetLowRegIGamma" ); double fLnFactor = fA * log(fX) - fX - GetLogGamma(fA); double fFactor = exp(fLnFactor); // Do we need more accuracy than exp(ln()) has? if (fX>fA+1.0) // includes fX>1.0; 1-GetUpRegIGamma, continued fraction @@ -141,7 +141,7 @@ double ScInterpreter::GetLowRegIGamma( double fA, double fX ) /** You must ensure fA>0.0 && fX>0.0) */ double ScInterpreter::GetUpRegIGamma( double fA, double fX ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetUpRegIGamma" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetUpRegIGamma" ); double fLnFactor= fA*log(fX)-fX-GetLogGamma(fA); double fFactor = exp(fLnFactor); //Do I need more accuracy than exp(ln()) has?; @@ -156,7 +156,7 @@ double ScInterpreter::GetUpRegIGamma( double fA, double fX ) You must ensure fAlpha>0.0 and fLambda>0.0 */ double ScInterpreter::GetGammaDistPDF( double fX, double fAlpha, double fLambda ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetGammaDistPDF" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGammaDistPDF" ); if (fX <= 0.0) return 0.0; // see ODFF else @@ -194,7 +194,7 @@ double ScInterpreter::GetGammaDistPDF( double fX, double fAlpha, double fLambda You must ensure fAlpha>0.0 and fLambda>0.0 */ double ScInterpreter::GetGammaDist( double fX, double fAlpha, double fLambda ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetGammaDist" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGammaDist" ); if (fX <= 0.0) return 0.0; else diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx index 634c6adbb5cf..5f2094d2f0f7 100644 --- a/sc/source/core/tool/parclass.cxx +++ b/sc/source/core/tool/parclass.cxx @@ -64,138 +64,138 @@ const ScParameterClassification::RawData ScParameterClassification::pRawData[] = // IF() and CHOOSE() are somewhat special, since the ScJumpMatrix is // created inside those functions and ConvertMatrixParameters() is not // called for them. - { ocIf, {{ Array, Reference, Reference }, false }}, - { ocChose, {{ Array, Reference }, true }}, + { ocIf, {{ Array, Reference, Reference }, false }}, + { ocChose, {{ Array, Reference }, true }}, // Other specials. - { ocOpen, {{ Bounds }, false }}, - { ocClose, {{ Bounds }, false }}, - { ocSep, {{ Bounds }, false }}, - { ocNoName, {{ Bounds }, false }}, - { ocErrCell, {{ Bounds }, false }}, - { ocStop, {{ Bounds }, false }}, - { ocUnion, {{ Reference, Reference }, false }}, - { ocRange, {{ Reference, Reference }, false }}, + { ocOpen, {{ Bounds }, false }}, + { ocClose, {{ Bounds }, false }}, + { ocSep, {{ Bounds }, false }}, + { ocNoName, {{ Bounds }, false }}, + { ocErrCell, {{ Bounds }, false }}, + { ocStop, {{ Bounds }, false }}, + { ocUnion, {{ Reference, Reference }, false }}, + { ocRange, {{ Reference, Reference }, false }}, // Functions with Value parameters only but not in resource. - { ocBackSolver, {{ Value, Value, Value }, false }}, - { ocTableOp, {{ Value, Value, Value, Value, Value }, false }}, + { ocBackSolver, {{ Value, Value, Value }, false }}, + { ocTableOp, {{ Value, Value, Value, Value, Value }, false }}, // Operators and functions. - { ocAdd, {{ Array, Array }, false }}, - { ocAmpersand, {{ Array, Array }, false }}, - { ocAnd, {{ Reference }, true }}, - { ocAreas, {{ Reference }, false }}, - { ocAveDev, {{ Reference }, true }}, - { ocAverage, {{ Reference }, true }}, - { ocAverageA, {{ Reference }, true }}, - { ocCell, {{ Value, Reference }, false }}, - { ocColumn, {{ Reference }, false }}, - { ocColumns, {{ Reference }, true }}, - { ocCorrel, {{ ForceArray, ForceArray }, false }}, - { ocCount, {{ Reference }, true }}, - { ocCount2, {{ Reference }, true }}, - { ocCountEmptyCells, {{ Reference }, false }}, - { ocCountIf, {{ Reference, Value }, false }}, - { ocCovar, {{ ForceArray, ForceArray }, false }}, - { ocDBAverage, {{ Reference, Reference, Reference }, false }}, - { ocDBCount, {{ Reference, Reference, Reference }, false }}, - { ocDBCount2, {{ Reference, Reference, Reference }, false }}, - { ocDBGet, {{ Reference, Reference, Reference }, false }}, - { ocDBMax, {{ Reference, Reference, Reference }, false }}, - { ocDBMin, {{ Reference, Reference, Reference }, false }}, - { ocDBProduct, {{ Reference, Reference, Reference }, false }}, - { ocDBStdDev, {{ Reference, Reference, Reference }, false }}, - { ocDBStdDevP, {{ Reference, Reference, Reference }, false }}, - { ocDBSum, {{ Reference, Reference, Reference }, false }}, - { ocDBVar, {{ Reference, Reference, Reference }, false }}, - { ocDBVarP, {{ Reference, Reference, Reference }, false }}, - { ocDevSq, {{ Reference }, true }}, - { ocDiv, {{ Array, Array }, false }}, - { ocEqual, {{ Array, Array }, false }}, - { ocForecast, {{ Value, ForceArray, ForceArray }, false }}, - { ocFrequency, {{ Reference, Reference }, false }}, - { ocFTest, {{ ForceArray, ForceArray }, false }}, - { ocGeoMean, {{ Reference }, true }}, - { ocGCD, {{ Reference }, true }}, - { ocGreater, {{ Array, Array }, false }}, - { ocGreaterEqual, {{ Array, Array }, false }}, - { ocGrowth, {{ Reference, Reference, Reference, Value }, false }}, - { ocHarMean, {{ Reference }, true }}, - { ocHLookup, {{ Value, Reference, Value, Value }, false }}, - { ocIRR, {{ Reference, Value }, false }}, - { ocIndex, {{ Reference, Value, Value, Value }, false }}, - { ocIntercept, {{ ForceArray, ForceArray }, false }}, - { ocIntersect, {{ Reference, Reference }, false }}, - { ocIsRef, {{ Reference }, false }}, - { ocLCM, {{ Reference }, true }}, - { ocKurt, {{ Reference }, true }}, - { ocLarge, {{ Reference, Value }, false }}, - { ocLess, {{ Array, Array }, false }}, - { ocLessEqual, {{ Array, Array }, false }}, - { ocLookup, {{ Value, Reference, Reference }, false }}, - { ocMatch, {{ Value, Reference, Reference }, false }}, - { ocMatDet, {{ ForceArray }, false }}, - { ocMatInv, {{ ForceArray }, false }}, - { ocMatMult, {{ ForceArray, ForceArray }, false }}, - { ocMatTrans, {{ Array }, false }}, // strange, but Xcl doesn't force MatTrans array - { ocMatValue, {{ Reference, Value, Value }, false }}, - { ocMax, {{ Reference }, true }}, - { ocMaxA, {{ Reference }, true }}, - { ocMedian, {{ Reference }, true }}, - { ocMin, {{ Reference }, true }}, - { ocMinA, {{ Reference }, true }}, - { ocMIRR, {{ Reference, Value, Value }, false }}, - { ocModalValue, {{ ForceArray }, true }}, - { ocMul, {{ Array, Array }, false }}, - { ocMultiArea, {{ Reference }, true }}, - { ocN, {{ Reference }, false }}, - { ocNPV, {{ Value, Reference }, true }}, - { ocNeg, {{ Array }, false }}, - { ocNegSub, {{ Array }, false }}, - { ocNot, {{ Array }, false }}, - { ocNotEqual, {{ Array, Array }, false }}, - { ocOffset, {{ Reference, Value, Value, Value, Value }, false }}, - { ocOr, {{ Reference }, true }}, - { ocPearson, {{ ForceArray, ForceArray }, false }}, - { ocPercentile, {{ Reference, Value }, false }}, - { ocPercentrank, {{ Reference, Value }, false }}, - { ocPow, {{ Array, Array }, false }}, - { ocPower, {{ Array, Array }, false }}, - { ocProb, {{ ForceArray, ForceArray, Value, Value }, false }}, - { ocProduct, {{ Reference }, true }}, - { ocQuartile, {{ Reference, Value }, false }}, - { ocRank, {{ Value, Reference, Value }, false }}, - { ocRGP, {{ Reference, Reference, Value, Value }, false }}, - { ocRKP, {{ Reference, Reference, Value, Value }, false }}, - { ocRow, {{ Reference }, false }}, - { ocRows, {{ Reference }, true }}, - { ocRSQ, {{ ForceArray, ForceArray }, false }}, - { ocSchiefe, {{ Reference }, true }}, - { ocSlope, {{ ForceArray, ForceArray }, false }}, - { ocSmall, {{ Reference, Value }, false }}, - { ocStDev, {{ Reference }, true }}, - { ocStDevA, {{ Reference }, true }}, - { ocStDevP, {{ Reference }, true }}, - { ocStDevPA, {{ Reference }, true }}, - { ocSTEYX, {{ ForceArray, ForceArray }, false }}, - { ocSub, {{ Array, Array }, false }}, - { ocSubTotal, {{ Value, Reference }, true }}, - { ocSum, {{ Reference }, true }}, - { ocSumIf, {{ Reference, Value, Reference }, false }}, - { ocSumProduct, {{ ForceArray }, true }}, - { ocSumSQ, {{ Reference }, true }}, - { ocSumX2MY2, {{ ForceArray, ForceArray }, false }}, - { ocSumX2DY2, {{ ForceArray, ForceArray }, false }}, - { ocSumXMY2, {{ ForceArray, ForceArray }, false }}, - { ocTable, {{ Reference }, false }}, - { ocTables, {{ Reference }, true }}, - { ocTrend, {{ Reference, Reference, Reference, Value }, false }}, - { ocTrimMean, {{ Reference, Value }, false }}, - { ocTTest, {{ ForceArray, ForceArray, Value, Value }, false }}, - { ocVar, {{ Reference }, true }}, - { ocVarA, {{ Reference }, true }}, - { ocVarP, {{ Reference }, true }}, - { ocVarPA, {{ Reference }, true }}, - { ocVLookup, {{ Value, Reference, Value, Value }, false }}, - { ocZTest, {{ Reference, Value, Value }, false }}, + { ocAdd, {{ Array, Array }, false }}, + { ocAmpersand, {{ Array, Array }, false }}, + { ocAnd, {{ Reference }, true }}, + { ocAreas, {{ Reference }, false }}, + { ocAveDev, {{ Reference }, true }}, + { ocAverage, {{ Reference }, true }}, + { ocAverageA, {{ Reference }, true }}, + { ocCell, {{ Value, Reference }, false }}, + { ocColumn, {{ Reference }, false }}, + { ocColumns, {{ Reference }, true }}, + { ocCorrel, {{ ForceArray, ForceArray }, false }}, + { ocCount, {{ Reference }, true }}, + { ocCount2, {{ Reference }, true }}, + { ocCountEmptyCells, {{ Reference }, false }}, + { ocCountIf, {{ Reference, Value }, false }}, + { ocCovar, {{ ForceArray, ForceArray }, false }}, + { ocDBAverage, {{ Reference, Reference, Reference }, false }}, + { ocDBCount, {{ Reference, Reference, Reference }, false }}, + { ocDBCount2, {{ Reference, Reference, Reference }, false }}, + { ocDBGet, {{ Reference, Reference, Reference }, false }}, + { ocDBMax, {{ Reference, Reference, Reference }, false }}, + { ocDBMin, {{ Reference, Reference, Reference }, false }}, + { ocDBProduct, {{ Reference, Reference, Reference }, false }}, + { ocDBStdDev, {{ Reference, Reference, Reference }, false }}, + { ocDBStdDevP, {{ Reference, Reference, Reference }, false }}, + { ocDBSum, {{ Reference, Reference, Reference }, false }}, + { ocDBVar, {{ Reference, Reference, Reference }, false }}, + { ocDBVarP, {{ Reference, Reference, Reference }, false }}, + { ocDevSq, {{ Reference }, true }}, + { ocDiv, {{ Array, Array }, false }}, + { ocEqual, {{ Array, Array }, false }}, + { ocForecast, {{ Value, ForceArray, ForceArray }, false }}, + { ocFrequency, {{ Reference, Reference }, false }}, + { ocFTest, {{ ForceArray, ForceArray }, false }}, + { ocGeoMean, {{ Reference }, true }}, + { ocGCD, {{ Reference }, true }}, + { ocGreater, {{ Array, Array }, false }}, + { ocGreaterEqual, {{ Array, Array }, false }}, + { ocGrowth, {{ Reference, Reference, Reference, Value }, false }}, + { ocHarMean, {{ Reference }, true }}, + { ocHLookup, {{ Value, Reference, Value, Value }, false }}, + { ocIRR, {{ Reference, Value }, false }}, + { ocIndex, {{ Reference, Value, Value, Value }, false }}, + { ocIntercept, {{ ForceArray, ForceArray }, false }}, + { ocIntersect, {{ Reference, Reference }, false }}, + { ocIsRef, {{ Reference }, false }}, + { ocLCM, {{ Reference }, true }}, + { ocKurt, {{ Reference }, true }}, + { ocLarge, {{ Reference, Value }, false }}, + { ocLess, {{ Array, Array }, false }}, + { ocLessEqual, {{ Array, Array }, false }}, + { ocLookup, {{ Value, ReferenceOrForceArray, ReferenceOrForceArray }, false }}, + { ocMatch, {{ Value, Reference, Reference }, false }}, + { ocMatDet, {{ ForceArray }, false }}, + { ocMatInv, {{ ForceArray }, false }}, + { ocMatMult, {{ ForceArray, ForceArray }, false }}, + { ocMatTrans, {{ Array }, false }}, // strange, but Xcl doesn't force MatTrans array + { ocMatValue, {{ Reference, Value, Value }, false }}, + { ocMax, {{ Reference }, true }}, + { ocMaxA, {{ Reference }, true }}, + { ocMedian, {{ Reference }, true }}, + { ocMin, {{ Reference }, true }}, + { ocMinA, {{ Reference }, true }}, + { ocMIRR, {{ Reference, Value, Value }, false }}, + { ocModalValue, {{ ForceArray }, true }}, + { ocMul, {{ Array, Array }, false }}, + { ocMultiArea, {{ Reference }, true }}, + { ocN, {{ Reference }, false }}, + { ocNPV, {{ Value, Reference }, true }}, + { ocNeg, {{ Array }, false }}, + { ocNegSub, {{ Array }, false }}, + { ocNot, {{ Array }, false }}, + { ocNotEqual, {{ Array, Array }, false }}, + { ocOffset, {{ Reference, Value, Value, Value, Value }, false }}, + { ocOr, {{ Reference }, true }}, + { ocPearson, {{ ForceArray, ForceArray }, false }}, + { ocPercentile, {{ Reference, Value }, false }}, + { ocPercentrank, {{ Reference, Value }, false }}, + { ocPow, {{ Array, Array }, false }}, + { ocPower, {{ Array, Array }, false }}, + { ocProb, {{ ForceArray, ForceArray, Value, Value }, false }}, + { ocProduct, {{ Reference }, true }}, + { ocQuartile, {{ Reference, Value }, false }}, + { ocRank, {{ Value, Reference, Value }, false }}, + { ocRGP, {{ Reference, Reference, Value, Value }, false }}, + { ocRKP, {{ Reference, Reference, Value, Value }, false }}, + { ocRow, {{ Reference }, false }}, + { ocRows, {{ Reference }, true }}, + { ocRSQ, {{ ForceArray, ForceArray }, false }}, + { ocSchiefe, {{ Reference }, true }}, + { ocSlope, {{ ForceArray, ForceArray }, false }}, + { ocSmall, {{ Reference, Value }, false }}, + { ocStDev, {{ Reference }, true }}, + { ocStDevA, {{ Reference }, true }}, + { ocStDevP, {{ Reference }, true }}, + { ocStDevPA, {{ Reference }, true }}, + { ocSTEYX, {{ ForceArray, ForceArray }, false }}, + { ocSub, {{ Array, Array }, false }}, + { ocSubTotal, {{ Value, Reference }, true }}, + { ocSum, {{ Reference }, true }}, + { ocSumIf, {{ Reference, Value, Reference }, false }}, + { ocSumProduct, {{ ForceArray }, true }}, + { ocSumSQ, {{ Reference }, true }}, + { ocSumX2MY2, {{ ForceArray, ForceArray }, false }}, + { ocSumX2DY2, {{ ForceArray, ForceArray }, false }}, + { ocSumXMY2, {{ ForceArray, ForceArray }, false }}, + { ocTable, {{ Reference }, false }}, + { ocTables, {{ Reference }, true }}, + { ocTrend, {{ Reference, Reference, Reference, Value }, false }}, + { ocTrimMean, {{ Reference, Value }, false }}, + { ocTTest, {{ ForceArray, ForceArray, Value, Value }, false }}, + { ocVar, {{ Reference }, true }}, + { ocVarA, {{ Reference }, true }}, + { ocVarP, {{ Reference }, true }}, + { ocVarPA, {{ Reference }, true }}, + { ocVLookup, {{ Value, Reference, Value, Value }, false }}, + { ocZTest, {{ Reference, Value, Value }, false }}, // Excel doubts: // ocT: Excel says (and handles) Reference, error? This means no position // dependent SingleRef if DoubleRef, and no array calculation, just the @@ -265,7 +265,7 @@ void ScParameterClassification::Init() } for ( size_t j=0; j < CommonData::nMaxParams; ++j ) { - if ( pRun->aData.nParam[j] == ForceArray ) + if ( pRun->aData.nParam[j] == ForceArray || pRun->aData.nParam[j] == ReferenceOrForceArray ) { pRun->bHasForceArray = true; break; // for @@ -537,6 +537,9 @@ void ScParameterClassification::GenerateDocumentation() case ForceArray : aStr += " ForceArray"; break; + case ReferenceOrForceArray : + aStr += " ReferenceOrForceArray"; + break; case Bounds : aStr += " (Bounds, classification error?)"; break; diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 457c31d4ab04..ef15b16030cf 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -31,25 +31,29 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" +// XXX xelink.hxx MUST be included before xeformula.hxx because of the +// redifinition of the CREATE_OUSTRING() macro, which is in oox/helper.hxx +// (indirectly included via xelink.hxx) and ../inc/ftools.hxx (indirectly +// included via xeformula.hxx) that does an undef first. Ugly. +#include "xelink.hxx" +#include "xeformula.hxx" + #include #include +#include +#include "addincol.hxx" #include "compiler.hxx" +#include "document.hxx" +#include "externalrefmgr.hxx" #include "rangelst.hxx" -#include "addincol.hxx" -#include "xestream.hxx" -#include "xehelper.hxx" -#include "xelink.hxx" -#include "xename.hxx" -#include "xeformula.hxx" #include "token.hxx" #include "tokenarray.hxx" +#include "xehelper.hxx" +#include "xename.hxx" +#include "xestream.hxx" -#include "document.hxx" -#include "externalrefmgr.hxx" - -#include +using namespace ::formula; -using namespace formula; // External reference log ===================================================== XclExpRefLogEntry::XclExpRefLogEntry() : @@ -63,90 +67,60 @@ XclExpRefLogEntry::XclExpRefLogEntry() : // Formula compiler =========================================================== -/** Type of token class handling. */ -enum XclExpTokenClassType -{ - EXC_CLASSTYPE_CELL, /// Cell formula, shared formula. - EXC_CLASSTYPE_ARRAY, /// Array formula, conditional formatting, data validation. - EXC_CLASSTYPE_NAME /// Defined name, range list. -}; +namespace { -/** Type of the link manager to be used. */ -enum XclExpLinkMgrType +/** Wrapper structure for a processed Calc formula token with additional + settings (whitespaces). */ +struct XclExpScToken { - EXC_LINKMGRTYPE_NONE, /// No link manager, 2D references only. - EXC_LINKMGRTYPE_LOCAL, /// Local (per-sheet) link manager. - EXC_LINKMGRTYPE_GLOBAL /// Global link manager. + const FormulaToken* mpScToken; /// Currently processed Calc token. + sal_uInt8 mnSpaces; /// Number of spaces before the Calc token. + + inline explicit XclExpScToken() : mpScToken( 0 ), mnSpaces( 0 ) {} + inline bool Is() const { return mpScToken != 0; } + inline StackVar GetType() const { return mpScToken ? mpScToken->GetType() : static_cast< StackVar >( svUnknown ); } + inline OpCode GetOpCode() const { return mpScToken ? mpScToken->GetOpCode() : static_cast< OpCode >( ocNone ); } }; // ---------------------------------------------------------------------------- -/** Configuration data of the formula compiler. */ -struct XclExpCompConfig +/** Effective token class conversion types. */ +enum XclExpClassConv { - XclFormulaType meType; /// Type of the formula to be created. - XclExpTokenClassType meClassType; /// Token class handling type. - XclExpLinkMgrType meLinkMgrType; /// Link manager to be used. - bool mbFromCell; /// True = Any kind of cell formula (cell, array, shared). - bool mb3DRefOnly; /// True = Only 3D references allowed (e.g. names). - bool mbAllowArrays; /// True = Allow inline arrays. + EXC_CLASSCONV_ORG, /// Keep original class of the token. + EXC_CLASSCONV_VAL, /// Convert ARR tokens to VAL class (REF remains uncahnged). + EXC_CLASSCONV_ARR /// Convert VAL tokens to ARR class (REF remains uncahnged). }; // ---------------------------------------------------------------------------- -/** Working data of the formula compiler. Used to push onto a stack for recursive calls. */ -struct XclExpCompData +/** Token class conversion and position of a token in the token array. */ +struct XclExpTokenConvInfo { - typedef ::std::list< const ScMatrix* > ScMatrixList; - typedef ScfRef< ScMatrixList > ScMatrixListRef; - typedef ScfRef< ScTokenArray > ScTokenArrayRef; - - XclExpCompConfig maCfg; /// Configuration for current formula type. - ScfUInt8Vec maTokVec; /// Byte vector containing token data. - ScTokenArrayRef mxOwnScTokArr; /// Own clone of a Calc token array. - XclTokenArrayIterator maTokArrIt; /// Iterator in Calc token array. - XclExpLinkManager* mpLinkMgr; /// Link manager for current context (local/global). - XclExpRefLog* mpRefLog; /// Log for external references. - ScMatrixListRef mxInlineArr; /// List of inline arrays (in reverse order) - - const ScAddress* mpScBasePos; /// Current cell position of the formula. - - // processing data during compilation - sal_uInt16 mnLastTokPos; /// Position of last appended Excel token ID. - sal_uInt8 mnLastDefClass; /// Default class of last appended Excel token ID. - sal_uInt8 mnRefExpClass; /// New class for VAL parameters, if REF is expected. - sal_uInt8 mnValExpClass; /// New class for all parameters, if VAL is expected. - sal_uInt8 mnArrExpClass; /// New class for all parameters, if ARR is expected. - bool mbStopAtSep; /// True = Stop subexpression creation at an ocSep token. - bool mbVolatile; /// True = Formula contains volatile function. - bool mbIsArrExp; /// True = ARR class is expected somewhere before. - bool mbOk; /// Current state of the compiler. - - explicit XclExpCompData(); + sal_uInt16 mnTokPos; /// Position of the token in the token array. + XclFuncParamConv meConv; /// Token class conversion type. + bool mbValType; /// Data type (false = REFTYPE, true = VALTYPE). }; -XclExpCompData::XclExpCompData() : - mpLinkMgr( 0 ), - mpRefLog( 0 ), - mpScBasePos( 0 ), - mbOk( false ) +/** Vector of token position and conversion for all operands of an operator, + or for all parameters of a function. */ +struct XclExpOperandList : public ::std::vector< XclExpTokenConvInfo > { -} - -// ---------------------------------------------------------------------------- + inline explicit XclExpOperandList() { reserve( 2 ); } + void AppendOperand( sal_uInt16 nTokPos, XclFuncParamConv eConv, bool bValType ); +}; -/** Working data for a processed Calc formula token. */ -struct XclExpTokenData +void XclExpOperandList::AppendOperand( sal_uInt16 nTokPos, XclFuncParamConv eConv, bool bValType ) { - const formula::FormulaToken* - mpScToken; /// Currently processed Calc token. - sal_uInt8 mnSpaces; /// Number of spaces before the Calc token. + resize( size() + 1 ); + XclExpTokenConvInfo& rConvInfo = back(); + rConvInfo.mnTokPos = nTokPos; + rConvInfo.meConv = eConv; + rConvInfo.mbValType = bValType; +} - inline explicit XclExpTokenData() : mpScToken( 0 ), mnSpaces( 0 ) {} - inline bool Is() const { return mpScToken != 0; } - inline formula::StackVar GetType() const { return mpScToken ? mpScToken->GetType() : static_cast< formula::StackVar >( svUnknown ); } - inline OpCode GetOpCode() const { return mpScToken ? mpScToken->GetOpCode() : static_cast< OpCode >( ocNone ); } -}; +typedef ScfRef< XclExpOperandList > XclExpOperandListRef; +typedef ::std::vector< XclExpOperandListRef > XclExpOperandListVector; // ---------------------------------------------------------------------------- @@ -175,87 +149,168 @@ class XclExpFuncData { public: explicit XclExpFuncData( - const XclExpTokenData& rTokData, + const XclExpScToken& rTokData, const XclFunctionInfo& rFuncInfo, - const XclExpExtFuncData& rExtFuncData, - sal_uInt8 nExpRetClass ); + const XclExpExtFuncData& rExtFuncData ); - inline const formula::FormulaToken& GetScToken() const { return *mrTokData.mpScToken; } + inline const FormulaToken& GetScToken() const { return *mrTokData.mpScToken; } inline OpCode GetOpCode() const { return mrFuncInfo.meOpCode; } inline sal_uInt16 GetXclFuncIdx() const { return mrFuncInfo.mnXclFunc; } inline bool IsVolatile() const { return mrFuncInfo.IsVolatile(); } + inline bool IsFixedParamCount() const { return mrFuncInfo.IsFixedParamCount(); } inline bool IsMacroFunc() const { return mrFuncInfo.IsMacroFunc(); } inline sal_uInt8 GetSpaces() const { return mrTokData.mnSpaces; } inline const XclExpExtFuncData& GetExtFuncData() const { return maExtFuncData; } - inline sal_uInt8 GetReturnClass() const { return mrFuncInfo.mnRetClass; } - inline sal_uInt8 GetExpReturnClass() const { return mnExpRetClass; } - inline sal_uInt8 GetExpParamClass() const { return mrFuncInfo.mpnParamClass[ mnClassIdx ]; } - void IncExpParamClassIdx(); + const XclFuncParamInfo& GetParamInfo() const; + bool IsCalcOnlyParam() const; + bool IsExcelOnlyParam() const; + void IncParamInfoIdx(); inline sal_uInt8 GetMinParamCount() const { return mrFuncInfo.mnMinParamCount; } inline sal_uInt8 GetMaxParamCount() const { return mrFuncInfo.mnMaxParamCount; } - inline sal_uInt8 GetParamCount() const { return mnParamCount; } - inline void IncParamCount() { ++mnParamCount; } + inline sal_uInt8 GetParamCount() const { return static_cast< sal_uInt8 >( mxOperands->size() ); } + void FinishParam( sal_uInt16 nTokPos ); + inline XclExpOperandListRef GetOperandList() const { return mxOperands; } inline ScfUInt16Vec& GetAttrPosVec() { return maAttrPosVec; } inline void AppendAttrPos( sal_uInt16 nPos ) { maAttrPosVec.push_back( nPos ); } private: ScfUInt16Vec maAttrPosVec; /// Token array positions of tAttr tokens. - const XclExpTokenData& mrTokData; /// Data about processed function name token. + const XclExpScToken& mrTokData; /// Data about processed function name token. const XclFunctionInfo& mrFuncInfo; /// Constant data about processed function. XclExpExtFuncData maExtFuncData; /// Data for external functions (macro, add-in). - sal_uInt8 mnExpRetClass; /// Expected token class for return value. - sal_uInt8 mnClassIdx; /// Index into expected parameter class array of mrFuncInfo. - sal_uInt8 mnParamCount; /// Current number of parameters of a function. + XclExpOperandListRef mxOperands; /// Class conversion and position of all parameters. + const XclFuncParamInfo* mpParamInfo; /// Information for current parameter. }; -XclExpFuncData::XclExpFuncData( - const XclExpTokenData& rTokData, const XclFunctionInfo& rFuncInfo, - const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpRetClass ) : +XclExpFuncData::XclExpFuncData( const XclExpScToken& rTokData, + const XclFunctionInfo& rFuncInfo, const XclExpExtFuncData& rExtFuncData ) : mrTokData( rTokData ), mrFuncInfo( rFuncInfo ), maExtFuncData( rExtFuncData ), - mnExpRetClass( nExpRetClass ), - mnClassIdx( 0 ), - mnParamCount( 0 ) + mxOperands( new XclExpOperandList ), + mpParamInfo( rFuncInfo.mpParamInfos ) { DBG_ASSERT( mrTokData.mpScToken, "XclExpFuncData::XclExpFuncData - missing core token" ); // set name of an add-in function - if( !maExtFuncData.maFuncName.Len() && dynamic_cast< const formula::FormulaExternalToken* >( mrTokData.mpScToken ) ) + if( (maExtFuncData.maFuncName.Len() == 0) && dynamic_cast< const FormulaExternalToken* >( mrTokData.mpScToken ) ) maExtFuncData.Set( GetScToken().GetExternal(), true, false ); } -void XclExpFuncData::IncExpParamClassIdx() +const XclFuncParamInfo& XclExpFuncData::GetParamInfo() const { - if( (mnClassIdx + 1 < EXC_FUNCINFO_CLASSCOUNT) && (mrFuncInfo.mpnParamClass[ mnClassIdx + 1 ] != EXC_TOKCLASS_NONE) ) - ++mnClassIdx; + static const XclFuncParamInfo saInvalidInfo = { EXC_PARAM_NONE, EXC_PARAMCONV_ORG, false }; + return mpParamInfo ? *mpParamInfo : saInvalidInfo; } -// reference handling --------------------------------------------------------- - -namespace { +bool XclExpFuncData::IsCalcOnlyParam() const +{ + return mpParamInfo && (mpParamInfo->meValid == EXC_PARAM_CALCONLY); +} -inline bool lclIsRefRel2D( const ScSingleRefData& rRefData ) +bool XclExpFuncData::IsExcelOnlyParam() const { - return rRefData.IsColRel() || rRefData.IsRowRel(); + return mpParamInfo && (mpParamInfo->meValid == EXC_PARAM_EXCELONLY); } -inline bool lclIsRefDel2D( const ScSingleRefData& rRefData ) +void XclExpFuncData::IncParamInfoIdx() { - return rRefData.IsColDeleted() || rRefData.IsRowDeleted(); + if( mpParamInfo ) + { + // move pointer to next entry, if something explicit follows + if( (static_cast(mpParamInfo - mrFuncInfo.mpParamInfos + 1) < EXC_FUNCINFO_PARAMINFO_COUNT) && (mpParamInfo[ 1 ].meValid != EXC_PARAM_NONE) ) + ++mpParamInfo; + // if last parameter type is 'Excel-only' or 'Calc-only', do not repeat it + else if( IsExcelOnlyParam() || IsCalcOnlyParam() ) + mpParamInfo = 0; + // otherwise: repeat last parameter class + } } -inline bool lclIsRefRel2D( const ScComplexRefData& rRefData ) +void XclExpFuncData::FinishParam( sal_uInt16 nTokPos ) { - return lclIsRefRel2D( rRefData.Ref1 ) || lclIsRefRel2D( rRefData.Ref2 ); + // write token class conversion info for this parameter + const XclFuncParamInfo& rParamInfo = GetParamInfo(); + mxOperands->AppendOperand( nTokPos, rParamInfo.meConv, rParamInfo.mbValType ); + // move to next parameter info structure + IncParamInfoIdx(); } -inline bool lclIsRefDel2D( const ScComplexRefData& rRefData ) +// compiler configuration ----------------------------------------------------- + +/** Type of token class handling. */ +enum XclExpFmlaClassType { - return lclIsRefDel2D( rRefData.Ref1 ) || lclIsRefDel2D( rRefData.Ref2 ); + EXC_CLASSTYPE_CELL, /// Cell formula, shared formula. + EXC_CLASSTYPE_ARRAY, /// Array formula, conditional formatting, data validation. + EXC_CLASSTYPE_NAME /// Defined name, range list. +}; + +/** Configuration data of the formula compiler. */ +struct XclExpCompConfig +{ + XclFormulaType meType; /// Type of the formula to be created. + XclExpFmlaClassType meClassType; /// Token class handling type. + bool mbLocalLinkMgr; /// True = local (per-sheet) link manager, false = global. + bool mbFromCell; /// True = Any kind of cell formula (cell, array, shared). + bool mb3DRefOnly; /// True = Only 3D references allowed (e.g. names). + bool mbAllowArrays; /// True = Allow inline arrays. +}; + +/** The table containing configuration data for all formula types. */ +static const XclExpCompConfig spConfigTable[] = +{ + // formula type token class type lclLM inCell 3dOnly allowArray + { EXC_FMLATYPE_CELL, EXC_CLASSTYPE_CELL, true, true, false, true }, + { EXC_FMLATYPE_SHARED, EXC_CLASSTYPE_CELL, true, true, false, true }, + { EXC_FMLATYPE_MATRIX, EXC_CLASSTYPE_ARRAY, true, true, false, true }, + { EXC_FMLATYPE_CONDFMT, EXC_CLASSTYPE_ARRAY, true, false, false, false }, + { EXC_FMLATYPE_DATAVAL, EXC_CLASSTYPE_ARRAY, true, false, false, false }, + { EXC_FMLATYPE_NAME, EXC_CLASSTYPE_NAME, false, false, true, true }, + { EXC_FMLATYPE_CHART, EXC_CLASSTYPE_NAME, true, false, true, true }, + { EXC_FMLATYPE_CONTROL, EXC_CLASSTYPE_NAME, true, false, false, false }, + { EXC_FMLATYPE_WQUERY, EXC_CLASSTYPE_NAME, true, false, true, false }, + { EXC_FMLATYPE_LISTVAL, EXC_CLASSTYPE_NAME, true, false, false, false } +}; + +// ---------------------------------------------------------------------------- + +/** Working data of the formula compiler. Used to push onto a stack for recursive calls. */ +struct XclExpCompData +{ + typedef ScfRef< ScTokenArray > ScTokenArrayRef; + + const XclExpCompConfig& mrCfg; /// Configuration for current formula type. + ScTokenArrayRef mxOwnScTokArr; /// Own clone of a Calc token array. + XclTokenArrayIterator maTokArrIt; /// Iterator in Calc token array. + XclExpLinkManager* mpLinkMgr; /// Link manager for current context (local/global). + XclExpRefLog* mpRefLog; /// Log for external references. + const ScAddress* mpScBasePos; /// Current cell position of the formula. + + ScfUInt8Vec maTokVec; /// Byte vector containing token data. + ScfUInt8Vec maExtDataVec; /// Byte vector containing extended data (arrays, stacked NLRs). + XclExpOperandListVector maOpListVec; /// Formula structure, maps operators to their operands. + ScfUInt16Vec maOpPosStack; /// Stack with positions of operand tokens waiting for an operator. + bool mbStopAtSep; /// True = Stop subexpression creation at an ocSep token. + bool mbVolatile; /// True = Formula contains volatile function. + bool mbOk; /// Current state of the compiler. + + explicit XclExpCompData( const XclExpCompConfig* pCfg ); +}; + +XclExpCompData::XclExpCompData( const XclExpCompConfig* pCfg ) : + mrCfg( pCfg ? *pCfg : spConfigTable[ 0 ] ), + mpLinkMgr( 0 ), + mpRefLog( 0 ), + mpScBasePos( 0 ), + mbStopAtSep( false ), + mbVolatile( false ), + mbOk( pCfg != 0 ) +{ + DBG_ASSERT( pCfg, "XclExpFmlaCompImpl::Init - unknown formula type" ); } } // namespace @@ -263,7 +318,7 @@ inline bool lclIsRefDel2D( const ScComplexRefData& rRefData ) // ---------------------------------------------------------------------------- /** Implementation class of the export formula compiler. */ -class XclExpFmlaCompImpl : protected XclExpRoot, protected XclTokenArrayHelper, private XclExpCompData +class XclExpFmlaCompImpl : protected XclExpRoot, protected XclTokenArrayHelper { public: explicit XclExpFmlaCompImpl( const XclExpRoot& rRoot ); @@ -285,64 +340,64 @@ public: // ------------------------------------------------------------------------ private: const XclExpCompConfig* GetConfigForType( XclFormulaType eType ) const; - inline sal_uInt16 GetSize() const { return static_cast< sal_uInt16 >( maTokVec.size() ); } + inline sal_uInt16 GetSize() const { return static_cast< sal_uInt16 >( mxData->maTokVec.size() ); } - void EnterRecursive(); void Init( XclFormulaType eType ); void Init( XclFormulaType eType, const ScTokenArray& rScTokArr, const ScAddress* pScBasePos, XclExpRefLog* pRefLog ); - void LeaveRecursive(); - void FinalizeFormula( ScfUInt8Vec & rExtensionTokens ); - void AppendInlineArrays( ScfUInt8Vec & rExtensionTokens ); - XclTokenArrayRef CreateTokenArray( ScfUInt8Vec* pExtensionTokens = NULL ); + void RecalcTokenClasses(); + void RecalcTokenClass( const XclExpTokenConvInfo& rConvInfo, XclFuncParamConv ePrevConv, XclExpClassConv ePrevClassConv, bool bWasRefClass ); + + void FinalizeFormula(); + XclTokenArrayRef CreateTokenArray(); // compiler --------------------------------------------------------------- - // XclExpTokenData: pass-by-value and return-by-value is intended - - const formula::FormulaToken* GetNextRawToken(); - const formula::FormulaToken* PeekNextRawToken( bool bSkipSpaces ) const; - - bool GetNextToken( XclExpTokenData& rTokData ); - XclExpTokenData GetNextToken(); - - XclExpTokenData Expression( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses, bool bStopAtSep ); - XclExpTokenData SkipExpression( XclExpTokenData aTokData, bool bStopAtSep ); - - XclExpTokenData OrTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ); - XclExpTokenData AndTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ); - XclExpTokenData CompareTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ); - XclExpTokenData ConcatTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ); - XclExpTokenData AddSubTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ); - XclExpTokenData MulDivTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ); - XclExpTokenData PowTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ); - XclExpTokenData UnaryPostTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ); - XclExpTokenData UnaryPreTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ); - XclExpTokenData ListTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ); - XclExpTokenData IntersectTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool& rbHasRefOp ); - XclExpTokenData RangeTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool& rbHasRefOp ); - XclExpTokenData Factor( XclExpTokenData aTokData, sal_uInt8 nExpClass ); + // XclExpScToken: pass-by-value and return-by-value is intended + + const FormulaToken* GetNextRawToken(); + const FormulaToken* PeekNextRawToken( bool bSkipSpaces ) const; + + bool GetNextToken( XclExpScToken& rTokData ); + XclExpScToken GetNextToken(); + + XclExpScToken Expression( XclExpScToken aTokData, bool bInParentheses, bool bStopAtSep ); + XclExpScToken SkipExpression( XclExpScToken aTokData, bool bStopAtSep ); + + XclExpScToken OrTerm( XclExpScToken aTokData, bool bInParentheses ); + XclExpScToken AndTerm( XclExpScToken aTokData, bool bInParentheses ); + XclExpScToken CompareTerm( XclExpScToken aTokData, bool bInParentheses ); + XclExpScToken ConcatTerm( XclExpScToken aTokData, bool bInParentheses ); + XclExpScToken AddSubTerm( XclExpScToken aTokData, bool bInParentheses ); + XclExpScToken MulDivTerm( XclExpScToken aTokData, bool bInParentheses ); + XclExpScToken PowTerm( XclExpScToken aTokData, bool bInParentheses ); + XclExpScToken UnaryPostTerm( XclExpScToken aTokData, bool bInParentheses ); + XclExpScToken UnaryPreTerm( XclExpScToken aTokData, bool bInParentheses ); + XclExpScToken ListTerm( XclExpScToken aTokData, bool bInParentheses ); + XclExpScToken IntersectTerm( XclExpScToken aTokData, bool& rbHasRefOp ); + XclExpScToken RangeTerm( XclExpScToken aTokData, bool& rbHasRefOp ); + XclExpScToken Factor( XclExpScToken aTokData ); // formula structure ------------------------------------------------------ - void ProcessDouble( const XclExpTokenData& rTokData ); - void ProcessString( const XclExpTokenData& rTokData ); - void ProcessError( const XclExpTokenData& rTokData ); - void ProcessMissing( const XclExpTokenData& rTokData ); - void ProcessBad( const XclExpTokenData& rTokData ); - void ProcessParentheses( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ); - void ProcessBoolean( const XclExpTokenData& rTokData ); - void ProcessDdeLink( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ); - void ProcessExternal( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ); - void ProcessExternalName( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ); - - void ProcessFunction( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ); + void ProcessDouble( const XclExpScToken& rTokData ); + void ProcessString( const XclExpScToken& rTokData ); + void ProcessError( const XclExpScToken& rTokData ); + void ProcessMissing( const XclExpScToken& rTokData ); + void ProcessBad( const XclExpScToken& rTokData ); + void ProcessParentheses( const XclExpScToken& rTokData ); + void ProcessBoolean( const XclExpScToken& rTokData ); + void ProcessDdeLink( const XclExpScToken& rTokData ); + void ProcessExternal( const XclExpScToken& rTokData ); + void ProcessMatrix( const XclExpScToken& rTokData ); + + void ProcessFunction( const XclExpScToken& rTokData ); void PrepareFunction( XclExpFuncData& rFuncData ); void FinishFunction( XclExpFuncData& rFuncData, sal_uInt8 nCloseSpaces ); void FinishIfFunction( XclExpFuncData& rFuncData ); void FinishChooseFunction( XclExpFuncData& rFuncData ); - XclExpTokenData ProcessParam( XclExpTokenData aTokData, XclExpFuncData& rFuncData ); + XclExpScToken ProcessParam( XclExpScToken aTokData, XclExpFuncData& rFuncData ); void PrepareParam( XclExpFuncData& rFuncData ); void FinishParam( XclExpFuncData& rFuncData ); void AppendDefaultParam( XclExpFuncData& rFuncData ); @@ -360,28 +415,20 @@ private: bool bNatLangRef ) const; XclExpRefLogEntry* GetNewRefLogEntry(); - void ProcessCellRef( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ); - void ProcessRangeRef( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ); - void ProcessMatrix( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ); - void ProcessDefinedName( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ); - void ProcessDatabaseArea( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ); - - // token identifiers ------------------------------------------------------ - - void SetReplaceTokenClasses(); - void SetArrExpFlag( bool bIsArrExp ); - void UpdateArrExpFlag( sal_uInt8 nParamExpClass, sal_uInt8 nFuncRetClass ); - - void AdjustTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nExpClass ); - void AdjustLastTokenClass( sal_uInt8 nExpClass ); - void AdjustLastTokenClassForEastereggOp(); - - void AppendOpTokenId( sal_uInt8 nTokenId, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 ); -//UNUSED2008-05 void AppendFuncTokenId( sal_uInt16 nXclFuncIdx, sal_uInt8 nRetClass, sal_uInt8 nExpRetClass, sal_uInt8 nSpaces = 0 ); - void AppendVarFuncTokenId( sal_uInt16 nXclFuncIdx, sal_uInt8 nRetClass, sal_uInt8 nExpRetClass, sal_uInt8 nParamCount, sal_uInt8 nSpaces = 0 ); + void ProcessCellRef( const XclExpScToken& rTokData ); + void ProcessRangeRef( const XclExpScToken& rTokData ); + void ProcessExternalCellRef( const XclExpScToken& rTokData ); + void ProcessExternalRangeRef( const XclExpScToken& rTokData ); + void ProcessDefinedName( const XclExpScToken& rTokData ); + void ProcessExternalName( const XclExpScToken& rTokData ); + void ProcessDatabaseArea( const XclExpScToken& rTokData ); // token vector ----------------------------------------------------------- + void PushOperandPos( sal_uInt16 nTokPos ); + void PushOperatorPos( sal_uInt16 nTokPos, const XclExpOperandListRef& rxOperands ); + sal_uInt16 PopOperandPos(); + void Append( sal_uInt8 nData ); void Append( sal_uInt8 nData, size_t nCount ); void Append( sal_uInt16 nData ); @@ -393,21 +440,30 @@ private: void AppendRange( const XclRange& rXclRange ); void AppendSpaceToken( sal_uInt8 nType, sal_uInt8 nCount ); + + void AppendOperandTokenId( sal_uInt8 nTokenId, sal_uInt8 nSpaces = 0 ); void AppendIntToken( sal_uInt16 nValue, sal_uInt8 nSpaces = 0 ); void AppendNumToken( double fValue, sal_uInt8 nSpaces = 0 ); void AppendBoolToken( bool bValue, sal_uInt8 nSpaces = 0 ); void AppendErrorToken( sal_uInt8 nErrCode, sal_uInt8 nSpaces = 0 ); void AppendMissingToken( sal_uInt8 nSpaces = 0 ); - void AppendNameToken( sal_uInt16 nNameIdx, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 ); - void AppendMissingNameToken( const String& rName, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 ); - void AppendNameXToken( sal_uInt16 nExtSheet, sal_uInt16 nExtName, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 ); - void AppendMacroCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 ); - void AppendAddInFuncToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 ); - void AppendEuroToolFuncToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 ); + void AppendNameToken( sal_uInt16 nNameIdx, sal_uInt8 nSpaces = 0 ); + void AppendMissingNameToken( const String& rName, sal_uInt8 nSpaces = 0 ); + void AppendNameXToken( sal_uInt16 nExtSheet, sal_uInt16 nExtName, sal_uInt8 nSpaces = 0 ); + void AppendMacroCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces = 0 ); + void AppendAddInCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces = 0 ); + void AppendEuroToolCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces = 0 ); + + void AppendOperatorTokenId( sal_uInt8 nTokenId, const XclExpOperandListRef& rxOperands, sal_uInt8 nSpaces = 0 ); + void AppendUnaryOperatorToken( sal_uInt8 nTokenId, sal_uInt8 nSpaces = 0 ); + void AppendBinaryOperatorToken( sal_uInt8 nTokenId, bool bValType, sal_uInt8 nSpaces = 0 ); + void AppendLogicalOperatorToken( sal_uInt16 nXclFuncIdx, sal_uInt8 nOpCount ); + void AppendFuncToken( const XclExpFuncData& rFuncData ); + void AppendParenToken( sal_uInt8 nOpenSpaces = 0, sal_uInt8 nCloseSpaces = 0 ); void AppendJumpToken( XclExpFuncData& rFuncData, sal_uInt8 nAttrType ); - void Insert( sal_uInt16 nInsertPos, sal_uInt16 nInsertSize ); + void InsertZeros( sal_uInt16 nInsertPos, sal_uInt16 nInsertSize ); void Overwrite( sal_uInt16 nWriteToPos, sal_uInt16 nOffset ); void UpdateAttrGoto( sal_uInt16 nAttrPos ); @@ -415,14 +471,23 @@ private: bool IsSpaceToken( sal_uInt16 nPos ) const; void RemoveTrailingParen(); + void AppendExt( sal_uInt8 nData ); + void AppendExt( sal_uInt8 nData, size_t nCount ); + void AppendExt( sal_uInt16 nData ); + void AppendExt( sal_uInt32 nData ); + void AppendExt( double fData ); + void AppendExt( const String& rString ); + // ------------------------------------------------------------------------ private: typedef ::std::map< XclFormulaType, XclExpCompConfig > XclExpCompConfigMap; - typedef ::std::list< XclExpCompData > XclExpCompDataList; + typedef ScfRef< XclExpCompData > XclExpCompDataRef; + typedef ::std::vector< XclExpCompDataRef > XclExpCompDataVector; XclExpCompConfigMap maCfgMap; /// Compiler configuration map for all formula types. XclFunctionProvider maFuncProv; /// Excel function data provider. - XclExpCompDataList maCompDataList; /// List for working data, when compiler is called recursively. + XclExpCompDataRef mxData; /// Working data for current formula. + XclExpCompDataVector maDataStack; /// Stack for working data, when compiler is called recursively. const XclBiff meBiff; /// Cached BIFF version to save GetBiff() calls. const SCsCOL mnMaxAbsCol; /// Maximum column index. const SCsROW mnMaxAbsRow; /// Maximum row index. @@ -430,31 +495,8 @@ private: const SCsROW mnMaxScRow; /// Maximum row index in Calc itself. const sal_uInt16 mnMaxColMask; /// Mask to delete invalid bits in column fields. const sal_uInt16 mnMaxRowMask; /// Mask to delete invalid bits in row fields. - bool mbRunning; /// true = compiler already running (for recursive calls). -}; - -// ---------------------------------------------------------------------------- - -namespace { - -/** The table containing configuration data for all formula types. */ -static const XclExpCompConfig spConfigTable[] = -{ - // formula type token class type link manager type inCell 3dOnly allowArray - { EXC_FMLATYPE_CELL, EXC_CLASSTYPE_CELL, EXC_LINKMGRTYPE_LOCAL, true, false, true }, - { EXC_FMLATYPE_SHARED, EXC_CLASSTYPE_CELL, EXC_LINKMGRTYPE_LOCAL, true, false, true }, - { EXC_FMLATYPE_MATRIX, EXC_CLASSTYPE_ARRAY, EXC_LINKMGRTYPE_LOCAL, true, false, true }, - { EXC_FMLATYPE_CONDFMT, EXC_CLASSTYPE_ARRAY, EXC_LINKMGRTYPE_NONE, false, false, false }, - { EXC_FMLATYPE_DATAVAL, EXC_CLASSTYPE_ARRAY, EXC_LINKMGRTYPE_NONE, false, false, false }, - { EXC_FMLATYPE_NAME, EXC_CLASSTYPE_NAME, EXC_LINKMGRTYPE_GLOBAL, false, true, true }, - { EXC_FMLATYPE_CHART, EXC_CLASSTYPE_NAME, EXC_LINKMGRTYPE_LOCAL, false, true, true }, - { EXC_FMLATYPE_CONTROL, EXC_CLASSTYPE_NAME, EXC_LINKMGRTYPE_LOCAL, false, false, false }, - { EXC_FMLATYPE_WQUERY, EXC_CLASSTYPE_NAME, EXC_LINKMGRTYPE_LOCAL, false, true, false }, - { EXC_FMLATYPE_LISTVAL, EXC_CLASSTYPE_NAME, EXC_LINKMGRTYPE_NONE, false, false, false } }; -} // namespace - // ---------------------------------------------------------------------------- XclExpFmlaCompImpl::XclExpFmlaCompImpl( const XclExpRoot& rRoot ) : @@ -466,8 +508,7 @@ XclExpFmlaCompImpl::XclExpFmlaCompImpl( const XclExpRoot& rRoot ) : mnMaxScCol( static_cast< SCsCOL >( rRoot.GetScMaxPos().Col() ) ), mnMaxScRow( static_cast< SCsROW >( rRoot.GetScMaxPos().Row() ) ), mnMaxColMask( static_cast< sal_uInt16 >( rRoot.GetXclMaxPos().Col() ) ), - mnMaxRowMask( static_cast< sal_uInt16 >( rRoot.GetXclMaxPos().Row() ) ), - mbRunning( false ) + mnMaxRowMask( static_cast< sal_uInt16 >( rRoot.GetXclMaxPos().Row() ) ) { // build the configuration map for( const XclExpCompConfig* pEntry = spConfigTable; pEntry != STATIC_TABLE_END( spConfigTable ); ++pEntry ) @@ -481,9 +522,9 @@ XclTokenArrayRef XclExpFmlaCompImpl::CreateFormula( XclFormulaType eType, Init( eType, rScTokArr, pScBasePos, pRefLog ); // start compilation, if initialization didn't fail - if( mbOk ) + if( mxData->mbOk ) { - XclExpTokenData aTokData( GetNextToken() ); + XclExpScToken aTokData( GetNextToken() ); USHORT nScError = rScTokArr.GetCodeError(); if( (nScError != 0) && (!aTokData.Is() || (aTokData.GetOpCode() == ocStop)) ) { @@ -492,29 +533,28 @@ XclTokenArrayRef XclExpFmlaCompImpl::CreateFormula( XclFormulaType eType, } else if( aTokData.Is() ) { - // expected class is VAL in cell and array formulas, and REF in names - sal_uInt8 nExpClass = (maCfg.meClassType == EXC_CLASSTYPE_NAME) ? EXC_TOKCLASS_REF : EXC_TOKCLASS_VAL; - aTokData = Expression( aTokData, nExpClass, false, false ); + aTokData = Expression( aTokData, false, false ); } else { DBG_ERRORFILE( "XclExpFmlaCompImpl::CreateFormula - empty token array" ); - mbOk = false; + mxData->mbOk = false; } - if( mbOk ) + if( mxData->mbOk ) { // #i44907# auto-generated SUBTOTAL formula cells have trailing ocStop token - mbOk = !aTokData.Is() || (aTokData.GetOpCode() == ocStop); - DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::CreateFormula - unknown garbage behind formula" ); + mxData->mbOk = !aTokData.Is() || (aTokData.GetOpCode() == ocStop); + DBG_ASSERT( mxData->mbOk, "XclExpFmlaCompImpl::CreateFormula - unknown garbage behind formula" ); } } - // finalizing, e.g. add tAttrVolatile token, and storing any inline arrays - ScfUInt8Vec aExtensionTokens; - FinalizeFormula( aExtensionTokens ); + // finalize (add tAttrVolatile token, calculate all token classes) + RecalcTokenClasses(); + FinalizeFormula(); - return CreateTokenArray( &aExtensionTokens ); + // leave recursive call, create and return the final token array + return CreateTokenArray(); } XclTokenArrayRef XclExpFmlaCompImpl::CreateErrorFormula( sal_uInt8 nErrCode ) @@ -527,7 +567,7 @@ XclTokenArrayRef XclExpFmlaCompImpl::CreateErrorFormula( sal_uInt8 nErrCode ) XclTokenArrayRef XclExpFmlaCompImpl::CreateSpecialRefFormula( sal_uInt8 nTokenId, const XclAddress& rXclPos ) { Init( EXC_FMLATYPE_NAME ); - AppendOpTokenId( nTokenId, EXC_TOKCLASS_NONE ); + AppendOperandTokenId( nTokenId ); Append( rXclPos.mnRow ); Append( rXclPos.mnCol ); // do not use AppendAddress(), we always need 16-bit column here return CreateTokenArray(); @@ -536,7 +576,7 @@ XclTokenArrayRef XclExpFmlaCompImpl::CreateSpecialRefFormula( sal_uInt8 nTokenId XclTokenArrayRef XclExpFmlaCompImpl::CreateNameXFormula( sal_uInt16 nExtSheet, sal_uInt16 nExtName ) { Init( EXC_FMLATYPE_NAME ); - AppendNameXToken( nExtSheet, nExtName, EXC_TOKCLASS_NONE ); + AppendNameXToken( nExtSheet, nExtName ); return CreateTokenArray(); } @@ -555,47 +595,13 @@ const XclExpCompConfig* XclExpFmlaCompImpl::GetConfigForType( XclFormulaType eTy return (aIt == maCfgMap.end()) ? 0 : &aIt->second; } -void XclExpFmlaCompImpl::EnterRecursive() -{ - if( mbRunning ) - // compiler invoked recursively - store old working data - maCompDataList.push_back( static_cast< const XclExpCompData& >( *this ) ); - else - mbRunning = true; -} - void XclExpFmlaCompImpl::Init( XclFormulaType eType ) { // compiler invoked recursively? - store old working data - EnterRecursive(); - - // compiler configuration - const XclExpCompConfig* pCfg = GetConfigForType( eType ); - mbOk = pCfg != 0; - DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::Init - unknown formula type" ); - if( mbOk ) - { - // copy config data to own member - maCfg = *pCfg; - - // reset per-formula data - maTokVec.clear(); - mxOwnScTokArr.reset(); - maTokArrIt.Init(); - mpLinkMgr = 0; - mpRefLog = 0; - mxInlineArr.reset(); - - mpScBasePos = 0; - - // init processing data used during compilation - mnLastTokPos = SAL_MAX_UINT16; - mnLastDefClass = EXC_TOKCLASS_NONE; - mbStopAtSep = false; - mbVolatile = false; - mbIsArrExp = false; - SetReplaceTokenClasses(); // initializes the token class variables for AdjustTokenClass() - } + if( mxData.get() ) + maDataStack.push_back( mxData ); + // new compiler working data structure + mxData.reset( new XclExpCompData( GetConfigForType( eType ) ) ); } void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokArr, @@ -605,199 +611,222 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA Init( eType ); // special initialization - if( mbOk ) switch( maCfg.meType ) + if( mxData->mbOk ) switch( mxData->mrCfg.meType ) { case EXC_FMLATYPE_CELL: case EXC_FMLATYPE_MATRIX: case EXC_FMLATYPE_CHART: - mbOk = pScBasePos != 0; - DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::Init - missing cell address" ); - mpScBasePos = pScBasePos; + mxData->mbOk = pScBasePos != 0; + DBG_ASSERT( mxData->mbOk, "XclExpFmlaCompImpl::Init - missing cell address" ); + mxData->mpScBasePos = pScBasePos; break; case EXC_FMLATYPE_SHARED: - mbOk = pScBasePos != 0; - DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::Init - missing cell address" ); + mxData->mbOk = pScBasePos != 0; + DBG_ASSERT( mxData->mbOk, "XclExpFmlaCompImpl::Init - missing cell address" ); // clone the passed token array, convert references relative to current cell position - mxOwnScTokArr.reset( rScTokArr.Clone() ); - ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos, MAXCOL, MAXROW ); - // don't remember pScBasePos in mpScBasePos, shared formulas use real relative refs + mxData->mxOwnScTokArr.reset( rScTokArr.Clone() ); + ScCompiler::MoveRelWrap( *mxData->mxOwnScTokArr, GetDocPtr(), *pScBasePos, MAXCOL, MAXROW ); + // don't remember pScBasePos in mxData->mpScBasePos, shared formulas use real relative refs break; default:; } - if( mbOk ) + if( mxData->mbOk ) { // link manager to be used - switch( maCfg.meLinkMgrType ) - { - case EXC_LINKMGRTYPE_NONE: mpLinkMgr = 0; break; - case EXC_LINKMGRTYPE_LOCAL: mpLinkMgr = &GetLocalLinkManager(); break; - case EXC_LINKMGRTYPE_GLOBAL: mpLinkMgr = &GetGlobalLinkManager(); break; - } + mxData->mpLinkMgr = mxData->mrCfg.mbLocalLinkMgr ? &GetLocalLinkManager() : &GetGlobalLinkManager(); // token array iterator (use cloned token array if present) - maTokArrIt.Init( mxOwnScTokArr.is() ? *mxOwnScTokArr : rScTokArr, false ); - mpRefLog = pRefLog; + mxData->maTokArrIt.Init( mxData->mxOwnScTokArr.is() ? *mxData->mxOwnScTokArr : rScTokArr, false ); + mxData->mpRefLog = pRefLog; } } -void XclExpFmlaCompImpl::LeaveRecursive() +void XclExpFmlaCompImpl::RecalcTokenClasses() { - mbRunning = !maCompDataList.empty(); - if( mbRunning ) + if( mxData->mbOk ) { - // compiler invoked recursively - restore old working data - static_cast< XclExpCompData& >( *this ) = maCompDataList.back(); - maCompDataList.pop_back(); + mxData->mbOk = mxData->maOpPosStack.size() == 1; + DBG_ASSERT( mxData->mbOk, "XclExpFmlaCompImpl::RecalcTokenClasses - position of root token expected on stack" ); + if( mxData->mbOk ) + { + /* Cell and array formulas start with VAL conversion and VALTYPE + parameter type, defined names start with ARR conversion and + REFTYPE parameter type for the root token. */ + XclExpOperandList aOperands; + bool bNameFmla = mxData->mrCfg.meClassType == EXC_CLASSTYPE_NAME; + XclFuncParamConv eParamConv = bNameFmla ? EXC_PARAMCONV_ARR : EXC_PARAMCONV_VAL; + XclExpClassConv eClassConv = bNameFmla ? EXC_CLASSCONV_ARR : EXC_CLASSCONV_VAL; + XclExpTokenConvInfo aConvInfo = { PopOperandPos(), eParamConv, !bNameFmla }; + RecalcTokenClass( aConvInfo, eParamConv, eClassConv, bNameFmla ); + } + + // clear operand vectors (calls to the expensive InsertZeros() may follow) + mxData->maOpListVec.clear(); + mxData->maOpPosStack.clear(); } } -void XclExpFmlaCompImpl::AppendInlineArrays( ScfUInt8Vec& rExtensionTokens ) +void XclExpFmlaCompImpl::RecalcTokenClass( const XclExpTokenConvInfo& rConvInfo, + XclFuncParamConv ePrevConv, XclExpClassConv ePrevClassConv, bool bWasRefClass ) { - // The const_cast is needed, otherwise MS and Sun compilers can't promote - // the non-const iterators obtained via ScMatrixList* to const iterators. - const ScMatrixList* pList = const_cast< const ScMatrixList* >( mxInlineArr.get() ); - for( ScMatrixList::const_reverse_iterator aIt = pList->rbegin(), aEnd = pList->rend(); aIt != aEnd ; ++aIt ) - { - const ScMatrix* pMatrix = *aIt; - SCSIZE nC, nMaxC, nR, nMaxR; + DBG_ASSERT( rConvInfo.mnTokPos < GetSize(), "XclExpFmlaCompImpl::RecalcTokenClass - invalid token position" ); + sal_uInt8& rnTokenId = mxData->maTokVec[ rConvInfo.mnTokPos ]; + sal_uInt8 nTokClass = GetTokenClass( rnTokenId ); - pMatrix->GetDimensions( nMaxC, nMaxR ); + // REF tokens in VALTYPE parameters behave like VAL tokens + if( rConvInfo.mbValType && (nTokClass == EXC_TOKCLASS_REF) ) + ChangeTokenClass( rnTokenId, nTokClass = EXC_TOKCLASS_VAL ); - if( meBiff == EXC_BIFF8 ) - { - rExtensionTokens.push_back( sal::static_int_cast( nMaxC - 1 ) ); - rExtensionTokens.resize( rExtensionTokens.size() + 2 ); - ShortToSVBT16( static_cast< USHORT >( nMaxR - 1 ), &*(rExtensionTokens.end() - 2) ); - } - else - { - rExtensionTokens.push_back( static_cast< sal_uInt8 >( (nMaxC == 256) ? 0 : nMaxC ) ); - rExtensionTokens.resize( rExtensionTokens.size() + 2 ); - ShortToSVBT16( static_cast< USHORT >( nMaxR ), &*(rExtensionTokens.end() - 2) ); - } + // replace RPO conversion of operator with parent conversion + XclFuncParamConv eConv = (rConvInfo.meConv == EXC_PARAMCONV_RPO) ? ePrevConv : rConvInfo.meConv; - for( nR = 0 ; nR < nMaxR ; nR++) - { - for( nC = 0 ; nC < nMaxC ; nC++) + // find the effective token class conversion to be performed for this token + XclExpClassConv eClassConv = EXC_CLASSCONV_ORG; + switch( eConv ) + { + case EXC_PARAMCONV_ORG: + // conversion is forced independent of parent conversion + eClassConv = EXC_CLASSCONV_ORG; + break; + case EXC_PARAMCONV_VAL: + // conversion is forced independent of parent conversion + eClassConv = EXC_CLASSCONV_VAL; + break; + case EXC_PARAMCONV_ARR: + // conversion is forced independent of parent conversion + eClassConv = EXC_CLASSCONV_ARR; + break; + case EXC_PARAMCONV_RPT: + switch( ePrevConv ) { - if( pMatrix->IsValue( nC, nR ) ) - { - ScMatValType nType; - const ScMatrixValue* pVal = pMatrix->Get( nC, nR, nType); - - if( nType == SC_MATVAL_BOOLEAN ) - { - rExtensionTokens.push_back( EXC_CACHEDVAL_BOOL ); - - rExtensionTokens.resize( rExtensionTokens.size() + 8 ); - const bool bVal = ! ::rtl::math::approxEqual( pVal->fVal, 0. ); - UInt32ToSVBT32( bVal ? 1 : 0, &*(rExtensionTokens.end() - 8) ); - UInt32ToSVBT32( 0, &*(rExtensionTokens.end() - 4) ); - } - else - { - USHORT nErr = pVal->GetError(); - if( nErr ) - { - rExtensionTokens.push_back( EXC_CACHEDVAL_ERROR ); - - rExtensionTokens.resize( rExtensionTokens.size() + 8 ); - UInt32ToSVBT32( XclTools::GetXclErrorCode ( nErr ), - &*(rExtensionTokens.end() - 8) ); - UInt32ToSVBT32( 0, &*(rExtensionTokens.end() - 4) ); - } - else - { - rExtensionTokens.push_back( EXC_CACHEDVAL_DOUBLE ); - - const double nVal = pMatrix->GetDouble( nC, nR ); - rExtensionTokens.resize( rExtensionTokens.size() + 8 ); - DoubleToSVBT64( nVal, &*(rExtensionTokens.end() - 8) ); - } - } - } - else if( pMatrix->IsEmpty( nC, nR ) ) - { - rExtensionTokens.push_back( EXC_CACHEDVAL_EMPTY ); - - rExtensionTokens.resize( rExtensionTokens.size() + 8 ); - UInt32ToSVBT32( 0, &*(rExtensionTokens.end() - 8) ); - UInt32ToSVBT32( 0, &*(rExtensionTokens.end() - 4) ); - } - else if( pMatrix->IsString( nC, nR ) ) - { - rExtensionTokens.push_back( EXC_CACHEDVAL_STRING ); - - const String & rString = pMatrix->GetString( nC, nR ); - XclExpStringRef xXclStr = XclExpStringHelper::CreateString( - GetRoot(), rString, - ((meBiff == EXC_BIFF8) ? EXC_STR_DEFAULT : EXC_STR_8BITLENGTH), - EXC_TOK_STR_MAXLEN ); - size_t nSize = rExtensionTokens.size(); - rExtensionTokens.resize( nSize + xXclStr->GetSize() ); - xXclStr->WriteToMem( &rExtensionTokens[ nSize ] ); - } - + case EXC_PARAMCONV_ORG: + case EXC_PARAMCONV_VAL: + case EXC_PARAMCONV_ARR: + /* If parent token has REF class (REF token in REFTYPE + function parameter), then RPT does not repeat the + previous explicit ORG or ARR conversion, but always + falls back to VAL conversion. */ + eClassConv = bWasRefClass ? EXC_CLASSCONV_VAL : ePrevClassConv; + break; + case EXC_PARAMCONV_RPT: + // nested RPT repeats the previous effective conversion + eClassConv = ePrevClassConv; + break; + case EXC_PARAMCONV_RPX: + /* If parent token has REF class (REF token in REFTYPE + function parameter), then RPX repeats the previous + effective conversion (wich will be either ORG or ARR, + but never VAL), otherwise falls back to ORG conversion. */ + eClassConv = bWasRefClass ? ePrevClassConv : EXC_CLASSCONV_ORG; + break; + case EXC_PARAMCONV_RPO: // does not occur + break; } - } + break; + case EXC_PARAMCONV_RPX: + /* If current token still has REF class, set previous effective + conversion as current conversion. This will not have an effect + on the REF token but is needed for RPT parameters of this + function that want to repeat this conversion type. If current + token is VAL or ARR class, the previous ARR conversion will be + repeated on the token, but VAL conversion will not. */ + eClassConv = ((nTokClass == EXC_TOKCLASS_REF) || (ePrevClassConv == EXC_CLASSCONV_ARR)) ? + ePrevClassConv : EXC_CLASSCONV_ORG; + break; + case EXC_PARAMCONV_RPO: // does not occur (see above) + break; } + + // do the token class conversion + switch( eClassConv ) + { + case EXC_CLASSCONV_ORG: + /* Cell formulas: leave the current token class. Cell formulas + are the only type of formulas where all tokens can keep + their original token class. + Array and defined name formulas: convert VAL to ARR. */ + if( (mxData->mrCfg.meClassType != EXC_CLASSTYPE_CELL) && (nTokClass == EXC_TOKCLASS_VAL) ) + ChangeTokenClass( rnTokenId, nTokClass = EXC_TOKCLASS_ARR ); + break; + case EXC_CLASSCONV_VAL: + // convert ARR to VAL + if( nTokClass == EXC_TOKCLASS_ARR ) + ChangeTokenClass( rnTokenId, nTokClass = EXC_TOKCLASS_VAL ); + break; + case EXC_CLASSCONV_ARR: + // convert VAL to ARR + if( nTokClass == EXC_TOKCLASS_VAL ) + ChangeTokenClass( rnTokenId, nTokClass = EXC_TOKCLASS_ARR ); + break; + } + + // do conversion for nested operands, if token is an operator or function + if( rConvInfo.mnTokPos < mxData->maOpListVec.size() ) + if( const XclExpOperandList* pOperands = mxData->maOpListVec[ rConvInfo.mnTokPos ].get() ) + for( XclExpOperandList::const_iterator aIt = pOperands->begin(), aEnd = pOperands->end(); aIt != aEnd; ++aIt ) + RecalcTokenClass( *aIt, eConv, eClassConv, nTokClass == EXC_TOKCLASS_REF ); } -void XclExpFmlaCompImpl::FinalizeFormula( ScfUInt8Vec & rExtensionTokens ) +void XclExpFmlaCompImpl::FinalizeFormula() { - if( mbOk ) + if( mxData->mbOk ) { // Volatile? Add a tAttrVolatile token at the beginning of the token array. - if( mbVolatile ) + if( mxData->mbVolatile ) { // tAttrSpace token can be extended with volatile flag if( !IsSpaceToken( 0 ) ) { - Insert( 0, 4 ); - maTokVec[ 0 ] = EXC_TOKID_ATTR; + InsertZeros( 0, 4 ); + mxData->maTokVec[ 0 ] = EXC_TOKID_ATTR; } - maTokVec[ 1 ] |= EXC_TOK_ATTR_VOLATILE; + mxData->maTokVec[ 1 ] |= EXC_TOK_ATTR_VOLATILE; } // Token array too long? -> error - mbOk = maTokVec.size() <= EXC_TOKARR_MAXLEN; - - // Store any inline arrays - if( mbOk && mxInlineArr.is() ) - AppendInlineArrays( rExtensionTokens ); + mxData->mbOk = mxData->maTokVec.size() <= EXC_TOKARR_MAXLEN; } - if( !mbOk ) + if( !mxData->mbOk ) { // Any unrecoverable error? -> Create a =#NA formula. - maTokVec.clear(); - mbVolatile = false; + mxData->maTokVec.clear(); + mxData->maExtDataVec.clear(); + mxData->mbVolatile = false; AppendErrorToken( EXC_ERR_NA ); } } -XclTokenArrayRef XclExpFmlaCompImpl::CreateTokenArray( ScfUInt8Vec* pExtensionTokens ) +XclTokenArrayRef XclExpFmlaCompImpl::CreateTokenArray() { - // create the Excel token array object before calling LeaveRecursive() - XclTokenArrayRef xTokArr( new XclTokenArray( maTokVec, mbVolatile, pExtensionTokens ) ); + // create the Excel token array from working data before resetting mxData + DBG_ASSERT( mxData->mrCfg.mbAllowArrays || mxData->maExtDataVec.empty(), "XclExpFmlaCompImpl::CreateTokenArray - unexpected extended data" ); + if( !mxData->mrCfg.mbAllowArrays ) + mxData->maExtDataVec.clear(); + XclTokenArrayRef xTokArr( new XclTokenArray( mxData->maTokVec, mxData->maExtDataVec, mxData->mbVolatile ) ); + mxData.reset(); // compiler invoked recursively? - restore old working data - LeaveRecursive(); + if( !maDataStack.empty() ) + { + mxData = maDataStack.back(); + maDataStack.pop_back(); + } return xTokArr; } // compiler ------------------------------------------------------------------- -const formula::FormulaToken* XclExpFmlaCompImpl::GetNextRawToken() +const FormulaToken* XclExpFmlaCompImpl::GetNextRawToken() { - const formula::FormulaToken* pScToken = maTokArrIt.Get(); - ++maTokArrIt; + const FormulaToken* pScToken = mxData->maTokArrIt.Get(); + ++mxData->maTokArrIt; return pScToken; } -const formula::FormulaToken* XclExpFmlaCompImpl::PeekNextRawToken( bool bSkipSpaces ) const +const FormulaToken* XclExpFmlaCompImpl::PeekNextRawToken( bool bSkipSpaces ) const { /* Returns pointer to next raw token in the token array. The token array iterator already points to the next token (A call to GetNextToken() @@ -806,11 +835,11 @@ const formula::FormulaToken* XclExpFmlaCompImpl::PeekNextRawToken( bool bSkipSpa created and set to the passed skip-spaces mode. If spaces have to be skipped, and the iterator currently points to a space token, the constructor will move it to the next non-space token. */ - XclTokenArrayIterator aTempIt( maTokArrIt, bSkipSpaces ); + XclTokenArrayIterator aTempIt( mxData->maTokArrIt, bSkipSpaces ); return aTempIt.Get(); } -bool XclExpFmlaCompImpl::GetNextToken( XclExpTokenData& rTokData ) +bool XclExpFmlaCompImpl::GetNextToken( XclExpScToken& rTokData ) { rTokData.mpScToken = GetNextRawToken(); rTokData.mnSpaces = (rTokData.GetOpCode() == ocSpaces) ? rTokData.mpScToken->GetByte() : 0; @@ -819,9 +848,9 @@ bool XclExpFmlaCompImpl::GetNextToken( XclExpTokenData& rTokData ) return rTokData.Is(); } -XclExpTokenData XclExpFmlaCompImpl::GetNextToken() +XclExpScToken XclExpFmlaCompImpl::GetNextToken() { - XclExpTokenData aTokData; + XclExpScToken aTokData; GetNextToken( aTokData ); return aTokData; } @@ -919,195 +948,187 @@ inline sal_uInt8 lclGetRangeTokenId( OpCode eOpCode ) } // namespace -XclExpTokenData XclExpFmlaCompImpl::Expression( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses, bool bStopAtSep ) +XclExpScToken XclExpFmlaCompImpl::Expression( XclExpScToken aTokData, bool bInParentheses, bool bStopAtSep ) { - if( mbOk && aTokData.Is() ) + if( mxData->mbOk && aTokData.Is() ) { // remember old stop-at-ocSep mode, restored below - bool bOldStopAtSep = mbStopAtSep; - mbStopAtSep = bStopAtSep; + bool bOldStopAtSep = mxData->mbStopAtSep; + mxData->mbStopAtSep = bStopAtSep; // start compilation of the subexpression - aTokData = OrTerm( aTokData, nExpClass, bInParentheses ); + aTokData = OrTerm( aTokData, bInParentheses ); // restore old stop-at-ocSep mode - mbStopAtSep = bOldStopAtSep; + mxData->mbStopAtSep = bOldStopAtSep; } return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::SkipExpression( XclExpTokenData aTokData, bool bStopAtSep ) +XclExpScToken XclExpFmlaCompImpl::SkipExpression( XclExpScToken aTokData, bool bStopAtSep ) { - while( mbOk && aTokData.Is() && (aTokData.GetOpCode() != ocClose) && (!bStopAtSep || (aTokData.GetOpCode() != ocSep)) ) + while( mxData->mbOk && aTokData.Is() && (aTokData.GetOpCode() != ocClose) && (!bStopAtSep || (aTokData.GetOpCode() != ocSep)) ) { if( aTokData.GetOpCode() == ocOpen ) { aTokData = SkipExpression( GetNextToken(), false ); - if( mbOk ) mbOk = aTokData.GetOpCode() == ocClose; + if( mxData->mbOk ) mxData->mbOk = aTokData.GetOpCode() == ocClose; } aTokData = GetNextToken(); } return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::OrTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ) +XclExpScToken XclExpFmlaCompImpl::OrTerm( XclExpScToken aTokData, bool bInParentheses ) { - aTokData = AndTerm( aTokData, nExpClass, bInParentheses ); + aTokData = AndTerm( aTokData, bInParentheses ); sal_uInt8 nParamCount = 1; - while( mbOk && (aTokData.GetOpCode() == ocOr) ) + while( mxData->mbOk && (aTokData.GetOpCode() == ocOr) ) { - AdjustLastTokenClassForEastereggOp(); // see comment in this function RemoveTrailingParen(); - aTokData = AndTerm( GetNextToken(), EXC_TOKCLASS_REF, bInParentheses ); + aTokData = AndTerm( GetNextToken(), bInParentheses ); RemoveTrailingParen(); ++nParamCount; - if( mbOk ) mbOk = nParamCount <= EXC_FUNC_MAXPARAM; + if( mxData->mbOk ) mxData->mbOk = nParamCount <= EXC_FUNC_MAXPARAM; } - if( mbOk && (nParamCount > 1) ) - AppendVarFuncTokenId( EXC_FUNCID_OR, EXC_TOKCLASS_VAL, nExpClass, nParamCount ); + if( mxData->mbOk && (nParamCount > 1) ) + AppendLogicalOperatorToken( EXC_FUNCID_OR, nParamCount ); return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::AndTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ) +XclExpScToken XclExpFmlaCompImpl::AndTerm( XclExpScToken aTokData, bool bInParentheses ) { - aTokData = CompareTerm( aTokData, nExpClass, bInParentheses ); + aTokData = CompareTerm( aTokData, bInParentheses ); sal_uInt8 nParamCount = 1; - while( mbOk && (aTokData.GetOpCode() == ocAnd) ) + while( mxData->mbOk && (aTokData.GetOpCode() == ocAnd) ) { - AdjustLastTokenClassForEastereggOp(); // see comment in this function RemoveTrailingParen(); - aTokData = CompareTerm( GetNextToken(), EXC_TOKCLASS_REF, bInParentheses ); + aTokData = CompareTerm( GetNextToken(), bInParentheses ); RemoveTrailingParen(); ++nParamCount; - if( mbOk ) mbOk = nParamCount <= EXC_FUNC_MAXPARAM; + if( mxData->mbOk ) mxData->mbOk = nParamCount <= EXC_FUNC_MAXPARAM; } - if( mbOk && (nParamCount > 1) ) - AppendVarFuncTokenId( EXC_FUNCID_AND, EXC_TOKCLASS_VAL, nExpClass, nParamCount ); + if( mxData->mbOk && (nParamCount > 1) ) + AppendLogicalOperatorToken( EXC_FUNCID_AND, nParamCount ); return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::CompareTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ) +XclExpScToken XclExpFmlaCompImpl::CompareTerm( XclExpScToken aTokData, bool bInParentheses ) { - aTokData = ConcatTerm( aTokData, nExpClass, bInParentheses ); + aTokData = ConcatTerm( aTokData, bInParentheses ); sal_uInt8 nOpTokenId = EXC_TOKID_NONE; - while( mbOk && ((nOpTokenId = lclGetCompareTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) + while( mxData->mbOk && ((nOpTokenId = lclGetCompareTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) { - AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG ); sal_uInt8 nSpaces = aTokData.mnSpaces; - aTokData = ConcatTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses ); - AppendOpTokenId( nOpTokenId, nExpClass, nSpaces ); + aTokData = ConcatTerm( GetNextToken(), bInParentheses ); + AppendBinaryOperatorToken( nOpTokenId, true, nSpaces ); } return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::ConcatTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ) +XclExpScToken XclExpFmlaCompImpl::ConcatTerm( XclExpScToken aTokData, bool bInParentheses ) { - aTokData = AddSubTerm( aTokData, nExpClass, bInParentheses ); + aTokData = AddSubTerm( aTokData, bInParentheses ); sal_uInt8 nOpTokenId = EXC_TOKID_NONE; - while( mbOk && ((nOpTokenId = lclGetConcatTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) + while( mxData->mbOk && ((nOpTokenId = lclGetConcatTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) { - AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG ); sal_uInt8 nSpaces = aTokData.mnSpaces; - aTokData = AddSubTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses ); - AppendOpTokenId( nOpTokenId, nExpClass, nSpaces ); + aTokData = AddSubTerm( GetNextToken(), bInParentheses ); + AppendBinaryOperatorToken( nOpTokenId, true, nSpaces ); } return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::AddSubTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ) +XclExpScToken XclExpFmlaCompImpl::AddSubTerm( XclExpScToken aTokData, bool bInParentheses ) { - aTokData = MulDivTerm( aTokData, nExpClass, bInParentheses ); + aTokData = MulDivTerm( aTokData, bInParentheses ); sal_uInt8 nOpTokenId = EXC_TOKID_NONE; - while( mbOk && ((nOpTokenId = lclGetAddSubTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) + while( mxData->mbOk && ((nOpTokenId = lclGetAddSubTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) { - AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG ); sal_uInt8 nSpaces = aTokData.mnSpaces; - aTokData = MulDivTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses ); - AppendOpTokenId( nOpTokenId, nExpClass, nSpaces ); + aTokData = MulDivTerm( GetNextToken(), bInParentheses ); + AppendBinaryOperatorToken( nOpTokenId, true, nSpaces ); } return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::MulDivTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ) +XclExpScToken XclExpFmlaCompImpl::MulDivTerm( XclExpScToken aTokData, bool bInParentheses ) { - aTokData = PowTerm( aTokData, nExpClass, bInParentheses ); + aTokData = PowTerm( aTokData, bInParentheses ); sal_uInt8 nOpTokenId = EXC_TOKID_NONE; - while( mbOk && ((nOpTokenId = lclGetMulDivTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) + while( mxData->mbOk && ((nOpTokenId = lclGetMulDivTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) { - AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG ); sal_uInt8 nSpaces = aTokData.mnSpaces; - aTokData = PowTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses ); - AppendOpTokenId( nOpTokenId, nExpClass, nSpaces ); + aTokData = PowTerm( GetNextToken(), bInParentheses ); + AppendBinaryOperatorToken( nOpTokenId, true, nSpaces ); } return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::PowTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ) +XclExpScToken XclExpFmlaCompImpl::PowTerm( XclExpScToken aTokData, bool bInParentheses ) { - aTokData = UnaryPostTerm( aTokData, nExpClass, bInParentheses ); + aTokData = UnaryPostTerm( aTokData, bInParentheses ); sal_uInt8 nOpTokenId = EXC_TOKID_NONE; - while( mbOk && ((nOpTokenId = lclGetPowTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) + while( mxData->mbOk && ((nOpTokenId = lclGetPowTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) { - AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG ); sal_uInt8 nSpaces = aTokData.mnSpaces; - aTokData = UnaryPostTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses ); - AppendOpTokenId( nOpTokenId, nExpClass, nSpaces ); + aTokData = UnaryPostTerm( GetNextToken(), bInParentheses ); + AppendBinaryOperatorToken( nOpTokenId, true, nSpaces ); } return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::UnaryPostTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ) +XclExpScToken XclExpFmlaCompImpl::UnaryPostTerm( XclExpScToken aTokData, bool bInParentheses ) { - aTokData = UnaryPreTerm( aTokData, nExpClass, bInParentheses ); + aTokData = UnaryPreTerm( aTokData, bInParentheses ); sal_uInt8 nOpTokenId = EXC_TOKID_NONE; - while( mbOk && ((nOpTokenId = lclGetUnaryPostTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) + while( mxData->mbOk && ((nOpTokenId = lclGetUnaryPostTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) { - AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG ); - AppendOpTokenId( nOpTokenId, nExpClass, aTokData.mnSpaces ); + AppendUnaryOperatorToken( nOpTokenId, aTokData.mnSpaces ); GetNextToken( aTokData ); } return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::UnaryPreTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ) +XclExpScToken XclExpFmlaCompImpl::UnaryPreTerm( XclExpScToken aTokData, bool bInParentheses ) { - sal_uInt8 nOpTokenId = mbOk ? lclGetUnaryPreTokenId( aTokData.GetOpCode() ) : EXC_TOKID_NONE; + sal_uInt8 nOpTokenId = mxData->mbOk ? lclGetUnaryPreTokenId( aTokData.GetOpCode() ) : EXC_TOKID_NONE; if( nOpTokenId != EXC_TOKID_NONE ) { sal_uInt8 nSpaces = aTokData.mnSpaces; - aTokData = UnaryPreTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses ); - AppendOpTokenId( nOpTokenId, nExpClass, nSpaces ); + aTokData = UnaryPreTerm( GetNextToken(), bInParentheses ); + AppendUnaryOperatorToken( nOpTokenId, nSpaces ); } else - aTokData = ListTerm( aTokData, nExpClass, bInParentheses ); + { + aTokData = ListTerm( aTokData, bInParentheses ); + } return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::ListTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses ) +XclExpScToken XclExpFmlaCompImpl::ListTerm( XclExpScToken aTokData, bool bInParentheses ) { sal_uInt16 nSubExprPos = GetSize(); bool bHasAnyRefOp = false; bool bHasListOp = false; - aTokData = IntersectTerm( aTokData, nExpClass, bHasAnyRefOp ); + aTokData = IntersectTerm( aTokData, bHasAnyRefOp ); sal_uInt8 nOpTokenId = EXC_TOKID_NONE; - while( mbOk && ((nOpTokenId = lclGetListTokenId( aTokData.GetOpCode(), mbStopAtSep )) != EXC_TOKID_NONE) ) + while( mxData->mbOk && ((nOpTokenId = lclGetListTokenId( aTokData.GetOpCode(), mxData->mbStopAtSep )) != EXC_TOKID_NONE) ) { - AdjustLastTokenClass( EXC_TOKCLASS_ANY_IN_REFOP ); sal_uInt8 nSpaces = aTokData.mnSpaces; - aTokData = IntersectTerm( GetNextToken(), EXC_TOKCLASS_ANY_IN_REFOP, bHasAnyRefOp ); - AppendOpTokenId( nOpTokenId, nExpClass, nSpaces ); + aTokData = IntersectTerm( GetNextToken(), bHasAnyRefOp ); + AppendBinaryOperatorToken( nOpTokenId, false, nSpaces ); bHasAnyRefOp = bHasListOp = true; } if( bHasAnyRefOp ) { - // adjust last added token back to REF - AdjustLastTokenClass( EXC_TOKCLASS_ANY_IN_REFOP ); // add a tMemFunc token enclosing the entire reference subexpression sal_uInt16 nSubExprSize = GetSize() - nSubExprPos; - Insert( nSubExprPos, 3 ); - maTokVec[ nSubExprPos ] = GetTokenId( EXC_TOKID_MEMFUNC, EXC_TOKCLASS_REF ); + InsertZeros( nSubExprPos, 3 ); + mxData->maTokVec[ nSubExprPos ] = GetTokenId( EXC_TOKID_MEMFUNC, EXC_TOKCLASS_REF ); Overwrite( nSubExprPos + 1, nSubExprSize ); - // adjust the tMemFunc token according to passed expected token class - mnLastTokPos = nSubExprPos; - AdjustLastTokenClass( nExpClass ); + // update the operand/operator stack (set the list expression as operand of the tMemFunc) + XclExpOperandListRef xOperands( new XclExpOperandList ); + xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_VAL, false ); + PushOperatorPos( nSubExprPos, xOperands ); } // #i86439# enclose list operator into parentheses, e.g. Calc's =AREAS(A1~A2) to Excel's =AREAS((A1;A2)) if( bHasListOp && !bInParentheses ) @@ -1115,77 +1136,66 @@ XclExpTokenData XclExpFmlaCompImpl::ListTerm( XclExpTokenData aTokData, sal_uInt return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::IntersectTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool& rbHasRefOp ) +XclExpScToken XclExpFmlaCompImpl::IntersectTerm( XclExpScToken aTokData, bool& rbHasRefOp ) { - aTokData = RangeTerm( aTokData, nExpClass, rbHasRefOp ); + aTokData = RangeTerm( aTokData, rbHasRefOp ); sal_uInt8 nOpTokenId = EXC_TOKID_NONE; - while( mbOk && ((nOpTokenId = lclGetIntersectTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) + while( mxData->mbOk && ((nOpTokenId = lclGetIntersectTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) { - AdjustLastTokenClass( EXC_TOKCLASS_ANY_IN_REFOP ); sal_uInt8 nSpaces = aTokData.mnSpaces; - aTokData = RangeTerm( GetNextToken(), EXC_TOKCLASS_ANY_IN_REFOP, rbHasRefOp ); - AppendOpTokenId( nOpTokenId, nExpClass, nSpaces ); + aTokData = RangeTerm( GetNextToken(), rbHasRefOp ); + AppendBinaryOperatorToken( nOpTokenId, false, nSpaces ); rbHasRefOp = true; } return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::RangeTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool& rbHasRefOp ) +XclExpScToken XclExpFmlaCompImpl::RangeTerm( XclExpScToken aTokData, bool& rbHasRefOp ) { - aTokData = Factor( aTokData, nExpClass ); + aTokData = Factor( aTokData ); sal_uInt8 nOpTokenId = EXC_TOKID_NONE; - while( mbOk && ((nOpTokenId = lclGetRangeTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) + while( mxData->mbOk && ((nOpTokenId = lclGetRangeTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) ) { - AdjustLastTokenClass( EXC_TOKCLASS_ANY_IN_REFOP ); sal_uInt8 nSpaces = aTokData.mnSpaces; - aTokData = Factor( GetNextToken(), EXC_TOKCLASS_ANY_IN_REFOP ); - AppendOpTokenId( nOpTokenId, nExpClass, nSpaces ); + aTokData = Factor( GetNextToken() ); + AppendBinaryOperatorToken( nOpTokenId, false, nSpaces ); rbHasRefOp = true; } return aTokData; } -XclExpTokenData XclExpFmlaCompImpl::Factor( XclExpTokenData aTokData, sal_uInt8 nExpClass ) +XclExpScToken XclExpFmlaCompImpl::Factor( XclExpScToken aTokData ) { - if( !mbOk || !aTokData.Is() ) return XclExpTokenData(); + if( !mxData->mbOk || !aTokData.Is() ) return XclExpScToken(); - formula::StackVar eTokType = aTokData.GetType(); - OpCode eOpCode = aTokData.GetOpCode(); - - if (eOpCode == ocExternalRef) + switch( aTokData.GetType() ) { - ProcessExternalName( aTokData, nExpClass ); - return GetNextToken(); - } - - switch( eTokType ) - { - case svUnknown: mbOk = false; break; - case formula::svDouble: ProcessDouble( aTokData ); break; - case formula::svString: ProcessString( aTokData ); break; + case svUnknown: mxData->mbOk = false; break; + case svDouble: ProcessDouble( aTokData ); break; + case svString: ProcessString( aTokData ); break; #if 0 // erAck - case formula::svError: ProcessError( aTokData ); break; + case svError: ProcessError( aTokData ); break; #endif - case svSingleRef: ProcessCellRef( aTokData, nExpClass ); break; - case formula::svDoubleRef: ProcessRangeRef( aTokData, nExpClass ); break; - case svMatrix: ProcessMatrix( aTokData, nExpClass ); break; - case svExternal: ProcessExternal( aTokData, nExpClass ); break; - - default: + case svSingleRef: ProcessCellRef( aTokData ); break; + case svDoubleRef: ProcessRangeRef( aTokData ); break; + case svExternalSingleRef: ProcessExternalCellRef( aTokData ); break; + case svExternalDoubleRef: ProcessExternalRangeRef( aTokData ); break; + case svExternalName: ProcessExternalName( aTokData ); break; + case svMatrix: ProcessMatrix( aTokData ); break; + case svExternal: ProcessExternal( aTokData ); break; + + default: switch( aTokData.GetOpCode() ) { - switch( eOpCode ) - { - case ocNone: /* do nothing */ break; - case ocMissing: ProcessMissing( aTokData ); break; - case ocBad: ProcessBad( aTokData ); break; - case ocOpen: ProcessParentheses( aTokData, nExpClass ); break; - case ocName: ProcessDefinedName( aTokData, nExpClass ); break; - case ocDBArea: ProcessDatabaseArea( aTokData, nExpClass ); break; - case ocFalse: - case ocTrue: ProcessBoolean( aTokData ); break; - case ocDde: ProcessDdeLink( aTokData, nExpClass ); break; - default: ProcessFunction( aTokData, nExpClass ); - } + case ocNone: /* do nothing */ break; + case ocMissing: ProcessMissing( aTokData ); break; + case ocBad: ProcessBad( aTokData ); break; + case ocOpen: ProcessParentheses( aTokData ); break; + case ocName: ProcessDefinedName( aTokData ); break; + case ocDBArea: ProcessDatabaseArea( aTokData ); break; + case ocFalse: + case ocTrue: ProcessBoolean( aTokData ); break; + case ocDde: ProcessDdeLink( aTokData ); break; + default: ProcessFunction( aTokData ); } } @@ -1194,7 +1204,7 @@ XclExpTokenData XclExpFmlaCompImpl::Factor( XclExpTokenData aTokData, sal_uInt8 // formula structure ---------------------------------------------------------- -void XclExpFmlaCompImpl::ProcessDouble( const XclExpTokenData& rTokData ) +void XclExpFmlaCompImpl::ProcessDouble( const XclExpScToken& rTokData ) { double fValue = rTokData.mpScToken->GetDouble(); double fInt; @@ -1205,13 +1215,13 @@ void XclExpFmlaCompImpl::ProcessDouble( const XclExpTokenData& rTokData ) AppendNumToken( fValue, rTokData.mnSpaces ); } -void XclExpFmlaCompImpl::ProcessString( const XclExpTokenData& rTokData ) +void XclExpFmlaCompImpl::ProcessString( const XclExpScToken& rTokData ) { - AppendOpTokenId( EXC_TOKID_STR, EXC_TOKCLASS_NONE, rTokData.mnSpaces ); + AppendOperandTokenId( EXC_TOKID_STR, rTokData.mnSpaces ); Append( rTokData.mpScToken->GetString() ); } -void XclExpFmlaCompImpl::ProcessError( const XclExpTokenData& rTokData ) +void XclExpFmlaCompImpl::ProcessError( const XclExpScToken& rTokData ) { #if 0 // erAck AppendErrorToken( XclTools::GetXclErrorCode( rTokData.mpScToken->GetError() ), rTokData.mnSpaces ); @@ -1220,36 +1230,36 @@ void XclExpFmlaCompImpl::ProcessError( const XclExpTokenData& rTokData ) #endif } -void XclExpFmlaCompImpl::ProcessMissing( const XclExpTokenData& rTokData ) +void XclExpFmlaCompImpl::ProcessMissing( const XclExpScToken& rTokData ) { AppendMissingToken( rTokData.mnSpaces ); } -void XclExpFmlaCompImpl::ProcessBad( const XclExpTokenData& rTokData ) +void XclExpFmlaCompImpl::ProcessBad( const XclExpScToken& rTokData ) { AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces ); } -void XclExpFmlaCompImpl::ProcessParentheses( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ) +void XclExpFmlaCompImpl::ProcessParentheses( const XclExpScToken& rTokData ) { - XclExpTokenData aTokData( Expression( GetNextToken(), nExpClass, true, false ) ); - mbOk = aTokData.GetOpCode() == ocClose; + XclExpScToken aTokData = Expression( GetNextToken(), true, false ); + mxData->mbOk = aTokData.GetOpCode() == ocClose; AppendParenToken( rTokData.mnSpaces, aTokData.mnSpaces ); } -void XclExpFmlaCompImpl::ProcessBoolean( const XclExpTokenData& rTokData ) +void XclExpFmlaCompImpl::ProcessBoolean( const XclExpScToken& rTokData ) { - mbOk = GetNextToken().GetOpCode() == ocOpen; - if( mbOk ) mbOk = GetNextToken().GetOpCode() == ocClose; - if( mbOk ) + mxData->mbOk = GetNextToken().GetOpCode() == ocOpen; + if( mxData->mbOk ) mxData->mbOk = GetNextToken().GetOpCode() == ocClose; + if( mxData->mbOk ) AppendBoolToken( rTokData.GetOpCode() == ocTrue, rTokData.mnSpaces ); } namespace { -inline bool lclGetTokenString( String& rString, const XclExpTokenData& rTokData ) +inline bool lclGetTokenString( String& rString, const XclExpScToken& rTokData ) { - bool bIsStr = (rTokData.GetType() == formula::svString) && (rTokData.GetOpCode() == ocPush); + bool bIsStr = (rTokData.GetType() == svString) && (rTokData.GetOpCode() == ocPush); if( bIsStr ) rString = rTokData.mpScToken->GetString(); return bIsStr; @@ -1257,169 +1267,113 @@ inline bool lclGetTokenString( String& rString, const XclExpTokenData& rTokData } // namespace -void XclExpFmlaCompImpl::ProcessDdeLink( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ) +void XclExpFmlaCompImpl::ProcessDdeLink( const XclExpScToken& rTokData ) { String aApplic, aTopic, aItem; - mbOk = GetNextToken().GetOpCode() == ocOpen; - if( mbOk ) mbOk = lclGetTokenString( aApplic, GetNextToken() ); - if( mbOk ) mbOk = GetNextToken().GetOpCode() == ocSep; - if( mbOk ) mbOk = lclGetTokenString( aTopic, GetNextToken() ); - if( mbOk ) mbOk = GetNextToken().GetOpCode() == ocSep; - if( mbOk ) mbOk = lclGetTokenString( aItem, GetNextToken() ); - if( mbOk ) mbOk = GetNextToken().GetOpCode() == ocClose; - if( mbOk ) mbOk = aApplic.Len() && aTopic.Len() && aItem.Len(); - if( mbOk ) + mxData->mbOk = GetNextToken().GetOpCode() == ocOpen; + if( mxData->mbOk ) mxData->mbOk = lclGetTokenString( aApplic, GetNextToken() ); + if( mxData->mbOk ) mxData->mbOk = GetNextToken().GetOpCode() == ocSep; + if( mxData->mbOk ) mxData->mbOk = lclGetTokenString( aTopic, GetNextToken() ); + if( mxData->mbOk ) mxData->mbOk = GetNextToken().GetOpCode() == ocSep; + if( mxData->mbOk ) mxData->mbOk = lclGetTokenString( aItem, GetNextToken() ); + if( mxData->mbOk ) mxData->mbOk = GetNextToken().GetOpCode() == ocClose; + if( mxData->mbOk ) mxData->mbOk = aApplic.Len() && aTopic.Len() && aItem.Len(); + if( mxData->mbOk ) { sal_uInt16 nExtSheet, nExtName; - if( mpLinkMgr && mpLinkMgr->InsertDde( nExtSheet, nExtName, aApplic, aTopic, aItem ) ) - AppendNameXToken( nExtSheet, nExtName, nExpClass, rTokData.mnSpaces ); + if( mxData->mpLinkMgr && mxData->mpLinkMgr->InsertDde( nExtSheet, nExtName, aApplic, aTopic, aItem ) ) + AppendNameXToken( nExtSheet, nExtName, rTokData.mnSpaces ); else AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces ); } } -void XclExpFmlaCompImpl::ProcessExternal( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ) +void XclExpFmlaCompImpl::ProcessExternal( const XclExpScToken& rTokData ) { /* #i47228# Excel import generates svExternal/ocMacro tokens for invalid names and for external/invalid function calls. This function looks for the next token in the token array. If it is an opening parenthesis, the token is processed as external function call, otherwise as undefined name. */ - const formula::FormulaToken* pNextScToken = PeekNextRawToken( true ); + const FormulaToken* pNextScToken = PeekNextRawToken( true ); if( !pNextScToken || (pNextScToken->GetOpCode() != ocOpen) ) - AppendMissingNameToken( rTokData.mpScToken->GetExternal(), nExpClass, rTokData.mnSpaces ); + AppendMissingNameToken( rTokData.mpScToken->GetExternal(), rTokData.mnSpaces ); else - ProcessFunction( rTokData, nExpClass ); + ProcessFunction( rTokData ); } -void XclExpFmlaCompImpl::ProcessExternalName( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ) +void XclExpFmlaCompImpl::ProcessMatrix( const XclExpScToken& rTokData ) { - StackVar eType = rTokData.GetType(); - - ScExternalRefManager* pRefMgr = GetDoc().GetExternalRefManager(); - USHORT nFileId = rTokData.mpScToken->GetIndex(); - switch (eType) + const ScMatrix* pMatrix = static_cast< const ScToken* >( rTokData.mpScToken )->GetMatrix(); + if( pMatrix && mxData->mrCfg.mbAllowArrays ) { - case svExternalSingleRef: - { - if (!mpScBasePos) - { - AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces); - break; - } - ScSingleRefData aRef(static_cast(rTokData.mpScToken)->GetSingleRef()); - aRef.CalcAbsIfRel(*mpScBasePos); - const String& rTabName = rTokData.mpScToken->GetString(); - ScExternalRefCache::TokenRef p = pRefMgr->getSingleRefToken(nFileId, rTabName, ScAddress(aRef.nCol, aRef.nRow, aRef.nTab), NULL, NULL); - if (!p.get()) - { - AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces); - break; - } + SCSIZE nScCols, nScRows; + pMatrix->GetDimensions( nScCols, nScRows ); + DBG_ASSERT( (nScCols > 0) && (nScRows > 0), "XclExpFmlaCompImpl::ProcessMatrix - invalid matrix size" ); + sal_uInt16 nCols = ::limit_cast< sal_uInt16 >( nScCols, 0, 256 ); + sal_uInt16 nRows = ::limit_cast< sal_uInt16 >( nScRows, 0, 1024 ); - mpLinkMgr->StoreCell(nFileId, rTabName, aRef); - - XclAddress aXclPos(ScAddress::UNINITIALIZED); - ConvertRefData(aRef, aXclPos, false, false, false); - - sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab; - mpLinkMgr->FindExtSheet(nFileId, rTabName, 1, nExtSheet, nFirstSBTab, nLastSBTab, GetNewRefLogEntry()); - sal_uInt8 nBaseId = lclIsRefDel2D(aRef) ? EXC_TOKID_REFERR3D : EXC_TOKID_REF3D; - AppendOpTokenId(GetTokenId(nBaseId, EXC_TOKCLASS_REF), nExpClass, rTokData.mnSpaces); - Append(nExtSheet); - if (meBiff <= EXC_BIFF5) - { - Append(0, 8); - Append(static_cast(nFirstSBTab)); - Append(static_cast(nFirstSBTab)); - } - AppendAddress(aXclPos); - } - break; - case svExternalDoubleRef: - { - if (!mpScBasePos) - { - AppendErrorToken(XclTools::GetXclErrorCode(errNoRef), rTokData.mnSpaces); - break; - } - ScComplexRefData aRef(static_cast(rTokData.mpScToken)->GetDoubleRef()); - aRef.CalcAbsIfRel(*mpScBasePos); - const String& rTabName = rTokData.mpScToken->GetString(); - const ScSingleRefData& r1 = aRef.Ref1; - const ScSingleRefData& r2 = aRef.Ref2; - ScRange aRange(r1.nCol, r1.nRow, r1.nTab, r2.nCol, r2.nRow, r2.nTab); - ScExternalRefCache::TokenArrayRef pArray = pRefMgr->getDoubleRefTokens(nFileId, rTabName, aRange, NULL); - if (!pArray.get()) - { - AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces); - break; - } + // create the tArray token + AppendOperandTokenId( GetTokenId( EXC_TOKID_ARRAY, EXC_TOKCLASS_ARR ), rTokData.mnSpaces ); + Append( static_cast< sal_uInt8 >( (meBiff == EXC_BIFF8) ? (nCols - 1) : nCols ) ); + Append( static_cast< sal_uInt16 >( (meBiff == EXC_BIFF8) ? (nRows - 1) : nRows ) ); + Append( static_cast< sal_uInt32 >( 0 ) ); - mpLinkMgr->StoreCellRange(nFileId, rTabName, aRef); - XclRange aXclRange(ScAddress::UNINITIALIZED); - ConvertRefData(aRef, aXclRange, false); - sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab; - sal_uInt16 nTabSpan = r2.nTab - r1.nTab + 1; - mpLinkMgr->FindExtSheet(nFileId, rTabName, nTabSpan, nExtSheet, nFirstSBTab, nLastSBTab, GetNewRefLogEntry()); - - sal_uInt8 nBaseId = lclIsRefDel2D(aRef) ? EXC_TOKID_AREAERR3D : EXC_TOKID_AREA3D; - AppendOpTokenId(GetTokenId( nBaseId, EXC_TOKCLASS_REF ), nExpClass, rTokData.mnSpaces); - Append(nExtSheet); - if (meBiff <= EXC_BIFF5) - { - Append(0, 8); - Append(static_cast(nFirstSBTab)); - Append(static_cast(nLastSBTab)); - } - AppendRange(aXclRange); - } - break; - case svExternalName: + // create the extended data containing the array values + AppendExt( static_cast< sal_uInt8 >( (meBiff == EXC_BIFF8) ? (nCols - 1) : nCols ) ); + AppendExt( static_cast< sal_uInt16 >( (meBiff == EXC_BIFF8) ? (nRows - 1) : nRows ) ); + for( SCSIZE nScRow = 0; nScRow < nScRows; ++nScRow ) { - const String& aName = rTokData.mpScToken->GetString(); - ScExternalRefCache::TokenArrayRef pArray = pRefMgr->getRangeNameTokens(nFileId, aName); - if (!pArray.get() || !mpScBasePos) + for( SCSIZE nScCol = 0; nScCol < nScCols; ++nScCol ) { - AppendErrorToken(XclTools::GetXclErrorCode(errNoName), rTokData.mnSpaces); - break; - } - - // Go through all these tokens to store the external cell/range - // references for CRN records. - for (formula::FormulaToken* p = pArray->First(); p; p = pArray->Next()) - { - if (p->GetOpCode() == ocExternalRef) + ScMatValType nType; + const ScMatrixValue* pMatVal = pMatrix->Get( nScCol, nScRow, nType ); + DBG_ASSERT( pMatVal, "XclExpFmlaCompImpl::ProcessMatrix - missing matrix value" ); + if( ScMatrix::IsValueType( nType ) ) // value, boolean, or error + { + if( ScMatrix::IsBooleanType( nType ) ) + { + AppendExt( EXC_CACHEDVAL_BOOL ); + AppendExt( static_cast< sal_uInt8 >( pMatVal->GetBoolean() ? 1 : 0 ) ); + AppendExt( 0, 7 ); + } + else if( USHORT nErr = pMatVal->GetError() ) + { + AppendExt( EXC_CACHEDVAL_ERROR ); + AppendExt( XclTools::GetXclErrorCode( nErr ) ); + AppendExt( 0, 7 ); + } + else + { + AppendExt( EXC_CACHEDVAL_DOUBLE ); + AppendExt( pMatVal->fVal ); + } + } + else // string or empty { - if (p->GetType() == svExternalSingleRef) + const String& rStr = pMatVal->GetString(); + if( rStr.Len() == 0 ) { - ScSingleRefData aData(static_cast(p)->GetSingleRef()); - aData.CalcAbsIfRel(*mpScBasePos); - mpLinkMgr->StoreCell(nFileId, p->GetString(), aData); + AppendExt( EXC_CACHEDVAL_EMPTY ); + AppendExt( 0, 8 ); } - else if (p->GetType() == svExternalDoubleRef) + else { - ScComplexRefData aData(static_cast(p)->GetDoubleRef()); - aData.CalcAbsIfRel(*mpScBasePos); - mpLinkMgr->StoreCellRange(nFileId, p->GetString(), aData); + AppendExt( EXC_CACHEDVAL_STRING ); + AppendExt( rStr ); } } } - - const String* pFile = pRefMgr->getExternalFileName(nFileId); - sal_uInt16 nExtSheet, nExtName; - if (mpLinkMgr->InsertExtName(nExtSheet, nExtName, *pFile, aName, pArray)) - AppendNameXToken(nExtSheet, nExtName, nExpClass, rTokData.mnSpaces); - else - AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces); } - break; - default: - ; // nothing + } + else + { + // array in places that do not allow it (cond fmts, data validation) + AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces ); } } -void XclExpFmlaCompImpl::ProcessFunction( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ) +void XclExpFmlaCompImpl::ProcessFunction( const XclExpScToken& rTokData ) { OpCode eOpCode = rTokData.GetOpCode(); const XclFunctionInfo* pFuncInfo = maFuncProv.GetFuncInfoFromOpCode( eOpCode ); @@ -1437,15 +1391,15 @@ void XclExpFmlaCompImpl::ProcessFunction( const XclExpTokenData& rTokData, sal_u } } - mbOk = pFuncInfo != 0; - if( !mbOk ) return; + mxData->mbOk = pFuncInfo != 0; + if( !mxData->mbOk ) return; // functions simulated by a macro call in file format if( pFuncInfo->IsMacroFunc() ) aExtFuncData.Set( pFuncInfo->GetMacroFuncName(), false, true ); - XclExpFuncData aFuncData( rTokData, *pFuncInfo, aExtFuncData, nExpClass ); - XclExpTokenData aTokData; + XclExpFuncData aFuncData( rTokData, *pFuncInfo, aExtFuncData ); + XclExpScToken aTokData; // preparations for special functions, before function processing starts PrepareFunction( aFuncData ); @@ -1455,12 +1409,12 @@ void XclExpFmlaCompImpl::ProcessFunction( const XclExpTokenData& rTokData, sal_u while( eState != STATE_END ) switch( eState ) { case STATE_START: - mbOk = GetNextToken( aTokData ) && (aTokData.GetOpCode() == ocOpen); - eState = mbOk ? STATE_OPEN : STATE_END; + mxData->mbOk = GetNextToken( aTokData ) && (aTokData.GetOpCode() == ocOpen); + eState = mxData->mbOk ? STATE_OPEN : STATE_END; break; case STATE_OPEN: - mbOk = GetNextToken( aTokData ); - eState = mbOk ? ((aTokData.GetOpCode() == ocClose) ? STATE_CLOSE : STATE_PARAM) : STATE_END; + mxData->mbOk = GetNextToken( aTokData ); + eState = mxData->mbOk ? ((aTokData.GetOpCode() == ocClose) ? STATE_CLOSE : STATE_PARAM) : STATE_END; break; case STATE_PARAM: aTokData = ProcessParam( aTokData, aFuncData ); @@ -1468,13 +1422,13 @@ void XclExpFmlaCompImpl::ProcessFunction( const XclExpTokenData& rTokData, sal_u { case ocSep: eState = STATE_SEP; break; case ocClose: eState = STATE_CLOSE; break; - default: mbOk = false; + default: mxData->mbOk = false; } - if( !mbOk ) eState = STATE_END; + if( !mxData->mbOk ) eState = STATE_END; break; case STATE_SEP: - mbOk = (aFuncData.GetParamCount() < EXC_FUNC_MAXPARAM) && GetNextToken( aTokData ); - eState = mbOk ? STATE_PARAM : STATE_END; + mxData->mbOk = (aFuncData.GetParamCount() < EXC_FUNC_MAXPARAM) && GetNextToken( aTokData ); + eState = mxData->mbOk ? STATE_PARAM : STATE_END; break; case STATE_CLOSE: FinishFunction( aFuncData, aTokData.mnSpaces ); @@ -1506,11 +1460,8 @@ void XclExpFmlaCompImpl::FinishFunction( XclExpFuncData& rFuncData, sal_uInt8 nC // check if parameter count fits into the limits of the function sal_uInt8 nParamCount = rFuncData.GetParamCount(); - sal_uInt8 nMinCount = rFuncData.GetMinParamCount(); - sal_uInt8 nMaxCount = rFuncData.GetMaxParamCount(); - if( (nMinCount <= nParamCount) && (nParamCount <= nMaxCount) ) + if( (rFuncData.GetMinParamCount() <= nParamCount) && (nParamCount <= rFuncData.GetMaxParamCount()) ) { - sal_uInt16 nXclFuncIdx = rFuncData.GetXclFuncIdx(); // first put the tAttrSpace tokens, they must not be included in tAttrGoto handling AppendSpaceToken( EXC_TOK_ATTR_SPACE_SP_CLOSE, nCloseSpaces ); AppendSpaceToken( EXC_TOK_ATTR_SPACE_SP, rFuncData.GetSpaces() ); @@ -1526,31 +1477,10 @@ void XclExpFmlaCompImpl::FinishFunction( XclExpFuncData& rFuncData, sal_uInt8 nC } // put the tFunc or tFuncVar token (or another special token, e.g. tAttrSum) - sal_uInt8 nRetClass = rFuncData.GetReturnClass(); - sal_uInt8 nExpRetClass = rFuncData.GetExpReturnClass(); - if( (nXclFuncIdx == EXC_FUNCID_SUM) && (nParamCount == 1) ) - { - // SUM with only one parameter - AppendOpTokenId( EXC_TOKID_ATTR, nExpRetClass ); - Append( EXC_TOK_ATTR_SUM ); - Append( sal_uInt16( 0 ) ); - } - else if( (nMinCount == nMaxCount) && (nXclFuncIdx != EXC_FUNCID_EXTERNCALL) ) - { - // fixed number of parameters - AppendOpTokenId( GetTokenId( EXC_TOKID_FUNC, nRetClass ), nExpRetClass ); - Append( nXclFuncIdx ); - } - else - { - // variable number of parameters - AppendOpTokenId( GetTokenId( EXC_TOKID_FUNCVAR, nRetClass ), nExpRetClass ); - Append( nParamCount ); - Append( nXclFuncIdx ); - } + AppendFuncToken( rFuncData ); // update volatile flag - is set if at least one used function is volatile - mbVolatile |= rFuncData.IsVolatile(); + mxData->mbVolatile |= rFuncData.IsVolatile(); // update jump tokens for specific functions, add additional tokens switch( rFuncData.GetOpCode() ) @@ -1564,11 +1494,11 @@ void XclExpFmlaCompImpl::FinishFunction( XclExpFuncData& rFuncData, sal_uInt8 nC case ocCot: // simulate COT(x) by (1/TAN(x)) case ocCotHyp: // simulate COTH(x) by (1/TANH(x)) - AppendOpTokenId( EXC_TOKID_DIV, EXC_TOKCLASS_NONE ); + AppendBinaryOperatorToken( EXC_TOKID_DIV, true ); AppendParenToken(); break; case ocArcCot: // simulate ACOT(x) by (PI/2-ATAN(x)) - AppendOpTokenId( EXC_TOKID_SUB, EXC_TOKCLASS_NONE ); + AppendBinaryOperatorToken( EXC_TOKID_SUB, true ); AppendParenToken(); break; @@ -1576,7 +1506,7 @@ void XclExpFmlaCompImpl::FinishFunction( XclExpFuncData& rFuncData, sal_uInt8 nC } } else - mbOk = false; + mxData->mbOk = false; } void XclExpFmlaCompImpl::FinishIfFunction( XclExpFuncData& rFuncData ) @@ -1607,7 +1537,7 @@ void XclExpFmlaCompImpl::FinishChooseFunction( XclExpFuncData& rFuncData ) // size of jump table: number of choices, plus 1 for error position sal_uInt16 nJumpArrSize = 2 * (nChoices + 1); // insert the jump table into the tAttrChoose token - Insert( nJumpArrPos, nJumpArrSize ); + InsertZeros( nJumpArrPos, nJumpArrSize ); // update positions of tAttrGoto tokens after jump table insertion sal_uInt16 nIdx; for( nIdx = 1; nIdx < nParamCount; ++nIdx ) @@ -1621,25 +1551,20 @@ void XclExpFmlaCompImpl::FinishChooseFunction( XclExpFuncData& rFuncData ) Overwrite( nJumpArrPos + 2 * nIdx, static_cast< sal_uInt16 >( rAttrPos[ nIdx ] + 4 - nJumpArrPos ) ); } -XclExpTokenData XclExpFmlaCompImpl::ProcessParam( XclExpTokenData aTokData, XclExpFuncData& rFuncData ) +XclExpScToken XclExpFmlaCompImpl::ProcessParam( XclExpScToken aTokData, XclExpFuncData& rFuncData ) { - if( rFuncData.GetExpParamClass() == EXC_FUNC_PAR_CALCONLY ) + if( rFuncData.IsCalcOnlyParam() ) { // skip Calc-only parameter, stop at next ocClose or ocSep aTokData = SkipExpression( aTokData, true ); - rFuncData.IncExpParamClassIdx(); + rFuncData.IncParamInfoIdx(); } else { // insert Excel-only parameters, modifies param count and class in rFuncData - while( rFuncData.GetExpParamClass() == EXC_FUNC_PAR_EXCELONLY ) + while( rFuncData.IsExcelOnlyParam() ) AppendDefaultParam( rFuncData ); - // propagate expected ARR class to subsequent subexpressions - sal_uInt8 nExpClass = rFuncData.GetExpParamClass(); - bool bOldIsArrExp = mbIsArrExp; - UpdateArrExpFlag( nExpClass, rFuncData.GetReturnClass() ); - // process the parameter, stop at next ocClose or ocSep PrepareParam( rFuncData ); /* #i37355# insert tMissArg token for missing parameters -- @@ -1649,12 +1574,10 @@ XclExpTokenData XclExpFmlaCompImpl::ProcessParam( XclExpTokenData aTokData, XclE { case ocSep: case ocClose: AppendMissingToken(); break; // empty parameter - default: aTokData = Expression( aTokData, nExpClass, false, true ); + default: aTokData = Expression( aTokData, false, true ); } - // restore old expected ARR class mode - SetArrExpFlag( bOldIsArrExp ); // finalize the parameter and add special tokens, e.g. for IF or CHOOSE parameters - if( mbOk ) FinishParam( rFuncData ); + if( mxData->mbOk ) FinishParam( rFuncData ); } return aTokData; } @@ -1698,21 +1621,18 @@ void XclExpFmlaCompImpl::PrepareParam( XclExpFuncData& rFuncData ) void XclExpFmlaCompImpl::FinishParam( XclExpFuncData& rFuncData ) { - // index of this parameter is equal to number of already finished parameters - sal_uInt8 nParamIdx = rFuncData.GetParamCount(); - - // increase parameter count - rFuncData.IncParamCount(); - // move to next expected parameter class - rFuncData.IncExpParamClassIdx(); + // increase parameter count, update operand stack + rFuncData.FinishParam( PopOperandPos() ); + // append more tokens for parameters of some special functions + sal_uInt8 nParamIdx = rFuncData.GetParamCount() - 1; switch( rFuncData.GetOpCode() ) { case ocArcCotHyp: // simulate ACOTH(x) by ATANH(1/(x)) if( nParamIdx == 0 ) { AppendParenToken(); - AppendOpTokenId( EXC_TOKID_DIV, EXC_TOKCLASS_NONE ); + AppendBinaryOperatorToken( EXC_TOKID_DIV, true ); } break; default:; @@ -1727,19 +1647,19 @@ void XclExpFmlaCompImpl::AppendDefaultParam( XclExpFuncData& rFuncData ) switch( rFuncData.GetOpCode() ) { case ocExternal: - AppendAddInFuncToken( rFuncData.GetExtFuncData(), EXC_TOKCLASS_REF ); + AppendAddInCallToken( rFuncData.GetExtFuncData() ); break; case ocEuroConvert: - AppendEuroToolFuncToken( rFuncData.GetExtFuncData(), EXC_TOKCLASS_REF ); + AppendEuroToolCallToken( rFuncData.GetExtFuncData() ); break; case ocMacro: - AppendMacroCallToken( rFuncData.GetExtFuncData(), EXC_TOKCLASS_REF ); + AppendMacroCallToken( rFuncData.GetExtFuncData() ); break; default: { DBG_ASSERT( rFuncData.IsMacroFunc(), "XclExpFmlaCompImpl::AppendDefaultParam - unknown opcode" ); if( rFuncData.IsMacroFunc() ) - AppendMacroCallToken( rFuncData.GetExtFuncData(), EXC_TOKCLASS_REF ); + AppendMacroCallToken( rFuncData.GetExtFuncData() ); else AppendMissingToken(); // to keep parameter count valid } @@ -1813,25 +1733,77 @@ void XclExpFmlaCompImpl::AppendTrailingParam( XclExpFuncData& rFuncData ) } break; + case ocNormDist: + if( nParamCount == 3 ) + { + // NORMDIST function needs 4 parameters in Excel + PrepareParam( rFuncData ); + AppendBoolToken( true ); + FinishParam( rFuncData ); + } + break; + + case ocLogNormDist: + switch( nParamCount ) + { + // LOGNORMDIST function needs 3 parameters in Excel + case 1: + PrepareParam( rFuncData ); + AppendIntToken( 0 ); + FinishParam( rFuncData ); + // do not break, add next default parameter + case 2: + PrepareParam( rFuncData ); + AppendIntToken( 1 ); + FinishParam( rFuncData ); + break; + default:; + } + + break; + default:; } } -// ---------------------------------------------------------------------------- +// reference handling --------------------------------------------------------- + +namespace { + +inline bool lclIsRefRel2D( const ScSingleRefData& rRefData ) +{ + return rRefData.IsColRel() || rRefData.IsRowRel(); +} + +inline bool lclIsRefDel2D( const ScSingleRefData& rRefData ) +{ + return rRefData.IsColDeleted() || rRefData.IsRowDeleted(); +} + +inline bool lclIsRefRel2D( const ScComplexRefData& rRefData ) +{ + return lclIsRefRel2D( rRefData.Ref1 ) || lclIsRefRel2D( rRefData.Ref2 ); +} + +inline bool lclIsRefDel2D( const ScComplexRefData& rRefData ) +{ + return lclIsRefDel2D( rRefData.Ref1 ) || lclIsRefDel2D( rRefData.Ref2 ); +} + +} // namespace SCTAB XclExpFmlaCompImpl::GetScTab( const ScSingleRefData& rRefData ) const { - bool bInvTab = rRefData.IsTabDeleted() || (!mpScBasePos && rRefData.IsTabRel()); + bool bInvTab = rRefData.IsTabDeleted() || (!mxData->mpScBasePos && IsInGlobals() && rRefData.IsTabRel()); return bInvTab ? SCTAB_INVALID : static_cast< SCTAB >( rRefData.nTab ); } bool XclExpFmlaCompImpl::IsRef2D( const ScSingleRefData& rRefData ) const { - /* rRefData.IsFlag3D() determines if sheet name is always visible, even on the - own sheet. If 3D references are allowed, the passed reference does not count - as 2D reference. If only 2D references are allowed (mpLinkMgr is 0), this - flag is ignored, thus the passed reference will be handled as 2D reference. */ - return (!mpLinkMgr || !rRefData.IsFlag3D()) && !rRefData.IsTabDeleted() && + /* rRefData.IsFlag3D() determines if sheet name is always visible, even on + the own sheet. If 3D references are allowed, the passed reference does + not count as 2D reference. */ + return (!mxData->mpLinkMgr || !rRefData.IsFlag3D()) && !rRefData.IsTabDeleted() && (rRefData.IsTabRel() ? (rRefData.nRelTab == 0) : (static_cast< SCTAB >( rRefData.nTab ) == GetCurrScTab())); } @@ -1844,10 +1816,10 @@ void XclExpFmlaCompImpl::ConvertRefData( ScSingleRefData& rRefData, XclAddress& rXclPos, bool bNatLangRef, bool bTruncMaxCol, bool bTruncMaxRow ) const { - if( mpScBasePos ) + if( mxData->mpScBasePos ) { // *** reference position exists (cell, matrix) - convert to absolute *** - rRefData.CalcAbsIfRel( *mpScBasePos ); + rRefData.CalcAbsIfRel( *mxData->mpScBasePos ); // convert column index SCsCOL& rnScCol = rRefData.nCol; @@ -1876,6 +1848,10 @@ void XclExpFmlaCompImpl::ConvertRefData( // convert row index (2-step-cast ScsROW->sal_Int16->sal_uInt16 to get all bits correctly) sal_Int16 nXclRelRow = static_cast< sal_Int16 >( rRefData.IsRowRel() ? rRefData.nRelRow : rRefData.nRow ); rXclPos.mnRow = static_cast< sal_uInt16 >( nXclRelRow ) & mnMaxRowMask; + + // resolve relative tab index if possible + if( rRefData.IsTabRel() && !IsInGlobals() && (GetCurrScTab() < GetDoc().GetTableCount()) ) + rRefData.nTab = static_cast< SCsTAB >( GetCurrScTab() + rRefData.nRelTab ); } // flags for relative column and row @@ -1905,19 +1881,19 @@ void XclExpFmlaCompImpl::ConvertRefData( XclExpRefLogEntry* XclExpFmlaCompImpl::GetNewRefLogEntry() { - if( mpRefLog ) + if( mxData->mpRefLog ) { - mpRefLog->resize( mpRefLog->size() + 1 ); - return &mpRefLog->back(); + mxData->mpRefLog->resize( mxData->mpRefLog->size() + 1 ); + return &mxData->mpRefLog->back(); } return 0; } -void XclExpFmlaCompImpl::ProcessCellRef( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ) +void XclExpFmlaCompImpl::ProcessCellRef( const XclExpScToken& rTokData ) { // get the Excel address components, adjust internal data in aRefData - bool bNatLangRef = (meBiff == EXC_BIFF8) && mpScBasePos && (rTokData.GetOpCode() == ocColRowName); - ScSingleRefData aRefData( static_cast(rTokData.mpScToken)->GetSingleRef() ); + bool bNatLangRef = (meBiff == EXC_BIFF8) && mxData->mpScBasePos && (rTokData.GetOpCode() == ocColRowName); + ScSingleRefData aRefData = static_cast< const ScToken* >( rTokData.mpScToken )->GetSingleRef(); XclAddress aXclPos( ScAddress::UNINITIALIZED ); ConvertRefData( aRefData, aXclPos, bNatLangRef, false, false ); @@ -1927,33 +1903,33 @@ void XclExpFmlaCompImpl::ProcessCellRef( const XclExpTokenData& rTokData, sal_uI "XclExpFmlaCompImpl::ProcessCellRef - broken natural language reference" ); // create tNlr token for natural language reference sal_uInt8 nSubId = aRefData.IsColRel() ? EXC_TOK_NLR_COLV : EXC_TOK_NLR_ROWV; - AppendOpTokenId( EXC_TOKID_NLR, nExpClass, rTokData.mnSpaces ); + AppendOperandTokenId( EXC_TOKID_NLR, rTokData.mnSpaces ); Append( nSubId ); AppendAddress( aXclPos ); } else { // store external cell contents in CRN records - if( maCfg.mbFromCell && mpLinkMgr && mpScBasePos ) - mpLinkMgr->StoreCell( aRefData ); + if( mxData->mrCfg.mbFromCell && mxData->mpLinkMgr && mxData->mpScBasePos ) + mxData->mpLinkMgr->StoreCell( aRefData ); // create the tRef, tRefErr, tRefN, tRef3d, or tRefErr3d token - if( !maCfg.mb3DRefOnly && IsRef2D( aRefData ) ) + if( !mxData->mrCfg.mb3DRefOnly && IsRef2D( aRefData ) ) { // 2D reference (not in defined names, but allowed in range lists) - sal_uInt8 nBaseId = (!mpScBasePos && lclIsRefRel2D( aRefData )) ? EXC_TOKID_REFN : + sal_uInt8 nBaseId = (!mxData->mpScBasePos && lclIsRefRel2D( aRefData )) ? EXC_TOKID_REFN : (lclIsRefDel2D( aRefData ) ? EXC_TOKID_REFERR : EXC_TOKID_REF); - AppendOpTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), nExpClass, rTokData.mnSpaces ); + AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces ); AppendAddress( aXclPos ); } - else if( mpLinkMgr ) // 3D reference + else if( mxData->mpLinkMgr ) // 3D reference { // 1-based EXTERNSHEET index and 0-based Excel sheet index sal_uInt16 nExtSheet, nXclTab; - mpLinkMgr->FindExtSheet( nExtSheet, nXclTab, GetScTab( aRefData ), GetNewRefLogEntry() ); + mxData->mpLinkMgr->FindExtSheet( nExtSheet, nXclTab, GetScTab( aRefData ), GetNewRefLogEntry() ); // write the token sal_uInt8 nBaseId = lclIsRefDel2D( aRefData ) ? EXC_TOKID_REFERR3D : EXC_TOKID_REF3D; - AppendOpTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), nExpClass, rTokData.mnSpaces ); + AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces ); Append( nExtSheet ); if( meBiff <= EXC_BIFF5 ) { @@ -1971,35 +1947,35 @@ void XclExpFmlaCompImpl::ProcessCellRef( const XclExpTokenData& rTokData, sal_uI } } -void XclExpFmlaCompImpl::ProcessRangeRef( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ) +void XclExpFmlaCompImpl::ProcessRangeRef( const XclExpScToken& rTokData ) { // get the Excel address components, adjust internal data in aRefData - ScComplexRefData aRefData( static_cast(rTokData.mpScToken)->GetDoubleRef() ); + ScComplexRefData aRefData = static_cast< const ScToken* >( rTokData.mpScToken )->GetDoubleRef(); XclRange aXclRange( ScAddress::UNINITIALIZED ); ConvertRefData( aRefData, aXclRange, false ); // store external cell contents in CRN records - if( maCfg.mbFromCell && mpLinkMgr && mpScBasePos ) - mpLinkMgr->StoreCellRange( aRefData ); + if( mxData->mrCfg.mbFromCell && mxData->mpLinkMgr && mxData->mpScBasePos ) + mxData->mpLinkMgr->StoreCellRange( aRefData ); // create the tArea, tAreaErr, tAreaN, tArea3d, or tAreaErr3d token - if( !maCfg.mb3DRefOnly && IsRef2D( aRefData ) ) + if( !mxData->mrCfg.mb3DRefOnly && IsRef2D( aRefData ) ) { // 2D reference (not in name formulas, but allowed in range lists) - sal_uInt8 nBaseId = (!mpScBasePos && lclIsRefRel2D( aRefData )) ? EXC_TOKID_AREAN : + sal_uInt8 nBaseId = (!mxData->mpScBasePos && lclIsRefRel2D( aRefData )) ? EXC_TOKID_AREAN : (lclIsRefDel2D( aRefData ) ? EXC_TOKID_AREAERR : EXC_TOKID_AREA); - AppendOpTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), nExpClass, rTokData.mnSpaces ); + AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces ); AppendRange( aXclRange ); } - else if( mpLinkMgr ) // 3D reference + else if( mxData->mpLinkMgr ) // 3D reference { // 1-based EXTERNSHEET index and 0-based Excel sheet indexes sal_uInt16 nExtSheet, nFirstXclTab, nLastXclTab; - mpLinkMgr->FindExtSheet( nExtSheet, nFirstXclTab, nLastXclTab, + mxData->mpLinkMgr->FindExtSheet( nExtSheet, nFirstXclTab, nLastXclTab, GetScTab( aRefData.Ref1 ), GetScTab( aRefData.Ref2 ), GetNewRefLogEntry() ); // write the token sal_uInt8 nBaseId = lclIsRefDel2D( aRefData ) ? EXC_TOKID_AREAERR3D : EXC_TOKID_AREA3D; - AppendOpTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), nExpClass, rTokData.mnSpaces ); + AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces ); Append( nExtSheet ); if( meBiff <= EXC_BIFF5 ) { @@ -2016,7 +1992,80 @@ void XclExpFmlaCompImpl::ProcessRangeRef( const XclExpTokenData& rTokData, sal_u } } -void XclExpFmlaCompImpl::ProcessDefinedName( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ) +void XclExpFmlaCompImpl::ProcessExternalCellRef( const XclExpScToken& rTokData ) +{ + if( mxData->mpLinkMgr ) + { + // get the Excel address components, adjust internal data in aRefData + ScSingleRefData aRefData = static_cast< const ScToken* >( rTokData.mpScToken )->GetSingleRef(); + XclAddress aXclPos( ScAddress::UNINITIALIZED ); + ConvertRefData( aRefData, aXclPos, false, false, false ); + + // store external cell contents in CRN records + USHORT nFileId = rTokData.mpScToken->GetIndex(); + const String& rTabName = rTokData.mpScToken->GetString(); + if( mxData->mrCfg.mbFromCell && mxData->mpScBasePos ) + mxData->mpLinkMgr->StoreCell( nFileId, rTabName, aRefData ); + + // 1-based EXTERNSHEET index and 0-based Excel sheet indexes + sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab; + mxData->mpLinkMgr->FindExtSheet( nFileId, rTabName, 1, nExtSheet, nFirstSBTab, nLastSBTab, GetNewRefLogEntry() ); + // write the token + sal_uInt8 nBaseId = lclIsRefDel2D( aRefData ) ? EXC_TOKID_REFERR3D : EXC_TOKID_REF3D; + AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces ); + Append( nExtSheet ); + if( meBiff <= EXC_BIFF5 ) + { + Append( 0, 8 ); + Append( nFirstSBTab ); + Append( nLastSBTab ); + } + AppendAddress( aXclPos ); + } + else + { + AppendErrorToken( EXC_ERR_REF, rTokData.mnSpaces ); + } +} + +void XclExpFmlaCompImpl::ProcessExternalRangeRef( const XclExpScToken& rTokData ) +{ + if( mxData->mpLinkMgr ) + { + // get the Excel address components, adjust internal data in aRefData + ScComplexRefData aRefData = static_cast< const ScToken* >( rTokData.mpScToken )->GetDoubleRef(); + XclRange aXclRange( ScAddress::UNINITIALIZED ); + ConvertRefData( aRefData, aXclRange, false ); + + // store external cell contents in CRN records + USHORT nFileId = rTokData.mpScToken->GetIndex(); + const String& rTabName = rTokData.mpScToken->GetString(); + if( mxData->mrCfg.mbFromCell && mxData->mpScBasePos ) + mxData->mpLinkMgr->StoreCellRange( nFileId, rTabName, aRefData ); + + // 1-based EXTERNSHEET index and 0-based Excel sheet indexes + sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab; + sal_uInt16 nTabSpan = static_cast< sal_uInt16 >( aRefData.Ref2.nTab - aRefData.Ref1.nTab + 1 ); + mxData->mpLinkMgr->FindExtSheet( nFileId, rTabName, nTabSpan, nExtSheet, nFirstSBTab, nLastSBTab, GetNewRefLogEntry() ); + // write the token + sal_uInt8 nBaseId = lclIsRefDel2D( aRefData ) ? EXC_TOKID_AREAERR3D : EXC_TOKID_AREA3D; + AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces ); + Append( nExtSheet ); + if( meBiff <= EXC_BIFF5 ) + { + Append( 0, 8 ); + Append( nFirstSBTab ); + Append( nLastSBTab ); + } + AppendRange( aXclRange ); + } + else + { + AppendErrorToken( EXC_ERR_REF, rTokData.mnSpaces ); + } +} + +void XclExpFmlaCompImpl::ProcessDefinedName( const XclExpScToken& rTokData ) { XclExpNameManager& rNameMgr = GetNameManager(); sal_uInt16 nNameIdx = rNameMgr.InsertName( rTokData.mpScToken->GetIndex() ); @@ -2024,218 +2073,167 @@ void XclExpFmlaCompImpl::ProcessDefinedName( const XclExpTokenData& rTokData, sa { // global names always with tName token, local names dependent on config SCTAB nScTab = rNameMgr.GetScTab( nNameIdx ); - if( (nScTab == SCTAB_GLOBAL) || (!maCfg.mb3DRefOnly && (nScTab == GetCurrScTab())) ) + if( (nScTab == SCTAB_GLOBAL) || (!mxData->mrCfg.mb3DRefOnly && (nScTab == GetCurrScTab())) ) { - AppendNameToken( nNameIdx, nExpClass, rTokData.mnSpaces ); + AppendNameToken( nNameIdx, rTokData.mnSpaces ); } - else if( mpLinkMgr ) + else if( mxData->mpLinkMgr ) { // use the same special EXTERNNAME to refer to any local name - sal_uInt16 nExtSheet = mpLinkMgr->FindExtSheet( EXC_EXTSH_OWNDOC ); - AppendNameXToken( nExtSheet, nNameIdx, nExpClass, rTokData.mnSpaces ); + sal_uInt16 nExtSheet = mxData->mpLinkMgr->FindExtSheet( EXC_EXTSH_OWNDOC ); + AppendNameXToken( nExtSheet, nNameIdx, rTokData.mnSpaces ); } else AppendErrorToken( EXC_ERR_NAME, rTokData.mnSpaces ); // volatile names (containing volatile functions) - mbVolatile |= rNameMgr.IsVolatile( nNameIdx ); + mxData->mbVolatile |= rNameMgr.IsVolatile( nNameIdx ); } else AppendErrorToken( EXC_ERR_NAME, rTokData.mnSpaces ); } -void XclExpFmlaCompImpl::ProcessDatabaseArea( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ) -{ - sal_uInt16 nNameIdx = GetNameManager().InsertDBRange( rTokData.mpScToken->GetIndex() ); - AppendNameToken( nNameIdx, nExpClass, rTokData.mnSpaces ); -} - -// token identifiers ---------------------------------------------------------- - -void XclExpFmlaCompImpl::SetReplaceTokenClasses() +void XclExpFmlaCompImpl::ProcessExternalName( const XclExpScToken& rTokData ) { - /* REF expected: change VAL to ARR in array and name type, or if ARR is expected somewhere before. - Example: How does the return class of PI() (default VAL) change in SUM() (expects REF)? - =SUM(PI()) -> PI() still returns VAL in cell formula - {=SUM(PI())} -> PI() returns ARR in array formula - =MDET(SUM(PI())) -> expected ARR from MDET(), PI() returns ARR too - */ - mnRefExpClass = (mbIsArrExp || (maCfg.meClassType != EXC_CLASSTYPE_CELL)) ? EXC_TOKCLASS_ARR : EXC_TOKCLASS_VAL; + if( mxData->mpLinkMgr ) + { + ScExternalRefManager& rExtRefMgr = *GetDoc().GetExternalRefManager(); + USHORT nFileId = rTokData.mpScToken->GetIndex(); + const String& rName = rTokData.mpScToken->GetString(); + ScExternalRefCache::TokenArrayRef xArray = rExtRefMgr.getRangeNameTokens( nFileId, rName ); + if( xArray.get() ) + { + // store external cell contents in CRN records + if( mxData->mpScBasePos ) + { + for( FormulaToken* pScToken = xArray->First(); pScToken; pScToken = xArray->Next() ) + { + if( pScToken->GetOpCode() == ocExternalRef ) + { + switch( pScToken->GetType() ) + { + case svExternalSingleRef: + { + ScSingleRefData aRefData = static_cast< ScToken* >( pScToken )->GetSingleRef(); + aRefData.CalcAbsIfRel( *mxData->mpScBasePos ); + mxData->mpLinkMgr->StoreCell( nFileId, pScToken->GetString(), aRefData ); + } + break; + case svExternalDoubleRef: + { + ScComplexRefData aRefData = static_cast< ScToken* >( pScToken )->GetDoubleRef(); + aRefData.CalcAbsIfRel( *mxData->mpScBasePos ); + mxData->mpLinkMgr->StoreCellRange( nFileId, pScToken->GetString(), aRefData ); + } + default: + ; // nothing, avoid compiler warning + } + } + } + } - /* VAL expected: set to ARR, if ARR is expected somewhere before; otherwise set to VAL. - Example: How does the class of A1 (default REF) change in ABS() (expects VAL)? - =ABS(A1) -> A1 is VAL in cell formula - =MDET(ABS(A1)) -> expected ARR from MDET(), A1 is ARR in cell formula - */ - mnValExpClass = mbIsArrExp ? EXC_TOKCLASS_ARR : EXC_TOKCLASS_VAL; + // insert the new external name and create the tNameX token + sal_uInt16 nExtSheet, nExtName; + const String* pFile = rExtRefMgr.getExternalFileName( nFileId ); + if( pFile && mxData->mpLinkMgr->InsertExtName( nExtSheet, nExtName, *pFile, rName, xArray ) ) + { + AppendNameXToken( nExtSheet, nExtName, rTokData.mnSpaces ); + return; + } + } + } - /* ARR expected: always set to ARR. */ - mnArrExpClass = EXC_TOKCLASS_ARR; + // on any error: create a #NAME? error + AppendErrorToken( EXC_ERR_NAME, rTokData.mnSpaces ); } -void XclExpFmlaCompImpl::SetArrExpFlag( bool bIsArrExp ) +void XclExpFmlaCompImpl::ProcessDatabaseArea( const XclExpScToken& rTokData ) { - if( mbIsArrExp != bIsArrExp ) - { - mbIsArrExp = bIsArrExp; - SetReplaceTokenClasses(); - } + sal_uInt16 nNameIdx = GetNameManager().InsertDBRange( rTokData.mpScToken->GetIndex() ); + AppendNameToken( nNameIdx, rTokData.mnSpaces ); } -void XclExpFmlaCompImpl::UpdateArrExpFlag( sal_uInt8 nParamExpClass, sal_uInt8 nFuncRetClass ) -{ - bool bNewIsArrExp = false; - switch( maCfg.meClassType ) - { - case EXC_CLASSTYPE_CELL: - bNewIsArrExp = nParamExpClass == EXC_TOKCLASS_ARR; - break; - case EXC_CLASSTYPE_ARRAY: - bNewIsArrExp = nParamExpClass != EXC_TOKCLASS_VAL; - break; - case EXC_CLASSTYPE_NAME: - bNewIsArrExp = ((nParamExpClass != EXC_TOKCLASS_VAL) || (nFuncRetClass != EXC_TOKCLASS_REF)); - break; +// token vector --------------------------------------------------------------- - default : - break; - } - SetArrExpFlag( mbIsArrExp || bNewIsArrExp ); +void XclExpFmlaCompImpl::PushOperandPos( sal_uInt16 nTokPos ) +{ + mxData->maOpPosStack.push_back( nTokPos ); } -void XclExpFmlaCompImpl::AdjustTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nExpClass ) +void XclExpFmlaCompImpl::PushOperatorPos( sal_uInt16 nTokPos, const XclExpOperandListRef& rxOperands ) { - sal_uInt8 nIsClass = GetTokenClass( rnTokenId ); - if( nIsClass != EXC_TOKCLASS_NONE ) - { - if( nExpClass == EXC_TOKCLASS_ANY_IN_REFOP ) - { - // always set to REF, if used by reference operators - ChangeTokenClass( rnTokenId, EXC_TOKCLASS_REF ); - } - else - { - /* If a REF token is part of a value operator, it behaves like a VAL token. - e.g.: =SUM(A1) -> SUM() expects REF, A1 is REF. - =SUM(A1+A1) -> SUM() expects REF, but both A1 are handled like VAL tokens. */ - if( (nIsClass == EXC_TOKCLASS_REF) && ::get_flag( nExpClass, EXC_TOKCLASS_INOP_FLAG ) ) - { - ChangeTokenClass( rnTokenId, EXC_TOKCLASS_VAL ); - nIsClass = EXC_TOKCLASS_VAL; // update nIsClass for following switch - } - - // change token class according to expected parameter class - switch( nExpClass ) - { - case EXC_TOKCLASS_REF: - case EXC_TOKCLASS_REF_IN_VALOP: - if( nIsClass == EXC_TOKCLASS_VAL ) - ChangeTokenClass( rnTokenId, mnRefExpClass ); - break; - case EXC_TOKCLASS_VAL: - case EXC_TOKCLASS_VAL_IN_VALOP: - ChangeTokenClass( rnTokenId, mnValExpClass ); - break; - case EXC_TOKCLASS_ARR: - case EXC_TOKCLASS_ARR_IN_VALOP: - ChangeTokenClass( rnTokenId, mnArrExpClass ); - break; - } - } - } + PushOperandPos( nTokPos ); + DBG_ASSERT( rxOperands.get(), "XclExpFmlaCompImpl::AppendOperatorTokenId - missing operand list" ); + if( mxData->maOpListVec.size() <= nTokPos ) + mxData->maOpListVec.resize( nTokPos + 1, XclExpOperandListRef() ); + mxData->maOpListVec[ nTokPos ] = rxOperands; } -void XclExpFmlaCompImpl::AdjustLastTokenClass( sal_uInt8 nExpClass ) +sal_uInt16 XclExpFmlaCompImpl::PopOperandPos() { - DBG_ASSERT( mnLastTokPos < GetSize(), "XclExpFmlaCompImpl::AdjustLastTokenClass - invalid position" ); - sal_uInt8& rnTokenId = maTokVec[ mnLastTokPos ]; - mnLastDefClass = GetTokenClass( rnTokenId ); - AdjustTokenClass( rnTokenId, nExpClass ); + DBG_ASSERT( !mxData->maOpPosStack.empty(), "XclExpFmlaCompImpl::PopOperandPos - token stack broken" ); + sal_uInt16 nTokPos = mxData->maOpPosStack.back(); + mxData->maOpPosStack.pop_back(); + return nTokPos; } -void XclExpFmlaCompImpl::AdjustLastTokenClassForEastereggOp() +namespace { + +inline void lclAppend( ScfUInt8Vec& orVector, sal_uInt16 nData ) { - /* This very special function cares about the leading subexpression of the - Calc easteregg operators OR and AND. - Example: The Calc formula =(A1:A2)OR(0) will be compiled to the Excel - formula =OR(A1:A2,0). The Excel OR function expects REF parameters to - be able to process all cells in a range reference. Since this compiler - didn't know this when processing the (A1:A2) subexpression, it may - create a tAreaV token from the reference (e.g. if in cell context). - This would cause Excel to only evaluate cell A1, and to ignore cell A2, - if the formula is located in cell B1. - So this function changes the last token back to its default class and - adjusts it with expected REF class, which is what would happen, if a - regular OR or AND function is processed. */ - DBG_ASSERT( mnLastTokPos < GetSize(), "XclExpFmlaCompImpl::AdjustLastTokenClassForEastereggOp - invalid position" ); - sal_uInt8& rnTokenId = maTokVec[ mnLastTokPos ]; - if( GetTokenClass( rnTokenId ) != EXC_TOKCLASS_NONE ) - { - ChangeTokenClass( rnTokenId, mnLastDefClass ); - AdjustTokenClass( rnTokenId, EXC_TOKCLASS_REF ); - } + orVector.resize( orVector.size() + 2 ); + ShortToSVBT16( nData, &*(orVector.end() - 2) ); } -void XclExpFmlaCompImpl::AppendOpTokenId( sal_uInt8 nTokenId, sal_uInt8 nExpClass, sal_uInt8 nSpaces ) +inline void lclAppend( ScfUInt8Vec& orVector, sal_uInt32 nData ) { - AppendSpaceToken( EXC_TOK_ATTR_SPACE_SP, nSpaces ); - mnLastTokPos = GetSize(); - Append( nTokenId ); - AdjustLastTokenClass( nExpClass ); + orVector.resize( orVector.size() + 4 ); + UInt32ToSVBT32( nData, &*(orVector.end() - 4) ); } -//UNUSED2008-05 void XclExpFmlaCompImpl::AppendFuncTokenId( -//UNUSED2008-05 sal_uInt16 nXclFuncIdx, sal_uInt8 nRetClass, sal_uInt8 nExpRetClass, sal_uInt8 nSpaces ) -//UNUSED2008-05 { -//UNUSED2008-05 AppendOpTokenId( GetTokenId( EXC_TOKID_FUNC, nRetClass ), nExpRetClass, nSpaces ); -//UNUSED2008-05 Append( nXclFuncIdx ); -//UNUSED2008-05 } +inline void lclAppend( ScfUInt8Vec& orVector, double fData ) +{ + orVector.resize( orVector.size() + 8 ); + DoubleToSVBT64( fData, &*(orVector.end() - 8) ); +} -void XclExpFmlaCompImpl::AppendVarFuncTokenId( - sal_uInt16 nXclFuncIdx, sal_uInt8 nRetClass, sal_uInt8 nExpRetClass, - sal_uInt8 nParamCount, sal_uInt8 nSpaces ) +inline void lclAppend( ScfUInt8Vec& orVector, const XclExpRoot& rRoot, const String& rString, XclStrFlags nStrFlags ) { - AppendOpTokenId( GetTokenId( EXC_TOKID_FUNCVAR, nRetClass ), nExpRetClass, nSpaces ); - Append( nParamCount ); - Append( nXclFuncIdx ); + XclExpStringRef xXclStr = XclExpStringHelper::CreateString( rRoot, rString, nStrFlags, EXC_TOK_STR_MAXLEN ); + size_t nSize = orVector.size(); + orVector.resize( nSize + xXclStr->GetSize() ); + xXclStr->WriteToMem( &orVector[ nSize ] ); } -// token vector --------------------------------------------------------------- +} // namespace void XclExpFmlaCompImpl::Append( sal_uInt8 nData ) { - maTokVec.push_back( nData ); + mxData->maTokVec.push_back( nData ); } void XclExpFmlaCompImpl::Append( sal_uInt8 nData, size_t nCount ) { - maTokVec.resize( maTokVec.size() + nCount, nData ); + mxData->maTokVec.resize( mxData->maTokVec.size() + nCount, nData ); } void XclExpFmlaCompImpl::Append( sal_uInt16 nData ) { - maTokVec.resize( maTokVec.size() + 2 ); - ShortToSVBT16( nData, &*(maTokVec.end() - 2) ); + lclAppend( mxData->maTokVec, nData ); } void XclExpFmlaCompImpl::Append( sal_uInt32 nData ) { - maTokVec.resize( maTokVec.size() + 4 ); - UInt32ToSVBT32( nData, &*(maTokVec.end() - 4) ); + lclAppend( mxData->maTokVec, nData ); } void XclExpFmlaCompImpl::Append( double fData ) { - maTokVec.resize( maTokVec.size() + 8 ); - DoubleToSVBT64( fData, &*(maTokVec.end() - 8) ); + lclAppend( mxData->maTokVec, fData ); } void XclExpFmlaCompImpl::Append( const String& rString ) { - XclExpStringRef xXclStr = XclExpStringHelper::CreateString( - GetRoot(), rString, EXC_STR_8BITLENGTH, EXC_TOK_STR_MAXLEN ); - size_t nSize = maTokVec.size(); - maTokVec.resize( nSize + xXclStr->GetSize() ); - xXclStr->WriteToMem( &maTokVec[ nSize ] ); + lclAppend( mxData->maTokVec, GetRoot(), rString, EXC_STR_8BITLENGTH ); } void XclExpFmlaCompImpl::AppendAddress( const XclAddress& rXclPos ) @@ -2265,7 +2263,7 @@ void XclExpFmlaCompImpl::AppendRange( const XclRange& rXclRange ) void XclExpFmlaCompImpl::AppendSpaceToken( sal_uInt8 nType, sal_uInt8 nCount ) { - if( nCount ) + if( nCount > 0 ) { Append( EXC_TOKID_ATTR ); Append( EXC_TOK_ATTR_SPACE ); @@ -2274,40 +2272,47 @@ void XclExpFmlaCompImpl::AppendSpaceToken( sal_uInt8 nType, sal_uInt8 nCount ) } } +void XclExpFmlaCompImpl::AppendOperandTokenId( sal_uInt8 nTokenId, sal_uInt8 nSpaces ) +{ + AppendSpaceToken( EXC_TOK_ATTR_SPACE_SP, nSpaces ); + PushOperandPos( GetSize() ); + Append( nTokenId ); +} + void XclExpFmlaCompImpl::AppendIntToken( sal_uInt16 nValue, sal_uInt8 nSpaces ) { - AppendOpTokenId( EXC_TOKID_INT, EXC_TOKCLASS_NONE, nSpaces ); + AppendOperandTokenId( EXC_TOKID_INT, nSpaces ); Append( nValue ); } void XclExpFmlaCompImpl::AppendNumToken( double fValue, sal_uInt8 nSpaces ) { - AppendOpTokenId( EXC_TOKID_NUM, EXC_TOKCLASS_NONE, nSpaces ); + AppendOperandTokenId( EXC_TOKID_NUM, nSpaces ); Append( fValue ); } void XclExpFmlaCompImpl::AppendBoolToken( bool bValue, sal_uInt8 nSpaces ) { - AppendOpTokenId( EXC_TOKID_BOOL, EXC_TOKCLASS_NONE, nSpaces ); + AppendOperandTokenId( EXC_TOKID_BOOL, nSpaces ); Append( bValue ? EXC_TOK_BOOL_TRUE : EXC_TOK_BOOL_FALSE ); } void XclExpFmlaCompImpl::AppendErrorToken( sal_uInt8 nErrCode, sal_uInt8 nSpaces ) { - AppendOpTokenId( EXC_TOKID_ERR, EXC_TOKCLASS_NONE, nSpaces ); + AppendOperandTokenId( EXC_TOKID_ERR, nSpaces ); Append( nErrCode ); } void XclExpFmlaCompImpl::AppendMissingToken( sal_uInt8 nSpaces ) { - AppendOpTokenId( EXC_TOKID_MISSARG, EXC_TOKCLASS_NONE, nSpaces ); + AppendOperandTokenId( EXC_TOKID_MISSARG, nSpaces ); } -void XclExpFmlaCompImpl::AppendNameToken( sal_uInt16 nNameIdx, sal_uInt8 nExpClass, sal_uInt8 nSpaces ) +void XclExpFmlaCompImpl::AppendNameToken( sal_uInt16 nNameIdx, sal_uInt8 nSpaces ) { if( nNameIdx > 0 ) { - AppendOpTokenId( GetTokenId( EXC_TOKID_NAME, EXC_TOKCLASS_REF ), nExpClass, nSpaces ); + AppendOperandTokenId( GetTokenId( EXC_TOKID_NAME, EXC_TOKCLASS_REF ), nSpaces ); Append( nNameIdx ); Append( 0, (meBiff <= EXC_BIFF5) ? 12 : 2 ); } @@ -2315,15 +2320,15 @@ void XclExpFmlaCompImpl::AppendNameToken( sal_uInt16 nNameIdx, sal_uInt8 nExpCla AppendErrorToken( EXC_ERR_NAME ); } -void XclExpFmlaCompImpl::AppendMissingNameToken( const String& rName, sal_uInt8 nExpClass, sal_uInt8 nSpaces ) +void XclExpFmlaCompImpl::AppendMissingNameToken( const String& rName, sal_uInt8 nSpaces ) { sal_uInt16 nNameIdx = GetNameManager().InsertRawName( rName ); - AppendNameToken( nNameIdx, nExpClass, nSpaces ); + AppendNameToken( nNameIdx, nSpaces ); } -void XclExpFmlaCompImpl::AppendNameXToken( sal_uInt16 nExtSheet, sal_uInt16 nExtName, sal_uInt8 nExpClass, sal_uInt8 nSpaces ) +void XclExpFmlaCompImpl::AppendNameXToken( sal_uInt16 nExtSheet, sal_uInt16 nExtName, sal_uInt8 nSpaces ) { - AppendOpTokenId( GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ), nExpClass, nSpaces ); + AppendOperandTokenId( GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ), nSpaces ); Append( nExtSheet ); if( meBiff <= EXC_BIFF5 ) Append( 0, 8 ); @@ -2331,34 +2336,94 @@ void XclExpFmlaCompImpl::AppendNameXToken( sal_uInt16 nExtSheet, sal_uInt16 nExt Append( 0, (meBiff <= EXC_BIFF5) ? 12 : 2 ); } -void XclExpFmlaCompImpl::AppendMacroCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces ) +void XclExpFmlaCompImpl::AppendMacroCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces ) { sal_uInt16 nNameIdx = GetNameManager().InsertMacroCall( rExtFuncData.maFuncName, rExtFuncData.mbVBasic, true, rExtFuncData.mbHidden ); - AppendNameToken( nNameIdx, nExpClass, nSpaces ); + AppendNameToken( nNameIdx, nSpaces ); } -void XclExpFmlaCompImpl::AppendAddInFuncToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces ) +void XclExpFmlaCompImpl::AppendAddInCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces ) { String aXclFuncName; - if( ScGlobal::GetAddInCollection()->GetExcelName( rExtFuncData.maFuncName, GetUILanguage(), aXclFuncName ) ) + if( mxData->mpLinkMgr && ScGlobal::GetAddInCollection()->GetExcelName( rExtFuncData.maFuncName, GetUILanguage(), aXclFuncName ) ) { sal_uInt16 nExtSheet, nExtName; - if( mpLinkMgr && mpLinkMgr->InsertAddIn( nExtSheet, nExtName, aXclFuncName ) ) + if( mxData->mpLinkMgr->InsertAddIn( nExtSheet, nExtName, aXclFuncName ) ) { - AppendNameXToken( nExtSheet, nExtName, nExpClass, nSpaces ); + AppendNameXToken( nExtSheet, nExtName, nSpaces ); return; } } - AppendMacroCallToken( rExtFuncData, nExpClass, nSpaces ); + AppendMacroCallToken( rExtFuncData, nSpaces ); } -void XclExpFmlaCompImpl::AppendEuroToolFuncToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces ) +void XclExpFmlaCompImpl::AppendEuroToolCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces ) { sal_uInt16 nExtSheet, nExtName; - if( mpLinkMgr && mpLinkMgr->InsertEuroTool( nExtSheet, nExtName, rExtFuncData.maFuncName ) ) - AppendNameXToken( nExtSheet, nExtName, nExpClass, nSpaces ); + if( mxData->mpLinkMgr && mxData->mpLinkMgr->InsertEuroTool( nExtSheet, nExtName, rExtFuncData.maFuncName ) ) + AppendNameXToken( nExtSheet, nExtName, nSpaces ); + else + AppendMacroCallToken( rExtFuncData, nSpaces ); +} + +void XclExpFmlaCompImpl::AppendOperatorTokenId( sal_uInt8 nTokenId, const XclExpOperandListRef& rxOperands, sal_uInt8 nSpaces ) +{ + AppendSpaceToken( EXC_TOK_ATTR_SPACE_SP, nSpaces ); + PushOperatorPos( GetSize(), rxOperands ); + Append( nTokenId ); +} + +void XclExpFmlaCompImpl::AppendUnaryOperatorToken( sal_uInt8 nTokenId, sal_uInt8 nSpaces ) +{ + XclExpOperandListRef xOperands( new XclExpOperandList ); + xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPO, true ); + AppendOperatorTokenId( nTokenId, xOperands, nSpaces ); +} + +void XclExpFmlaCompImpl::AppendBinaryOperatorToken( sal_uInt8 nTokenId, bool bValType, sal_uInt8 nSpaces ) +{ + XclExpOperandListRef xOperands( new XclExpOperandList ); + xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPO, bValType ); + xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPO, bValType ); + AppendOperatorTokenId( nTokenId, xOperands, nSpaces ); +} + +void XclExpFmlaCompImpl::AppendLogicalOperatorToken( sal_uInt16 nXclFuncIdx, sal_uInt8 nOpCount ) +{ + XclExpOperandListRef xOperands( new XclExpOperandList ); + for( sal_uInt8 nOpIdx = 0; nOpIdx < nOpCount; ++nOpIdx ) + xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPX, false ); + AppendOperatorTokenId( GetTokenId( EXC_TOKID_FUNCVAR, EXC_TOKCLASS_VAL ), xOperands ); + Append( nOpCount ); + Append( nXclFuncIdx ); +} + +void XclExpFmlaCompImpl::AppendFuncToken( const XclExpFuncData& rFuncData ) +{ + sal_uInt16 nXclFuncIdx = rFuncData.GetXclFuncIdx(); + sal_uInt8 nParamCount = rFuncData.GetParamCount(); + sal_uInt8 nRetClass = rFuncData.GetReturnClass(); + + if( (nXclFuncIdx == EXC_FUNCID_SUM) && (nParamCount == 1) ) + { + // SUM with only one parameter + AppendOperatorTokenId( EXC_TOKID_ATTR, rFuncData.GetOperandList() ); + Append( EXC_TOK_ATTR_SUM ); + Append( sal_uInt16( 0 ) ); + } + else if( rFuncData.IsFixedParamCount() ) + { + // fixed number of parameters + AppendOperatorTokenId( GetTokenId( EXC_TOKID_FUNC, nRetClass ), rFuncData.GetOperandList() ); + Append( nXclFuncIdx ); + } else - AppendMacroCallToken( rExtFuncData, nExpClass, nSpaces ); + { + // variable number of parameters + AppendOperatorTokenId( GetTokenId( EXC_TOKID_FUNCVAR, nRetClass ), rFuncData.GetOperandList() ); + Append( nParamCount ); + Append( nXclFuncIdx ); + } } void XclExpFmlaCompImpl::AppendParenToken( sal_uInt8 nOpenSpaces, sal_uInt8 nCloseSpaces ) @@ -2378,16 +2443,31 @@ void XclExpFmlaCompImpl::AppendJumpToken( XclExpFuncData& rFuncData, sal_uInt8 n Append( sal_uInt16( 0 ) ); // placeholder that will be updated later } -void XclExpFmlaCompImpl::Insert( sal_uInt16 nInsertPos, sal_uInt16 nInsertSize ) +void XclExpFmlaCompImpl::InsertZeros( sal_uInt16 nInsertPos, sal_uInt16 nInsertSize ) { - DBG_ASSERT( nInsertPos < maTokVec.size(), "XclExpFmlaCompImpl::Insert - invalid position" ); - maTokVec.insert( maTokVec.begin() + nInsertPos, nInsertSize, 0 ); + // insert zeros into the token array + DBG_ASSERT( nInsertPos < mxData->maTokVec.size(), "XclExpFmlaCompImpl::Insert - invalid position" ); + mxData->maTokVec.insert( mxData->maTokVec.begin() + nInsertPos, nInsertSize, 0 ); + + // update positions of operands waiting for an operator + for( ScfUInt16Vec::iterator aIt = mxData->maOpPosStack.begin(), aEnd = mxData->maOpPosStack.end(); aIt != aEnd; ++aIt ) + if( nInsertPos <= *aIt ) + *aIt = *aIt + nInsertSize; + + // update operand lists of all operator tokens + if( nInsertPos < mxData->maOpListVec.size() ) + mxData->maOpListVec.insert( mxData->maOpListVec.begin() + nInsertPos, nInsertSize, XclExpOperandListRef() ); + for( XclExpOperandListVector::iterator aIt = mxData->maOpListVec.begin(), aEnd = mxData->maOpListVec.end(); aIt != aEnd; ++aIt ) + if( aIt->get() ) + for( XclExpOperandList::iterator aIt2 = (*aIt)->begin(), aEnd2 = (*aIt)->end(); aIt2 != aEnd2; ++aIt2 ) + if( nInsertPos <= aIt2->mnTokPos ) + aIt2->mnTokPos = aIt2->mnTokPos + nInsertSize; } void XclExpFmlaCompImpl::Overwrite( sal_uInt16 nWriteToPos, sal_uInt16 nOffset ) { - DBG_ASSERT( static_cast< size_t >( nWriteToPos + 1 ) < maTokVec.size(), "XclExpFmlaCompImpl::Overwrite - invalid position" ); - ShortToSVBT16( nOffset, &maTokVec[ nWriteToPos ] ); + DBG_ASSERT( static_cast< size_t >( nWriteToPos + 1 ) < mxData->maTokVec.size(), "XclExpFmlaCompImpl::Overwrite - invalid position" ); + ShortToSVBT16( nOffset, &mxData->maTokVec[ nWriteToPos ] ); } void XclExpFmlaCompImpl::UpdateAttrGoto( sal_uInt16 nAttrPos ) @@ -2403,19 +2483,49 @@ void XclExpFmlaCompImpl::UpdateAttrGoto( sal_uInt16 nAttrPos ) bool XclExpFmlaCompImpl::IsSpaceToken( sal_uInt16 nPos ) const { return - (static_cast< size_t >( nPos + 4 ) <= maTokVec.size()) && - (maTokVec[ nPos ] == EXC_TOKID_ATTR) && - (maTokVec[ nPos + 1 ] == EXC_TOK_ATTR_SPACE); + (static_cast< size_t >( nPos + 4 ) <= mxData->maTokVec.size()) && + (mxData->maTokVec[ nPos ] == EXC_TOKID_ATTR) && + (mxData->maTokVec[ nPos + 1 ] == EXC_TOK_ATTR_SPACE); } void XclExpFmlaCompImpl::RemoveTrailingParen() { // remove trailing tParen token - if( !maTokVec.empty() && (maTokVec.back() == EXC_TOKID_PAREN) ) - maTokVec.pop_back(); + if( !mxData->maTokVec.empty() && (mxData->maTokVec.back() == EXC_TOKID_PAREN) ) + mxData->maTokVec.pop_back(); // remove remaining tAttrSpace tokens - while( (maTokVec.size() >= 4) && IsSpaceToken( GetSize() - 4 ) ) - maTokVec.erase( maTokVec.end() - 4, maTokVec.end() ); + while( (mxData->maTokVec.size() >= 4) && IsSpaceToken( GetSize() - 4 ) ) + mxData->maTokVec.erase( mxData->maTokVec.end() - 4, mxData->maTokVec.end() ); +} + +void XclExpFmlaCompImpl::AppendExt( sal_uInt8 nData ) +{ + mxData->maExtDataVec.push_back( nData ); +} + +void XclExpFmlaCompImpl::AppendExt( sal_uInt8 nData, size_t nCount ) +{ + mxData->maExtDataVec.resize( mxData->maExtDataVec.size() + nCount, nData ); +} + +void XclExpFmlaCompImpl::AppendExt( sal_uInt16 nData ) +{ + lclAppend( mxData->maExtDataVec, nData ); +} + +void XclExpFmlaCompImpl::AppendExt( sal_uInt32 nData ) +{ + lclAppend( mxData->maExtDataVec, nData ); +} + +void XclExpFmlaCompImpl::AppendExt( double fData ) +{ + lclAppend( mxData->maExtDataVec, fData ); +} + +void XclExpFmlaCompImpl::AppendExt( const String& rString ) +{ + lclAppend( mxData->maExtDataVec, GetRoot(), rString, (meBiff == EXC_BIFF8) ? EXC_STR_DEFAULT : EXC_STR_8BITLENGTH ); } // ============================================================================ @@ -2530,29 +2640,5 @@ XclTokenArrayRef XclExpFormulaCompiler::CreateNameXFormula( return mxImpl->CreateNameXFormula( nExtSheet, nExtName ); } -void XclExpFmlaCompImpl::ProcessMatrix( const XclExpTokenData& rTokData, sal_uInt8 nExpClass ) -{ - const ScMatrix* pMatrix = static_cast(rTokData.mpScToken)->GetMatrix(); - if( maCfg.mbAllowArrays && pMatrix ) - { - SCSIZE nCols, nRows; - pMatrix->GetDimensions( nCols, nRows ); - - AppendOpTokenId( GetTokenId( EXC_TOKID_ARRAY, EXC_TOKCLASS_ARR ), nExpClass, rTokData.mnSpaces ); - Append( static_cast< sal_uInt8 >( (meBiff == EXC_BIFF8) ? (nCols - 1) : nCols ) ); - Append( static_cast< sal_uInt16 >( (meBiff == EXC_BIFF8) ? (nRows - 1) : nRows ) ); - Append( static_cast< sal_uInt32 >( 0 ) ); - - if( !mxInlineArr ) - mxInlineArr.reset( new ScMatrixList ); - mxInlineArr->push_front( pMatrix ); // save it for later - } - else - { - // Array in places that do not allow it (cond fmts, data validation) - AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces ); - } -} - // ============================================================================ diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index 2e15a39e68dd..5e6c85b49077 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -30,16 +30,23 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" + +// XXX xestream.hxx MUST be included before xlformula.hxx because of the +// redifinition of the CREATE_OUSTRING() macro, which is in oox/helper.hxx +// (indirectly included via xestream.hxx) and ../inc/ftools.hxx (indirectly +// included via xlformula.hxx) that does an undef first. Ugly. #include "xestream.hxx" #include "xlformula.hxx" + #include "compiler.hxx" #include "rangenam.hxx" -#include "xlroot.hxx" -#include "xistream.hxx" #include "token.hxx" #include "tokenarray.hxx" +#include "xistream.hxx" +#include "xlroot.hxx" + +using namespace ::formula; -using namespace formula; // Function data ============================================================== String XclFunctionInfo::GetMacroFuncName() const @@ -49,278 +56,291 @@ String XclFunctionInfo::GetMacroFuncName() const return EMPTY_STRING; } +// abbreviations for function return token class const sal_uInt8 R = EXC_TOKCLASS_REF; const sal_uInt8 V = EXC_TOKCLASS_VAL; const sal_uInt8 A = EXC_TOKCLASS_ARR; -const sal_uInt8 C = EXC_FUNC_PAR_CALCONLY; -const sal_uInt8 E = EXC_FUNC_PAR_EXCELONLY; -const sal_uInt8 I = EXC_FUNC_PAR_INVALID; + +// abbreviations for parameter infos +#define RO { EXC_PARAM_REGULAR, EXC_PARAMCONV_ORG, false } +#define RV { EXC_PARAM_REGULAR, EXC_PARAMCONV_VAL, false } +#define RA { EXC_PARAM_REGULAR, EXC_PARAMCONV_ARR, false } +#define RR { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPT, false } +#define RX { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPX, false } +#define VO { EXC_PARAM_REGULAR, EXC_PARAMCONV_ORG, true } +#define VV { EXC_PARAM_REGULAR, EXC_PARAMCONV_VAL, true } +#define VA { EXC_PARAM_REGULAR, EXC_PARAMCONV_ARR, true } +#define VR { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPT, true } +#define VX { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPX, true } +#define RO_E { EXC_PARAM_EXCELONLY, EXC_PARAMCONV_ORG, false } +#define VR_E { EXC_PARAM_EXCELONLY, EXC_PARAMCONV_RPT, true } +#define C { EXC_PARAM_CALCONLY, EXC_PARAMCONV_ORG, false } /** Functions new in BIFF2. */ static const XclFunctionInfo saFuncTable_2[] = { - { ocCount, 0, 0, 30, V, { R }, 0, 0 }, - { ocIf, 1, 2, 3, R, { V, R }, 0, 0 }, - { ocIsNA, 2, 1, 1, V, { V }, 0, 0 }, - { ocIsError, 3, 1, 1, V, { V }, 0, 0 }, - { ocSum, 4, 0, 30, V, { R }, 0, 0 }, - { ocAverage, 5, 1, 30, V, { R }, 0, 0 }, - { ocMin, 6, 1, 30, V, { R }, 0, 0 }, - { ocMax, 7, 1, 30, V, { R }, 0, 0 }, - { ocRow, 8, 0, 1, V, { R }, 0, 0 }, - { ocColumn, 9, 0, 1, V, { R }, 0, 0 }, + { ocCount, 0, 0, 30, V, { RX }, 0, 0 }, + { ocIf, 1, 2, 3, R, { VO, RO }, 0, 0 }, + { ocIsNA, 2, 1, 1, V, { VR }, 0, 0 }, + { ocIsError, 3, 1, 1, V, { VR }, 0, 0 }, + { ocSum, 4, 0, 30, V, { RX }, 0, 0 }, + { ocAverage, 5, 1, 30, V, { RX }, 0, 0 }, + { ocMin, 6, 1, 30, V, { RX }, 0, 0 }, + { ocMax, 7, 1, 30, V, { RX }, 0, 0 }, + { ocRow, 8, 0, 1, V, { RO }, 0, 0 }, + { ocColumn, 9, 0, 1, V, { RO }, 0, 0 }, { ocNotAvail, 10, 0, 0, V, {}, 0, 0 }, - { ocNPV, 11, 2, 30, V, { V, R }, 0, 0 }, - { ocStDev, 12, 1, 30, V, { R }, 0, 0 }, - { ocCurrency, 13, 1, 2, V, { V }, 0, 0 }, - { ocFixed, 14, 1, 2, V, { V, V, C, I }, 0, 0 }, - { ocSin, 15, 1, 1, V, { V }, 0, 0 }, - { ocCos, 16, 1, 1, V, { V }, 0, 0 }, - { ocTan, 17, 1, 1, V, { V }, 0, 0 }, - { ocCot, 17, 1, 1, V, { V }, EXC_FUNCFLAG_EXPORTONLY, 0 }, - { ocArcTan, 18, 1, 1, V, { V }, 0, 0 }, - { ocArcCot, 18, 1, 1, V, { V }, EXC_FUNCFLAG_EXPORTONLY, 0 }, + { ocNPV, 11, 2, 30, V, { VR, RX }, 0, 0 }, + { ocStDev, 12, 1, 30, V, { RX }, 0, 0 }, + { ocCurrency, 13, 1, 2, V, { VR }, 0, 0 }, + { ocFixed, 14, 1, 2, V, { VR, VR, C }, 0, 0 }, + { ocSin, 15, 1, 1, V, { VR }, 0, 0 }, + { ocCos, 16, 1, 1, V, { VR }, 0, 0 }, + { ocTan, 17, 1, 1, V, { VR }, 0, 0 }, + { ocCot, 17, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 }, + { ocArcTan, 18, 1, 1, V, { VR }, 0, 0 }, + { ocArcCot, 18, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 }, { ocPi, 19, 0, 0, V, {}, 0, 0 }, - { ocSqrt, 20, 1, 1, V, { V }, 0, 0 }, - { ocExp, 21, 1, 1, V, { V }, 0, 0 }, - { ocLn, 22, 1, 1, V, { V }, 0, 0 }, - { ocLog10, 23, 1, 1, V, { V }, 0, 0 }, - { ocAbs, 24, 1, 1, V, { V }, 0, 0 }, - { ocInt, 25, 1, 1, V, { V }, 0, 0 }, - { ocPlusMinus, 26, 1, 1, V, { V }, 0, 0 }, - { ocRound, 27, 2, 2, V, { V }, 0, 0 }, - { ocLookup, 28, 2, 3, V, { V, R }, 0, 0 }, - { ocIndex, 29, 2, 4, R, { R, V }, 0, 0 }, - { ocRept, 30, 2, 2, V, { V }, 0, 0 }, - { ocMid, 31, 3, 3, V, { V }, 0, 0 }, - { ocLen, 32, 1, 1, V, { V }, 0, 0 }, - { ocValue, 33, 1, 1, V, { V }, 0, 0 }, + { ocSqrt, 20, 1, 1, V, { VR }, 0, 0 }, + { ocExp, 21, 1, 1, V, { VR }, 0, 0 }, + { ocLn, 22, 1, 1, V, { VR }, 0, 0 }, + { ocLog10, 23, 1, 1, V, { VR }, 0, 0 }, + { ocAbs, 24, 1, 1, V, { VR }, 0, 0 }, + { ocInt, 25, 1, 1, V, { VR }, 0, 0 }, + { ocPlusMinus, 26, 1, 1, V, { VR }, 0, 0 }, + { ocRound, 27, 2, 2, V, { VR }, 0, 0 }, + { ocLookup, 28, 2, 3, V, { VR, RA }, 0, 0 }, + { ocIndex, 29, 2, 4, R, { RA, VV }, 0, 0 }, + { ocRept, 30, 2, 2, V, { VR }, 0, 0 }, + { ocMid, 31, 3, 3, V, { VR }, 0, 0 }, + { ocLen, 32, 1, 1, V, { VR }, 0, 0 }, + { ocValue, 33, 1, 1, V, { VR }, 0, 0 }, { ocTrue, 34, 0, 0, V, {}, 0, 0 }, { ocFalse, 35, 0, 0, V, {}, 0, 0 }, - { ocAnd, 36, 1, 30, V, { R }, 0, 0 }, - { ocOr, 37, 1, 30, V, { R }, 0, 0 }, - { ocNot, 38, 1, 1, V, { V }, 0, 0 }, - { ocMod, 39, 2, 2, V, { V }, 0, 0 }, - { ocDBCount, 40, 3, 3, V, { R }, 0, 0 }, - { ocDBSum, 41, 3, 3, V, { R }, 0, 0 }, - { ocDBAverage, 42, 3, 3, V, { R }, 0, 0 }, - { ocDBMin, 43, 3, 3, V, { R }, 0, 0 }, - { ocDBMax, 44, 3, 3, V, { R }, 0, 0 }, - { ocDBStdDev, 45, 3, 3, V, { R }, 0, 0 }, - { ocVar, 46, 1, 30, V, { R }, 0, 0 }, - { ocDBVar, 47, 3, 3, V, { R }, 0, 0 }, - { ocText, 48, 2, 2, V, { V }, 0, 0 }, - { ocRGP, 49, 1, 2, A, { R, R, C, C, I }, 0, 0 }, - { ocTrend, 50, 1, 3, A, { R, R, R, C, I }, 0, 0 }, - { ocRKP, 51, 1, 2, A, { R, R, C, C, I }, 0, 0 }, - { ocGrowth, 52, 1, 3, A, { R, R, R, C, I }, 0, 0 }, - { ocBW, 56, 3, 5, V, { V }, 0, 0 }, - { ocZW, 57, 3, 5, V, { V }, 0, 0 }, - { ocZZR, 58, 3, 5, V, { V }, 0, 0 }, - { ocRMZ, 59, 3, 5, V, { V }, 0, 0 }, - { ocZins, 60, 3, 6, V, { V }, 0, 0 }, - { ocMIRR, 61, 3, 3, V, { R, V }, 0, 0 }, - { ocIRR, 62, 1, 2, V, { R, V }, 0, 0 }, + { ocAnd, 36, 1, 30, V, { RX }, 0, 0 }, + { ocOr, 37, 1, 30, V, { RX }, 0, 0 }, + { ocNot, 38, 1, 1, V, { VR }, 0, 0 }, + { ocMod, 39, 2, 2, V, { VR }, 0, 0 }, + { ocDBCount, 40, 3, 3, V, { RO, RR }, 0, 0 }, + { ocDBSum, 41, 3, 3, V, { RO, RR }, 0, 0 }, + { ocDBAverage, 42, 3, 3, V, { RO, RR }, 0, 0 }, + { ocDBMin, 43, 3, 3, V, { RO, RR }, 0, 0 }, + { ocDBMax, 44, 3, 3, V, { RO, RR }, 0, 0 }, + { ocDBStdDev, 45, 3, 3, V, { RO, RR }, 0, 0 }, + { ocVar, 46, 1, 30, V, { RX }, 0, 0 }, + { ocDBVar, 47, 3, 3, V, { RO, RR }, 0, 0 }, + { ocText, 48, 2, 2, V, { VR }, 0, 0 }, + { ocRGP, 49, 1, 2, A, { RA, RA, C, C }, 0, 0 }, + { ocTrend, 50, 1, 3, A, { RA, RA, RA, C }, 0, 0 }, + { ocRKP, 51, 1, 2, A, { RA, RA, C, C }, 0, 0 }, + { ocGrowth, 52, 1, 3, A, { RA, RA, RA, C }, 0, 0 }, + { ocBW, 56, 3, 5, V, { VR }, 0, 0 }, + { ocZW, 57, 3, 5, V, { VR }, 0, 0 }, + { ocZZR, 58, 3, 5, V, { VR }, 0, 0 }, + { ocRMZ, 59, 3, 5, V, { VR }, 0, 0 }, + { ocZins, 60, 3, 6, V, { VR }, 0, 0 }, + { ocMIRR, 61, 3, 3, V, { RA, VR }, 0, 0 }, + { ocIRR, 62, 1, 2, V, { RA, VR }, 0, 0 }, { ocRandom, 63, 0, 0, V, {}, EXC_FUNCFLAG_VOLATILE, 0 }, - { ocMatch, 64, 2, 3, V, { V, R }, 0, 0 }, - { ocGetDate, 65, 3, 3, V, { V }, 0, 0 }, - { ocGetTime, 66, 3, 3, V, { V }, 0, 0 }, - { ocGetDay, 67, 1, 1, V, { V }, 0, 0 }, - { ocGetMonth, 68, 1, 1, V, { V }, 0, 0 }, - { ocGetYear, 69, 1, 1, V, { V }, 0, 0 }, - { ocGetDayOfWeek, 70, 1, 1, V, { V, C, I }, 0, 0 }, - { ocGetHour, 71, 1, 1, V, { V }, 0, 0 }, - { ocGetMin, 72, 1, 1, V, { V }, 0, 0 }, - { ocGetSec, 73, 1, 1, V, { V }, 0, 0 }, + { ocMatch, 64, 2, 3, V, { VR, RX, RR }, 0, 0 }, + { ocGetDate, 65, 3, 3, V, { VR }, 0, 0 }, + { ocGetTime, 66, 3, 3, V, { VR }, 0, 0 }, + { ocGetDay, 67, 1, 1, V, { VR }, 0, 0 }, + { ocGetMonth, 68, 1, 1, V, { VR }, 0, 0 }, + { ocGetYear, 69, 1, 1, V, { VR }, 0, 0 }, + { ocGetDayOfWeek, 70, 1, 1, V, { VR, C }, 0, 0 }, + { ocGetHour, 71, 1, 1, V, { VR }, 0, 0 }, + { ocGetMin, 72, 1, 1, V, { VR }, 0, 0 }, + { ocGetSec, 73, 1, 1, V, { VR }, 0, 0 }, { ocGetActTime, 74, 0, 0, V, {}, EXC_FUNCFLAG_VOLATILE, 0 }, - { ocAreas, 75, 1, 1, V, { R }, 0, 0 }, - { ocRows, 76, 1, 1, V, { R }, 0, 0 }, - { ocColumns, 77, 1, 1, V, { R }, 0, 0 }, - { ocOffset, 78, 3, 5, R, { R, V }, EXC_FUNCFLAG_VOLATILE, 0 }, - { ocSearch, 82, 2, 3, V, { V }, 0, 0 }, - { ocMatTrans, 83, 1, 1, A, { A }, 0, 0 }, - { ocType, 86, 1, 1, V, { V }, 0, 0 }, - { ocArcTan2, 97, 2, 2, V, { V }, 0, 0 }, - { ocArcSin, 98, 1, 1, V, { V }, 0, 0 }, - { ocArcCos, 99, 1, 1, V, { V }, 0, 0 }, - { ocChose, 100, 2, 30, R, { V, R }, 0, 0 }, - { ocHLookup, 101, 3, 3, V, { V, R, R, C, I }, 0, 0 }, - { ocVLookup, 102, 3, 3, V, { V, R, R, C, I }, 0, 0 }, - { ocIsRef, 105, 1, 1, V, { R }, 0, 0 }, - { ocLog, 109, 1, 2, V, { V }, 0, 0 }, - { ocChar, 111, 1, 1, V, { V }, 0, 0 }, - { ocLower, 112, 1, 1, V, { V }, 0, 0 }, - { ocUpper, 113, 1, 1, V, { V }, 0, 0 }, - { ocPropper, 114, 1, 1, V, { V }, 0, 0 }, - { ocLeft, 115, 1, 2, V, { V }, 0, 0 }, - { ocRight, 116, 1, 2, V, { V }, 0, 0 }, - { ocExact, 117, 2, 2, V, { V }, 0, 0 }, - { ocTrim, 118, 1, 1, V, { V }, 0, 0 }, - { ocReplace, 119, 4, 4, V, { V }, 0, 0 }, - { ocSubstitute, 120, 3, 4, V, { V }, 0, 0 }, - { ocCode, 121, 1, 1, V, { V }, 0, 0 }, - { ocFind, 124, 2, 3, V, { V }, 0, 0 }, - { ocCell, 125, 1, 2, V, { V, R }, EXC_FUNCFLAG_VOLATILE, 0 }, - { ocIsErr, 126, 1, 1, V, { V }, 0, 0 }, - { ocIsString, 127, 1, 1, V, { V }, 0, 0 }, - { ocIsValue, 128, 1, 1, V, { V }, 0, 0 }, - { ocIsEmpty, 129, 1, 1, V, { V }, 0, 0 }, - { ocT, 130, 1, 1, V, { R }, 0, 0 }, - { ocN, 131, 1, 1, V, { R }, 0, 0 }, - { ocGetDateValue, 140, 1, 1, V, { V }, 0, 0 }, - { ocGetTimeValue, 141, 1, 1, V, { V }, 0, 0 }, - { ocLIA, 142, 3, 3, V, { V }, 0, 0 }, - { ocDIA, 143, 4, 4, V, { V }, 0, 0 }, - { ocGDA, 144, 4, 5, V, { V }, 0, 0 }, - { ocIndirect, 148, 1, 2, R, { V }, EXC_FUNCFLAG_VOLATILE, 0 }, - { ocClean, 162, 1, 1, V, { V }, 0, 0 }, - { ocMatDet, 163, 1, 1, V, { A }, 0, 0 }, - { ocMatInv, 164, 1, 1, A, { A }, 0, 0 }, - { ocMatMult, 165, 2, 2, A, { A }, 0, 0 }, - { ocZinsZ, 167, 4, 6, V, { V }, 0, 0 }, - { ocKapz, 168, 4, 6, V, { V }, 0, 0 }, - { ocCount2, 169, 0, 30, V, { R }, 0, 0 }, - { ocProduct, 183, 0, 30, V, { R }, 0, 0 }, - { ocFact, 184, 1, 1, V, { V }, 0, 0 }, - { ocDBProduct, 189, 3, 3, V, { R }, 0, 0 }, - { ocIsNonString, 190, 1, 1, V, { V }, 0, 0 }, - { ocStDevP, 193, 1, 30, V, { R }, 0, 0 }, - { ocVarP, 194, 1, 30, V, { R }, 0, 0 }, - { ocDBStdDevP, 195, 3, 3, V, { R }, 0, 0 }, - { ocDBVarP, 196, 3, 3, V, { R }, 0, 0 }, - { ocTrunc, 197, 1, 1, V, { V, C, I }, 0, 0 }, - { ocIsLogical, 198, 1, 1, V, { V }, 0, 0 }, - { ocDBCount2, 199, 3, 3, V, { R }, 0, 0 }, - { ocCurrency, 204, 1, 2, V, { V }, EXC_FUNCFLAG_IMPORTONLY, 0 }, - { ocRoundUp, 212, 2, 2, V, { V }, 0, 0 }, - { ocRoundDown, 213, 2, 2, V, { V }, 0, 0 }, - { ocExternal, 255, 1, 30, R, { E, R }, EXC_FUNCFLAG_IMPORTONLY, 0 } + { ocAreas, 75, 1, 1, V, { RO }, 0, 0 }, + { ocRows, 76, 1, 1, V, { RO }, 0, 0 }, + { ocColumns, 77, 1, 1, V, { RO }, 0, 0 }, + { ocOffset, 78, 3, 5, R, { RO, VR }, EXC_FUNCFLAG_VOLATILE, 0 }, + { ocSearch, 82, 2, 3, V, { VR }, 0, 0 }, + { ocMatTrans, 83, 1, 1, A, { VO }, 0, 0 }, + { ocType, 86, 1, 1, V, { VX }, 0, 0 }, + { ocArcTan2, 97, 2, 2, V, { VR }, 0, 0 }, + { ocArcSin, 98, 1, 1, V, { VR }, 0, 0 }, + { ocArcCos, 99, 1, 1, V, { VR }, 0, 0 }, + { ocChose, 100, 2, 30, R, { VO, RO }, 0, 0 }, + { ocHLookup, 101, 3, 3, V, { VV, RO, RO, C }, 0, 0 }, + { ocVLookup, 102, 3, 3, V, { VV, RO, RO, C }, 0, 0 }, + { ocIsRef, 105, 1, 1, V, { RX }, 0, 0 }, + { ocLog, 109, 1, 2, V, { VR }, 0, 0 }, + { ocChar, 111, 1, 1, V, { VR }, 0, 0 }, + { ocLower, 112, 1, 1, V, { VR }, 0, 0 }, + { ocUpper, 113, 1, 1, V, { VR }, 0, 0 }, + { ocPropper, 114, 1, 1, V, { VR }, 0, 0 }, + { ocLeft, 115, 1, 2, V, { VR }, 0, 0 }, + { ocRight, 116, 1, 2, V, { VR }, 0, 0 }, + { ocExact, 117, 2, 2, V, { VR }, 0, 0 }, + { ocTrim, 118, 1, 1, V, { VR }, 0, 0 }, + { ocReplace, 119, 4, 4, V, { VR }, 0, 0 }, + { ocSubstitute, 120, 3, 4, V, { VR }, 0, 0 }, + { ocCode, 121, 1, 1, V, { VR }, 0, 0 }, + { ocFind, 124, 2, 3, V, { VR }, 0, 0 }, + { ocCell, 125, 1, 2, V, { VV, RO }, EXC_FUNCFLAG_VOLATILE, 0 }, + { ocIsErr, 126, 1, 1, V, { VR }, 0, 0 }, + { ocIsString, 127, 1, 1, V, { VR }, 0, 0 }, + { ocIsValue, 128, 1, 1, V, { VR }, 0, 0 }, + { ocIsEmpty, 129, 1, 1, V, { VR }, 0, 0 }, + { ocT, 130, 1, 1, V, { RO }, 0, 0 }, + { ocN, 131, 1, 1, V, { RO }, 0, 0 }, + { ocGetDateValue, 140, 1, 1, V, { VR }, 0, 0 }, + { ocGetTimeValue, 141, 1, 1, V, { VR }, 0, 0 }, + { ocLIA, 142, 3, 3, V, { VR }, 0, 0 }, + { ocDIA, 143, 4, 4, V, { VR }, 0, 0 }, + { ocGDA, 144, 4, 5, V, { VR }, 0, 0 }, + { ocIndirect, 148, 1, 2, R, { VR }, EXC_FUNCFLAG_VOLATILE, 0 }, + { ocClean, 162, 1, 1, V, { VR }, 0, 0 }, + { ocMatDet, 163, 1, 1, V, { VA }, 0, 0 }, + { ocMatInv, 164, 1, 1, A, { VA }, 0, 0 }, + { ocMatMult, 165, 2, 2, A, { VA }, 0, 0 }, + { ocZinsZ, 167, 4, 6, V, { VR }, 0, 0 }, + { ocKapz, 168, 4, 6, V, { VR }, 0, 0 }, + { ocCount2, 169, 0, 30, V, { RX }, 0, 0 }, + { ocProduct, 183, 0, 30, V, { RX }, 0, 0 }, + { ocFact, 184, 1, 1, V, { VR }, 0, 0 }, + { ocDBProduct, 189, 3, 3, V, { RO, RR }, 0, 0 }, + { ocIsNonString, 190, 1, 1, V, { VR }, 0, 0 }, + { ocStDevP, 193, 1, 30, V, { RX }, 0, 0 }, + { ocVarP, 194, 1, 30, V, { RX }, 0, 0 }, + { ocDBStdDevP, 195, 3, 3, V, { RO, RR }, 0, 0 }, + { ocDBVarP, 196, 3, 3, V, { RO, RR }, 0, 0 }, + { ocTrunc, 197, 1, 1, V, { VR, C }, 0, 0 }, + { ocIsLogical, 198, 1, 1, V, { VR }, 0, 0 }, + { ocDBCount2, 199, 3, 3, V, { RO, RR }, 0, 0 }, + { ocCurrency, 204, 1, 2, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, + { ocRoundUp, 212, 2, 2, V, { VR }, 0, 0 }, + { ocRoundDown, 213, 2, 2, V, { VR }, 0, 0 }, + { ocExternal, 255, 1, 30, R, { RO_E, RO }, EXC_FUNCFLAG_IMPORTONLY, 0 } }; /** Functions new in BIFF3. */ static const XclFunctionInfo saFuncTable_3[] = { - { ocRGP, 49, 1, 4, A, { R, R, V, V }, 0, 0 }, // BIFF2: 1-2, BIFF3: 1-4 - { ocTrend, 50, 1, 4, A, { R, R, R, V }, 0, 0 }, // BIFF2: 1-3, BIFF3: 1-4 - { ocRKP, 51, 1, 4, A, { R, R, V, V }, 0, 0 }, // BIFF2: 1-2, BIFF3: 1-4 - { ocGrowth, 52, 1, 4, A, { R, R, R, V }, 0, 0 }, // BIFF2: 1-3, BIFF3: 1-4 - { ocTrunc, 197, 1, 2, V, { V }, 0, 0 }, // BIFF2: 1, BIFF3: 1-2 - { ocAddress, 219, 2, 5, V, { V, V, V, V, V }, 0, 0 }, - { ocGetDiffDate360, 220, 2, 2, V, { V, V, C, I }, 0, 0 }, + { ocRGP, 49, 1, 4, A, { RA, RA, VV }, 0, 0 }, // BIFF2: 1-2, BIFF3: 1-4 + { ocTrend, 50, 1, 4, A, { RA, RA, RA, VV }, 0, 0 }, // BIFF2: 1-3, BIFF3: 1-4 + { ocRKP, 51, 1, 4, A, { RA, RA, VV }, 0, 0 }, // BIFF2: 1-2, BIFF3: 1-4 + { ocGrowth, 52, 1, 4, A, { RA, RA, RA, VV }, 0, 0 }, // BIFF2: 1-3, BIFF3: 1-4 + { ocTrunc, 197, 1, 2, V, { VR }, 0, 0 }, // BIFF2: 1, BIFF3: 1-2 + { ocAddress, 219, 2, 5, V, { VR }, 0, 0 }, + { ocGetDiffDate360, 220, 2, 2, V, { VR, VR, C }, 0, 0 }, { ocGetActDate, 221, 0, 0, V, {}, EXC_FUNCFLAG_VOLATILE, 0 }, - { ocVBD, 222, 5, 7, V, { V }, 0, 0 }, - { ocMedian, 227, 1, 30, V, { R }, 0, 0 }, - { ocSumProduct, 228, 1, 30, V, { A }, 0, 0 }, - { ocSinHyp, 229, 1, 1, V, { V }, 0, 0 }, - { ocCosHyp, 230, 1, 1, V, { V }, 0, 0 }, - { ocTanHyp, 231, 1, 1, V, { V }, 0, 0 }, - { ocCotHyp, 231, 1, 1, V, { V }, EXC_FUNCFLAG_EXPORTONLY, 0 }, - { ocArcSinHyp, 232, 1, 1, V, { V }, 0, 0 }, - { ocArcCosHyp, 233, 1, 1, V, { V }, 0, 0 }, - { ocArcTanHyp, 234, 1, 1, V, { V }, 0, 0 }, - { ocArcCotHyp, 234, 1, 1, V, { V }, EXC_FUNCFLAG_EXPORTONLY, 0 }, - { ocDBGet, 235, 3, 3, V, { R }, 0, 0 }, - { ocInfo, 244, 1, 1, V, { V }, EXC_FUNCFLAG_VOLATILE, 0 } + { ocVBD, 222, 5, 7, V, { VR }, 0, 0 }, + { ocMedian, 227, 1, 30, V, { RX }, 0, 0 }, + { ocSumProduct, 228, 1, 30, V, { VA }, 0, 0 }, + { ocSinHyp, 229, 1, 1, V, { VR }, 0, 0 }, + { ocCosHyp, 230, 1, 1, V, { VR }, 0, 0 }, + { ocTanHyp, 231, 1, 1, V, { VR }, 0, 0 }, + { ocCotHyp, 231, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 }, + { ocArcSinHyp, 232, 1, 1, V, { VR }, 0, 0 }, + { ocArcCosHyp, 233, 1, 1, V, { VR }, 0, 0 }, + { ocArcTanHyp, 234, 1, 1, V, { VR }, 0, 0 }, + { ocArcCotHyp, 234, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 }, + { ocDBGet, 235, 3, 3, V, { RO, RR }, 0, 0 }, + { ocInfo, 244, 1, 1, V, { VR }, EXC_FUNCFLAG_VOLATILE, 0 } }; /** Functions new in BIFF4. */ static const XclFunctionInfo saFuncTable_4[] = { - { ocFixed, 14, 1, 3, V, { V }, 0, 0 }, // BIFF2-3: 1-2, BIFF4: 1-3 - { ocAsc, 214, 1, 1, V, { V }, 0, 0 }, - { ocJis, 215, 1, 1, V, { V }, 0, 0 }, - { ocRank, 216, 2, 3, V, { V, R, V }, 0, 0 }, - { ocGDA2, 247, 4, 5, V, { V }, 0, 0 }, - { ocFrequency, 252, 2, 2, A, { R }, 0, 0 }, - { ocErrorType, 261, 1, 1, V, { V }, 0, 0 }, - { ocAveDev, 269, 1, 30, V, { R }, 0, 0 }, - { ocBetaDist, 270, 3, 5, V, { V }, 0, 0 }, - { ocGammaLn, 271, 1, 1, V, { V }, 0, 0 }, - { ocBetaInv, 272, 3, 5, V, { V }, 0, 0 }, - { ocBinomDist, 273, 4, 4, V, { V }, 0, 0 }, - { ocChiDist, 274, 2, 2, V, { V }, 0, 0 }, - { ocChiInv, 275, 2, 2, V, { V }, 0, 0 }, - { ocKombin, 276, 2, 2, V, { V }, 0, 0 }, - { ocConfidence, 277, 3, 3, V, { V }, 0, 0 }, - { ocKritBinom, 278, 3, 3, V, { V }, 0, 0 }, - { ocEven, 279, 1, 1, V, { V }, 0, 0 }, - { ocExpDist, 280, 3, 3, V, { V }, 0, 0 }, - { ocFDist, 281, 3, 3, V, { V }, 0, 0 }, - { ocFInv, 282, 3, 3, V, { V }, 0, 0 }, - { ocFisher, 283, 1, 1, V, { V }, 0, 0 }, - { ocFisherInv, 284, 1, 1, V, { V }, 0, 0 }, - { ocFloor, 285, 2, 2, V, { V, V, C, I }, 0, 0 }, - { ocGammaDist, 286, 4, 4, V, { V }, 0, 0 }, - { ocGammaInv, 287, 3, 3, V, { V }, 0, 0 }, - { ocCeil, 288, 2, 2, V, { V, V, C, I }, 0, 0 }, - { ocHypGeomDist, 289, 4, 4, V, { V }, 0, 0 }, - { ocLogNormDist, 290, 3, 3, V, { V }, 0, 0 }, - { ocLogInv, 291, 3, 3, V, { V }, 0, 0 }, - { ocNegBinomVert, 292, 3, 3, V, { V }, 0, 0 }, - { ocNormDist, 293, 4, 4, V, { V }, 0, 0 }, - { ocStdNormDist, 294, 1, 1, V, { V }, 0, 0 }, - { ocNormInv, 295, 3, 3, V, { V }, 0, 0 }, - { ocSNormInv, 296, 1, 1, V, { V }, 0, 0 }, - { ocStandard, 297, 3, 3, V, { V }, 0, 0 }, - { ocOdd, 298, 1, 1, V, { V }, 0, 0 }, - { ocVariationen, 299, 2, 2, V, { V }, 0, 0 }, - { ocPoissonDist, 300, 3, 3, V, { V }, 0, 0 }, - { ocTDist, 301, 3, 3, V, { V }, 0, 0 }, - { ocWeibull, 302, 4, 4, V, { V }, 0, 0 }, - { ocSumXMY2, 303, 2, 2, V, { A }, 0, 0 }, - { ocSumX2MY2, 304, 2, 2, V, { A }, 0, 0 }, - { ocSumX2DY2, 305, 2, 2, V, { A }, 0, 0 }, - { ocChiTest, 306, 2, 2, V, { A }, 0, 0 }, - { ocCorrel, 307, 2, 2, V, { A }, 0, 0 }, - { ocCovar, 308, 2, 2, V, { A }, 0, 0 }, - { ocForecast, 309, 3, 3, V, { V, A }, 0, 0 }, - { ocFTest, 310, 2, 2, V, { A }, 0, 0 }, - { ocIntercept, 311, 2, 2, V, { A }, 0, 0 }, - { ocPearson, 312, 2, 2, V, { A }, 0, 0 }, - { ocRSQ, 313, 2, 2, V, { A }, 0, 0 }, - { ocSTEYX, 314, 2, 2, V, { A }, 0, 0 }, - { ocSlope, 315, 2, 2, V, { A }, 0, 0 }, - { ocTTest, 316, 4, 4, V, { A, A, V }, 0, 0 }, - { ocProb, 317, 3, 4, V, { A, A, V }, 0, 0 }, - { ocDevSq, 318, 1, 30, V, { R }, 0, 0 }, - { ocGeoMean, 319, 1, 30, V, { R }, 0, 0 }, - { ocHarMean, 320, 1, 30, V, { R }, 0, 0 }, - { ocSumSQ, 321, 0, 30, V, { R }, 0, 0 }, - { ocKurt, 322, 1, 30, V, { R }, 0, 0 }, - { ocSchiefe, 323, 1, 30, V, { R }, 0, 0 }, - { ocZTest, 324, 2, 3, V, { R, V }, 0, 0 }, - { ocLarge, 325, 2, 2, V, { R, V }, 0, 0 }, - { ocSmall, 326, 2, 2, V, { R, V }, 0, 0 }, - { ocQuartile, 327, 2, 2, V, { R, V }, 0, 0 }, - { ocPercentile, 328, 2, 2, V, { R, V }, 0, 0 }, - { ocPercentrank, 329, 2, 3, V, { R, V }, 0, 0 }, - { ocModalValue, 330, 1, 30, V, { A }, 0, 0 }, - { ocTrimMean, 331, 2, 2, V, { R, V }, 0, 0 }, - { ocTInv, 332, 2, 2, V, { V }, 0, 0 } + { ocFixed, 14, 1, 3, V, { VR }, 0, 0 }, // BIFF2-3: 1-2, BIFF4: 1-3 + { ocAsc, 214, 1, 1, V, { VR }, 0, 0 }, + { ocJis, 215, 1, 1, V, { VR }, 0, 0 }, + { ocRank, 216, 2, 3, V, { VR, RO, VR }, 0, 0 }, + { ocGDA2, 247, 4, 5, V, { VR }, 0, 0 }, + { ocFrequency, 252, 2, 2, A, { RA }, 0, 0 }, + { ocErrorType, 261, 1, 1, V, { VR }, 0, 0 }, + { ocAveDev, 269, 1, 30, V, { RX }, 0, 0 }, + { ocBetaDist, 270, 3, 5, V, { VR }, 0, 0 }, + { ocGammaLn, 271, 1, 1, V, { VR }, 0, 0 }, + { ocBetaInv, 272, 3, 5, V, { VR }, 0, 0 }, + { ocBinomDist, 273, 4, 4, V, { VR }, 0, 0 }, + { ocChiDist, 274, 2, 2, V, { VR }, 0, 0 }, + { ocChiInv, 275, 2, 2, V, { VR }, 0, 0 }, + { ocKombin, 276, 2, 2, V, { VR }, 0, 0 }, + { ocConfidence, 277, 3, 3, V, { VR }, 0, 0 }, + { ocKritBinom, 278, 3, 3, V, { VR }, 0, 0 }, + { ocEven, 279, 1, 1, V, { VR }, 0, 0 }, + { ocExpDist, 280, 3, 3, V, { VR }, 0, 0 }, + { ocFDist, 281, 3, 3, V, { VR }, 0, 0 }, + { ocFInv, 282, 3, 3, V, { VR }, 0, 0 }, + { ocFisher, 283, 1, 1, V, { VR }, 0, 0 }, + { ocFisherInv, 284, 1, 1, V, { VR }, 0, 0 }, + { ocFloor, 285, 2, 2, V, { VR, VR, C }, 0, 0 }, + { ocGammaDist, 286, 4, 4, V, { VR }, 0, 0 }, + { ocGammaInv, 287, 3, 3, V, { VR }, 0, 0 }, + { ocCeil, 288, 2, 2, V, { VR, VR, C }, 0, 0 }, + { ocHypGeomDist, 289, 4, 4, V, { VR }, 0, 0 }, + { ocLogNormDist, 290, 3, 3, V, { VR }, 0, 0 }, + { ocLogInv, 291, 3, 3, V, { VR }, 0, 0 }, + { ocNegBinomVert, 292, 3, 3, V, { VR }, 0, 0 }, + { ocNormDist, 293, 4, 4, V, { VR }, 0, 0 }, + { ocStdNormDist, 294, 1, 1, V, { VR }, 0, 0 }, + { ocNormInv, 295, 3, 3, V, { VR }, 0, 0 }, + { ocSNormInv, 296, 1, 1, V, { VR }, 0, 0 }, + { ocStandard, 297, 3, 3, V, { VR }, 0, 0 }, + { ocOdd, 298, 1, 1, V, { VR }, 0, 0 }, + { ocVariationen, 299, 2, 2, V, { VR }, 0, 0 }, + { ocPoissonDist, 300, 3, 3, V, { VR }, 0, 0 }, + { ocTDist, 301, 3, 3, V, { VR }, 0, 0 }, + { ocWeibull, 302, 4, 4, V, { VR }, 0, 0 }, + { ocSumXMY2, 303, 2, 2, V, { VA }, 0, 0 }, + { ocSumX2MY2, 304, 2, 2, V, { VA }, 0, 0 }, + { ocSumX2DY2, 305, 2, 2, V, { VA }, 0, 0 }, + { ocChiTest, 306, 2, 2, V, { VA }, 0, 0 }, + { ocCorrel, 307, 2, 2, V, { VA }, 0, 0 }, + { ocCovar, 308, 2, 2, V, { VA }, 0, 0 }, + { ocForecast, 309, 3, 3, V, { VR, VA }, 0, 0 }, + { ocFTest, 310, 2, 2, V, { VA }, 0, 0 }, + { ocIntercept, 311, 2, 2, V, { VA }, 0, 0 }, + { ocPearson, 312, 2, 2, V, { VA }, 0, 0 }, + { ocRSQ, 313, 2, 2, V, { VA }, 0, 0 }, + { ocSTEYX, 314, 2, 2, V, { VA }, 0, 0 }, + { ocSlope, 315, 2, 2, V, { VA }, 0, 0 }, + { ocTTest, 316, 4, 4, V, { VA, VA, VR }, 0, 0 }, + { ocProb, 317, 3, 4, V, { VA, VA, VR }, 0, 0 }, + { ocDevSq, 318, 1, 30, V, { RX }, 0, 0 }, + { ocGeoMean, 319, 1, 30, V, { RX }, 0, 0 }, + { ocHarMean, 320, 1, 30, V, { RX }, 0, 0 }, + { ocSumSQ, 321, 0, 30, V, { RX }, 0, 0 }, + { ocKurt, 322, 1, 30, V, { RX }, 0, 0 }, + { ocSchiefe, 323, 1, 30, V, { RX }, 0, 0 }, + { ocZTest, 324, 2, 3, V, { RX, VR }, 0, 0 }, + { ocLarge, 325, 2, 2, V, { RX, VR }, 0, 0 }, + { ocSmall, 326, 2, 2, V, { RX, VR }, 0, 0 }, + { ocQuartile, 327, 2, 2, V, { RX, VR }, 0, 0 }, + { ocPercentile, 328, 2, 2, V, { RX, VR }, 0, 0 }, + { ocPercentrank, 329, 2, 3, V, { RX, VR, VR_E }, 0, 0 }, + { ocModalValue, 330, 1, 30, V, { VA }, 0, 0 }, + { ocTrimMean, 331, 2, 2, V, { RX, VR }, 0, 0 }, + { ocTInv, 332, 2, 2, V, { VR }, 0, 0 } }; /** Functions new in BIFF5/BIFF7. Unsupported functions: DATEDIF, DATESTRING, NUMBERSTRING. */ static const XclFunctionInfo saFuncTable_5[] = { - { ocGetDayOfWeek, 70, 1, 2, V, { V }, 0, 0 }, // BIFF2-4: 1, BIFF5: 1-2 - { ocHLookup, 101, 3, 4, V, { V, R, R, V }, 0, 0 }, // BIFF2-4: 3, BIFF5: 3-4 - { ocVLookup, 102, 3, 4, V, { V, R, R, V }, 0, 0 }, // BIFF2-4: 3, BIFF5: 3-4 - { ocGetDiffDate360, 220, 2, 3, V, { V }, 0, 0 }, // BIFF3-4: 2, BIFF5: 2-3 - { ocMacro, 255, 1, 30, R, { E, R }, EXC_FUNCFLAG_EXPORTONLY, 0 }, - { ocExternal, 255, 1, 30, R, { E, R }, EXC_FUNCFLAG_EXPORTONLY, 0 }, - { ocConcat, 336, 0, 30, V, { V }, 0, 0 }, - { ocPower, 337, 2, 2, V, { V }, 0, 0 }, - { ocRad, 342, 1, 1, V, { V }, 0, 0 }, - { ocDeg, 343, 1, 1, V, { V }, 0, 0 }, - { ocSubTotal, 344, 2, 30, V, { V, R }, 0, 0 }, - { ocSumIf, 345, 2, 3, V, { R, V, R }, 0, 0 }, - { ocCountIf, 346, 2, 2, V, { R, V }, 0, 0 }, - { ocCountEmptyCells, 347, 1, 1, V, { R }, 0, 0 }, - { ocISPMT, 350, 4, 4, V, { V }, 0, 0 }, - { ocNoName, 351, 3, 3, V, { V }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATEDIF - { ocNoName, 352, 1, 1, V, { V }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATESTRING - { ocNoName, 353, 2, 2, V, { V }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // NUMBERSTRING - { ocRoman, 354, 1, 2, V, { V }, 0, 0 } + { ocGetDayOfWeek, 70, 1, 2, V, { VR }, 0, 0 }, // BIFF2-4: 1, BIFF5: 1-2 + { ocHLookup, 101, 3, 4, V, { VV, RO, RO, VV }, 0, 0 }, // BIFF2-4: 3, BIFF5: 3-4 + { ocVLookup, 102, 3, 4, V, { VV, RO, RO, VV }, 0, 0 }, // BIFF2-4: 3, BIFF5: 3-4 + { ocGetDiffDate360, 220, 2, 3, V, { VR }, 0, 0 }, // BIFF3-4: 2, BIFF5: 2-3 + { ocMacro, 255, 1, 30, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, 0 }, + { ocExternal, 255, 1, 30, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, 0 }, + { ocConcat, 336, 0, 30, V, { VR }, 0, 0 }, + { ocPower, 337, 2, 2, V, { VR }, 0, 0 }, + { ocRad, 342, 1, 1, V, { VR }, 0, 0 }, + { ocDeg, 343, 1, 1, V, { VR }, 0, 0 }, + { ocSubTotal, 344, 2, 30, V, { VR, RO }, 0, 0 }, + { ocSumIf, 345, 2, 3, V, { RO, VR, RO }, 0, 0 }, + { ocCountIf, 346, 2, 2, V, { RO, VR }, 0, 0 }, + { ocCountEmptyCells, 347, 1, 1, V, { RO }, 0, 0 }, + { ocISPMT, 350, 4, 4, V, { VR }, 0, 0 }, + { ocNoName, 351, 3, 3, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATEDIF + { ocNoName, 352, 1, 1, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATESTRING + { ocNoName, 353, 2, 2, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // NUMBERSTRING + { ocRoman, 354, 1, 2, V, { VR }, 0, 0 } }; #define EXC_FUNCNAME_PREFIX "_xlfn." @@ -330,19 +350,19 @@ const sal_Char* const EXC_FUNCNAME_BAHTTEXT = EXC_FUNCNAME_PREFIX "BAHTTEXT"; /** Functions new in BIFF8. Unsupported functions: PHONETIC. */ static const XclFunctionInfo saFuncTable_8[] = { - { ocGetPivotData, 358, 2, 30, V, { V, R, V }, 0, 0 }, - { ocHyperLink, 359, 1, 2, V, { V }, 0, 0 }, - { ocNoName, 360, 1, 1, V, { R }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // PHONETIC - { ocAverageA, 361, 1, 30, V, { R }, 0, 0 }, - { ocMaxA, 362, 1, 30, V, { R }, 0, 0 }, - { ocMinA, 363, 1, 30, V, { R }, 0, 0 }, - { ocStDevPA, 364, 1, 30, V, { R }, 0, 0 }, - { ocVarPA, 365, 1, 30, V, { R }, 0, 0 }, - { ocStDevA, 366, 1, 30, V, { R }, 0, 0 }, - { ocVarA, 367, 1, 30, V, { R }, 0, 0 }, - { ocBahtText, 368, 1, 1, V, { V }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME_BAHTTEXT }, - { ocBahtText, 255, 2, 2, V, { E, V }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME_BAHTTEXT }, - { ocEuroConvert, 255, 4, 6, V, { E, V }, EXC_FUNCFLAG_EXPORTONLY, "EUROCONVERT" } + { ocGetPivotData, 358, 2, 30, V, { RR, RR, VR }, 0, 0 }, + { ocHyperLink, 359, 1, 2, V, { VV, VO }, 0, 0 }, + { ocNoName, 360, 1, 1, V, { RO }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // PHONETIC + { ocAverageA, 361, 1, 30, V, { RX }, 0, 0 }, + { ocMaxA, 362, 1, 30, V, { RX }, 0, 0 }, + { ocMinA, 363, 1, 30, V, { RX }, 0, 0 }, + { ocStDevPA, 364, 1, 30, V, { RX }, 0, 0 }, + { ocVarPA, 365, 1, 30, V, { RX }, 0, 0 }, + { ocStDevA, 366, 1, 30, V, { RX }, 0, 0 }, + { ocVarA, 367, 1, 30, V, { RX }, 0, 0 }, + { ocBahtText, 368, 1, 1, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME_BAHTTEXT }, + { ocBahtText, 255, 2, 2, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME_BAHTTEXT }, + { ocEuroConvert, 255, 4, 6, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, "EUROCONVERT" } }; // ---------------------------------------------------------------------------- @@ -436,16 +456,17 @@ XclTokenArray::XclTokenArray( bool bVolatile ) : { } -XclTokenArray::XclTokenArray( ScfUInt8Vec& rTokVec, bool bVolatile, - ScfUInt8Vec* pExtensionTokens) : +XclTokenArray::XclTokenArray( ScfUInt8Vec& rTokVec, bool bVolatile ) : mbVolatile( bVolatile ) { maTokVec.swap( rTokVec ); - if( NULL != pExtensionTokens) - { - DBG_ASSERT( maTokVec.size() <= 0xFFFF, "XclTokenArray::XclTokenArray - extension array too long" ); - maExtensions.swap( *pExtensionTokens ); - } +} + +XclTokenArray::XclTokenArray( ScfUInt8Vec& rTokVec, ScfUInt8Vec& rExtDataVec, bool bVolatile ) : + mbVolatile( bVolatile ) +{ + maTokVec.swap( rTokVec ); + maExtDataVec.swap( rExtDataVec ); } sal_uInt16 XclTokenArray::GetSize() const @@ -482,8 +503,8 @@ void XclTokenArray::WriteArray( XclExpStream& rStrm ) const { if( !maTokVec.empty() ) rStrm.Write( &maTokVec.front(), GetSize() ); - if( !maExtensions.empty() ) - rStrm.Write( &maExtensions.front(), limit_cast< sal_uInt16 >(maExtensions.size() ) ); + if( !maExtDataVec.empty() ) + rStrm.Write( &maExtDataVec.front(), maExtDataVec.size() ); } void XclTokenArray::Write( XclExpStream& rStrm ) const @@ -494,7 +515,7 @@ void XclTokenArray::Write( XclExpStream& rStrm ) const bool XclTokenArray::operator==( const XclTokenArray& rTokArr ) const { - return (mbVolatile == rTokArr.mbVolatile) && (maTokVec == rTokArr.maTokVec); + return (mbVolatile == rTokArr.mbVolatile) && (maTokVec == rTokArr.maTokVec) && (maExtDataVec == rTokArr.maExtDataVec); } XclImpStream& operator>>( XclImpStream& rStrm, XclTokenArray& rTokArr ) @@ -558,7 +579,7 @@ void XclTokenArrayIterator::Init() void XclTokenArrayIterator::Init( const ScTokenArray& rScTokArr, bool bSkipSpaces ) { USHORT nTokArrLen = rScTokArr.GetLen(); - mppScTokenBeg = static_cast< const formula::FormulaToken*const* >( nTokArrLen ? rScTokArr.GetArray() : 0 ); + mppScTokenBeg = static_cast< const FormulaToken* const* >( nTokArrLen ? rScTokArr.GetArray() : 0 ); mppScTokenEnd = mppScTokenBeg ? (mppScTokenBeg + nTokArrLen) : 0; mppScToken = (mppScTokenBeg != mppScTokenEnd) ? mppScTokenBeg : 0; mbSkipSpaces = bSkipSpaces; @@ -588,9 +609,9 @@ void XclTokenArrayIterator::SkipSpaces() // strings and string lists --------------------------------------------------- -bool XclTokenArrayHelper::GetTokenString( String& rString, const formula::FormulaToken& rScToken ) +bool XclTokenArrayHelper::GetTokenString( String& rString, const FormulaToken& rScToken ) { - bool bIsStr = (rScToken.GetType() == formula::svString) && (rScToken.GetOpCode() == ocPush); + bool bIsStr = (rScToken.GetType() == svString) && (rScToken.GetOpCode() == ocPush); if( bIsStr ) rString = rScToken.GetString(); return bIsStr; } @@ -653,7 +674,7 @@ void XclTokenArrayHelper::ConvertStringToList( ScTokenArray& rScTokArr, sal_Unic const ScTokenArray* XclTokenArrayHelper::GetSharedFormula( const XclRoot& rRoot, const ScTokenArray& rScTokArr ) { if( rScTokArr.GetLen() == 1 ) - if( const formula::FormulaToken* pScToken = rScTokArr.GetArray()[ 0 ] ) + if( const FormulaToken* pScToken = rScTokArr.GetArray()[ 0 ] ) if( pScToken->GetOpCode() == ocName ) if( ScRangeData* pData = rRoot.GetNamedRanges().FindIndex( pScToken->GetIndex() ) ) if( pData->HasType( RT_SHARED ) ) @@ -665,7 +686,7 @@ const ScTokenArray* XclTokenArrayHelper::GetSharedFormula( const XclRoot& rRoot, namespace { -inline bool lclGetAddress( ScAddress& rAddress, const formula::FormulaToken& rToken ) +inline bool lclGetAddress( ScAddress& rAddress, const FormulaToken& rToken ) { OpCode eOpCode = rToken.GetOpCode(); bool bIsSingleRef = (eOpCode == ocPush) && (rToken.GetType() == svSingleRef); diff --git a/sc/source/filter/inc/xlformula.hxx b/sc/source/filter/inc/xlformula.hxx index ef9274bc0338..aed77452b311 100644 --- a/sc/source/filter/inc/xlformula.hxx +++ b/sc/source/filter/inc/xlformula.hxx @@ -32,8 +32,8 @@ #define SC_XLFORMULA_HXX #include +#include #include "address.hxx" -#include "formula/opcode.hxx" #include "ftools.hxx" // Constants ================================================================== @@ -43,18 +43,11 @@ const size_t EXC_TOKARR_MAXLEN = 4096; /// Maximum size of a to // Token class flags ---------------------------------------------------------- const sal_uInt8 EXC_TOKCLASS_MASK = 0x60; -const sal_uInt8 EXC_TOKCLASS_INOP_FLAG = 0x80; /// Used in operators (internal flag). - const sal_uInt8 EXC_TOKCLASS_NONE = 0x00; /// 00-1F: Base tokens. const sal_uInt8 EXC_TOKCLASS_REF = 0x20; /// 20-3F: Reference class tokens. const sal_uInt8 EXC_TOKCLASS_VAL = 0x40; /// 40-5F: Value class tokens. const sal_uInt8 EXC_TOKCLASS_ARR = 0x60; /// 60-7F: Array class tokens. -const sal_uInt8 EXC_TOKCLASS_ANY_IN_REFOP = EXC_TOKCLASS_INOP_FLAG | EXC_TOKCLASS_NONE; -const sal_uInt8 EXC_TOKCLASS_REF_IN_VALOP = EXC_TOKCLASS_INOP_FLAG | EXC_TOKCLASS_REF; -const sal_uInt8 EXC_TOKCLASS_VAL_IN_VALOP = EXC_TOKCLASS_INOP_FLAG | EXC_TOKCLASS_VAL; -const sal_uInt8 EXC_TOKCLASS_ARR_IN_VALOP = EXC_TOKCLASS_INOP_FLAG | EXC_TOKCLASS_ARR; - // Base tokens ---------------------------------------------------------------- const sal_uInt8 EXC_TOKID_MASK = 0x1F; @@ -183,15 +176,120 @@ enum XclFormulaType EXC_FMLATYPE_LISTVAL /// List (cell range) validation. }; +// Function parameter info ==================================================== + +/** Enumerates validity modes for a function parameter. */ +enum XclFuncParamValidity +{ + EXC_PARAM_NONE = 0, /// Default for an unspecified entry in a C-array. + EXC_PARAM_REGULAR, /// Parameter supported by Calc and Excel. + EXC_PARAM_CALCONLY, /// Parameter supported by Calc only. + EXC_PARAM_EXCELONLY /// Parameter supported by Excel only. +}; + +/** Enumerates different types of token class conversion in function parameters. */ +enum XclFuncParamConv +{ + EXC_PARAMCONV_ORG, /// Use original class of current token. + EXC_PARAMCONV_VAL, /// Convert tokens to VAL class. + EXC_PARAMCONV_ARR, /// Convert tokens to ARR class. + EXC_PARAMCONV_RPT, /// Repeat parent conversion in VALTYPE parameters. + EXC_PARAMCONV_RPX, /// Repeat parent conversion in REFTYPE parameters. + EXC_PARAMCONV_RPO /// Repeat parent conversion in operands of operators. +}; + +/** Structure that contains all needed information for a parameter in a + function. + + The member meValid specifies which application supports the parameter. If + set to CALCONLY, import filters have to insert a default value for this + parameter, and export filters have to skip the parameter. If set to + EXCELONLY, import filters have to skip the parameter, and export filters + have to insert a default value for this parameter. + + The member mbValType specifies whether the parameter requires tokens to be + of value type (VAL or ARR class). + + If set to false, the parameter is called to be REFTYPE. Tokens with REF + default class can be inserted for the parameter (e.g. tAreaR tokens). + + If set to true, the parameter is called to be VALTYPE. Tokens with REF + class need to be converted to VAL tokens first (e.g. tAreaR will be + converted to tAreaV), and further conversion is done according to this + new token class. + + The member meConv specifies how to convert the current token class of the + token inserted for the parameter. If the token class is still REF this + means that the token has default REF class and the parameter is REFTYPE + (see member mbValType), the token will not be converted at all and remains + in REF class. Otherwise, token class conversion is depending on the actual + token class of the return value of the function containing this parameter. + The function may return REF class (tFuncR, tFuncVarR, tFuncCER), or it may + return VAL or ARR class (tFuncV, tFuncA, tFuncVarV, tFuncVarA, tFuncCEV, + tFuncCEA). Even if the function is able to return REF class, it may return + VAL or ARR class instead due to the VALTYPE data type of the parent + function parameter that calls the own function. Example: The INDIRECT + function returns REF class by default. But if called from a VALTYPE + function parameter, e.g. in the formula =ABS(INDIRECT("A1")), it returns + VAL or ARR class instead. Additionally, the repeating conversion types RPT + and RPX rely on the conversion executed for the function token class. + + 1) ORG: + Use the original class of the token (VAL or ARR), regardless of any + conversion done for the function return class. + + 2) VAL: + Convert ARR tokens to VAL class, regardless of any conversion done for + the function return class. + + 3) ARR: + Convert VAL tokens to ARR class, regardless of any conversion done for + the function return class. + + 4) RPT: + If the own function returns REF class (thus it is called from a REFTYPE + parameter, see above), and the parent conversion type (for the function + return class) was ORG, VAL, or ARR, ignore that conversion and always + use VAL conversion for the own token instead. If the parent conversion + type was RPT or RPX, repeat the conversion that would have been used if + the function would return value type. + If the own function returns value type (VAL or ARR class, see above), + and the parent conversion type (for the function return class) was ORG, + VAL, ARR, or RPT, repeat this conversion for the own token. If the + parent conversion type was RPX, always use ORG conversion type for the + own token instead. + + 5) RPX: + This type of conversion only occurs in functions returning VAL class by + default. If the own token is value type, and the VAL return class of + the own function has been changed to ARR class (due to direct ARR + conversion, or due to ARR conversion repeated by RPT or RPX), set the + own token to ARR type. Otherwise use the original token type (VAL + conversion from parent parameter will not be repeated at all). If + nested functions have RPT or value-type RPX parameters, they will not + repeat this conversion type, but will use ORG conversion instead (see + description of RPT above). + + 6) RPO: + This type of conversion is only used for the operands of all operators + (unary and binary arithmetic operators, comparison operators, and range + operators). It is not used for function parameters. On conversion, it + will be replaced by the last conversion type that was not the RPO + conversion. This leads to a slightly different behaviour than the RPT + conversion for operands in conjunction with a parent RPX conversion. + */ +struct XclFuncParamInfo +{ + XclFuncParamValidity meValid; /// Parameter validity. + XclFuncParamConv meConv; /// Token class conversion type. + bool mbValType; /// Data type (false = REFTYPE, true = VALTYPE). +}; + // Function data ============================================================== const sal_uInt8 EXC_FUNC_MAXPARAM = 30; /// Maximum parameter count. -const sal_uInt8 EXC_FUNC_PAR_CALCONLY = 0xFD; /// Placeholder for a parameter existing in Calc, but not in Excel. -const sal_uInt8 EXC_FUNC_PAR_EXCELONLY = 0xFE; /// Placeholder for a parameter existing in Excel, but not in Calc. -const sal_uInt8 EXC_FUNC_PAR_INVALID = 0xFF; /// Placeholder for an invalid token class. - -const sal_uInt8 EXC_FUNCINFO_CLASSCOUNT = 5; /// Number of token class entries. +const size_t EXC_FUNCINFO_PARAMINFO_COUNT = 5; /// Number of parameter info entries. const sal_uInt8 EXC_FUNCFLAG_VOLATILE = 0x01; /// Result is volatile (e.g. NOW() function). const sal_uInt8 EXC_FUNCFLAG_IMPORTONLY = 0x02; /// Only used in import filter. @@ -207,14 +305,11 @@ const sal_uInt16 EXC_FUNCID_EXTERNCALL = 255; /** Represents information for a spreadsheet function for import and export. - The member mpnParamClass contains an array of token classes for each - parameter of the function. The last existing (non-null) value in this array - is used for all following parameters used in a function. Additionally to - the three actual token classes, this array may contain the special values - EXC_FUNC_PAR_CALCONLY, EXC_FUNC_PAR_EXCELONLY, and EXC_FUNC_PAR_INVALID. - The former two specify parameters only existing in one of the applications. - EXC_FUNC_PAR_INVALID is simply a terminator for the array to prevent that - the last token class or special value is repeated for additional parameters. + The member mpParamInfos points to an array of type information structures + for all parameters of the function. The last initialized structure + describing a regular parameter (member meValid == EXC_PARAMVALID_ALWAYS) in + this array is used repeatedly for all following parameters supported by a + function. */ struct XclFunctionInfo { @@ -223,12 +318,14 @@ struct XclFunctionInfo sal_uInt8 mnMinParamCount; /// Minimum number of parameters. sal_uInt8 mnMaxParamCount; /// Maximum number of parameters. sal_uInt8 mnRetClass; /// Token class of the return value. - sal_uInt8 mpnParamClass[ EXC_FUNCINFO_CLASSCOUNT ]; /// Expected token classes of parameters. - sal_uInt8 mnFlags; /// Additional flags. + XclFuncParamInfo mpParamInfos[ EXC_FUNCINFO_PARAMINFO_COUNT ]; /// Information for all parameters. + sal_uInt8 mnFlags; /// Additional flags (EXC_FUNCFLAG_* constants). const sal_Char* mpcMacroName; /// Function name, if simulated by a macro call (UTF-8). /** Returns true, if the function is volatile. */ inline bool IsVolatile() const { return ::get_flag( mnFlags, EXC_FUNCFLAG_VOLATILE ); } + /** Returns true, if the function parameter count is fixed. */ + inline bool IsFixedParamCount() const { return (mnXclFunc != EXC_FUNCID_EXTERNCALL) && (mnMinParamCount == mnMaxParamCount); } /** Returns true, if the function is simulated by a macro call. */ inline bool IsMacroFunc() const { return mpcMacroName != 0; } /** Returns the name of the external function as string. */ @@ -278,8 +375,9 @@ public: /** Creates an empty token array. */ explicit XclTokenArray( bool bVolatile = false ); /** Creates a token array, swaps passed token vector into own data. */ - explicit XclTokenArray( ScfUInt8Vec& rTokVec, bool bVolatile = false, - ScfUInt8Vec* pExtensionTokens = NULL); + explicit XclTokenArray( ScfUInt8Vec& rTokVec, bool bVolatile = false ); + /** Creates a token array, swaps passed token vectors into own data. */ + explicit XclTokenArray( ScfUInt8Vec& rTokVec, ScfUInt8Vec& rExtDataVec, bool bVolatile = false ); /** Returns true, if the token array is empty. */ inline bool Empty() const { return maTokVec.empty(); } @@ -309,7 +407,7 @@ public: private: ScfUInt8Vec maTokVec; /// Byte vector containing token data. - ScfUInt8Vec maExtensions; /// Byte vector of extensions (eg inline arrays) + ScfUInt8Vec maExtDataVec; /// Byte vector containing extended data (arrays, stacked NLRs). bool mbVolatile; /// True = Formula contains volatile function. }; @@ -326,10 +424,7 @@ XclExpStream& operator<<( XclExpStream& rStrm, const XclTokenArrayRef& rxTokArr // ---------------------------------------------------------------------------- -namespace formula -{ - class FormulaToken; -} +namespace formula { class FormulaToken; } class ScTokenArray; /** Special token array iterator for the Excel filters. @@ -347,7 +442,7 @@ class XclTokenArrayIterator public: explicit XclTokenArrayIterator(); explicit XclTokenArrayIterator( const ScTokenArray& rScTokArr, bool bSkipSpaces ); - /** Copy constructor that allowa to change the skip-spaces mode. */ + /** Copy constructor that allows to change the skip-spaces mode. */ explicit XclTokenArrayIterator( const XclTokenArrayIterator& rTokArrIt, bool bSkipSpaces ); void Init(); @@ -355,9 +450,9 @@ public: inline bool Is() const { return mppScToken != 0; } inline bool operator!() const { return !Is(); } - inline const formula::FormulaToken* Get() const { return mppScToken ? *mppScToken : 0; } - inline const formula::FormulaToken* operator->() const { return Get(); } - inline const formula::FormulaToken& operator*() const { return *Get(); } + inline const ::formula::FormulaToken* Get() const { return mppScToken ? *mppScToken : 0; } + inline const ::formula::FormulaToken* operator->() const { return Get(); } + inline const ::formula::FormulaToken& operator*() const { return *Get(); } XclTokenArrayIterator& operator++(); @@ -366,9 +461,9 @@ private: void SkipSpaces(); private: - const formula::FormulaToken*const* mppScTokenBeg; /// Pointer to first token pointer of token array. - const formula::FormulaToken*const* mppScTokenEnd; /// Pointer behind last token pointer of token array. - const formula::FormulaToken*const* mppScToken; /// Pointer to current token pointer of token array. + const ::formula::FormulaToken*const* mppScTokenBeg; /// Pointer to first token pointer of token array. + const ::formula::FormulaToken*const* mppScTokenEnd; /// Pointer behind last token pointer of token array. + const ::formula::FormulaToken*const* mppScToken; /// Pointer to current token pointer of token array. bool mbSkipSpaces; /// true = Skip whitespace tokens. }; @@ -407,14 +502,14 @@ public: /** Returns the token class of the passed token ID. */ inline static sal_uInt8 GetTokenClass( sal_uInt8 nTokenId ) { return nTokenId & EXC_TOKCLASS_MASK; } /** Changes the token class in the passed classified token ID. */ - inline static void ChangeTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nTokenClass ); + inline static void ChangeTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nTokenClass ); // strings and string lists ----------------------------------------------- /** Tries to extract a string from the passed token. @param rString (out-parameter) The string contained in the token. @return true = Passed token is a string token, rString parameter is valid. */ - static bool GetTokenString( String& rString, const formula::FormulaToken& rScToken ); + static bool GetTokenString( String& rString, const ::formula::FormulaToken& rScToken ); /** Parses the passed formula and tries to find a single string token, i.e. "abc". @param rString (out-parameter) The string contained in the formula. diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 10224536bf0b..eede290aa8db 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -418,7 +418,7 @@ public: void ExecuteCellFormatDlg ( SfxRequest& rReq, USHORT nTabPage = 0xffff ); - BOOL GetFunction( String& rFuncStr ); + BOOL GetFunction( String& rFuncStr, sal_uInt16 nErrCode = 0 ); void StartSimpleRefDialog( const String& rTitle, const String& rInitVal, BOOL bCloseOnButtonUp, BOOL bSingleCell, BOOL bMultiSelection ); diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src index ed6273e26ae4..f05793872d4c 100644 --- a/sc/source/ui/src/scfuncs.src +++ b/sc/source/ui/src/scfuncs.src @@ -2691,7 +2691,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 { String 1 // Description { - Text [ en-US ] = "Raises a number to the power of another." ; + Text [ en-US ] = "Returns a^b, base a raised to the power of exponent b." ; }; ExtraData = { @@ -2707,15 +2707,15 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1 }; String 3 // Description of Parameter 1 { - Text [ en-US ] = "The number that is to be raised to the power of another." ; + Text [ en-US ] = "The base a of the power a^b." ; }; String 4 // Name of Parameter 2 { - Text [ en-US ] = "Power" ; + Text [ en-US ] = "Exponent" ; }; String 5 // Description of Parameter 2 { - Text [ en-US ] = "The power by which the number is to be raised." ; + Text [ en-US ] = "The exponent b of the power a^b." ; }; }; // -=*# Resource for function ANZAHLLEEREZELLEN #*=- @@ -5718,7 +5718,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 0; ID_FUNCTION_GRP_STATISTIC; U2S( HID_FUNC_NORMVERT ); - 4; 0; 0; 0; 0; + 4; 0; 0; 0; 1; 0; }; String 2 // Name of Parameter 1 @@ -5731,7 +5731,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 4 // Name of Parameter 2 { - Text [ en-US ] = "mean" ; + Text [ en-US ] = "Mean" ; }; String 5 // Description of Parameter 2 { @@ -5751,7 +5751,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 9 // Description of Parameter 4 { - Text [ en-US ] = "Cumulated. C=0 calculates the density function, C=1 the distribution." ; + Text [ en-US ] = "0 or FALSE calculates the probability density function. Any other value or TRUE or omitted calculates the cumulative distribution function." ; }; }; // -=*# Resource for function NORMINV #*=- @@ -5854,7 +5854,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 0; ID_FUNCTION_GRP_STATISTIC; U2S( HID_FUNC_LOGNORMVERT ); - 3; 0; 0; 0; + 4; 0; 1; 1; 1; 0; }; String 2 // Name of Parameter 1 @@ -5871,7 +5871,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 5 // Description of Parameter 2 { - Text [ en-US ] = "Mean value. The mean value of the log normal distribution." ; + Text [ en-US ] = "The mean value of the log normal distribution. It is set to 0 if omitted." ; }; String 6 // Name of Parameter 3 { @@ -5879,7 +5879,15 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 7 // Description of Parameter 3 { - Text [ en-US ] = "Standard deviation. The standard deviation of the log normal distribution." ; + Text [ en-US ] = "The standard deviation of the log normal distribution. It is set to 1 if omitted." ; + }; + String 8 // Name of Parameter 4 + { + Text [ en-US] = "Cumulative"; + }; + String 9 // Description of Parameter 4 + { + Text [ en-US] = "0 or FALSE calculates the probability density function. Any other value or TRUE or omitted calculates the cumulative distribution function." ; }; }; // -=*# Resource for function LOGINV #*=- @@ -6758,7 +6766,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 { String 1 // Description { - Text [ en-US ] = "Returns the two-tailed P value of a z test." ; + Text [ en-US ] = "Calculates the probability of observing a z-statistic greater than the one computed based on a sample." ; }; ExtraData = { @@ -6774,15 +6782,15 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 3 // Description of Parameter 1 { - Text [ en-US ] = "The data array." ; + Text [ en-US ] = "The given sample, drawn from a normally distributed population." ; }; String 4 // Name of Parameter 2 { - Text [ en-US ] = "Number" ; + Text [ en-US ] = "mu" ; }; String 5 // Description of Parameter 2 { - Text [ en-US ] = "The value to be tested." ; + Text [ en-US ] = "The known mean of the population." ; }; String 6 // Name of Parameter 3 { @@ -6790,7 +6798,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; String 7 // Description of Parameter 3 { - Text [ en-US ] = "The standard deviation of the population." ; + Text [ en-US ] = "The known standard deviation of the population. If omitted, the standard deviation of the given sample is used." ; }; }; // -=*# Resource for function CHITEST #*=- @@ -8906,7 +8914,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; ExtraData = { - 1; // TODO: implementation and unsuppress + 0; ID_FUNCTION_GRP_TEXT; U2S( HID_FUNC_UNICODE ); 1; 0; @@ -8929,7 +8937,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2 }; ExtraData = { - 1; // TODO: implementation and unsuppress + 0; ID_FUNCTION_GRP_TEXT; U2S( HID_FUNC_UNICHAR ); 1; 0; diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 722885363346..0090ec42a0e9 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -669,15 +669,9 @@ void ScCellShell::GetState(SfxItemSet &rSet) nErrCode = pFCell->GetErrCode(); } - if ( nErrCode > 0 ) - rSet.Put( SfxStringItem( nWhich, - ScGlobal::GetLongErrorString( nErrCode ) ) ); - else - { - String aFuncStr; - if ( pTabViewShell->GetFunction( aFuncStr ) ) - rSet.Put( SfxStringItem( nWhich, aFuncStr ) ); - } + String aFuncStr; + if ( pTabViewShell->GetFunction( aFuncStr, nErrCode ) ) + rSet.Put( SfxStringItem( nWhich, aFuncStr ) ); } } break; diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 72fb7bfdf06f..9e844f970909 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -72,11 +72,23 @@ #include "compiler.hxx" -BOOL ScTabViewShell::GetFunction( String& rFuncStr ) +BOOL ScTabViewShell::GetFunction( String& rFuncStr, sal_uInt16 nErrCode ) { String aStr; ScSubTotalFunc eFunc = (ScSubTotalFunc) SC_MOD()->GetAppOptions().GetStatusFunc(); + ScViewData* pViewData = GetViewData(); + ScMarkData& rMark = pViewData->GetMarkData(); + bool bIgnoreError = (rMark.IsMarked() || rMark.IsMultiMarked()); + + if (bIgnoreError && (eFunc == SUBTOTAL_FUNC_CNT || eFunc == SUBTOTAL_FUNC_CNT2)) + nErrCode = 0; + + if (nErrCode) + { + rFuncStr = ScGlobal::GetLongErrorString(nErrCode); + return true; + } USHORT nGlobStrId = 0; switch (eFunc) @@ -94,9 +106,7 @@ BOOL ScTabViewShell::GetFunction( String& rFuncStr ) } if (nGlobStrId) { - ScViewData* pViewData = GetViewData(); ScDocument* pDoc = pViewData->GetDocument(); - ScMarkData& rMark = pViewData->GetMarkData(); SCCOL nPosX = pViewData->GetCurX(); SCROW nPosY = pViewData->GetCurY(); SCTAB nTab = pViewData->GetTabNo(); diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index 32f9c4d2c04d..e241b0ab88c8 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -669,209 +669,16 @@ STRING ConvertFromDec( double fNum, double fMin, double fMax, sal_uInt16 nBase, return aRet; } -/** Approximation algorithm for erf for 0 < x < 0.65. */ -void Erf0065( double x, double& fVal ) -{ - static const double pn[] = { - 1.12837916709551256, - 1.35894887627277916E-1, - 4.03259488531795274E-2, - 1.20339380863079457E-3, - 6.49254556481904354E-5 - }; - static const double qn[] = { - 1.00000000000000000, - 4.53767041780002545E-1, - 8.69936222615385890E-2, - 8.49717371168693357E-3, - 3.64915280629351082E-4 - }; - - double fPSum = 0.0; - double fQSum = 0.0; - double fXPow = 1.0; - for ( unsigned int i = 0; i <= 4; ++i ) - { - fPSum += pn[i]*fXPow; - fQSum += qn[i]*fXPow; - fXPow *= x*x; - } - fVal = x * fPSum / fQSum; -} - -/** Approximation algorithm for erfc for 0.65 < x < 6.0. */ -void Erfc0600( double x, double& fVal ) -{ - double fPSum = 0.0; - double fQSum = 0.0; - double fXPow = 1.0; - const double *pn; - const double *qn; - - if ( x < 2.2 ) - { - static const double pn22[] = { - 9.99999992049799098E-1, - 1.33154163936765307, - 8.78115804155881782E-1, - 3.31899559578213215E-1, - 7.14193832506776067E-2, - 7.06940843763253131E-3 - }; - static const double qn22[] = { - 1.00000000000000000, - 2.45992070144245533, - 2.65383972869775752, - 1.61876655543871376, - 5.94651311286481502E-1, - 1.26579413030177940E-1, - 1.25304936549413393E-2 - }; - pn = pn22; - qn = qn22; - } - else /* if ( x < 6.0 ) this is true, but the compiler does not know */ - { - static const double pn60[] = { - 9.99921140009714409E-1, - 1.62356584489366647, - 1.26739901455873222, - 5.81528574177741135E-1, - 1.57289620742838702E-1, - 2.25716982919217555E-2 - }; - static const double qn60[] = { - 1.00000000000000000, - 2.75143870676376208, - 3.37367334657284535, - 2.38574194785344389, - 1.05074004614827206, - 2.78788439273628983E-1, - 4.00072964526861362E-2 - }; - pn = pn60; - qn = qn60; - } - - for ( unsigned int i = 0; i < 6; ++i ) - { - fPSum += pn[i]*fXPow; - fQSum += qn[i]*fXPow; - fXPow *= x; - } - fQSum += qn[6]*fXPow; - fVal = exp( -1.0*x*x )* fPSum / fQSum; -} - -/** Approximation algorithm for erfc for 6.0 < x < 26.54 (but used for all - x > 6.0). */ -void Erfc2654( double x, double& fVal ) -{ - static const double pn[] = { - 5.64189583547756078E-1, - 8.80253746105525775, - 3.84683103716117320E1, - 4.77209965874436377E1, - 8.08040729052301677 - }; - static const double qn[] = { - 1.00000000000000000, - 1.61020914205869003E1, - 7.54843505665954743E1, - 1.12123870801026015E2, - 3.73997570145040850E1 - }; - - double fPSum = 0.0; - double fQSum = 0.0; - double fXPow = 1.0; - - for ( unsigned int i = 0; i <= 4; ++i ) - { - fPSum += pn[i]*fXPow; - fQSum += qn[i]*fXPow; - fXPow /= x*x; - } - fVal = exp(-1.0*x*x)*fPSum / (x*fQSum); -} - -double Erfc( double ); - -/** Parent error function (erf) that calls different algorithms based on the - value of x. It takes care of cases where x is negative as erf is an odd - function i.e. erf(-x) = -erf(x). - - Kramer, W., and Blomquist, F., 2000, Algorithms with Guaranteed Error Bounds - for the Error Function and the Complementary Error Function - - http://www.math.uni-wuppertal.de/wrswt/literatur_en.html - - @author Kohei Yoshida - - @see #i55735# - */ +// implementation moved to module sal, see #i97091# double Erf( double x ) { - if( x == 0.0 ) - return 0.0; - - bool bNegative = false; - if ( x < 0.0 ) - { - x = fabs( x ); - bNegative = true; - } - - double fErf = 1.0; - if ( x < 1.0e-10 ) - fErf = (double) (x*1.1283791670955125738961589031215452L); - else if ( x < 0.65 ) - Erf0065( x, fErf ); - else - fErf = 1.0 - Erfc( x ); - - if ( bNegative ) - fErf *= -1.0; - - return fErf; + return ::rtl::math::erf(x); } -/** Parent complementary error function (erfc) that calls different algorithms - based on the value of x. It takes care of cases where x is negative as erfc - satisfies relationship erfc(-x) = 2 - erfc(x). See the comment for Erf(x) - for the source publication. - - @author Kohei Yoshida - - @see #i55735# - */ +// implementation moved to module sal, see #i97091# double Erfc( double x ) { - if ( x == 0.0 ) - return 1.0; - - bool bNegative = false; - if ( x < 0.0 ) - { - x = fabs( x ); - bNegative = true; - } - - double fErfc = 0.0; - if ( x >= 0.65 ) - { - if ( x < 6.0 ) - Erfc0600( x, fErfc ); - else - Erfc2654( x, fErfc ); - } - else - fErfc = 1.0 - Erf( x ); - - if ( bNegative ) - fErfc = 2.0 - fErfc; - - return fErfc; + return ::rtl::math::erfc(x); } inline sal_Bool IsNum( sal_Unicode c ) @@ -2378,10 +2185,11 @@ void ComplexList::Append( const SEQ( ANY )& aMultPars, ComplListAppendHandl eAH -ConvertData::ConvertData( const sal_Char p[], double fC, ConvertDataClass e ) : aName( p, strlen( p ), RTL_TEXTENCODING_MS_1252 ) +ConvertData::ConvertData( const sal_Char p[], double fC, ConvertDataClass e, sal_Bool bPrefSupport ) : aName( p, strlen( p ), RTL_TEXTENCODING_MS_1252 ) { fConst = fC; eClass = e; + bPrefixSupport = bPrefSupport; } ConvertData::~ConvertData() @@ -2391,13 +2199,26 @@ ConvertData::~ConvertData() sal_Int16 ConvertData::GetMatchingLevel( const STRING& rRef ) const { - if( aName.equals( rRef ) ) + STRING aStr = rRef; + sal_Int32 nLen = rRef.getLength(); + sal_Int32 nIndex = rRef.lastIndexOf( '^' ); + if( nIndex > 0 && nIndex == ( nLen - 2 ) ) + { + const sal_Unicode* p = aStr.getStr(); + aStr = STRING( p, nLen - 2 ); + aStr += STRING( p[ nLen - 1 ] ); + } + if( aName.equals( aStr ) ) return 0; else { - const sal_Unicode* p = rRef.getStr(); + const sal_Unicode* p = aStr.getStr(); - if ( aName == p + 1 ) + nLen = aStr.getLength(); + bool bPref = IsPrefixSupport(); + bool bOneChar = (bPref && nLen > 1 && (aName == p + 1)); + if (bOneChar || (bPref && nLen > 2 && (aName == p + 2) && + *p == 'd' && *(p+1) == 'a')) { sal_Int16 n; switch( *p ) @@ -2411,7 +2232,14 @@ sal_Int16 ConvertData::GetMatchingLevel( const STRING& rRef ) const case 'u': n = -6; break; case 'm': n = -3; break; case 'c': n = -2; break; - case 'd': n = -1; break; + case 'd': + { + if ( bOneChar ) + n = -1; // deci + else + n = 1; // deca + } + break; case 'e': n = 1; break; case 'h': n = 2; break; case 'k': n = 3; break; @@ -2426,10 +2254,16 @@ sal_Int16 ConvertData::GetMatchingLevel( const STRING& rRef ) const n = INV_MATCHLEV; } +// We could weed some nonsense out, ODFF doesn't say so though. +#if 0 + if (n < 0 && Class() == CDC_Information) + n = INV_MATCHLEV; // milli-bits doesn't make sense +#endif + //! #100616# "cm3" is not 10^-2 m^3 but 10^-6 m^3 !!! ------------------ if( n != INV_MATCHLEV ) { - sal_Unicode cLast = p[ rRef.getLength() - 1 ]; + sal_Unicode cLast = p[ aStr.getLength() - 1 ]; if( cLast == '2' ) n *= 2; else if( cLast == '3' ) @@ -2439,6 +2273,27 @@ sal_Int16 ConvertData::GetMatchingLevel( const STRING& rRef ) const return n; } + else if ( nLen > 2 && ( aName == p + 2 ) && ( Class() == CDC_Information ) ) + { + const sal_Unicode* pStr = aStr.getStr(); + if ( *(pStr + 1) != 'i') + return INV_MATCHLEV; + sal_Int16 n; + switch( *pStr ) + { + case 'k': n = 10; break; + case 'M': n = 20; break; + case 'G': n = 30; break; + case 'T': n = 40; break; + case 'P': n = 50; break; + case 'E': n = 60; break; + case 'Z': n = 70; break; + case 'Y': n = 80; break; + default: + n = INV_MATCHLEV; + } + return n; + } else return INV_MATCHLEV; } @@ -2451,6 +2306,25 @@ double ConvertData::Convert( if( Class() != r.Class() ) THROW_IAE; + sal_Bool bBinFromLev = ( nLevFrom > 0 && ( nLevFrom % 10 ) == 0 ); + sal_Bool bBinToLev = ( nLevTo > 0 && ( nLevTo % 10 ) == 0 ); + + if ( Class() == CDC_Information && ( bBinFromLev || bBinToLev ) ) + { + if ( bBinFromLev && bBinToLev ) + { + nLevFrom = sal::static_int_cast( nLevFrom - nLevTo ); + f *= r.fConst / fConst; + if( nLevFrom ) + f *= pow( 2.0, nLevFrom ); + } + else if ( bBinFromLev ) + f *= ( r.fConst / fConst ) * ( pow( 2.0, nLevFrom ) / pow( 10.0, nLevTo ) ); + else + f *= ( r.fConst / fConst ) * ( pow( 10.0, nLevFrom ) / pow( 2.0, nLevTo ) ); + return f; + } + nLevFrom = sal::static_int_cast( nLevFrom - nLevTo ); // effective level f *= r.fConst / fConst; @@ -2519,15 +2393,17 @@ double ConvertDataLinear::ConvertFromBase( double f, sal_Int16 n ) const ConvertDataList::ConvertDataList( void ) { #define NEWD(str,unit,cl) Append(new ConvertData(str,unit,cl)) +#define NEWDP(str,unit,cl) Append(new ConvertData(str,unit,cl,sal_True)) #define NEWL(str,unit,offs,cl) Append(new ConvertDataLinear(str,unit,offs,cl)) +#define NEWLP(str,unit,offs,cl) Append(new ConvertDataLinear(str,unit,offs,cl,sal_True)) // *** are extra and not standard Excel Analysis Addin! // MASS: 1 Gram is... - NEWD( "g", 1.0000000000000000E00, CDC_Mass ); // Gram + NEWDP( "g", 1.0000000000000000E00, CDC_Mass ); // Gram NEWD( "sg", 6.8522050005347800E-05, CDC_Mass ); // Pieces NEWD( "lbm", 2.2046229146913400E-03, CDC_Mass ); // Pound (commercial weight) - NEWD( "u", 6.0221370000000000E23, CDC_Mass ); // U (atomic mass) + NEWDP( "u", 6.0221370000000000E23, CDC_Mass ); // U (atomic mass) NEWD( "ozm", 3.5273971800362700E-02, CDC_Mass ); // Ounce (commercial weight) NEWD( "stone", 1.574730e-04, CDC_Mass ); // *** Stone NEWD( "ton", 1.102311e-06, CDC_Mass ); // *** Ton @@ -2536,9 +2412,16 @@ ConvertDataList::ConvertDataList( void ) NEWD( "hweight", 1.968413E-05, CDC_Mass ); // *** Hundredweight NEWD( "shweight", 2.204623E-05, CDC_Mass ); // *** Shorthundredweight NEWD( "brton", 9.842065E-07, CDC_Mass ); // *** Gross Registered Ton + NEWD( "cwt", 2.2046226218487758E-05, CDC_Mass ); // U.S. (short) hundredweight + NEWD( "shweight", 2.2046226218487758E-05, CDC_Mass ); // U.S. (short) hundredweight also + NEWD( "uk_cwt", 1.9684130552221213E-05, CDC_Mass ); // Imperial hundredweight + NEWD( "lcwt", 1.9684130552221213E-05, CDC_Mass ); // Imperial hundredweight also + NEWD( "hweight", 1.9684130552221213E-05, CDC_Mass ); // Imperial hundredweight also + NEWD( "uk_ton", 9.8420652761106063E-07, CDC_Mass ); // Imperial ton + NEWD( "LTON", 9.8420652761106063E-07, CDC_Mass ); // Imperial ton also // LENGTH: 1 Meter is... - NEWD( "m", 1.0000000000000000E00, CDC_Length ); // Meter + NEWDP( "m", 1.0000000000000000E00, CDC_Length ); // Meter NEWD( "mi", 6.2137119223733397E-04, CDC_Length ); // Britsh Mile 6,21371192237333969617434184363e-4 NEWD( "Nmi", 5.3995680345572354E-04, CDC_Length ); // Nautical Mile 5,39956803455723542116630669546e-4 NEWD( "in", 3.9370078740157480E01, CDC_Length ); // Inch 39,37007874015748031496062992126 @@ -2547,56 +2430,73 @@ ConvertDataList::ConvertDataList( void ) NEWD( "ang", 1.0000000000000000E10, CDC_Length ); // Angstroem NEWD( "Pica", 2.8346456692913386E03, CDC_Length ); // Pica (1/72 Inch) 2834,6456692913385826771653543307 NEWD( "ell", 8.748906E-01, CDC_Length ); // *** Ell - NEWD( "parsec", 3.240779E-17, CDC_Length ); // *** Parsec - NEWD( "lightyear", 1.0570234557732930E-16, CDC_Length ); // *** Light Year + NEWDP( "parsec", 3.240779E-17, CDC_Length ); // *** Parsec + NEWDP( "pc", 3.240779E-17, CDC_Length ); // *** Parsec also + NEWDP( "lightyear", 1.0570234557732930E-16, CDC_Length ); // *** Light Year + NEWDP( "ly", 1.0570234557732930E-16, CDC_Length ); // *** Light Year also + NEWD( "survey_mi", 6.2136994949494949E-04, CDC_Length ); // U.S. survey mile // TIME: 1 Second is... NEWD( "yr", 3.1688087814028950E-08, CDC_Time ); // Year NEWD( "day", 1.1574074074074074E-05, CDC_Time ); // Day + NEWD( "d", 1.1574074074074074E-05, CDC_Time ); // Day also NEWD( "hr", 2.7777777777777778E-04, CDC_Time ); // Hour NEWD( "mn", 1.6666666666666667E-02, CDC_Time ); // Minute - NEWD( "sec", 1.0000000000000000E00, CDC_Time ); // Second + NEWD( "min", 1.6666666666666667E-02, CDC_Time ); // Minute also + NEWDP( "sec", 1.0000000000000000E00, CDC_Time ); // Second + NEWDP( "s", 1.0000000000000000E00, CDC_Time ); // Second also // PRESSURE: 1 Pascal is... - NEWD( "Pa", 1.0000000000000000E00, CDC_Pressure ); // Pascal - NEWD( "atm", 9.8692329999819300E-06, CDC_Pressure ); // Atmoshpere - NEWD( "mmHg", 7.5006170799862700E-03, CDC_Pressure ); // mm Hg (Mercury) + NEWDP( "Pa", 1.0000000000000000E00, CDC_Pressure ); // Pascal + NEWDP( "atm", 9.8692329999819300E-06, CDC_Pressure ); // Atmosphere + NEWDP( "at", 9.8692329999819300E-06, CDC_Pressure ); // Atmosphere also + NEWDP( "mmHg", 7.5006170799862700E-03, CDC_Pressure ); // mm Hg (Mercury) NEWD( "Torr", 7.5006380000000000E-03, CDC_Pressure ); // *** Torr NEWD( "psi", 1.4503770000000000E-04, CDC_Pressure ); // *** Psi // FORCE: 1 Newton is... - NEWD( "N", 1.0000000000000000E00, CDC_Force ); // Newton - NEWD( "dyn", 1.0000000000000000E05, CDC_Force ); // Dyn + NEWDP( "N", 1.0000000000000000E00, CDC_Force ); // Newton + NEWDP( "dyn", 1.0000000000000000E05, CDC_Force ); // Dyn + NEWDP( "dy", 1.0000000000000000E05, CDC_Force ); // Dyn also NEWD( "lbf", 2.24808923655339E-01, CDC_Force ); // Pound-Force - NEWD( "pond", 1.019716E02, CDC_Force ); // *** Pond + NEWDP( "pond", 1.019716E02, CDC_Force ); // *** Pond // ENERGY: 1 Joule is... - NEWD( "J", 1.0000000000000000E00, CDC_Energy ); // Joule - NEWD( "e", 1.0000000000000000E07, CDC_Energy ); // Erg -> http://www.chemie.fu-berlin.de/chemistry/general/si.html + NEWDP( "J", 1.0000000000000000E00, CDC_Energy ); // Joule + NEWDP( "e", 1.0000000000000000E07, CDC_Energy ); // Erg -> http://www.chemie.fu-berlin.de/chemistry/general/si.html // NEWD( "e", 9.99999519343231E06, CDC_Energy ); // Erg - NEWD( "c", 2.3900624947346700E-01, CDC_Energy ); // Thermodynamical Calorie - NEWD( "cal", 2.3884619064201700E-01, CDC_Energy ); // Calorie - NEWD( "eV", 6.2414570000000000E18, CDC_Energy ); // Electronvolt + NEWDP( "c", 2.3900624947346700E-01, CDC_Energy ); // Thermodynamical Calorie + NEWDP( "cal", 2.3884619064201700E-01, CDC_Energy ); // Calorie + NEWDP( "eV", 6.2414570000000000E18, CDC_Energy ); // Electronvolt + NEWDP( "ev", 6.2414570000000000E18, CDC_Energy ); // Electronvolt also NEWD( "HPh", 3.7250611111111111E-07, CDC_Energy ); // Horsepower Hours + NEWD( "hh", 3.7250611111111111E-07, CDC_Energy ); // Horsepower Hours also // NEWD( "HPh", 3.72506430801000E-07, CDC_Energy ); // Horsepower Hours - NEWD( "Wh", 2.7777777777777778E-04, CDC_Energy ); // Watt Hours + NEWDP( "Wh", 2.7777777777777778E-04, CDC_Energy ); // Watt Hours + NEWDP( "wh", 2.7777777777777778E-04, CDC_Energy ); // Watt Hours also NEWD( "flb", 2.37304222192651E01, CDC_Energy ); // Foot Pound NEWD( "BTU", 9.4781506734901500E-04, CDC_Energy ); // British Thermal Unit + NEWD( "btu", 9.4781506734901500E-04, CDC_Energy ); // British Thermal Unit also // POWER: 1 Watt is... - NEWD( "W", 1.0000000000000000E00, CDC_Power ); // Watt + NEWDP( "W", 1.0000000000000000E00, CDC_Power ); // Watt + NEWDP( "w", 1.0000000000000000E00, CDC_Power ); // Watt also NEWD( "HP", 1.341022E-03, CDC_Power ); // Horsepower + NEWD( "h", 1.341022E-03, CDC_Power ); // Horsepower also NEWD( "PS", 1.359622E-03, CDC_Power ); // *** German Pferdestaerke // NEWD( "HP", 1.4102006031908E-03, CDC_Power ); // Excel seams to be a little bit wrong... either this doesn't fit to J -> HPh // MAGNETISM: 1 Tesla is... - NEWD( "T", 1.0000000000000000E00, CDC_Magnetism ); // Tesla - NEWD( "ga", 1.0000000000000000E04, CDC_Magnetism ); // Gauss + NEWDP( "T", 1.0000000000000000E00, CDC_Magnetism ); // Tesla + NEWDP( "ga", 1.0000000000000000E04, CDC_Magnetism ); // Gauss // TEMERATURE: 1 Kelvin is... NEWL( "C", 1.0000000000000000E00, -2.7315000000000000E02, CDC_Temperature ); // Celsius + NEWL( "cel", 1.0000000000000000E00, -2.7315000000000000E02, CDC_Temperature ); // Celsius also NEWL( "F", 1.8000000000000000E00, -2.5537222222222222E02, CDC_Temperature ); // Fahrenheit - NEWL( "K", 1.0000000000000000E00, +0.0000000000000000E00, CDC_Temperature ); // Kelvin + NEWL( "fah", 1.8000000000000000E00, -2.5537222222222222E02, CDC_Temperature ); // Fahrenheit also + NEWLP( "K", 1.0000000000000000E00, +0.0000000000000000E00, CDC_Temperature ); // Kelvin + NEWLP( "kel", 1.0000000000000000E00, +0.0000000000000000E00, CDC_Temperature ); // Kelvin also NEWL( "Reau", 8.0000000000000000E-01, -2.7315000000000000E02, CDC_Temperature ); // *** Reaumur NEWL( "Rank", 1.8000000000000000E00, +0.0000000000000000E00, CDC_Temperature ); // *** Rankine @@ -2606,11 +2506,14 @@ ConvertDataList::ConvertDataList( void ) NEWD( "oz", 3.3806666666666667E01, CDC_Volume ); // Ounce Liquid NEWD( "cup", 4.2258333333333333E00, CDC_Volume ); // Cup NEWD( "pt", 2.1129166666666667E00, CDC_Volume ); // US Pint + NEWD( "us_pt", 2.1129166666666667E00, CDC_Volume ); // US Pint also NEWD( "uk_pt", 1.75975569552166E00, CDC_Volume ); // UK Pint NEWD( "qt", 1.0564583333333333E00, CDC_Volume ); // Quart NEWD( "gal", 2.6411458333333333E-01, CDC_Volume ); // Gallone - NEWD( "l", 1.0000000000000000E00, CDC_Volume ); // Liter - NEWD( "m3", 1.0000000000000000E-03, CDC_Volume ); // *** Cubic Meter + NEWDP( "l", 1.0000000000000000E00, CDC_Volume ); // Liter + NEWDP( "L", 1.0000000000000000E00, CDC_Volume ); // Liter also + NEWDP( "lt", 1.0000000000000000E00, CDC_Volume ); // Liter also + NEWDP( "m3", 1.0000000000000000E-03, CDC_Volume ); // *** Cubic Meter NEWD( "mi3", 2.3991275857892772E-13, CDC_Volume ); // *** Cubic Britsh Mile NEWD( "Nmi3", 1.5742621468581148E-13, CDC_Volume ); // *** Cubic Nautical Mile NEWD( "in3", 6.1023744094732284E01, CDC_Volume ); // *** Cubic Inch @@ -2621,30 +2524,41 @@ ConvertDataList::ConvertDataList( void ) NEWD( "barrel", 6.289811E-03, CDC_Volume ); // *** Barrel (=42gal?) NEWD( "bushel", 2.837759E-02, CDC_Volume ); // *** Bushel NEWD( "regton", 3.531467E-04, CDC_Volume ); // *** Register ton + NEWD( "GRT", 3.531467E-04, CDC_Volume ); // *** Register ton also NEWD( "Schooner", 2.3529411764705882E00, CDC_Volume ); // *** austr. Schooner NEWD( "Middy", 3.5087719298245614E00, CDC_Volume ); // *** austr. Middy NEWD( "Glass", 5.0000000000000000E00, CDC_Volume ); // *** austr. Glass NEWD( "Sixpack", 0.5, CDC_Volume ); // *** NEWD( "Humpen", 2.0, CDC_Volume ); // *** + NEWD( "ly3", 1.1810108125623799E-51, CDC_Volume ); // *** Cubic light-year + NEWD( "MTON", 1.4125866688595436E00, CDC_Volume ); // *** Measurement ton + NEWD( "tspm", 5.0000000000000000E02, CDC_Volume ); // *** Modern teaspoon + NEWD( "uk_gal", 2.6411458333333333E-01, CDC_Volume ); // U.K. / Imperial gallon ?? + NEWD( "uk_qt", 1.0564583333333333E00, CDC_Volume ); // U.K. / Imperial quart ?? // 1 Square Meter is... - NEWD( "m2", 1.0000000000000000E00, CDC_Area ); // *** Square Meter + NEWDP( "m2", 1.0000000000000000E00, CDC_Area ); // *** Square Meter NEWD( "mi2", 3.8610215854244585E-07, CDC_Area ); // *** Square Britsh Mile NEWD( "Nmi2", 2.9155334959812286E-07, CDC_Area ); // *** Square Nautical Mile NEWD( "in2", 1.5500031000062000E03, CDC_Area ); // *** Square Inch NEWD( "ft2", 1.0763910416709722E01, CDC_Area ); // *** Square Foot NEWD( "yd2", 1.1959900463010803E00, CDC_Area ); // *** Square Yard - NEWD( "ang2", 1.0000000000000000E20, CDC_Area ); // *** Square Angstroem + NEWDP( "ang2", 1.0000000000000000E20, CDC_Area ); // *** Square Angstroem NEWD( "Pica2", 8.0352160704321409E06, CDC_Area ); // *** Square Pica NEWD( "Morgen", 4.0000000000000000E-04, CDC_Area ); // *** Morgen - NEWD( "ar", 1.000000E-02, CDC_Area ); // *** Ar + NEWDP( "ar", 1.000000E-02, CDC_Area ); // *** Ar NEWD( "acre", 2.471053815E-04, CDC_Area ); // *** Acre + NEWD( "uk_acre", 2.4710538146716534E-04, CDC_Area ); // *** International acre + NEWD( "us_acre", 2.4710439304662790E-04, CDC_Area ); // *** U.S. survey/statute acre + NEWD( "ly2", 1.1172985860549147E-32, CDC_Area ); // *** Square Light-year NEWD( "ha", 1.000000E-04, CDC_Area ); // *** Hectare NEWD( "Quadratlatschen",5.6689342403628117914,CDC_Area ); // *** // SPEED: 1 Meter per Second is... - NEWD( "m/s", 1.0000000000000000E00, CDC_Speed ); // *** Meters per Second + NEWDP( "m/s", 1.0000000000000000E00, CDC_Speed ); // *** Meters per Second + NEWDP( "m/sec", 1.0000000000000000E00, CDC_Speed ); // *** Meters per Second also NEWD( "m/h", 3.6000000000000000E03, CDC_Speed ); // *** Meters per Hour + NEWD( "m/hr", 3.6000000000000000E03, CDC_Speed ); // *** Meters per Hour also NEWD( "mph", 2.2369362920544023E00, CDC_Speed ); // *** Britsh Miles per Hour NEWD( "kn", 1.9438444924406048E00, CDC_Speed ); // *** Knot = Nautical Miles per Hour NEWD( "admkn", 1.9438446603753486E00, CDC_Speed ); // *** Admiralty Knot @@ -2652,6 +2566,10 @@ ConvertDataList::ConvertDataList( void ) NEWD( "ludicrous speed", 2.0494886343432328E-14, CDC_Speed ); // *** NEWD( "laecherliche Geschwindigkeit", 4.0156958471424288E-06, CDC_Speed); // *** NEWD( "ridiculous speed", 4.0156958471424288E-06, CDC_Speed); // *** + + // INFORMATION: 1 Bit is... + NEWDP( "bit", 1.00E00, CDC_Information); // *** Bit + NEWDP( "byte", 1.25E-01, CDC_Information); // *** Byte } diff --git a/scaddins/source/analysis/analysishelper.hxx b/scaddins/source/analysis/analysishelper.hxx index bdc3e6d7e977..e651e8a16eb5 100644 --- a/scaddins/source/analysis/analysishelper.hxx +++ b/scaddins/source/analysis/analysishelper.hxx @@ -514,7 +514,7 @@ public: enum ConvertDataClass { CDC_Mass, CDC_Length, CDC_Time, CDC_Pressure, CDC_Force, CDC_Energy, CDC_Power, CDC_Magnetism, - CDC_Temperature, CDC_Volume, CDC_Area, CDC_Speed + CDC_Temperature, CDC_Volume, CDC_Area, CDC_Speed, CDC_Information }; @@ -533,11 +533,13 @@ protected: double fConst; STRING aName; ConvertDataClass eClass; + sal_Bool bPrefixSupport; public: ConvertData( const sal_Char pUnitName[], double fConvertConstant, - ConvertDataClass eClass ); + ConvertDataClass eClass, + sal_Bool bPrefSupport = sal_False ); virtual ~ConvertData(); @@ -556,6 +558,7 @@ public: virtual double ConvertFromBase( double fVal, sal_Int16 nMatchLevel ) const; inline ConvertDataClass Class( void ) const; + inline sal_Bool IsPrefixSupport( void ) const; }; @@ -570,7 +573,8 @@ public: const sal_Char pUnitName[], double fConvertConstant, double fConvertOffset, - ConvertDataClass eClass ); + ConvertDataClass eClass, + sal_Bool bPrefSupport = sal_False ); virtual ~ConvertDataLinear(); @@ -891,9 +895,14 @@ inline ConvertDataClass ConvertData::Class( void ) const +inline sal_Bool ConvertData::IsPrefixSupport( void ) const +{ + return bPrefixSupport; +} -inline ConvertDataLinear::ConvertDataLinear( const sal_Char* p, double fC, double fO, ConvertDataClass e ) : - ConvertData( p, fC, e ), +inline ConvertDataLinear::ConvertDataLinear( const sal_Char* p, double fC, double fO, ConvertDataClass e, + sal_Bool bPrefSupport ) : + ConvertData( p, fC, e, bPrefSupport ), fOffs( fO ) { } -- cgit From 8fb4e719e4d0e90afdc3685edd4d9cf3a097cfa6 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Mon, 14 Sep 2009 10:57:16 +0000 Subject: CWS-TOOLING: integrate CWS chart41 2009-09-07 11:17:59 +0200 iha r275880 : #i104854# ODF: Fallback to bar chart for surface charts as long as surface charts are not implemented 2009-09-03 10:07:24 +0200 iha r275745 : #i104020# Y axis scaling problem with stock chart 2009-09-02 17:11:42 +0200 iha r275723 : #i103984# XChartDataArray / setDataArray broken 2009-09-02 17:05:16 +0200 iha r275721 : #i103984# XChartDataArray / setDataArray broken 2009-08-31 18:18:21 +0200 iha r275629 : #i103076# ODF, chart from MS-Office2007sp2 doesn't load caused be different xlink:href syntax 2009-08-28 18:35:52 +0200 iha r275548 : #i103460# ODF charts without svg:width and svg:height are not imported correctly 2009-08-28 18:35:25 +0200 iha r275547 : #i103460# ODF charts without svg:width and svg:height are not imported correctly 2009-08-28 18:25:45 +0200 iha r275546 : #i103460# ODF charts without svg:width and svg:height are not imported correctly 2009-08-28 18:23:21 +0200 iha r275544 : #i103460# ODF charts without svg:width and svg:height are not imported correctly 2009-08-28 18:18:34 +0200 iha r275543 : #i103460# ODF charts without svg:width and svg:height are not imported correctly 2009-08-27 15:57:20 +0200 iha r275490 : #i104160# report designer broken --- chart2/source/tools/InternalDataProvider.cxx | 10 ++-- chart2/source/view/main/VDataSeries.cxx | 82 +++++++++++++++++----------- sc/source/ui/unoobj/chartuno.cxx | 11 +++- 3 files changed, 64 insertions(+), 39 deletions(-) diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index 880cd5c72984..4d8f7be112ff 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -393,8 +393,8 @@ void InternalData::swapAllDataAtIndexWithNext( sal_Int32 nAtIndex, bool bDataInC bool InternalData::enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount ) { - sal_Int32 nNewColumnCount( ::std::max(1, ::std::max( m_nColumnCount, nColumnCount ))); - sal_Int32 nNewRowCount( ::std::max(1, ::std::max( m_nRowCount, nRowCount ))); + sal_Int32 nNewColumnCount( ::std::max( m_nColumnCount, nColumnCount ) ); + sal_Int32 nNewRowCount( ::std::max( m_nRowCount, nRowCount ) ); sal_Int32 nNewSize( nNewColumnCount*nNewRowCount ); bool bGrow = (nNewSize > m_nColumnCount*m_nRowCount); @@ -412,9 +412,9 @@ bool InternalData::enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount ) m_aData.resize( nNewSize ); m_aData = aNewData; - m_nColumnCount = nNewColumnCount; - m_nRowCount = nNewRowCount; } + m_nColumnCount = nNewColumnCount; + m_nRowCount = nNewRowCount; return bGrow; } @@ -739,6 +739,8 @@ Sequence< Reference< chart2::data::XLabeledDataSequence > > { ::std::vector< OUString > aLabels( rInternalData.getColumnLabels()); OSL_ASSERT( static_cast< size_t >( nNewIndex ) < aLabels.size()); + if( aLabels.size() <= static_cast< size_t >( nNewIndex ) ) + aLabels.resize( nNewIndex+1 ); aLabels[nNewIndex] = impl::FlattenStringSequence( xLabel->getTextualData()); rInternalData.setColumnLabels( aLabels ); Reference< chart2::data::XDataSequence > xNewLabel( diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index abe8fad1a942..f537612efd8b 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -620,24 +620,33 @@ sal_Int32 VDataSeries::getLabelPlacement( sal_Int32 nPointIndex, const uno::Refe double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const { - double fY = getYValue( index ); - double fY_Min = getY_Min( index ); - double fY_Max = getY_Max( index ); - double fY_First = getY_First( index ); - double fY_Last = getY_Last( index ); - double fMin=0.0; ::rtl::math::setInf(&fMin, false); - if(fMin>fY) - fMin=fY; - if(fMin>fY_First) - fMin=fY_First; - if(fMin>fY_Last) - fMin=fY_Last; - if(fMin>fY_Min) - fMin=fY_Min; - if(fMin>fY_Max) - fMin=fY_Max; + + if( !m_aValues_Y.is() && + (m_aValues_Y_Min.is() || m_aValues_Y_Max.is() + || m_aValues_Y_First.is() || m_aValues_Y_Last.is() ) ) + { + double fY_Min = getY_Min( index ); + double fY_Max = getY_Max( index ); + double fY_First = getY_First( index ); + double fY_Last = getY_Last( index ); + + if(fMin>fY_First) + fMin=fY_First; + if(fMin>fY_Last) + fMin=fY_Last; + if(fMin>fY_Min) + fMin=fY_Min; + if(fMin>fY_Max) + fMin=fY_Max; + } + else + { + double fY = getYValue( index ); + if(fMin>fY) + fMin=fY; + } if( ::rtl::math::isInf(fMin) ) ::rtl::math::setNan(&fMin); @@ -647,24 +656,33 @@ double VDataSeries::getMinimumofAllDifferentYValues( sal_Int32 index ) const double VDataSeries::getMaximumofAllDifferentYValues( sal_Int32 index ) const { - double fY = getYValue( index ); - double fY_Min = getY_Min( index ); - double fY_Max = getY_Max( index ); - double fY_First = getY_First( index ); - double fY_Last = getY_Last( index ); - double fMax=0.0; ::rtl::math::setInf(&fMax, true); - if(fMaxgetComponent(), uno::UNO_QUERY ); if( xReceiver.is()) { + String sRangeStr; + xNewRanges->Format(sRangeStr, SCR_ABS_3D, pDoc); + // connect - xReceiver->attachDataProvider( xDataProvider ); + if( sRangeStr.Len() ) + xReceiver->attachDataProvider( xDataProvider ); + else + sRangeStr = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( "all" ) ); + uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( pDocShell->GetModel(), uno::UNO_QUERY ); xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier ); // set arguments - String sRangeStr; - xNewRanges->Format(sRangeStr, SCR_ABS_3D, pDoc); uno::Sequence< beans::PropertyValue > aArgs( 4 ); aArgs[0] = beans::PropertyValue( ::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1, -- cgit From 236fe0666bcb40990a3533ad2afa0a6bfbc9de67 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Mon, 14 Sep 2009 14:21:40 +0000 Subject: #i10000# build break fixed --- sc/source/core/tool/interpr1.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 9c604d9a07e4..904c2625730c 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -5114,7 +5114,7 @@ void ScInterpreter::ScLookup() if ( !rEntry.bQueryByString ) bFound = false; else - bFound = (ScGlobal::pCollator->compareString( aDataStr, *rEntry.pStr) <= 0); + bFound = (ScGlobal::GetCollator()->compareString( aDataStr, *rEntry.pStr) <= 0); } if (!bFound) -- cgit From c552e9a4f47c54a5202017bbf0bf5cc4eedb1d2c Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 16 Sep 2009 11:45:54 +0000 Subject: CWS-TOOLING: integrate CWS l10nframework01 --- sc/sdi/makefile.mk | 3 ++- sc/source/ui/vba/makefile.mk | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sc/sdi/makefile.mk b/sc/sdi/makefile.mk index 8431c62307b9..57fb3b7956e1 100644 --- a/sc/sdi/makefile.mk +++ b/sc/sdi/makefile.mk @@ -41,7 +41,7 @@ SVSDIINC=$(PRJ)$/source$/ui$/inc # --- Files -------------------------------------------------------- - +.IF "$(L10N_framework)"=="" SDI1NAME=$(TARGET) #SIDHRCNAME=SCSLOTS.HRC SDI1EXPORT=scalc @@ -67,6 +67,7 @@ SVSDI1DEPEND= \ pgbrksh.sdi \ scslots.hrc \ $(INC)$/sc.hrc +.ENDIF # --- Targets ------------------------------------------------------- diff --git a/sc/source/ui/vba/makefile.mk b/sc/source/ui/vba/makefile.mk index fb1cc00488b8..71727297d078 100644 --- a/sc/source/ui/vba/makefile.mk +++ b/sc/source/ui/vba/makefile.mk @@ -45,7 +45,7 @@ DLLPRE = dummy: @echo "not building vba..." .ENDIF - +.IF "$(L10N_framework)"=="" INCPRE=$(INCCOM)$/$(TARGET) # ------------------------------------------------------------------ @@ -135,11 +135,13 @@ SLOFILES= \ $(SLO)$/vbaspinbutton.obj \ $(SLO)$/vbaimage.obj \ $(SLO)$/service.obj - +.ENDIF # --- Targets ------------------------------------------------------ .INCLUDE : target.mk +.IF "$(L10N_framework)"=="" + ALLTAR : \ $(MISC)$/$(TARGET).don \ @@ -149,3 +151,4 @@ $(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@ echo $@ +.ENDIF -- cgit From e6c032c3a8260f176f8d76c7d29931e119e7a69b Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Wed, 16 Sep 2009 13:55:36 +0000 Subject: CWS-TOOLING: integrate CWS impressnotes01 2009-09-11 13:52:41 +0200 cl r276061 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@276043 (milestone: DEV300:m58) 2009-09-10 15:44:57 +0200 cl r276039 : #i103139# continued work on the impress annotation feature 2009-09-10 14:52:31 +0200 cl r276032 : #i103139# continued work on the impress annotation feature 2009-09-10 14:50:32 +0200 cl r276031 : #i103139# continued work on the impress annotation feature 2009-09-10 14:48:29 +0200 cl r276030 : #i103139# continued work on the impress annotation feature 2009-09-10 11:36:11 +0200 cl r276027 : #i103139# continued work on the impress annotation feature 2009-09-09 20:22:41 +0200 cl r276018 : #i103139# continued work on the impress annotation feature 2009-09-09 20:21:45 +0200 cl r276017 : #i103139# continued work on the impress annotation feature 2009-09-09 19:32:29 +0200 sj r276015 : #i103139# added import of comments (ppt binary) 2009-09-09 19:31:07 +0200 sj r276014 : #i103139# added import of comments (ppt binary) 2009-09-09 19:16:41 +0200 cl r276011 : #i103139# continued work on the impress annotation feature 2009-09-09 19:15:19 +0200 cl r276010 : #i103139# continued work on the impress annotation feature 2009-09-09 16:27:19 +0200 cl r276001 : #i104579# fixed isEmptyPresObj() 2009-09-09 15:12:02 +0200 cl r275997 : #i103139# continued work on the impress annotation feature 2009-09-09 15:06:29 +0200 sj r275996 : #i103139# added import of comments (ppt binary) 2009-09-09 14:53:01 +0200 cl r275995 : #i103139# continued work on the impress annotation feature 2009-09-09 14:51:32 +0200 cl r275994 : #i103139# continued work on the impress annotation feature 2009-09-09 12:11:17 +0200 cl r275982 : #i103139# continued work on the impress annotation feature 2009-09-09 11:47:55 +0200 cl r275981 : #i103139# continued work on the impress annotation feature 2009-09-09 11:47:23 +0200 cl r275980 : #i103139# continued work on the impress annotation feature 2009-09-09 11:44:47 +0200 cl r275978 : #i104315# added missing tab pages 2009-09-08 16:04:44 +0200 cl r275936 : #i103139# continued work on the impress annotation feature 2009-09-08 16:03:28 +0200 cl r275935 : #i103139# continued work on the impress annotation feature 2009-09-08 11:45:47 +0200 cl r275920 : #i103139# continued work on the impress annotation feature 2009-09-08 11:41:51 +0200 cl r275919 : #i103139# continued work on the impress annotation feature 2009-09-07 18:30:55 +0200 cl r275910 : #i103139# continued work on the impress annotation feature 2009-09-07 18:29:37 +0200 cl r275909 : #i103139# continued work on the impress annotation feature 2009-09-07 17:25:43 +0200 cl r275905 : #i103139# continued work on the impress annotation feature 2009-09-07 12:00:28 +0200 cl r275884 : #i103139# continued work on the impress annotation feature 2009-09-06 14:14:00 +0200 cl r275859 : #i103139# continued work on the impress annotation feature 2009-09-05 20:57:24 +0200 cl r275854 : #i103139# continued work on the impress annotation feature 2009-09-05 20:56:29 +0200 cl r275853 : #i103139# continued work on the impress annotation feature 2009-09-05 20:55:27 +0200 cl r275852 : #i103139# continued work on the impress annotation feature 2009-09-05 20:11:42 +0200 cl r275851 : #i103139# continued work on the impress annotation feature 2009-09-05 20:11:09 +0200 cl r275850 : #i103139# continued work on the impress annotation feature 2009-09-05 17:43:33 +0200 cl r275845 : #i103139# continued work on the impress annotation feature 2009-09-05 17:04:41 +0200 cl r275843 : #i103139# continued work on the impress annotation feature 2009-09-05 17:03:26 +0200 cl r275842 : #i103139# continued work on the impress annotation feature 2009-09-05 17:02:53 +0200 cl r275841 : #i103139# continued work on the impress annotation feature 2009-09-05 13:15:04 +0200 pl r275839 : #i104823# WB_NEEDSFOCUS 2009-09-05 13:14:41 +0200 pl r275838 : #i104823# WB_NEEDSFOCUS 2009-09-04 17:48:21 +0200 cl r275826 : #i103139# continued work on the impress annotation feature 2009-09-04 17:35:03 +0200 cl r275825 : #i103139# continued work on the impress annotation feature 2009-09-04 17:15:46 +0200 cl r275824 : #i103139# continued work on the impress annotation feature 2009-09-04 17:12:54 +0200 cl r275823 : #i103139# continued work on the impress annotation feature 2009-09-04 17:05:23 +0200 cl r275822 : #i103139# continued work on the impress annotation feature 2009-09-04 16:48:28 +0200 cl r275820 : #i103139# continued work on the impress annotation feature 2009-09-04 16:44:02 +0200 cl r275818 : #i103139# continued work on the impress annotation feature 2009-09-04 16:43:23 +0200 cl r275817 : #i103139# continued work on the impress annotation feature 2009-09-04 16:06:04 +0200 cl r275812 : #i103139# continued work on the impress annotation feature 2009-09-04 16:05:45 +0200 cl r275811 : #i103139# continued work on the impress annotation feature 2009-09-04 15:04:33 +0200 cl r275806 : #i103139# continued work on the impress annotation feature 2009-09-04 11:43:14 +0200 cl r275795 : #i103139# continued work on the impress annotation feature 2009-09-04 11:27:10 +0200 cl r275793 : #i103139# continued work on the impress annotation feature 2009-09-04 11:10:02 +0200 cl r275792 : #i103139# continued work on the impress annotation feature 2009-09-04 11:07:05 +0200 cl r275790 : #i103139# continued work on the impress annotation feature 2009-09-04 11:05:01 +0200 cl r275789 : #i103139# continued work on the impress annotation feature 2009-09-04 10:55:51 +0200 cl r275785 : #i103139# renamed notes to comments 2009-09-04 10:54:57 +0200 cl r275784 : #i103139# renamed notes to comments 2009-09-03 20:37:35 +0200 cl r275772 : #i103139# continued work on the impress annotation feature 2009-09-03 20:35:31 +0200 cl r275771 : #i103139# continued work on the impress annotation feature 2009-09-01 18:17:55 +0200 cl r275680 : #i103139# continued work on the impress annotation feature 2009-09-01 18:15:08 +0200 cl r275678 : #i103139# continued work on the impress annotation feature 2009-09-01 18:13:38 +0200 cl r275677 : #i103139# continued work on the impress annotation feature 2009-08-18 12:35:42 +0200 cl r275089 : fixed merge error 2009-08-18 11:39:58 +0200 cl r275086 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@275001 (milestone: DEV300:m55) 2009-07-30 13:45:10 +0200 cl r274481 : fixed merge errrors 2009-07-30 13:41:21 +0200 cl r274480 : fixed merge errrors 2009-07-30 13:39:40 +0200 cl r274478 : fixed merge errrors 2009-07-22 18:07:30 +0200 cl r274256 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@273858 (milestone: DEV300:m52) 2009-07-21 17:21:31 +0200 cl r274208 : merging 2009-07-20 14:28:34 +0200 cl r274137 : #i103139# annotation support for impress 2009-07-20 14:28:04 +0200 cl r274136 : #i103139# annotation support for impress 2009-07-20 14:27:20 +0200 cl r274135 : #i103139# annotation support for impress 2009-07-20 14:21:17 +0200 cl r274134 : #i103139# annotation support for impress 2009-07-20 14:20:56 +0200 cl r274133 : #i103139# annotation support for impress 2009-07-20 14:20:09 +0200 cl r274132 : #i103139# annotation support for impress 2009-07-20 14:19:00 +0200 cl r274131 : #i103139# annotation support for impress 2009-07-20 14:17:50 +0200 cl r274130 : #i103139# annotation support for impress 2009-07-20 14:12:24 +0200 cl r274129 : #i103139# annotation support for impress 2009-07-20 13:52:03 +0200 cl r274128 : #i103139# annotation support for impress 2009-07-20 13:51:11 +0200 cl r274127 : #i103139# annotation support for impress 2009-07-20 13:48:59 +0200 cl r274126 : #i103139# annotation support for impress 2009-07-20 13:43:56 +0200 cl r274125 : #i103139# annotation support for impress 2009-07-20 13:31:55 +0200 cl r274123 : #i103139# annotation support for impress 2009-07-20 13:30:45 +0200 cl r274122 : #i103139# annotation support for impress --- sc/source/ui/navipi/navipi.src | 2 +- sc/source/ui/pagedlg/pagedlg.src | 2 +- sc/source/ui/src/globstr.src | 14 +++++++------- sc/source/ui/src/optdlg.src | 2 +- sc/source/ui/src/popup.src | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sc/source/ui/navipi/navipi.src b/sc/source/ui/navipi/navipi.src index f5eaeb56bae1..6d5baba4d075 100644 --- a/sc/source/ui/navipi/navipi.src +++ b/sc/source/ui/navipi/navipi.src @@ -320,7 +320,7 @@ String SCSTR_CONTENT_OLEOBJECT }; String SCSTR_CONTENT_NOTE { - Text [ en-US ] = "Notes" ; + Text [ en-US ] = "Comments" ; }; String SCSTR_CONTENT_AREALINK { diff --git a/sc/source/ui/pagedlg/pagedlg.src b/sc/source/ui/pagedlg/pagedlg.src index a031fbe464c9..6db6b1c06cc7 100644 --- a/sc/source/ui/pagedlg/pagedlg.src +++ b/sc/source/ui/pagedlg/pagedlg.src @@ -175,7 +175,7 @@ TabPage RID_SCPAGE_TABLE { Pos = MAP_APPFONT ( 12 , 101 ) ; Size = MAP_APPFONT ( 142 , 10 ) ; - Text [ en-US ] = "~Notes" ; + Text [ en-US ] = "~Comments" ; TabStop = TRUE ; }; CheckBox BTN_OBJECTS diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src index c5b8cfd1a9e8..fb3890616aa0 100644 --- a/sc/source/ui/src/globstr.src +++ b/sc/source/ui/src/globstr.src @@ -304,23 +304,23 @@ Resource RID_GLOBSTR }; String STR_UNDO_INSERTNOTE { - Text [ en-US ] = "Insert Note" ; + Text [ en-US ] = "Insert Comment" ; }; String STR_UNDO_DELETENOTE { - Text [ en-US ] = "Delete Note" ; + Text [ en-US ] = "Delete Comment" ; }; String STR_UNDO_SHOWNOTE { - Text [ en-US ] = "Show Note" ; + Text [ en-US ] = "Show Comment" ; }; String STR_UNDO_HIDENOTE { - Text [ en-US ] = "Hide note" ; + Text [ en-US ] = "Hide Comment" ; }; String STR_UNDO_EDITNOTE { - Text [ en-US ] = "Edit Note" ; + Text [ en-US ] = "Edit Comment" ; }; String STR_UNDO_DEC_INDENT { @@ -1020,7 +1020,7 @@ Resource RID_GLOBSTR }; String STR_NOTES { - Text [ en-US ] = "Notes" ; + Text [ en-US ] = "Comments" ; }; String STR_QUERY_DELTAB { @@ -1260,7 +1260,7 @@ Resource RID_GLOBSTR }; String STR_SCATTR_PAGE_NOTES { - Text [ en-US ] = "Notes" ; + Text [ en-US ] = "Comments" ; }; String STR_SCATTR_PAGE_GRID { diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src index ed84da38b742..66e42d08dcef 100644 --- a/sc/source/ui/src/optdlg.src +++ b/sc/source/ui/src/optdlg.src @@ -363,7 +363,7 @@ TabPage RID_SCPAGE_CONTENT { Pos = MAP_APPFONT ( 139 , 40 ) ; Size = MAP_APPFONT ( 112 , 10 ) ; - Text [ en-US ] = "~Note indicator" ; + Text [ en-US ] = "~Comment indicator" ; }; CheckBox CB_VALUE { diff --git a/sc/source/ui/src/popup.src b/sc/source/ui/src/popup.src index 05d10b9813bd..e9d869b6b850 100644 --- a/sc/source/ui/src/popup.src +++ b/sc/source/ui/src/popup.src @@ -86,19 +86,19 @@ Menu RID_POPUP_CELLS { Identifier = SID_INSERT_POSTIT ; HelpId = SID_INSERT_POSTIT ; - Text [ en-US ] = "Insert ~Note" ; + Text [ en-US ] = "Insert Co~mment" ; }; MenuItem { Identifier = SID_DELETE_NOTE ; HelpId = SID_DELETE_NOTE ; - Text [ en-US ] = "D~elete Note" ; + Text [ en-US ] = "D~elete Comment" ; }; MenuItem { Identifier = FID_NOTE_VISIBLE ; HelpId = FID_NOTE_VISIBLE ; - Text [ en-US ] = "Sho~w Note" ; + Text [ en-US ] = "Sho~w Comment" ; }; //------------------------------ MenuItem { Separator = TRUE ; }; @@ -524,7 +524,7 @@ Menu RID_POPUP_PAGEBREAK { Identifier = FID_NOTE_VISIBLE ; HelpId = FID_NOTE_VISIBLE ; - Text [ en-US ] = "Sho~w Note" ; + Text [ en-US ] = "Sho~w Comment" ; }; }; }; -- cgit From f06e2089d82702cbc577cd3358260d98cc790131 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 17 Sep 2009 11:09:25 +0000 Subject: CWS-TOOLING: integrate CWS dr69 2009-09-09 11:45:28 +0200 dr r275979 : suncc failure 2009-09-09 11:33:34 +0200 dr r275977 : gcc warning 2009-09-09 11:09:02 +0200 er r275976 : #i87171# reworked name check for creating defined names 2009-09-09 10:38:02 +0200 dr r275973 : adapt changes in oox base class 2009-09-09 10:21:03 +0200 dr r275969 : remove faulty pagesize stuff 2009-09-09 10:20:13 +0200 dr r275968 : remove faulty pagesize stuff 2009-09-08 20:24:39 +0200 nn r275958 : #i104899# interpret cells when creating chart listener after loading 2009-09-08 16:05:37 +0200 er r275937 : ScXMLDDELinkContext::EndElement: Excel writes bad ODF without 's table:number-columns-repeated attribute; be lenient ... 2009-09-08 13:14:54 +0200 er r275925 : #i103315# handle external references in Excel's ODF msoxl namespace 2009-09-07 17:37:18 +0200 dr r275907 : #i104753# crash when deleting cell with note 2009-09-07 14:02:29 +0200 dr r275896 : #i103520# reworked sheet name buffer to resolve internal hyperlinks, fix almost all remaining problems with external links in BIFF, fix auto color import for BIFF 2009-09-06 20:01:05 +0200 er r275862 : #i35913# fix regression introduced by integration of CWS fhawfixes1; patch from 2009-09-05 18:32:00 +0200 er r275847 : #i104156# merge #i103918# from uncloned dr68ooo311 2009-09-05 18:19:23 +0200 er r275846 : #i104156# merge #i103317# from uncloned dr68ooo311 2009-09-05 17:32:12 +0200 er r275844 : #i104484# glueState: correct casts in range bounds; patch from slightly modified 2009-09-03 17:26:38 +0200 dr r275764 : #i103520# handle apostrophs in sheet names in internal URLs 2009-09-03 17:21:26 +0200 dr r275763 : #i95271# show text formatting in temp notes 2009-09-03 12:24:52 +0200 dr r275747 : unused declaration 2009-09-02 21:33:03 +0200 dr r275727 : #i96438# cleanup color handling in xls filter, extend VML color parser 2009-09-02 15:39:57 +0200 dr r275715 : #158571# #i96438# accept also VML colors in the form '#RRGGBB [xyz]' 2009-09-02 15:16:36 +0200 dr r275714 : #158571# #i96438# set note text 2009-09-02 14:59:33 +0200 dr r275713 : #158571# #i96438# load custom line dashes from DrawingML and VML 2009-09-02 11:53:35 +0200 dr r275702 : #158571# #i96438# import VML fill gradients 2009-08-31 19:28:10 +0200 dr r275632 : #158571# #i96438# more vml formatting 2009-08-31 14:29:30 +0200 dr r275606 : #158571# #i96438# changed handling of xml token ids/names 2009-08-28 18:25:26 +0200 dr r275545 : #158571# #i96438# preparations for and basic support of VML shape formatting, load spreadsheet cell notes position, formatting, and visibility 2009-08-25 19:08:31 +0200 dr r275378 : #i103390# dump BIFF STYLEEXT 2009-08-25 18:28:50 +0200 dr r275377 : #i103390# improve built-in style handling 2009-08-25 18:27:38 +0200 dr r275376 : #i103390# improve built-in style handling 2009-08-04 18:49:40 +0200 dr r274629 : CWS-TOOLING: rebase CWS dr69 to trunk@274622 (milestone: DEV300:m54) --- sc/inc/compiler.hxx | 73 ++++++++++++++--- sc/inc/document.hxx | 5 +- sc/inc/externalrefmgr.hxx | 48 ++++++++++- sc/source/core/data/cell2.cxx | 4 +- sc/source/core/data/documen3.cxx | 5 +- sc/source/core/data/document.cxx | 20 +++++ sc/source/core/data/postit.cxx | 25 +++--- sc/source/core/tool/address.cxx | 107 +++++++++++++++++++++--- sc/source/core/tool/compiler.cxx | 111 +++++++++++++++++++++---- sc/source/core/tool/rangenam.cxx | 58 ++++++------- sc/source/core/tool/rangeutl.cxx | 4 +- sc/source/core/tool/reftokenhelper.cxx | 2 +- sc/source/core/tool/token.cxx | 2 +- sc/source/filter/excel/xestream.cxx | 5 -- sc/source/filter/excel/xicontent.cxx | 19 +++++ sc/source/filter/excel/xistyle.cxx | 114 +++++++++++++++++++++----- sc/source/filter/excel/xltools.cxx | 42 ++++++---- sc/source/filter/ftools/ftools.cxx | 6 +- sc/source/filter/inc/xestream.hxx | 1 - sc/source/filter/inc/xistyle.hxx | 22 +++-- sc/source/filter/inc/xlstyle.hxx | 6 ++ sc/source/filter/inc/xltools.hxx | 8 +- sc/source/filter/xml/XMLDDELinksContext.cxx | 15 +++- sc/source/filter/xml/XMLTableShapeResizer.cxx | 6 ++ sc/source/filter/xml/xmlexprt.cxx | 2 +- sc/source/filter/xml/xmlexternaltabi.cxx | 28 ++++++- sc/source/ui/docshell/docfunc.cxx | 2 +- sc/source/ui/docshell/externalrefmgr.cxx | 106 +++++++++++++++++------- sc/source/ui/unoobj/chart2uno.cxx | 14 +++- 29 files changed, 671 insertions(+), 189 deletions(-) diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 76293479660c..c981af2dad18 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -64,7 +64,7 @@ // constants and data types also for external modules (ScInterpreter et al) #define MAXCODE 512 /* maximum number of tokens in formula */ -#define MAXSTRLEN 256 /* maximum length of input string of one symbol */ +#define MAXSTRLEN 1024 /* maximum length of input string of one symbol */ #define MAXJUMPCOUNT 32 /* maximum number of jumps (ocChose) */ // flag values of CharTable @@ -91,6 +91,8 @@ #define SC_COMPILER_C_ODF_RBRACKET 0x00080000 // ODF ']' reference bracket #define SC_COMPILER_C_ODF_LABEL_OP 0x00100000 // ODF '!!' automatic intersection of labels #define SC_COMPILER_C_ODF_NAME_MARKER 0x00200000 // ODF '$$' marker that starts a defined (range) name +#define SC_COMPILER_C_CHAR_NAME 0x00400000 // start character of a defined name +#define SC_COMPILER_C_NAME 0x00800000 // continuation character of a defined name #define SC_COMPILER_FILE_TAB_SEP '#' // 'Doc'#Tab @@ -217,6 +219,14 @@ typedef formula::SimpleIntrusiveReference< struct ScRawToken > ScRawTokenRef; class SC_DLLPUBLIC ScCompiler : public formula::FormulaCompiler { public: + + enum EncodeUrlMode + { + ENCODE_BY_GRAMMAR, + ENCODE_ALWAYS, + ENCODE_NEVER, + }; + struct Convention { const formula::FormulaGrammar::AddressConvention meConv; @@ -313,6 +323,7 @@ private: SCsTAB nMaxTab; // last sheet in document sal_Int32 mnRangeOpPosInSymbol; // if and where a range operator is in symbol const Convention *pConv; + EncodeUrlMode meEncodeUrlMode; bool mbCloseBrackets; // whether to close open brackets automatically, default TRUE bool mbExtendedErrorDetection; bool mbRewind; // whether symbol is to be rewound to some step during lexical analysis @@ -373,6 +384,8 @@ public: void SetGrammar( const formula::FormulaGrammar::Grammar eGrammar ); + void SetEncodeUrlMode( EncodeUrlMode eMode ); + EncodeUrlMode GetEncodeUrlMode() const; private: /** Set grammar and reference convention from within SetFormulaLanguage() or SetGrammar(). @@ -435,28 +448,66 @@ public: BOOL HasModifiedRange(); - /// If the character is allowed as first character in sheet names or references + /** If the character is allowed as first character in sheet names or + references, includes '$' and '?'. */ static inline BOOL IsCharWordChar( String const & rStr, xub_StrLen nPos, const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO ) { sal_Unicode c = rStr.GetChar( nPos ); - return c < 128 ? - static_cast( - (pConventions[eConv]->mpCharTable[ UINT8(c) ] & SC_COMPILER_C_CHAR_WORD) == SC_COMPILER_C_CHAR_WORD) : - ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); + if (c < 128) + { + return pConventions[eConv] ? static_cast( + (pConventions[eConv]->mpCharTable[ UINT8(c) ] & SC_COMPILER_C_CHAR_WORD) == SC_COMPILER_C_CHAR_WORD) : + FALSE; // no convention => assume invalid + } + else + return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); } - /// If the character is allowed in sheet names or references + /** If the character is allowed in sheet names, thus may be part of a + reference, includes '$' and '?' and such. */ static inline BOOL IsWordChar( String const & rStr, xub_StrLen nPos, const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO ) { sal_Unicode c = rStr.GetChar( nPos ); - return c < 128 ? - static_cast( - (pConventions[eConv]->mpCharTable[ UINT8(c) ] & SC_COMPILER_C_WORD) == SC_COMPILER_C_WORD) : - ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); + if (c < 128) + { + return pConventions[eConv] ? static_cast( + (pConventions[eConv]->mpCharTable[ UINT8(c) ] & SC_COMPILER_C_WORD) == SC_COMPILER_C_WORD) : + FALSE; // convention not known => assume invalid + } + else + return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); + } + + /** If the character is allowed as tested by nFlags (SC_COMPILER_C_... + bits) for all known address conventions. If more than one bit is given + in nFlags, all bits must match. If bTestLetterNumeric is FALSE and + char>=128, no LetterNumeric test is done and FALSE is returned. */ + static inline bool IsCharFlagAllConventions( String const & rStr, + xub_StrLen nPos, + ULONG nFlags, + bool bTestLetterNumeric = true ) + { + sal_Unicode c = rStr.GetChar( nPos ); + if (c < 128) + { + for ( int nConv = formula::FormulaGrammar::CONV_UNSPECIFIED; + ++nConv < formula::FormulaGrammar::CONV_LAST; ) + { + if (pConventions[nConv] && + ((pConventions[nConv]->mpCharTable[ UINT8(c) ] & nFlags) != nFlags)) + return false; + // convention not known => assume valid + } + return true; + } + else if (bTestLetterNumeric) + return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); + else + return false; } private: diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 67d36861d10a..5f75108c2ebf 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -610,8 +610,8 @@ public: const String& aFileName, const String& aTabName ); - bool HasExternalRefManager() { return pExternalRefMgr.get(); } - SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager(); + bool HasExternalRefManager() const { return pExternalRefMgr.get(); } + SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager() const; bool IsInExternalReferenceMarking() const; void MarkUsedExternalReferences(); bool MarkUsedExternalReferences( ScTokenArray & rArr ); @@ -832,6 +832,7 @@ public: void SetDirty(); void SetDirty( const ScRange& ); void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp + void InterpretDirtyCells( const ScRangeList& rRanges ); void CalcAll(); SC_DLLPUBLIC void CalcAfterLoad(); void CompileAll(); diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx index 9b12dba52f1f..bf795f04fe1c 100644 --- a/sc/inc/externalrefmgr.hxx +++ b/sc/inc/externalrefmgr.hxx @@ -422,10 +422,13 @@ public: /** Source document meta-data container. */ struct SrcFileData { - String maFileName; + String maFileName; /// original file name as loaded from the file. + String maRealFileName; /// file name created from the relative name. String maRelativeName; String maFilterName; String maFilterOptions; + + void maybeCreateRealFileName(const String& rOwnDocName); }; public: @@ -576,7 +579,21 @@ public: */ void convertToAbsName(String& rFile) const; sal_uInt16 getExternalFileId(const String& rFile); - const String* getExternalFileName(sal_uInt16 nFileId) const; + + /** + * It returns a pointer to the name of the URI associated with a given + * external file ID. In case the original document has moved, it returns + * an URI adjusted for the relocation. + * + * @param nFileId file ID for an external document + * @param bForceOriginal If true, it always returns the original document + * URI even if the referring document has relocated. + * If false, it returns an URI adjusted for + * relocated document. + * + * @return const String* external document URI. + */ + const String* getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal = false); bool hasExternalFile(sal_uInt16 nFileId) const; bool hasExternalFile(const String& rFile) const; const SrcFileData* getExternalFileData(sal_uInt16 nFileId) const; @@ -585,8 +602,15 @@ public: const String* getRealRangeName(sal_uInt16 nFileId, const String& rRangeName) const; void refreshNames(sal_uInt16 nFileId); void breakLink(sal_uInt16 nFileId); - void switchSrcFile(sal_uInt16 nFileId, const String& rNewFile); + void switchSrcFile(sal_uInt16 nFileId, const String& rNewFile, const String& rNewFilter); + /** + * Set a relative file path for the specified file ID. Note that the + * caller must ensure that the passed URL is a valid relative URL. + * + * @param nFileId file ID for an external document + * @param rRelUrl relative URL + */ void setRelativeFileName(sal_uInt16 nFileId, const String& rRelUrl); /** @@ -607,8 +631,11 @@ public: * Re-generates relative names for all stored source files. This is * necessary when exporting to an ods document, to ensure that all source * files have their respective relative names for xlink:href export. + * + * @param rBaseFileUrl Absolute URL of the content.xml fragment of the + * document being exported. */ - void resetSrcFileData(); + void resetSrcFileData(const String& rBaseFileUrl); /** * Update a single referencing cell position. @@ -675,6 +702,19 @@ private: void maybeLinkExternalFile(sal_uInt16 nFileId); + /** + * Try to create a "real" file name from the relative path. The original + * file name may not point to the real document when the referencing and + * referenced documents have been moved. + * + * For the real file name to be created, the relative name should not be + * empty before calling this method, or the real file name will not be + * created. + * + * @param nFileId file ID for an external document + */ + void maybeCreateRealFileName(sal_uInt16 nFileId); + bool compileTokensByCell(const ScAddress& rCell); /** diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx index 0b2a5a551ccb..acac874704c6 100644 --- a/sc/source/core/data/cell2.cxx +++ b/sc/source/core/data/cell2.cxx @@ -134,8 +134,8 @@ void ScEditCell::GetString( String& rString ) const EditEngine& rEngine = pDoc->GetEditEngine(); rEngine.SetText( *pData ); rString = ScEditUtil::GetMultilineString(rEngine); // string with line separators between paragraphs - // kurze Strings fuer Formeln merken - if ( rString.Len() < MAXSTRLEN ) + // cache short strings for formulas + if ( rString.Len() < 256 ) ((ScEditCell*)this)->pString = new String( rString ); //! non-const } else diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 4ba4a225c21f..9fc4b09f21af 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -440,10 +440,11 @@ BOOL ScDocument::LinkExternalTab( SCTAB& rTab, const String& aDocTab, return TRUE; } -ScExternalRefManager* ScDocument::GetExternalRefManager() +ScExternalRefManager* ScDocument::GetExternalRefManager() const { + ScDocument* pThis = const_cast(this); if (!pExternalRefMgr.get()) - pExternalRefMgr.reset(new ScExternalRefManager(this)); + pThis->pExternalRefMgr.reset( new ScExternalRefManager( pThis)); return pExternalRefMgr.get(); } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index c74d804de352..8b04d5a0500e 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2880,6 +2880,26 @@ void ScDocument::SetTableOpDirty( const ScRange& rRange ) } +void ScDocument::InterpretDirtyCells( const ScRangeList& rRanges ) +{ + ULONG nRangeCount = rRanges.Count(); + for (ULONG nPos=0; nPosGetCellType() == CELLTYPE_FORMULA) + { + if ( static_cast(pCell)->GetDirty() && GetAutoCalc() ) + static_cast(pCell)->Interpret(); + } + pCell = aIter.GetNext(); + } + } +} + + void ScDocument::AddTableOpFormulaCell( ScFormulaCell* pCell ) { ScInterpreterTableOpParams* p = aTableOpList.Last(); diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index c53694b7674c..a7c5753e4a51 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -786,19 +786,16 @@ SdrCaptionObj* ScNoteUtil::CreateTempCaption( OUStringBuffer aBuffer( rUserText ); // add plain text of invisible (!) cell note (no formatting etc.) SdrCaptionObj* pNoteCaption = 0; - if( const ScPostIt* pNote = rDoc.GetNote( rPos ) ) + const ScPostIt* pNote = rDoc.GetNote( rPos ); + if( pNote && !pNote->IsCaptionShown() ) { - if( !pNote->IsCaptionShown() ) - { - if( aBuffer.getLength() > 0 ) - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\n--------\n" ) ); - aBuffer.append( pNote->GetText() ); - pNoteCaption = pNote->GetOrCreateCaption( rPos ); - } + if( aBuffer.getLength() > 0 ) + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\n--------\n" ) ).append( pNote->GetText() ); + pNoteCaption = pNote->GetOrCreateCaption( rPos ); } // create a caption if any text exists - if( aBuffer.getLength() == 0 ) + if( !pNoteCaption && (aBuffer.getLength() == 0) ) return 0; // prepare visible rectangle (add default distance to all borders) @@ -811,20 +808,24 @@ SdrCaptionObj* ScNoteUtil::CreateTempCaption( // create the caption object ScCaptionCreator aCreator( rDoc, rPos, true, bTailFront ); SdrCaptionObj* pCaption = aCreator.GetCaption(); + // insert caption into page (needed to set caption text) rDrawPage.InsertObject( pCaption ); - // set the text to the object - pCaption->SetText( aBuffer.makeStringAndClear() ); - // set formatting (must be done after setting text) and resize the box to fit the text + // clone the edit text object, unless user text is present, then set this text if( pNoteCaption && (rUserText.getLength() == 0) ) { + if( OutlinerParaObject* pOPO = pNoteCaption->GetOutlinerParaObject() ) + pCaption->SetOutlinerParaObject( new OutlinerParaObject( *pOPO ) ); + // set formatting (must be done after setting text) and resize the box to fit the text pCaption->SetMergedItemSetAndBroadcast( pNoteCaption->GetMergedItemSet() ); Rectangle aCaptRect( pCaption->GetLogicRect().TopLeft(), pNoteCaption->GetLogicRect().GetSize() ); pCaption->SetLogicRect( aCaptRect ); } else { + // if pNoteCaption is null, then aBuffer contains some text + pCaption->SetText( aBuffer.makeStringAndClear() ); ScCaptionUtil::SetDefaultItems( *pCaption, rDoc ); // adjust caption size to text size long nMaxWidth = ::std::min< long >( aVisRect.GetWidth() * 2 / 3, SC_NOTECAPTION_MAXWIDTH_TEMP ); diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 8bfeaaa72289..259018e213ce 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -218,18 +218,55 @@ static bool lcl_ScRange_External_TabSpan( return true; } -// Returns NULL if the string should be a sheet name, but is invalid. -// Returns a pointer to the first character after the sheet name, if there was -// any, else pointer to start. +/** Returns NULL if the string should be a sheet name, but is invalid. + Returns a pointer to the first character after the sheet name, if there was + any, else pointer to start. + @param pMsoxlQuoteStop + Starting _within_ a quoted name, but still may be 3D; quoted name stops + at pMsoxlQuoteStop + */ static const sal_Unicode * lcl_XL_ParseSheetRef( const sal_Unicode* start, String& rExternTabName, - bool allow_3d ) + bool allow_3d, + const sal_Unicode* pMsoxlQuoteStop ) { String aTabName; const sal_Unicode *p = start; - if( *p == '\'' ) // XL only seems to use single quotes for sheet names + // XL only seems to use single quotes for sheet names. + if (pMsoxlQuoteStop) + { + const sal_Unicode* pCurrentStart = p; + while (p < pMsoxlQuoteStop) + { + if (*p == '\'') + { + // We pre-analyzed the quoting, no checks needed here. + if (*++p == '\'') + { + aTabName.Append( pCurrentStart, + sal::static_int_cast( p - pCurrentStart)); + pCurrentStart = ++p; + } + } + else if (*p == ':') + { + break; // while + } + else + ++p; + } + if (pCurrentStart < p) + aTabName.Append( pCurrentStart, sal::static_int_cast( p - pCurrentStart)); + if (!aTabName.Len()) + return NULL; + if (p == pMsoxlQuoteStop) + ++p; // position on ! of ...'!... + if( *p != '!' && ( !allow_3d || *p != ':' ) ) + return (!allow_3d && *p == ':') ? p : start; + } + else if( *p == '\'') { p = lcl_ParseQuotedName(p, aTabName); if (!aTabName.Len()) @@ -290,8 +327,8 @@ lcl_XL_ParseSheetRef( const sal_Unicode* start, break; } - if( *p != '!' &&( !allow_3d || *p != ':' ) ) - return start; + if( *p != '!' && ( !allow_3d || *p != ':' ) ) + return (!allow_3d && *p == ':') ? p : start; aTabName.Append( start, sal::static_int_cast( p - start ) ); } @@ -318,6 +355,7 @@ const sal_Unicode* ScRange::Parse_XL_Header( rStartTabName.Erase(); rEndTabName.Erase(); rExternDocName.Erase(); + const sal_Unicode* pMsoxlQuoteStop = NULL; if (*p == '[') { ++p; @@ -371,9 +409,47 @@ const sal_Unicode* ScRange::Parse_XL_Header( } rExternDocName = ScGlobal::GetAbsDocName(rExternDocName, pDoc->GetDocumentShell()); } + else if (*p == '\'') + { + // Sickness in Excel's ODF msoxl namespace: + // 'E:\[EXTDATA8.XLS]Sheet1'!$A$7 or + // 'E:\[EXTDATA12B.XLSB]Sheet1:Sheet3'!$A$11 + // But, 'Sheet1'!B3 would also be a valid! + // Excel does not allow [ and ] characters in sheet names though. + p = lcl_ParseQuotedName(p, rExternDocName); + if (!*p || *p != '!') + return start; + if (rExternDocName.Len()) + { + xub_StrLen nOpen = rExternDocName.Search( '['); + if (nOpen == STRING_NOTFOUND) + rExternDocName.Erase(); + else + { + xub_StrLen nClose = rExternDocName.Search( ']', nOpen+1); + if (nClose == STRING_NOTFOUND) + rExternDocName.Erase(); + else + { + rExternDocName.Erase( nClose); + rExternDocName.Erase( nOpen, 1); + pMsoxlQuoteStop = p - 1; // the ' quote char + // There may be embedded escaped quotes, just matching the + // doc name's length may not work. + for (p = start; *p != '['; ++p) + ; + for ( ; *p != ']'; ++p) + ; + ++p; + } + } + } + if (!rExternDocName.Len()) + p = start; + } startTabs = p; - p = lcl_XL_ParseSheetRef( p, rStartTabName, !bOnlyAcceptSingle ); + p = lcl_XL_ParseSheetRef( p, rStartTabName, !bOnlyAcceptSingle, pMsoxlQuoteStop); if( NULL == p ) return start; // invalid tab if (bOnlyAcceptSingle && *p == ':') @@ -383,7 +459,7 @@ const sal_Unicode* ScRange::Parse_XL_Header( nFlags |= SCA_VALID_TAB | SCA_TAB_3D | SCA_TAB_ABSOLUTE; if( *p == ':' ) // 3d ref { - p = lcl_XL_ParseSheetRef( p+1, rEndTabName, false ); + p = lcl_XL_ParseSheetRef( p+1, rEndTabName, false, pMsoxlQuoteStop); if( p == NULL ) { nFlags = nSaveFlags; @@ -413,7 +489,12 @@ const sal_Unicode* ScRange::Parse_XL_Header( // Use the current tab, it needs to be passed in. : aEnd.SetTab( .. ); } - if (!rExternDocName.Len()) + if (rExternDocName.Len()) + { + ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager(); + pRefMgr->convertToAbsName( rExternDocName); + } + else { // Internal reference. if (!rStartTabName.Len()) @@ -594,7 +675,8 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r, if (p && p[0] != 0) { // any trailing invalid character must invalidate the whole address. - nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB); + nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | + SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2); return nFlags; } @@ -661,7 +743,8 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r, if (p && p[0] != 0) { // any trailing invalid character must invalidate the whole address. - nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB); + nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB | + SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2); return nFlags; } diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 0da842e6ca5a..a8ca4be2b5b6 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -372,6 +372,15 @@ void ScCompiler::SetGrammar( const FormulaGrammar::Grammar eGrammar ) } } +void ScCompiler::SetEncodeUrlMode( EncodeUrlMode eMode ) +{ + meEncodeUrlMode = eMode; +} + +ScCompiler::EncodeUrlMode ScCompiler::GetEncodeUrlMode() const +{ + return meEncodeUrlMode; +} void ScCompiler::SetFormulaLanguage( const ScCompiler::OpCodeMapPtr & xMap ) { @@ -461,22 +470,22 @@ ScCompiler::Convention::Convention( FormulaGrammar::AddressConvention eConv ) /* + */ t[43] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_EXP | SC_COMPILER_C_VALUE_SIGN; /* , */ t[44] = SC_COMPILER_C_CHAR_VALUE | SC_COMPILER_C_VALUE; /* - */ t[45] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_EXP | SC_COMPILER_C_VALUE_SIGN; -/* . */ t[46] = SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_VALUE | SC_COMPILER_C_VALUE | SC_COMPILER_C_IDENT; +/* . */ t[46] = SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_VALUE | SC_COMPILER_C_VALUE | SC_COMPILER_C_IDENT | SC_COMPILER_C_NAME; /* / */ t[47] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; for (i = 48; i < 58; i++) -/* 0-9 */ t[i] = SC_COMPILER_C_CHAR_VALUE | SC_COMPILER_C_WORD | SC_COMPILER_C_VALUE | SC_COMPILER_C_VALUE_EXP | SC_COMPILER_C_VALUE_VALUE | SC_COMPILER_C_IDENT; +/* 0-9 */ t[i] = SC_COMPILER_C_CHAR_VALUE | SC_COMPILER_C_WORD | SC_COMPILER_C_VALUE | SC_COMPILER_C_VALUE_EXP | SC_COMPILER_C_VALUE_VALUE | SC_COMPILER_C_IDENT | SC_COMPILER_C_NAME; /* : */ t[58] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD; /* ; */ t[59] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; /* < */ t[60] = SC_COMPILER_C_CHAR_BOOL | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; /* = */ t[61] = SC_COMPILER_C_CHAR | SC_COMPILER_C_BOOL | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; /* > */ t[62] = SC_COMPILER_C_CHAR_BOOL | SC_COMPILER_C_BOOL | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; -/* ? */ t[63] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD; +/* ? */ t[63] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_NAME; /* @ */ // FREE for (i = 65; i < 91; i++) -/* A-Z */ t[i] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT; +/* A-Z */ t[i] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT | SC_COMPILER_C_CHAR_NAME | SC_COMPILER_C_NAME; if (FormulaGrammar::CONV_ODF == meConv) { @@ -491,11 +500,11 @@ ScCompiler::Convention::Convention( FormulaGrammar::AddressConvention eConv ) /* ] */ // FREE } /* ^ */ t[94] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; -/* _ */ t[95] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT; +/* _ */ t[95] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT | SC_COMPILER_C_CHAR_NAME | SC_COMPILER_C_NAME; /* ` */ // FREE for (i = 97; i < 123; i++) -/* a-z */ t[i] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT; +/* a-z */ t[i] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT | SC_COMPILER_C_CHAR_NAME | SC_COMPILER_C_NAME; /* { */ t[123] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; // array open /* | */ t[124] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; // array row sep (Should be OOo specific) @@ -995,14 +1004,19 @@ struct ConventionOOO_A1 : public Convention_A1 bool makeExternalSingleRefStr( ::rtl::OUStringBuffer& rBuffer, sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef, - ScExternalRefManager* pRefMgr, bool bDisplayTabName ) const + ScExternalRefManager* pRefMgr, bool bDisplayTabName, bool bEncodeUrl ) const { if (bDisplayTabName) { String aFile; const String* p = pRefMgr->getExternalFileName(nFileId); if (p) - aFile = *p; + { + if (bEncodeUrl) + aFile = *p; + else + aFile = INetURLObject::decode(*p, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS); + } aFile.SearchAndReplaceAllAscii("'", String::CreateFromAscii("''")); rBuffer.append(sal_Unicode('\'')); @@ -1036,7 +1050,23 @@ struct ConventionOOO_A1 : public Convention_A1 if (bODF) rBuffer.append( sal_Unicode('[')); - makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef, pRefMgr, true); + + bool bEncodeUrl = true; + switch (rCompiler.GetEncodeUrlMode()) + { + case ScCompiler::ENCODE_BY_GRAMMAR: + bEncodeUrl = bODF; + break; + case ScCompiler::ENCODE_ALWAYS: + bEncodeUrl = true; + break; + case ScCompiler::ENCODE_NEVER: + bEncodeUrl = false; + break; + default: + ; + } + makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef, pRefMgr, true, bEncodeUrl); if (bODF) rBuffer.append( sal_Unicode(']')); } @@ -1058,9 +1088,25 @@ struct ConventionOOO_A1 : public Convention_A1 if (bODF) rBuffer.append( sal_Unicode('[')); // Ensure that there's always a closing bracket, no premature returns. + bool bEncodeUrl = true; + switch (rCompiler.GetEncodeUrlMode()) + { + case ScCompiler::ENCODE_BY_GRAMMAR: + bEncodeUrl = bODF; + break; + case ScCompiler::ENCODE_ALWAYS: + bEncodeUrl = true; + break; + case ScCompiler::ENCODE_NEVER: + bEncodeUrl = false; + break; + default: + ; + } + do { - if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef.Ref1, pRefMgr, true)) + if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef.Ref1, pRefMgr, true, bEncodeUrl)) break; rBuffer.append(sal_Unicode(':')); @@ -1086,7 +1132,7 @@ struct ConventionOOO_A1 : public Convention_A1 else if (bODF) rBuffer.append( sal_Unicode('.')); // need at least the sheet separator in ODF makeExternalSingleRefStr( rBuffer, nFileId, aLastTabName, - aRef.Ref2, pRefMgr, bDisplayTabName); + aRef.Ref2, pRefMgr, bDisplayTabName, bEncodeUrl); } while (0); if (bODF) rBuffer.append( sal_Unicode(']')); @@ -1248,7 +1294,7 @@ struct ConventionXL return lcl_makeExternalNameStr( rFile, rName, sal_Unicode('!'), false); } - static void makeExternalDocStr( ::rtl::OUStringBuffer& rBuffer, const String& rFullName ) + static void makeExternalDocStr( ::rtl::OUStringBuffer& rBuffer, const String& rFullName, bool bEncodeUrl ) { // Format that is easier to deal with inside OOo, because we use file // URL, and all characetrs are allowed. Check if it makes sense to do @@ -1259,8 +1305,14 @@ struct ConventionXL rBuffer.append(sal_Unicode('[')); rBuffer.append(sal_Unicode('\'')); - const sal_Unicode* pBuf = rFullName.GetBuffer(); - xub_StrLen nLen = rFullName.Len(); + String aFullName; + if (bEncodeUrl) + aFullName = rFullName; + else + aFullName = INetURLObject::decode(rFullName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS); + + const sal_Unicode* pBuf = aFullName.GetBuffer(); + xub_StrLen nLen = aFullName.Len(); for (xub_StrLen i = 0; i < nLen; ++i) { const sal_Unicode c = pBuf[i]; @@ -1473,7 +1525,8 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL ScSingleRefData aRef(rRef); aRef.CalcAbsIfRel(rCompiler.GetPos()); - ConventionXL::makeExternalDocStr(rBuffer, *pFullName); + ConventionXL::makeExternalDocStr( + rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS); ScRangeStringConverter::AppendTableName(rBuffer, rTabName); rBuffer.append(sal_Unicode('!')); @@ -1496,7 +1549,8 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL ScComplexRefData aRef(rRef); aRef.CalcAbsIfRel(rCompiler.GetPos()); - ConventionXL::makeExternalDocStr(rBuffer, *pFullName); + ConventionXL::makeExternalDocStr( + rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS); ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, aTabNames, aRef); rBuffer.append(sal_Unicode('!')); @@ -1677,7 +1731,8 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL ScSingleRefData aRef(rRef); aRef.CalcAbsIfRel(rCompiler.GetPos()); - ConventionXL::makeExternalDocStr(rBuffer, *pFullName); + ConventionXL::makeExternalDocStr( + rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS); ScRangeStringConverter::AppendTableName(rBuffer, rTabName); rBuffer.append(sal_Unicode('!')); @@ -1701,7 +1756,8 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL ScComplexRefData aRef(rRef); aRef.CalcAbsIfRel(rCompiler.GetPos()); - ConventionXL::makeExternalDocStr(rBuffer, *pFullName); + ConventionXL::makeExternalDocStr( + rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS); ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, aTabNames, aRef); rBuffer.append(sal_Unicode('!')); @@ -1753,6 +1809,7 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,ScTokenArra mnPredetectedReference(0), mnRangeOpPosInSymbol(-1), pConv( pConvOOO_A1 ), + meEncodeUrlMode( ENCODE_BY_GRAMMAR ), mbCloseBrackets( true ), mbExtendedErrorDetection( false ), mbRewind( false ) @@ -1768,6 +1825,7 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos) mnPredetectedReference(0), mnRangeOpPosInSymbol(-1), pConv( pConvOOO_A1 ), + meEncodeUrlMode( ENCODE_BY_GRAMMAR ), mbCloseBrackets( true ), mbExtendedErrorDetection( false ), mbRewind( false ) @@ -2802,6 +2860,23 @@ BOOL ScCompiler::IsReference( const String& rName ) mbRewind = true; return true; // end all checks } + else + { + // Special treatment for the 'E:\[doc]Sheet1:Sheet3'!D5 Excel sickness, + // mnRangeOpPosInSymbol did not catch the range operator as it is + // within a quoted name. + switch (pConv->meConv) + { + case FormulaGrammar::CONV_XL_A1: + case FormulaGrammar::CONV_XL_R1C1: + case FormulaGrammar::CONV_XL_OOX: + if (rName.GetChar(0) == '\'' && IsDoubleReference( rName)) + return true; + break; + default: + ; // nothing + } + } return false; } diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index 3f0cadbadb7f..7795256dce3c 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -453,48 +453,45 @@ void ScRangeData::UpdateTabRef(SCTAB nOldTable, USHORT nFlag, SCTAB nNewTable) } } -// wie beim Uebernehmen von Namen in Excel void ScRangeData::MakeValidName( String& rName ) // static { //ScCompiler::InitSymbolsNative(); - // ungueltige Zeichen vorne weglassen + // strip leading invalid characters xub_StrLen nPos = 0; xub_StrLen nLen = rName.Len(); - while ( nPos < nLen && !ScCompiler::IsWordChar( rName, nPos) ) + while ( nPos < nLen && !ScCompiler::IsCharFlagAllConventions( rName, nPos, SC_COMPILER_C_NAME) ) ++nPos; if ( nPos>0 ) rName.Erase(0,nPos); - // wenn vorne ein ungueltiges Anfangszeichen steht, '_' davor - if ( rName.Len() && !ScCompiler::IsCharWordChar( rName, 0 ) ) + // if the first character is an invalid start character, precede with '_' + if ( rName.Len() && !ScCompiler::IsCharFlagAllConventions( rName, 0, SC_COMPILER_C_CHAR_NAME ) ) rName.Insert('_',0); - // ungueltige durch '_' ersetzen + // replace invalid with '_' nLen = rName.Len(); for (nPos=0; nPos( nConv ) ); - while( aRange.Parse( rName, NULL, details ) - || aAddr.Parse( rName, NULL, details ) ) + // Don't check Parse on VALID, any partial only VALID may result in + // #REF! during compile later! + while (aRange.Parse( rName, NULL, details) || aAddr.Parse( rName, NULL, details)) { - //! Range Parse auch bei Bereich mit ungueltigem Tabellennamen gueltig - //! Address Parse dito, Name erzeugt deswegen bei Compile ein #REF! - if ( rName.SearchAndReplace( ':', '_' ) == STRING_NOTFOUND - && rName.SearchAndReplace( '.', '_' ) == STRING_NOTFOUND ) + //! Range Parse is partially valid also with invalid sheet name, + //! Address Parse dito, during compile name would generate a #REF! + if ( rName.SearchAndReplace( '.', '_' ) == STRING_NOTFOUND ) rName.Insert('_',0); } } @@ -502,26 +499,25 @@ void ScRangeData::MakeValidName( String& rName ) // static BOOL ScRangeData::IsNameValid( const String& rName, ScDocument* pDoc ) { - /* If changed, ScfTools::ConvertToScDefinedName (sc/source/filter/ftools/ftools.cxx) - needs to be changed too. */ + /* XXX If changed, sc/source/filter/ftools/ftools.cxx + * ScfTools::ConvertToScDefinedName needs to be changed too. */ xub_StrLen nPos = 0; xub_StrLen nLen = rName.Len(); - if ( !nLen || !ScCompiler::IsCharWordChar( rName, nPos++ ) ) + if ( !nLen || !ScCompiler::IsCharFlagAllConventions( rName, nPos++, SC_COMPILER_C_CHAR_NAME ) ) return FALSE; while ( nPos < nLen ) { - if ( !ScCompiler::IsWordChar( rName, nPos++ ) ) + if ( !ScCompiler::IsCharFlagAllConventions( rName, nPos++, SC_COMPILER_C_NAME ) ) return FALSE; } - // Parse nicht auf VALID pruefen, es reicht, wenn irgendein Bestandteil - // erkannt wurde + ScAddress aAddr; ScRange aRange; - if( aRange.Parse( rName, pDoc ) ) // THIS IS WRONG - return FALSE; - else + for (int nConv = FormulaGrammar::CONV_UNSPECIFIED; ++nConv < FormulaGrammar::CONV_LAST; ) { - ScAddress aAddr; - if ( aAddr.Parse( rName, pDoc ) ) // THIS IS WRONG + ScAddress::Details details( static_cast( nConv ) ); + // Don't check Parse on VALID, any partial only VALID may result in + // #REF! during compile later! + if (aRange.Parse( rName, pDoc, details) || aAddr.Parse( rName, pDoc, details)) return FALSE; } return TRUE; diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx index b1654421b12c..4a26a5004799 100644 --- a/sc/source/core/tool/rangeutl.cxx +++ b/sc/source/core/tool/rangeutl.cxx @@ -786,7 +786,7 @@ static void lcl_appendCellAddress( if (rExtInfo.mbExternal) { ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager(); - const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo.mnFileId); + const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo.mnFileId, true); if (!pFilePath) return; @@ -821,7 +821,7 @@ static void lcl_appendCellRangeAddress( DBG_ASSERT(rExtInfo1.mnFileId == rExtInfo2.mnFileId, "File IDs do not match between 1st and 2nd addresses."); ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager(); - const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo1.mnFileId); + const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo1.mnFileId, true); if (!pFilePath) return; diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx index e129abdcf97f..d0f2b8233de0 100644 --- a/sc/source/core/tool/reftokenhelper.cxx +++ b/sc/source/core/tool/reftokenhelper.cxx @@ -51,7 +51,7 @@ using ::rtl::OUString; void ScRefTokenHelper::compileRangeRepresentation( vector& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc, FormulaGrammar::Grammar eGrammar) { - const sal_Unicode cSep = ';'; + const sal_Unicode cSep = GetScCompilerNativeSymbol(ocSep).GetChar(0); const sal_Unicode cQuote = '\''; bool bFailure = false; diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 0f03d31d3fc8..6c5c6a03b773 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -119,7 +119,7 @@ IMPL_FIXEDMEMPOOL_NEWDEL( ImpTokenIterator, 32, 16 ) // Align MemPools on 4k boundaries - 64 bytes (4k is a MUST for OS/2) // Since RawTokens are temporary for the compiler, don't align on 4k and waste memory. -// ScRawToken size is FixMembers + MAXSTRLEN ~= 264 +// ScRawToken size is FixMembers + MAXSTRLEN + ~4 ~= 1036 IMPL_FIXEDMEMPOOL_NEWDEL( ScRawToken, 8, 4 ) // Some ScDoubleRawToken, FixMembers + sizeof(double) ~= 16 const USHORT nMemPoolDoubleRawToken = 0x0400 / sizeof(ScDoubleRawToken); diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 45ced68de006..10d23eccdf27 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -985,11 +985,6 @@ bool XclExpXmlStream::importDocument() throw() return false; } -sal_Int32 XclExpXmlStream::getSchemeClr( sal_Int32 /*nColorSchemeToken*/ ) const -{ - return -1; -} - oox::vml::Drawing* XclExpXmlStream::getVmlDrawing() { return 0; diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index b57297b344dc..7b5fb222a12b 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -377,14 +377,33 @@ void XclImpHyperlink::ConvertToValidTabName(String& rUrl) String aNewUrl(sal_Unicode('#')), aTabName; bool bInQuote = false; + bool bQuoteTabName = false; for (xub_StrLen i = 1; i < n; ++i) { c = rUrl.GetChar(i); if (c == sal_Unicode('\'')) { + if (bInQuote && i+1 < n && rUrl.GetChar(i+1) == sal_Unicode('\'')) + { + // Two consecutive single quotes ('') signify a single literal + // quite. When this occurs, the whole table name needs to be + // quoted. + bQuoteTabName = true; + aTabName.Append(c); + aTabName.Append(c); + ++i; + continue; + } + bInQuote = !bInQuote; if (!bInQuote && aTabName.Len() > 0) + { + if (bQuoteTabName) + aNewUrl.Append(sal_Unicode('\'')); aNewUrl.Append(aTabName); + if (bQuoteTabName) + aNewUrl.Append(sal_Unicode('\'')); + } } else if (bInQuote) aTabName.Append(c); diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 7f1627e89e7f..a83e203c167d 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -1088,26 +1088,25 @@ void XclImpXF::ReadXF( XclImpStream& rStrm ) } } -void XclImpXF::SetStyleName( const String& rStyleName ) +void XclImpXF::SetStyleName( const String& rStyleName, bool bBuiltIn, bool bForceCreate ) { DBG_ASSERT( IsStyleXF(), "XclImpXF::SetStyleName - not a style XF" ); - DBG_ASSERT( rStyleName.Len(), "XclImpXF::SetStyleName - style name empty" ); - if( IsStyleXF() && !maStyleName.Len() ) + DBG_ASSERT( rStyleName.Len() > 0, "XclImpXF::SetStyleName - style name empty" ); + if( IsStyleXF() && (rStyleName.Len() > 0) ) { maStyleName = rStyleName; - mbForceCreate = true; + mbWasBuiltIn = bBuiltIn; + mbForceCreate = bForceCreate; } } -void XclImpXF::SetBuiltInStyleName( sal_uInt8 nStyleId, sal_uInt8 nLevel ) +void XclImpXF::ChangeStyleName( const String& rStyleName ) { - DBG_ASSERT( IsStyleXF(), "XclImpXF::SetStyleName - not a style XF" ); - if( IsStyleXF() && !maStyleName.Len() ) - { - mbWasBuiltIn = true; - maStyleName = XclTools::GetBuiltInStyleName( nStyleId, nLevel ); - mbForceCreate = nStyleId == EXC_STYLE_NORMAL; // force creation of "Default" style - } + DBG_ASSERT( IsStyleXF(), "XclImpXF::ChangeStyleName - not a style XF" ); + DBG_ASSERT( rStyleName.Len() > 0, "XclImpXF::ChangeStyleName - new style name empty" ); + DBG_ASSERT( maStyleName.Len() > 0, "XclImpXF::ChangeStyleName - old style name empty" ); + if( IsStyleXF() && (rStyleName.Len() > 0) ) + maStyleName = rStyleName; } void XclImpXF::CreateUserStyle() @@ -1239,6 +1238,7 @@ ScStyleSheet* XclImpXF::CreateStyleSheet() { if( !mpStyleSheet && maStyleName.Len() ) // valid name implies style XF { + bool bCreatePattern = false; // there may be a user-defined "Default" - test on built-in too! bool bDefStyle = mbWasBuiltIn && (maStyleName == ScGlobal::GetRscString( STR_STYLENAME_STANDARD )); if( bDefStyle ) @@ -1249,16 +1249,23 @@ ScStyleSheet* XclImpXF::CreateStyleSheet() mpStyleSheet = static_cast< ScStyleSheet* >( GetStyleSheetPool().Find( ScGlobal::GetRscString( STR_STYLENAME_STANDARD ), SFX_STYLE_FAMILY_PARA ) ); DBG_ASSERT( mpStyleSheet, "XclImpXF::CreateStyleSheet - Default style not found" ); + bCreatePattern = true; } else { - /* mbWasBuiltIn==true forces renaming of equal-named user defined styles - to be able to re-export built-in styles correctly. */ - mpStyleSheet = &ScfTools::MakeCellStyleSheet( GetStyleSheetPool(), maStyleName, mbWasBuiltIn ); + /* #i103281# do not create another style sheet of the same name, + if it exists already. This is needed to prevent that styles + pasted from clipboard get duplicated over and over. */ + mpStyleSheet = static_cast< ScStyleSheet* >( GetStyleSheetPool().Find( maStyleName, SFX_STYLE_FAMILY_PARA ) ); + if( !mpStyleSheet ) + { + mpStyleSheet = &static_cast< ScStyleSheet& >( GetStyleSheetPool().Make( maStyleName, SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_USERDEF ) ); + bCreatePattern = true; + } } // bDefStyle==true omits default pool items in CreatePattern() - if( mpStyleSheet ) + if( bCreatePattern && mpStyleSheet ) mpStyleSheet->GetItemSet().Put( CreatePattern( bDefStyle ).GetItemSet() ); } return mpStyleSheet; @@ -1274,6 +1281,16 @@ XclImpXFBuffer::XclImpXFBuffer( const XclImpRoot& rRoot ) : void XclImpXFBuffer::Initialize() { maXFList.Clear(); + maStyleXFs.clear(); + /* Reserve style names that are built-in in Calc. For BIFF4 workbooks + which contain a separate list of styles per sheet, reserve all existing + names if current sheet is not the first sheet. This will create unique + names for styles in different sheets with the same name. */ + bool bReserveAll = (GetBiff() == EXC_BIFF4) && (GetCurrScTab() > 0); + SfxStyleSheetIterator aStyleIter( GetDoc().GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA ); + for( SfxStyleSheetBase* pStyleSheet = aStyleIter.First(); pStyleSheet; pStyleSheet = aStyleIter.Next() ) + if( bReserveAll || !pStyleSheet->IsUserDefined() ) + maStyleXFs[ pStyleSheet->GetName() ] = 0; } void XclImpXFBuffer::ReadXF( XclImpStream& rStrm ) @@ -1282,9 +1299,9 @@ void XclImpXFBuffer::ReadXF( XclImpStream& rStrm ) pXF->ReadXF( rStrm ); maXFList.Append( pXF ); + // set the name of the "Default" cell style (always the first XF in an Excel file) if( (GetBiff() >= EXC_BIFF3) && (maXFList.Count() == 1) ) - // set the name of the "Default" cell style (always the first XF in an Excel file) - pXF->SetBuiltInStyleName( EXC_STYLE_NORMAL, 0 ); + CalcStyleName( *pXF, EXC_STYLE_NORMAL, 0 ); } void XclImpXFBuffer::ReadStyle( XclImpStream& rStrm ) @@ -1301,7 +1318,7 @@ void XclImpXFBuffer::ReadStyle( XclImpStream& rStrm ) { sal_uInt8 nStyleId, nLevel; rStrm >> nStyleId >> nLevel; - pXF->SetBuiltInStyleName( nStyleId, nLevel ); + CalcStyleName( *pXF, nStyleId, nLevel ); } else // user-defined styles { @@ -1310,8 +1327,20 @@ void XclImpXFBuffer::ReadStyle( XclImpStream& rStrm ) aStyleName = rStrm.ReadByteString( false ); // 8 bit length else aStyleName = rStrm.ReadUniString(); - if( aStyleName.Len() ) // #i1624# #i1768# ignore unnamed styles - pXF->SetStyleName( aStyleName ); + + if( aStyleName.Len() > 0 ) // #i1624# #i1768# ignore unnamed styles + { + // #i103281# check if this is a new built-in style introduced in XL2007 + bool bBuiltIn = false; + if( (GetBiff() == EXC_BIFF8) && (rStrm.GetNextRecId() == EXC_ID_STYLEEXT) && rStrm.StartNextRecord() ) + { + sal_uInt8 nExtFlags; + rStrm.Ignore( 12 ); + rStrm >> nExtFlags; + bBuiltIn = ::get_flag( nExtFlags, EXC_STYLEEXT_BUILTIN ); + } + CalcStyleName( *pXF, aStyleName, bBuiltIn ); + } } } } @@ -1345,6 +1374,49 @@ void XclImpXFBuffer::ApplyPattern( } } +void XclImpXFBuffer::CalcStyleName( XclImpXF& rXF, const String& rStyleName, bool bBuiltIn ) +{ + DBG_ASSERT( rStyleName.Len() > 0, "XclImpXFBuffer::CalcStyleName - style name empty" ); + if( rStyleName.Len() > 0 ) + { + String aStyleName = bBuiltIn ? XclTools::GetBuiltInStyleName( rStyleName ) : rStyleName; + SetStyleName( rXF, aStyleName, bBuiltIn, !bBuiltIn ); + } +} + +void XclImpXFBuffer::CalcStyleName( XclImpXF& rXF, sal_uInt8 nStyleId, sal_uInt8 nLevel ) +{ + // force creation of "Default" style + SetStyleName( rXF, XclTools::GetBuiltInStyleName( nStyleId, nLevel ), true, nStyleId == EXC_STYLE_NORMAL ); +} + +void XclImpXFBuffer::SetStyleName( XclImpXF& rXF, const String& rStyleName, bool bBuiltIn, bool bForceCreate ) +{ + DBG_ASSERT( rXF.IsStyleXF(), "XclImpXFBuffer::SetStyleName - not a style XF" ); + if( rXF.IsStyleXF() ) + { + // find an unused name + String aUnusedName( rStyleName ); + sal_Int32 nIndex = 0; + while( maStyleXFs.count( aUnusedName ) > 0 ) + aUnusedName.Assign( rStyleName ).Append( ' ' ).Append( String::CreateFromInt32( ++nIndex ) ); + + // move old style to new name, if new style is built-in + if( bBuiltIn && (aUnusedName != rStyleName) ) + { + XclImpXF*& rpXF = maStyleXFs[ aUnusedName ]; + rpXF = maStyleXFs[ rStyleName ]; + if( rpXF ) + rpXF->ChangeStyleName( aUnusedName ); + aUnusedName = rStyleName; + } + + // insert new style + maStyleXFs[ aUnusedName ] = &rXF; + rXF.SetStyleName( aUnusedName, bBuiltIn, bForceCreate ); + } +} + // Buffer for XF indexes in cells ============================================= IMPL_FIXEDMEMPOOL_NEWDEL( XclImpXFRange, 100, 500 ) diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index ef38a0037ca0..a84aaba82b90 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -511,7 +511,8 @@ sal_Unicode XclTools::GetBuiltInDefNameIndex( const String& rDefName ) // built-in style names ------------------------------------------------------- -const String XclTools::maStyleNamePrefix( RTL_CONSTASCII_USTRINGPARAM( "Excel_BuiltIn_" ) ); +const String XclTools::maStyleNamePrefix1( RTL_CONSTASCII_USTRINGPARAM( "Excel_BuiltIn_" ) ); +const String XclTools::maStyleNamePrefix2( RTL_CONSTASCII_USTRINGPARAM( "Excel Built-in " ) ); static const sal_Char* const ppcStyleNames[] = { @@ -534,7 +535,7 @@ String XclTools::GetBuiltInStyleName( sal_uInt8 nStyleId, sal_uInt8 nLevel ) if( nStyleId == EXC_STYLE_NORMAL ) // "Normal" becomes "Default" style aStyleName = ScGlobal::GetRscString( STR_STYLENAME_STANDARD ); else if( nStyleId < STATIC_TABLE_SIZE( ppcStyleNames ) ) - aStyleName.Assign( maStyleNamePrefix ).AppendAscii( ppcStyleNames[ nStyleId ] ); + aStyleName.Assign( maStyleNamePrefix1 ).AppendAscii( ppcStyleNames[ nStyleId ] ); if( (nStyleId == EXC_STYLE_ROWLEVEL) || (nStyleId == EXC_STYLE_COLLEVEL) ) aStyleName.Append( String::CreateFromInt32( nLevel + 1 ) ); @@ -542,6 +543,11 @@ String XclTools::GetBuiltInStyleName( sal_uInt8 nStyleId, sal_uInt8 nLevel ) return aStyleName; } +String XclTools::GetBuiltInStyleName( const String& rStyleName ) +{ + return String( maStyleNamePrefix1 ).Append( rStyleName ); +} + bool XclTools::IsBuiltInStyleName( const String& rStyleName, sal_uInt8* pnStyleId, xub_StrLen* pnNextChar ) { // "Default" becomes "Normal" @@ -553,10 +559,15 @@ bool XclTools::IsBuiltInStyleName( const String& rStyleName, sal_uInt8* pnStyleI } // try the other built-in styles - xub_StrLen nPrefixLen = maStyleNamePrefix.Len(); sal_uInt8 nFoundId = 0; xub_StrLen nNextChar = 0; - if( rStyleName.EqualsIgnoreCaseAscii( maStyleNamePrefix, 0, nPrefixLen ) ) + + xub_StrLen nPrefixLen = 0; + if( rStyleName.EqualsIgnoreCaseAscii( maStyleNamePrefix1, 0, maStyleNamePrefix1.Len() ) ) + nPrefixLen = maStyleNamePrefix1.Len(); + else if( rStyleName.EqualsIgnoreCaseAscii( maStyleNamePrefix2, 0, maStyleNamePrefix2.Len() ) ) + nPrefixLen = maStyleNamePrefix2.Len(); + if( nPrefixLen > 0 ) { String aShortName; for( sal_uInt8 nId = 0; nId < STATIC_TABLE_SIZE( ppcStyleNames ); ++nId ) @@ -583,14 +594,14 @@ bool XclTools::IsBuiltInStyleName( const String& rStyleName, sal_uInt8* pnStyleI if( pnStyleId ) *pnStyleId = EXC_STYLE_USERDEF; if( pnNextChar ) *pnNextChar = 0; - return false; + return nPrefixLen > 0; // also return true for unknown built-in styles } bool XclTools::GetBuiltInStyleId( sal_uInt8& rnStyleId, sal_uInt8& rnLevel, const String& rStyleName ) { sal_uInt8 nStyleId; xub_StrLen nNextChar; - if( IsBuiltInStyleName( rStyleName, &nStyleId, &nNextChar ) ) + if( IsBuiltInStyleName( rStyleName, &nStyleId, &nNextChar ) && (nStyleId != EXC_STYLE_USERDEF) ) { if( (nStyleId == EXC_STYLE_ROWLEVEL) || (nStyleId == EXC_STYLE_COLLEVEL) ) { @@ -617,24 +628,25 @@ bool XclTools::GetBuiltInStyleId( sal_uInt8& rnStyleId, sal_uInt8& rnLevel, cons // conditional formatting style names ----------------------------------------- -const String XclTools::maCFStyleNamePrefix( RTL_CONSTASCII_USTRINGPARAM( "Excel_CondFormat_" ) ); +const String XclTools::maCFStyleNamePrefix1( RTL_CONSTASCII_USTRINGPARAM( "Excel_CondFormat_" ) ); +const String XclTools::maCFStyleNamePrefix2( RTL_CONSTASCII_USTRINGPARAM( "ConditionalStyle_" ) ); String XclTools::GetCondFormatStyleName( SCTAB nScTab, sal_Int32 nFormat, sal_uInt16 nCondition ) { - return String( maCFStyleNamePrefix ).Append( String::CreateFromInt32( nScTab + 1 ) ). + return String( maCFStyleNamePrefix1 ).Append( String::CreateFromInt32( nScTab + 1 ) ). Append( '_' ).Append( String::CreateFromInt32( nFormat + 1 ) ). Append( '_' ).Append( String::CreateFromInt32( nCondition + 1 ) ); } bool XclTools::IsCondFormatStyleName( const String& rStyleName, xub_StrLen* pnNextChar ) { - xub_StrLen nPrefixLen = maCFStyleNamePrefix.Len(); - if( rStyleName.EqualsIgnoreCaseAscii( maCFStyleNamePrefix, 0, nPrefixLen ) ) - { - if( pnNextChar ) *pnNextChar = nPrefixLen; - return true; - } - return false; + xub_StrLen nPrefixLen = 0; + if( rStyleName.EqualsIgnoreCaseAscii( maCFStyleNamePrefix1, 0, maCFStyleNamePrefix1.Len() ) ) + nPrefixLen = maCFStyleNamePrefix1.Len(); + else if( rStyleName.EqualsIgnoreCaseAscii( maCFStyleNamePrefix2, 0, maCFStyleNamePrefix2.Len() ) ) + nPrefixLen = maCFStyleNamePrefix2.Len(); + if( pnNextChar ) *pnNextChar = nPrefixLen; + return nPrefixLen > 0; } // stream handling ------------------------------------------------------------ diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index 98faeb9f03d4..2271a8f35d4d 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -160,13 +160,15 @@ Color ScfTools::GetMixedColor( const Color& rFore, const Color& rBack, sal_uInt8 // *** conversion of names *** ------------------------------------------------ +/* XXX As in sc/source/core/tool/rangenam.cxx ScRangeData::IsValidName() */ + void ScfTools::ConvertToScDefinedName( String& rName ) { xub_StrLen nLen = rName.Len(); - if( nLen && !ScCompiler::IsCharWordChar( rName, 0 ) ) + if( nLen && !ScCompiler::IsCharFlagAllConventions( rName, 0, SC_COMPILER_C_CHAR_NAME ) ) rName.SetChar( 0, '_' ); for( xub_StrLen nPos = 1; nPos < nLen; ++nPos ) - if( !ScCompiler::IsWordChar( rName, nPos ) ) + if( !ScCompiler::IsCharFlagAllConventions( rName, nPos, SC_COMPILER_C_NAME ) ) rName.SetChar( nPos, '_' ); } diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx index 44e02d075317..857d756e2133 100644 --- a/sc/source/filter/inc/xestream.hxx +++ b/sc/source/filter/inc/xestream.hxx @@ -333,7 +333,6 @@ public: // only needed for import; ignore virtual bool importDocument() throw(); - virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const; virtual oox::vml::Drawing* getVmlDrawing(); virtual const oox::drawingml::Theme* getCurrentTheme() const; virtual const oox::drawingml::table::TableStyleListPtr getTableStyles(); diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx index fe43aa75c331..2fe3a6ecbc15 100644 --- a/sc/source/filter/inc/xistyle.hxx +++ b/sc/source/filter/inc/xistyle.hxx @@ -397,15 +397,13 @@ public: /** Reads an XF record. */ void ReadXF( XclImpStream& rStrm ); - /** Sets the style name of this XF, if it is a style XF. - @descr Additionally creates this user-defined style in the Calc document. */ - void SetStyleName( const String& rStyleName ); - /** Sets the style name of this XF from a built-in Excel style, if it is a style XF. - @descr Does not create the style in the Calc document. This is done on demand - in CreatePattern(), if the style is really used. */ - void SetBuiltInStyleName( sal_uInt8 nStyleId, sal_uInt8 nLevel ); - + /** Sets the style name of this XF, if it is a style XF. */ + void SetStyleName( const String& rStyleName, bool bBuiltIn, bool bForceCreate ); + /** Changes the style name of this XF, if it is a style XF. */ + void ChangeStyleName( const String& rStyleName ); + /** Returns the style name of this XF, if it is a style XF. */ inline const String& GetStyleName() const { return maStyleName; } + inline sal_uInt8 GetHorAlign() const { return maAlignment.mnHorAlign; } inline sal_uInt8 GetVerAlign() const { return maAlignment.mnVerAlign; } inline sal_uInt16 GetFontIndex() const { return mnXclFont; } @@ -501,7 +499,15 @@ public: SCTAB nScTab, const XclImpXFIndex& rXFIndex ); private: + void CalcStyleName( XclImpXF& rXF, const String& rStyleName, bool bBuiltIn ); + void CalcStyleName( XclImpXF& rXF, sal_uInt8 nStyleId, sal_uInt8 nLevel ); + void SetStyleName( XclImpXF& rXF, const String& rStyleName, bool bBuiltIn, bool bForceCreate ); + +private: + typedef ::std::map< String, XclImpXF* > XclImpStyleXFMap; + ScfDelList< XclImpXF > maXFList; /// List of contents of all XF record. + XclImpStyleXFMap maStyleXFs; /// Maps style names to style XF records. }; // Buffer for XF indexes in cells ============================================= diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx index 9d02f0720efc..ebb22c2cb05f 100644 --- a/sc/source/filter/inc/xlstyle.hxx +++ b/sc/source/filter/inc/xlstyle.hxx @@ -242,6 +242,12 @@ const sal_uInt8 EXC_STYLE_USERDEF = 0xFF; /// No built-in styl const sal_uInt8 EXC_STYLE_LEVELCOUNT = 7; /// Number of outline level styles. const sal_uInt8 EXC_STYLE_NOLEVEL = 0xFF; /// Default value for unused level. +// (0x0892) STYLEEXT ---------------------------------------------------------- + +const sal_uInt16 EXC_ID_STYLEEXT = 0x0892; + +const sal_uInt8 EXC_STYLEEXT_BUILTIN = 0x01; + // Structs and classes ======================================================== // Color data ================================================================= diff --git a/sc/source/filter/inc/xltools.hxx b/sc/source/filter/inc/xltools.hxx index 459a5c9b3a78..d818fa9e0a89 100644 --- a/sc/source/filter/inc/xltools.hxx +++ b/sc/source/filter/inc/xltools.hxx @@ -197,6 +197,8 @@ public: @param nLevel The zero-based outline level for RowLevel and ColLevel styles. @return The style name or an empty string, if the parameters are not valid. */ static String GetBuiltInStyleName( sal_uInt8 nStyleId, sal_uInt8 nLevel ); + /** Returns the passed style name with a special built-in prefix. */ + static String GetBuiltInStyleName( const String& rStyleName ); /** Returns true, if the passed string is a name of an Excel built-in style. @param pnStyleId If not 0, the found style identifier will be returned here. @param pnNextChar If not 0, the index of the char after the evaluated substring will be returned here. */ @@ -230,8 +232,10 @@ public: // ------------------------------------------------------------------------ private: static const String maDefNamePrefix; /// Prefix for built-in defined names. - static const String maStyleNamePrefix; /// Prefix for built-in cell style names. - static const String maCFStyleNamePrefix; /// Prefix for cond. formatting style names. + static const String maStyleNamePrefix1; /// Prefix for built-in cell style names. + static const String maStyleNamePrefix2; /// Prefix for built-in cell style names from OOX filter. + static const String maCFStyleNamePrefix1; /// Prefix for cond. formatting style names. + static const String maCFStyleNamePrefix2; /// Prefix for cond. formatting style names from OOX filter. }; // read/write colors ---------------------------------------------------------- diff --git a/sc/source/filter/xml/XMLDDELinksContext.cxx b/sc/source/filter/xml/XMLDDELinksContext.cxx index c0872ae07668..ce77178500bb 100644 --- a/sc/source/filter/xml/XMLDDELinksContext.cxx +++ b/sc/source/filter/xml/XMLDDELinksContext.cxx @@ -163,9 +163,20 @@ void ScXMLDDELinkContext::EndElement() { if (nPosition > -1 && nColumns && nRows && GetScImport().GetDocument()) { + bool bSizeMatch = (static_cast(nColumns * nRows) == aDDELinkTable.size()); + DBG_ASSERT( bSizeMatch, "ScXMLDDELinkContext::EndElement: matrix dimension doesn't match cells count"); + // Excel writes bad ODF in that it does not write the + // table:number-columns-repeated attribute of the + // element, but apparently uses the number of + // elements within a element to + // determine the column count instead. Be lenient ... + if (!bSizeMatch && nColumns == 1) + { + nColumns = aDDELinkTable.size() / nRows; + DBG_ASSERT( static_cast(nColumns * nRows) == aDDELinkTable.size(), + "ScXMLDDELinkContext::EndElement: adapted matrix dimension doesn't match either"); + } ScMatrixRef pMatrix = new ScMatrix( static_cast(nColumns), static_cast(nRows) ); - - DBG_ASSERT(static_cast(nColumns * nRows) == aDDELinkTable.size(), "there is a wrong cells count"); sal_Int32 nCol(0); sal_Int32 nRow(-1); sal_Int32 nIndex(0); diff --git a/sc/source/filter/xml/XMLTableShapeResizer.cxx b/sc/source/filter/xml/XMLTableShapeResizer.cxx index 88c5fbf248b1..ca6d23a6459a 100644 --- a/sc/source/filter/xml/XMLTableShapeResizer.cxx +++ b/sc/source/filter/xml/XMLTableShapeResizer.cxx @@ -106,6 +106,12 @@ void ScMyShapeResizer::CreateChartListener(ScDocument* pDoc, //otherwise the charts keep their first visual representation which was created at a moment where the calc itself was not loaded completly and is incorect therefor if( (rImport.getImportFlags() & IMPORT_ALL) == IMPORT_ALL ) pCL->SetDirty( TRUE ); + else + { + // #i104899# If a formula cell is already dirty, further changes aren't propagated. + // This can happen easily now that row heights aren't updated for all sheets. + pDoc->InterpretDirtyCells( *pCL->GetRangeList() ); + } pCollection->Insert( pCL ); pCL->StartListeningTo(); diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index a35a426e4831..df7e99955bfd 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3902,7 +3902,7 @@ void ScXMLExport::WriteExternalRefCaches() return; ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager(); - pRefMgr->resetSrcFileData(); + pRefMgr->resetSrcFileData(GetOrigFileName()); sal_uInt16 nCount = pRefMgr->getExternalFileCount(); for (sal_uInt16 nFileId = 0; nFileId < nCount; ++nFileId) { diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx index 7eabdff07b9b..b53431843a57 100644 --- a/sc/source/filter/xml/xmlexternaltabi.cxx +++ b/sc/source/filter/xml/xmlexternaltabi.cxx @@ -100,6 +100,32 @@ SvXMLImportContext* ScXMLExternalRefTabSourceContext::CreateChildContext( return new SvXMLImportContext(GetImport(), nPrefix, rLocalName); } +/** + * Make sure the URL is a valid relative URL, mainly to avoid storing + * absolute URL as relative URL by accident. For now, we only check the first + * three characters which are assumed to be always '../', because the relative + * URL for an external document is always in reference to the content.xml + * fragment of the original document. + */ +static bool lcl_isValidRelativeURL(const OUString& rUrl) +{ + sal_Int32 n = ::std::min( rUrl.getLength(), static_cast(3)); + if (n < 3) + return false; + const sal_Unicode* p = rUrl.getStr(); + for (sal_Int32 i = 0; i < n; ++i) + { + sal_Unicode c = p[i]; + if (i < 2 && c != '.') + // the path must begin with '..' + return false; + else if (i == 2 && c != '/') + // a '/' path separator must follow + return false; + } + return true; +} + void ScXMLExternalRefTabSourceContext::EndElement() { ScDocument* pDoc = mrScImport.GetDocument(); @@ -107,7 +133,7 @@ void ScXMLExternalRefTabSourceContext::EndElement() return; ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager(); - if (!maRelativeUrl.equals(mrExternalRefInfo.maFileUrl)) + if (lcl_isValidRelativeURL(maRelativeUrl)) pRefMgr->setRelativeFileName(mrExternalRefInfo.mnFileId, maRelativeUrl); pRefMgr->setFilterData(mrExternalRefInfo.mnFileId, maFilterName, maFilterOptions); } diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 608c1c688ea9..5df8db46bd13 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2016,7 +2016,7 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, nScenarioCount ++; pDoc->CopyToDocument( nUndoStartX, nUndoStartY, i, nUndoEndX, nUndoEndY, i+nScenarioCount, - IDF_ALL, FALSE, pUndoDoc ); + IDF_ALL | IDF_NOCAPTIONS, FALSE, pUndoDoc ); } } diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 9cc0b274028e..5cfc833be5dd 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -950,9 +950,18 @@ ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nF ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew, size_t* pnIndex) { + // In API, the index is transported as cached sheet ID of type sal_Int32 in + // sheet::SingleReference.Sheet or sheet::ComplexReference.Reference1.Sheet + // in a sheet::FormulaToken, choose a sensible value for N/A. Effectively + // being 0xffffffff + const size_t nNotAvailable = static_cast( static_cast( -1)); + DocItem* pDoc = getDocItem(nFileId); if (!pDoc) + { + if (pnIndex) *pnIndex = nNotAvailable; return TableTypeRef(); + } DocItem& rDoc = *pDoc; @@ -966,7 +975,10 @@ ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nF } if (!bCreateNew) + { + if (pnIndex) *pnIndex = nNotAvailable; return TableTypeRef(); + } // Specified table doesn't exist yet. Create one. nIndex = rDoc.maTables.size(); @@ -1045,7 +1057,7 @@ void ScExternalRefLink::DataChanged(const String& /*rMimeType*/, const Any& /*rV else { // The source document has changed. - pMgr->switchSrcFile(mnFileId, aFile); + pMgr->switchSrcFile(mnFileId, aFile, aFilter); maFilterName = aFilter; } } @@ -1891,24 +1903,17 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri if (!pFileData) return NULL; + // Always load the document by using the path created from the relative + // path. If the referenced document is not there, simply exit. The + // original file name should be used only when the relative path is not + // given. String aFile = pFileData->maFileName; - if (!isFileLoadable(aFile)) - { - // The original file path is not loadable. Try the relative path. - // Note that the path is relative to the content.xml substream which - // is one-level higher than the file itself. + maybeCreateRealFileName(nFileId); + if (pFileData->maRealFileName.Len()) + aFile = pFileData->maRealFileName; - if (!pFileData->maRelativeName.Len()) - return NULL; - - INetURLObject aBaseURL(getOwnDocumentName()); - aBaseURL.insertName(OUString::createFromAscii("content.xml")); - bool bWasAbs = false; - aFile = aBaseURL.smartRel2Abs(pFileData->maRelativeName, bWasAbs).GetMainURL(INetURLObject::NO_DECODE); - if (!isFileLoadable(aFile)) - // Ok, I've tried both paths but no success. Bail out. - return NULL; - } + if (!isFileLoadable(aFile)) + return NULL; String aOptions; ScDocumentLoader::GetFilterName(aFile, rFilter, aOptions, true, false); @@ -1960,6 +1965,9 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri bool ScExternalRefManager::isFileLoadable(const String& rFile) const { + if (!rFile.Len()) + return false; + if (isOwnDocument(rFile)) return false; @@ -1994,6 +2002,32 @@ void ScExternalRefManager::maybeLinkExternalFile(sal_uInt16 nFileId) maLinkedDocs.insert(LinkedDocMap::value_type(nFileId, true)); } +void ScExternalRefManager::SrcFileData::maybeCreateRealFileName(const String& rOwnDocName) +{ + if (!maRelativeName.Len()) + // No relative path given. Nothing to do. + return; + + if (maRealFileName.Len()) + // Real file name already created. Nothing to do. + return; + + // Formulate the absolute file path from the relative path. + const String& rRelPath = maRelativeName; + INetURLObject aBaseURL(rOwnDocName); + aBaseURL.insertName(OUString::createFromAscii("content.xml")); + bool bWasAbs = false; + maRealFileName = aBaseURL.smartRel2Abs(rRelPath, bWasAbs).GetMainURL(INetURLObject::NO_DECODE); +} + +void ScExternalRefManager::maybeCreateRealFileName(sal_uInt16 nFileId) +{ + if (nFileId >= maSrcFiles.size()) + return; + + maSrcFiles[nFileId].maybeCreateRealFileName(getOwnDocumentName()); +} + bool ScExternalRefManager::compileTokensByCell(const ScAddress& rCell) { ScBaseCell* pCell; @@ -2064,12 +2098,20 @@ sal_uInt16 ScExternalRefManager::getExternalFileId(const String& rFile) return static_cast(maSrcFiles.size() - 1); } -const String* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId) const +const String* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal) { if (nFileId >= maSrcFiles.size()) return NULL; - return &maSrcFiles[nFileId].maFileName; + if (bForceOriginal) + return &maSrcFiles[nFileId].maFileName; + + maybeCreateRealFileName(nFileId); + + if (maSrcFiles[nFileId].maRealFileName.Len()) + return &maSrcFiles[nFileId].maRealFileName; + else + return &maSrcFiles[nFileId].maFileName; } bool ScExternalRefManager::hasExternalFile(sal_uInt16 nFileId) const @@ -2138,10 +2180,17 @@ void ScExternalRefManager::breakLink(sal_uInt16 nFileId) notifyAllLinkListeners(nFileId, LINK_BROKEN); } -void ScExternalRefManager::switchSrcFile(sal_uInt16 nFileId, const String& rNewFile) +void ScExternalRefManager::switchSrcFile(sal_uInt16 nFileId, const String& rNewFile, const String& rNewFilter) { maSrcFiles[nFileId].maFileName = rNewFile; maSrcFiles[nFileId].maRelativeName.Erase(); + maSrcFiles[nFileId].maRealFileName.Erase(); + if (!maSrcFiles[nFileId].maFilterName.Equals(rNewFilter)) + { + // Filter type has changed. + maSrcFiles[nFileId].maFilterName = rNewFilter; + maSrcFiles[nFileId].maFilterOptions.Erase(); + } refreshNames(nFileId); } @@ -2175,19 +2224,18 @@ bool ScExternalRefManager::hasExternalData() const return !maSrcFiles.empty(); } -void ScExternalRefManager::resetSrcFileData() +void ScExternalRefManager::resetSrcFileData(const String& rBaseFileUrl) { - INetURLObject aBaseURL(getOwnDocumentName()); - aBaseURL.insertName(OUString::createFromAscii("content.xml")); - String aBaseUrlStr = aBaseURL.GetMainURL(INetURLObject::NO_DECODE); for (vector::iterator itr = maSrcFiles.begin(), itrEnd = maSrcFiles.end(); itr != itrEnd; ++itr) { - if (!itr->maRelativeName.Len()) - { - itr->maRelativeName = URIHelper::simpleNormalizedMakeRelative( - aBaseUrlStr, itr->maFileName); - } + // Re-generate relative file name from the absolute file name. + String aAbsName = itr->maRealFileName; + if (!aAbsName.Len()) + aAbsName = itr->maFileName; + + itr->maRelativeName = URIHelper::simpleNormalizedMakeRelative( + rBaseFileUrl, aAbsName); } } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index d63fbb837e44..bdf5317da1bc 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -500,6 +500,10 @@ void Chart2Positioner::glueState() ScRefTokenHelper::getDoubleRefDataFromToken(aData, *itr); SCCOLROW n1 = aData.Ref1.nCol; SCCOLROW n2 = aData.Ref2.nCol; + if (n1 > MAXCOL) + n1 = MAXCOL; + if (n2 > MAXCOL) + n2 = MAXCOL; SCCOLROW nTmp = n2 - n1 + 1; if (n1 < mnStartCol) mnStartCol = static_cast(n1); @@ -510,14 +514,18 @@ void Chart2Positioner::glueState() n1 = aData.Ref1.nRow; n2 = aData.Ref2.nRow; + if (n1 > MAXROW) + n1 = MAXROW; + if (n2 > MAXROW) + n2 = MAXROW; nTmp = n2 - n1 + 1; if (n1 < mnStartRow) - mnStartRow = static_cast(n1); + mnStartRow = static_cast(n1); if (n2 > nEndRow) - nEndRow = static_cast(n2); + nEndRow = static_cast(n2); if (nTmp > nMaxRows) - nMaxRows = static_cast(nTmp); + nMaxRows = static_cast(nTmp); } // total column size ? -- cgit From 87f6d77a00006f49cb32a8b0e43d0dcd542cb567 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 17 Sep 2009 11:26:03 +0000 Subject: CWS-TOOLING: integrate CWS defaultdoclang 2009-08-21 14:44:21 +0200 cmc r275260 : CWS-TOOLING: rebase CWS defaultdoclang to trunk@275001 (milestone: DEV300:m55) 2009-08-10 17:43:32 +0200 cmc r274833 : CWS-TOOLING: rebase CWS defaultdoclang to trunk@274622 (milestone: DEV300:m54) 2009-07-24 11:46:58 +0200 cmc r274297 : CWS-TOOLING: rebase CWS defaultdoclang to trunk@274203 (milestone: DEV300:m53) 2009-07-10 12:22:16 +0200 cmc r273884 : #i99577# tweak the widths a bit 2009-07-08 15:17:58 +0200 cmc r273834 : #i99577 tidy up indentation 2009-07-04 16:09:18 +0200 cmc r273721 : #i99577# a "default" document language that reflects what the locale language is --- chart2/source/tools/CharacterProperties.cxx | 15 +++++++++++---- sc/source/ui/app/scmod2.cxx | 9 +++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/chart2/source/tools/CharacterProperties.cxx b/chart2/source/tools/CharacterProperties.cxx index e9893bae0a89..4f558b35df0a 100644 --- a/chart2/source/tools/CharacterProperties.cxx +++ b/chart2/source/tools/CharacterProperties.cxx @@ -51,9 +51,11 @@ #include #include #include +#include #include + // header for struct SvtLinguConfig #ifndef _SVTOOLS_LINGUCFG_HXX_ #include @@ -478,16 +480,21 @@ void CharacterProperties::AddDefaultsToMap( const float fDefaultFontHeight = 13.0; SvtLinguConfig aLinguConfig; - lang::Locale aDefaultLocale( C2U( "en" ), C2U( "US" ), OUString() ); + lang::Locale aDefaultLocale; aLinguConfig.GetProperty(C2U("DefaultLocale")) >>= aDefaultLocale; lang::Locale aDefaultLocale_CJK; aLinguConfig.GetProperty(C2U("DefaultLocale_CJK")) >>= aDefaultLocale_CJK; lang::Locale aDefaultLocale_CTL; aLinguConfig.GetProperty(C2U("DefaultLocale_CTL")) >>= aDefaultLocale_CTL; - Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, MsLangId::convertLocaleToLanguage( aDefaultLocale ), DEFAULTFONT_FLAGS_ONLYONE, 0 ); - Font aFontCJK = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, MsLangId::convertLocaleToLanguage( aDefaultLocale_CJK ), DEFAULTFONT_FLAGS_ONLYONE, 0 ); - Font aFontCTL = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, MsLangId::convertLocaleToLanguage( aDefaultLocale_CTL ), DEFAULTFONT_FLAGS_ONLYONE, 0 ); + using namespace ::com::sun::star::i18n::ScriptType; + LanguageType nLang; + nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aDefaultLocale), LATIN); + Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 ); + nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage( aDefaultLocale_CJK), ASIAN); + Font aFontCJK = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 ); + nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage( aDefaultLocale_CTL), COMPLEX); + Font aFontCTL = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, nLang, DEFAULTFONT_FLAGS_ONLYONE, 0 ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_NAME, OUString( aFont.GetName() ) ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CHAR_FONT_STYLE_NAME, OUString(aFont.GetStyleName()) ); diff --git a/sc/source/ui/app/scmod2.cxx b/sc/source/ui/app/scmod2.cxx index 2424b62c5414..4001ebe62036 100644 --- a/sc/source/ui/app/scmod2.cxx +++ b/sc/source/ui/app/scmod2.cxx @@ -37,7 +37,8 @@ #include #include - +#include +#include #include #include @@ -62,9 +63,9 @@ void ScModule::GetSpellSettings( USHORT& rDefLang, USHORT& rCjkLang, USHORT& rCt SvtLinguOptions aOptions; aConfig.GetOptions( aOptions ); - rDefLang = aOptions.nDefaultLanguage; - rCjkLang = aOptions.nDefaultLanguage_CJK; - rCtlLang = aOptions.nDefaultLanguage_CTL; + rDefLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN); + rCjkLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN); + rCtlLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX); rAutoSpell = aOptions.bIsSpellAuto; } -- cgit From bb14b9817dff8de46359ab8a1deb0f82692a7fcf Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Thu, 17 Sep 2009 13:53:54 +0000 Subject: CWS-TOOLING: integrate CWS encsig09 2009-09-14 15:11:29 +0200 oc r276125 : #i105049# MacroSignatur needs Macro 2009-09-09 17:09:46 +0200 jl r276005 : #i103989# could not signe encrypted doc containing a formular object 2009-09-09 13:11:24 +0200 jl r275985 : #i103989# could not signe encrypted doc containing a formular object 2009-09-08 15:54:02 +0200 mav r275934 : #i103906# fix the automation test scenario ( tempfile should be writable for the user ) 2009-09-07 14:01:39 +0200 mav r275895 : #i103906# fix the problem with reload 2009-09-07 09:34:48 +0200 mav r275871 : #i104786# do the ODF version check only for ODF documents 2009-09-07 08:19:06 +0200 mav r275870 : #i104389# fix text 2009-09-06 22:24:21 +0200 mav r275867 : #i104786# check the consistency of ODF version 2009-09-06 22:23:24 +0200 mav r275866 : #i104786# check the consistency of ODF version 2009-09-06 22:23:00 +0200 mav r275865 : #i104786# check the consistency of ODF version 2009-09-06 22:22:36 +0200 mav r275864 : #i104786# check the consistency of ODF version 2009-09-06 22:22:03 +0200 mav r275863 : #i104786# check the consistency of ODF version 2009-09-02 17:09:30 +0200 mav r275722 : #i104715# let repairing mechanics use the streams correctly 2009-09-01 16:52:49 +0200 mav r275670 : #i104389# notify user not to trust the corrupted document 2009-09-01 16:31:37 +0200 mav r275668 : #i104389# use vnd.sun.star.zip: protocol to access zip files 2009-09-01 16:30:32 +0200 mav r275667 : #i104389# use vnd.sun.star.zip: protocol to access zip files 2009-09-01 16:22:13 +0200 jl r275666 : #i104339# small content change 2009-09-01 14:20:42 +0200 jl r275660 : #i103519# remove some debug output 2009-09-01 13:51:52 +0200 jl r275659 : #i103519# NSS uses '\' for escaping in distinguished names 2009-09-01 12:49:47 +0200 mav r275655 : #i104389# use zip-mode to read from jar files 2009-09-01 12:40:22 +0200 mav r275653 : #i104389# use zip-mode to read from jar files 2009-09-01 12:32:29 +0200 mav r275652 : #i104389# use constants 2009-08-31 21:58:00 +0200 mav r275637 : #i10000# fix warning 2009-08-31 21:11:17 +0200 mav r275636 : #i104227# adding of scripting signature removes the document signature 2009-08-31 20:55:05 +0200 mav r275635 : #i103905# ZipStorage supports Compressed property 2009-08-31 20:53:55 +0200 mav r275634 : #i103905# adjust macro signature transfer to usage of ZipStorage 2009-08-31 15:30:49 +0200 jl r275609 : #i103989# warning is shown as long the user does not click 'OK' 2009-08-31 14:36:10 +0200 jl r275608 : #i103989# changed warning text when signing macro and there is a document signature. This warning is only displayed once 2009-08-31 13:34:41 +0200 mav r275603 : #i104452# disable macros in repaired documents 2009-08-31 13:33:42 +0200 mav r275602 : #i104452# disable macros in repaired documents 2009-08-31 13:03:56 +0200 jl r275600 : #i45212# signature dialog could not be started when using read-only documents 2009-08-31 09:26:13 +0200 mav r275583 : #i104578# store the additional entry as the last one to workaround parsing problem in OOo3.1 and later 2009-08-30 20:54:25 +0200 mav r275562 : #i10000# adopt for unix 2009-08-30 10:56:00 +0200 mav r275561 : CWS-TOOLING: rebase CWS encsig09 to trunk@275331 (milestone: DEV300:m56) 2009-08-28 16:34:00 +0200 mav r275539 : #i104578# write necessary info in manifest.xml for ODF1.2 encrypted document 2009-08-28 14:04:22 +0200 mav r275533 : #104587# fix handling of readonly streams 2009-08-28 13:58:10 +0200 mav r275531 : #i104389# fix the broken document handling 2009-08-28 11:40:39 +0200 mav r275522 : #i104389# fix the signature streams check 2009-08-27 21:48:12 +0200 mav r275509 : #i103927# show the warning 2009-08-27 21:47:48 +0200 mav r275508 : #i103927# show the warning 2009-08-27 16:45:59 +0200 jl r275495 : #i45212# remove unused variable 2009-08-27 16:34:00 +0200 jl r275494 : #i103989# 2009-08-27 13:54:28 +0200 jl r275482 : #i103519# fixed replacement of 'S' by 'ST' 2009-08-27 12:32:21 +0200 mav r275472 : #i10000# fix warning 2009-08-27 11:58:11 +0200 mav r275467 : #i104389# handle the entry path correctly 2009-08-26 17:18:35 +0200 jl r275438 : #i103519# subject and issuer distinguished names were not properly displayed. The strings were obtained by system functions (Windows, NSS), which use quotes to escape the values, when they contain special characters 2009-08-26 11:00:20 +0200 mav r275403 : #i10000# fix warnings 2009-08-26 08:25:45 +0200 mav r275392 : #i10000# fix warning 2009-08-26 08:02:22 +0200 mav r275391 : #i10000# adopt for linux 2009-08-26 07:40:30 +0200 mav r275390 : #i10000# fix warning 2009-08-26 07:35:28 +0200 mav r275389 : #i10000# use correct include file name 2009-08-25 15:01:41 +0200 jl r275356 : #i103989# better check for mimetype of streams 2009-08-25 09:07:09 +0200 mav r275335 : CWS-TOOLING: rebase CWS encsig09 to trunk@274622 (milestone: DEV300:m54) 2009-08-24 18:17:02 +0200 mav r275329 : #i103927# check the nonencrypted streams 2009-08-24 18:14:14 +0200 mav r275328 : #i103927# check the nonencrypted streams 2009-08-24 17:59:34 +0200 mav r275327 : #i103927#,#i104389# check the package consistency and nonencrypted streams 2009-08-24 16:18:28 +0200 jl r275323 : #i103989# added comment 2009-08-24 13:08:47 +0200 jl r275305 : #i45212# #i66276# only write the X509Certificate element once and allow to add remove several certificates at a time 2009-08-21 12:57:28 +0200 ufi r275239 : 104339 2009-08-21 08:39:05 +0200 jl r275213 : #i10398# comparing URIs of signed files with the 'element list' 2009-08-20 13:39:47 +0200 jl r275178 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 13:35:39 +0200 jl r275177 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 13:29:06 +0200 jl r275176 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 13:26:21 +0200 jl r275175 : #i10398# displaying 'new partially signed' status in the status bar 2009-08-20 12:05:09 +0200 ufi r275170 : i104339 2009-08-19 12:24:54 +0200 jl r275146 : #i10398# displaying 'old signature' icon and status in signature dialog 2009-08-18 15:18:48 +0200 jl r275111 : #i103989# document signatures containing manifest.xml are now validated according to the final ODF1.2 spec 2009-08-18 11:41:06 +0200 mav r275087 : #i103927# detect if encrypted ODF1.2 document contains nonencrypted streams 2009-08-18 11:35:13 +0200 mav r275085 : #i103927# detect if encrypted ODF1.2 document contains nonencrypted streams 2009-08-14 17:32:41 +0200 jl r274999 : #i103989# using c14n tranformation for XML streams 2009-08-14 15:27:43 +0200 jl r274987 : #i103989# remove special handling for encrypted document streams in UriBindingHelper::OpenInputStream, since we use zip storage this is not necessary anymore 2009-08-14 15:08:10 +0200 jl r274983 : #i103989# Showing a message when adding or removing a macro signature, that the document signature will be removed 2009-08-14 14:57:27 +0200 jl r274982 : #i103989# accesing Sequence at invalid index 2009-08-11 08:55:02 +0200 mav r274846 : #i103905# let signing service know if there is already a valid document signature 2009-08-10 11:33:37 +0200 jl r274799 : #i103905# do not truncate the stream 2009-08-10 10:43:47 +0200 mav r274797 : #i103905# provide the storage version 2009-08-07 16:58:46 +0200 jl r274780 : #i103989# 2009-08-07 16:56:19 +0200 jl r274779 : #i103989# using odf version string etc. 2009-08-07 15:20:53 +0200 mav r274771 : #i103905# provide the storage version 2009-08-07 15:19:12 +0200 mav r274770 : #i103905# provide the storage version 2009-08-07 12:41:45 +0200 mav r274758 : #103930# do not store thumbnail in case of encrypted document 2009-08-07 12:36:52 +0200 mav r274757 : #i103905# provide the storage version 2009-08-07 12:15:54 +0200 mav r274754 : #i103760# the signed state is not lost on saving 2009-08-07 12:06:19 +0200 mav r274753 : #i103760# avoid warning regarding signature removal on export 2009-08-07 12:06:01 +0200 mav r274752 : #i103760# avoid warning regarding signature removal on export 2009-08-06 08:47:34 +0200 mav r274703 : #i103905# allow to transport ODF version to the signing component 2009-08-05 21:34:42 +0200 mav r274701 : #i103905# allow to transport ODF version to the signing component 2009-08-05 15:48:17 +0200 mav r274683 : #i103905# allow to transport ODF version to the signing component 2009-08-05 14:58:12 +0200 jl r274673 : #i103989# documentsignature now signes all streams except documentsignatures.xml, all streams are processed as binary files 2009-08-05 12:00:32 +0200 mav r274648 : #i103905# allow to transport ODF version to the signing component 2009-08-04 10:57:04 +0200 jl r274612 : #i103989# added XInitialization 2009-07-31 10:32:27 +0200 mav r274516 : #i103905# use zip storage to sign documents 2009-07-30 14:01:33 +0200 mav r274489 : #i103906# optimize the usage of temporary medium 2009-07-30 14:00:28 +0200 mav r274488 : #i103906# optimize the usage of temporary medium 2009-07-30 13:59:09 +0200 mav r274487 : #i103906# optimize the usage of temporary medium 2009-07-30 13:50:44 +0200 mav r274485 : #i103906# optimize the usage of temporary medium 2009-07-30 13:49:53 +0200 mav r274484 : #i103906# optimize the usage of temporary medium 2009-07-30 13:49:13 +0200 mav r274483 : #i103906# optimize the usage of temporary medium 2009-07-30 13:47:09 +0200 mav r274482 : #i103905#,#i103906# let the signing process use zip-storage; optimize the usage of temporary medium 2009-07-21 09:10:31 +0200 mav r274159 : CWS-TOOLING: rebase CWS encsig09 to trunk@273468 (milestone: DEV300:m51) 2009-05-05 08:39:01 +0200 mav r271496 : #i100832# allow to sign macros only when there are any --- sc/source/filter/xml/xmlwrap.cxx | 24 ++++++++++++++++++++++-- sc/source/ui/unoobj/scdetect.cxx | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index dbf672993310..7bc5396fcb5b 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -265,7 +265,24 @@ sal_uInt32 ScXMLImportWrapper::ImportFromComponent(uno::Reference>= aTmp ) + aSaxEx = aTmp; + else + bTryChild = sal_False; + } + + packages::zip::ZipIOException aBrokenPackage; + if ( aSaxEx.WrappedException >>= aBrokenPackage ) + return ERRCODE_IO_BROKENPACKAGE; + else if( bEncrypted ) nReturn = ERRCODE_SFX_WRONGPASSWORD; else { @@ -298,7 +315,10 @@ sal_uInt32 ScXMLImportWrapper::ImportFromComponent(uno::Reference>= aBrokenPackage ) + return ERRCODE_IO_BROKENPACKAGE; + else if( bEncrypted ) nReturn = ERRCODE_SFX_WRONGPASSWORD; else { diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx index 1b17c2e130ac..6ed8181091ac 100644 --- a/sc/source/ui/unoobj/scdetect.cxx +++ b/sc/source/ui/unoobj/scdetect.cxx @@ -350,7 +350,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter ) // maybe that IsStorage() already created an error! if ( bIsStorage ) { - uno::Reference < embed::XStorage > xStorage(aMedium.GetStorage()); + uno::Reference < embed::XStorage > xStorage(aMedium.GetStorage( sal_False )); if ( aMedium.GetLastStorageCreationState() != ERRCODE_NONE ) { // error during storage creation means _here_ that the medium -- cgit From b1ed9193bc94e84d0880b54df3df6442599f44ec Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Fri, 18 Sep 2009 10:15:03 +0000 Subject: CWS-TOOLING: integrate CWS mba32issues02 2009-09-17 mb93783 merge commit 2009-09-03 tb121644 #i104748 - slot unification to .uno:PasteSpecial 2009-09-01 mba #101455#: code simplification 2009-08-31 mb93783 iso locales for norwegian builds are nb and nn, not no 2009-08-25 mba merge to m55 2009-07-29 mba cleanup after rebase 2009-07-29 mba #i103200#: wrong order of first and last name in CJK UI 2009-07-27 mba adding dictionary changes from broken svn CWS 2009-07-27 mba adding dictionary changes from broken svn CWS 2009-07-27 mba apply patch from broken svn CWS --- sc/inc/sc.hrc | 7 --- sc/sdi/cellsh.sdi | 5 +- sc/sdi/drtxtob.sdi | 2 +- sc/sdi/editsh.sdi | 2 +- sc/sdi/makefile.mk | 3 +- sc/sdi/scalc.sdi | 100 ------------------------------------- sc/source/ui/docshell/docsh3.cxx | 4 ++ sc/source/ui/drawfunc/drtxtob.cxx | 6 +-- sc/source/ui/drawfunc/drtxtob2.cxx | 2 +- sc/source/ui/src/hdrcont.src | 8 +-- sc/source/ui/src/popup.src | 4 +- sc/source/ui/view/cellsh.cxx | 6 +-- sc/source/ui/view/cellsh1.cxx | 39 +-------------- sc/source/ui/view/editsh.cxx | 6 +-- sc/source/ui/view/tabview3.cxx | 2 +- 15 files changed, 27 insertions(+), 169 deletions(-) diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 8fb6b929337b..375eebe30964 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -675,7 +675,6 @@ #define FILE_MENU_END (SC_FUNCTION_START + 20) #define EDIT_MENU_START (FILE_MENU_END) -#define FID_PASTE_CONTENTS (EDIT_MENU_START) #define FID_DELETE_CELLCONTENTS (EDIT_MENU_START + 1) #define FID_DELETE_CELL (EDIT_MENU_START + 2) #define FID_DELETE_TABLE (EDIT_MENU_START + 3) @@ -856,8 +855,6 @@ #define RID_INPUTBAR_END (RID_INPUTBAR_START+1) #define DRAW_BAR_START (RID_INPUTBAR_END) -//! SID_OBJECT_MIRROR wird sicher mal allgemein -#define SID_OBJECT_MIRROR (DRAW_BAR_START) #define SID_DRAWTOABOVE (DRAW_BAR_START+15) #define SID_DRAWTOBELOW (DRAW_BAR_START+16) //#define SID_GROUP (DRAW_BAR_START+17) @@ -1106,10 +1103,6 @@ #define SID_DELETE_SCENARIO (SID_NEW_SLOTS+95) #define SID_EDIT_SCENARIO (SID_NEW_SLOTS+96) -#define SID_GET_CLPBRD_FORMAT_COUNT (SID_NEW_SLOTS+97) -#define SID_GET_CLPBRD_FORMAT_BY_IDX (SID_NEW_SLOTS+98) -#define SID_GET_CLPBRD_FORMAT_NAME (SID_NEW_SLOTS+99) - // idl Parameter --------------------------------------------------------- //aus sfx: #define FN_PARAM_1 (SC_PARAM_START) diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 7f97a8a0161e..8b6d488baee6 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -153,11 +153,8 @@ interface CellSelection SID_CUT [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_COPY [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_PASTE [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] - FID_PASTE_CONTENTS [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] + SID_PASTE_SPECIAL [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = ExecuteEdit; StateMethod = GetClipState; ] - SID_GET_CLPBRD_FORMAT_COUNT [ ExecMethod = ExecuteEdit; ] - SID_GET_CLPBRD_FORMAT_BY_IDX [ ExecMethod = ExecuteEdit; ] - SID_GET_CLPBRD_FORMAT_NAME [ ExecMethod = ExecuteEdit; ] SID_EXTERNAL_SOURCE [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] FID_MERGE_ON [ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_OFF [ ExecMethod = Execute; StateMethod = GetState; ] diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi index 0d226895af4a..34d850bed6c2 100644 --- a/sc/sdi/drtxtob.sdi +++ b/sc/sdi/drtxtob.sdi @@ -61,7 +61,7 @@ interface TableDrawText SID_CUT [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_COPY [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_PASTE [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ] - FID_PASTE_CONTENTS [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ] + SID_PASTE_SPECIAL [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ] SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ] SID_SELECTALL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_CHARMAP [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] diff --git a/sc/sdi/editsh.sdi b/sc/sdi/editsh.sdi index c8ad37208744..da5ca92c0f1a 100644 --- a/sc/sdi/editsh.sdi +++ b/sc/sdi/editsh.sdi @@ -44,7 +44,7 @@ interface TableText SID_CUT [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_COPY [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_PASTE [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ] - FID_PASTE_CONTENTS [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ] + SID_PASTE_SPECIAL [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ] SID_CLIPBOARD_FORMAT_ITEMS [ ExecMethod = Execute; StateMethod = GetClipState; Export = FALSE; ] SID_SELECTALL [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] SID_CHARMAP [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ] diff --git a/sc/sdi/makefile.mk b/sc/sdi/makefile.mk index 57fb3b7956e1..f0f7d12885d8 100644 --- a/sc/sdi/makefile.mk +++ b/sc/sdi/makefile.mk @@ -66,7 +66,8 @@ SVSDI1DEPEND= \ mediash.sdi \ pgbrksh.sdi \ scslots.hrc \ - $(INC)$/sc.hrc + $(INC)$/sc.hrc \ + $(SOLARINCXDIR)$/svxslots.ilb .ENDIF # --- Targets ------------------------------------------------------- diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 0be7ed5df204..8ed57a8dfc5d 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -2704,81 +2704,6 @@ SfxVoidItem FunctionDialog SID_OPENDLG_FUNCTION GroupId = GID_INSERT; ] -//-------------------------------------------------------------------------- -SfxUInt32Item GetClipboardFormat SID_GET_CLPBRD_FORMAT_BY_IDX -(SfxUInt16Item Index SID_GET_CLPBRD_FORMAT_BY_IDX) -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Volatile, - FastCall = TRUE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- -SfxUInt16Item GetClipboardFormatCount SID_GET_CLPBRD_FORMAT_COUNT -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Volatile, - FastCall = TRUE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- -SfxStringItem GetClipboardFormatName SID_GET_CLPBRD_FORMAT_NAME -(SfxUInt32Item Format SID_GET_CLPBRD_FORMAT_NAME) -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Volatile, - FastCall = TRUE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_EDIT; -] - //-------------------------------------------------------------------------- SfxVoidItem GoalSeek SID_SOLVE () @@ -4984,31 +4909,6 @@ SfxVoidItem PageFormatDialog SID_FORMATPAGE GroupId = GID_FORMAT; ] -//-------------------------------------------------------------------------- -SfxInt16Item PasteSpecial FID_PASTE_CONTENTS -(SfxUInt32Item Format FID_PASTE_CONTENTS) -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Volatile, - FastCall = TRUE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - //-------------------------------------------------------------------------- SfxVoidItem PreviousPage SID_PREVIEW_PREVIOUS () diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index fcbfb648ae14..380f4635cdcf 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -483,6 +483,10 @@ OutputDevice* ScDocShell::GetRefDevice() USHORT ScDocShell::SetPrinter( SfxPrinter* pNewPrinter, USHORT nDiffFlags ) { + SfxPrinter *pOld = aDocument.GetPrinter( FALSE ); + if ( pOld && pOld->IsPrinting() ) + return SFX_PRINTERROR_BUSY; + if (nDiffFlags & SFX_PRINTER_PRINTER) { if ( aDocument.GetPrinter() != pNewPrinter ) diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 8c175f0cd3a9..d241843f9745 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -201,7 +201,7 @@ void __EXPORT ScDrawTextObjectBar::Execute( SfxRequest &rReq ) } break; - case FID_PASTE_CONTENTS: + case SID_PASTE_SPECIAL: ExecutePasteContents( rReq ); break; @@ -467,7 +467,7 @@ IMPL_LINK( ScDrawTextObjectBar, ClipboardChanged, TransferableDataHelper*, pData SfxBindings& rBindings = pViewData->GetBindings(); rBindings.Invalidate( SID_PASTE ); - rBindings.Invalidate( FID_PASTE_CONTENTS ); + rBindings.Invalidate( SID_PASTE_SPECIAL ); rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); } return 0; @@ -502,7 +502,7 @@ void __EXPORT ScDrawTextObjectBar::GetClipState( SfxItemSet& rSet ) switch (nWhich) { case SID_PASTE: - case FID_PASTE_CONTENTS: + case SID_PASTE_SPECIAL: if( !bPastePossible ) rSet.DisableItem( nWhich ); break; diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx index a011de6fa0e9..d05e0568c1ca 100644 --- a/sc/source/ui/drawfunc/drtxtob2.cxx +++ b/sc/source/ui/drawfunc/drtxtob2.cxx @@ -91,7 +91,7 @@ void __EXPORT ScDrawTextObjectBar::ExecuteGlobal( SfxRequest &rReq ) break; case SID_PASTE: - case FID_PASTE_CONTENTS: + case SID_PASTE_SPECIAL: case SID_CLIPBOARD_FORMAT_ITEMS: case SID_HYPERLINK_SETLINK: { diff --git a/sc/source/ui/src/hdrcont.src b/sc/source/ui/src/hdrcont.src index 6b80e2597b87..7ba7b6a1c8fe 100644 --- a/sc/source/ui/src/hdrcont.src +++ b/sc/source/ui/src/hdrcont.src @@ -136,8 +136,8 @@ Menu RID_POPUP_ROWHEADER PART2 MenuItem { - Identifier = FID_PASTE_CONTENTS ; - HelpId = FID_PASTE_CONTENTS ; + Identifier = SID_PASTE_SPECIAL ; + HelpId = SID_PASTE_SPECIAL ; Text [ en-US ] = "P~aste Special..." ; }; }; @@ -214,8 +214,8 @@ Menu RID_POPUP_COLHEADER PART2 MenuItem { - Identifier = FID_PASTE_CONTENTS ; - HelpId = FID_PASTE_CONTENTS ; + Identifier = SID_PASTE_SPECIAL ; + HelpId = SID_PASTE_SPECIAL ; Text [ en-US ] = "Paste ~Special..." ; }; }; diff --git a/sc/source/ui/src/popup.src b/sc/source/ui/src/popup.src index e9d869b6b850..b03c0c0ae135 100644 --- a/sc/source/ui/src/popup.src +++ b/sc/source/ui/src/popup.src @@ -126,8 +126,8 @@ Menu RID_POPUP_CELLS MenuItem { - Identifier = FID_PASTE_CONTENTS ; - HelpId = FID_PASTE_CONTENTS ; + Identifier = SID_PASTE_SPECIAL ; + HelpId = SID_PASTE_SPECIAL ; Text [ en-US ] = "P~aste Special..." ; }; //------------------------------ diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 0090ec42a0e9..c2d0f68fc6ef 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -442,7 +442,7 @@ IMPL_LINK( ScCellShell, ClipboardChanged, TransferableDataHelper*, pDataHelper ) SfxBindings& rBindings = GetViewData()->GetBindings(); rBindings.Invalidate( SID_PASTE ); - rBindings.Invalidate( FID_PASTE_CONTENTS ); + rBindings.Invalidate( SID_PASTE_SPECIAL ); rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); } return 0; @@ -452,7 +452,7 @@ IMPL_LINK( ScCellShell, ClipboardChanged, TransferableDataHelper*, pDataHelper ) void __EXPORT ScCellShell::GetClipState( SfxItemSet& rSet ) { // SID_PASTE -// FID_PASTE_CONTENTS +// SID_PASTE_SPECIAL // SID_CLIPBOARD_FORMAT_ITEMS if ( !pImpl->m_pClipEvtLstnr ) @@ -489,7 +489,7 @@ void __EXPORT ScCellShell::GetClipState( SfxItemSet& rSet ) if (bDisable) { rSet.DisableItem( SID_PASTE ); - rSet.DisableItem( FID_PASTE_CONTENTS ); + rSet.DisableItem( SID_PASTE_SPECIAL ); rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS ); } else if ( rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) != SFX_ITEM_UNKNOWN ) diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 7f632f62c2ba..f610e28b3fc5 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1387,7 +1387,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pTabViewShell->CellContentChanged(); // => PasteFromXXX ??? break; - case FID_PASTE_CONTENTS: + case SID_PASTE_SPECIAL: // Unterscheidung, ob eigene oder fremde Daten, // dadurch FID_INS_CELL_CONTENTS ueberfluessig { @@ -1485,43 +1485,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pTabViewShell->CellContentChanged(); // => PasteFromSystem() ??? break; -#if 0 - // clipboard slots were used only for old basic: - - case SID_GET_CLPBRD_FORMAT_COUNT: - rReq.SetReturnValue( SfxUInt16Item( nSlot, Clipboard::GetFormatCount() ) ); - break; - - case SID_GET_CLPBRD_FORMAT_BY_IDX: - if (pReqArgs) - { - const SfxPoolItem* pItem; - if ( pReqArgs->GetItemState(nSlot, TRUE, &pItem) == SFX_ITEM_SET && - pItem->ISA(SfxUInt16Item) ) - { - USHORT nCount = Clipboard::GetFormatCount(); - USHORT nPos = ((const SfxUInt16Item*)pItem)->GetValue(); // 1-based - if ( nPos && nPos <= nCount ) - rReq.SetReturnValue( SfxUInt32Item( nSlot, Clipboard::GetFormat(--nPos) ) ); - } - } - break; - - case SID_GET_CLPBRD_FORMAT_NAME: - if (pReqArgs) - { - const SfxPoolItem* pItem; - if ( pReqArgs->GetItemState(nSlot, TRUE, &pItem) == SFX_ITEM_SET && - pItem->ISA(SfxUInt32Item) ) - { - String aName = Exchange::GetFormatName( - ((const SfxUInt32Item*)pItem)->GetValue() ); - rReq.SetReturnValue( SfxStringItem( nSlot, aName ) ); - } - } - break; -#endif - // // sonstiges // diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index d9c19f02058a..022eabdc11cf 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -268,7 +268,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) } break; - case FID_PASTE_CONTENTS: + case SID_PASTE_SPECIAL: { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() ); @@ -714,7 +714,7 @@ IMPL_LINK( ScEditShell, ClipboardChanged, TransferableDataHelper*, pDataHelper ) SfxBindings& rBindings = pViewData->GetBindings(); rBindings.Invalidate( SID_PASTE ); - rBindings.Invalidate( FID_PASTE_CONTENTS ); + rBindings.Invalidate( SID_PASTE_SPECIAL ); rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS ); } return 0; @@ -742,7 +742,7 @@ void __EXPORT ScEditShell::GetClipState( SfxItemSet& rSet ) switch (nWhich) { case SID_PASTE: - case FID_PASTE_CONTENTS: + case SID_PASTE_SPECIAL: if( !bPastePossible ) rSet.DisableItem( nWhich ); break; diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index f8cf331bc8cf..a19760e4c277 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -422,7 +422,7 @@ void ScTabView::SelectionChanged() rBindings.Invalidate( SID_CUT ); rBindings.Invalidate( SID_COPY ); rBindings.Invalidate( SID_PASTE ); - rBindings.Invalidate( FID_PASTE_CONTENTS ); + rBindings.Invalidate( SID_PASTE_SPECIAL ); rBindings.Invalidate( FID_INS_ROW ); rBindings.Invalidate( FID_INS_COLUMN ); -- cgit From 3b40fd41e4a26a01fcee082bcb8143ea9456d4fd Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 18 Sep 2009 12:31:43 +0000 Subject: CWS-TOOLING: integrate CWS calc32stopper1 2009-09-15 15:43:23 +0200 dr r276180 : newpic 2009-09-15 15:41:13 +0200 dr r276179 : newpic 2009-09-15 14:58:14 +0200 dr r276178 : #i104905# fixed note handling while importing from external data 2009-09-15 13:47:43 +0200 dr r276173 : #i104905# fixed note handling while importing from database 2009-09-15 11:56:00 +0200 dr r276164 : #i104155# prevent crash loading docx 2009-09-15 10:40:43 +0200 dr r276154 : #i104990# 2009-09-15 10:27:31 +0200 dr r276152 : #i104990# enable saving BIFF8 with password/encryption 2009-09-15 10:26:40 +0200 dr r276151 : #i104990# enable saving BIFF8 with password/encryption 2009-09-14 19:13:11 +0200 dr r276145 : #i105007# missing cleanup for deleted headers 2009-09-14 19:06:57 +0200 dr r276144 : #i105007# missing cleanup for deleted headers 2009-09-14 18:53:39 +0200 dr r276143 : #i104915# prevent crashes and misbehaviour when dealing with note cells: enter matrix, enter mult.op 2009-09-14 13:57:00 +0200 dr r276109 : #160184# make drilldown working in exported pivottables, ported to DEV300 2009-09-11 15:16:08 +0200 nn r276068 : #i104987# MoveBlock: pass bCut parameter 2009-09-11 15:15:22 +0200 nn r276067 : #i104986# CopyToClip: correct order of parameters 2009-09-11 09:45:59 +0200 dr r276053 : correct milestone --- sc/source/core/data/postit.cxx | 11 ++++++++-- sc/source/core/tool/interpr4.cxx | 2 +- sc/source/filter/excel/xepivot.cxx | 3 +++ sc/source/ui/docshell/arealink.cxx | 8 +++---- sc/source/ui/docshell/dbdocimp.cxx | 17 +++++++++------ sc/source/ui/docshell/docfunc.cxx | 6 +++--- sc/source/ui/docshell/docsh.cxx | 44 +++++++++++++++----------------------- sc/source/ui/docshell/impex.cxx | 4 ++-- sc/source/ui/undo/undoblk.cxx | 6 +++--- sc/source/ui/undo/undoblk3.cxx | 20 ++++++++--------- sc/source/ui/undo/undodat.cxx | 18 ++++++++-------- sc/source/ui/unoobj/cellsuno.cxx | 2 +- sc/source/ui/view/viewfun3.cxx | 2 +- sc/source/ui/view/viewfun4.cxx | 2 +- 14 files changed, 74 insertions(+), 71 deletions(-) diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index a7c5753e4a51..7a08f352ed91 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -652,7 +652,9 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const been created already. */ OSL_ENSURE( !mrDoc.IsUndo() && !mrDoc.IsClipboard(), "ScPostIt::CreateCaptionFromInitData - note caption should not be created in undo/clip documents" ); - if( !maNoteData.mpCaption ) + /* #i104915# Never try to create notes in Undo document, leads to + crash due to missing document members (e.g. row height array). */ + if( !maNoteData.mpCaption && !mrDoc.IsUndo() ) { // ScNoteCaptionCreator c'tor creates the caption and inserts it into the document and maNoteData ScNoteCaptionCreator aCreator( mrDoc, rPos, maNoteData ); @@ -704,8 +706,13 @@ void ScPostIt::CreateCaption( const ScAddress& rPos, const SdrCaptionObj* pCapti OSL_ENSURE( !maNoteData.mpCaption, "ScPostIt::CreateCaption - unexpected caption object found" ); maNoteData.mpCaption = 0; - // drawing layer may be missing, if a note is copied into a clipboard document + /* #i104915# Never try to create notes in Undo document, leads to + crash due to missing document members (e.g. row height array). */ OSL_ENSURE( !mrDoc.IsUndo(), "ScPostIt::CreateCaption - note caption should not be created in undo documents" ); + if( mrDoc.IsUndo() ) + return; + + // drawing layer may be missing, if a note is copied into a clipboard document if( mrDoc.IsClipboard() ) mrDoc.InitDrawLayer(); diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index a5644985206f..11fd414c81f2 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3279,7 +3279,7 @@ void ScInterpreter::ScCalcTeam() if( !bShown ) { ShowTheTeam(); - String aTeam( RTL_CONSTASCII_USTRINGPARAM( "Ballach, Nebel, Rentz, Rathke, Marmion" ) ); + String aTeam( RTL_CONSTASCII_USTRINGPARAM( "Nebel, Benisch, Rentz, Rathke" ) ); if ( (GetByte() == 1) && ::rtl::math::approxEqual( GetDouble(), 1996) ) aTeam.AppendAscii( " (a word with 'B': -Olk, -Nietsch, -Daeumling)" ); PushString( aTeam ); diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 4695c2c191cf..69b323e1e718 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -662,6 +662,9 @@ XclExpPivotCache::XclExpPivotCache( const XclExpRoot& rRoot, const ScDPObject& r if( 2 * (nDocRow2 - nDocRow1) < (nSrcRow2 - nSrcRow1) ) ::set_flag( maPCInfo.mnFlags, EXC_SXDB_SAVEDATA, false ); + // #160184# Excel must refresh tables to make drilldown working + ::set_flag( maPCInfo.mnFlags, EXC_SXDB_REFRESH_LOAD ); + // adjust row indexes, keep one row of empty area to surely have the empty cache item if( nSrcRow1 < nDocRow1 ) nSrcRow1 = nDocRow1 - 1; diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index a9e5f7ce8218..fd3a562ecb42 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -355,12 +355,12 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter, } else pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle - pDoc->CopyToDocument( aOldRange, IDF_ALL, FALSE, pUndoDoc ); + pDoc->CopyToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc ); } else // ohne Einfuegen { pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle - pDoc->CopyToDocument( aMaxRange, IDF_ALL, FALSE, pUndoDoc ); + pDoc->CopyToDocument( aMaxRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc ); } } @@ -370,7 +370,7 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter, if (bDoInsert) pDoc->FitBlock( aOldRange, aNewRange ); // incl. loeschen else - pDoc->DeleteAreaTab( aMaxRange, IDF_ALL ); + pDoc->DeleteAreaTab( aMaxRange, IDF_ALL & ~IDF_NOTE ); // Daten kopieren @@ -426,7 +426,7 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter, { pRedoDoc = new ScDocument( SCDOCMODE_UNDO ); pRedoDoc->InitUndo( pDoc, nDestTab, nDestTab ); - pDoc->CopyToDocument( aNewRange, IDF_ALL, FALSE, pRedoDoc ); + pDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, FALSE, pRedoDoc ); pImpl->m_pDocSh->GetUndoManager()->AddUndoAction( new ScUndoUpdateAreaLink( pImpl->m_pDocSh, diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index ae176868162e..09e4dd7aa4af 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -576,18 +576,21 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, if (bRecord) { + // do not touch notes (ScUndoImportData does not support drawing undo) + sal_uInt16 nCopyFlags = IDF_ALL & ~IDF_NOTE; + // nFormulaCols is set only if column count is unchanged pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab, nEndCol+nFormulaCols, nEndRow, nTab, - IDF_ALL, FALSE, pUndoDoc ); + nCopyFlags, FALSE, pUndoDoc ); if ( rParam.nCol2 > nEndCol ) pDoc->CopyToDocument( nEndCol+1, rParam.nRow1, nTab, nUndoEndCol, nUndoEndRow, nTab, - IDF_ALL, FALSE, pUndoDoc ); + nCopyFlags, FALSE, pUndoDoc ); if ( rParam.nRow2 > nEndRow ) pDoc->CopyToDocument( rParam.nCol1, nEndRow+1, nTab, nUndoEndCol+nFormulaCols, nUndoEndRow, nTab, - IDF_ALL, FALSE, pUndoDoc ); + nCopyFlags, FALSE, pUndoDoc ); } // @@ -601,7 +604,7 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, ScRange aDelRange( rParam.nCol1, rParam.nRow1, nTab, rParam.nCol2, rParam.nRow2, nTab ); - pDoc->DeleteAreaTab( aDelRange, IDF_ALL ); // ohne die Formeln + pDoc->DeleteAreaTab( aDelRange, IDF_ALL & ~IDF_NOTE ); // ohne die Formeln ScRange aOld( rParam.nCol1, rParam.nRow1, nTab, rParam.nCol2+nFormulaCols, rParam.nRow2, nTab ); @@ -611,10 +614,10 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, } else if ( nEndCol < rParam.nCol2 ) // DeleteArea calls PutInOrder pDoc->DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2, - aNewMark, IDF_CONTENTS ); + aNewMark, IDF_CONTENTS & ~IDF_NOTE ); // CopyToDocument doesn't remove contents - pDoc->DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS ); + pDoc->DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS & ~IDF_NOTE ); // #41216# remove each column from ImportDoc after copying to reduce memory usage BOOL bOldAutoCalc = pDoc->GetAutoCalc(); @@ -671,7 +674,7 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, if (nFormulaCols > 0) // include filled formulas for redo pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab, nEndCol+nFormulaCols, nEndRow, nTab, - IDF_ALL, FALSE, pRedoDoc ); + IDF_ALL & ~IDF_NOTE, FALSE, pRedoDoc ); ScDBData* pRedoDBData = pDBData ? new ScDBData( *pDBData ) : NULL; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 5df8db46bd13..cb5d2ead509f 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2277,7 +2277,7 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, } ScDrawLayer::SetGlobalDrawPersist(aDragShellRef); - ScClipParam aClipParam(ScRange(nStartCol, nStartRow, 0, nEndCol, nEndRow, 0), false); + ScClipParam aClipParam(ScRange(nStartCol, nStartRow, 0, nEndCol, nEndRow, 0), bCut); pDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bScenariosAdded, true); ScDrawLayer::SetGlobalDrawPersist(NULL); @@ -3577,7 +3577,7 @@ BOOL ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark, //! auch bei Undo selektierte Tabellen beruecksichtigen pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab ); - pDoc->CopyToDocument( rRange, IDF_ALL, FALSE, pUndoDoc ); + pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc ); } // use TokenArray if given, string (and flags) otherwise @@ -3665,7 +3665,7 @@ BOOL ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark, //! auch bei Undo selektierte Tabellen beruecksichtigen ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab ); - pDoc->CopyToDocument( rRange, IDF_ALL, FALSE, pUndoDoc ); + pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc ); rDocShell.GetUndoManager()->AddUndoAction( new ScUndoTabOp( &rDocShell, diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c8a41e81497d..f7d1e2ccae2f 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1856,38 +1856,28 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed ) aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions ); pViewShell->GetViewData()->WriteExtOptions( *pExtDocOpt ); -#if ENABLE_SHEET_PROTECTION - bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_XL); - if (bNeedRetypePassDlg && !pViewShell->ExecuteRetypePassDlg(PASSHASH_XL)) + /* #115980# #i104990# If the imported document contains a medium + password, determine if we can save it, otherwise ask the users + whether they want to save without it. */ + if( !::sfx2::CheckMSPasswordCapabilityForExport( aFltName ) ) { - SetError( ERRCODE_ABORT ); - return false; - } -#else - - do - { - SfxItemSet* pSet = rMed.GetItemSet(); - if (!pSet) - break; - - const SfxPoolItem* pItem = NULL; - if (SFX_ITEM_SET != pSet->GetItemState(SID_PASSWORD, sal_True, &pItem)) - // password is not set. - break; - - /* #115980 #If the imported document contained an encrypted password - - determine if we should save without it. */ - bDoSave = ScWarnPassword::WarningOnPassword( rMed ); - - if (bDoSave) + SfxItemSet* pItemSet = rMed.GetItemSet(); + const SfxPoolItem* pItem = 0; + if( pItemSet && pItemSet->GetItemState( SID_PASSWORD, sal_True, &pItem ) == SFX_ITEM_SET ) { - // #i42858# warn only one time - pSet->ClearItem(SID_PASSWORD); + bDoSave = ScWarnPassword::WarningOnPassword( rMed ); + // #i42858# remove password from medium (warn only one time) + if( bDoSave ) + pItemSet->ClearItem( SID_PASSWORD ); } } - while (false); +#if ENABLE_SHEET_PROTECTION + if( bDoSave ) + { + bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen( aDocument, PASSHASH_XL ); + bDoSave = !bNeedRetypePassDlg || pViewShell->ExecuteRetypePassDlg( PASSHASH_XL ); + } #endif } diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 67186f84a84a..1561e4c6efeb 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -253,7 +253,7 @@ BOOL ScImportExport::StartPaste() { pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); pUndoDoc->InitUndo( pDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() ); - pDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pUndoDoc ); + pDoc->CopyToDocument( aRange, IDF_ALL | IDF_NOCAPTIONS, FALSE, pUndoDoc ); } return TRUE; } @@ -270,7 +270,7 @@ void ScImportExport::EndPaste() { ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO ); pRedoDoc->InitUndo( pDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() ); - pDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pRedoDoc ); + pDoc->CopyToDocument( aRange, IDF_ALL | IDF_NOCAPTIONS, FALSE, pRedoDoc ); ScMarkData aDestMark; aDestMark.SelectOneTable( aRange.aStart.Tab() ); pDocSh->GetUndoManager()->AddUndoAction( diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 3df8e99348c0..8cc45d41a2e6 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -442,7 +442,7 @@ void ScUndoDeleteCells::DoChange( const BOOL bUndo ) for( i=0; iCopyToDocument( aEffRange.aStart.Col(), aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Col(), aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i], - IDF_ALL, FALSE, pDoc ); + IDF_ALL | IDF_NOCAPTIONS, FALSE, pDoc ); } ScRange aWorkRange( aEffRange ); @@ -1729,8 +1729,8 @@ void __EXPORT ScUndoEnterMatrix::Undo() ScDocument* pDoc = pDocShell->GetDocument(); - pDoc->DeleteAreaTab( aBlockRange, IDF_ALL ); - pUndoDoc->CopyToDocument( aBlockRange, IDF_ALL, FALSE, pDoc ); + pDoc->DeleteAreaTab( aBlockRange, IDF_ALL & ~IDF_NOTE ); + pUndoDoc->CopyToDocument( aBlockRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc ); pDocShell->PostPaint( aBlockRange, PAINT_GRID ); pDocShell->PostDataChanged(); ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index ea1e303d6ae3..4a94827ed1ec 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -1340,8 +1340,8 @@ void __EXPORT ScUndoTabOp::Undo() pDocShell->UpdatePaintExt( nExtFlags, aRange ); ScDocument* pDoc = pDocShell->GetDocument(); - pDoc->DeleteAreaTab( aRange,IDF_ALL ); - pUndoDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pDoc ); + pDoc->DeleteAreaTab( aRange,IDF_ALL & ~IDF_NOTE ); + pUndoDoc->CopyToDocument( aRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc ); pDocShell->PostPaint( aRange, PAINT_GRID, nExtFlags ); pDocShell->PostDataChanged(); ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); @@ -2023,14 +2023,14 @@ void ScUndoUpdateAreaLink::DoChange( const BOOL bUndo ) const if ( bWithInsert ) { pDoc->FitBlock( aNewRange, aOldRange ); - pDoc->DeleteAreaTab( aOldRange, IDF_ALL ); - pUndoDoc->UndoToDocument( aOldRange, IDF_ALL, FALSE, pDoc ); + pDoc->DeleteAreaTab( aOldRange, IDF_ALL & ~IDF_NOTE ); + pUndoDoc->UndoToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc ); } else { ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) ); - pDoc->DeleteAreaTab( aCopyRange, IDF_ALL ); - pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL, FALSE, pDoc ); + pDoc->DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE ); + pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc ); } } else @@ -2038,14 +2038,14 @@ void ScUndoUpdateAreaLink::DoChange( const BOOL bUndo ) const if ( bWithInsert ) { pDoc->FitBlock( aOldRange, aNewRange ); - pDoc->DeleteAreaTab( aNewRange, IDF_ALL ); - pRedoDoc->CopyToDocument( aNewRange, IDF_ALL, FALSE, pDoc ); + pDoc->DeleteAreaTab( aNewRange, IDF_ALL & ~IDF_NOTE ); + pRedoDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc ); } else { ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) ); - pDoc->DeleteAreaTab( aCopyRange, IDF_ALL ); - pRedoDoc->CopyToDocument( aCopyRange, IDF_ALL, FALSE, pDoc ); + pDoc->DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE ); + pRedoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc ); } } diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx index f16409b37239..7ab321ac0c1d 100644 --- a/sc/source/ui/undo/undodat.cxx +++ b/sc/source/ui/undo/undodat.cxx @@ -1302,8 +1302,8 @@ void __EXPORT ScUndoImportData::Undo() for (SCCOL nCopyCol = nCol1; nCopyCol <= nCol2; nCopyCol++) { pDoc->CopyToDocument( nCopyCol,nRow1,nTab, nCopyCol,nRow2,nTab, - IDF_CONTENTS, FALSE, pRedoDoc ); - pDoc->DeleteAreaTab( nCopyCol,nRow1, nCopyCol,nRow2, nTab, IDF_CONTENTS ); + IDF_CONTENTS & ~IDF_NOTE, FALSE, pRedoDoc ); + pDoc->DeleteAreaTab( nCopyCol,nRow1, nCopyCol,nRow2, nTab, IDF_CONTENTS & ~IDF_NOTE ); pDoc->DoColResize( nTab, nCopyCol, nCopyCol, 0 ); } pDoc->SetAutoCalc( bOldAutoCalc ); @@ -1321,7 +1321,7 @@ void __EXPORT ScUndoImportData::Undo() pRedoDBData->GetArea( aNew ); pDoc->DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(), - aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL ); + aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL & ~IDF_NOTE ); aOld.aEnd.SetCol( aOld.aEnd.Col() + nFormulaCols ); // FitBlock auch fuer Formeln aNew.aEnd.SetCol( aNew.aEnd.Col() + nFormulaCols ); @@ -1329,11 +1329,11 @@ void __EXPORT ScUndoImportData::Undo() } else pDoc->DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1, - nEndCol,nEndRow, nTab, IDF_ALL ); + nEndCol,nEndRow, nTab, IDF_ALL & ~IDF_NOTE ); pUndoDoc->CopyToDocument( aImportParam.nCol1,aImportParam.nRow1,nTab, nEndCol+nFormulaCols,nEndRow,nTab, - IDF_ALL, FALSE, pDoc ); + IDF_ALL & ~IDF_NOTE, FALSE, pDoc ); if (pCurrentData) { @@ -1395,16 +1395,16 @@ void __EXPORT ScUndoImportData::Redo() pDoc->FitBlock( aOld, aNew ); pDoc->DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(), - aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL ); + aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL & ~IDF_NOTE ); - pRedoDoc->CopyToDocument( aNew, IDF_ALL, FALSE, pDoc ); // incl. Formeln + pRedoDoc->CopyToDocument( aNew, IDF_ALL & ~IDF_NOTE, FALSE, pDoc ); // incl. Formeln } else { pDoc->DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1, - nEndCol,nEndRow, nTab, IDF_ALL ); + nEndCol,nEndRow, nTab, IDF_ALL & ~IDF_NOTE ); pRedoDoc->CopyToDocument( aImportParam.nCol1,aImportParam.nRow1,nTab, - nEndCol,nEndRow,nTab, IDF_ALL, FALSE, pDoc ); + nEndCol,nEndRow,nTab, IDF_ALL & ~IDF_NOTE, FALSE, pDoc ); } if (pCurrentData) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index cfe51aed6edc..f3418a84e2ef 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1093,7 +1093,7 @@ BOOL lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, { pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); pUndoDoc->InitUndo( pDoc, nTab, nTab ); - pDoc->CopyToDocument( rRange, IDF_CONTENTS, FALSE, pUndoDoc ); + pDoc->CopyToDocument( rRange, IDF_CONTENTS|IDF_NOCAPTIONS, FALSE, pUndoDoc ); } pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS ); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 4b5d59b80284..3065aa2fd4e1 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -465,7 +465,7 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI if (!bValidRanges) break; - pDoc->CopyToClip(aClipParam, pDocClip.get(), false, &rMark, false, bIncludeObjects); + pDoc->CopyToClip(aClipParam, pDocClip.get(), &rMark, false, false, bIncludeObjects); ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack(); if ( pChangeTrack ) diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 0f3a1c812802..578f6c1fe733 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -155,7 +155,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow, { ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO ); pRedoDoc->InitUndo( pDoc, nTab, nTab ); - pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, IDF_ALL, FALSE, pRedoDoc ); + pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, IDF_ALL|IDF_NOCAPTIONS, FALSE, pRedoDoc ); ScMarkData aDestMark; aDestMark.SelectOneTable( nTab ); -- cgit From 34551159a38cbdef7e254664834c0b793e593d5b Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Thu, 1 Oct 2009 10:29:37 +0000 Subject: CWS-TOOLING: integrate CWS sw32bf04 2009-09-22 Michael Stahl galobj.hxx: do not export SgaObject methods (fixes wntmsci12 build) 2009-09-21 Michael Stahl #i105149# #i93308# svx: unofield.cxx: support field services with proper case 2009-09-21 Michael Stahl #i105149# #i102468# sc: servuno.cxx: support field services with proper case 2009-09-21 Michael Stahl #i105149# txtflde.cxx: support docinfo field services with proper case 2009-09-18 Michael Stahl #i105148# fmtatr2.cxx: SwFmtMeta::Clone(): avoid assert on clone pool default 2009-09-18 Michael Stahl #i105148# fmtatr2.cxx: SwFmtMeta::~SwFmtMeta(): check if m_pMeta != 0 2009-09-18 Michael Stahl #i105179# unocoll.cxx: SwXFrames::getByName(): add missing breaks 2009-09-18 Michael Stahl dbgoutsw.cxx: explicitly convert from SwNodeIndex to SwPosition 2009-09-18 Michael Stahl galobj.hxx: export class SgaObject from svxcore, needed by unogalitem.cxx 2009-09-17 Michael Stahl #i105149# txtflde.cxx: compare text field prefix case-insensitively 2009-09-16 Michael Stahl #i105117# docdde.cxx: fix possible NULL dereference (patch by cmc) 2009-09-16 Michael Stahl #i105124# docdde.cxx: fix use-after-free bug: make _FindItem member String --- sc/source/ui/unoobj/servuno.cxx | 131 ++++++++++++++++++++++++---------------- 1 file changed, 78 insertions(+), 53 deletions(-) diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index 71f45e6ab12b..1f51bc1646af 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -65,55 +65,71 @@ using namespace ::com::sun::star; //------------------------------------------------------------------------ +// +struct ProvNamesId_Type +{ + const char * pName; + sal_uInt16 nType; +}; -static const sal_Char* __FAR_DATA aProvNames[SC_SERVICE_COUNT] = - { - "com.sun.star.sheet.Spreadsheet", // SC_SERVICE_SHEET - "com.sun.star.text.TextField.URL", // SC_SERVICE_URLFIELD - "com.sun.star.text.TextField.PageNumber", // SC_SERVICE_PAGEFIELD - "com.sun.star.text.TextField.PageCount", // SC_SERVICE_PAGESFIELD - "com.sun.star.text.TextField.Date", // SC_SERVICE_DATEFIELD - "com.sun.star.text.TextField.Time", // SC_SERVICE_TIMEFIELD - "com.sun.star.text.TextField.DocumentTitle",// SC_SERVICE_TITLEFIELD - "com.sun.star.text.TextField.FileName", // SC_SERVICE_FILEFIELD - "com.sun.star.text.TextField.SheetName", // SC_SERVICE_SHEETFIELD - "com.sun.star.style.CellStyle", // SC_SERVICE_CELLSTYLE - "com.sun.star.style.PageStyle", // SC_SERVICE_PAGESTYLE - "com.sun.star.sheet.TableAutoFormat", // SC_SERVICE_AUTOFORMAT - "com.sun.star.sheet.SheetCellRanges", // SC_SERVICE_CELLRANGES - "com.sun.star.drawing.GradientTable", // SC_SERVICE_GRADTAB - "com.sun.star.drawing.HatchTable", // SC_SERVICE_HATCHTAB - "com.sun.star.drawing.BitmapTable", // SC_SERVICE_BITMAPTAB - "com.sun.star.drawing.TransparencyGradientTable", // SC_SERVICE_TRGRADTAB - "com.sun.star.drawing.MarkerTable", // SC_SERVICE_MARKERTAB - "com.sun.star.drawing.DashTable", // SC_SERVICE_DASHTAB - "com.sun.star.text.NumberingRules", // SC_SERVICE_NUMRULES - "com.sun.star.sheet.Defaults", // SC_SERVICE_DOCDEFLTS - "com.sun.star.drawing.Defaults", // SC_SERVICE_DRAWDEFLTS - "com.sun.star.comp.SpreadsheetSettings", // SC_SERVICE_DOCSPRSETT - "com.sun.star.document.Settings", // SC_SERVICE_DOCCONF - "com.sun.star.image.ImageMapRectangleObject",// SC_SERVICE_IMAP_RECT - "com.sun.star.image.ImageMapCircleObject", // SC_SERVICE_IMAP_CIRC - "com.sun.star.image.ImageMapPolygonObject", // SC_SERVICE_IMAP_POLY +static const ProvNamesId_Type __FAR_DATA aProvNamesId[] = +{ + { "com.sun.star.sheet.Spreadsheet", SC_SERVICE_SHEET }, + { "com.sun.star.text.TextField.URL", SC_SERVICE_URLFIELD }, + { "com.sun.star.text.TextField.PageNumber", SC_SERVICE_PAGEFIELD }, + { "com.sun.star.text.TextField.PageCount", SC_SERVICE_PAGESFIELD }, + { "com.sun.star.text.TextField.Date", SC_SERVICE_DATEFIELD }, + { "com.sun.star.text.TextField.Time", SC_SERVICE_TIMEFIELD }, + { "com.sun.star.text.TextField.DocumentTitle", SC_SERVICE_TITLEFIELD }, + { "com.sun.star.text.TextField.FileName", SC_SERVICE_FILEFIELD }, + { "com.sun.star.text.TextField.SheetName", SC_SERVICE_SHEETFIELD }, + { "com.sun.star.style.CellStyle", SC_SERVICE_CELLSTYLE }, + { "com.sun.star.style.PageStyle", SC_SERVICE_PAGESTYLE }, + { "com.sun.star.sheet.TableAutoFormat", SC_SERVICE_AUTOFORMAT }, + { "com.sun.star.sheet.SheetCellRanges", SC_SERVICE_CELLRANGES }, + { "com.sun.star.drawing.GradientTable", SC_SERVICE_GRADTAB }, + { "com.sun.star.drawing.HatchTable", SC_SERVICE_HATCHTAB }, + { "com.sun.star.drawing.BitmapTable", SC_SERVICE_BITMAPTAB }, + { "com.sun.star.drawing.TransparencyGradientTable", SC_SERVICE_TRGRADTAB }, + { "com.sun.star.drawing.MarkerTable", SC_SERVICE_MARKERTAB }, + { "com.sun.star.drawing.DashTable", SC_SERVICE_DASHTAB }, + { "com.sun.star.text.NumberingRules", SC_SERVICE_NUMRULES }, + { "com.sun.star.sheet.Defaults", SC_SERVICE_DOCDEFLTS }, + { "com.sun.star.drawing.Defaults", SC_SERVICE_DRAWDEFLTS }, + { "com.sun.star.comp.SpreadsheetSettings", SC_SERVICE_DOCSPRSETT }, + { "com.sun.star.document.Settings", SC_SERVICE_DOCCONF }, + { "com.sun.star.image.ImageMapRectangleObject", SC_SERVICE_IMAP_RECT }, + { "com.sun.star.image.ImageMapCircleObject", SC_SERVICE_IMAP_CIRC }, + { "com.sun.star.image.ImageMapPolygonObject", SC_SERVICE_IMAP_POLY }, // #100263# Support creation of GraphicObjectResolver and EmbeddedObjectResolver - "com.sun.star.document.ExportGraphicObjectResolver", // SC_SERVICE_EXPORT_GOR - "com.sun.star.document.ImportGraphicObjectResolver", // SC_SERVICE_IMPORT_GOR - "com.sun.star.document.ExportEmbeddedObjectResolver", // SC_SERVICE_EXPORT_EOR - "com.sun.star.document.ImportEmbeddedObjectResolver", // SC_SERVICE_IMPORT_EOR - - SC_SERVICENAME_VALBIND, // SC_SERVICE_VALBIND - SC_SERVICENAME_LISTCELLBIND, // SC_SERVICE_LISTCELLBIND - SC_SERVICENAME_LISTSOURCE, // SC_SERVICE_LISTSOURCE - SC_SERVICENAME_CELLADDRESS, // SC_SERVICE_CELLADDRESS - SC_SERVICENAME_RANGEADDRESS, // SC_SERVICE_RANGEADDRESS - - "com.sun.star.sheet.DocumentSettings", // SC_SERVICE_SHEETDOCSET - - SC_SERVICENAME_CHDATAPROV, // SC_SERVICE_CHDATAPROV - SC_SERVICENAME_FORMULAPARS, // SC_SERVICE_FORMULAPARS - SC_SERVICENAME_OPCODEMAPPER // SC_SERVICE_OPCODEMAPPER - }; + { "com.sun.star.document.ExportGraphicObjectResolver", SC_SERVICE_EXPORT_GOR }, + { "com.sun.star.document.ImportGraphicObjectResolver", SC_SERVICE_IMPORT_GOR }, + { "com.sun.star.document.ExportEmbeddedObjectResolver", SC_SERVICE_EXPORT_EOR }, + { "com.sun.star.document.ImportEmbeddedObjectResolver", SC_SERVICE_IMPORT_EOR }, + + { SC_SERVICENAME_VALBIND, SC_SERVICE_VALBIND }, + { SC_SERVICENAME_LISTCELLBIND, SC_SERVICE_LISTCELLBIND }, + { SC_SERVICENAME_LISTSOURCE, SC_SERVICE_LISTSOURCE }, + { SC_SERVICENAME_CELLADDRESS, SC_SERVICE_CELLADDRESS }, + { SC_SERVICENAME_RANGEADDRESS, SC_SERVICE_RANGEADDRESS }, + + { "com.sun.star.sheet.DocumentSettings",SC_SERVICE_SHEETDOCSET }, + + { SC_SERVICENAME_CHDATAPROV, SC_SERVICE_CHDATAPROV }, + { SC_SERVICENAME_FORMULAPARS, SC_SERVICE_FORMULAPARS }, + { SC_SERVICENAME_OPCODEMAPPER, SC_SERVICE_OPCODEMAPPER }, + + // case-correct versions of the service names (#i102468#) + { "com.sun.star.text.textfield.URL", SC_SERVICE_URLFIELD }, + { "com.sun.star.text.textfield.PageNumber", SC_SERVICE_PAGEFIELD }, + { "com.sun.star.text.textfield.PageCount", SC_SERVICE_PAGESFIELD }, + { "com.sun.star.text.textfield.Date", SC_SERVICE_DATEFIELD }, + { "com.sun.star.text.textfield.Time", SC_SERVICE_TIMEFIELD }, + { "com.sun.star.text.textfield.DocumentTitle", SC_SERVICE_TITLEFIELD }, + { "com.sun.star.text.textfield.FileName", SC_SERVICE_FILEFIELD }, + { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD }, +}; // // old service names that were in 567 still work in createInstance, @@ -186,11 +202,17 @@ sal_uInt16 ScServiceProvider::GetProviderType(const String& rServiceName) { if (rServiceName.Len()) { - USHORT i; - for (i=0; i crash"); @@ -369,10 +391,13 @@ uno::Reference ScServiceProvider::MakeInstance( uno::Sequence ScServiceProvider::GetAllServiceNames() { - uno::Sequence aRet(SC_SERVICE_COUNT); + const sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]); + uno::Sequence aRet(nEntries); rtl::OUString* pArray = aRet.getArray(); - for (sal_uInt16 i = 0; i < SC_SERVICE_COUNT; i++) - pArray[i] = rtl::OUString::createFromAscii( aProvNames[i] ); + for (sal_uInt16 i = 0; i < nEntries; i++) + { + pArray[i] = rtl::OUString::createFromAscii( aProvNamesId[i].pName ); + } return aRet; } -- cgit From 458b43715fe289804a0bd8889e8709a72a8ac90e Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Wed, 14 Oct 2009 15:49:17 +0000 Subject: CWS-TOOLING: integrate CWS calc32stopper2 2009-10-01 12:42:16 +0200 dr r276592 : #i104992# and more typos... 2009-10-01 12:42:13 +0200 nn r276591 : #i105512# SetDocOptions: update number formatter if it already exists 2009-09-30 19:03:58 +0200 dr r276573 : #104992# oops, forgotten to skip a byte 2009-09-30 16:07:17 +0200 dr r276560 : #i103540# check valid vector size 2009-09-29 14:20:45 +0200 dr r276529 : dump some more BIFF records 2009-09-29 13:00:22 +0200 dr r276526 : dump some more BIFF records 2009-09-28 14:34:14 +0200 dr r276490 : #i104057# missing exception file 2009-09-28 10:35:42 +0200 dr r276483 : #i105325# set correct format while opening zip package 2009-09-25 19:07:32 +0200 dr r276475 : #i104992# handle cell styles built-in in Calc correctly 2009-09-25 19:06:46 +0200 dr r276474 : #i104992# handle cell styles built-in in Calc correctly 2009-09-25 17:37:28 +0200 dr r276472 : #i105219# missing include 2009-09-25 12:32:24 +0200 dr r276435 : #i10000# rebase error: renamed variable 2009-09-25 11:34:53 +0200 dr r276431 : CWS-TOOLING: rebase CWS calc32stopper2 to trunk@276429 (milestone: DEV300:m60) 2009-09-24 18:59:23 +0200 dr r276427 : 160550# preserve write-protection password in roundtrip 2009-09-24 18:54:43 +0200 dr r276426 : 160550# preserve write-protection password in roundtrip 2009-09-22 11:38:17 +0200 dr r276353 : #160550# the property has to be integer of course 2009-09-21 18:52:06 +0200 dr r276342 : #160550# new internal property WriteProtectinPassword 2009-09-21 18:22:40 +0200 dr r276340 : #i104057# load sheets substreams according to offsets in SHEET records 2009-09-21 18:11:00 +0200 dr r276338 : #i104057# load sheets substreams according to offsets in SHEET records 2009-09-17 20:07:33 +0200 dr r276255 : #i104057# BIFF5/BIFF8: order of sheet substreams may be different to sheet order, use stream offset provided in SHEET records --- sc/inc/docuno.hxx | 1 + sc/source/core/data/documen3.cxx | 3 - sc/source/core/data/poolhelp.cxx | 17 +- sc/source/core/inc/poolhelp.hxx | 4 +- sc/source/filter/excel/excdoc.cxx | 59 ++++-- sc/source/filter/excel/excimp8.cxx | 6 +- sc/source/filter/excel/excrecds.cxx | 32 +-- sc/source/filter/excel/exctools.cxx | 2 - sc/source/filter/excel/impop.cxx | 17 +- sc/source/filter/excel/makefile.mk | 1 + sc/source/filter/excel/read.cxx | 49 ++++- sc/source/filter/excel/xeformula.cxx | 13 +- sc/source/filter/excel/xichart.cxx | 4 +- sc/source/filter/excel/xilink.cxx | 40 ++-- sc/source/filter/excel/xistream.cxx | 6 + sc/source/filter/excel/xistyle.cxx | 377 +++++++++++++++++++---------------- sc/source/filter/excel/xlformula.cxx | 7 +- sc/source/filter/excel/xlroot.cxx | 6 + sc/source/filter/excel/xltools.cxx | 44 ++-- sc/source/filter/inc/excrecds.hxx | 12 -- sc/source/filter/inc/ftools.hxx | 4 +- sc/source/filter/inc/imp_op.hxx | 2 + sc/source/filter/inc/root.hxx | 1 - sc/source/filter/inc/xcl97rec.hxx | 85 ++------ sc/source/filter/inc/xistream.hxx | 4 + sc/source/filter/inc/xistyle.hxx | 75 ++++--- sc/source/filter/inc/xlconst.hxx | 27 +++ sc/source/filter/inc/xlroot.hxx | 3 + sc/source/filter/inc/xlstyle.hxx | 2 + sc/source/filter/inc/xltools.hxx | 7 +- sc/source/filter/xcl97/xcl97rec.cxx | 134 +++---------- sc/source/ui/unoobj/chart2uno.cxx | 8 + sc/source/ui/unoobj/docuno.cxx | 19 +- 33 files changed, 559 insertions(+), 512 deletions(-) diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 0d69c9f68670..5966e446d0c3 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -114,6 +114,7 @@ private: com::sun::star::uno::Reference GetFormatter(); rtl::OUString maBuildId; + sal_Int32 mnXlsWriteProtPass; protected: const SfxItemPropertySet& GetPropertySet() const { return aPropSet; } diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 9fc4b09f21af..17650028db70 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1734,11 +1734,8 @@ const ScDocOptions& ScDocument::GetDocOptions() const void ScDocument::SetDocOptions( const ScDocOptions& rOpt ) { - USHORT d,m,y; - DBG_ASSERT( pDocOptions, "No DocOptions! :-(" ); *pDocOptions = rOpt; - rOpt.GetDate( d,m,y ); xPoolHelper->SetFormTableOpt(rOpt); } diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx index ff8f7bb76c5c..d85e16ad135f 100644 --- a/sc/source/core/data/poolhelp.cxx +++ b/sc/source/core/data/poolhelp.cxx @@ -95,14 +95,29 @@ SvNumberFormatter* ScPoolHelper::GetFormTable() const pFormTable->SetColorLink( LINK( m_pSourceDoc, ScDocument, GetUserDefinedColor ) ); pFormTable->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT ); + UseDocOptions(); // null date, year2000, std precision + } + return pFormTable; +} + +void ScPoolHelper::UseDocOptions() const +{ + if (pFormTable) + { USHORT d,m,y; aOpt.GetDate( d,m,y ); pFormTable->ChangeNullDate( d,m,y ); pFormTable->ChangeStandardPrec( (USHORT)aOpt.GetStdPrecision() ); pFormTable->SetYear2000( aOpt.GetYear2000() ); } - return pFormTable; } + +void ScPoolHelper::SetFormTableOpt(const ScDocOptions& rOpt) +{ + aOpt = rOpt; + UseDocOptions(); // #i105512# if the number formatter exists, update its settings +} + void ScPoolHelper::SourceDocumentGone() { // reset all pointers to the source document diff --git a/sc/source/core/inc/poolhelp.hxx b/sc/source/core/inc/poolhelp.hxx index a60b8db462ab..00474d63c080 100644 --- a/sc/source/core/inc/poolhelp.hxx +++ b/sc/source/core/inc/poolhelp.hxx @@ -54,6 +54,8 @@ private: mutable SfxItemPool* pEnginePool; // EditEnginePool ScDocument* m_pSourceDoc; + void UseDocOptions() const; + public: ScPoolHelper( ScDocument* pSourceDoc ); virtual ~ScPoolHelper(); @@ -68,7 +70,7 @@ public: SfxItemPool* GetEditPool() const; SfxItemPool* GetEnginePool() const; - void SetFormTableOpt(const ScDocOptions& rOpt) { aOpt = rOpt; } + void SetFormTableOpt(const ScDocOptions& rOpt); }; #endif diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index d1b08b9cfc68..c72d165c7972 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -144,12 +144,12 @@ static void lcl_AddWorkbookProtection( XclExpRecordList<>& aRecList, ExcTable& s } #endif -static void lcl_AddScenariosAndFilters( XclExpRecordList<>& aRecList, ExcTable& self, SCTAB mnScTab ) +static void lcl_AddScenariosAndFilters( XclExpRecordList<>& aRecList, const XclExpRoot& rRoot, SCTAB nScTab ) { // Scenarios - aRecList.AppendNewRecord( new ExcEScenarioManager( self.GetDoc(), mnScTab ) ); + aRecList.AppendNewRecord( new ExcEScenarioManager( rRoot, nScTab ) ); // filter - aRecList.AppendRecord( self.GetFilterManager().CreateRecord( mnScTab ) ); + aRecList.AppendRecord( rRoot.GetFilterManager().CreateRecord( nScTab ) ); } @@ -205,20 +205,47 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList ) rR.pObjRecs = NULL; // per sheet + sal_uInt16 nWriteProtHash = 0; + if( SfxObjectShell* pDocShell = GetDocShell() ) + { + ScfPropertySet aPropSet( pDocShell->GetModel() ); + sal_Int32 nApiHash = 0; + if( aPropSet.GetProperty( nApiHash, CREATE_OUSTRING( "WriteProtectionPassword" ) ) && (0 < nApiHash) && (nApiHash <= SAL_MAX_UINT16) ) + { + nWriteProtHash = static_cast< sal_uInt16 >( nApiHash ); + Add( new XclExpEmptyRecord( EXC_ID_WRITEPROT ) ); + } + } + + // TODO: correct codepage for BIFF5? + sal_uInt16 nCodePage = XclTools::GetXclCodePage( (GetBiff() <= EXC_BIFF5) ? RTL_TEXTENCODING_MS_1252 : RTL_TEXTENCODING_UNICODE ); + if( GetBiff() <= EXC_BIFF5 ) + { + Add( new XclExpEmptyRecord( EXC_ID_INTERFACEHDR ) ); + Add( new XclExpUInt16Record( EXC_ID_MMS, 0 ) ); + Add( new XclExpEmptyRecord( EXC_ID_TOOLBARHDR ) ); + Add( new XclExpEmptyRecord( EXC_ID_TOOLBAREND ) ); + Add( new XclExpEmptyRecord( EXC_ID_INTERFACEEND ) ); Add( new ExcDummy_00 ); + } else { - if ( IsDocumentEncrypted() ) - Add( new XclExpFilePass(GetRoot()) ); - - Add( new XclExpInterfaceHdr ); - Add( new XclExpMMS ); - Add( new XclExpInterfaceEnd ); + if( IsDocumentEncrypted() ) + Add( new XclExpFilePass( GetRoot() ) ); + Add( new XclExpInterfaceHdr( nCodePage ) ); + Add( new XclExpUInt16Record( EXC_ID_MMS, 0 ) ); + Add( new XclExpEmptyRecord( EXC_ID_INTERFACEEND ) ); Add( new XclExpWriteAccess ); - Add( new XclExpCodePage ); - Add( new XclExpDSF ); - Add( new XclExpExcel9File ); + } + + Add( new XclExpFileSharing( GetRoot(), nWriteProtHash ) ); + Add( new XclExpUInt16Record( EXC_ID_CODEPAGE, nCodePage ) ); + + if( GetBiff() == EXC_BIFF8 ) + { + Add( new XclExpBoolRecord( EXC_ID_DSF, false ) ); + Add( new XclExpEmptyRecord( EXC_ID_XL9FILE ) ); rR.pTabId = new XclExpChTrTabId( Max( nExcTabCount, nCodenames ) ); Add( rR.pTabId ); if( HasVbaStorage() ) @@ -228,10 +255,10 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList ) if( rCodeName.Len() ) Add( new XclCodename( rCodeName ) ); } - - Add( new XclExpFnGroupCount ); } + Add( new XclExpUInt16Record( EXC_ID_FNGROUPCOUNT, 14 ) ); + // erst Namen- und Tabellen-Eintraege aufbauen String aName; @@ -473,7 +500,7 @@ void ExcTable::FillAsTable( size_t nCodeNameIdx ) aRecList.AppendRecord( CreateRecord( EXC_ID_EXTERNSHEET ) ); if ( eBiff == EXC_BIFF8 ) - lcl_AddScenariosAndFilters( aRecList, *this, mnScTab ); + lcl_AddScenariosAndFilters( aRecList, GetRoot(), mnScTab ); // cell table: DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records aRecList.AppendRecord( mxCellTable ); @@ -585,7 +612,7 @@ void ExcTable::FillAsXmlTable( size_t nCodeNameIdx ) // web queries Add( new XclExpWebQueryBuffer( GetRoot() ) ); - lcl_AddScenariosAndFilters( aRecList, *this, mnScTab ); + lcl_AddScenariosAndFilters( aRecList, GetRoot(), mnScTab ); // MERGEDCELLS record, generated by the cell table aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_MERGEDCELLS ) ); diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 1d209b91bc68..deaa3b375c6d 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -165,14 +165,14 @@ void ImportExcel8::Boundsheet( void ) UINT8 nLen; UINT16 nGrbit; - aIn.Ignore( 4 ); + aIn.DisableDecryption(); + maSheetOffsets.push_back( aIn.ReaduInt32() ); + aIn.EnableDecryption(); aIn >> nGrbit >> nLen; String aName( aIn.ReadUniString( nLen ) ); GetTabInfo().AppendXclTabName( aName, nBdshtTab ); - *pExcRoot->pTabNameBuff << aName; - SCTAB nScTab = static_cast< SCTAB >( nBdshtTab ); if( nScTab > 0 ) { diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index bff8d4cba246..4ee5f70dc938 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -107,17 +107,10 @@ using ::rtl::OString; //--------------------------------------------------------- class ExcDummy_00 - const BYTE ExcDummy_00::pMyData[] = { - 0xe1, 0x00, 0x00, 0x00, // INTERFACEHDR - 0xc1, 0x00, 0x02, 0x00, 0x00, 0x00, // MMS - 0xbf, 0x00, 0x00, 0x00, // TOOLBARHDR - 0xc0, 0x00, 0x00, 0x00, // TOOLBAREND - 0xe2, 0x00, 0x00, 0x00, // INTERFACEEND - 0x5c, 0x00, 0x20, 0x00, 0x04, 0x4d, 0x72, 0x20, 0x58, // WRITEACCESS + 0x5c, 0x00, 0x20, 0x00, 0x04, 'C', 'a', 'l', 'c', // WRITEACCESS 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - 0x42, 0x00, 0x02, 0x00, 0xe4, 0x04, // CODEPAGE - 0x9c, 0x00, 0x02, 0x00, 0x0e, 0x00 // FNGROUPCOUNT + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; const sal_Size ExcDummy_00::nMyLen = sizeof( ExcDummy_00::pMyData ); @@ -315,27 +308,6 @@ sal_Size ExcEof::GetLen( void ) const -//----------------------------------------------------- class ExcFngroupcount - - -void ExcFngroupcount::SaveCont( XclExpStream& rStrm ) -{ - rStrm << ( UINT16 ) 0x000E; // copied from Excel -} - - -UINT16 ExcFngroupcount::GetNum( void ) const -{ - return 0x009C; -} - - -sal_Size ExcFngroupcount::GetLen( void ) const -{ - return 2; -} - - - //--------------------------------------------------------- class ExcDummy_00 - sal_Size ExcDummy_00::GetLen( void ) const diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx index 11400ca20742..d698278d9d3c 100644 --- a/sc/source/filter/excel/exctools.cxx +++ b/sc/source/filter/excel/exctools.cxx @@ -68,7 +68,6 @@ RootData::RootData( void ) { eDateiTyp = BiffX; pExtSheetBuff = NULL; - pTabNameBuff = NULL; pShrfmlaBuff = NULL; pExtNameBuff = NULL; pFmlaConverter = NULL; @@ -90,7 +89,6 @@ RootData::RootData( void ) RootData::~RootData() { delete pExtSheetBuff; - delete pTabNameBuff; delete pShrfmlaBuff; delete pExtNameBuff; delete pAutoFilterBuffer; diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index 5a0ae1f9a972..9b868f4d3268 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -136,7 +136,6 @@ ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ): pExcRoot->pIR = this; // ExcRoot -> XclImpRoot pExcRoot->eDateiTyp = BiffX; pExcRoot->pExtSheetBuff = new ExtSheetBuffer( pExcRoot ); //&aExtSheetBuff; - pExcRoot->pTabNameBuff = new NameBuffer( pExcRoot ); //&aTabNameBuff; pExcRoot->pShrfmlaBuff = new ShrfmlaBuffer( pExcRoot ); //&aShrfrmlaBuff; pExcRoot->pExtNameBuff = new ExtNameBuff ( *this ); @@ -180,9 +179,19 @@ void ImportExcel::ReadFileSharing() { sal_uInt16 nRecommendReadOnly, nPasswordHash; maStrm >> nRecommendReadOnly >> nPasswordHash; + if( (nRecommendReadOnly != 0) || (nPasswordHash != 0) ) if( SfxItemSet* pItemSet = GetMedium().GetItemSet() ) pItemSet->Put( SfxBoolItem( SID_DOC_READONLY, TRUE ) ); + + if( nPasswordHash != 0 ) + { + if( SfxObjectShell* pDocShell = GetDocShell() ) + { + ScfPropertySet aPropSet( pDocShell->GetModel() ); + aPropSet.SetProperty( CREATE_OUSTRING( "WriteProtectionPassword" ), static_cast< sal_Int32 >( nPasswordHash ) ); + } + } } sal_uInt16 ImportExcel::ReadXFIndex( bool bBiff2 ) @@ -688,14 +697,14 @@ void ImportExcel::Boundsheet( void ) if( GetBiff() == EXC_BIFF5 ) { - aIn.Ignore( 4 ); + aIn.DisableDecryption(); + maSheetOffsets.push_back( aIn.ReaduInt32() ); + aIn.EnableDecryption(); aIn >> nGrbit; } String aName( aIn.ReadByteString( FALSE ) ); - *pExcRoot->pTabNameBuff << aName; - SCTAB nScTab = static_cast< SCTAB >( nBdshtTab ); if( nScTab > 0 ) { diff --git a/sc/source/filter/excel/makefile.mk b/sc/source/filter/excel/makefile.mk index 5b483f04729d..4c94b0712d89 100644 --- a/sc/source/filter/excel/makefile.mk +++ b/sc/source/filter/excel/makefile.mk @@ -121,6 +121,7 @@ EXCEPTIONSFILES = \ $(SLO)$/excimp8.obj \ $(SLO)$/excrecds.obj \ $(SLO)$/expop2.obj \ + $(SLO)$/impop.obj \ $(SLO)$/namebuff.obj \ $(SLO)$/tokstack.obj \ $(SLO)$/xecontent.obj \ diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx index a4a286d27171..afa66422ca44 100644 --- a/sc/source/filter/excel/read.cxx +++ b/sc/source/filter/excel/read.cxx @@ -99,9 +99,28 @@ FltError ImportExcel::Read( void ) ::std::auto_ptr< ScfSimpleProgressBar > pProgress( new ScfSimpleProgressBar( aIn.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC ) ); + /* #i104057# Need to track a base position for progress bar calculation, + because sheet substreams may not be in order of sheets. */ + sal_Size nProgressBasePos = 0; + sal_Size nProgressBaseSize = 0; + while( eAkt != Z_Ende ) { - aIn.StartNextRecord(); + if( eAkt == Z_Biff5E ) + { + sal_uInt16 nScTab = GetCurrScTab(); + if( nScTab < maSheetOffsets.size() ) + { + nProgressBaseSize += (aIn.GetSvStreamPos() - nProgressBasePos); + nProgressBasePos = maSheetOffsets[ nScTab ]; + aIn.StartNextRecord( nProgressBasePos ); + } + else + eAkt = Z_Ende; + } + else + aIn.StartNextRecord(); + nOpcode = aIn.GetRecId(); if( !aIn.IsValid() ) @@ -124,8 +143,11 @@ FltError ImportExcel::Read( void ) break; } + if( eAkt == Z_Ende ) + break; + if( eAkt != Z_Biff5TPre && eAkt != Z_Biff5WPre ) - pProgress->ProgressAbs( aIn.GetSvStreamPos() ); + pProgress->ProgressAbs( nProgressBaseSize + aIn.GetSvStreamPos() - nProgressBasePos ); switch( eAkt ) { @@ -804,9 +826,28 @@ FltError ImportExcel8::Read( void ) ::std::auto_ptr< ScfSimpleProgressBar > pProgress( new ScfSimpleProgressBar( aIn.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC ) ); + /* #i104057# Need to track a base position for progress bar calculation, + because sheet substreams may not be in order of sheets. */ + sal_Size nProgressBasePos = 0; + sal_Size nProgressBaseSize = 0; + while( eAkt != EXC_STATE_END ) { - aIn.StartNextRecord(); + if( eAkt == EXC_STATE_BEFORE_SHEET ) + { + sal_uInt16 nScTab = GetCurrScTab(); + if( nScTab < maSheetOffsets.size() ) + { + nProgressBaseSize += (aIn.GetSvStreamPos() - nProgressBasePos); + nProgressBasePos = maSheetOffsets[ nScTab ]; + aIn.StartNextRecord( nProgressBasePos ); + } + else + eAkt = EXC_STATE_END; + } + else + aIn.StartNextRecord(); + if( !aIn.IsValid() ) { // #124240# #i63591# finalize table if EOF is missing @@ -830,7 +871,7 @@ FltError ImportExcel8::Read( void ) break; if( eAkt != EXC_STATE_SHEET_PRE && eAkt != EXC_STATE_GLOBALS_PRE ) - pProgress->ProgressAbs( aIn.GetSvStreamPos() ); + pProgress->ProgressAbs( nProgressBaseSize + aIn.GetSvStreamPos() - nProgressBasePos ); sal_uInt16 nRecId = aIn.GetRecId(); diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index ef15b16030cf..849ac080bb1d 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -2170,10 +2170,15 @@ void XclExpFmlaCompImpl::PushOperatorPos( sal_uInt16 nTokPos, const XclExpOperan sal_uInt16 XclExpFmlaCompImpl::PopOperandPos() { - DBG_ASSERT( !mxData->maOpPosStack.empty(), "XclExpFmlaCompImpl::PopOperandPos - token stack broken" ); - sal_uInt16 nTokPos = mxData->maOpPosStack.back(); - mxData->maOpPosStack.pop_back(); - return nTokPos; + DBG_ASSERT( !mxData->mbOk || !mxData->maOpPosStack.empty(), "XclExpFmlaCompImpl::PopOperandPos - token stack broken" ); + mxData->mbOk &= !mxData->maOpPosStack.empty(); + if( mxData->mbOk ) + { + sal_uInt16 nTokPos = mxData->maOpPosStack.back(); + mxData->maOpPosStack.pop_back(); + return nTokPos; + } + return 0; } namespace { diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 2d920b0a0bd4..dc542a1c1eeb 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -2159,7 +2159,9 @@ void XclImpChChart3d::ReadChChart3d( XclImpStream& rStrm ) void XclImpChChart3d::Convert( ScfPropertySet& rPropSet, bool b3dWallChart ) const { namespace cssd = ::com::sun::star::drawing; - DBG_ASSERT( ::get_flag( maData.mnFlags, EXC_CHCHART3D_HASWALLS ) == b3dWallChart, "XclImpChChart3d::Convert - wrong wall flag" ); + +// #i104057# do not assert this, written by broken external generators +// DBG_ASSERT( ::get_flag( maData.mnFlags, EXC_CHCHART3D_HASWALLS ) == b3dWallChart, "XclImpChChart3d::Convert - wrong wall flag" ); sal_Int32 nRotationY = 0; sal_Int32 nRotationX = 0; diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 9033ecc125bd..00268215a5dc 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -153,6 +153,7 @@ struct XclImpXti sal_uInt16 mnSupbook; /// Index to SUPBOOK record. sal_uInt16 mnSBTabFirst; /// Index to the first sheet of the range in the SUPBOOK. sal_uInt16 mnSBTabLast; /// Index to the last sheet of the range in the SUPBOOK. + inline explicit XclImpXti() : mnSupbook( SAL_MAX_UINT16 ), mnSBTabFirst( SAL_MAX_UINT16 ), mnSBTabLast( SAL_MAX_UINT16 ) {} }; inline XclImpStream& operator>>( XclImpStream& rStrm, XclImpXti& rXti ) @@ -204,8 +205,10 @@ public: const String& GetMacroName( sal_uInt16 nExtSheet, sal_uInt16 nExtName ) const; private: + /** Returns the specified XTI (link entry from BIFF8 EXTERNSHEET record). */ + const XclImpXti* GetXti( sal_uInt16 nXtiIndex ) const; /** Returns the specified SUPBOOK (external document). */ - const XclImpSupbook* GetSupbook( sal_uInt32 nXtiIndex ) const; + const XclImpSupbook* GetSupbook( sal_uInt16 nXtiIndex ) const; //UNUSED2009-05 /** Returns the SUPBOOK (external workbook) specified by its URL. */ //UNUSED2009-05 const XclImpSupbook* GetSupbook( const String& rUrl ) const; @@ -222,10 +225,10 @@ private: //UNUSED2009-05 sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const; private: - typedef ScfDelList< XclImpXti > XclImpXtiList; + typedef ::std::vector< XclImpXti > XclImpXtiVector; typedef ScfDelList< XclImpSupbook > XclImpSupbookList; - XclImpXtiList maXtiList; /// List of all XTI structures. + XclImpXtiVector maXtiList; /// List of all XTI structures. XclImpSupbookList maSupbookList; /// List of external documents. bool mbCreated; /// true = Calc sheets already created. }; @@ -582,15 +585,17 @@ void XclImpLinkManagerImpl::ReadExternsheet( XclImpStream& rStrm ) { sal_uInt16 nXtiCount; rStrm >> nXtiCount; - - XclImpXti* pXti; - while( nXtiCount ) - { - pXti = new XclImpXti; - rStrm >> *pXti; - maXtiList.Append( pXti ); - --nXtiCount; - } + DBG_ASSERT( static_cast< sal_Size >( nXtiCount * 6 ) == rStrm.GetRecLeft(), "XclImpLinkManagerImpl::ReadExternsheet - invalid count" ); + nXtiCount = static_cast< sal_uInt16 >( ::std::min< sal_Size >( nXtiCount, rStrm.GetRecLeft() / 6 ) ); + + /* #i104057# A weird external XLS generator writes multiple EXTERNSHEET + records instead of only one as expected. Surprisingly, Excel seems to + insert the entries of the second record before the entries of the first + record. */ + XclImpXtiVector aNewEntries( nXtiCount ); + for( XclImpXtiVector::iterator aIt = aNewEntries.begin(), aEnd = aNewEntries.end(); rStrm.IsValid() && (aIt != aEnd); ++aIt ) + rStrm >> *aIt; + maXtiList.insert( maXtiList.begin(), aNewEntries.begin(), aNewEntries.end() ); LoadCachedValues(); } @@ -627,7 +632,7 @@ bool XclImpLinkManagerImpl::IsSelfRef( sal_uInt16 nXtiIndex ) const bool XclImpLinkManagerImpl::GetScTabRange( SCTAB& rnFirstScTab, SCTAB& rnLastScTab, sal_uInt16 nXtiIndex ) const { - if( const XclImpXti* pXti = maXtiList.GetObject( nXtiIndex ) ) + if( const XclImpXti* pXti = GetXti( nXtiIndex ) ) { if (maSupbookList.GetObject(pXti->mnSupbook)) { @@ -671,9 +676,14 @@ const String& XclImpLinkManagerImpl::GetMacroName( sal_uInt16 nExtSheet, sal_uIn return pSupbook ? pSupbook->GetMacroName( nExtName ) : EMPTY_STRING; } -const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( sal_uInt32 nXtiIndex ) const +const XclImpXti* XclImpLinkManagerImpl::GetXti( sal_uInt16 nXtiIndex ) const +{ + return (nXtiIndex < maXtiList.size()) ? &maXtiList[ nXtiIndex ] : 0; +} + +const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( sal_uInt16 nXtiIndex ) const { - const XclImpXti* pXti = maXtiList.GetObject( nXtiIndex ); + const XclImpXti* pXti = GetXti( nXtiIndex ); return pXti ? maSupbookList.GetObject( pXti->mnSupbook ) : 0; } diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index b168c4389c4c..a040f21b1c4f 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -414,6 +414,12 @@ bool XclImpStream::StartNextRecord() return mbValidRec; } +bool XclImpStream::StartNextRecord( sal_Size nNextRecPos ) +{ + mnNextRecPos = nNextRecPos; + return StartNextRecord(); +} + void XclImpStream::ResetRecord( bool bContLookup, sal_uInt16 nAltContId ) { if( mbValidRec ) diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index a83e203c167d..07368f6db680 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -968,9 +968,7 @@ XclImpXF::XclImpXF( const XclImpRoot& rRoot ) : XclImpRoot( rRoot ), mpStyleSheet( 0 ), mnXclNumFmt( 0 ), - mnXclFont( 0 ), - mbWasBuiltIn( false ), - mbForceCreate( false ) + mnXclFont( 0 ) { } @@ -1088,31 +1086,61 @@ void XclImpXF::ReadXF( XclImpStream& rStrm ) } } -void XclImpXF::SetStyleName( const String& rStyleName, bool bBuiltIn, bool bForceCreate ) +const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs ) { - DBG_ASSERT( IsStyleXF(), "XclImpXF::SetStyleName - not a style XF" ); - DBG_ASSERT( rStyleName.Len() > 0, "XclImpXF::SetStyleName - style name empty" ); - if( IsStyleXF() && (rStyleName.Len() > 0) ) + if( mpPattern.get() ) + return *mpPattern; + + // create new pattern attribute set + mpPattern.reset( new ScPatternAttr( GetDoc().GetPool() ) ); + SfxItemSet& rItemSet = mpPattern->GetItemSet(); + + // parent cell style + if( IsCellXF() && !mpStyleSheet ) { - maStyleName = rStyleName; - mbWasBuiltIn = bBuiltIn; - mbForceCreate = bForceCreate; + mpStyleSheet = GetXFBuffer().CreateStyleSheet( mnParent ); + if( XclImpXF* pParentXF = GetXFBuffer().GetXF( mnParent ) ) + UpdateUsedFlags( *pParentXF ); } -} -void XclImpXF::ChangeStyleName( const String& rStyleName ) -{ - DBG_ASSERT( IsStyleXF(), "XclImpXF::ChangeStyleName - not a style XF" ); - DBG_ASSERT( rStyleName.Len() > 0, "XclImpXF::ChangeStyleName - new style name empty" ); - DBG_ASSERT( maStyleName.Len() > 0, "XclImpXF::ChangeStyleName - old style name empty" ); - if( IsStyleXF() && (rStyleName.Len() > 0) ) - maStyleName = rStyleName; -} + // cell protection + if( mbProtUsed ) + maProtection.FillToItemSet( rItemSet, bSkipPoolDefs ); -void XclImpXF::CreateUserStyle() -{ - if( IsStyleXF() && mbForceCreate ) - CreateStyleSheet(); + // font + if( mbFontUsed ) + GetFontBuffer().FillToItemSet( rItemSet, EXC_FONTITEM_CELL, mnXclFont, bSkipPoolDefs ); + + // value format + if( mbFmtUsed ) + { + GetNumFmtBuffer().FillToItemSet( rItemSet, mnXclNumFmt, bSkipPoolDefs ); + // Trace occurrences of Windows date formats + GetTracer().TraceDates( mnXclNumFmt ); + } + + // alignment + if( mbAlignUsed ) + maAlignment.FillToItemSet( rItemSet, GetFontBuffer().GetFont( mnXclFont ), bSkipPoolDefs ); + + // border + if( mbBorderUsed ) + { + maBorder.FillToItemSet( rItemSet, GetPalette(), bSkipPoolDefs ); + GetTracer().TraceBorderLineStyle(maBorder.mnLeftLine > EXC_LINE_HAIR || + maBorder.mnRightLine > EXC_LINE_HAIR || maBorder.mnTopLine > EXC_LINE_HAIR || + maBorder.mnBottomLine > EXC_LINE_HAIR ); + } + + // area + if( mbAreaUsed ) + { + maArea.FillToItemSet( rItemSet, GetPalette(), bSkipPoolDefs ); + GetTracer().TraceFillPattern(maArea.mnPattern != EXC_PATT_NONE && + maArea.mnPattern != EXC_PATT_SOLID); + } + + return *mpPattern; } void XclImpXF::ApplyPattern( @@ -1175,80 +1203,71 @@ void XclImpXF::UpdateUsedFlags( const XclImpXF& rParentXF ) mbAreaUsed = !rParentXF.mbAreaUsed || !(maArea == rParentXF.maArea); } -const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs ) -{ - if( mpPattern.get() ) - return *mpPattern; - - // create new pattern attribute set - mpPattern.reset( new ScPatternAttr( GetDoc().GetPool() ) ); - SfxItemSet& rItemSet = mpPattern->GetItemSet(); - - // parent cell style - if( IsCellXF() ) - { - if( XclImpXF* pParentXF = GetXFBuffer().GetXF( mnParent ) ) - { - mpStyleSheet = pParentXF->CreateStyleSheet(); - UpdateUsedFlags( *pParentXF ); - } - } - - // cell protection - if( mbProtUsed ) - maProtection.FillToItemSet( rItemSet, bSkipPoolDefs ); +// ---------------------------------------------------------------------------- - // font - if( mbFontUsed ) - GetFontBuffer().FillToItemSet( rItemSet, EXC_FONTITEM_CELL, mnXclFont, bSkipPoolDefs ); +XclImpStyle::XclImpStyle( const XclImpRoot& rRoot ) : + XclImpRoot( rRoot ), + mnXfId( EXC_XF_NOTFOUND ), + mnBuiltinId( EXC_STYLE_USERDEF ), + mnLevel( EXC_STYLE_NOLEVEL ), + mbBuiltin( false ), + mbCustom( false ), + mbHidden( false ), + mpStyleSheet( 0 ) +{ +} - // value format - if( mbFmtUsed ) - { - GetNumFmtBuffer().FillToItemSet( rItemSet, mnXclNumFmt, bSkipPoolDefs ); - // Trace occurrences of Windows date formats - GetTracer().TraceDates( mnXclNumFmt ); - } +void XclImpStyle::ReadStyle( XclImpStream& rStrm ) +{ + DBG_ASSERT_BIFF( GetBiff() >= EXC_BIFF3 ); - // alignment - if( mbAlignUsed ) - maAlignment.FillToItemSet( rItemSet, GetFontBuffer().GetFont( mnXclFont ), bSkipPoolDefs ); + sal_uInt16 nXFIndex; + rStrm >> nXFIndex; + mnXfId = nXFIndex & EXC_STYLE_XFMASK; + mbBuiltin = ::get_flag( nXFIndex, EXC_STYLE_BUILTIN ); - // border - if( mbBorderUsed ) + if( mbBuiltin ) { - maBorder.FillToItemSet( rItemSet, GetPalette(), bSkipPoolDefs ); - GetTracer().TraceBorderLineStyle(maBorder.mnLeftLine > EXC_LINE_HAIR || - maBorder.mnRightLine > EXC_LINE_HAIR || maBorder.mnTopLine > EXC_LINE_HAIR || - maBorder.mnBottomLine > EXC_LINE_HAIR ); + rStrm >> mnBuiltinId >> mnLevel; } - - // area - if( mbAreaUsed ) + else { - maArea.FillToItemSet( rItemSet, GetPalette(), bSkipPoolDefs ); - GetTracer().TraceFillPattern(maArea.mnPattern != EXC_PATT_NONE && - maArea.mnPattern != EXC_PATT_SOLID); + maName = (GetBiff() <= EXC_BIFF5) ? rStrm.ReadByteString( false ) : rStrm.ReadUniString(); + // #i103281# check if this is a new built-in style introduced in XL2007 + if( (GetBiff() == EXC_BIFF8) && (rStrm.GetNextRecId() == EXC_ID_STYLEEXT) && rStrm.StartNextRecord() ) + { + sal_uInt8 nExtFlags; + rStrm.Ignore( 12 ); + rStrm >> nExtFlags; + mbBuiltin = ::get_flag( nExtFlags, EXC_STYLEEXT_BUILTIN ); + mbCustom = ::get_flag( nExtFlags, EXC_STYLEEXT_CUSTOM ); + mbHidden = ::get_flag( nExtFlags, EXC_STYLEEXT_HIDDEN ); + if( mbBuiltin ) + { + rStrm.Ignore( 1 ); // category + rStrm >> mnBuiltinId >> mnLevel; + } + } } - - return *mpPattern; } -ScStyleSheet* XclImpXF::CreateStyleSheet() +ScStyleSheet* XclImpStyle::CreateStyleSheet() { - if( !mpStyleSheet && maStyleName.Len() ) // valid name implies style XF + // #i1624# #i1768# ignore unnamed user styles + if( !mpStyleSheet && (maFinalName.Len() > 0) ) { bool bCreatePattern = false; - // there may be a user-defined "Default" - test on built-in too! - bool bDefStyle = mbWasBuiltIn && (maStyleName == ScGlobal::GetRscString( STR_STYLENAME_STANDARD )); + XclImpXF* pXF = GetXFBuffer().GetXF( mnXfId ); + + bool bDefStyle = mbBuiltin && (mnBuiltinId == EXC_STYLE_NORMAL); if( bDefStyle ) { - // set all flags to true to get all items in CreatePattern() - SetAllUsedFlags( true ); + // set all flags to true to get all items in XclImpXF::CreatePattern() + if( pXF ) pXF->SetAllUsedFlags( true ); // use existing "Default" style sheet mpStyleSheet = static_cast< ScStyleSheet* >( GetStyleSheetPool().Find( ScGlobal::GetRscString( STR_STYLENAME_STANDARD ), SFX_STYLE_FAMILY_PARA ) ); - DBG_ASSERT( mpStyleSheet, "XclImpXF::CreateStyleSheet - Default style not found" ); + DBG_ASSERT( mpStyleSheet, "XclImpStyle::CreateStyleSheet - Default style not found" ); bCreatePattern = true; } else @@ -1256,21 +1275,28 @@ ScStyleSheet* XclImpXF::CreateStyleSheet() /* #i103281# do not create another style sheet of the same name, if it exists already. This is needed to prevent that styles pasted from clipboard get duplicated over and over. */ - mpStyleSheet = static_cast< ScStyleSheet* >( GetStyleSheetPool().Find( maStyleName, SFX_STYLE_FAMILY_PARA ) ); + mpStyleSheet = static_cast< ScStyleSheet* >( GetStyleSheetPool().Find( maFinalName, SFX_STYLE_FAMILY_PARA ) ); if( !mpStyleSheet ) { - mpStyleSheet = &static_cast< ScStyleSheet& >( GetStyleSheetPool().Make( maStyleName, SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_USERDEF ) ); + mpStyleSheet = &static_cast< ScStyleSheet& >( GetStyleSheetPool().Make( maFinalName, SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_USERDEF ) ); bCreatePattern = true; } } // bDefStyle==true omits default pool items in CreatePattern() - if( bCreatePattern && mpStyleSheet ) - mpStyleSheet->GetItemSet().Put( CreatePattern( bDefStyle ).GetItemSet() ); + if( bCreatePattern && mpStyleSheet && pXF ) + mpStyleSheet->GetItemSet().Put( pXF->CreatePattern( bDefStyle ).GetItemSet() ); } return mpStyleSheet; } +void XclImpStyle::CreateUserStyle( const String& rFinalName ) +{ + maFinalName = rFinalName; + if( !IsBuiltin() || mbCustom ) + CreateStyleSheet(); +} + // ---------------------------------------------------------------------------- XclImpXFBuffer::XclImpXFBuffer( const XclImpRoot& rRoot ) : @@ -1281,16 +1307,9 @@ XclImpXFBuffer::XclImpXFBuffer( const XclImpRoot& rRoot ) : void XclImpXFBuffer::Initialize() { maXFList.Clear(); - maStyleXFs.clear(); - /* Reserve style names that are built-in in Calc. For BIFF4 workbooks - which contain a separate list of styles per sheet, reserve all existing - names if current sheet is not the first sheet. This will create unique - names for styles in different sheets with the same name. */ - bool bReserveAll = (GetBiff() == EXC_BIFF4) && (GetCurrScTab() > 0); - SfxStyleSheetIterator aStyleIter( GetDoc().GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA ); - for( SfxStyleSheetBase* pStyleSheet = aStyleIter.First(); pStyleSheet; pStyleSheet = aStyleIter.Next() ) - if( bReserveAll || !pStyleSheet->IsUserDefined() ) - maStyleXFs[ pStyleSheet->GetName() ] = 0; + maBuiltinStyles.Clear(); + maUserStyles.Clear(); + maStylesByXf.clear(); } void XclImpXFBuffer::ReadXF( XclImpStream& rStrm ) @@ -1298,51 +1317,15 @@ void XclImpXFBuffer::ReadXF( XclImpStream& rStrm ) XclImpXF* pXF = new XclImpXF( GetRoot() ); pXF->ReadXF( rStrm ); maXFList.Append( pXF ); - - // set the name of the "Default" cell style (always the first XF in an Excel file) - if( (GetBiff() >= EXC_BIFF3) && (maXFList.Count() == 1) ) - CalcStyleName( *pXF, EXC_STYLE_NORMAL, 0 ); } void XclImpXFBuffer::ReadStyle( XclImpStream& rStrm ) { - DBG_ASSERT_BIFF( GetBiff() >= EXC_BIFF3 ); - - sal_uInt16 nXFIndex; - rStrm >> nXFIndex; - - XclImpXF* pXF = GetXF( nXFIndex & EXC_STYLE_XFMASK ); // bits 0...11 are used for XF index - if( pXF && pXF->IsStyleXF() ) - { - if( ::get_flag( nXFIndex, EXC_STYLE_BUILTIN ) ) // built-in styles - { - sal_uInt8 nStyleId, nLevel; - rStrm >> nStyleId >> nLevel; - CalcStyleName( *pXF, nStyleId, nLevel ); - } - else // user-defined styles - { - String aStyleName; - if( GetBiff() <= EXC_BIFF5 ) - aStyleName = rStrm.ReadByteString( false ); // 8 bit length - else - aStyleName = rStrm.ReadUniString(); - - if( aStyleName.Len() > 0 ) // #i1624# #i1768# ignore unnamed styles - { - // #i103281# check if this is a new built-in style introduced in XL2007 - bool bBuiltIn = false; - if( (GetBiff() == EXC_BIFF8) && (rStrm.GetNextRecId() == EXC_ID_STYLEEXT) && rStrm.StartNextRecord() ) - { - sal_uInt8 nExtFlags; - rStrm.Ignore( 12 ); - rStrm >> nExtFlags; - bBuiltIn = ::get_flag( nExtFlags, EXC_STYLEEXT_BUILTIN ); - } - CalcStyleName( *pXF, aStyleName, bBuiltIn ); - } - } - } + XclImpStyle* pStyle = new XclImpStyle( GetRoot() ); + pStyle->ReadStyle( rStrm ); + (pStyle->IsBuiltin() ? maBuiltinStyles : maUserStyles).Append( pStyle ); + DBG_ASSERT( maStylesByXf.count( pStyle->GetXfId() ) == 0, "XclImpXFBuffer::ReadStyle - multiple styles with equal XF identifier" ); + maStylesByXf[ pStyle->GetXfId() ] = pStyle; } sal_uInt16 XclImpXFBuffer::GetFontIndex( sal_uInt16 nXFIndex ) const @@ -1356,64 +1339,104 @@ const XclImpFont* XclImpXFBuffer::GetFont( sal_uInt16 nXFIndex ) const return GetFontBuffer().GetFont( GetFontIndex( nXFIndex ) ); } -void XclImpXFBuffer::CreateUserStyles() +namespace { + +/** Functor for case-insensitive string comparison, usable in maps etc. */ +struct IgnoreCaseCompare { - for( XclImpXF* pXF = maXFList.First(); pXF; pXF = maXFList.Next() ) - pXF->CreateUserStyle(); -} + inline bool operator()( const String& rName1, const String& rName2 ) const + { return rName1.CompareIgnoreCaseToAscii( rName2 ) == COMPARE_LESS; } +}; -void XclImpXFBuffer::ApplyPattern( - SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2, - SCTAB nScTab, const XclImpXFIndex& rXFIndex ) +} // namespace + +void XclImpXFBuffer::CreateUserStyles() { - if( XclImpXF* pXF = GetXF( rXFIndex.GetXFIndex() ) ) + // calculate final names of all styles + typedef ::std::map< String, XclImpStyle*, IgnoreCaseCompare > CellStyleNameMap; + typedef ::std::vector< XclImpStyle* > XclImpStyleVector; + + CellStyleNameMap aCellStyles; + XclImpStyleVector aConflictNameStyles; + + /* First, reserve style names that are built-in in Calc. This causes that + imported cell styles get different unused names and thus do not try to + overwrite these built-in styles. For BIFF4 workbooks (which contain a + separate list of cell styles per sheet), reserve all existing styles if + current sheet is not the first sheet (this styles buffer will be + initialized again for every new sheet). This will create unique names + for styles in different sheets with the same name. Assuming that the + BIFF4W import filter is never used to import from clipboard... */ + bool bReserveAll = (GetBiff() == EXC_BIFF4) && (GetCurrScTab() > 0); + SfxStyleSheetIterator aStyleIter( GetDoc().GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA ); + String aStandardName = ScGlobal::GetRscString( STR_STYLENAME_STANDARD ); + for( SfxStyleSheetBase* pStyleSheet = aStyleIter.First(); pStyleSheet; pStyleSheet = aStyleIter.Next() ) + if( (pStyleSheet->GetName() != aStandardName) && (bReserveAll || !pStyleSheet->IsUserDefined()) ) + if( aCellStyles.count( pStyleSheet->GetName() ) == 0 ) + aCellStyles[ pStyleSheet->GetName() ] = 0; + + /* Calculate names of built-in styles. Store styles with reserved names + in the aConflictNameStyles list. */ + for( XclImpStyle* pStyle = maBuiltinStyles.First(); pStyle; pStyle = maBuiltinStyles.Next() ) { - // #108770# set 'Standard' number format for all Boolean cells - ULONG nForceScNumFmt = rXFIndex.IsBoolCell() ? GetNumFmtBuffer().GetStdScNumFmt() : NUMBERFORMAT_ENTRY_NOT_FOUND; - pXF->ApplyPattern( nScCol1, nScRow1, nScCol2, nScRow2, nScTab, nForceScNumFmt ); + String aStyleName = XclTools::GetBuiltInStyleName( pStyle->GetBuiltinId(), pStyle->GetName(), pStyle->GetLevel() ); + DBG_ASSERT( bReserveAll || (aCellStyles.count( aStyleName ) == 0), + "XclImpXFBuffer::CreateUserStyles - multiple styles with equal built-in identifier" ); + if( aCellStyles.count( aStyleName ) > 0 ) + aConflictNameStyles.push_back( pStyle ); + else + aCellStyles[ aStyleName ] = pStyle; } -} -void XclImpXFBuffer::CalcStyleName( XclImpXF& rXF, const String& rStyleName, bool bBuiltIn ) -{ - DBG_ASSERT( rStyleName.Len() > 0, "XclImpXFBuffer::CalcStyleName - style name empty" ); - if( rStyleName.Len() > 0 ) + /* Calculate names of user defined styles. Store styles with reserved + names in the aConflictNameStyles list. */ + for( XclImpStyle* pStyle = maUserStyles.First(); pStyle; pStyle = maUserStyles.Next() ) { - String aStyleName = bBuiltIn ? XclTools::GetBuiltInStyleName( rStyleName ) : rStyleName; - SetStyleName( rXF, aStyleName, bBuiltIn, !bBuiltIn ); + // #i1624# #i1768# ignore unnamed user styles + if( pStyle->GetName().Len() > 0 ) + { + if( aCellStyles.count( pStyle->GetName() ) > 0 ) + aConflictNameStyles.push_back( pStyle ); + else + aCellStyles[ pStyle->GetName() ] = pStyle; + } } + + // find unused names for all styles with conflicting names + for( XclImpStyleVector::iterator aIt = aConflictNameStyles.begin(), aEnd = aConflictNameStyles.end(); aIt != aEnd; ++aIt ) + { + XclImpStyle* pStyle = *aIt; + String aUnusedName; + sal_Int32 nIndex = 0; + do + { + aUnusedName.Assign( pStyle->GetName() ).Append( ' ' ).Append( String::CreateFromInt32( ++nIndex ) ); + } + while( aCellStyles.count( aUnusedName ) > 0 ); + aCellStyles[ aUnusedName ] = pStyle; + } + + // set final names and create user-defined and modified built-in cell styles + for( CellStyleNameMap::iterator aIt = aCellStyles.begin(), aEnd = aCellStyles.end(); aIt != aEnd; ++aIt ) + if( aIt->second ) + aIt->second->CreateUserStyle( aIt->first ); } -void XclImpXFBuffer::CalcStyleName( XclImpXF& rXF, sal_uInt8 nStyleId, sal_uInt8 nLevel ) +ScStyleSheet* XclImpXFBuffer::CreateStyleSheet( sal_uInt16 nXFIndex ) { - // force creation of "Default" style - SetStyleName( rXF, XclTools::GetBuiltInStyleName( nStyleId, nLevel ), true, nStyleId == EXC_STYLE_NORMAL ); + XclImpStyleMap::iterator aIt = maStylesByXf.find( nXFIndex ); + return (aIt == maStylesByXf.end()) ? 0 : aIt->second->CreateStyleSheet(); } -void XclImpXFBuffer::SetStyleName( XclImpXF& rXF, const String& rStyleName, bool bBuiltIn, bool bForceCreate ) +void XclImpXFBuffer::ApplyPattern( + SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2, + SCTAB nScTab, const XclImpXFIndex& rXFIndex ) { - DBG_ASSERT( rXF.IsStyleXF(), "XclImpXFBuffer::SetStyleName - not a style XF" ); - if( rXF.IsStyleXF() ) + if( XclImpXF* pXF = GetXF( rXFIndex.GetXFIndex() ) ) { - // find an unused name - String aUnusedName( rStyleName ); - sal_Int32 nIndex = 0; - while( maStyleXFs.count( aUnusedName ) > 0 ) - aUnusedName.Assign( rStyleName ).Append( ' ' ).Append( String::CreateFromInt32( ++nIndex ) ); - - // move old style to new name, if new style is built-in - if( bBuiltIn && (aUnusedName != rStyleName) ) - { - XclImpXF*& rpXF = maStyleXFs[ aUnusedName ]; - rpXF = maStyleXFs[ rStyleName ]; - if( rpXF ) - rpXF->ChangeStyleName( aUnusedName ); - aUnusedName = rStyleName; - } - - // insert new style - maStyleXFs[ aUnusedName ] = &rXF; - rXF.SetStyleName( aUnusedName, bBuiltIn, bForceCreate ); + // #108770# set 'Standard' number format for all Boolean cells + ULONG nForceScNumFmt = rXFIndex.IsBoolCell() ? GetNumFmtBuffer().GetStdScNumFmt() : NUMBERFORMAT_ENTRY_NOT_FOUND; + pXF->ApplyPattern( nScCol1, nScRow1, nScCol2, nScRow2, nScTab, nForceScNumFmt ); } } diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index 5e6c85b49077..b8c18eb3e7c0 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -30,18 +30,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" - -// XXX xestream.hxx MUST be included before xlformula.hxx because of the -// redifinition of the CREATE_OUSTRING() macro, which is in oox/helper.hxx -// (indirectly included via xestream.hxx) and ../inc/ftools.hxx (indirectly -// included via xlformula.hxx) that does an undef first. Ugly. -#include "xestream.hxx" #include "xlformula.hxx" #include "compiler.hxx" #include "rangenam.hxx" #include "token.hxx" #include "tokenarray.hxx" +#include "xestream.hxx" #include "xistream.hxx" #include "xlroot.hxx" diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 29522f4f50ff..0b6af9da2e63 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -95,6 +96,11 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium, mnScTab( 0 ), mbExport( bExport ) { + // user name + maUserName = SvtUserOptions().GetLastName(); + if( maUserName.Len() == 0 ) + maUserName = CREATE_STRING( "Calc" ); + // default script type, e.g. for empty cells switch( ScGlobal::GetDefaultScriptType() ) { diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index a84aaba82b90..6398e25b9be7 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -426,16 +426,19 @@ rtl_TextEncoding XclTools::GetTextEncoding( sal_uInt16 nCodePage ) return pEntry->meTextEnc; } -//UNUSED2008-05 sal_uInt16 XclTools::GetXclCodePage( rtl_TextEncoding eTextEnc ) -//UNUSED2008-05 { -//UNUSED2008-05 const XclCodePageEntry* pEntry = ::std::find_if( pCodePageTable, pCodePageTableEnd, XclCodePageEntry_TEPred( eTextEnc ) ); -//UNUSED2008-05 if( pEntry == pCodePageTableEnd ) -//UNUSED2008-05 { -//UNUSED2008-05 DBG_ERROR1( "XclTools::GetXclCodePage - unsupported text encoding: %d", eTextEnc ); -//UNUSED2008-05 return 1252; -//UNUSED2008-05 } -//UNUSED2008-05 return pEntry->mnCodePage; -//UNUSED2008-05 } +sal_uInt16 XclTools::GetXclCodePage( rtl_TextEncoding eTextEnc ) +{ + if( eTextEnc == RTL_TEXTENCODING_UNICODE ) + return 1200; // for BIFF8 + + const XclCodePageEntry* pEntry = ::std::find_if( pCodePageTable, pCodePageTableEnd, XclCodePageEntry_TEPred( eTextEnc ) ); + if( pEntry == pCodePageTableEnd ) + { + DBG_ERROR1( "XclTools::GetXclCodePage - unsupported text encoding: %d", eTextEnc ); + return 1252; + } + return pEntry->mnCodePage; +} // font names ----------------------------------------------------------------- @@ -528,17 +531,26 @@ static const sal_Char* const ppcStyleNames[] = "Followed_Hyperlink" }; -String XclTools::GetBuiltInStyleName( sal_uInt8 nStyleId, sal_uInt8 nLevel ) +String XclTools::GetBuiltInStyleName( sal_uInt8 nStyleId, const String& rName, sal_uInt8 nLevel ) { String aStyleName; if( nStyleId == EXC_STYLE_NORMAL ) // "Normal" becomes "Default" style + { aStyleName = ScGlobal::GetRscString( STR_STYLENAME_STANDARD ); - else if( nStyleId < STATIC_TABLE_SIZE( ppcStyleNames ) ) - aStyleName.Assign( maStyleNamePrefix1 ).AppendAscii( ppcStyleNames[ nStyleId ] ); - - if( (nStyleId == EXC_STYLE_ROWLEVEL) || (nStyleId == EXC_STYLE_COLLEVEL) ) - aStyleName.Append( String::CreateFromInt32( nLevel + 1 ) ); + } + else + { + aStyleName = maStyleNamePrefix1; + if( nStyleId < STATIC_TABLE_SIZE( ppcStyleNames ) ) + aStyleName.AppendAscii( ppcStyleNames[ nStyleId ] ); + else if( rName.Len() > 0 ) + aStyleName.Append( rName ); + else + aStyleName.Append( String::CreateFromInt32( nStyleId ) ); + if( (nStyleId == EXC_STYLE_ROWLEVEL) || (nStyleId == EXC_STYLE_COLLEVEL) ) + aStyleName.Append( String::CreateFromInt32( nLevel + 1 ) ); + } return aStyleName; } diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx index 568032aa317f..79607802ccdc 100644 --- a/sc/source/filter/inc/excrecds.hxx +++ b/sc/source/filter/inc/excrecds.hxx @@ -210,18 +210,6 @@ public: }; -//----------------------------------------------------- class ExcFngroupcount - - -class ExcFngroupcount : public ExcRecord -{ -private: - virtual void SaveCont( XclExpStream& rStrm ); -public: - virtual UINT16 GetNum( void ) const; - virtual sal_Size GetLen( void ) const; -}; - - //--------------------------------------------------------- class ExcDummy_00 - // INTERFACEHDR to FNGROUPCOUNT (see excrecds.cxx) diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index 393775e721f7..5fd338a73bb5 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -38,6 +38,7 @@ #include #include #include +#include #include "filter.hxx" #include "scdllapi.h" @@ -50,9 +51,6 @@ /** Expands to a temporary String, created from an ASCII character array. */ #define CREATE_STRING( ascii ) String( RTL_CONSTASCII_USTRINGPARAM( ascii ) ) -/** Expands to a temporary ::rtl::OUString, created from an ASCII character array. */ -#undef CREATE_OUSTRING -#define CREATE_OUSTRING( ascii ) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ascii ) ) // items and item sets -------------------------------------------------------- diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx index ab5513ead1ed..fa0e6b7f5074 100644 --- a/sc/source/filter/inc/imp_op.hxx +++ b/sc/source/filter/inc/imp_op.hxx @@ -99,6 +99,8 @@ protected: XclImpStream maStrm; // input stream XclImpStream& aIn; // input stream + ScfUInt32Vec maSheetOffsets; + NameBuffer* pExtNameBuff; // ... externe Namen (Ind.-Basis=1) ExcelToSc* pFormConv; // Formel-Konverter diff --git a/sc/source/filter/inc/root.hxx b/sc/source/filter/inc/root.hxx index 3aa94ca542b1..ffff5dd9ff94 100644 --- a/sc/source/filter/inc/root.hxx +++ b/sc/source/filter/inc/root.hxx @@ -67,7 +67,6 @@ struct RootData // -> Inkarnation jeweils im ImportExcel-Objekt! { BiffTyp eDateiTyp; // feine Differenzierung ExtSheetBuffer* pExtSheetBuff; - NameBuffer* pTabNameBuff; ShrfmlaBuffer* pShrfmlaBuff; ExtNameBuff* pExtNameBuff; ExcelToSc* pFmlaConverter; diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx index 649a7bd02702..ef97a60a8a8e 100644 --- a/sc/source/filter/inc/xcl97rec.hxx +++ b/sc/source/filter/inc/xcl97rec.hxx @@ -412,7 +412,7 @@ private: sal_Size nRecLen; XclExpString sName; XclExpString sComment; - static XclExpString sUsername; + XclExpString sUserName; UINT8 nProtected; inline ExcEScenarioCell* _First() { return (ExcEScenarioCell*) List::First(); } @@ -424,7 +424,7 @@ private: protected: public: - ExcEScenario( ScDocument& rDoc, SCTAB nTab ); + ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab ); virtual ~ExcEScenario(); virtual UINT16 GetNum() const; @@ -450,7 +450,7 @@ private: protected: public: - ExcEScenarioManager( ScDocument& rDoc, SCTAB nTab ); + ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab ); virtual ~ExcEScenarioManager(); virtual void Save( XclExpStream& rStrm ); @@ -558,53 +558,14 @@ private: // ============================================================================ -class XclExpFnGroupCount : public XclExpRecord -{ -public: - explicit XclExpFnGroupCount(); - virtual ~XclExpFnGroupCount(); - -private: - virtual void WriteBody( XclExpStream& rStrm ); -}; - -// ============================================================================ - /** Beginning of User Interface Records */ -class XclExpInterfaceHdr : public XclExpRecord +class XclExpInterfaceHdr : public XclExpUInt16Record { public: - explicit XclExpInterfaceHdr(); - virtual ~XclExpInterfaceHdr(); + explicit XclExpInterfaceHdr( sal_uInt16 nCodePage ); private: - virtual void WriteBody( XclExpStream& rStrm ); -}; - -// ============================================================================ - -/** Beginning of User Interface Records */ -class XclExpInterfaceEnd : public XclExpRecord -{ -public: - explicit XclExpInterfaceEnd(); - virtual ~XclExpInterfaceEnd(); - -private: - virtual void WriteBody( XclExpStream& rStrm ); -}; - -// ============================================================================ - -/** ADDMENU/DELMENU Record Group Count */ -class XclExpMMS : public XclExpRecord -{ -public: - explicit XclExpMMS(); - virtual ~XclExpMMS(); - -private: - virtual void WriteBody( XclExpStream& rStrm ); + virtual void WriteBody( XclExpStream& rStrm ); }; // ============================================================================ @@ -623,26 +584,19 @@ private: // ============================================================================ -class XclExpCodePage : public XclExpRecord +class XclExpFileSharing : public XclExpRecord { public: - explicit XclExpCodePage(); - virtual ~XclExpCodePage(); - -private: - virtual void WriteBody( XclExpStream& rStrm ); -}; + explicit XclExpFileSharing( const XclExpRoot& rRoot, sal_uInt16 nPasswordHash ); -// ============================================================================ + virtual void Save( XclExpStream& rStrm ); -class XclExpDSF : public XclExpRecord -{ -public: - explicit XclExpDSF(); - virtual ~XclExpDSF(); +private: + virtual void WriteBody( XclExpStream& rStrm ); private: - virtual void WriteBody( XclExpStream& rStrm ); + XclExpString maUserName; + sal_uInt16 mnPasswordHash; }; // ============================================================================ @@ -671,19 +625,6 @@ private: // ============================================================================ -/** What's this record for? It is a zero-byte record. */ -class XclExpExcel9File : public XclExpRecord -{ -public: - explicit XclExpExcel9File(); - virtual ~XclExpExcel9File(); - -private: - virtual void WriteBody( XclExpStream& rStrm ); -}; - -// ============================================================================ - class XclExpRecalcId : public XclExpDummyRecord { public: diff --git a/sc/source/filter/inc/xistream.hxx b/sc/source/filter/inc/xistream.hxx index 3ee461f163fe..bbc1cc04fde5 100644 --- a/sc/source/filter/inc/xistream.hxx +++ b/sc/source/filter/inc/xistream.hxx @@ -269,6 +269,10 @@ public: CONTINUE usage is switched on. @return false = no record found (end of stream). */ bool StartNextRecord(); + /** Sets stream pointer to the start of the record content for the record + at the passed absolute stream position. + @return false = no record found (end of stream). */ + bool StartNextRecord( sal_Size nNextRecPos ); /** Sets stream pointer to begin of record content. @param bContLookup Automatic CONTINUE lookup on/off. In difference to other stream settings, this setting is persistent until next call of diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx index 2fe3a6ecbc15..a67458366057 100644 --- a/sc/source/filter/inc/xistyle.hxx +++ b/sc/source/filter/inc/xistyle.hxx @@ -397,19 +397,14 @@ public: /** Reads an XF record. */ void ReadXF( XclImpStream& rStrm ); - /** Sets the style name of this XF, if it is a style XF. */ - void SetStyleName( const String& rStyleName, bool bBuiltIn, bool bForceCreate ); - /** Changes the style name of this XF, if it is a style XF. */ - void ChangeStyleName( const String& rStyleName ); - /** Returns the style name of this XF, if it is a style XF. */ - inline const String& GetStyleName() const { return maStyleName; } - inline sal_uInt8 GetHorAlign() const { return maAlignment.mnHorAlign; } inline sal_uInt8 GetVerAlign() const { return maAlignment.mnVerAlign; } inline sal_uInt16 GetFontIndex() const { return mnXclFont; } - /** Creates the Calc style sheet, if this is a user-defined style. */ - void CreateUserStyle(); + /** Creates a Calc item set containing an item set with all cell properties. + @param bSkipPoolDefs true = Do not put items equal to pool default; false = Put all items. + @return A read-only reference to the item set stored internally. */ + const ScPatternAttr& CreatePattern( bool bSkipPoolDefs = false ); /** Inserts all formatting attributes to the specified area in the Calc document. @param nForcedNumFmt If not set to NUMBERFORMAT_ENTRY_NOT_FOUND, it will overwrite @@ -434,20 +429,10 @@ private: /** Sets own "attribute used" flags, if attributes are different from passed parent XF. */ void UpdateUsedFlags( const XclImpXF& rParentXF ); - /** Creates a Calc item set containing an item set with all cell properties. - @param bSkipPoolDefs true = Do not put items equal to pool default; false = Put all items. - @return A read-only reference to the item set stored internally. */ - const ScPatternAttr& CreatePattern( bool bSkipPoolDefs = false ); - /** Creates a cell style sheet and inserts it into the Calc document. - @descr Creates a style sheet only for style XFs with a valid style name. - @return The pointer to the cell style sheet, or 0, if there is no style sheet. */ - ScStyleSheet* CreateStyleSheet(); - private: typedef ::std::auto_ptr< ScPatternAttr > ScPatternAttrPtr; ScPatternAttrPtr mpPattern; /// Calc item set. - String maStyleName; /// Name of the style sheet. ScStyleSheet* mpStyleSheet; /// Calc cell style sheet. XclImpCellProt maProtection; /// Cell protection flags. @@ -456,9 +441,42 @@ private: XclImpCellArea maArea; /// Background area style. sal_uInt16 mnXclNumFmt; /// Index to number format. sal_uInt16 mnXclFont; /// Index to font record. +}; + +// ---------------------------------------------------------------------------- - bool mbWasBuiltIn; /// true = XF was an Excel built-in style. - bool mbForceCreate; /// true = Force creation of style sheet. +/** Contains all data of a cell style associated with an XF record. */ +class XclImpStyle : protected XclImpRoot +{ +public: + explicit XclImpStyle( const XclImpRoot& rRoot ); + + /** Reads a STYLE record. */ + void ReadStyle( XclImpStream& rStrm ); + + inline const String& GetName() const { return maName; } + inline sal_uInt16 GetXfId() const { return mnXfId; } + inline bool IsBuiltin() const { return mbBuiltin && (mnBuiltinId != EXC_STYLE_USERDEF); } + inline sal_uInt8 GetBuiltinId() const { return mnBuiltinId; } + inline sal_uInt8 GetLevel() const { return mnLevel; } + + /** Creates a cell style sheet and inserts it into the Calc document. + @return The pointer to the cell style sheet, or 0, if there is no style sheet. */ + ScStyleSheet* CreateStyleSheet(); + /** Creates the Calc style sheet, if this is a user-defined style. */ + void CreateUserStyle( const String& rFinalName ); + +private: + String maName; /// Cell style name. + sal_uInt16 mnXfId; /// Formatting for this cell style. + sal_uInt8 mnBuiltinId; /// Identifier for builtin styles. + sal_uInt8 mnLevel; /// Level for builtin column/row styles. + bool mbBuiltin; /// True = builtin style. + bool mbCustom; /// True = customized builtin style. + bool mbHidden; /// True = style not visible in GUI. + + String maFinalName; /// Final name used in the Calc document. + ScStyleSheet* mpStyleSheet; /// Calc cell style sheet. }; // ---------------------------------------------------------------------------- @@ -489,6 +507,9 @@ public: /** Creates all user defined style sheets. */ void CreateUserStyles(); + /** Creates a cell style sheet of the passed XF and inserts it into the Calc document. + @return The pointer to the cell style sheet, or 0, if there is no style sheet. */ + ScStyleSheet* CreateStyleSheet( sal_uInt16 nXFIndex ); /** Inserts formatting attributes from an XF to the specified area in the Calc document. @param nForcedNumFmt If not set to NUMBERFORMAT_ENTRY_NOT_FOUND, it will overwrite @@ -499,15 +520,13 @@ public: SCTAB nScTab, const XclImpXFIndex& rXFIndex ); private: - void CalcStyleName( XclImpXF& rXF, const String& rStyleName, bool bBuiltIn ); - void CalcStyleName( XclImpXF& rXF, sal_uInt8 nStyleId, sal_uInt8 nLevel ); - void SetStyleName( XclImpXF& rXF, const String& rStyleName, bool bBuiltIn, bool bForceCreate ); - -private: - typedef ::std::map< String, XclImpXF* > XclImpStyleXFMap; + typedef ScfDelList< XclImpStyle > XclImpStyleList; + typedef ::std::map< sal_uInt16, XclImpStyle* > XclImpStyleMap; ScfDelList< XclImpXF > maXFList; /// List of contents of all XF record. - XclImpStyleXFMap maStyleXFs; /// Maps style names to style XF records. + XclImpStyleList maBuiltinStyles; /// List of built-in cell styles. + XclImpStyleList maUserStyles; /// List of user defined cell styles. + XclImpStyleMap maStylesByXf; /// Maps XF records to cell styles. }; // Buffer for XF indexes in cells ============================================= diff --git a/sc/source/filter/inc/xlconst.hxx b/sc/source/filter/inc/xlconst.hxx index eebaa76e4702..eeb3fb3982b9 100644 --- a/sc/source/filter/inc/xlconst.hxx +++ b/sc/source/filter/inc/xlconst.hxx @@ -205,6 +205,10 @@ const sal_uInt16 EXC_WSBOOL_FITTOPAGE = 0x0100; const sal_uInt16 EXC_WSBOOL_DEFAULTFLAGS = 0x04C1; +// (0x0086) WRITEPROT --------------------------------------------------------- + +const sal_uInt16 EXC_ID_WRITEPROT = 0x0086; + // (0x008C) COUNTRY ----------------------------------------------------------- const sal_uInt16 EXC_ID_COUNTRY = 0x008C; @@ -213,6 +217,10 @@ const sal_uInt16 EXC_ID_COUNTRY = 0x008C; const sal_uInt16 EXC_ID_FILTERMODE = 0x009B; +// (0x009C) FNGROUPCOUNT ------------------------------------------------------ + +const sal_uInt16 EXC_ID_FNGROUPCOUNT = 0x009C; + // (0x009D) AUTOFILTERINFO ---------------------------------------------------- const sal_uInt16 EXC_ID_AUTOFILTERINFO = 0x009D; @@ -221,15 +229,34 @@ const sal_uInt16 EXC_ID_AUTOFILTERINFO = 0x009D; const sal_uInt16 EXC_ID_AUTOFILTER = 0x009E; +// (0x00BF, 0x00C0, 0x00C1) TOOLBARHDR, TOOLBAREND, MMS ----------------------- + +const sal_uInt16 EXC_ID_TOOLBARHDR = 0x00BF; +const sal_uInt16 EXC_ID_TOOLBAREND = 0x00C0; +const sal_uInt16 EXC_ID_MMS = 0x00C1; + +// (0x00E1, 0x00E2) INTERFACEHDR, INTERFACEEND -------------------------------- + +const sal_uInt16 EXC_ID_INTERFACEHDR = 0x00E1; +const sal_uInt16 EXC_ID_INTERFACEEND = 0x00E2; + // (0x0160) USESELFS ---------------------------------------------------------- const sal_uInt16 EXC_ID_USESELFS = 0x0160; +// (0x0161) DSF --------------------------------------------------------------- + +const sal_uInt16 EXC_ID_DSF = 0x0161; + // (0x01AA,0x01AB) USERSVIEWBEGIN, USERSVIEWEND ------------------------------- const sal_uInt16 EXC_ID_USERSVIEWBEGIN = 0x01AA; const sal_uInt16 EXC_ID_USERSVIEWEND = 0x01AB; +// (0x01C0) XL9FILE -------------------------------------------------------- + +const sal_uInt16 EXC_ID_XL9FILE = 0x01C0; + // (0x8xx) Future records ----------------------------------------------------- /** Enumerates different header types of future records. */ diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx index 8571dafcbc74..8b0873b25475 100644 --- a/sc/source/filter/inc/xlroot.hxx +++ b/sc/source/filter/inc/xlroot.hxx @@ -94,6 +94,7 @@ struct XclRootData ScDocument& mrDoc; /// The source or destination document. String maDocUrl; /// Document URL of imported/exported file. String maBasePath; /// Base path of imported/exported file (path of maDocUrl). + String maUserName; /// Current user name. const String maDefPassword; /// The default password used for stream encryption. rtl_TextEncoding meTextEnc; /// Text encoding to import/export byte strings. LanguageType meSysLang; /// System language. @@ -185,6 +186,8 @@ public: inline const String& GetDocUrl() const { return mrData.maDocUrl; } /** Returns the base path of the imported/exported file. */ inline const String& GetBasePath() const { return mrData.maBasePath; } + /** Returns the current user name. */ + inline const String& GetUserName() const { return mrData.maUserName; } /** Returns the default password used for stream encryption. */ inline const String& GetDefaultPassword() const { return mrData.maDefPassword; } diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx index ebb22c2cb05f..9613abfc8725 100644 --- a/sc/source/filter/inc/xlstyle.hxx +++ b/sc/source/filter/inc/xlstyle.hxx @@ -247,6 +247,8 @@ const sal_uInt8 EXC_STYLE_NOLEVEL = 0xFF; /// Default value fo const sal_uInt16 EXC_ID_STYLEEXT = 0x0892; const sal_uInt8 EXC_STYLEEXT_BUILTIN = 0x01; +const sal_uInt8 EXC_STYLEEXT_HIDDEN = 0x02; +const sal_uInt8 EXC_STYLEEXT_CUSTOM = 0x04; // Structs and classes ======================================================== diff --git a/sc/source/filter/inc/xltools.hxx b/sc/source/filter/inc/xltools.hxx index d818fa9e0a89..392b0a2ae1fc 100644 --- a/sc/source/filter/inc/xltools.hxx +++ b/sc/source/filter/inc/xltools.hxx @@ -167,8 +167,8 @@ public: @return The corresponding text encoding or RTL_TEXTENCODING_DONTKNOW. */ static rtl_TextEncoding GetTextEncoding( sal_uInt16 nCodePage ); -//UNUSED2008-05 /** Returns an Excel code page from a text encoding. */ -//UNUSED2008-05 static sal_uInt16 GetXclCodePage( rtl_TextEncoding eTextEnc ); + /** Returns an Excel code page from a text encoding. */ + static sal_uInt16 GetXclCodePage( rtl_TextEncoding eTextEnc ); // font names ------------------------------------------------------------- @@ -194,9 +194,10 @@ public: /** Returns the specified built-in cell style name. @param nStyleId The identifier of the built-in style. + @param rName Default name for unknown styles. @param nLevel The zero-based outline level for RowLevel and ColLevel styles. @return The style name or an empty string, if the parameters are not valid. */ - static String GetBuiltInStyleName( sal_uInt8 nStyleId, sal_uInt8 nLevel ); + static String GetBuiltInStyleName( sal_uInt8 nStyleId, const String& rName, sal_uInt8 nLevel ); /** Returns the passed style name with a special built-in prefix. */ static String GetBuiltInStyleName( const String& rStyleName ); /** Returns true, if the passed string is a name of an Excel built-in style. diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index ac71dbb01fbb..608b13c49ac3 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -65,7 +65,6 @@ #include #include -#include #include #include @@ -1033,15 +1032,14 @@ void ExcEScenarioCell::SaveXml( XclExpXmlStream& rStrm ) -XclExpString ExcEScenario::sUsername; - -ExcEScenario::ExcEScenario( ScDocument& rDoc, SCTAB nTab ) +ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab ) { String sTmpName; String sTmpComm; Color aDummyCol; USHORT nFlags; + ScDocument& rDoc = rRoot.GetDoc(); rDoc.GetName( nTab, sTmpName ); sName.Assign( sTmpName, EXC_STR_8BITLENGTH ); nRecLen = 8 + sName.GetBufferSize(); @@ -1052,14 +1050,8 @@ ExcEScenario::ExcEScenario( ScDocument& rDoc, SCTAB nTab ) nRecLen += sComment.GetSize(); nProtected = (nFlags & SC_SCENARIO_PROTECT) ? 1 : 0; - if( !sUsername.Len() ) - { - SvtUserOptions aUserOpt; - sUsername.Assign( aUserOpt.GetLastName(), EXC_STR_DEFAULT, 255 ); - } - if( !sUsername.Len() ) - sUsername.Assign( String::CreateFromAscii( "SC" ) ); - nRecLen += sUsername.GetSize(); + sUserName.Assign( rRoot.GetUserName(), EXC_STR_DEFAULT, 255 ); + nRecLen += sUserName.GetSize(); const ScRangeList* pRList = rDoc.GetScenarioRanges( nTab ); if( !pRList ) @@ -1118,11 +1110,11 @@ void ExcEScenario::SaveCont( XclExpStream& rStrm ) << (UINT8) 0 // fHidden << (UINT8) sName.Len() // length of scen name << (UINT8) sComment.Len() // length of comment - << (UINT8) sUsername.Len(); // length of user name + << (UINT8) sUserName.Len(); // length of user name sName.WriteFlagField( rStrm ); sName.WriteBuffer( rStrm ); - rStrm << sUsername; + rStrm << sUserName; if( sComment.Len() ) rStrm << sComment; @@ -1154,7 +1146,7 @@ void ExcEScenario::SaveXml( XclExpXmlStream& rStrm ) XML_locked, XclXmlUtils::ToPsz( nProtected ), // OOXTODO: XML_hidden, XML_count, OString::valueOf( (sal_Int32) List::Count() ).getStr(), - XML_user, XESTRING_TO_PSZ( sUsername ), + XML_user, XESTRING_TO_PSZ( sUserName ), XML_comment, XESTRING_TO_PSZ( sComment ), FSEND ); @@ -1167,9 +1159,10 @@ void ExcEScenario::SaveXml( XclExpXmlStream& rStrm ) -ExcEScenarioManager::ExcEScenarioManager( ScDocument& rDoc, SCTAB nTab ) : +ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab ) : nActive( 0 ) { + ScDocument& rDoc = rRoot.GetDoc(); if( rDoc.IsScenario( nTab ) ) return; @@ -1178,7 +1171,7 @@ ExcEScenarioManager::ExcEScenarioManager( ScDocument& rDoc, SCTAB nTab ) : while( rDoc.IsScenario( nNewTab ) ) { - Append( new ExcEScenario( rDoc, nNewTab ) ); + Append( new ExcEScenario( rRoot, nNewTab ) ); if( rDoc.IsActiveScenario( nNewTab ) ) nActive = static_cast(nNewTab - nFirstTab); @@ -1453,67 +1446,15 @@ void XclExpFilePass::WriteBody( XclExpStream& rStrm ) // ============================================================================ -XclExpFnGroupCount::XclExpFnGroupCount() : - XclExpRecord(0x009C, 2) -{ -} - -XclExpFnGroupCount::~XclExpFnGroupCount() -{ -} - -void XclExpFnGroupCount::WriteBody( XclExpStream& rStrm ) -{ - rStrm << static_cast(14); -} - -// ============================================================================ - -XclExpInterfaceHdr::XclExpInterfaceHdr() : - XclExpRecord(0x00E1, 2) -{ -} - -XclExpInterfaceHdr::~XclExpInterfaceHdr() +XclExpInterfaceHdr::XclExpInterfaceHdr( sal_uInt16 nCodePage ) : + XclExpUInt16Record( EXC_ID_INTERFACEHDR, nCodePage ) { } void XclExpInterfaceHdr::WriteBody( XclExpStream& rStrm ) { - // The value must be the same value as the CODEPAGE record. rStrm.DisableEncryption(); - rStrm << static_cast(0x04B0); -} - -// ============================================================================ - -XclExpInterfaceEnd::XclExpInterfaceEnd() : - XclExpRecord(0x00E2, 0) -{ -} - -XclExpInterfaceEnd::~XclExpInterfaceEnd() -{ -} - -void XclExpInterfaceEnd::WriteBody( XclExpStream& /*rStrm*/ ) -{ -} - -// ============================================================================ - -XclExpMMS::XclExpMMS() : - XclExpRecord(0x00C1, 2) -{ -} - -XclExpMMS::~XclExpMMS() -{ -} - -void XclExpMMS::WriteBody( XclExpStream& rStrm ) -{ - rStrm << static_cast(0x0000); + rStrm << GetValue(); } // ============================================================================ @@ -1552,35 +1493,25 @@ void XclExpWriteAccess::WriteBody( XclExpStream& rStrm ) // ============================================================================ -XclExpCodePage::XclExpCodePage() : - XclExpRecord(0x0042, 2) -{ -} - -XclExpCodePage::~XclExpCodePage() -{ -} - -void XclExpCodePage::WriteBody( XclExpStream& rStrm ) -{ - // 0x04B0 : UTF-16 (BIFF8) - rStrm << static_cast(0x04B0); -} - -// ============================================================================ - -XclExpDSF::XclExpDSF() : - XclExpRecord(0x0161, 2) +XclExpFileSharing::XclExpFileSharing( const XclExpRoot& rRoot, sal_uInt16 nPasswordHash ) : + XclExpRecord( EXC_ID_FILESHARING ), + mnPasswordHash( nPasswordHash ) { + if( rRoot.GetBiff() <= EXC_BIFF5 ) + maUserName.AssignByte( rRoot.GetUserName(), rRoot.GetTextEncoding(), EXC_STR_8BITLENGTH ); + else + maUserName.Assign( rRoot.GetUserName() ); } -XclExpDSF::~XclExpDSF() +void XclExpFileSharing::Save( XclExpStream& rStrm ) { + if( mnPasswordHash != 0 ) + XclExpRecord::Save( rStrm ); } -void XclExpDSF::WriteBody( XclExpStream& rStrm ) +void XclExpFileSharing::WriteBody( XclExpStream& rStrm ) { - rStrm << static_cast(0x0000); + rStrm << sal_uInt16( 0 ) << mnPasswordHash << maUserName; } // ============================================================================ @@ -1617,21 +1548,6 @@ void XclExpProt4RevPass::WriteBody( XclExpStream& rStrm ) // ============================================================================ -XclExpExcel9File::XclExpExcel9File() : - XclExpRecord(0x01C0, 0) -{ -} - -XclExpExcel9File::~XclExpExcel9File() -{ -} - -void XclExpExcel9File::WriteBody( XclExpStream& /*rStrm*/ ) -{ -} - -// ============================================================================ - static const sal_uInt8 nDataRecalcId[] = { 0xC1, 0x01, 0x00, 0x00, 0x54, 0x8D, 0x01, 0x00 }; diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index bdf5317da1bc..07ed8709ab01 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -542,6 +542,14 @@ void Chart2Positioner::glueState() meGlue = GLUETYPE_COLS; return; } + // #i103540# prevent invalid vector size + if ((nC <= 0) || (nR <= 0)) + { + invalidateGlue(); + mnStartCol = 0; + mnStartRow = 0; + return; + } sal_uInt32 nCR = static_cast(nC*nR); const sal_uInt8 nHole = 0; diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index cd63adc33989..3e2295d73471 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -221,7 +221,8 @@ ScModelObj::ScModelObj( ScDocShell* pDocSh ) : aPropSet( lcl_GetDocOptPropertyMap() ), pDocShell( pDocSh ), pPrintFuncCache( NULL ), - maChangesListeners( m_aMutex ) + maChangesListeners( m_aMutex ), + mnXlsWriteProtPass( 0 ) { // pDocShell may be NULL if this is the base of a ScDocOptionsObj if ( pDocShell ) @@ -1448,6 +1449,14 @@ void SAL_CALL ScModelObj::setPropertyValue( if ( aObjName.getLength() ) pDoc->RestoreChartListener( aObjName ); } + else if ( aString.EqualsAscii( "WriteProtectionPassword" ) ) + { + /* This is a hack for #160550# to preserve the write-protection + password in an XLS roundtrip. This property MUST NOT be used + for any other purpose. This property will be deleted when the + feature "Write Protection With Password" will be implemented. */ + aValue >>= mnXlsWriteProtPass; + } if ( aNewOpt != rOldOpt ) { @@ -1610,6 +1619,14 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const rtl::OUString& aPropertyNa { ScUnoHelpFunctions::SetBoolInAny( aRet, (pDocShell->GetCreateMode() == SFX_CREATE_MODE_INTERNAL) ); } + else if ( aString.EqualsAscii( "WriteProtectionPassword" ) ) + { + /* This is a hack for #160550# to preserve the write-protection + password in an XLS roundtrip. This property MUST NOT be used + for any other purpose. This property will be deleted when the + feature "Write Protection With Password" will be implemented. */ + aRet <<= mnXlsWriteProtPass; + } } return aRet; -- cgit From 61dec8ceed38588d3a2d2d5a91e501791b2e73c7 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Wed, 21 Oct 2009 13:32:17 +0000 Subject: CWS-TOOLING: integrate CWS calc32stopper3 2009-10-12 14:26:09 +0200 er r276833 : disable dump again 2009-10-12 13:46:57 +0200 er r276832 : #i102294# setValue: yet another DST glitch 2009-10-12 13:21:48 +0200 iha r276828 : #i105767# Y axis vanishes in case of zero rotated axis title 2009-10-08 01:49:20 +0200 er r276772 : NextSymbol: actually do reset ODF reference detection on file/sheet separator 2009-10-08 00:18:58 +0200 er r276771 : #i101639# use TabIDs in cached RangeArrays, not RefData Tabs 2009-10-07 19:25:47 +0200 er r276767 : #i105200# UpdateBroadcastAreas: hash key changes, remove area from all slots and reinsert 2009-10-05 17:20:44 +0200 er r276690 : #i105365# SI prefixes for ang, ang3, m/h, m/hr 2009-10-05 16:21:29 +0200 er r276686 : #i105161 intersection has higher precedence than union --- .../controller/chartapiwrapper/TitleWrapper.cxx | 2 +- .../WrappedTextRotationProperty.cxx | 14 ++++- .../WrappedTextRotationProperty.hxx | 7 ++- sc/source/core/data/bcaslot.cxx | 59 ++++++++++++++++++++++ sc/source/core/inc/bcaslot.hxx | 1 + sc/source/core/tool/compiler.cxx | 34 ++++++++----- sc/source/ui/docshell/externalrefmgr.cxx | 22 ++++---- scaddins/source/analysis/analysishelper.cxx | 8 +-- 8 files changed, 118 insertions(+), 29 deletions(-) diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx index e0e9511cf71d..a84dbc0cfc4d 100644 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx @@ -505,7 +505,7 @@ const std::vector< WrappedProperty* > TitleWrapper::createWrappedProperties() ::std::vector< ::chart::WrappedProperty* > aWrappedProperties; aWrappedProperties.push_back( new WrappedTitleStringProperty( m_spChart2ModelContact->m_xContext ) ); - aWrappedProperties.push_back( new WrappedTextRotationProperty() ); + aWrappedProperties.push_back( new WrappedTextRotationProperty( m_eTitleType==TitleHelper::Y_AXIS_TITLE || m_eTitleType==TitleHelper::X_AXIS_TITLE ) ); aWrappedProperties.push_back( new WrappedStackedTextProperty() ); WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this ); WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties ); diff --git a/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx index bd505d6edac5..07532a4ecf22 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx @@ -33,7 +33,9 @@ #include "WrappedTextRotationProperty.hxx" #include "macros.hxx" +#include +using namespace ::com::sun::star; using ::com::sun::star::uno::Any; using ::rtl::OUString; @@ -43,13 +45,23 @@ namespace chart { //............................................................................. -WrappedTextRotationProperty::WrappedTextRotationProperty() +WrappedTextRotationProperty::WrappedTextRotationProperty( bool bDirectState ) : ::chart::WrappedProperty( C2U( "TextRotation" ), C2U( "TextRotation" ) ) + , m_bDirectState( bDirectState ) { } WrappedTextRotationProperty::~WrappedTextRotationProperty() { } + +beans::PropertyState WrappedTextRotationProperty::getPropertyState( const uno::Reference< beans::XPropertyState >& xInnerPropertyState ) const + throw (beans::UnknownPropertyException, uno::RuntimeException) +{ + if( m_bDirectState ) + return beans::PropertyState_DIRECT_VALUE; + return WrappedProperty::getPropertyState( xInnerPropertyState ); +} + Any WrappedTextRotationProperty::convertInnerToOuterValue( const Any& rInnerValue ) const { Any aRet; diff --git a/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx index 38a516bbc1b9..54fbf38e53d7 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx +++ b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx @@ -40,12 +40,17 @@ namespace chart class WrappedTextRotationProperty : public WrappedProperty { public: - WrappedTextRotationProperty(); + WrappedTextRotationProperty( bool bDirectState=false ); virtual ~WrappedTextRotationProperty(); + virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const + throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + protected: virtual ::com::sun::star::uno::Any convertInnerToOuterValue( const ::com::sun::star::uno::Any& rInnerValue ) const; virtual ::com::sun::star::uno::Any convertOuterToInnerValue( const ::com::sun::star::uno::Any& rOuterValue ) const; + + bool m_bDirectState; }; //............................................................................. diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index 85f8a4921242..d3d86be58440 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -353,6 +353,21 @@ void ScBroadcastAreaSlot::UpdateRemove( UpdateRefMode eUpdateRefMode, } +void ScBroadcastAreaSlot::UpdateRemoveArea( ScBroadcastArea* pArea ) +{ + ScBroadcastAreas::iterator aIter( aBroadcastAreaTbl.find( pArea)); + if (aIter == aBroadcastAreaTbl.end()) + return; + if (*aIter != pArea) + DBG_ERRORFILE( "UpdateRemoveArea: area pointer mismatch"); + else + { + aBroadcastAreaTbl.erase( aIter); + pArea->DecRef(); + } +} + + void ScBroadcastAreaSlot::UpdateInsert( ScBroadcastArea* pArea ) { ::std::pair< ScBroadcastAreas::iterator, bool > aPair = @@ -732,6 +747,50 @@ void ScBroadcastAreaSlotMachine::UpdateBroadcastAreas( } } + // Updating an area's range will modify the hash key, remove areas from all + // affected slots. Will be reinserted later with the updated range. + ScBroadcastArea* pChain = pUpdateChain; + while (pChain) + { + ScBroadcastArea* pArea = pChain; + pChain = pArea->GetUpdateChainNext(); + ScRange aRange( pArea->GetRange()); + // remove from slots + for (SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab() && pArea->GetRef(); ++nTab) + { + TableSlotsMap::iterator iTab( aTableSlotsMap.find( nTab)); + if (iTab == aTableSlotsMap.end()) + { + DBG_ERRORFILE( "UpdateBroadcastAreas: Where's the TableSlot?!?"); + continue; // for + } + ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots(); + SCSIZE nStart, nEnd, nRowBreak; + ComputeAreaPoints( aRange, nStart, nEnd, nRowBreak ); + SCSIZE nOff = nStart; + SCSIZE nBreak = nOff + nRowBreak; + ScBroadcastAreaSlot** pp = ppSlots + nOff; + while ( nOff <= nEnd && pArea->GetRef() ) + { + if (*pp) + (*pp)->UpdateRemoveArea( pArea); + if ( nOff < nBreak ) + { + ++nOff; + ++pp; + } + else + { + nStart += BCA_SLOTS_ROW; + nOff = nStart; + pp = ppSlots + nOff; + nBreak = nOff + nRowBreak; + } + } + } + + } + // shift sheets if (nDz) { diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx index ef2f77b55684..79335a35fa7e 100644 --- a/sc/source/core/inc/bcaslot.hxx +++ b/sc/source/core/inc/bcaslot.hxx @@ -192,6 +192,7 @@ public: void UpdateRemove( UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + void UpdateRemoveArea( ScBroadcastArea* pArea ); void UpdateInsert( ScBroadcastArea* pArea ); }; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index a8ca4be2b5b6..df7131397aef 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2278,14 +2278,16 @@ Label_MaskStateMachine: static const int kQuote = (1 << 4); // Past ' closing quote. static const int kClose = (1 << 5); + // Encountered # file/sheet separator. + static const int kFileSep = (1 << 6); // Past . sheet name separator. - static const int kPast = (1 << 6); + static const int kPast = (1 << 7); // Marked name $$ follows sheet name separator, detected // while we're still on the separator. Will be cleared when // entering the name. - static const int kMarkAhead = (1 << 7); + static const int kMarkAhead = (1 << 8); // In marked defined name. - static const int kDefName = (1 << 8); + static const int kDefName = (1 << 9); bool bAddToSymbol = true; if ((nMask & SC_COMPILER_C_ODF_RBRACKET) && !(nRefInName & kOpen)) @@ -2309,7 +2311,9 @@ Label_MaskStateMachine: { // Not in col/row yet. - if ('$' == c && '$' == pSrc[0] && !(nRefInName & kOpen)) + if (SC_COMPILER_FILE_TAB_SEP == c && (nRefInName & kFileSep)) + nRefInName = 0; + else if ('$' == c && '$' == pSrc[0] && !(nRefInName & kOpen)) { nRefInName &= ~kMarkAhead; if (!(nRefInName & kDefName)) @@ -2356,16 +2360,20 @@ Label_MaskStateMachine: } else { - if ('\'' == pSrc[0]) - { - // escapes embedded quote - nRefInName |= kQuote; - } - else + switch (pSrc[0]) { - // quote not followed by quote => close - nRefInName |= kClose; - nRefInName &= ~kOpen; + case '\'': + // escapes embedded quote + nRefInName |= kQuote; + break; + case SC_COMPILER_FILE_TAB_SEP: + // sheet name should follow + nRefInName |= kFileSep; + // fallthru + default: + // quote not followed by quote => close + nRefInName |= kClose; + nRefInName &= ~kOpen; } bAddToSymbol = !(nRefInName & kDefName); } diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 5cfc833be5dd..f74e8c519fb6 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -384,11 +384,6 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( return TokenArrayRef(); DocItem& rDoc = itrDoc->second; - RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find(rRange); - if (itrRange != rDoc.maRangeArrays.end()) - { - return itrRange->second; - } TableNameIndexMap::iterator itrTabId = rDoc.maTableNameIndex.find( ScGlobal::pCharClass->upper(rTabName)); @@ -410,6 +405,13 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( // not all tables are cached. return TokenArrayRef(); + ScRange aCacheRange( nCol1, nRow1, static_cast(nTabFirstId), nCol2, nRow2, static_cast(nTabLastId)); + RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find( aCacheRange); + if (itrRange != rDoc.maRangeArrays.end()) + { + return itrRange->second; + } + TokenArrayRef pArray(new ScTokenArray); bool bFirstTab = true; for (size_t nTab = nTabFirstId; nTab <= nTabLastId; ++nTab) @@ -462,7 +464,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData( bFirstTab = false; } - rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray)); + rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray)); return pArray; } @@ -545,13 +547,13 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa return; } - size_t nTab1 = itrTabName->second; + size_t nTabFirstId = itrTabName->second; SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row(); SCCOL nCol1 = rRange.aStart.Col(), nCol2 = rRange.aEnd.Col(); vector::const_iterator itrDataBeg = rData.begin(), itrDataEnd = rData.end(); for (vector::const_iterator itrData = itrDataBeg; itrData != itrDataEnd; ++itrData) { - size_t i = nTab1 + ::std::distance(itrDataBeg, itrData); + size_t i = nTabFirstId + ::std::distance(itrDataBeg, itrData); TableTypeRef& pTabData = rDoc.maTables[i]; if (!pTabData.get()) pTabData.reset(new Table); @@ -575,7 +577,9 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa } } - rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray)); + size_t nTabLastId = nTabFirstId + rRange.aEnd.Tab() - rRange.aStart.Tab(); + ScRange aCacheRange( nCol1, nRow1, static_cast(nTabFirstId), nCol2, nRow2, static_cast(nTabLastId)); + rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray)); } bool ScExternalRefCache::isDocInitialized(sal_uInt16 nFileId) diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx index e241b0ab88c8..7370b1adf588 100644 --- a/scaddins/source/analysis/analysishelper.cxx +++ b/scaddins/source/analysis/analysishelper.cxx @@ -2427,7 +2427,7 @@ ConvertDataList::ConvertDataList( void ) NEWD( "in", 3.9370078740157480E01, CDC_Length ); // Inch 39,37007874015748031496062992126 NEWD( "ft", 3.2808398950131234E00, CDC_Length ); // Foot 3,2808398950131233595800524934383 NEWD( "yd", 1.0936132983377078E00, CDC_Length ); // Yard 1,0936132983377077865266841644794 - NEWD( "ang", 1.0000000000000000E10, CDC_Length ); // Angstroem + NEWDP( "ang", 1.0000000000000000E10, CDC_Length ); // Angstroem NEWD( "Pica", 2.8346456692913386E03, CDC_Length ); // Pica (1/72 Inch) 2834,6456692913385826771653543307 NEWD( "ell", 8.748906E-01, CDC_Length ); // *** Ell NEWDP( "parsec", 3.240779E-17, CDC_Length ); // *** Parsec @@ -2519,7 +2519,7 @@ ConvertDataList::ConvertDataList( void ) NEWD( "in3", 6.1023744094732284E01, CDC_Volume ); // *** Cubic Inch NEWD( "ft3", 3.5314666721488590E-02, CDC_Volume ); // *** Cubic Foot NEWD( "yd3", 1.3079506193143922E-03, CDC_Volume ); // *** Cubic Yard - NEWD( "ang3", 1.0000000000000000E27, CDC_Volume ); // *** Cubic Angstroem + NEWDP( "ang3", 1.0000000000000000E27, CDC_Volume ); // *** Cubic Angstroem NEWD( "Pica3", 2.2776990435870636E07, CDC_Volume ); // *** Cubic Pica NEWD( "barrel", 6.289811E-03, CDC_Volume ); // *** Barrel (=42gal?) NEWD( "bushel", 2.837759E-02, CDC_Volume ); // *** Bushel @@ -2557,8 +2557,8 @@ ConvertDataList::ConvertDataList( void ) // SPEED: 1 Meter per Second is... NEWDP( "m/s", 1.0000000000000000E00, CDC_Speed ); // *** Meters per Second NEWDP( "m/sec", 1.0000000000000000E00, CDC_Speed ); // *** Meters per Second also - NEWD( "m/h", 3.6000000000000000E03, CDC_Speed ); // *** Meters per Hour - NEWD( "m/hr", 3.6000000000000000E03, CDC_Speed ); // *** Meters per Hour also + NEWDP( "m/h", 3.6000000000000000E03, CDC_Speed ); // *** Meters per Hour + NEWDP( "m/hr", 3.6000000000000000E03, CDC_Speed ); // *** Meters per Hour also NEWD( "mph", 2.2369362920544023E00, CDC_Speed ); // *** Britsh Miles per Hour NEWD( "kn", 1.9438444924406048E00, CDC_Speed ); // *** Knot = Nautical Miles per Hour NEWD( "admkn", 1.9438446603753486E00, CDC_Speed ); // *** Admiralty Knot -- cgit -- cgit