diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-03-10 16:55:21 -0500 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-03-10 20:21:13 -0500 |
commit | 12343c15568dcc2c9209d8ca41fda2263122448f (patch) | |
tree | 3212a89c6cd8ea2e0aee7103aa9669bbb8a6f307 /sc/source/filter/excel | |
parent | 99745dbcbb25b61437914c9782475d0b67a4b0bd (diff) | |
parent | ce6308e4fad2281241bf4ca78280eba29f744d43 (diff) |
Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
Diffstat (limited to 'sc/source/filter/excel')
44 files changed, 1357 insertions, 858 deletions
diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx index 363e522092f4..17270c14fc00 100644 --- a/sc/source/filter/excel/colrowst.cxx +++ b/sc/source/filter/excel/colrowst.cxx @@ -303,7 +303,7 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) // hide the columns for( SCCOL nScCol = 0; nScCol <= MAXCOL; ++nScCol ) if( ::get_flag( maColFlags[ nScCol ], EXC_COLROW_HIDDEN ) ) - rDoc.ShowCol( nScCol, nScTab, FALSE ); + rDoc.ShowCol( nScCol, nScTab, false ); // #i38093# rows hidden by filter need extra flag SCROW nFirstFilterScRow = SCROW_MAX; @@ -358,7 +358,7 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) // #i47438# if default row format is hidden, hide remaining rows if( ::get_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN ) && (mnLastScRow < MAXROW) ) - rDoc.ShowRows( mnLastScRow + 1, MAXROW, nScTab, FALSE ); + rDoc.ShowRows( mnLastScRow + 1, MAXROW, nScTab, false ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 6bd9a1388513..1b2491ae15dd 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -194,8 +194,8 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList ) SCTAB nC; String aTmpString; SCTAB nScTabCount = rTabInfo.GetScTabCount(); - UINT16 nExcTabCount = rTabInfo.GetXclTabCount(); - UINT16 nCodenames = static_cast< UINT16 >( GetExtDocOptions().GetCodeNameCount() ); + sal_uInt16 nExcTabCount = rTabInfo.GetXclTabCount(); + sal_uInt16 nCodenames = static_cast< sal_uInt16 >( GetExtDocOptions().GetCodeNameCount() ); SfxObjectShell* pShell = GetDocShell(); sal_uInt16 nWriteProtHash = pShell ? pShell->GetModifyPasswordHash() : 0; @@ -219,7 +219,7 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList ) else { if( IsDocumentEncrypted() ) - Add( new XclExpFilePass( GetRoot() ) ); + Add( new XclExpFileEncryption( GetRoot() ) ); Add( new XclExpInterfaceHdr( nCodePage ) ); Add( new XclExpUInt16Record( EXC_ID_MMS, 0 ) ); Add( new XclExpInterfaceEnd ); diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index c0012c5519f7..4bd3654caa64 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -32,6 +32,8 @@ #include <sfx2/docfile.hxx> #include <sfx2/objsh.hxx> #include <sfx2/app.hxx> +#include <sfx2/frame.hxx> +#include <sfx2/request.hxx> #include <sot/storage.hxx> #include <sot/exchange.hxx> #include <tools/globname.hxx> @@ -93,17 +95,24 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument aArgs[ 0 ] <<= getProcessServiceFactory(); aArgs[ 1 ] <<= aArgSeq; uno::Reference< document::XImporter > xImporter( ScfApiHelper::CreateInstanceWithArgs( - CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW ); + CREATE_OUSTRING( "com.sun.star.comp.oox.xls.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW ); xImporter->setTargetDocument( xComponent ); MediaDescriptor aMediaDesc; SfxItemSet* pItemSet = rMedium.GetItemSet(); if( pItemSet ) { - if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) ) - 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() ); + SFX_ITEMSET_ARG( pItemSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, false); + if( pFileNameItem ) + aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pFileNameItem->GetValue() ); + + SFX_ITEMSET_ARG( pItemSet, pPasswordItem, SfxStringItem, SID_PASSWORD, false); + if( pPasswordItem ) + aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pPasswordItem->GetValue() ); + + SFX_ITEMSET_ARG( pItemSet, pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, false); + if( pEncryptionDataItem ) + aMediaDesc[ MediaDescriptor::PROP_ENCRYPTIONDATA() ] = pEncryptionDataItem->GetValue(); } aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream(); aMediaDesc[ MediaDescriptor::PROP_INTERACTIONHANDLER() ] <<= rMedium.GetInteractionHandler(); @@ -136,7 +145,7 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument SotStorageStreamRef xStrgStrm; if( SotStorage::IsStorageFile( pMedStrm ) ) { - xRootStrg = new SotStorage( pMedStrm, FALSE ); + xRootStrg = new SotStorage( pMedStrm, false ); if( xRootStrg->GetError() ) xRootStrg = 0; } @@ -209,10 +218,10 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument static FltError lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument, - SvStream* pMedStrm, BOOL bBiff8, CharSet eNach ) + SvStream* pMedStrm, sal_Bool bBiff8, CharSet eNach ) { // try to open an OLE storage - SotStorageRef xRootStrg = new SotStorage( pMedStrm, FALSE ); + SotStorageRef xRootStrg = new SotStorage( pMedStrm, false ); if( xRootStrg->GetError() ) return eERR_OPEN; // create BIFF dependent strings diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index c9cb9ccb301f..ff3c3e118f9f 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -46,8 +46,8 @@ using ::std::vector; -const UINT16 ExcelToSc::nRowMask = 0x3FFF; -const UINT16 ExcelToSc::nLastInd = 399; +const sal_uInt16 ExcelToSc::nRowMask = 0x3FFF; +const sal_uInt16 ExcelToSc::nLastInd = 399; @@ -55,16 +55,16 @@ const UINT16 ExcelToSc::nLastInd = 399; void ImportExcel::Formula25() { XclAddress aXclPos; - UINT16 nXF = 0, nFormLen; + sal_uInt16 nXF = 0, nFormLen; double fCurVal; - BYTE nFlag0; - BOOL bShrFmla; + sal_uInt8 nFlag0; + sal_Bool bShrFmla; aIn >> aXclPos; if( GetBiff() == EXC_BIFF2 ) {// BIFF2 - BYTE nDummy; + sal_uInt8 nDummy; aIn.Ignore( 3 ); @@ -72,7 +72,7 @@ void ImportExcel::Formula25() aIn.Ignore( 1 ); aIn >> nDummy; nFormLen = nDummy; - bShrFmla = FALSE; + bShrFmla = false; } else {// BIFF5 @@ -99,9 +99,9 @@ void ImportExcel::Formula3() void ImportExcel::Formula4() { XclAddress aXclPos; - UINT16 nXF, nFormLen; + sal_uInt16 nXF, nFormLen; double fCurVal; - BYTE nFlag0; + sal_uInt8 nFlag0; aIn >> aXclPos >> nXF >> fCurVal >> nFlag0; aIn.Ignore( 1 ); @@ -109,12 +109,12 @@ void ImportExcel::Formula4() nLastXF = nXF; - Formula( aXclPos, nXF, nFormLen, fCurVal, FALSE ); + Formula( aXclPos, nXF, nFormLen, fCurVal, false ); } void ImportExcel::Formula( const XclAddress& rXclPos, - UINT16 nXF, UINT16 nFormLen, double& rCurVal, BOOL bShrFmla ) + sal_uInt16 nXF, sal_uInt16 nFormLen, double& rCurVal, sal_Bool bShrFmla ) { ConvErr eErr = ConvOK; @@ -123,14 +123,14 @@ void ImportExcel::Formula( const XclAddress& rXclPos, { // jetzt steht Lesemarke auf Formel, Laenge in nFormLen const ScTokenArray* pErgebnis = 0; - BOOL bConvert; + sal_Bool bConvert; pFormConv->Reset( aScPos ); if( bShrFmla ) bConvert = !pFormConv->GetShrFmla( pErgebnis, maStrm, nFormLen ); else - bConvert = TRUE; + bConvert = sal_True; if( bConvert ) eErr = pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula); @@ -140,7 +140,7 @@ void ImportExcel::Formula( const XclAddress& rXclPos, if( pErgebnis ) { pZelle = new ScFormulaCell( pD, aScPos, pErgebnis ); - pD->PutCell( aScPos.Col(), aScPos.Row(), aScPos.Tab(), pZelle, (BOOL)TRUE ); + pD->PutCell( aScPos.Col(), aScPos.Row(), aScPos.Tab(), pZelle, (sal_Bool)sal_True ); } else { @@ -196,23 +196,23 @@ void ExcelToSc::GetDummy( const ScTokenArray*& pErgebnis ) ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT ) { RootData& rR = GetOldRoot(); - BYTE nOp, nLen, nByte; - UINT16 nUINT16; - INT16 nINT16; + sal_uInt8 nOp, nLen, nByte; + sal_uInt16 nUINT16; + sal_Int16 nINT16; double fDouble; String aString; - BOOL bError = FALSE; - BOOL bArrayFormula = FALSE; + sal_Bool bError = false; + sal_Bool bArrayFormula = false; TokenId nMerk0; - const BOOL bRangeName = eFT == FT_RangeName; - const BOOL bSharedFormula = eFT == FT_SharedFormula; - const BOOL bRNorSF = bRangeName || bSharedFormula; + const sal_Bool bRangeName = eFT == FT_RangeName; + const sal_Bool bSharedFormula = eFT == FT_SharedFormula; + const sal_Bool bRNorSF = bRangeName || bSharedFormula; ScSingleRefData aSRD; ScComplexRefData aCRD; ExtensionTypeVec aExtensions; - bExternName = FALSE; + bExternName = false; if( eStatus != ConvOK ) { @@ -250,7 +250,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s aIn.Ignore( nUINT16 ); - bArrayFormula = TRUE; + bArrayFormula = sal_True; break; case 0x03: // Addition [312 264] aStack >> nMerk0; @@ -368,8 +368,8 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s break; case 0x19: // Special Attribute [327 279] { - UINT16 nData, nFakt; - BYTE nOpt; + sal_uInt16 nData, nFakt; + sal_uInt8 nOpt; aIn >> nOpt; @@ -535,7 +535,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s aSRD.nCol = static_cast<SCsCOL>(nByte); aSRD.nRow = nUINT16 & 0x3FFF; aSRD.nRelTab = 0; - aSRD.SetTabRel( TRUE ); + aSRD.SetTabRel( sal_True ); aSRD.SetFlag3D( bRangeName ); ExcRelToScRel( nUINT16, nByte, aSRD, bRangeName ); @@ -546,8 +546,8 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s case 0x6A: case 0x2A: // Deleted Cell Reference [323 273] // no information which part is deleted, set both - aSRD.SetColDeleted( TRUE ); - aSRD.SetRowDeleted( TRUE ); + aSRD.SetColDeleted( sal_True ); + aSRD.SetRowDeleted( sal_True ); } aStack << aPool.Store( aSRD ); @@ -559,16 +559,16 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s case 0x6B: case 0x2B: // Deleted Area Refernce [323 273] { - UINT16 nRowFirst, nRowLast; - UINT8 nColFirst, nColLast; + sal_uInt16 nRowFirst, nRowLast; + sal_uInt8 nColFirst, nColLast; ScSingleRefData& rSRef1 = aCRD.Ref1; ScSingleRefData& rSRef2 = aCRD.Ref2; aIn >> nRowFirst >> nRowLast >> nColFirst >> nColLast; rSRef1.nRelTab = rSRef2.nRelTab = 0; - rSRef1.SetTabRel( TRUE ); - rSRef2.SetTabRel( TRUE ); + rSRef1.SetTabRel( sal_True ); + rSRef2.SetTabRel( sal_True ); rSRef1.SetFlag3D( bRangeName ); rSRef2.SetFlag3D( bRangeName ); @@ -586,10 +586,10 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s case 0x6B: case 0x2B: // Deleted Area Refernce [323 273] // no information which part is deleted, set all - rSRef1.SetColDeleted( TRUE ); - rSRef1.SetRowDeleted( TRUE ); - rSRef2.SetColDeleted( TRUE ); - rSRef2.SetRowDeleted( TRUE ); + rSRef1.SetColDeleted( sal_True ); + rSRef1.SetRowDeleted( sal_True ); + rSRef2.SetColDeleted( sal_True ); + rSRef2.SetRowDeleted( sal_True ); } aStack << aPool.Store( aCRD ); @@ -617,7 +617,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s aIn >> nUINT16 >> nByte; // >> Attribute, Row >> Col aSRD.nRelTab = 0; - aSRD.SetTabRel( TRUE ); + aSRD.SetTabRel( sal_True ); aSRD.SetFlag3D( bRangeName ); ExcRelToScRel( nUINT16, nByte, aSRD, bRNorSF ); @@ -629,12 +629,12 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s case 0x6D: case 0x2D: // Area Reference Within a Name [324 ] { // Area Reference Within a Shared Formula[ 274] - UINT16 nRowFirst, nRowLast; - UINT8 nColFirst, nColLast; + sal_uInt16 nRowFirst, nRowLast; + sal_uInt8 nColFirst, nColLast; aCRD.Ref1.nRelTab = aCRD.Ref2.nRelTab = 0; - aCRD.Ref1.SetTabRel( TRUE ); - aCRD.Ref2.SetTabRel( TRUE ); + aCRD.Ref1.SetTabRel( sal_True ); + aCRD.Ref2.SetTabRel( sal_True ); aCRD.Ref1.SetFlag3D( bRangeName ); aCRD.Ref2.SetFlag3D( bRangeName ); @@ -682,12 +682,12 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s { const ExtName* pExtName = rR.pExtNameBuff->GetNameByIndex( nINT16, nUINT16 ); if( pExtName && pExtName->IsDDE() && - rR.pExtSheetBuff->IsLink( ( UINT16 ) nINT16 ) ) + rR.pExtSheetBuff->IsLink( ( sal_uInt16 ) nINT16 ) ) { String aAppl, aExtDoc; TokenId nPar1, nPar2; - rR.pExtSheetBuff->GetLink( ( UINT16 ) nINT16 , aAppl, aExtDoc ); + rR.pExtSheetBuff->GetLink( ( sal_uInt16 ) nINT16 , aAppl, aExtDoc ); nPar1 = aPool.Store( aAppl ); nPar2 = aPool.Store( aExtDoc ); nMerk0 = aPool.Store( pExtName->aName ); @@ -712,9 +712,9 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s case 0x7C: case 0x3C: // Deleted 3-D Cell Reference [ 277] { - UINT16 nTabFirst, nTabLast, nRow; - INT16 nExtSheet; - BYTE nCol; + sal_uInt16 nTabFirst, nTabLast, nRow; + sal_Int16 nExtSheet; + sal_uInt8 nCol; aIn >> nExtSheet; aIn.Ignore( 8 ); @@ -738,8 +738,8 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s if( nExtSheet <= 0 ) { // in aktuellem Workbook aSRD.nTab = static_cast<SCTAB>(nTabFirst); - aSRD.SetFlag3D( TRUE ); - aSRD.SetTabRel( FALSE ); + aSRD.SetFlag3D( sal_True ); + aSRD.SetTabRel( false ); ExcRelToScRel( nRow, nCol, aSRD, bRangeName ); @@ -749,11 +749,11 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s case 0x7C: case 0x3C: // Deleted 3-D Cell Reference [ 277] // no information which part is deleted, set both - aSRD.SetColDeleted( TRUE ); - aSRD.SetRowDeleted( TRUE ); + aSRD.SetColDeleted( sal_True ); + aSRD.SetRowDeleted( sal_True ); } if ( !ValidTab(static_cast<SCTAB>(nTabFirst)) ) - aSRD.SetTabDeleted( TRUE ); + aSRD.SetTabDeleted( sal_True ); if( nTabLast != nTabFirst ) { @@ -775,9 +775,9 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s case 0x7D: case 0x3D: // Deleted 3-D Area Reference [ 277] { - UINT16 nTabFirst, nTabLast, nRowFirst, nRowLast; - INT16 nExtSheet; - BYTE nColFirst, nColLast; + sal_uInt16 nTabFirst, nTabLast, nRowFirst, nRowLast; + sal_Int16 nExtSheet; + sal_uInt8 nColFirst, nColLast; aIn >> nExtSheet; aIn.Ignore( 8 ); @@ -808,10 +808,10 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s rR1.nTab = static_cast<SCTAB>(nTabFirst); rR2.nTab = static_cast<SCTAB>(nTabLast); - rR1.SetFlag3D( TRUE ); - rR1.SetTabRel( FALSE ); + rR1.SetFlag3D( sal_True ); + rR1.SetTabRel( false ); rR2.SetFlag3D( nTabFirst != nTabLast ); - rR2.SetTabRel( FALSE ); + rR2.SetTabRel( false ); ExcRelToScRel( nRowFirst, nColFirst, aCRD.Ref1, bRangeName ); ExcRelToScRel( nRowLast, nColLast, aCRD.Ref2, bRangeName ); @@ -827,21 +827,21 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s case 0x7D: case 0x3D: // Deleted 3-D Area Reference [ 277] // no information which part is deleted, set all - rR1.SetColDeleted( TRUE ); - rR1.SetRowDeleted( TRUE ); - rR2.SetColDeleted( TRUE ); - rR2.SetRowDeleted( TRUE ); + rR1.SetColDeleted( sal_True ); + rR1.SetRowDeleted( sal_True ); + rR2.SetColDeleted( sal_True ); + rR2.SetRowDeleted( sal_True ); } if ( !ValidTab(static_cast<SCTAB>(nTabFirst)) ) - rR1.SetTabDeleted( TRUE ); + rR1.SetTabDeleted( sal_True ); if ( !ValidTab(static_cast<SCTAB>(nTabLast)) ) - rR2.SetTabDeleted( TRUE ); + rR2.SetTabDeleted( sal_True ); aStack << aPool.Store( aCRD ); }//ENDE in aktuellem Workbook } break; - default: bError = TRUE; + default: bError = sal_True; } bError |= !aIn.IsValid(); } @@ -892,21 +892,21 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal SCsTAB nTab, const FORMULA_TYPE eFT ) { RootData& rR = GetOldRoot(); - BYTE nOp, nLen; + sal_uInt8 nOp, nLen; sal_Size nIgnore; - UINT16 nUINT16; - UINT8 nByte; - BOOL bError = FALSE; - BOOL bArrayFormula = FALSE; - const BOOL bRangeName = eFT == FT_RangeName; - const BOOL bSharedFormula = eFT == FT_SharedFormula; - const BOOL bRNorSF = bRangeName || bSharedFormula; + sal_uInt16 nUINT16; + sal_uInt8 nByte; + sal_Bool bError = false; + sal_Bool bArrayFormula = false; + const sal_Bool bRangeName = eFT == FT_RangeName; + const sal_Bool bSharedFormula = eFT == FT_SharedFormula; + const sal_Bool bRNorSF = bRangeName || bSharedFormula; ScSingleRefData aSRD; ScComplexRefData aCRD; aCRD.Ref1.nTab = aCRD.Ref2.nTab = aEingPos.Tab(); - bExternName = FALSE; + bExternName = false; if( eStatus != ConvOK ) { @@ -933,7 +933,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal case 0x01: // Array Formula [325 ] // Array Formula or Shared Formula [ 277] nIgnore = (meBiff == EXC_BIFF2) ? 3 : 4; - bArrayFormula = TRUE; + bArrayFormula = sal_True; break; case 0x02: // Data Table [325 277] nIgnore = (meBiff == EXC_BIFF2) ? 3 : 4; @@ -965,8 +965,8 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal break; case 0x19: // Special Attribute [327 279] { - UINT16 nData, nFakt; - BYTE nOpt; + sal_uInt16 nData, nFakt; + sal_uInt8 nOpt; aIn >> nOpt; @@ -1052,7 +1052,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal aSRD.nCol = static_cast<SCsCOL>(nByte); aSRD.nRow = nUINT16 & 0x3FFF; aSRD.nRelTab = 0; - aSRD.SetTabRel( TRUE ); + aSRD.SetTabRel( sal_True ); aSRD.SetFlag3D( bRangeName ); ExcRelToScRel( nUINT16, nByte, aSRD, bRangeName ); @@ -1063,16 +1063,16 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal case 0x65: case 0x25: // Area Reference [320 270] { - UINT16 nRowFirst, nRowLast; - UINT8 nColFirst, nColLast; + sal_uInt16 nRowFirst, nRowLast; + sal_uInt8 nColFirst, nColLast; ScSingleRefData &rSRef1 = aCRD.Ref1; ScSingleRefData &rSRef2 = aCRD.Ref2; aIn >> nRowFirst >> nRowLast >> nColFirst >> nColLast; rSRef1.nRelTab = rSRef2.nRelTab = 0; - rSRef1.SetTabRel( TRUE ); - rSRef2.SetTabRel( TRUE ); + rSRef1.SetTabRel( sal_True ); + rSRef2.SetTabRel( sal_True ); rSRef1.SetFlag3D( bRangeName ); rSRef2.SetFlag3D( bRangeName ); @@ -1116,7 +1116,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal aIn >> nUINT16 >> nByte; // >> Attribute, Row >> Col aSRD.nRelTab = 0; - aSRD.SetTabRel( TRUE ); + aSRD.SetTabRel( sal_True ); aSRD.SetFlag3D( bRangeName ); ExcRelToScRel( nUINT16, nByte, aSRD, bRNorSF ); @@ -1128,12 +1128,12 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal case 0x6D: case 0x2D: // Area Reference Within a Name [324 ] { // Area Reference Within a Shared Formula[ 274] - UINT16 nRowFirst, nRowLast; - UINT8 nColFirst, nColLast; + sal_uInt16 nRowFirst, nRowLast; + sal_uInt8 nColFirst, nColLast; aCRD.Ref1.nRelTab = aCRD.Ref2.nRelTab = 0; - aCRD.Ref1.SetTabRel( TRUE ); - aCRD.Ref2.SetTabRel( TRUE ); + aCRD.Ref1.SetTabRel( sal_True ); + aCRD.Ref2.SetTabRel( sal_True ); aCRD.Ref1.SetFlag3D( bRangeName ); aCRD.Ref2.SetFlag3D( bRangeName ); @@ -1175,9 +1175,9 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal case 0x7A: case 0x3A: // 3-D Cell Reference [ 275] { - UINT16 nTabFirst, nTabLast, nRow; - INT16 nExtSheet; - BYTE nCol; + sal_uInt16 nTabFirst, nTabLast, nRow; + sal_Int16 nExtSheet; + sal_uInt8 nCol; aIn >> nExtSheet; aIn.Ignore( 8 ); @@ -1201,10 +1201,10 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal if( nExtSheet <= 0 ) {// in aktuellem Workbook - BOOL b3D = ( static_cast<SCTAB>(nTabFirst) != aEingPos.Tab() ) || bRangeName; + sal_Bool b3D = ( static_cast<SCTAB>(nTabFirst) != aEingPos.Tab() ) || bRangeName; aSRD.nTab = static_cast<SCTAB>(nTabFirst); aSRD.SetFlag3D( b3D ); - aSRD.SetTabRel( FALSE ); + aSRD.SetTabRel( false ); ExcRelToScRel( nRow, nCol, aSRD, bRangeName ); @@ -1216,7 +1216,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal aCRD.Ref2.nTab = static_cast<SCTAB>(nTabLast); b3D = ( static_cast<SCTAB>(nTabLast) != aEingPos.Tab() ); aCRD.Ref2.SetFlag3D( b3D ); - aCRD.Ref2.SetTabRel( FALSE ); + aCRD.Ref2.SetTabRel( false ); rRangeList.Append( aCRD, nTab ); } else @@ -1229,9 +1229,9 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal case 0x7B: case 0x3B: // 3-D Area Reference [ 276] { - UINT16 nTabFirst, nTabLast, nRowFirst, nRowLast; - INT16 nExtSheet; - BYTE nColFirst, nColLast; + sal_uInt16 nTabFirst, nTabLast, nRowFirst, nRowLast; + sal_Int16 nExtSheet; + sal_uInt8 nColFirst, nColLast; aIn >> nExtSheet; aIn.Ignore( 8 ); @@ -1263,9 +1263,9 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal rR1.nTab = static_cast<SCTAB>(nTabFirst); rR2.nTab = static_cast<SCTAB>(nTabLast); rR1.SetFlag3D( ( static_cast<SCTAB>(nTabFirst) != aEingPos.Tab() ) || bRangeName ); - rR1.SetTabRel( FALSE ); + rR1.SetTabRel( false ); rR2.SetFlag3D( ( static_cast<SCTAB>(nTabLast) != aEingPos.Tab() ) || bRangeName ); - rR2.SetTabRel( FALSE ); + rR2.SetTabRel( false ); ExcRelToScRel( nRowFirst, nColFirst, aCRD.Ref1, bRangeName ); ExcRelToScRel( nRowLast, nColLast, aCRD.Ref2, bRangeName ); @@ -1289,7 +1289,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal case 0x3D: // Deleted 3-D Area Reference [ 277] nIgnore = 20; break; - default: bError = TRUE; + default: bError = sal_True; } bError |= !aIn.IsValid(); @@ -1320,11 +1320,11 @@ ConvErr ExcelToSc::ConvertExternName( const ScTokenArray*& /*rpArray*/, XclImpSt return ConvErrNi; } -BOOL ExcelToSc::GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen ) +sal_Bool ExcelToSc::GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen ) { DBG_ASSERT_BIFF( GetBiff() == EXC_BIFF5 ); if( GetBiff() != EXC_BIFF5 ) - return FALSE; + return false; sal_uInt8 nOp; sal_uInt16 nRow1, nRow2; @@ -1509,8 +1509,8 @@ BOOL ExcelToSc::GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Si break; case 0x19: // Special Attribute [327 279] { - BYTE nOpt; - UINT16 nData; + sal_uInt8 nOpt; + sal_uInt16 nData; rStrm >> nOpt >> nData; if( nOpt & 0x04 ) nSeek = nData * 2 + 2; @@ -1528,7 +1528,7 @@ BOOL ExcelToSc::GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Si void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz, sal_uInt8 nMinParamCount ) { TokenId eParam[ 256 ]; - INT32 nLauf; + sal_Int32 nLauf; if( eId == ocCeil || eId == ocFloor ) { @@ -1565,10 +1565,10 @@ void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz, sal_uInt8 nMinParamCo if( nAnz > 0 ) { // attention: 0 = last parameter, nAnz-1 = first parameter - INT16 nNull = -1; // skip this parameter - INT16 nSkipEnd = -1; // skip all parameters <= nSkipEnd + sal_Int16 nNull = -1; // skip this parameter + sal_Int16 nSkipEnd = -1; // skip all parameters <= nSkipEnd - INT16 nLast = nAnz - 1; + sal_Int16 nLast = nAnz - 1; // Funktionen, bei denen Parameter wegfallen muessen if( eId == ocPercentrank && nAnz == 3 ) @@ -1577,13 +1577,13 @@ void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz, sal_uInt8 nMinParamCo // Joost-Spezialfaelle else if( eId == ocIf ) { - UINT16 nNullParam = 0; + sal_uInt16 nNullParam = 0; for( nLauf = 0 ; nLauf < nAnz ; nLauf++ ) { if( aPool.IsSingleOp( eParam[ nLauf ], ocMissing ) ) { if( !nNullParam ) - nNullParam = (UINT16) aPool.Store( ( double ) 0.0 ); + nNullParam = (sal_uInt16) aPool.Store( ( double ) 0.0 ); eParam[ nLauf ] = nNullParam; } } @@ -1592,7 +1592,7 @@ void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz, sal_uInt8 nMinParamCo // FIXME: ideally we'd want to import all missing args, but this // conflicts with lots of fn's understanding of nParams - we need // a function table, and pre-call argument normalisation 1st. - INT16 nLastRemovable = nLast - nMinParamCount; + sal_Int16 nLastRemovable = nLast - nMinParamCount; // skip missing parameters at end of parameter list while( nSkipEnd < nLastRemovable && @@ -1619,36 +1619,36 @@ void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz, sal_uInt8 nMinParamCo } -void ExcelToSc::ExcRelToScRel( UINT16 nRow, UINT8 nCol, ScSingleRefData &rSRD, const BOOL bName ) +void ExcelToSc::ExcRelToScRel( sal_uInt16 nRow, sal_uInt8 nCol, ScSingleRefData &rSRD, const sal_Bool bName ) { if( bName ) { // C O L if( nRow & 0x4000 ) {// rel Col - rSRD.SetColRel( TRUE ); - rSRD.nRelCol = static_cast<SCsCOL>(static_cast<INT8>(nCol)); + rSRD.SetColRel( sal_True ); + rSRD.nRelCol = static_cast<SCsCOL>(static_cast<sal_Int8>(nCol)); } else {// abs Col - rSRD.SetColRel( FALSE ); + rSRD.SetColRel( false ); rSRD.nCol = static_cast<SCCOL>(nCol); } // R O W if( nRow & 0x8000 ) {// rel Row - rSRD.SetRowRel( TRUE ); + rSRD.SetRowRel( sal_True ); if( nRow & 0x2000 ) // Bit 13 gesetzt? // -> Row negativ - rSRD.nRelRow = static_cast<SCsROW>(static_cast<INT16>(nRow | 0xC000)); + rSRD.nRelRow = static_cast<SCsROW>(static_cast<sal_Int16>(nRow | 0xC000)); else // -> Row positiv rSRD.nRelRow = static_cast<SCsROW>(nRow & nRowMask); } else {// abs Row - rSRD.SetRowRel( FALSE ); + rSRD.SetRowRel( false ); rSRD.nRow = static_cast<SCROW>(nRow & nRowMask); } @@ -1682,7 +1682,7 @@ void ExcelToSc::ExcRelToScRel( UINT16 nRow, UINT8 nCol, ScSingleRefData &rSRD, c const ScTokenArray* ExcelToSc::GetBoolErr( XclBoolError eType ) { - UINT16 nError; + sal_uInt16 nError; aPool.Reset(); aStack.Reset(); @@ -1724,13 +1724,13 @@ const ScTokenArray* ExcelToSc::GetBoolErr( XclBoolError eType ) // if a shared formula was found, stream seeks to first byte after <nFormulaLen>, // else stream pointer stays unchanged -BOOL ExcelToSc::GetShrFmla( const ScTokenArray*& rpErgebnis, XclImpStream& aIn, sal_Size nFormulaLen ) +sal_Bool ExcelToSc::GetShrFmla( const ScTokenArray*& rpErgebnis, XclImpStream& aIn, sal_Size nFormulaLen ) { - BYTE nOp; - BOOL bRet = TRUE; + sal_uInt8 nOp; + sal_Bool bRet = sal_True; if( nFormulaLen == 0 ) - bRet = FALSE; + bRet = false; else { aIn.PushPosition(); @@ -1739,17 +1739,17 @@ BOOL ExcelToSc::GetShrFmla( const ScTokenArray*& rpErgebnis, XclImpStream& aIn, if( nOp == 0x01 ) // Shared Formula [ 277] { - UINT16 nCol, nRow; + sal_uInt16 nCol, nRow; aIn >> nRow >> nCol; aStack << aPool.Store( GetOldRoot().pShrfmlaBuff->Find( ScAddress( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), GetCurrScTab() ) ) ); - bRet = TRUE; + bRet = sal_True; } else - bRet = FALSE; + bRet = false; aIn.PopPosition(); } @@ -1768,7 +1768,7 @@ BOOL ExcelToSc::GetShrFmla( const ScTokenArray*& rpErgebnis, XclImpStream& aIn, void ExcelToSc::SetError( ScFormulaCell &rCell, const ConvErr eErr ) { - UINT16 nInd; + sal_uInt16 nInd; switch( eErr ) { @@ -1807,8 +1807,8 @@ void ExcelToSc::ReadExtensionArray( unsigned int n, XclImpStream& aIn ) { // printf( "inline array;\n" ); - BYTE nByte; - UINT16 nUINT16; + sal_uInt8 nByte; + sal_uInt16 nUINT16; double fDouble; String aString; ScMatrix* pMatrix; diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 772d41ddbcad..2508e20681f4 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -63,7 +63,7 @@ ExcelToSc8::~ExcelToSc8() { } -bool ExcelToSc8::GetExternalFileIdFromXti( UINT16 nIxti, sal_uInt16& rFileId ) const +bool ExcelToSc8::GetExternalFileIdFromXti( sal_uInt16 nIxti, sal_uInt16& rFileId ) const { const String* pFileUrl = rLinkMan.GetSupbookUrl(nIxti); if (!pFileUrl || pFileUrl->Len() == 0 || !GetDocShell()) @@ -76,7 +76,7 @@ bool ExcelToSc8::GetExternalFileIdFromXti( UINT16 nIxti, sal_uInt16& rFileId ) c return true; } -bool ExcelToSc8::Read3DTabReference( UINT16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo ) +bool ExcelToSc8::Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo ) { rFirstTab = rLastTab = 0; rExtInfo.mbExternal = !rLinkMan.IsSelfRef(nIxti); @@ -97,16 +97,16 @@ bool ExcelToSc8::Read3DTabReference( UINT16 nIxti, SCTAB& rFirstTab, SCTAB& rLas // otherwise it will seek to the first byte past additional content after <nFormulaLen> ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT ) { - BYTE nOp, nLen, nByte; - UINT16 nUINT16; + sal_uInt8 nOp, nLen, nByte; + sal_uInt16 nUINT16; double fDouble; String aString; - BOOL bError = FALSE; - BOOL bArrayFormula = FALSE; + sal_Bool bError = false; + sal_Bool bArrayFormula = false; TokenId nMerk0; - const BOOL bRangeName = eFT == FT_RangeName; - const BOOL bSharedFormula = eFT == FT_SharedFormula; - const BOOL bRNorSF = bRangeName || bSharedFormula; + const sal_Bool bRangeName = eFT == FT_RangeName; + const sal_Bool bSharedFormula = eFT == FT_SharedFormula; + const sal_Bool bRNorSF = bRangeName || bSharedFormula; ScSingleRefData aSRD; ScComplexRefData aCRD; @@ -143,7 +143,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x02: // Data Table [325 277] aIn.Ignore( 4 ); - bArrayFormula = TRUE; + bArrayFormula = sal_True; break; case 0x03: // Addition [312 264] aStack >> nMerk0; @@ -261,8 +261,8 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, break; case 0x18: // natural language formula { - UINT8 nEptg; - UINT16 nCol, nRow; + sal_uInt8 nEptg; + sal_uInt16 nCol, nRow; aIn >> nEptg; switch( nEptg ) { // name size ext type @@ -280,9 +280,9 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, aSRD.InitAddress( ScAddress( static_cast<SCCOL>(nCol & 0xFF), static_cast<SCROW>(nRow), aEingPos.Tab() ) ); if( nEptg == 0x02 || nEptg == 0x06 ) - aSRD.SetRowRel( TRUE ); + aSRD.SetRowRel( sal_True ); else - aSRD.SetColRel( TRUE ); + aSRD.SetColRel( sal_True ); aSRD.CalcRelFromAbs( aEingPos ); @@ -294,7 +294,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, aSRD.InitAddress( ScAddress( static_cast<SCCOL>(nCol & 0xFF), static_cast<SCROW>(nRow), aEingPos.Tab() ) ); - aSRD.SetColRel( TRUE ); + aSRD.SetColRel( sal_True ); aSRD.CalcRelFromAbs( aEingPos ); @@ -329,8 +329,8 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, break; case 0x19: // Special Attribute [327 279] { - UINT16 nData, nFakt; - BYTE nOpt; + sal_uInt16 nData, nFakt; + sal_uInt8 nOpt; aIn >> nOpt >> nData; nFakt = 2; @@ -445,14 +445,14 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x6A: case 0x2A: // Deleted Cell Reference [323 273] { - UINT16 nCol, nRow; + sal_uInt16 nCol, nRow; aIn >> nRow >> nCol; aSRD.nCol = static_cast<SCCOL>(nCol); aSRD.nRow = nRow & 0x3FFF; aSRD.nRelTab = 0; - aSRD.SetTabRel( TRUE ); + aSRD.SetTabRel( sal_True ); aSRD.SetFlag3D( bRangeName ); ExcRelToScRel8( nRow, nCol, aSRD, bRangeName ); @@ -463,8 +463,8 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x6A: case 0x2A: // Deleted Cell Reference [323 273] // no information which part is deleted, set both - aSRD.SetColDeleted( TRUE ); - aSRD.SetRowDeleted( TRUE ); + aSRD.SetColDeleted( sal_True ); + aSRD.SetRowDeleted( sal_True ); } aStack << aPool.Store( aSRD ); @@ -477,16 +477,16 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x6B: case 0x2B: // Deleted Area Refernce [323 273] { - UINT16 nRowFirst, nRowLast; - UINT16 nColFirst, nColLast; + sal_uInt16 nRowFirst, nRowLast; + sal_uInt16 nColFirst, nColLast; ScSingleRefData &rSRef1 = aCRD.Ref1; ScSingleRefData &rSRef2 = aCRD.Ref2; aIn >> nRowFirst >> nRowLast >> nColFirst >> nColLast; rSRef1.nRelTab = rSRef2.nRelTab = 0; - rSRef1.SetTabRel( TRUE ); - rSRef2.SetTabRel( TRUE ); + rSRef1.SetTabRel( sal_True ); + rSRef2.SetTabRel( sal_True ); rSRef1.SetFlag3D( bRangeName ); rSRef2.SetFlag3D( bRangeName ); @@ -504,10 +504,10 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x6B: case 0x2B: // Deleted Area Refernce [323 273] // no information which part is deleted, set all - rSRef1.SetColDeleted( TRUE ); - rSRef1.SetRowDeleted( TRUE ); - rSRef2.SetColDeleted( TRUE ); - rSRef2.SetRowDeleted( TRUE ); + rSRef1.SetColDeleted( sal_True ); + rSRef1.SetRowDeleted( sal_True ); + rSRef2.SetColDeleted( sal_True ); + rSRef2.SetRowDeleted( sal_True ); } aStack << aPool.Store( aCRD ); @@ -543,12 +543,12 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x2C: // Cell Reference Within a Name [323 ] // Cell Reference Within a Shared Formula[ 273] { - UINT16 nRow, nCol; + sal_uInt16 nRow, nCol; aIn >> nRow >> nCol; aSRD.nRelTab = 0; - aSRD.SetTabRel( TRUE ); + aSRD.SetTabRel( sal_True ); aSRD.SetFlag3D( bRangeName ); ExcRelToScRel8( nRow, nCol, aSRD, bRNorSF ); @@ -560,12 +560,12 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x6D: case 0x2D: // Area Reference Within a Name [324 ] { // Area Reference Within a Shared Formula[ 274] - UINT16 nRowFirst, nRowLast; - UINT16 nColFirst, nColLast; + sal_uInt16 nRowFirst, nRowLast; + sal_uInt16 nColFirst, nColLast; aCRD.Ref1.nRelTab = aCRD.Ref2.nRelTab = 0; - aCRD.Ref1.SetTabRel( TRUE ); - aCRD.Ref2.SetTabRel( TRUE ); + aCRD.Ref1.SetTabRel( sal_True ); + aCRD.Ref2.SetTabRel( sal_True ); aCRD.Ref1.SetFlag3D( bRangeName ); aCRD.Ref2.SetFlag3D( bRangeName ); @@ -699,7 +699,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x7C: case 0x3C: // Deleted 3-D Cell Reference [ 277] { - UINT16 nIxti, nRw, nGrbitCol; + sal_uInt16 nIxti, nRw, nGrbitCol; SCTAB nTabFirst, nTabLast; aIn >> nIxti >> nRw >> nGrbitCol; @@ -713,8 +713,8 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, } aSRD.nTab = nTabFirst; - aSRD.SetFlag3D( TRUE ); - aSRD.SetTabRel( FALSE ); + aSRD.SetFlag3D( sal_True ); + aSRD.SetTabRel( false ); ExcRelToScRel8( nRw, nGrbitCol, aSRD, bRangeName ); @@ -724,8 +724,8 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x7C: case 0x3C: // Deleted 3-D Cell Reference [ 277] // no information which part is deleted, set both - aSRD.SetColDeleted( TRUE ); - aSRD.SetRowDeleted( TRUE ); + aSRD.SetColDeleted( sal_True ); + aSRD.SetRowDeleted( sal_True ); } if (aExtInfo.mbExternal) @@ -748,7 +748,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, else { if ( !ValidTab(nTabFirst)) - aSRD.SetTabDeleted( TRUE ); + aSRD.SetTabDeleted( sal_True ); if( nTabLast != nTabFirst ) { @@ -769,7 +769,7 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x7D: case 0x3D: // Deleted 3-D Area Reference [ 277] { - UINT16 nIxti, nRw1, nGrbitCol1, nRw2, nGrbitCol2; + sal_uInt16 nIxti, nRw1, nGrbitCol1, nRw2, nGrbitCol2; SCTAB nTabFirst, nTabLast; aIn >> nIxti >> nRw1 >> nRw2 >> nGrbitCol1 >> nGrbitCol2; @@ -786,10 +786,10 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, rR1.nTab = nTabFirst; rR2.nTab = nTabLast; - rR1.SetFlag3D( TRUE ); - rR1.SetTabRel( FALSE ); + rR1.SetFlag3D( sal_True ); + rR1.SetTabRel( false ); rR2.SetFlag3D( nTabFirst != nTabLast ); - rR2.SetTabRel( FALSE ); + rR2.SetTabRel( false ); ExcRelToScRel8( nRw1, nGrbitCol1, aCRD.Ref1, bRangeName ); ExcRelToScRel8( nRw2, nGrbitCol2, aCRD.Ref2, bRangeName ); @@ -805,10 +805,10 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x7D: case 0x3D: // Deleted 3-D Area Reference [ 277] // no information which part is deleted, set all - rR1.SetColDeleted( TRUE ); - rR1.SetRowDeleted( TRUE ); - rR2.SetColDeleted( TRUE ); - rR2.SetRowDeleted( TRUE ); + rR1.SetColDeleted( sal_True ); + rR1.SetRowDeleted( sal_True ); + rR2.SetColDeleted( sal_True ); + rR2.SetRowDeleted( sal_True ); } if (aExtInfo.mbExternal) @@ -818,15 +818,15 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, else { if ( !ValidTab(nTabFirst) ) - rR1.SetTabDeleted( TRUE ); + rR1.SetTabDeleted( sal_True ); if ( !ValidTab(nTabLast) ) - rR2.SetTabDeleted( TRUE ); + rR2.SetTabDeleted( sal_True ); aStack << aPool.Store( aCRD ); } } break; - default: bError = TRUE; + default: bError = sal_True; } bError |= !aIn.IsValid(); } @@ -871,16 +871,16 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT ) { - BYTE nOp, nLen;//, nByte; - BOOL bError = FALSE; - const BOOL bRangeName = eFT == FT_RangeName; - const BOOL bSharedFormula = eFT == FT_SharedFormula; - const BOOL bRNorSF = bRangeName || bSharedFormula; + sal_uInt8 nOp, nLen;//, nByte; + sal_Bool bError = false; + const sal_Bool bRangeName = eFT == FT_RangeName; + const sal_Bool bSharedFormula = eFT == FT_SharedFormula; + const sal_Bool bRNorSF = bRangeName || bSharedFormula; ScSingleRefData aSRD; ScComplexRefData aCRD; - bExternName = FALSE; + bExternName = false; if( eStatus != ConvOK ) { @@ -938,8 +938,8 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa break; case 0x19: // Special Attribute [327 279] { - UINT16 nData, nFakt; - BYTE nOpt; + sal_uInt16 nData, nFakt; + sal_uInt8 nOpt; aIn >> nOpt >> nData; nFakt = 2; @@ -985,14 +985,14 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa case 0x64: case 0x24: // Cell Reference [319 270] { - UINT16 nCol, nRow; + sal_uInt16 nCol, nRow; aIn >> nRow >> nCol; aSRD.nCol = static_cast<SCCOL>(nCol); aSRD.nRow = nRow & 0x3FFF; aSRD.nRelTab = 0; - aSRD.SetTabRel( TRUE ); + aSRD.SetTabRel( sal_True ); aSRD.SetFlag3D( bRangeName ); ExcRelToScRel8( nRow, nCol, aSRD, bRangeName ); @@ -1004,16 +1004,16 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa case 0x65: case 0x25: // Area Reference [320 270] { - UINT16 nRowFirst, nRowLast; - UINT16 nColFirst, nColLast; + sal_uInt16 nRowFirst, nRowLast; + sal_uInt16 nColFirst, nColLast; ScSingleRefData &rSRef1 = aCRD.Ref1; ScSingleRefData &rSRef2 = aCRD.Ref2; aIn >> nRowFirst >> nRowLast >> nColFirst >> nColLast; rSRef1.nRelTab = rSRef2.nRelTab = 0; - rSRef1.SetTabRel( TRUE ); - rSRef2.SetTabRel( TRUE ); + rSRef1.SetTabRel( sal_True ); + rSRef2.SetTabRel( sal_True ); rSRef1.SetFlag3D( bRangeName ); rSRef2.SetFlag3D( bRangeName ); @@ -1059,12 +1059,12 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa case 0x2C: // Cell Reference Within a Name [323 ] // Cell Reference Within a Shared Formula[ 273] { - UINT16 nRow, nCol; + sal_uInt16 nRow, nCol; aIn >> nRow >> nCol; aSRD.nRelTab = 0; - aSRD.SetTabRel( TRUE ); + aSRD.SetTabRel( sal_True ); aSRD.SetFlag3D( bRangeName ); ExcRelToScRel8( nRow, nCol, aSRD, bRNorSF ); @@ -1076,12 +1076,12 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa case 0x6D: case 0x2D: // Area Reference Within a Name [324 ] { // Area Reference Within a Shared Formula[ 274] - UINT16 nRowFirst, nRowLast; - UINT16 nColFirst, nColLast; + sal_uInt16 nRowFirst, nRowLast; + sal_uInt16 nColFirst, nColLast; aCRD.Ref1.nRelTab = aCRD.Ref2.nRelTab = 0; - aCRD.Ref1.SetTabRel( TRUE ); - aCRD.Ref2.SetTabRel( TRUE ); + aCRD.Ref1.SetTabRel( sal_True ); + aCRD.Ref2.SetTabRel( sal_True ); aCRD.Ref1.SetFlag3D( bRangeName ); aCRD.Ref2.SetFlag3D( bRangeName ); @@ -1118,7 +1118,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa case 0x7A: case 0x3A: // 3-D Cell Reference [ 275] { - UINT16 nIxti, nRw, nGrbitCol; + sal_uInt16 nIxti, nRw, nGrbitCol; aIn >> nIxti >> nRw >> nGrbitCol; @@ -1126,8 +1126,8 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa if( rLinkMan.GetScTabRange( nFirstScTab, nLastScTab, nIxti ) ) { aSRD.nTab = nFirstScTab; - aSRD.SetFlag3D( TRUE ); - aSRD.SetTabRel( FALSE ); + aSRD.SetFlag3D( sal_True ); + aSRD.SetTabRel( false ); ExcRelToScRel8( nRw, nGrbitCol, aSRD, bRangeName ); @@ -1148,7 +1148,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa case 0x7B: case 0x3B: // 3-D Area Reference [ 276] { - UINT16 nIxti, nRw1, nGrbitCol1, nRw2, nGrbitCol2; + sal_uInt16 nIxti, nRw1, nGrbitCol1, nRw2, nGrbitCol2; aIn >> nIxti >> nRw1 >> nRw2 >> nGrbitCol1 >> nGrbitCol2; @@ -1160,10 +1160,10 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa rR1.nTab = nFirstScTab; rR2.nTab = nLastScTab; - rR1.SetFlag3D( TRUE ); - rR1.SetTabRel( FALSE ); + rR1.SetFlag3D( sal_True ); + rR1.SetTabRel( false ); rR2.SetFlag3D( nFirstScTab != nLastScTab ); - rR2.SetTabRel( FALSE ); + rR2.SetTabRel( false ); ExcRelToScRel8( nRw1, nGrbitCol1, aCRD.Ref1, bRangeName ); ExcRelToScRel8( nRw2, nGrbitCol2, aCRD.Ref2, bRangeName ); @@ -1188,7 +1188,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa aIn.Ignore( 10 ); break; default: - bError = TRUE; + bError = sal_True; } bError |= !aIn.IsValid(); } @@ -1358,11 +1358,11 @@ ConvErr ExcelToSc8::ConvertExternName( const ScTokenArray*& rpArray, XclImpStrea return eRet; } -void ExcelToSc8::ExcRelToScRel8( UINT16 nRow, UINT16 nC, ScSingleRefData &rSRD, const BOOL bName ) +void ExcelToSc8::ExcRelToScRel8( sal_uInt16 nRow, sal_uInt16 nC, ScSingleRefData &rSRD, const sal_Bool bName ) { - const BOOL bColRel = ( nC & 0x4000 ) != 0; - const BOOL bRowRel = ( nC & 0x8000 ) != 0; - const UINT8 nCol = static_cast<UINT8>(nC); + const sal_Bool bColRel = ( nC & 0x4000 ) != 0; + const sal_Bool bRowRel = ( nC & 0x8000 ) != 0; + const sal_uInt8 nCol = static_cast<sal_uInt8>(nC); rSRD.SetColRel( bColRel ); rSRD.SetRowRel( bRowRel ); @@ -1372,7 +1372,7 @@ void ExcelToSc8::ExcRelToScRel8( UINT16 nRow, UINT16 nC, ScSingleRefData &rSRD, // C O L if( bColRel ) // rel Col - rSRD.nRelCol = static_cast<SCsCOL>(static_cast<INT8>(nC)); + rSRD.nRelCol = static_cast<SCsCOL>(static_cast<sal_Int8>(nC)); else // abs Col rSRD.nCol = static_cast<SCCOL>(nCol); @@ -1380,7 +1380,7 @@ void ExcelToSc8::ExcRelToScRel8( UINT16 nRow, UINT16 nC, ScSingleRefData &rSRD, // R O W if( bRowRel ) // rel Row - rSRD.nRelRow = static_cast<SCsROW>(static_cast<INT16>(nRow)); + rSRD.nRelRow = static_cast<SCsROW>(static_cast<sal_Int16>(nRow)); else // abs Row rSRD.nRow = Min( static_cast<SCROW>(nRow), MAXROW); @@ -1413,12 +1413,12 @@ void ExcelToSc8::ExcRelToScRel8( UINT16 nRow, UINT16 nC, ScSingleRefData &rSRD, // stream seeks to first byte after <nLen> -BOOL ExcelToSc8::GetAbsRefs( ScRangeList& r, XclImpStream& aIn, sal_Size nLen ) +sal_Bool ExcelToSc8::GetAbsRefs( ScRangeList& r, XclImpStream& aIn, sal_Size nLen ) { - UINT8 nOp; - UINT16 nRow1, nRow2, nCol1, nCol2; + sal_uInt8 nOp; + sal_uInt16 nRow1, nRow2, nCol1, nCol2; SCTAB nTab1, nTab2; - UINT16 nIxti; + sal_uInt16 nIxti; sal_Size nSeek; @@ -1558,7 +1558,7 @@ BOOL ExcelToSc8::GetAbsRefs( ScRangeList& r, XclImpStream& aIn, sal_Size nLen ) break; case 0x17: // String Constant [314 266] { - UINT8 nStrLen; + sal_uInt8 nStrLen; aIn >> nStrLen; aIn.IgnoreUniString( nStrLen ); // reads Grbit even if nLen==0 nSeek = 0; @@ -1566,8 +1566,8 @@ BOOL ExcelToSc8::GetAbsRefs( ScRangeList& r, XclImpStream& aIn, sal_Size nLen ) break; case 0x19: // Special Attribute [327 279] { - UINT16 nData; - UINT8 nOpt; + sal_uInt16 nData; + sal_uInt8 nOpt; aIn >> nOpt >> nData; if( nOpt & 0x04 ) {// nFakt -> Bytes oder Words ueberlesen AttrChoose diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index b18e3a33b323..beb64b9b30ca 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -31,10 +31,9 @@ #include "excimp8.hxx" -#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> - #include <scitems.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/mediadescriptor.hxx> #include <unotools/fltrcfg.hxx> #include <svtools/wmf.hxx> @@ -43,6 +42,11 @@ #include <sfx2/docfile.hxx> #include <sfx2/objsh.hxx> +#include <sfx2/request.hxx> +#include <sfx2/app.hxx> +#include <sfx2/docinf.hxx> +#include <sfx2/frame.hxx> + #include <editeng/brshitem.hxx> #include <editeng/editdata.hxx> #include <editeng/editeng.hxx> @@ -55,19 +59,16 @@ #include <editeng/crsditem.hxx> #include <editeng/flditem.hxx> #include <svx/xflclit.hxx> -#include <filter/msfilter/svxmsbas.hxx> -#include <basic/basmgr.hxx> #include <vcl/graph.hxx> #include <vcl/bmpacc.hxx> #include <sot/exchange.hxx> -#include <sfx2/docinf.hxx> +#include <svl/stritem.hxx> #include <tools/string.hxx> #include <tools/urlobj.hxx> #include <rtl/math.hxx> -#include <rtl/ustrbuf.hxx> #include <unotools/localedatawrapper.hxx> #include <unotools/charclass.hxx> #include <drwlayer.hxx> @@ -249,8 +250,8 @@ void ImportExcel8::Iteration( void ) void ImportExcel8::Boundsheet( void ) { - UINT8 nLen; - UINT16 nGrbit; + sal_uInt8 nLen; + sal_uInt16 nGrbit; aIn.DisableDecryption(); maSheetOffsets.push_back( aIn.ReaduInt32() ); @@ -268,7 +269,7 @@ void ImportExcel8::Boundsheet( void ) } if( ( nGrbit & 0x0001 ) || ( nGrbit & 0x0002 ) ) - pD->SetVisible( nScTab, FALSE ); + pD->SetVisible( nScTab, false ); if( !pD->RenameTab( nScTab, aName ) ) { @@ -282,7 +283,7 @@ void ImportExcel8::Boundsheet( void ) void ImportExcel8::Scenman( void ) { - UINT16 nLastDispl; + sal_uInt16 nLastDispl; aIn.Ignore( 4 ); aIn >> nLastDispl; @@ -300,8 +301,8 @@ void ImportExcel8::Scenario( void ) void ImportExcel8::Labelsst( void ) { XclAddress aXclPos; - UINT16 nXF; - UINT32 nSst; + sal_uInt16 nXF; + sal_uInt32 nSst; aIn >> aXclPos >> nXF >> nSst; @@ -324,8 +325,7 @@ void ImportExcel8::ReadBasic( void ) { SfxObjectShell* pShell = GetDocShell(); SotStorageRef xRootStrg = GetRootStorage(); - SvtFilterOptions* pFilterOpt = SvtFilterOptions::Get(); - if( pShell && xRootStrg.Is() && pFilterOpt ) + if( pShell && xRootStrg.Is() ) try { bool bLoadCode = pFilterOpt->IsLoadExcelBasicCode(); bool bLoadExecutable = pFilterOpt->IsLoadExcelBasicExecutable(); @@ -392,6 +392,15 @@ void ImportExcel8::ReadBasic( void ) catch( uno::Exception& ) { } + 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 ); + xFilter->filter( aMediaDesc.getAsConstPropertyValueList() ); + } + catch( uno::Exception& ) + { } } @@ -498,10 +507,10 @@ XclImpAutoFilterData::XclImpAutoFilterData( RootData* pRoot, const ScRange& rRan ExcRoot( pRoot ), pCurrDBData(NULL), nFirstEmpty( 0 ), - bActive( FALSE ), - bHasConflict( FALSE ), - bCriteria( FALSE ), - bAutoOrAdvanced(FALSE), + bActive( false ), + bHasConflict( false ), + bCriteria( false ), + bAutoOrAdvanced(false), aFilterName(rName) { aParam.nCol1 = rRange.aStart.Col(); @@ -510,7 +519,7 @@ XclImpAutoFilterData::XclImpAutoFilterData( RootData* pRoot, const ScRange& rRan aParam.nCol2 = rRange.aEnd.Col(); aParam.nRow2 = rRange.aEnd.Row(); - aParam.bInplace = TRUE; + aParam.bInplace = sal_True; } @@ -518,7 +527,7 @@ void XclImpAutoFilterData::CreateFromDouble( String& rStr, double fVal ) { rStr += String( ::rtl::math::doubleToUString( fVal, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), TRUE)); + ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), sal_True)); } void XclImpAutoFilterData::SetCellAttribs() @@ -526,7 +535,7 @@ void XclImpAutoFilterData::SetCellAttribs() ScDocument& rDoc = pExcRoot->pIR->GetDoc(); for ( SCCOL nCol = StartCol(); nCol <= EndCol(); nCol++ ) { - INT16 nFlag = ((ScMergeFlagAttr*) rDoc.GetAttr( nCol, StartRow(), Tab(), ATTR_MERGE_FLAG ))->GetValue(); + sal_Int16 nFlag = ((ScMergeFlagAttr*) rDoc.GetAttr( nCol, StartRow(), Tab(), ATTR_MERGE_FLAG ))->GetValue(); rDoc.ApplyAttr( nCol, StartRow(), Tab(), ScMergeFlagAttr( nFlag | SC_MF_AUTO) ); } } @@ -536,7 +545,7 @@ void XclImpAutoFilterData::InsertQueryParam() if( pCurrDBData && !bHasConflict ) { ScRange aAdvRange; - BOOL bHasAdv = pCurrDBData->GetAdvancedQuerySource( aAdvRange ); + sal_Bool bHasAdv = pCurrDBData->GetAdvancedQuerySource( aAdvRange ); if( bHasAdv ) pExcRoot->pIR->GetDoc().CreateQueryParam( aAdvRange.aStart.Col(), aAdvRange.aStart.Row(), aAdvRange.aEnd.Col(), aAdvRange.aEnd.Row(), @@ -547,7 +556,7 @@ void XclImpAutoFilterData::InsertQueryParam() pCurrDBData->SetAdvancedQuerySource( &aAdvRange ); else { - pCurrDBData->SetAutoFilter( TRUE ); + pCurrDBData->SetAutoFilter( sal_True ); SetCellAttribs(); } } @@ -587,14 +596,14 @@ static void ExcelQueryToOooQuery( ScQueryEntry& rEntry ) void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm ) { - UINT16 nCol, nFlags; + sal_uInt16 nCol, nFlags; rStrm >> nCol >> nFlags; ScQueryConnect eConn = ::get_flagvalue( nFlags, EXC_AFFLAG_ANDORMASK, SC_OR, SC_AND ); - BOOL bTop10 = ::get_flag( nFlags, EXC_AFFLAG_TOP10 ); - BOOL bTopOfTop10 = ::get_flag( nFlags, EXC_AFFLAG_TOP10TOP ); - BOOL bPercent = ::get_flag( nFlags, EXC_AFFLAG_TOP10PERC ); - UINT16 nCntOfTop10 = nFlags >> 7; + sal_Bool bTop10 = ::get_flag( nFlags, EXC_AFFLAG_TOP10 ); + sal_Bool bTopOfTop10 = ::get_flag( nFlags, EXC_AFFLAG_TOP10TOP ); + sal_Bool bPercent = ::get_flag( nFlags, EXC_AFFLAG_TOP10PERC ); + sal_uInt16 nCntOfTop10 = nFlags >> 7; SCSIZE nCount = aParam.GetEntryCount(); if( bTop10 ) @@ -602,8 +611,8 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm ) if( nFirstEmpty < nCount ) { ScQueryEntry& aEntry = aParam.GetEntry( nFirstEmpty ); - aEntry.bDoQuery = TRUE; - aEntry.bQueryByString = TRUE; + aEntry.bDoQuery = sal_True; + aEntry.bQueryByString = sal_True; aEntry.nField = static_cast<SCCOLROW>(StartCol() + static_cast<SCCOL>(nCol)); aEntry.eOp = bTopOfTop10 ? (bPercent ? SC_TOPPERC : SC_TOPVAL) : (bPercent ? SC_BOTPERC : SC_BOTVAL); @@ -616,12 +625,12 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm ) } else { - UINT8 nE, nType, nOper, nBoolErr, nVal; - INT32 nRK; + sal_uInt8 nE, nType, nOper, nBoolErr, nVal; + sal_Int32 nRK; double fVal; - BOOL bIgnore; + sal_Bool bIgnore; - UINT8 nStrLen[ 2 ] = { 0, 0 }; + sal_uInt8 nStrLen[ 2 ] = { 0, 0 }; ScQueryEntry *pQueryEntries[ 2 ] = { NULL, NULL }; for( nE = 0; nE < 2; nE++ ) @@ -630,7 +639,7 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm ) { ScQueryEntry& aEntry = aParam.GetEntry( nFirstEmpty ); pQueryEntries[ nE ] = &aEntry; - bIgnore = FALSE; + bIgnore = false; rStrm >> nType >> nOper; switch( nOper ) @@ -678,21 +687,21 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm ) rStrm >> nBoolErr >> nVal; rStrm.Ignore( 6 ); aEntry.pStr->Assign( String::CreateFromInt32( (sal_Int32) nVal ) ); - bIgnore = (BOOL) nBoolErr; + bIgnore = (sal_Bool) nBoolErr; break; case EXC_AFTYPE_EMPTY: - aEntry.bQueryByString = FALSE; + aEntry.bQueryByString = false; aEntry.nVal = SC_EMPTYFIELDS; aEntry.eOp = SC_EQUAL; break; case EXC_AFTYPE_NOTEMPTY: - aEntry.bQueryByString = FALSE; + aEntry.bQueryByString = false; aEntry.nVal = SC_NONEMPTYFIELDS; aEntry.eOp = SC_EQUAL; break; default: rStrm.Ignore( 8 ); - bIgnore = TRUE; + bIgnore = sal_True; } /* #i39464# conflict, if two conditions of one column are 'OR'ed, @@ -702,11 +711,11 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm ) 'A1 AND (B1 OR B2)' in this case, but Calc would do '(A1 AND B1) OR B2' instead. */ if( (nFirstEmpty > 1) && nE && (eConn == SC_OR) && !bIgnore ) - bHasConflict = TRUE; + bHasConflict = sal_True; if( !bHasConflict && !bIgnore ) { - aEntry.bDoQuery = TRUE; - aEntry.bQueryByString = TRUE; + aEntry.bDoQuery = sal_True; + aEntry.bQueryByString = sal_True; aEntry.nField = static_cast<SCCOLROW>(StartCol() + static_cast<SCCOL>(nCol)); aEntry.eConnect = nE ? eConn : SC_AND; nFirstEmpty++; @@ -731,10 +740,10 @@ void XclImpAutoFilterData::SetAdvancedRange( const ScRange* pRange ) if (pRange) { aCriteriaRange = *pRange; - bCriteria = TRUE; + bCriteria = sal_True; } else - bCriteria = FALSE; + bCriteria = false; } void XclImpAutoFilterData::SetExtractPos( const ScAddress& rAddr ) @@ -742,11 +751,11 @@ void XclImpAutoFilterData::SetExtractPos( const ScAddress& rAddr ) aParam.nDestCol = rAddr.Col(); aParam.nDestRow = rAddr.Row(); aParam.nDestTab = rAddr.Tab(); - aParam.bInplace = FALSE; - aParam.bDestPers = TRUE; + aParam.bInplace = false; + aParam.bDestPers = sal_True; } -void XclImpAutoFilterData::Apply( const BOOL bUseUnNamed ) +void XclImpAutoFilterData::Apply( const sal_Bool bUseUnNamed ) { CreateScDBData(bUseUnNamed); @@ -758,7 +767,7 @@ void XclImpAutoFilterData::Apply( const BOOL bUseUnNamed ) // SCROW nRow1 = StartRow(); // SCROW nRow2 = EndRow(); // size_t nRows = nRow2 - nRow1 + 1; -// boost::scoped_array<BYTE> pFlags( new BYTE[nRows]); +// boost::scoped_array<sal_uInt8> pFlags( new sal_uInt8[nRows]); // pExcRoot->pDoc->GetRowFlagsArray( Tab()).FillDataArray( nRow1, nRow2, // pFlags.get()); // for (size_t j=0; j<nRows; ++j) @@ -770,7 +779,7 @@ void XclImpAutoFilterData::Apply( const BOOL bUseUnNamed ) } } -void XclImpAutoFilterData::CreateScDBData( const BOOL bUseUnNamed ) +void XclImpAutoFilterData::CreateScDBData( const sal_Bool bUseUnNamed ) { // Create the ScDBData() object if the AutoFilter is activated @@ -809,7 +818,7 @@ void XclImpAutoFilterData::EnableRemoveFilter() if( !bActive && bAutoOrAdvanced ) { ScQueryEntry& aEntry = aParam.GetEntry( nFirstEmpty ); - aEntry.bDoQuery = TRUE; + aEntry.bDoQuery = sal_True; ++nFirstEmpty; } @@ -818,7 +827,7 @@ void XclImpAutoFilterData::EnableRemoveFilter() // inside the advanced range } -void XclImpAutoFilterData::AmendAFName(const BOOL bUseUnNamed) +void XclImpAutoFilterData::AmendAFName(const sal_Bool bUseUnNamed) { // If-and-only-if we have one AF filter then // use the Calc "unnamed" range name. Calc diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 032a540c867a..ec4c425c1621 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -97,15 +97,13 @@ #include "xcl97rec.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::com::sun::star::uno::Sequence; - - using ::rtl::OString; //--------------------------------------------------------- class ExcDummy_00 - -const BYTE ExcDummy_00::pMyData[] = { +const sal_uInt8 ExcDummy_00::pMyData[] = { 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, @@ -114,20 +112,20 @@ const BYTE ExcDummy_00::pMyData[] = { const sal_Size ExcDummy_00::nMyLen = sizeof( ExcDummy_00::pMyData ); //-------------------------------------------------------- class ExcDummy_04x - -const BYTE ExcDummy_040::pMyData[] = { +const sal_uInt8 ExcDummy_040::pMyData[] = { 0x40, 0x00, 0x02, 0x00, 0x00, 0x00, // BACKUP 0x8d, 0x00, 0x02, 0x00, 0x00, 0x00, // HIDEOBJ }; const sal_Size ExcDummy_040::nMyLen = sizeof( ExcDummy_040::pMyData ); -const BYTE ExcDummy_041::pMyData[] = { +const sal_uInt8 ExcDummy_041::pMyData[] = { 0x0e, 0x00, 0x02, 0x00, 0x01, 0x00, // PRECISION 0xda, 0x00, 0x02, 0x00, 0x00, 0x00 // BOOKBOOL }; const sal_Size ExcDummy_041::nMyLen = sizeof( ExcDummy_041::pMyData ); //-------------------------------------------------------- class ExcDummy_02a - -const BYTE ExcDummy_02a::pMyData[] = { +const sal_uInt8 ExcDummy_02a::pMyData[] = { 0x0d, 0x00, 0x02, 0x00, 0x01, 0x00, // CALCMODE 0x0c, 0x00, 0x02, 0x00, 0x64, 0x00, // CALCCOUNT 0x0f, 0x00, 0x02, 0x00, 0x01, 0x00, // REFMODE @@ -167,7 +165,7 @@ void ExcEmptyRec::Save( XclExpStream& /*rStrm*/ ) } -UINT16 ExcEmptyRec::GetNum() const +sal_uInt16 ExcEmptyRec::GetNum() const { return 0; } @@ -205,7 +203,7 @@ void ExcDummyRec::Save( XclExpStream& rStrm ) } -UINT16 ExcDummyRec::GetNum( void ) const +sal_uInt16 ExcDummyRec::GetNum( void ) const { return 0x0000; } @@ -216,7 +214,7 @@ UINT16 ExcDummyRec::GetNum( void ) const void ExcBoolRecord::SaveCont( XclExpStream& rStrm ) { - rStrm << (UINT16)(bVal ? 0x0001 : 0x0000); + rStrm << (sal_uInt16)(bVal ? 0x0001 : 0x0000); } @@ -253,7 +251,7 @@ void ExcBof::SaveCont( XclExpStream& rStrm ) } -UINT16 ExcBof::GetNum( void ) const +sal_uInt16 ExcBof::GetNum( void ) const { return 0x0809; } @@ -282,7 +280,7 @@ void ExcBofW::SaveCont( XclExpStream& rStrm ) -UINT16 ExcBofW::GetNum( void ) const +sal_uInt16 ExcBofW::GetNum( void ) const { return 0x0809; } @@ -298,7 +296,7 @@ sal_Size ExcBofW::GetLen( void ) const //-------------------------------------------------------------- class ExcEof - -UINT16 ExcEof::GetNum( void ) const +sal_uInt16 ExcEof::GetNum( void ) const { return 0x000A; } @@ -319,7 +317,7 @@ sal_Size ExcDummy_00::GetLen( void ) const } -const BYTE* ExcDummy_00::GetData( void ) const +const sal_uInt8* ExcDummy_00::GetData( void ) const { return pMyData; } @@ -334,7 +332,7 @@ sal_Size ExcDummy_040::GetLen( void ) const } -const BYTE* ExcDummy_040::GetData( void ) const +const sal_uInt8* ExcDummy_040::GetData( void ) const { return pMyData; } @@ -348,7 +346,7 @@ sal_Size ExcDummy_041::GetLen( void ) const } -const BYTE* ExcDummy_041::GetData( void ) const +const sal_uInt8* ExcDummy_041::GetData( void ) const { return pMyData; } @@ -360,12 +358,12 @@ const BYTE* ExcDummy_041::GetData( void ) const Exc1904::Exc1904( ScDocument& rDoc ) { Date* pDate = rDoc.GetFormatTable()->GetNullDate(); - bVal = pDate ? (*pDate == Date( 1, 1, 1904 )) : FALSE; - bDateCompatibility = pDate ? !( *pDate == Date( 30, 12, 1899 )) : FALSE; + bVal = pDate ? (*pDate == Date( 1, 1, 1904 )) : false; + bDateCompatibility = pDate ? !( *pDate == Date( 30, 12, 1899 )) : false; } -UINT16 Exc1904::GetNum( void ) const +sal_uInt16 Exc1904::GetNum( void ) const { return 0x0022; } @@ -421,7 +419,7 @@ void ExcBundlesheetBase::UpdateStreamPos( XclExpStream& rStrm ) } -UINT16 ExcBundlesheetBase::GetNum( void ) const +sal_uInt16 ExcBundlesheetBase::GetNum( void ) const { return 0x0085; } @@ -441,7 +439,7 @@ ExcBundlesheet::ExcBundlesheet( RootData& rRootData, SCTAB _nTab ) : void ExcBundlesheet::SaveCont( XclExpStream& rStrm ) { nOwnPos = rStrm.GetSvStreamPos(); - rStrm << (UINT32) 0x00000000 // dummy (stream position of the sheet) + rStrm << (sal_uInt32) 0x00000000 // dummy (stream position of the sheet) << nGrbit; rStrm.WriteByteString( aName ); // 8 bit length, max 255 chars } @@ -460,7 +458,7 @@ sal_Size ExcDummy_02a::GetLen( void ) const return nMyLen; } -const BYTE* ExcDummy_02a::GetData( void ) const +const sal_uInt8* ExcDummy_02a::GetData( void ) const { return pMyData; } @@ -593,7 +591,7 @@ sal_Size ExcFilterCondition::GetTextBytes() const return pText ? (1 + pText->GetBufferSize()) : 0; } -void ExcFilterCondition::SetCondition( UINT8 nTp, UINT8 nOp, double fV, String* pT ) +void ExcFilterCondition::SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, double fV, String* pT ) { nType = nTp; nOper = nOp; @@ -613,17 +611,17 @@ void ExcFilterCondition::Save( XclExpStream& rStrm ) break; case EXC_AFTYPE_STRING: DBG_ASSERT( pText, "ExcFilterCondition::Save() -- pText is NULL!" ); - rStrm << (UINT32)0 << (UINT8) pText->Len() << (UINT16)0 << (UINT8)0; + rStrm << (sal_uInt32)0 << (sal_uInt8) pText->Len() << (sal_uInt16)0 << (sal_uInt8)0; break; case EXC_AFTYPE_BOOLERR: - rStrm << (UINT8)0 << (UINT8)((fVal != 0) ? 1 : 0) << (UINT32)0 << (UINT16)0; + rStrm << (sal_uInt8)0 << (sal_uInt8)((fVal != 0) ? 1 : 0) << (sal_uInt32)0 << (sal_uInt16)0; break; default: - rStrm << (UINT32)0 << (UINT32)0; + rStrm << (sal_uInt32)0 << (sal_uInt32)0; } } -static const char* lcl_GetOperator( UINT8 nOper ) +static const char* lcl_GetOperator( sal_uInt8 nOper ) { switch( nOper ) { @@ -638,7 +636,7 @@ static const char* lcl_GetOperator( UINT8 nOper ) } } -static OString lcl_GetValue( UINT8 nType, double fVal, XclExpString* pStr ) +static OString lcl_GetValue( sal_uInt8 nType, double fVal, XclExpString* pStr ) { switch( nType ) { @@ -672,7 +670,7 @@ void ExcFilterCondition::SaveText( XclExpStream& rStrm ) // ---------------------------------------------------------------------------- -XclExpAutofilter::XclExpAutofilter( const XclExpRoot& rRoot, UINT16 nC ) : +XclExpAutofilter::XclExpAutofilter( const XclExpRoot& rRoot, sal_uInt16 nC ) : XclExpRecord( EXC_ID_AUTOFILTER, 24 ), XclExpRoot( rRoot ), nCol( nC ), @@ -680,13 +678,13 @@ XclExpAutofilter::XclExpAutofilter( const XclExpRoot& rRoot, UINT16 nC ) : { } -BOOL XclExpAutofilter::AddCondition( ScQueryConnect eConn, UINT8 nType, UINT8 nOp, - double fVal, String* pText, BOOL bSimple ) +sal_Bool XclExpAutofilter::AddCondition( ScQueryConnect eConn, sal_uInt8 nType, sal_uInt8 nOp, + double fVal, String* pText, sal_Bool bSimple ) { if( !aCond[ 1 ].IsEmpty() ) - return FALSE; + return false; - UINT16 nInd = aCond[ 0 ].IsEmpty() ? 0 : 1; + sal_uInt16 nInd = aCond[ 0 ].IsEmpty() ? 0 : 1; if( nInd == 1 ) nFlags |= (eConn == SC_OR) ? EXC_AFFLAG_OR : EXC_AFFLAG_AND; @@ -697,12 +695,12 @@ BOOL XclExpAutofilter::AddCondition( ScQueryConnect eConn, UINT8 nType, UINT8 nO AddRecSize( aCond[ nInd ].GetTextBytes() ); - return TRUE; + return sal_True; } -BOOL XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry ) +sal_Bool XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry ) { - BOOL bConflict = FALSE; + sal_Bool bConflict = false; String sText; if( rEntry.pStr ) @@ -732,23 +730,23 @@ BOOL XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry ) } } - BOOL bLen = sText.Len() > 0; + sal_Bool bLen = sText.Len() > 0; // empty/nonempty fields if( !bLen && (rEntry.nVal == SC_EMPTYFIELDS) ) - bConflict = !AddCondition( rEntry.eConnect, EXC_AFTYPE_EMPTY, EXC_AFOPER_NONE, 0.0, NULL, TRUE ); + bConflict = !AddCondition( rEntry.eConnect, EXC_AFTYPE_EMPTY, EXC_AFOPER_NONE, 0.0, NULL, sal_True ); else if( !bLen && (rEntry.nVal == SC_NONEMPTYFIELDS) ) - bConflict = !AddCondition( rEntry.eConnect, EXC_AFTYPE_NOTEMPTY, EXC_AFOPER_NONE, 0.0, NULL, TRUE ); + bConflict = !AddCondition( rEntry.eConnect, EXC_AFTYPE_NOTEMPTY, EXC_AFOPER_NONE, 0.0, NULL, sal_True ); // other conditions else { double fVal = 0.0; sal_uInt32 nIndex = 0; - BOOL bIsNum = bLen ? GetFormatter().IsNumberFormat( sText, nIndex, fVal ) : TRUE; + sal_Bool bIsNum = bLen ? GetFormatter().IsNumberFormat( sText, nIndex, fVal ) : sal_True; String* pText = bIsNum ? NULL : &sText; // top10 flags - UINT16 nNewFlags = 0x0000; + sal_uInt16 nNewFlags = 0x0000; switch( rEntry.eOp ) { case SC_TOPVAL: @@ -765,7 +763,7 @@ BOOL XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry ) break; default:; } - BOOL bNewTop10 = ::get_flag( nNewFlags, EXC_AFFLAG_TOP10 ); + sal_Bool bNewTop10 = ::get_flag( nNewFlags, EXC_AFFLAG_TOP10 ); bConflict = HasTop10() && bNewTop10; if( !bConflict ) @@ -774,13 +772,13 @@ BOOL XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry ) { if( fVal < 0 ) fVal = 0; if( fVal >= 501 ) fVal = 500; - nFlags |= (nNewFlags | (UINT16)(fVal) << 7); + nFlags |= (nNewFlags | (sal_uInt16)(fVal) << 7); } // normal condition else { - UINT8 nType = bIsNum ? EXC_AFTYPE_DOUBLE : EXC_AFTYPE_STRING; - UINT8 nOper = EXC_AFOPER_NONE; + sal_uInt8 nType = bIsNum ? EXC_AFTYPE_DOUBLE : EXC_AFTYPE_STRING; + sal_uInt8 nOper = EXC_AFOPER_NONE; switch( rEntry.eOp ) { @@ -862,9 +860,9 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) : XclExpNameManager& rNameMgr = GetNameManager(); // search for first DB-range with filter - UINT16 nIndex = 0; - BOOL bFound = FALSE; - BOOL bAdvanced = FALSE; + sal_uInt16 nIndex = 0; + sal_Bool bFound = false; + sal_Bool bAdvanced = false; ScDBData* pData = NULL; ScRange aAdvRange; while( (nIndex < rDBColl.GetCount()) && !bFound ) @@ -917,9 +915,9 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) : // AutoFilter else { - BOOL bConflict = FALSE; - BOOL bContLoop = TRUE; - BOOL bHasOr = FALSE; + sal_Bool bConflict = false; + sal_Bool bContLoop = sal_True; + sal_Bool bHasOr = false; SCCOLROW nFirstField = aParam.GetEntry( 0 ).nField; // create AUTOFILTER records for filtered columns @@ -984,12 +982,12 @@ XclExpAutofilter* ExcAutoFilterRecs::GetByCol( SCCOL nCol ) return xFilter.get(); } -BOOL ExcAutoFilterRecs::IsFiltered( SCCOL nCol ) +sal_Bool ExcAutoFilterRecs::IsFiltered( SCCOL nCol ) { for( size_t nPos = 0, nSize = maFilterList.GetSize(); nPos < nSize; ++nPos ) if( maFilterList.GetRecord( nPos )->GetCol() == static_cast<sal_uInt16>(nCol) ) - return TRUE; - return FALSE; + return sal_True; + return false; } void ExcAutoFilterRecs::AddObjRecs() diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx index 4797d4b71c7b..2b442a240bb8 100644 --- a/sc/source/filter/excel/exctools.cxx +++ b/sc/source/filter/excel/exctools.cxx @@ -161,7 +161,7 @@ void XclImpOutlineBuffer::MakeScOutline() else if (nFirstPos > 0) bCollapsed = maCollapsedPosSet.count(nFirstPos-1) > 0; - BOOL bDummy; + sal_Bool bDummy; mpOutlineArray->Insert(nFirstPos, nPos-1, bDummy, bCollapsed); } } @@ -193,8 +193,8 @@ ExcScenarioCell::ExcScenarioCell( const UINT16 nC, const UINT16 nR ) ExcScenario::ExcScenario( XclImpStream& rIn, const RootData& rR ) : nTab( rR.pIR->GetCurrScTab() ) { - UINT16 nCref; - UINT8 nName, nComment; + sal_uInt16 nCref; + sal_uInt8 nName, nComment; rIn >> nCref; rIn >> nProtected; @@ -217,8 +217,8 @@ ExcScenario::ExcScenario( XclImpStream& rIn, const RootData& rR ) else pComment = new String; - UINT16 n = nCref; - UINT16 nC, nR; + sal_uInt16 n = nCref; + sal_uInt16 nC, nR; while( n ) { rIn >> nR >> nC; @@ -245,16 +245,16 @@ ExcScenario::~ExcScenario() delete pUserName; } -void ExcScenario::Apply( const XclImpRoot& rRoot, const BOOL bLast ) +void ExcScenario::Apply( const XclImpRoot& rRoot, const sal_Bool bLast ) { ScDocument& r = rRoot.GetDoc(); String aSzenName( *pName ); - UINT16 nNewTab = nTab + 1; + sal_uInt16 nNewTab = nTab + 1; if( !r.InsertTab( nNewTab, aSzenName ) ) return; - r.SetScenario( nNewTab, TRUE ); + r.SetScenario( nNewTab, true ); // do not show scenario frames r.SetScenarioData( nNewTab, *pComment, COL_LIGHTGRAY, /*SC_SCENARIO_SHOWFRAME|*/SC_SCENARIO_COPYALL|(nProtected ? SC_SCENARIO_PROTECT : 0) ); @@ -271,7 +271,7 @@ void ExcScenario::Apply( const XclImpRoot& rRoot, const BOOL bLast ) } if( bLast ) - r.SetActiveScenario( nNewTab, TRUE ); + r.SetActiveScenario( nNewTab, sal_True ); // modify what the Active tab is set to if the new // scenario tab occurs before the active tab. diff --git a/sc/source/filter/excel/expop2.cxx b/sc/source/filter/excel/expop2.cxx index 643b557300c6..f52c0d7feec2 100644 --- a/sc/source/filter/excel/expop2.cxx +++ b/sc/source/filter/excel/expop2.cxx @@ -98,7 +98,7 @@ FltError ExportBiff5::Write() if( pDocShell && xRootStrg.Is() && bWriteBasicStrg ) { SvxImportMSVBasic aBasicImport( *pDocShell, *xRootStrg, bWriteBasicCode, bWriteBasicStrg ); - ULONG nErr = aBasicImport.SaveOrDelMSVBAStorage( TRUE, EXC_STORAGE_VBA_PROJECT ); + sal_uLong nErr = aBasicImport.SaveOrDelMSVBAStorage( sal_True, EXC_STORAGE_VBA_PROJECT ); if( nErr != ERRCODE_NONE ) pDocShell->SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } @@ -119,7 +119,7 @@ FltError ExportBiff5::Write() if ( SvtFilterOptions::Get()->IsEnableCalcPreview() ) { ::boost::shared_ptr<GDIMetaFile> pMetaFile = - pDocShell->GetPreviewMetaFile (sal_False); + pDocShell->GetPreviewMetaFile (false); uno::Sequence<sal_uInt8> metaFile( sfx2::convertMetaFile(pMetaFile.get())); sfx2::SaveOlePropertySet(xDocProps, xRootStrg, &metaFile); diff --git a/sc/source/filter/excel/fontbuff.cxx b/sc/source/filter/excel/fontbuff.cxx index 21f99163f52a..26db50f0166f 100644 --- a/sc/source/filter/excel/fontbuff.cxx +++ b/sc/source/filter/excel/fontbuff.cxx @@ -49,11 +49,11 @@ #include "patattr.hxx" #include "ftools.hxx" -const UINT16 LotusFontBuffer::nSize = 8; +const sal_uInt16 LotusFontBuffer::nSize = 8; -void LotusFontBuffer::Fill( const UINT8 nIndex, SfxItemSet& rItemSet ) +void LotusFontBuffer::Fill( const sal_uInt8 nIndex, SfxItemSet& rItemSet ) { - UINT8 nIntIndex = nIndex & 0x07; + sal_uInt8 nIntIndex = nIndex & 0x07; ENTRY* pAkt = pData + nIntIndex; @@ -94,7 +94,7 @@ void LotusFontBuffer::Fill( const UINT8 nIndex, SfxItemSet& rItemSet ) } -void LotusFontBuffer::SetName( const UINT16 nIndex, const String& rName ) +void LotusFontBuffer::SetName( const sal_uInt16 nIndex, const String& rName ) { DBG_ASSERT( nIndex < nSize, "*LotusFontBuffer::SetName(): Array zu klein!" ); if( nIndex < nSize ) @@ -108,15 +108,15 @@ void LotusFontBuffer::SetName( const UINT16 nIndex, const String& rName ) } -void LotusFontBuffer::SetHeight( const UINT16 nIndex, const UINT16 nHeight ) +void LotusFontBuffer::SetHeight( const sal_uInt16 nIndex, const sal_uInt16 nHeight ) { DBG_ASSERT( nIndex < nSize, "*LotusFontBuffer::SetHeight(): Array zu klein!" ); if( nIndex < nSize ) - pData[ nIndex ].Height( *( new SvxFontHeightItem( ( ULONG ) nHeight * 20, 100, ATTR_FONT_HEIGHT ) ) ); + pData[ nIndex ].Height( *( new SvxFontHeightItem( ( sal_uLong ) nHeight * 20, 100, ATTR_FONT_HEIGHT ) ) ); } -void LotusFontBuffer::SetType( const UINT16 nIndex, const UINT16 nType ) +void LotusFontBuffer::SetType( const sal_uInt16 nIndex, const sal_uInt16 nType ) { DBG_ASSERT( nIndex < nSize, "*LotusFontBuffer::SetType(): Array zu klein!" ); if( nIndex < nSize ) diff --git a/sc/source/filter/excel/frmbase.cxx b/sc/source/filter/excel/frmbase.cxx index 26db049dfdb8..0b34736d8c8f 100644 --- a/sc/source/filter/excel/frmbase.cxx +++ b/sc/source/filter/excel/frmbase.cxx @@ -35,10 +35,10 @@ _ScRangeListTabs::_ScRangeListTabs() { ppTabLists = new _ScRangeList*[ MAXTAB + 1 ]; - for( UINT16 n = 0 ; n <= MAXTAB ; n++ ) + for( sal_uInt16 n = 0 ; n <= MAXTAB ; n++ ) ppTabLists[ n ] = NULL; - bHasRanges = FALSE; + bHasRanges = false; pAct = NULL; nAct = 0; } @@ -47,7 +47,7 @@ _ScRangeListTabs::~_ScRangeListTabs() { if( bHasRanges ) { - for( UINT16 n = 0 ; n <= MAXTAB ; n++ ) + for( sal_uInt16 n = 0 ; n <= MAXTAB ; n++ ) { if( ppTabLists[ n ] ) delete ppTabLists[ n ]; @@ -58,7 +58,7 @@ _ScRangeListTabs::~_ScRangeListTabs() } -void _ScRangeListTabs::Append( ScSingleRefData a, SCsTAB nTab, const BOOL b ) +void _ScRangeListTabs::Append( ScSingleRefData a, SCsTAB nTab, const sal_Bool b ) { if( b ) { @@ -76,7 +76,7 @@ void _ScRangeListTabs::Append( ScSingleRefData a, SCsTAB nTab, const BOOL b ) DBG_ASSERT( ValidTab(a.nTab), "-_ScRangeListTabs::Append(): Luegen haben kurze Abstuerze!" ); } - bHasRanges = TRUE; + bHasRanges = sal_True; if( nTab == SCTAB_MAX) return; @@ -94,7 +94,7 @@ void _ScRangeListTabs::Append( ScSingleRefData a, SCsTAB nTab, const BOOL b ) } } -void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const BOOL b ) +void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const sal_Bool b ) { if( b ) { @@ -140,7 +140,7 @@ void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const BOOL b ) "+_ScRangeListTabs::Append(): 3D-Ranges werden in SC nicht unterstuetzt!" ); } - bHasRanges = TRUE; + bHasRanges = sal_True; if( nTab == SCTAB_MAX) return; @@ -188,7 +188,7 @@ const ScRange* _ScRangeListTabs::Next () return NULL; } -ConverterBase::ConverterBase( UINT16 nNewBuffer ) : +ConverterBase::ConverterBase( sal_uInt16 nNewBuffer ) : aEingPos( 0, 0, 0 ), eStatus( ConvOK ), nBufferSize( nNewBuffer ) @@ -212,7 +212,7 @@ void ConverterBase::Reset() -ExcelConverterBase::ExcelConverterBase( UINT16 nNewBuffer ) : +ExcelConverterBase::ExcelConverterBase( sal_uInt16 nNewBuffer ) : ConverterBase( nNewBuffer ) { } @@ -236,7 +236,7 @@ void ExcelConverterBase::Reset() -LotusConverterBase::LotusConverterBase( SvStream &rStr, UINT16 nNewBuffer ) : +LotusConverterBase::LotusConverterBase( SvStream &rStr, sal_uInt16 nNewBuffer ) : ConverterBase( nNewBuffer ), aIn( rStr ), nBytesLeft( 0 ) diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index 6267c64a2c3c..7f862721a3b2 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -89,7 +89,7 @@ #include "excimp8.hxx" #include "excform.hxx" -#if defined( WNT ) || defined( WIN ) +#if defined( WNT ) #include <math.h> #else #include <stdlib.h> @@ -147,7 +147,7 @@ ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ): // ab Biff8 pFormConv = pExcRoot->pFmlaConverter = new ExcelToSc( GetRoot() ); - bTabTruncated = FALSE; + bTabTruncated = false; // Excel-Dokument per Default auf 31.12.1899, entspricht Excel-Einstellungen mit 1.1.1900 ScDocOptions aOpt = pD->GetDocOptions(); @@ -156,9 +156,9 @@ ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ): pD->GetFormatTable()->ChangeNullDate( 30, 12, 1899 ); ScDocOptions aDocOpt( pD->GetDocOptions() ); - aDocOpt.SetIgnoreCase( TRUE ); // always in Excel - aDocOpt.SetFormulaRegexEnabled( FALSE ); // regular expressions? what's that? - aDocOpt.SetLookUpColRowNames( FALSE ); // default: no natural language refs + aDocOpt.SetIgnoreCase( sal_True ); // always in Excel + aDocOpt.SetFormulaRegexEnabled( false ); // regular expressions? what's that? + aDocOpt.SetLookUpColRowNames( false ); // default: no natural language refs pD->SetDocOptions( aDocOpt ); } @@ -183,7 +183,7 @@ void ImportExcel::ReadFileSharing() if( (nRecommendReadOnly != 0) || (nPasswordHash != 0) ) { if( SfxItemSet* pItemSet = GetMedium().GetItemSet() ) - pItemSet->Put( SfxBoolItem( SID_DOC_READONLY, TRUE ) ); + pItemSet->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) ); if( SfxObjectShell* pShell = GetDocShell() ) { @@ -384,7 +384,7 @@ void ImportExcel::Window1() void ImportExcel::Row25( void ) { - UINT16 nRow, nRowHeight; + sal_uInt16 nRow, nRowHeight; aIn >> nRow; aIn.Ignore( 4 ); // Mic und Mac ueberspringen @@ -400,7 +400,7 @@ void ImportExcel::Row25( void ) } else {// -------------------- BIFF5 - UINT16 nGrbit; + sal_uInt16 nGrbit; aIn.Ignore( 2 ); // reserved aIn >> nGrbit; @@ -467,8 +467,8 @@ void ImportExcel:: WinProtection( void ) void ImportExcel::Columndefault( void ) {// Default Cell Attributes - UINT16 nColMic, nColMac; - BYTE nOpt0; + sal_uInt16 nColMic, nColMac; + sal_uInt8 nOpt0; aIn >> nColMic >> nColMac; @@ -478,9 +478,9 @@ void ImportExcel::Columndefault( void ) nColMac--; if( nColMac > MAXCOL ) - nColMac = static_cast<UINT16>(MAXCOL); + nColMac = static_cast<sal_uInt16>(MAXCOL); - for( UINT16 nCol = nColMic ; nCol <= nColMac ; nCol++ ) + for( sal_uInt16 nCol = nColMic ; nCol <= nColMac ; nCol++ ) { aIn >> nOpt0; aIn.Ignore( 2 ); // nur 0. Attribut-Byte benutzt @@ -493,8 +493,8 @@ void ImportExcel::Columndefault( void ) void ImportExcel::Array25( void ) { - UINT16 nFirstRow, nLastRow, nFormLen; - BYTE nFirstCol, nLastCol; + sal_uInt16 nFirstRow, nLastRow, nFormLen; + sal_uInt8 nFirstCol, nLastCol; aIn >> nFirstRow >> nLastRow >> nFirstCol >> nLastCol; @@ -532,7 +532,7 @@ void ImportExcel::Array25( void ) void ImportExcel::Rec1904( void ) { - UINT16 n1904; + sal_uInt16 n1904; aIn >> n1904; @@ -548,12 +548,12 @@ void ImportExcel::Rec1904( void ) void ImportExcel::Externname25( void ) { - UINT32 nRes; - UINT16 nOpt; + sal_uInt32 nRes; + sal_uInt16 nOpt; aIn >> nOpt >> nRes; - String aName( aIn.ReadByteString( FALSE ) ); + String aName( aIn.ReadByteString( false ) ); if( ( nOpt & 0x0001 ) || ( ( nOpt & 0xFFFE ) == 0x0000 ) ) {// external name @@ -573,16 +573,16 @@ void ImportExcel::Externname25( void ) void ImportExcel::Colwidth( void ) {// Column Width - BYTE nColFirst, nColLast; - UINT16 nColWidth; + sal_uInt8 nColFirst, nColLast; + sal_uInt16 nColWidth; aIn >> nColFirst >> nColLast >> nColWidth; //! TODO: add a check for the unlikely case of changed MAXCOL (-> XclImpAddressConverter) // if( nColLast > MAXCOL ) -// nColLast = static_cast<UINT16>(MAXCOL); +// nColLast = static_cast<sal_uInt16>(MAXCOL); - USHORT nScWidth = XclTools::GetScColumnWidth( nColWidth, GetCharWidth() ); + sal_uInt16 nScWidth = XclTools::GetScColumnWidth( nColWidth, GetCharWidth() ); pColRowBuff->SetWidthRange( nColFirst, nColLast, nScWidth ); } @@ -641,7 +641,7 @@ void ImportExcel::DefColWidth( void ) long nFontHt = GetFontBuffer().GetAppFontData().mnHeight; fDefWidth += XclTools::GetXclDefColWidthCorrection( nFontHt ); - USHORT nScWidth = XclTools::GetScColumnWidth( limit_cast< sal_uInt16 >( fDefWidth ), GetCharWidth() ); + sal_uInt16 nScWidth = XclTools::GetScColumnWidth( limit_cast< sal_uInt16 >( fDefWidth ), GetCharWidth() ); pColRowBuff->SetDefWidth( nScWidth ); } @@ -653,8 +653,8 @@ void ImportExcel::Builtinfmtcnt( void ) void ImportExcel::Colinfo( void ) {// Column Formatting Information - UINT16 nColFirst, nColLast, nColWidth, nXF; - UINT16 nOpt; + sal_uInt16 nColFirst, nColLast, nColWidth, nXF; + sal_uInt16 nOpt; aIn >> nColFirst >> nColLast >> nColWidth >> nXF >> nOpt; @@ -662,7 +662,7 @@ void ImportExcel::Colinfo( void ) return; if( nColLast > MAXCOL ) - nColLast = static_cast<UINT16>(MAXCOL); + nColLast = static_cast<sal_uInt16>(MAXCOL); bool bHidden = ::get_flag( nOpt, EXC_COLINFO_HIDDEN ); bool bCollapsed = ::get_flag( nOpt, EXC_COLINFO_COLLAPSED ); @@ -672,7 +672,7 @@ void ImportExcel::Colinfo( void ) if( bHidden ) pColRowBuff->HideColRange( nColFirst, nColLast ); - USHORT nScWidth = XclTools::GetScColumnWidth( nColWidth, GetCharWidth() ); + sal_uInt16 nScWidth = XclTools::GetScColumnWidth( nColWidth, GetCharWidth() ); pColRowBuff->SetWidthRange( nColFirst, nColLast, nScWidth ); pColRowBuff->SetDefaultXF( nColFirst, nColLast, nXF ); } @@ -680,7 +680,7 @@ void ImportExcel::Colinfo( void ) void ImportExcel::Wsbool( void ) { - UINT16 nFlags; + sal_uInt16 nFlags; aIn >> nFlags; pRowOutlineBuff->SetButtonMode( ::get_flag( nFlags, EXC_WSBOOL_ROWBELOW ) ); @@ -692,7 +692,7 @@ void ImportExcel::Wsbool( void ) void ImportExcel::Boundsheet( void ) { - UINT16 nGrbit = 0; + sal_uInt16 nGrbit = 0; if( GetBiff() == EXC_BIFF5 ) { @@ -702,7 +702,7 @@ void ImportExcel::Boundsheet( void ) aIn >> nGrbit; } - String aName( aIn.ReadByteString( FALSE ) ); + String aName( aIn.ReadByteString( false ) ); SCTAB nScTab = static_cast< SCTAB >( nBdshtTab ); if( nScTab > 0 ) @@ -712,7 +712,7 @@ void ImportExcel::Boundsheet( void ) } if( ( nGrbit & 0x0001 ) || ( nGrbit & 0x0002 ) ) - pD->SetVisible( nScTab, FALSE ); + pD->SetVisible( nScTab, false ); if( !pD->RenameTab( nScTab, aName ) ) { @@ -746,7 +746,7 @@ void ImportExcel::ReadUsesElfs() if( maStrm.ReaduInt16() != 0 ) { ScDocOptions aDocOpt = GetDoc().GetDocOptions(); - aDocOpt.SetLookUpColRowNames( TRUE ); + aDocOpt.SetLookUpColRowNames( sal_True ); GetDoc().SetDocOptions( aDocOpt ); } } @@ -754,7 +754,7 @@ void ImportExcel::ReadUsesElfs() void ImportExcel::Hideobj( void ) { - UINT16 nHide; + sal_uInt16 nHide; ScVObjMode eOle, eChart, eDraw; aIn >> nHide; @@ -795,15 +795,15 @@ void ImportExcel::Bundleheader( void ) void ImportExcel::Standardwidth( void ) { - USHORT nScWidth = XclTools::GetScColumnWidth( maStrm.ReaduInt16(), GetCharWidth() ); - pColRowBuff->SetDefWidth( nScWidth, TRUE ); + sal_uInt16 nScWidth = XclTools::GetScColumnWidth( maStrm.ReaduInt16(), GetCharWidth() ); + pColRowBuff->SetDefWidth( nScWidth, sal_True ); } void ImportExcel::Shrfmla( void ) { - UINT16 nFirstRow, nLastRow, nLenExpr; - BYTE nFirstCol, nLastCol; + sal_uInt16 nFirstRow, nLastRow, nLenExpr; + sal_uInt8 nFirstCol, nLastCol; aIn >> nFirstRow >> nLastRow >> nFirstCol >> nLastCol; aIn.Ignore( 2 ); @@ -829,8 +829,8 @@ void ImportExcel::Shrfmla( void ) void ImportExcel::Mulrk( void ) { XclAddress aXclPos; - UINT16 nXF; - INT32 nRkNum; + sal_uInt16 nXF; + sal_Int32 nRkNum; aIn >> aXclPos; @@ -851,7 +851,7 @@ void ImportExcel::Mulrk( void ) void ImportExcel::Mulblank( void ) { XclAddress aXclPos; - UINT16 nXF; + sal_uInt16 nXF; aIn >> aXclPos; @@ -927,7 +927,7 @@ void ImportExcel::Olesize( void ) void ImportExcel::Row34( void ) { - UINT16 nRow, nRowHeight, nGrbit, nXF; + sal_uInt16 nRow, nRowHeight, nGrbit, nXF; aIn >> nRow; aIn.Ignore( 4 ); // Mic und Mac ueberspringen @@ -972,8 +972,8 @@ void ImportExcel::Bof3( void ) void ImportExcel::Array34( void ) { - UINT16 nFirstRow, nLastRow, nFormLen; - BYTE nFirstCol, nLastCol; + sal_uInt16 nFirstRow, nLastRow, nFormLen; + sal_uInt8 nFirstCol, nLastCol; aIn >> nFirstRow >> nLastRow >> nFirstCol >> nLastCol; aIn.Ignore( (GetBiff() >= EXC_BIFF5) ? 6 : 2 ); @@ -1015,10 +1015,10 @@ void ImportExcel::Defrowheight345( void ) void ImportExcel::TableOp( void ) { - UINT16 nFirstRow, nLastRow; - UINT8 nFirstCol, nLastCol; - UINT16 nGrbit; - UINT16 nInpRow, nInpCol, nInpRow2, nInpCol2; + sal_uInt16 nFirstRow, nLastRow; + sal_uInt8 nFirstCol, nLastCol; + sal_uInt16 nGrbit; + sal_uInt16 nInpRow, nInpCol, nInpRow2, nInpCol2; aIn >> nFirstRow >> nLastRow >> nFirstCol >> nLastCol >> nGrbit >> nInpRow >> nInpCol >> nInpRow2 >> nInpCol2; @@ -1029,50 +1029,50 @@ void ImportExcel::TableOp( void ) { ScTabOpParam aTabOpParam; aTabOpParam.nMode = (nGrbit & EXC_TABLEOP_BOTH) ? 2 : ((nGrbit & EXC_TABLEOP_ROW) ? 1 : 0 ); - USHORT nCol = nFirstCol - 1; - USHORT nRow = nFirstRow - 1; + sal_uInt16 nCol = nFirstCol - 1; + sal_uInt16 nRow = nFirstRow - 1; SCTAB nTab = GetCurrScTab(); switch( aTabOpParam.nMode ) { case 0: // COL aTabOpParam.aRefFormulaCell.Set( static_cast<SCCOL>(nFirstCol), - static_cast<SCROW>(nFirstRow - 1), nTab, FALSE, - FALSE, FALSE ); + static_cast<SCROW>(nFirstRow - 1), nTab, false, + false, false ); aTabOpParam.aRefFormulaEnd.Set( static_cast<SCCOL>(nLastCol), - static_cast<SCROW>(nFirstRow - 1), nTab, FALSE, - FALSE, FALSE ); + static_cast<SCROW>(nFirstRow - 1), nTab, false, + false, false ); aTabOpParam.aRefColCell.Set( static_cast<SCCOL>(nInpCol), - static_cast<SCROW>(nInpRow), nTab, FALSE, FALSE, - FALSE ); + static_cast<SCROW>(nInpRow), nTab, false, false, + false ); nRow++; break; case 1: // ROW aTabOpParam.aRefFormulaCell.Set( static_cast<SCCOL>(nFirstCol - 1), - static_cast<SCROW>(nFirstRow), nTab, FALSE, FALSE, - FALSE ); + static_cast<SCROW>(nFirstRow), nTab, false, false, + false ); aTabOpParam.aRefFormulaEnd.Set( static_cast<SCCOL>(nFirstCol - 1), - static_cast<SCROW>(nLastRow), nTab, FALSE, FALSE, - FALSE ); + static_cast<SCROW>(nLastRow), nTab, false, false, + false ); aTabOpParam.aRefRowCell.Set( static_cast<SCCOL>(nInpCol), - static_cast<SCROW>(nInpRow), nTab, FALSE, FALSE, - FALSE ); + static_cast<SCROW>(nInpRow), nTab, false, false, + false ); nCol++; break; case 2: // TWO-INPUT aTabOpParam.aRefFormulaCell.Set( static_cast<SCCOL>(nFirstCol - 1), - static_cast<SCROW>(nFirstRow - 1), nTab, FALSE, - FALSE, FALSE ); + static_cast<SCROW>(nFirstRow - 1), nTab, false, + false, false ); aTabOpParam.aRefRowCell.Set( static_cast<SCCOL>(nInpCol), - static_cast<SCROW>(nInpRow), nTab, FALSE, FALSE, - FALSE ); + static_cast<SCROW>(nInpRow), nTab, false, false, + false ); aTabOpParam.aRefColCell.Set( static_cast<SCCOL>(nInpCol2), - static_cast<SCROW>(nInpRow2), nTab, FALSE, FALSE, - FALSE ); + static_cast<SCROW>(nInpRow2), nTab, false, false, + false ); break; } @@ -1085,7 +1085,7 @@ void ImportExcel::TableOp( void ) } else { - bTabTruncated = TRUE; + bTabTruncated = sal_True; GetTracer().TraceInvalidRow(GetCurrScTab(), nLastRow, MAXROW); } } @@ -1112,7 +1112,7 @@ void ImportExcel::Bof4( void ) void ImportExcel::Bof5( void ) { //POST: eDateiTyp = Typ der zu lesenden Datei - UINT16 nSubType, nVers; + sal_uInt16 nSubType, nVers; BiffTyp eDatei; maStrm.DisableDecryption(); @@ -1176,7 +1176,7 @@ void ImportExcel::NeueTabelle( void ) } -const ScTokenArray* ImportExcel::ErrorToFormula( BYTE bErrOrVal, BYTE nError, double& rVal ) +const ScTokenArray* ImportExcel::ErrorToFormula( sal_uInt8 bErrOrVal, sal_uInt8 nError, double& rVal ) { return pFormConv->GetBoolErr( XclTools::ErrorToEnum( rVal, bErrOrVal, nError ) ); } @@ -1259,7 +1259,7 @@ void ImportExcel::PostDocLoad( void ) { for( SCTAB n = 0 ; n < nLast ; n++ ) { - p = pExcRoot->pPrintRanges->First( static_cast<UINT16>(n) ); + p = pExcRoot->pPrintRanges->First( static_cast<sal_uInt16>(n) ); if( p ) { DBG_ASSERT( pExcRoot->pPrintRanges->HasActList(), @@ -1285,27 +1285,27 @@ void ImportExcel::PostDocLoad( void ) { for( SCTAB n = 0 ; n < nLast ; n++ ) { - p = pExcRoot->pPrintTitles->First( static_cast<UINT16>(n) ); + p = pExcRoot->pPrintTitles->First( static_cast<sal_uInt16>(n) ); if( p ) { DBG_ASSERT( pExcRoot->pPrintTitles->HasActList(), "-ImportExcel::PostDocLoad(): Imaginaere Tabelle gefunden!" ); - BOOL bRowVirgin = TRUE; - BOOL bColVirgin = TRUE; + sal_Bool bRowVirgin = sal_True; + sal_Bool bColVirgin = sal_True; while( p ) { if( p->aStart.Col() == 0 && p->aEnd.Col() == MAXCOL && bRowVirgin ) { pD->SetRepeatRowRange( n, p ); - bRowVirgin = FALSE; + bRowVirgin = false; } if( p->aStart.Row() == 0 && p->aEnd.Row() == MAXROW && bColVirgin ) { pD->SetRepeatColRange( n, p ); - bColVirgin = FALSE; + bColVirgin = false; } p = pExcRoot->pPrintTitles->Next(); @@ -1330,10 +1330,10 @@ XclImpOutlineDataBuffer::~XclImpOutlineDataBuffer() void XclImpOutlineDataBuffer::Convert() { - mxColOutlineBuff->SetOutlineArray( GetDoc().GetOutlineTable( mnScTab, TRUE )->GetColArray() ); + mxColOutlineBuff->SetOutlineArray( GetDoc().GetOutlineTable( mnScTab, sal_True )->GetColArray() ); mxColOutlineBuff->MakeScOutline(); - mxRowOutlineBuff->SetOutlineArray( GetDoc().GetOutlineTable( mnScTab, TRUE )->GetRowArray() ); + mxRowOutlineBuff->SetOutlineArray( GetDoc().GetOutlineTable( mnScTab, sal_True )->GetRowArray() ); mxRowOutlineBuff->MakeScOutline(); mxColRowBuff->ConvertHiddenFlags( mnScTab ); diff --git a/sc/source/filter/excel/namebuff.cxx b/sc/source/filter/excel/namebuff.cxx index 42ebd6d4c5a2..fe388a218e95 100644 --- a/sc/source/filter/excel/namebuff.cxx +++ b/sc/source/filter/excel/namebuff.cxx @@ -45,16 +45,16 @@ #include "xiroot.hxx" -UINT32 StringHashEntry::MakeHashCode( const String& r ) +sal_uInt32 StringHashEntry::MakeHashCode( const String& r ) { - register UINT32 n = 0; + register sal_uInt32 n = 0; const sal_Unicode* pAkt = r.GetBuffer(); register sal_Unicode cAkt = *pAkt; while( cAkt ) { n *= 70; - n += ( UINT32 ) cAkt; + n += ( sal_uInt32 ) cAkt; pAkt++; cAkt = *pAkt; } @@ -87,14 +87,14 @@ void NameBuffer::operator <<( const String &rNewString ) #ifdef DBG_UTIL -UINT16 nShrCnt; +sal_uInt16 nShrCnt; #endif size_t ShrfmlaBuffer::ScAddressHashFunc::operator() (const ScAddress &addr) const { // Use something simple, it is just a hash. - return static_cast< UINT16 >( addr.Row() ) | (static_cast< UINT8 >( addr.Col() ) << 16); + return static_cast< sal_uInt16 >( addr.Row() ) | (static_cast< sal_uInt8 >( addr.Col() ) << 16); } const size_t nBase = 16384; // Range~ und Shared~ Dingens mit jeweils der Haelfte Ids @@ -128,15 +128,15 @@ void ShrfmlaBuffer::Store( const ScRange& rRange, const ScTokenArray& rToken ) const ScAddress& rMaxPos = pExcRoot->pIR->GetMaxPos(); pData->SetMaxCol(rMaxPos.Col()); pData->SetMaxRow(rMaxPos.Row()); - pData->SetIndex( static_cast< USHORT >( mnCurrIdx ) ); + pData->SetIndex( static_cast< sal_uInt16 >( mnCurrIdx ) ); pExcRoot->pIR->GetNamedRanges().insert( pData ); - index_hash[rRange.aStart] = static_cast< USHORT >( mnCurrIdx ); + index_hash[rRange.aStart] = static_cast< sal_uInt16 >( mnCurrIdx ); index_list.push_front (rRange); ++mnCurrIdx; } -USHORT ShrfmlaBuffer::Find( const ScAddress & aAddr ) const +sal_uInt16 ShrfmlaBuffer::Find( const ScAddress & aAddr ) const { ShrfmlaHash::const_iterator hash = index_hash.find (aAddr); if (hash != index_hash.end()) @@ -146,8 +146,8 @@ USHORT ShrfmlaBuffer::Find( const ScAddress & aAddr ) const unsigned int ind = nBase; for (ShrfmlaList::const_iterator ptr = index_list.end(); ptr != index_list.begin() ; ind++) if ((--ptr)->In (aAddr)) - return static_cast< USHORT >( ind ); - return static_cast< USHORT >( mnCurrIdx ); + return static_cast< sal_uInt16 >( ind ); + return static_cast< sal_uInt16 >( mnCurrIdx ); } @@ -181,7 +181,7 @@ ExtSheetBuffer::~ExtSheetBuffer() } -sal_Int16 ExtSheetBuffer::Add( const String& rFPAN, const String& rTN, const BOOL bSWB ) +sal_Int16 ExtSheetBuffer::Add( const String& rFPAN, const String& rTN, const sal_Bool bSWB ) { List::Insert( new Cont( rFPAN, rTN, bSWB ), LIST_APPEND ); // return 1-based index of EXTERNSHEET @@ -189,21 +189,21 @@ sal_Int16 ExtSheetBuffer::Add( const String& rFPAN, const String& rTN, const BOO } -BOOL ExtSheetBuffer::GetScTabIndex( UINT16 nExcIndex, UINT16& rScIndex ) +sal_Bool ExtSheetBuffer::GetScTabIndex( sal_uInt16 nExcIndex, sal_uInt16& rScIndex ) { DBG_ASSERT( nExcIndex, "*ExtSheetBuffer::GetScTabIndex(): Sheet-Index == 0!" ); nExcIndex--; Cont* pCur = ( Cont * ) List::GetObject( nExcIndex ); - UINT16& rTabNum = pCur->nTabNum; + sal_uInt16& rTabNum = pCur->nTabNum; if( pCur ) { if( rTabNum < 0xFFFD ) { rScIndex = rTabNum; - return TRUE; + return sal_True; } if( rTabNum == 0xFFFF ) @@ -213,8 +213,8 @@ BOOL ExtSheetBuffer::GetScTabIndex( UINT16 nExcIndex, UINT16& rScIndex ) {// Tabelle ist im selben Workbook! if( pExcRoot->pIR->GetDoc().GetTable( pCur->aTab, nNewTabNum ) ) { - rScIndex = rTabNum = static_cast<UINT16>(nNewTabNum); - return TRUE; + rScIndex = rTabNum = static_cast<sal_uInt16>(nNewTabNum); + return sal_True; } else rTabNum = 0xFFFD; @@ -228,8 +228,8 @@ BOOL ExtSheetBuffer::GetScTabIndex( UINT16 nExcIndex, UINT16& rScIndex ) String aTabName( ScGlobal::GetDocTabName( aURL, pCur->aTab ) ); if( pExcRoot->pIR->GetDoc().LinkExternalTab( nNewTabNum, aTabName, aURL, pCur->aTab ) ) { - rScIndex = rTabNum = static_cast<UINT16>(nNewTabNum); - return TRUE; + rScIndex = rTabNum = static_cast<sal_uInt16>(nNewTabNum); + return sal_True; } else rTabNum = 0xFFFE; // Tabelle einmal nicht angelegt -> wird @@ -242,11 +242,11 @@ BOOL ExtSheetBuffer::GetScTabIndex( UINT16 nExcIndex, UINT16& rScIndex ) } } - return FALSE; + return false; } -BOOL ExtSheetBuffer::IsLink( const UINT16 nExcIndex ) const +sal_Bool ExtSheetBuffer::IsLink( const sal_uInt16 nExcIndex ) const { DBG_ASSERT( nExcIndex > 0, "*ExtSheetBuffer::IsLink(): Index muss >0 sein!" ); Cont* pRet = ( Cont * ) List::GetObject( nExcIndex - 1 ); @@ -254,11 +254,11 @@ BOOL ExtSheetBuffer::IsLink( const UINT16 nExcIndex ) const if( pRet ) return pRet->bLink; else - return FALSE; + return false; } -BOOL ExtSheetBuffer::GetLink( const UINT16 nExcIndex, String& rAppl, String& rDoc ) const +sal_Bool ExtSheetBuffer::GetLink( const sal_uInt16 nExcIndex, String& rAppl, String& rDoc ) const { DBG_ASSERT( nExcIndex > 0, "*ExtSheetBuffer::GetLink(): Index muss >0 sein!" ); Cont* pRet = ( Cont * ) List::GetObject( nExcIndex - 1 ); @@ -267,10 +267,10 @@ BOOL ExtSheetBuffer::GetLink( const UINT16 nExcIndex, String& rAppl, String& rDo { rAppl = pRet->aFile; rDoc = pRet->aTab; - return TRUE; + return sal_True; } else - return FALSE; + return false; } @@ -289,13 +289,13 @@ void ExtSheetBuffer::Reset( void ) -BOOL ExtName::IsDDE( void ) const +sal_Bool ExtName::IsDDE( void ) const { return ( nFlags & 0x0001 ) != 0; } -BOOL ExtName::IsOLE( void ) const +sal_Bool ExtName::IsOLE( void ) const { return ( nFlags & 0x0002 ) != 0; } @@ -314,7 +314,7 @@ void ExtNameBuff::AddDDE( const String& rName, sal_Int16 nRefIdx ) } -void ExtNameBuff::AddOLE( const String& rName, sal_Int16 nRefIdx, UINT32 nStorageId ) +void ExtNameBuff::AddOLE( const String& rName, sal_Int16 nRefIdx, sal_uInt32 nStorageId ) { ExtName aNew( rName, 0x0002 ); aNew.nStorageId = nStorageId; diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx index 3e4227062863..07a8ba1aaf03 100644 --- a/sc/source/filter/excel/read.cxx +++ b/sc/source/filter/excel/read.cxx @@ -719,7 +719,7 @@ FltError ImportExcel::Read( void ) break; case Biff5V: default: - pD->SetVisible( GetCurrScTab(), FALSE ); + pD->SetVisible( GetCurrScTab(), false ); ePrev = eAkt; eAkt = Z_Biffn0; } @@ -779,7 +779,7 @@ FltError ImportExcel8::Read( void ) { #if EXC_INCL_DUMPER { - Biff8RecDumper aDumper( GetRoot(), TRUE ); + Biff8RecDumper aDumper( GetRoot(), sal_True ); if( aDumper.Dump( aIn ) ) return ERRCODE_ABORT; } @@ -1058,7 +1058,7 @@ FltError ImportExcel8::Read( void ) case Biff8V: // VB module default: // TODO: do not create a sheet in the Calc document - pD->SetVisible( GetCurrScTab(), FALSE ); + pD->SetVisible( GetCurrScTab(), false ); XclTools::SkipSubStream( maStrm ); IncCurrScTab(); } diff --git a/sc/source/filter/excel/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx index 3959019382b0..9c144b3d00e8 100644 --- a/sc/source/filter/excel/tokstack.cxx +++ b/sc/source/filter/excel/tokstack.cxx @@ -41,10 +41,10 @@ #include <stdio.h> // printf -const UINT16 TokenPool::nScTokenOff = 8192; +const sal_uInt16 TokenPool::nScTokenOff = 8192; -TokenStack::TokenStack( UINT16 nNewSize ) +TokenStack::TokenStack( sal_uInt16 nNewSize ) { pStack = new TokenId[ nNewSize ]; @@ -70,17 +70,17 @@ TokenStack::~TokenStack() TokenPool::TokenPool( void ) { - UINT16 nLauf = nScTokenOff; + sal_uInt16 nLauf = nScTokenOff; // Sammelstelle fuer Id-Folgen nP_Id = 256; - pP_Id = new UINT16[ nP_Id ]; + pP_Id = new sal_uInt16[ nP_Id ]; // Sammelstelle fuer Ids nElement = 32; - pElement = new UINT16[ nElement ]; + pElement = new sal_uInt16[ nElement ]; pType = new E_TYPE[ nElement ]; - pSize = new UINT16[ nElement ]; + pSize = new sal_uInt16[ nElement ]; nP_IdLast = 0; // Sammelstelle fuer Strings @@ -95,7 +95,7 @@ TokenPool::TokenPool( void ) // Sammelstelle fuer error codes nP_Err = 8; - pP_Err = new USHORT[ nP_Err ]; + pP_Err = new sal_uInt16[ nP_Err ]; // Sammelstellen fuer Referenzen nP_RefTr = 32; @@ -123,7 +123,7 @@ TokenPool::TokenPool( void ) TokenPool::~TokenPool() { - UINT16 n; + sal_uInt16 n; delete[] pP_Id; delete[] pElement; @@ -173,8 +173,8 @@ TokenPool::~TokenPool() void TokenPool::GrowString( void ) { - UINT16 nP_StrNew = nP_Str * 2; - UINT16 nL; + sal_uInt16 nP_StrNew = nP_Str * 2; + sal_uInt16 nL; String** ppP_StrNew = new String *[ nP_StrNew ]; @@ -192,11 +192,11 @@ void TokenPool::GrowString( void ) void TokenPool::GrowDouble( void ) { - UINT16 nP_DblNew = nP_Dbl * 2; + sal_uInt16 nP_DblNew = nP_Dbl * 2; double* pP_DblNew = new double[ nP_DblNew ]; - for( UINT16 nL = 0 ; nL < nP_Dbl ; nL++ ) + for( sal_uInt16 nL = 0 ; nL < nP_Dbl ; nL++ ) pP_DblNew[ nL ] = pP_Dbl[ nL ]; nP_Dbl = nP_DblNew; @@ -207,8 +207,8 @@ void TokenPool::GrowDouble( void ) void TokenPool::GrowTripel( void ) { - UINT16 nP_RefTrNew = nP_RefTr * 2; - UINT16 nL; + sal_uInt16 nP_RefTrNew = nP_RefTr * 2; + sal_uInt16 nL; ScSingleRefData** ppP_RefTrNew = new ScSingleRefData *[ nP_RefTrNew ]; @@ -226,11 +226,11 @@ void TokenPool::GrowTripel( void ) void TokenPool::GrowId( void ) { - UINT16 nP_IdNew = nP_Id * 2; + sal_uInt16 nP_IdNew = nP_Id * 2; - UINT16* pP_IdNew = new UINT16[ nP_IdNew ]; + sal_uInt16* pP_IdNew = new sal_uInt16[ nP_IdNew ]; - for( UINT16 nL = 0 ; nL < nP_Id ; nL++ ) + for( sal_uInt16 nL = 0 ; nL < nP_Id ; nL++ ) pP_IdNew[ nL ] = pP_Id[ nL ]; nP_Id = nP_IdNew; @@ -242,13 +242,13 @@ void TokenPool::GrowId( void ) void TokenPool::GrowElement( void ) { - UINT16 nElementNew = nElement * 2; + sal_uInt16 nElementNew = nElement * 2; - UINT16* pElementNew = new UINT16[ nElementNew ]; + sal_uInt16* pElementNew = new sal_uInt16[ nElementNew ]; E_TYPE* pTypeNew = new E_TYPE[ nElementNew ]; - UINT16* pSizeNew = new UINT16[ nElementNew ]; + sal_uInt16* pSizeNew = new sal_uInt16[ nElementNew ]; - for( UINT16 nL = 0 ; nL < nElement ; nL++ ) + for( sal_uInt16 nL = 0 ; nL < nElement ; nL++ ) { pElementNew[ nL ] = pElement[ nL ]; pTypeNew[ nL ] = pType[ nL ]; @@ -268,7 +268,7 @@ void TokenPool::GrowElement( void ) void TokenPool::GrowExt( void ) { - UINT16 nNewSize = nP_Ext * 2; + sal_uInt16 nNewSize = nP_Ext * 2; EXTCONT** ppNew = new EXTCONT*[ nNewSize ]; @@ -283,7 +283,7 @@ void TokenPool::GrowExt( void ) void TokenPool::GrowNlf( void ) { - UINT16 nNewSize = nP_Nlf * 2; + sal_uInt16 nNewSize = nP_Nlf * 2; NLFCONT** ppNew = new NLFCONT*[ nNewSize ]; @@ -298,7 +298,7 @@ void TokenPool::GrowNlf( void ) void TokenPool::GrowMatrix( void ) { - UINT16 nNewSize = nP_Matrix * 2; + sal_uInt16 nNewSize = nP_Matrix * 2; ScMatrix** ppNew = new ScMatrix*[ nNewSize ]; @@ -310,7 +310,7 @@ void TokenPool::GrowMatrix( void ) nP_Matrix = nNewSize; } -void TokenPool::GetElement( const UINT16 nId ) +void TokenPool::GetElement( const sal_uInt16 nId ) { DBG_ASSERT( nId < nElementAkt, "*TokenPool::GetElement(): Id zu gross!?" ); @@ -334,7 +334,7 @@ void TokenPool::GetElement( const UINT16 nId ) case T_Err: break; case T_RefC: - pScToken->AddSingleReference( *ppP_RefTr[ pElement[ (UINT16) nId ] ] ); + pScToken->AddSingleReference( *ppP_RefTr[ pElement[ (sal_uInt16) nId ] ] ); break; case T_RefA: { @@ -349,7 +349,7 @@ void TokenPool::GetElement( const UINT16 nId ) break; case T_Ext: { - UINT16 n = pElement[ nId ]; + sal_uInt16 n = pElement[ nId ]; EXTCONT* p = ( n < nP_Ext )? ppP_Ext[ n ] : NULL; if( p ) @@ -363,7 +363,7 @@ void TokenPool::GetElement( const UINT16 nId ) break; case T_Nlf: { - UINT16 n = pElement[ nId ]; + sal_uInt16 n = pElement[ nId ]; NLFCONT* p = ( n < nP_Nlf )? ppP_Nlf[ n ] : NULL; if( p ) @@ -372,7 +372,7 @@ void TokenPool::GetElement( const UINT16 nId ) break; case T_Matrix: { - UINT16 n = pElement[ nId ]; + sal_uInt16 n = pElement[ nId ]; ScMatrix* p = ( n < nP_Matrix )? ppP_Matrix[ n ] : NULL; if( p ) @@ -381,7 +381,7 @@ void TokenPool::GetElement( const UINT16 nId ) break; case T_ExtName: { - UINT16 n = pElement[nId]; + sal_uInt16 n = pElement[nId]; if (n < maExtNames.size()) { const ExtName& r = maExtNames[n]; @@ -390,7 +390,7 @@ void TokenPool::GetElement( const UINT16 nId ) } case T_ExtRefC: { - UINT16 n = pElement[nId]; + sal_uInt16 n = pElement[nId]; if (n < maExtCellRefs.size()) { const ExtCellRef& r = maExtCellRefs[n]; @@ -399,7 +399,7 @@ void TokenPool::GetElement( const UINT16 nId ) } case T_ExtRefA: { - UINT16 n = pElement[nId]; + sal_uInt16 n = pElement[nId]; if (n < maExtAreaRefs.size()) { const ExtAreaRef& r = maExtAreaRefs[n]; @@ -414,7 +414,7 @@ void TokenPool::GetElement( const UINT16 nId ) } -void TokenPool::GetElementRek( const UINT16 nId ) +void TokenPool::GetElementRek( const sal_uInt16 nId ) { #ifdef DBG_UTIL nRek++; @@ -426,8 +426,8 @@ void TokenPool::GetElementRek( const UINT16 nId ) DBG_ASSERT( pType[ nId ] == T_Id, "-TokenPool::GetElementRek(): nId nicht Id-Folge!" ); - UINT16 nAnz = pSize[ nId ]; - UINT16* pAkt = &pP_Id[ pElement[ nId ] ]; + sal_uInt16 nAnz = pSize[ nId ]; + sal_uInt16* pAkt = &pP_Id[ pElement[ nId ] ]; for( ; nAnz > 0 ; nAnz--, pAkt++ ) { if( *pAkt < nScTokenOff ) @@ -461,7 +461,7 @@ void TokenPool::GetElementRek( const UINT16 nId ) break; case T_Ext: { - UINT16 n = pElement[ *pAkt ]; + sal_uInt16 n = pElement[ *pAkt ]; EXTCONT* p = ( n < nP_Ext )? ppP_Ext[ n ] : NULL; if( p ) @@ -470,7 +470,7 @@ void TokenPool::GetElementRek( const UINT16 nId ) break; case T_Nlf: { - UINT16 n = pElement[ *pAkt ]; + sal_uInt16 n = pElement[ *pAkt ]; NLFCONT* p = ( n < nP_Nlf )? ppP_Nlf[ n ] : NULL; if( p ) @@ -479,7 +479,7 @@ void TokenPool::GetElementRek( const UINT16 nId ) break; case T_Matrix: { - UINT16 n = pElement[ *pAkt ]; + sal_uInt16 n = pElement[ *pAkt ]; ScMatrix* p = ( n < nP_Matrix )? ppP_Matrix[ n ] : NULL; if( p ) @@ -488,7 +488,7 @@ void TokenPool::GetElementRek( const UINT16 nId ) break; case T_ExtName: { - UINT16 n = pElement[*pAkt]; + sal_uInt16 n = pElement[*pAkt]; if (n < maExtNames.size()) { const ExtName& r = maExtNames[n]; @@ -497,7 +497,7 @@ void TokenPool::GetElementRek( const UINT16 nId ) } case T_ExtRefC: { - UINT16 n = pElement[*pAkt]; + sal_uInt16 n = pElement[*pAkt]; if (n < maExtCellRefs.size()) { const ExtCellRef& r = maExtCellRefs[n]; @@ -506,7 +506,7 @@ void TokenPool::GetElementRek( const UINT16 nId ) } case T_ExtRefA: { - UINT16 n = pElement[*pAkt]; + sal_uInt16 n = pElement[*pAkt]; if (n < maExtAreaRefs.size()) { const ExtAreaRef& r = maExtAreaRefs[n]; @@ -568,7 +568,7 @@ const TokenId TokenPool::Store( const double& rDouble ) } -const TokenId TokenPool::Store( const UINT16 nIndex ) +const TokenId TokenPool::Store( const sal_uInt16 nIndex ) { if( nElementAkt >= nElement ) GrowElement(); @@ -604,7 +604,7 @@ const TokenId TokenPool::Store( const String& rString ) DBG_ASSERT( sizeof( xub_StrLen ) <= 2, "*TokenPool::Store(): StrLen doesn't match!" ); - pSize[ nElementAkt ] = ( UINT16 ) ppP_Str[ nP_StrAkt ]->Len(); + pSize[ nElementAkt ] = ( sal_uInt16 ) ppP_Str[ nP_StrAkt ]->Len(); nElementAkt++; nP_StrAkt++; @@ -743,7 +743,7 @@ const TokenId TokenPool::StoreExtName( sal_uInt16 nFileId, const String& rName ) if ( nElementAkt >= nElement ) GrowElement(); - pElement[nElementAkt] = static_cast<UINT16>(maExtNames.size()); + pElement[nElementAkt] = static_cast<sal_uInt16>(maExtNames.size()); pType[nElementAkt] = T_ExtName; maExtNames.push_back(ExtName()); @@ -761,7 +761,7 @@ const TokenId TokenPool::StoreExtRef( sal_uInt16 nFileId, const String& rTabName if ( nElementAkt >= nElement ) GrowElement(); - pElement[nElementAkt] = static_cast<UINT16>(maExtCellRefs.size()); + pElement[nElementAkt] = static_cast<sal_uInt16>(maExtCellRefs.size()); pType[nElementAkt] = T_ExtRefC; maExtCellRefs.push_back(ExtCellRef()); @@ -780,7 +780,7 @@ const TokenId TokenPool::StoreExtRef( sal_uInt16 nFileId, const String& rTabName if ( nElementAkt >= nElement ) GrowElement(); - pElement[nElementAkt] = static_cast<UINT16>(maExtAreaRefs.size()); + pElement[nElementAkt] = static_cast<sal_uInt16>(maExtAreaRefs.size()); pType[nElementAkt] = T_ExtRefA; maExtAreaRefs.push_back(ExtAreaRef()); @@ -803,9 +803,9 @@ void TokenPool::Reset( void ) } -BOOL TokenPool::IsSingleOp( const TokenId& rId, const DefTokenId eId ) const +sal_Bool TokenPool::IsSingleOp( const TokenId& rId, const DefTokenId eId ) const { - UINT16 nId = (UINT16) rId; + sal_uInt16 nId = (sal_uInt16) rId; if( nId && nId <= nElementAkt ) {// existent? nId--; @@ -813,7 +813,7 @@ BOOL TokenPool::IsSingleOp( const TokenId& rId, const DefTokenId eId ) const {// Tokenfolge? if( pSize[ nId ] == 1 ) {// GENAU 1 Token - UINT16 nSecId = pP_Id[ pElement[ nId ] ]; + sal_uInt16 nSecId = pP_Id[ pElement[ nId ] ]; if( nSecId >= nScTokenOff ) {// Default-Token? return ( DefTokenId ) ( nSecId - nScTokenOff ) == eId; // Gesuchter? @@ -822,13 +822,13 @@ BOOL TokenPool::IsSingleOp( const TokenId& rId, const DefTokenId eId ) const } } - return FALSE; + return false; } const String* TokenPool::GetExternal( const TokenId& rId ) const { const String* p = NULL; - UINT16 n = (UINT16) rId; + sal_uInt16 n = (sal_uInt16) rId; if( n && n <= nElementAkt ) { n--; diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index a5f47770e4a2..ebf622b080c5 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -38,9 +38,13 @@ #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> #include <com/sun/star/chart/ChartAxisPosition.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> +#include <com/sun/star/chart/TimeInterval.hpp> +#include <com/sun/star/chart/TimeUnit.hpp> +#include <com/sun/star/chart/XAxisSupplier.hpp> #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -56,9 +60,9 @@ #include <com/sun/star/chart2/CurveStyle.hpp> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> #include <com/sun/star/chart2/DataPointLabel.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> +#include <com/sun/star/chart2/RelativeSize.hpp> #include <com/sun/star/chart2/StackingDirection.hpp> #include <com/sun/star/chart2/TickmarkStyle.hpp> @@ -93,6 +97,7 @@ using ::com::sun::star::drawing::XShapes; using ::com::sun::star::chart2::IncrementData; using ::com::sun::star::chart2::RelativePosition; +using ::com::sun::star::chart2::RelativeSize; using ::com::sun::star::chart2::ScaleData; using ::com::sun::star::chart2::SubIncrement; using ::com::sun::star::chart2::XAxis; @@ -181,6 +186,56 @@ bool lclIsAutoAnyOrGetScaledValue( double& rfValue, const Any& rAny, bool bLogSc return bIsAuto; } +sal_uInt16 lclGetTimeValue( const XclExpRoot& rRoot, double fSerialDate, sal_uInt16 nTimeUnit ) +{ + DateTime aDateTime = rRoot.GetDateTimeFromDouble( fSerialDate ); + switch( nTimeUnit ) + { + case EXC_CHDATERANGE_DAYS: + return ::limit_cast< sal_uInt16, double >( fSerialDate, 0, SAL_MAX_UINT16 ); + case EXC_CHDATERANGE_MONTHS: + return ::limit_cast< sal_uInt16, sal_uInt16 >( 12 * (aDateTime.GetYear() - rRoot.GetBaseYear()) + aDateTime.GetMonth() - 1, 0, SAL_MAX_INT16 ); + case EXC_CHDATERANGE_YEARS: + return ::limit_cast< sal_uInt16, sal_uInt16 >( aDateTime.GetYear() - rRoot.GetBaseYear(), 0, SAL_MAX_INT16 ); + default: + OSL_ENSURE( false, "lclGetTimeValue - unexpected time unit" ); + } + return ::limit_cast< sal_uInt16, double >( fSerialDate, 0, SAL_MAX_UINT16 ); +} + +bool lclConvertTimeValue( const XclExpRoot& rRoot, sal_uInt16& rnValue, const Any& rAny, sal_uInt16 nTimeUnit ) +{ + double fSerialDate = 0; + bool bAuto = lclIsAutoAnyOrGetValue( fSerialDate, rAny ); + if( !bAuto ) + rnValue = lclGetTimeValue( rRoot, fSerialDate, nTimeUnit ); + return bAuto; +} + +sal_uInt16 lclGetTimeUnit( sal_Int32 nApiTimeUnit ) +{ + switch( nApiTimeUnit ) + { + case cssc::TimeUnit::DAY: return EXC_CHDATERANGE_DAYS; + case cssc::TimeUnit::MONTH: return EXC_CHDATERANGE_MONTHS; + case cssc::TimeUnit::YEAR: return EXC_CHDATERANGE_YEARS; + default: OSL_ENSURE( false, "lclGetTimeUnit - unexpected time unit" ); + } + return EXC_CHDATERANGE_DAYS; +} + +bool lclConvertTimeInterval( sal_uInt16 rnValue, sal_uInt16& rnTimeUnit, const Any& rAny ) +{ + cssc::TimeInterval aInterval; + bool bAuto = lclIsAutoAnyOrGetValue( aInterval, rAny ); + if( !bAuto ) + { + rnValue = ::limit_cast< sal_uInt16, sal_Int32 >( aInterval.Number, 1, SAL_MAX_UINT16 ); + rnTimeUnit = lclGetTimeUnit( aInterval.TimeUnit ); + } + return bAuto; +} + } // namespace // Common ===================================================================== @@ -769,6 +824,12 @@ void XclExpChFrame::Convert( const ScfPropertySet& rPropSet ) ConvertFrameBase( GetChRoot(), rPropSet, meObjType ); } +void XclExpChFrame::SetAutoFlags( bool bAutoPos, bool bAutoSize ) +{ + ::set_flag( maData.mnFlags, EXC_CHFRAME_AUTOPOS, bAutoPos ); + ::set_flag( maData.mnFlags, EXC_CHFRAME_AUTOSIZE, bAutoSize ); +} + bool XclExpChFrame::IsDefault() const { return IsDefaultFrameBase( GetFormatInfo( meObjType ).meDefFrameType ); @@ -1286,7 +1347,7 @@ bool XclExpChText::ConvertDataLabel( const ScfPropertySet& rPropSet, sal_uInt16 nLabelPos = EXC_CHTEXT_POS_AUTO; if( rPropSet.GetProperty( nPlacement, EXC_CHPROP_LABELPLACEMENT ) ) { - using namespace ::com::sun::star::chart::DataLabelPlacement; + using namespace cssc::DataLabelPlacement; if( nPlacement == rTypeInfo.mnDefaultLabelPos ) { nLabelPos = EXC_CHTEXT_POS_DEFAULT; @@ -1507,7 +1568,7 @@ void XclExpCh3dDataFormat::Convert( const ScfPropertySet& rPropSet ) sal_Int32 nApiType(0); if( rPropSet.GetProperty( nApiType, EXC_CHPROP_GEOMETRY3D ) ) { - using namespace ::com::sun::star::chart2::DataPointGeometry3D; + using namespace cssc2::DataPointGeometry3D; switch( nApiType ) { case CUBOID: @@ -2252,33 +2313,52 @@ void XclExpChLegend::Convert( const ScfPropertySet& rPropSet ) mxText.reset( new XclExpChText( GetChRoot() ) ); mxText->ConvertLegend( rPropSet ); - // legend position - Any aRelPosAny; + // legend position and size + Any aRelPosAny, aRelSizeAny; rPropSet.GetAnyProperty( aRelPosAny, EXC_CHPROP_RELATIVEPOSITION ); - if( aRelPosAny.has< RelativePosition >() ) + rPropSet.GetAnyProperty( aRelSizeAny, EXC_CHPROP_RELATIVESIZE ); + cssc::ChartLegendExpansion eApiExpand = cssc::ChartLegendExpansion_CUSTOM; + rPropSet.GetProperty( eApiExpand, EXC_CHPROP_EXPANSION ); + if( aRelPosAny.has< RelativePosition >() || ((eApiExpand == cssc::ChartLegendExpansion_CUSTOM) && aRelSizeAny.has< RelativeSize >()) ) { try { - /* The 'RelativePosition' property is used as indicator of manually - changed legend position, but due to the different anchor modes - used by this property (in the RelativePosition.Anchor member) - it cannot be used to calculate the position easily. For this, - the Chart1 API will be used instead. */ - Reference< ::com::sun::star::chart::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW ); + /* The 'RelativePosition' or 'RelativeSize' properties are used as + indicator of manually changed legend position/size, but due to + the different anchor modes used by this property (in the + RelativePosition.Anchor member) it cannot be used to calculate + the position easily. For this, the Chart1 API will be used + instead. */ + Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW ); Reference< XShape > xChart1Legend( xChart1Doc->getLegend(), UNO_SET_THROW ); // coordinates in CHLEGEND record written but not used by Excel mxFramePos.reset( new XclExpChFramePos( EXC_CHFRAMEPOS_CHARTSIZE, EXC_CHFRAMEPOS_PARENT ) ); XclChFramePos& rFramePos = mxFramePos->GetFramePosData(); - rFramePos.maRect.mnX = maData.maRect.mnX = CalcChartXFromHmm( xChart1Legend->getPosition().X ); - rFramePos.maRect.mnY = maData.maRect.mnY = CalcChartYFromHmm( xChart1Legend->getPosition().Y ); + rFramePos.mnTLMode = EXC_CHFRAMEPOS_CHARTSIZE; + ::com::sun::star::awt::Point aLegendPos = xChart1Legend->getPosition(); + rFramePos.maRect.mnX = maData.maRect.mnX = CalcChartXFromHmm( aLegendPos.X ); + rFramePos.maRect.mnY = maData.maRect.mnY = CalcChartYFromHmm( aLegendPos.Y ); + // legend size, Excel expects points in CHFRAMEPOS record + rFramePos.mnBRMode = EXC_CHFRAMEPOS_ABSSIZE_POINTS; + ::com::sun::star::awt::Size aLegendSize = xChart1Legend->getSize(); + rFramePos.maRect.mnWidth = static_cast< sal_uInt16 >( aLegendSize.Width * EXC_POINTS_PER_HMM + 0.5 ); + rFramePos.maRect.mnHeight = static_cast< sal_uInt16 >( aLegendSize.Height * EXC_POINTS_PER_HMM + 0.5 ); + maData.maRect.mnWidth = CalcChartXFromHmm( aLegendSize.Width ); + maData.maRect.mnHeight = CalcChartYFromHmm( aLegendSize.Height ); + eApiExpand = cssc::ChartLegendExpansion_CUSTOM; // manual legend position implies manual plot area GetChartData().SetManualPlotArea(); maData.mnDockMode = EXC_CHLEGEND_NOTDOCKED; + // a CHFRAME record with cleared auto flags is needed + if( !mxFrame ) + mxFrame.reset( new XclExpChFrame( GetChRoot(), EXC_CHOBJTYPE_LEGEND ) ); + mxFrame->SetAutoFlags( false, false ); } catch( Exception& ) { OSL_ENSURE( false, "XclExpChLegend::Convert - cannot get legend shape" ); maData.mnDockMode = EXC_CHLEGEND_RIGHT; + eApiExpand = cssc::ChartLegendExpansion_HIGH; } } else @@ -2294,13 +2374,10 @@ void XclExpChLegend::Convert( const ScfPropertySet& rPropSet ) default: OSL_ENSURE( false, "XclExpChLegend::Convert - unrecognized legend position" ); maData.mnDockMode = EXC_CHLEGEND_RIGHT; + eApiExpand = cssc::ChartLegendExpansion_HIGH; } } - - // legend expansion - cssc2::LegendExpansion eApiExpand = cssc2::LegendExpansion_BALANCED; - rPropSet.GetProperty( eApiExpand, EXC_CHPROP_EXPANSION ); - ::set_flag( maData.mnFlags, EXC_CHLEGEND_STACKED, eApiExpand != cssc2::LegendExpansion_WIDE ); + ::set_flag( maData.mnFlags, EXC_CHLEGEND_STACKED, eApiExpand == cssc::ChartLegendExpansion_HIGH ); // other flags ::set_flag( maData.mnFlags, EXC_CHLEGEND_AUTOSERIES ); @@ -2366,9 +2443,9 @@ void XclExpChTypeGroup::ConvertType( // spline - TODO: get from single series (#i66858#) ScfPropertySet aTypeProp( xChartType ); - ::com::sun::star::chart2::CurveStyle eCurveStyle; + cssc2::CurveStyle eCurveStyle; bool bSpline = aTypeProp.GetProperty( eCurveStyle, EXC_CHPROP_CURVESTYLE ) && - (eCurveStyle != ::com::sun::star::chart2::CurveStyle_LINES); + (eCurveStyle != cssc2::CurveStyle_LINES); // extended type info maTypeInfo.Set( maType.GetTypeInfo(), b3dChart, bSpline ); @@ -2568,16 +2645,53 @@ XclExpChLabelRange::XclExpChLabelRange( const XclExpChRoot& rRoot ) : { } -void XclExpChLabelRange::Convert( const ScaleData& rScaleData, bool bMirrorOrient ) +void XclExpChLabelRange::Convert( const ScaleData& rScaleData, const ScfPropertySet& rChart1Axis, bool bMirrorOrient ) { + /* Base time unit (using the property 'ExplicitTimeIncrement' from the old + chart API allows to detect axis type (date axis, if property exists), + and to receive the base time unit currently used in case the base time + unit is set to 'automatic'. */ + cssc::TimeIncrement aTimeIncrement; + if( rChart1Axis.GetProperty( aTimeIncrement, EXC_CHPROP_EXPTIMEINCREMENT ) ) + { + // property exists -> this is a date axis currently + ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS ); + + // automatic base time unit, if the UNO Any 'rScaleData.TimeIncrement.TimeResolution' does not contain a valid value... + bool bAutoBase = !rScaleData.TimeIncrement.TimeResolution.has< cssc::TimeIncrement >(); + ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOBASE, bAutoBase ); + + // ...but get the current base time unit from the property of the old chart API + sal_Int32 nApiTimeUnit = 0; + bool bValidBaseUnit = aTimeIncrement.TimeResolution >>= nApiTimeUnit; + DBG_ASSERT( bValidBaseUnit, "XclExpChLabelRange::Convert - cannot ghet base time unit" ); + maDateData.mnBaseUnit = bValidBaseUnit ? lclGetTimeUnit( nApiTimeUnit ) : EXC_CHDATERANGE_DAYS; + + /* Min/max values depend on base time unit, they specify the number of + days, months, or years starting from null date. */ + bool bAutoMin = lclConvertTimeValue( GetRoot(), maDateData.mnMinDate, rScaleData.Minimum, maDateData.mnBaseUnit ); + ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMIN, bAutoMin ); + bool bAutoMax = lclConvertTimeValue( GetRoot(), maDateData.mnMaxDate, rScaleData.Maximum, maDateData.mnBaseUnit ); + ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAX, bAutoMax ); + } + + // automatic axis type detection + ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTODATE, rScaleData.AutoDateAxis ); + + // increment + bool bAutoMajor = lclConvertTimeInterval( maDateData.mnMajorStep, maDateData.mnMajorUnit, rScaleData.TimeIncrement.MajorTimeInterval ); + ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAJOR, bAutoMajor ); + bool bAutoMinor = lclConvertTimeInterval( maDateData.mnMinorStep, maDateData.mnMinorUnit, rScaleData.TimeIncrement.MinorTimeInterval ); + ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMINOR, bAutoMinor ); + // origin double fOrigin = 0.0; if( !lclIsAutoAnyOrGetValue( fOrigin, rScaleData.Origin ) ) - maData.mnCross = limit_cast< sal_uInt16 >( fOrigin, 1, 31999 ); + maLabelData.mnCross = limit_cast< sal_uInt16 >( fOrigin, 1, 31999 ); // reverse order - if( (rScaleData.Orientation == ::com::sun::star::chart2::AxisOrientation_REVERSE) != bMirrorOrient ) - ::set_flag( maData.mnFlags, EXC_CHLABELRANGE_REVERSE ); + if( (rScaleData.Orientation == cssc2::AxisOrientation_REVERSE) != bMirrorOrient ) + ::set_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_REVERSE ); } void XclExpChLabelRange::ConvertAxisPosition( const ScfPropertySet& rPropSet ) @@ -2586,19 +2700,55 @@ void XclExpChLabelRange::ConvertAxisPosition( const ScfPropertySet& rPropSet ) rPropSet.GetProperty( eAxisPos, EXC_CHPROP_CROSSOVERPOSITION ); double fCrossingPos = 1.0; rPropSet.GetProperty( fCrossingPos, EXC_CHPROP_CROSSOVERVALUE ); + + bool bDateAxis = ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS ); switch( eAxisPos ) { - case cssc::ChartAxisPosition_ZERO: maData.mnCross = 1; break; - case cssc::ChartAxisPosition_START: maData.mnCross = 1; break; - case cssc::ChartAxisPosition_END: ::set_flag( maData.mnFlags, EXC_CHLABELRANGE_MAXCROSS ); break; - case cssc::ChartAxisPosition_VALUE: maData.mnCross = limit_cast< sal_uInt16 >( fCrossingPos, 1, 31999 ); break; - default: maData.mnCross = 1; + case cssc::ChartAxisPosition_ZERO: + case cssc::ChartAxisPosition_START: + maLabelData.mnCross = 1; + ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS ); + break; + case cssc::ChartAxisPosition_END: + ::set_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_MAXCROSS ); + break; + case cssc::ChartAxisPosition_VALUE: + maLabelData.mnCross = limit_cast< sal_uInt16 >( fCrossingPos, 1, 31999 ); + ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS, false ); + if( bDateAxis ) + maDateData.mnCross = lclGetTimeValue( GetRoot(), fCrossingPos, maDateData.mnBaseUnit ); + break; + default: + maLabelData.mnCross = 1; + ::set_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS ); + } +} + +void XclExpChLabelRange::Save( XclExpStream& rStrm ) +{ + // the CHLABELRANGE record + XclExpRecord::Save( rStrm ); + + // the CHDATERANGE record with date axis settings (BIFF8 only) + if( GetBiff() == EXC_BIFF8 ) + { + rStrm.StartRecord( EXC_ID_CHDATERANGE, 18 ); + rStrm << maDateData.mnMinDate + << maDateData.mnMaxDate + << maDateData.mnMajorStep + << maDateData.mnMajorUnit + << maDateData.mnMinorStep + << maDateData.mnMinorUnit + << maDateData.mnBaseUnit + << maDateData.mnCross + << maDateData.mnFlags; + rStrm.EndRecord(); } } void XclExpChLabelRange::WriteBody( XclExpStream& rStrm ) { - rStrm << maData.mnCross << maData.mnLabelFreq << maData.mnTickFreq << maData.mnFlags; + rStrm << maLabelData.mnCross << maLabelData.mnLabelFreq << maLabelData.mnTickFreq << maLabelData.mnFlags; } // ---------------------------------------------------------------------------- @@ -2683,7 +2833,7 @@ namespace { sal_uInt8 lclGetXclTickPos( sal_Int32 nApiTickmarks ) { - using namespace ::com::sun::star::chart2::TickmarkStyle; + using namespace cssc2::TickmarkStyle; sal_uInt8 nXclTickPos = 0; ::set_flag( nXclTickPos, EXC_CHTICK_INSIDE, ::get_flag( nApiTickmarks, INNER ) ); ::set_flag( nXclTickPos, EXC_CHTICK_OUTSIDE, ::get_flag( nApiTickmarks, OUTER ) ); @@ -2786,6 +2936,30 @@ Reference< XAxis > lclGetApiAxis( Reference< XCoordinateSystem > xCoordSystem, return xAxis; } +Reference< cssc::XAxis > lclGetApiChart1Axis( Reference< XChartDocument > xChartDoc, + sal_Int32 nApiAxisDim, sal_Int32 nApiAxesSetIdx ) +{ + Reference< cssc::XAxis > xChart1Axis; + try + { + Reference< cssc::XChartDocument > xChart1Doc( xChartDoc, UNO_QUERY_THROW ); + Reference< cssc::XAxisSupplier > xChart1AxisSupp( xChart1Doc->getDiagram(), UNO_QUERY_THROW ); + switch( nApiAxesSetIdx ) + { + case EXC_CHART_AXESSET_PRIMARY: + xChart1Axis = xChart1AxisSupp->getAxis( nApiAxisDim ); + break; + case EXC_CHART_AXESSET_SECONDARY: + xChart1Axis = xChart1AxisSupp->getSecondaryAxis( nApiAxisDim ); + break; + } + } + catch( Exception& ) + { + } + return xChart1Axis; +} + } // namespace XclExpChAxis::XclExpChAxis( const XclExpChRoot& rRoot, sal_uInt16 nAxisType ) : @@ -2808,7 +2982,8 @@ void XclExpChAxis::SetRotation( sal_uInt16 nRotation ) mxTick->SetRotation( nRotation ); } -void XclExpChAxis::Convert( Reference< XAxis > xAxis, Reference< XAxis > xCrossingAxis, const XclChExtTypeInfo& rTypeInfo ) +void XclExpChAxis::Convert( Reference< XAxis > xAxis, Reference< XAxis > xCrossingAxis, + Reference< cssc::XAxis > xChart1Axis, const XclChExtTypeInfo& rTypeInfo ) { ScfPropertySet aAxisProp( xAxis ); bool bCategoryAxis = ((GetAxisType() == EXC_CHAXIS_X) && rTypeInfo.mbCategoryAxis) || (GetAxisType() == EXC_CHAXIS_Z); @@ -2828,8 +3003,11 @@ void XclExpChAxis::Convert( Reference< XAxis > xAxis, Reference< XAxis > xCrossi mxLabelRange.reset( new XclExpChLabelRange( GetChRoot() ) ); mxLabelRange->SetTicksBetweenCateg( rTypeInfo.mbTicksBetweenCateg ); if( xAxis.is() ) + { + ScfPropertySet aChart1AxisProp( xChart1Axis ); // #i71684# radar charts have reversed rotation direction - mxLabelRange->Convert( xAxis->getScaleData(), (GetAxisType() == EXC_CHAXIS_X) && (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR) ); + mxLabelRange->Convert( xAxis->getScaleData(), aChart1AxisProp, (GetAxisType() == EXC_CHAXIS_X) && (rTypeInfo.meTypeCateg == EXC_CHTYPECATEG_RADAR) ); + } // get position of crossing axis on this axis from passed axis object if( aCrossingProp.Is() ) mxLabelRange->ConvertAxisPosition( aCrossingProp ); @@ -2957,7 +3135,7 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > xDiagram, sal_uInt16 bool b3dChart = xCoordSystem.is() && (xCoordSystem->getDimension() == 3); // percent charts - namespace ApiAxisType = ::com::sun::star::chart2::AxisType; + namespace ApiAxisType = cssc2::AxisType; Reference< XAxis > xApiYAxis = lclGetApiAxis( xCoordSystem, EXC_CHART_AXIS_Y, nApiAxesSetIdx ); bool bPercent = xApiYAxis.is() && (xApiYAxis->getScaleData().AxisType == ApiAxisType::PERCENT); @@ -3064,8 +3242,8 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > xDiagram, sal_uInt16 // inner and outer plot area position and size try { - Reference< ::com::sun::star::chart::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW ); - Reference< ::com::sun::star::chart::XDiagramPositioning > xPositioning( xChart1Doc->getDiagram(), UNO_QUERY_THROW ); + Reference< cssc::XChartDocument > xChart1Doc( GetChartDocument(), UNO_QUERY_THROW ); + Reference< cssc::XDiagramPositioning > xPositioning( xChart1Doc->getDiagram(), UNO_QUERY_THROW ); // set manual flag in chart data if( !xPositioning->isAutomaticDiagramPositioning() ) GetChartData().SetManualPlotArea(); @@ -3132,7 +3310,8 @@ void XclExpChAxesSet::ConvertAxis( sal_Int32 nApiAxesSetIdx = GetApiAxesSetIndex(); Reference< XAxis > xAxis = lclGetApiAxis( xCoordSystem, nApiAxisDim, nApiAxesSetIdx ); Reference< XAxis > xCrossingAxis = lclGetApiAxis( xCoordSystem, nCrossingAxisDim, nApiAxesSetIdx ); - rxChAxis->Convert( xAxis, xCrossingAxis, rTypeInfo ); + Reference< cssc::XAxis > xChart1Axis = lclGetApiChart1Axis( GetChartDocument(), nApiAxisDim, nApiAxesSetIdx ); + rxChAxis->Convert( xAxis, xCrossingAxis, xChart1Axis, rTypeInfo ); // create and convert axis title Reference< XTitled > xTitled( xAxis, UNO_QUERY ); @@ -3215,7 +3394,7 @@ XclExpChChart::XclExpChChart( const XclExpRoot& rRoot, sal_Int32 nMissingValues = 0; if( aDiaProp.GetProperty( nMissingValues, EXC_CHPROP_MISSINGVALUETREATMENT ) ) { - using namespace ::com::sun::star::chart::MissingValueTreatment; + using namespace cssc::MissingValueTreatment; switch( nMissingValues ) { case LEAVE_GAP: maProps.mnEmptyMode = EXC_CHPROPS_EMPTY_SKIP; break; diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index aecf72da0937..b25cc7f20b1e 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -56,7 +56,7 @@ #include "xestyle.hxx" #include "xename.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; @@ -853,7 +853,7 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat GetAddressConverter().ConvertRangeList( maXclRanges, aScRanges, true ); if( !maXclRanges.empty() ) { - for( USHORT nIndex = 0, nCount = rCondFormat.Count(); nIndex < nCount; ++nIndex ) + for( sal_uInt16 nIndex = 0, nCount = rCondFormat.Count(); nIndex < nCount; ++nIndex ) if( const ScCondFormatEntry* pEntry = rCondFormat.GetEntry( nIndex ) ) maCFList.AppendNewRecord( new XclExpCF( GetRoot(), *pEntry ) ); aScRanges.Format( msSeqRef, SCA_VALID, NULL, formula::FormulaGrammar::CONV_XL_A1 ); @@ -996,7 +996,7 @@ const char* lcl_GetOperatorType( sal_uInt32 nFlags ) // ---------------------------------------------------------------------------- -XclExpDV::XclExpDV( const XclExpRoot& rRoot, ULONG nScHandle ) : +XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : XclExpRecord( EXC_ID_DV ), XclExpRoot( rRoot ), mnFlags( 0 ), @@ -1006,7 +1006,7 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, ULONG nScHandle ) : { // prompt box - empty string represented by single NUL character String aTitle, aText; - bool bShowPrompt = (pValData->GetInput( aTitle, aText ) == TRUE); + bool bShowPrompt = (pValData->GetInput( aTitle, aText ) == sal_True); if( aTitle.Len() ) maPromptTitle.Assign( aTitle ); else @@ -1018,7 +1018,7 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, ULONG nScHandle ) : // error box - empty string represented by single NUL character ScValidErrorStyle eScErrorStyle; - bool bShowError = (pValData->GetErrMsg( aTitle, aText, eScErrorStyle ) == TRUE); + bool bShowError = (pValData->GetErrMsg( aTitle, aText, eScErrorStyle ) == sal_True); if( aTitle.Len() ) maErrorTitle.Assign( aTitle ); else @@ -1222,7 +1222,7 @@ XclExpDval::~XclExpDval() { } -void XclExpDval::InsertCellRange( const ScRange& rRange, ULONG nScHandle ) +void XclExpDval::InsertCellRange( const ScRange& rRange, sal_uLong nScHandle ) { if( GetBiff() == EXC_BIFF8 ) { @@ -1267,7 +1267,7 @@ void XclExpDval::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->endElement( XML_dataValidations ); } -XclExpDV& XclExpDval::SearchOrCreateDv( ULONG nScHandle ) +XclExpDV& XclExpDval::SearchOrCreateDv( sal_uLong nScHandle ) { // test last found record if( mxLastFoundDV.get() && (mxLastFoundDV->GetScHandle() == nScHandle) ) @@ -1280,7 +1280,7 @@ XclExpDV& XclExpDval::SearchOrCreateDv( ULONG nScHandle ) size_t nFirstPos = 0; size_t nLastPos = maDVList.GetSize() - 1; bool bLoop = true; - ULONG nCurrScHandle = ::std::numeric_limits< ULONG >::max(); + sal_uLong nCurrScHandle = ::std::numeric_limits< sal_uLong >::max(); while( (nFirstPos <= nLastPos) && bLoop ) { nCurrPos = (nFirstPos + nLastPos) / 2; diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index e26a0b3e630c..c7cfe136bff2 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -531,10 +531,10 @@ XclExpOcxControlObj::XclExpOcxControlObj( XclExpObjectManager& rObjMgr, Referenc ScfPropertySet aCtrlProp( XclControlHelper::GetControlModel( xShape ) ); // OBJ record flags - SetLocked( TRUE ); + SetLocked( sal_True ); SetPrintable( aCtrlProp.GetBoolProperty( CREATE_OUSTRING( "Printable" ) ) ); - SetAutoFill( FALSE ); - SetAutoLine( FALSE ); + SetAutoFill( false ); + SetAutoLine( false ); // fill DFF property set mrEscherEx.OpenContainer( ESCHER_SpContainer ); @@ -553,7 +553,7 @@ XclExpOcxControlObj::XclExpOcxControlObj( XclExpObjectManager& rObjMgr, Referenc // meta file //! TODO - needs check Reference< XPropertySet > xShapePS( xShape, UNO_QUERY ); - if( xShapePS.is() && aPropOpt.CreateGraphicProperties( xShapePS, CREATE_STRING( "MetaFile" ), sal_False ) ) + if( xShapePS.is() && aPropOpt.CreateGraphicProperties( xShapePS, CREATE_STRING( "MetaFile" ), false ) ) { sal_uInt32 nBlipId; if( aPropOpt.GetOpt( ESCHER_Prop_pib, nBlipId ) ) @@ -675,10 +675,10 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference< return; // OBJ record flags - SetLocked( TRUE ); + SetLocked( sal_True ); SetPrintable( aCtrlProp.GetBoolProperty( CREATE_OUSTRING( "Printable" ) ) ); - SetAutoFill( FALSE ); - SetAutoLine( FALSE ); + SetAutoFill( false ); + SetAutoLine( false ); // fill DFF property set mrEscherEx.OpenContainer( ESCHER_SpContainer ); @@ -1256,7 +1256,7 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos, // AutoFill style would change if Postit.cxx object creation values are changed OUString aCol(((XFillColorItem &)GETITEM(aItemSet, XFillColorItem , XATTR_FILLCOLOR)).GetValue()); - mbAutoFill = !aCol.getLength() && (GETITEMVALUE(aItemSet, XFillStyleItem, XATTR_FILLSTYLE, ULONG) == XFILL_SOLID); + mbAutoFill = !aCol.getLength() && (GETITEMVALUE(aItemSet, XFillStyleItem, XATTR_FILLSTYLE, sal_uLong) == XFILL_SOLID); mbAutoLine = true; mbRowHidden = (rRoot.GetDoc().RowHidden(maScPos.Row(),maScPos.Tab())); mbColHidden = (rRoot.GetDoc().ColHidden(maScPos.Col(),maScPos.Tab())); diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 4373cff8edac..4d40aaf1d206 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -521,7 +521,7 @@ XclTokenArrayRef XclExpFmlaCompImpl::CreateFormula( XclFormulaType eType, if( mxData->mbOk ) { XclExpScToken aTokData( GetNextToken() ); - USHORT nScError = rScTokArr.GetCodeError(); + sal_uInt16 nScError = rScTokArr.GetCodeError(); if( (nScError != 0) && (!aTokData.Is() || (aTokData.GetOpCode() == ocStop)) ) { // #i50253# convert simple ocStop token to error code formula (e.g. =#VALUE!) @@ -1319,7 +1319,7 @@ void XclExpFmlaCompImpl::ProcessMatrix( const XclExpScToken& rTokData ) AppendExt( static_cast< sal_uInt8 >( nMatVal.GetBoolean() ? 1 : 0 ) ); AppendExt( 0, 7 ); } - else if( USHORT nErr = nMatVal.GetError() ) + else if( sal_uInt16 nErr = nMatVal.GetError() ) { AppendExt( EXC_CACHEDVAL_ERROR ); AppendExt( XclTools::GetXclErrorCode( nErr ) ); @@ -1744,7 +1744,11 @@ void XclExpFmlaCompImpl::AppendTrailingParam( XclExpFuncData& rFuncData ) break; - default:; + default: + // #i108420# function without parameters stored as macro call needs the external name reference + if( (nParamCount == 0) && rFuncData.IsMacroFunc() ) + AppendDefaultParam( rFuncData ); + } } @@ -1808,7 +1812,7 @@ void XclExpFmlaCompImpl::ConvertRefData( if( bTruncMaxCol && (rnScCol == mnMaxScCol) ) rnScCol = mnMaxAbsCol; else if( (rnScCol < 0) || (rnScCol > mnMaxAbsCol) ) - rRefData.SetColDeleted( TRUE ); + rRefData.SetColDeleted( sal_True ); rXclPos.mnCol = static_cast< sal_uInt16 >( rnScCol ) & mnMaxColMask; // convert row index @@ -1816,7 +1820,7 @@ void XclExpFmlaCompImpl::ConvertRefData( if( bTruncMaxRow && (rnScRow == mnMaxScRow) ) rnScRow = mnMaxAbsRow; else if( (rnScRow < 0) || (rnScRow > mnMaxAbsRow) ) - rRefData.SetRowDeleted( TRUE ); + rRefData.SetRowDeleted( sal_True ); rXclPos.mnRow = static_cast< sal_uInt16 >( rnScRow ) & mnMaxRowMask; } else @@ -1984,7 +1988,7 @@ void XclExpFmlaCompImpl::ProcessExternalCellRef( const XclExpScToken& rTokData ) ConvertRefData( aRefData, aXclPos, false, false, false ); // store external cell contents in CRN records - USHORT nFileId = rTokData.mpScToken->GetIndex(); + sal_uInt16 nFileId = rTokData.mpScToken->GetIndex(); const String& rTabName = rTokData.mpScToken->GetString(); if( mxData->mrCfg.mbFromCell && mxData->mpScBasePos ) mxData->mpLinkMgr->StoreCell( nFileId, rTabName, aRefData ); @@ -2020,7 +2024,7 @@ void XclExpFmlaCompImpl::ProcessExternalRangeRef( const XclExpScToken& rTokData ConvertRefData( aRefData, aXclRange, false ); // store external cell contents in CRN records - USHORT nFileId = rTokData.mpScToken->GetIndex(); + sal_uInt16 nFileId = rTokData.mpScToken->GetIndex(); const String& rTabName = rTokData.mpScToken->GetString(); if( mxData->mrCfg.mbFromCell && mxData->mpScBasePos ) mxData->mpLinkMgr->StoreCellRange( nFileId, rTabName, aRefData ); @@ -2079,7 +2083,7 @@ void XclExpFmlaCompImpl::ProcessExternalName( const XclExpScToken& rTokData ) if( mxData->mpLinkMgr ) { ScExternalRefManager& rExtRefMgr = *GetDoc().GetExternalRefManager(); - USHORT nFileId = rTokData.mpScToken->GetIndex(); + sal_uInt16 nFileId = rTokData.mpScToken->GetIndex(); const String& rName = rTokData.mpScToken->GetString(); ScExternalRefCache::TokenArrayRef xArray = rExtRefMgr.getRangeNameTokens( nFileId, rName ); if( xArray.get() ) @@ -2519,11 +2523,11 @@ void lclInitOwnTab( ScSingleRefData& rRef, const ScAddress& rScPos, SCTAB nCurrS if( b3DRefOnly ) { // no reduction to 2D reference, if global link manager is used - rRef.SetFlag3D( TRUE ); + rRef.SetFlag3D( sal_True ); } else if( rScPos.Tab() == nCurrScTab ) { - rRef.SetTabRel( TRUE ); + rRef.SetTabRel( sal_True ); rRef.nRelTab = 0; } } diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index 93eb4e54cb63..90743a7ffb28 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -479,7 +479,7 @@ XclExpStringRef lclCreateFormattedString( { // test if the character is a text field const SfxPoolItem* pItem; - if( aEditSet.GetItemState( EE_FEATURE_FIELD, FALSE, &pItem ) == SFX_ITEM_SET ) + if( aEditSet.GetItemState( EE_FEATURE_FIELD, false, &pItem ) == SFX_ITEM_SET ) { const SvxFieldData* pField = static_cast< const SvxFieldItem* >( pItem )->GetField(); if( const SvxURLField* pUrlField = PTR_CAST( SvxURLField, pField ) ) @@ -592,8 +592,8 @@ XclExpStringRef XclExpStringHelper::CreateCellString( { // formatted cell ScEditEngineDefaulter& rEE = rRoot.GetEditEngine(); - BOOL bOldUpdateMode = rEE.GetUpdateMode(); - rEE.SetUpdateMode( TRUE ); + sal_Bool bOldUpdateMode = rEE.GetUpdateMode(); + rEE.SetUpdateMode( sal_True ); // default items const SfxItemSet& rItemSet = pCellAttr ? pCellAttr->GetItemSet() : rRoot.GetDoc().GetDefPattern()->GetItemSet(); SfxItemSet* pEEItemSet = new SfxItemSet( rEE.GetEmptyItemSet() ); @@ -622,8 +622,8 @@ XclExpStringRef XclExpStringHelper::CreateString( if( const OutlinerParaObject* pParaObj = rTextObj.GetOutlinerParaObject() ) { EditEngine& rEE = rRoot.GetDrawEditEngine(); - BOOL bOldUpdateMode = rEE.GetUpdateMode(); - rEE.SetUpdateMode( TRUE ); + sal_Bool bOldUpdateMode = rEE.GetUpdateMode(); + rEE.SetUpdateMode( sal_True ); // create the string rEE.SetText( pParaObj->GetTextObject() ); xString = lclCreateFormattedString( rRoot, rEE, 0, nFlags, nMaxLen ); @@ -650,8 +650,8 @@ XclExpStringRef XclExpStringHelper::CreateString( { XclExpStringRef xString; EditEngine& rEE = rRoot.GetDrawEditEngine(); - BOOL bOldUpdateMode = rEE.GetUpdateMode(); - rEE.SetUpdateMode( TRUE ); + sal_Bool bOldUpdateMode = rEE.GetUpdateMode(); + rEE.SetUpdateMode( sal_True ); rEE.SetText( rEditObj ); xString = lclCreateFormattedString( rRoot, rEE, 0, nFlags, nMaxLen ); rEE.SetUpdateMode( bOldUpdateMode ); @@ -710,8 +710,8 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico SfxItemSet aItemSet( *GetDoc().GetPool(), ATTR_PATTERN_START, ATTR_PATTERN_END ); // edit engine - BOOL bOldUpdateMode = mrEE.GetUpdateMode(); - mrEE.SetUpdateMode( TRUE ); + sal_Bool bOldUpdateMode = mrEE.GetUpdateMode(); + mrEE.SetUpdateMode( sal_True ); mrEE.SetText( *pTextObj ); // font information @@ -832,7 +832,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico const SfxPoolItem* pItem; if( (aSel.nStartPos + 1 == aSel.nEndPos) && // fields are single characters - (aEditSet.GetItemState( EE_FEATURE_FIELD, sal_False, &pItem ) == SFX_ITEM_SET) ) + (aEditSet.GetItemState( EE_FEATURE_FIELD, false, &pItem ) == SFX_ITEM_SET) ) { if( const SvxFieldData* pFieldData = static_cast< const SvxFieldItem* >( pItem )->GetField() ) { @@ -931,7 +931,7 @@ bool lclConvertToDos( String& rUrl, const String& rBasePath, bool bSaveRelUrl ) bool bLoop = true; while( bLoop && ((nPos = aDosBase.Search( '\\', nStartSearch )) != STRING_NOTFOUND) ) { - bLoop = (TRUE == aDosBase.Equals( aDosUrl, 0, nPos + 1 )); + bLoop = (sal_True == aDosBase.Equals( aDosUrl, 0, nPos + 1 )); if( bLoop ) { aDosBase.Erase( 0, nPos + 1 ); @@ -1106,7 +1106,7 @@ void XclExpCachedMatrix::Save( XclExpStream& rStrm ) const rStrm << EXC_CACHEDVAL_BOOL << nBool; rStrm.WriteZeroBytes( 7 ); } - else if( USHORT nScError = nMatVal.GetError() ) + else if( sal_uInt16 nScError = nMatVal.GetError() ) { sal_Int8 nError ( XclTools::GetXclErrorCode( nScError ) ); rStrm.SetSliceSize( 9 ); diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 39396179f8d8..43f8342bf815 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -1063,7 +1063,7 @@ sal_uInt16 XclExpExtNameBuffer::InsertDde( sal_uInt16 nIndex = GetIndex( rItem ); if( nIndex == 0 ) { - USHORT nPos; + sal_uInt16 nPos; if( GetDoc().FindDdeLink( rApplic, rTopic, rItem, SC_DDE_IGNOREMODE, nPos ) ) { // create the leading 'StdDocumentName' EXTERNNAME record @@ -1157,7 +1157,7 @@ void XclExpCrn::WriteDouble( XclExpStream& rStrm, double fValue ) { if( ::rtl::math::isNan( fValue ) ) { - USHORT nScError = static_cast< USHORT >( reinterpret_cast< const sal_math_Double* >( &fValue )->nan_parts.fraction_lo ); + sal_uInt16 nScError = static_cast< sal_uInt16 >( reinterpret_cast< const sal_math_Double* >( &fValue )->nan_parts.fraction_lo ); WriteError( rStrm, XclTools::GetXclErrorCode( nScError ) ); } else @@ -1278,7 +1278,7 @@ void XclExpXct::Save( XclExpStream& rStrm ) ::std::pair< SCCOL, SCCOL > aColRange = mxCacheTable->getColRange( nScRow ); for( SCCOL nScCol = aColRange.first; bValid && (nScCol < aColRange.second); ++nScCol ) { - if( maUsedCells.IsCellMarked( nScCol, nScRow, TRUE ) ) + if( maUsedCells.IsCellMarked( nScCol, nScRow, sal_True ) ) { sal_uInt32 nScNumFmt = 0; ScExternalRefCache::TokenRef xToken = mxCacheTable->getCell( nScCol, nScRow, &nScNumFmt ); diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index ae95b6a0725a..9bd32dc63fd4 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -42,9 +42,10 @@ // for filter manager #include "excrecds.hxx" -#include <oox/core/tokens.hxx> #include <formula/grammar.hxx> +using namespace ::oox; + using ::rtl::OString; // ============================================================================ @@ -136,9 +137,9 @@ public: void Initialize(); /** Inserts the Calc name with the passed index and returns the Excel NAME index. */ - sal_uInt16 InsertName( USHORT nScNameIdx ); + sal_uInt16 InsertName( sal_uInt16 nScNameIdx ); /** Inserts the Calc database range with the passed index and returns the Excel NAME index. */ - sal_uInt16 InsertDBRange( USHORT nScDBRangeIdx ); + sal_uInt16 InsertDBRange( sal_uInt16 nScDBRangeIdx ); /** Inserts a new built-in defined name. */ sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab ); @@ -165,11 +166,11 @@ public: private: typedef XclExpRecordList< XclExpName > XclExpNameList; typedef XclExpNameList::RecordRefType XclExpNameRef; - typedef ::std::map< USHORT, sal_uInt16 > XclExpIndexMap; + typedef ::std::map< sal_uInt16, sal_uInt16 > XclExpIndexMap; private: /** Finds the index of a NAME record from the passed Calc index in the specified map. */ - sal_uInt16 FindNameIdx( const XclExpIndexMap& rMap, USHORT nScIdx ) const; + sal_uInt16 FindNameIdx( const XclExpIndexMap& rMap, sal_uInt16 nScIdx ) const; /** Returns the index of an existing built-in NAME record with the passed definition, otherwise 0. */ sal_uInt16 FindBuiltInNameIdx( const String& rName, const XclTokenArray& rTokArr, bool bDBRange ) const; @@ -378,7 +379,7 @@ void XclExpNameManagerImpl::Initialize() CreateDatabaseNames(); } -sal_uInt16 XclExpNameManagerImpl::InsertName( USHORT nScNameIdx ) +sal_uInt16 XclExpNameManagerImpl::InsertName( sal_uInt16 nScNameIdx ) { sal_uInt16 nNameIdx = FindNameIdx( maNameMap, nScNameIdx ); if( nNameIdx == 0 ) @@ -387,7 +388,7 @@ sal_uInt16 XclExpNameManagerImpl::InsertName( USHORT nScNameIdx ) return nNameIdx; } -sal_uInt16 XclExpNameManagerImpl::InsertDBRange( USHORT nScDBRangeIdx ) +sal_uInt16 XclExpNameManagerImpl::InsertDBRange( sal_uInt16 nScDBRangeIdx ) { sal_uInt16 nNameIdx = FindNameIdx( maDBRangeMap, nScDBRangeIdx ); if( nNameIdx == 0 ) @@ -482,7 +483,7 @@ void XclExpNameManagerImpl::SaveXml( XclExpXmlStream& rStrm ) // private -------------------------------------------------------------------- -sal_uInt16 XclExpNameManagerImpl::FindNameIdx( const XclExpIndexMap& rMap, USHORT nScIdx ) const +sal_uInt16 XclExpNameManagerImpl::FindNameIdx( const XclExpIndexMap& rMap, sal_uInt16 nScIdx ) const { XclExpIndexMap::const_iterator aIt = rMap.find( nScIdx ); return (aIt == rMap.end()) ? 0 : aIt->second; @@ -628,7 +629,7 @@ void XclExpNameManagerImpl::CreateBuiltInNames() if( rDoc.HasPrintRange() ) { ScRangeList aRangeList; - for( USHORT nIdx = 0, nCount = rDoc.GetPrintRangeCount( nScTab ); nIdx < nCount; ++nIdx ) + for( sal_uInt16 nIdx = 0, nCount = rDoc.GetPrintRangeCount( nScTab ); nIdx < nCount; ++nIdx ) { ScRange aRange( *rDoc.GetPrintRange( nScTab, nIdx ) ); // Calc document does not care about sheet index in print ranges @@ -684,7 +685,7 @@ void XclExpNameManagerImpl::CreateUserNames() void XclExpNameManagerImpl::CreateDatabaseNames() { const ScDBCollection& rDBRanges = GetDatabaseRanges(); - for( USHORT nDBIdx = 0, nDBCount = rDBRanges.GetCount(); nDBIdx < nDBCount; ++nDBIdx ) + for( sal_uInt16 nDBIdx = 0, nDBCount = rDBRanges.GetCount(); nDBIdx < nDBCount; ++nDBIdx ) { const ScDBData* pDBData = rDBRanges[ nDBIdx ]; DBG_ASSERT( pDBData, "XclExpNameManagerImpl::CreateDatabaseNames - missing database range" ); @@ -711,12 +712,12 @@ void XclExpNameManager::Initialize() mxImpl->Initialize(); } -sal_uInt16 XclExpNameManager::InsertName( USHORT nScNameIdx ) +sal_uInt16 XclExpNameManager::InsertName( sal_uInt16 nScNameIdx ) { return mxImpl->InsertName( nScNameIdx ); } -sal_uInt16 XclExpNameManager::InsertDBRange( USHORT nScDBRangeIdx ) +sal_uInt16 XclExpNameManager::InsertDBRange( sal_uInt16 nScDBRangeIdx ) { return mxImpl->InsertDBRange( nScDBRangeIdx ); } diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx index 4d3f3dae9d9e..47396d620e41 100644 --- a/sc/source/filter/excel/xepage.cxx +++ b/sc/source/filter/excel/xepage.cxx @@ -49,7 +49,7 @@ #include <set> #include <limits> -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::rtl::OString; using ::std::set; diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 56c98a199f9a..069c9a7719e6 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -52,7 +52,7 @@ #include "xestring.hxx" #include "xelink.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::com::sun::star::sheet::DataPilotFieldOrientation; using ::com::sun::star::sheet::DataPilotFieldOrientation_HIDDEN; @@ -938,7 +938,7 @@ String lclGetDataFieldCaption( const String& rFieldName, GeneralFunction eFunc ) { String aCaption; - USHORT nResIdx = 0; + sal_uInt16 nResIdx = 0; using namespace ::com::sun::star::sheet; switch( eFunc ) { diff --git a/sc/source/filter/excel/xerecord.cxx b/sc/source/filter/excel/xerecord.cxx index f02e2db82fc1..f210efd1a4a1 100644 --- a/sc/source/filter/excel/xerecord.cxx +++ b/sc/source/filter/excel/xerecord.cxx @@ -31,7 +31,7 @@ #include "xerecord.hxx" #include "xeroot.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; // Base classes to export Excel records ======================================= diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index 4b6169ceb20a..d72f9c77d61d 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -29,7 +29,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" +#include <rtl/random.h> #include <sfx2/docfile.hxx> +#include <sfx2/request.hxx> +#include <sfx2/frame.hxx> #include <sfx2/sfxsids.hrc> #include <unotools/saveopt.hxx> #include <svl/itemset.hxx> @@ -52,6 +55,8 @@ #include "document.hxx" #include "scextopt.hxx" +using namespace ::com::sun::star; + // Global data ================================================================ XclExpRootData::XclExpRootData( XclBiff eBiff, SfxMedium& rMedium, @@ -242,23 +247,66 @@ bool XclExpRoot::IsDocumentEncrypted() const if (pDocProt && pDocProt->isProtected() && pDocProt->isOptionEnabled(ScDocProtection::STRUCTURE)) return true; - if (GetPassword().Len() > 0) + if ( GetEncryptionData().getLength() > 0 ) // Password is entered directly into the save dialog. return true; return false; } -String XclExpRoot::GetPassword() const +uno::Sequence< beans::NamedValue > XclExpRoot::GenerateEncryptionData( const ::rtl::OUString& aPass ) const { - if( SfxItemSet* pItemSet = GetMedium().GetItemSet() ) + uno::Sequence< beans::NamedValue > aEncryptionData; + + if ( aPass.getLength() > 0 && aPass.getLength() < 16 ) { - const SfxPoolItem* pItem = 0; - if( pItemSet->GetItemState( SID_PASSWORD, TRUE, &pItem ) == SFX_ITEM_SET ) - if( const SfxStringItem* pStrItem = dynamic_cast< const SfxStringItem* >( pItem ) ) - return pStrItem->GetValue(); + TimeValue aTime; + osl_getSystemTime( &aTime ); + rtlRandomPool aRandomPool = rtl_random_createPool (); + rtl_random_addBytes ( aRandomPool, &aTime, 8 ); + + sal_uInt8 pnDocId[16]; + rtl_random_getBytes( aRandomPool, pnDocId, 16 ); + + rtl_random_destroyPool( aRandomPool ); + + sal_uInt16 pnPasswd[16]; + memset( pnPasswd, 0, sizeof( pnPasswd ) ); + for (xub_StrLen nChar = 0; nChar < aPass.getLength(); ++nChar ) + pnPasswd[nChar] = aPass.getStr()[nChar]; + + ::msfilter::MSCodec_Std97 aCodec; + aCodec.InitKey( pnPasswd, pnDocId ); + aEncryptionData = aCodec.GetEncryptionData(); } - return String::EmptyString(); + + return aEncryptionData; +} + +uno::Sequence< beans::NamedValue > XclExpRoot::GetEncryptionData() const +{ + uno::Sequence< beans::NamedValue > aEncryptionData; + SFX_ITEMSET_ARG( GetMedium().GetItemSet(), pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, false ); + if ( pEncryptionDataItem ) + pEncryptionDataItem->GetValue() >>= aEncryptionData; + else + { + // try to get the encryption data from the password + SFX_ITEMSET_ARG( GetMedium().GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD, false ); + if ( pPasswordItem && pPasswordItem->GetValue().Len() ) + aEncryptionData = GenerateEncryptionData( pPasswordItem->GetValue() ); + } + + return aEncryptionData; +} + +uno::Sequence< beans::NamedValue > XclExpRoot::GenerateDefaultEncryptionData() const +{ + uno::Sequence< beans::NamedValue > aEncryptionData; + if ( GetDefaultPassword().Len() > 0 ) + aEncryptionData = GenerateEncryptionData( GetDefaultPassword() ); + + return aEncryptionData; } XclExpRootData::XclExpLinkMgrRef XclExpRoot::GetLocalLinkMgrRef() const diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index e1e44a52b7cc..d8fe4bed9234 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -33,6 +33,8 @@ #include <utility> #include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/random.h> #include <sax/fshelper.hxx> #include <unotools/streamwrap.hxx> @@ -78,10 +80,17 @@ using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::XInterface; using ::rtl::OString; using ::rtl::OUString; +using ::rtl::OUStringBuffer; using ::utl::OStreamWrapper; using ::std::vector; -using namespace formula; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::sheet; +using namespace ::com::sun::star::uno; +using namespace ::formula; +using namespace ::oox; // ============================================================================ @@ -473,17 +482,16 @@ void XclExpStream::WriteRawZeroBytes( sal_Size nBytes ) // ============================================================================ -XclExpBiff8Encrypter::XclExpBiff8Encrypter( const XclExpRoot& rRoot, const sal_uInt8 nDocId[16], - const sal_uInt8 nSalt[16] ) : +XclExpBiff8Encrypter::XclExpBiff8Encrypter( const XclExpRoot& rRoot ) : mrRoot(rRoot), mnOldPos(STREAM_SEEK_TO_END), mbValid(false) { - String aPass = rRoot.GetPassword(); - if (aPass.Len() == 0) + Sequence< NamedValue > aEncryptionData = rRoot.GetEncryptionData(); + if( !aEncryptionData.hasElements() ) // Empty password. Get the default biff8 password. - aPass = rRoot.GetDefaultPassword(); - Init(aPass, nDocId, nSalt); + aEncryptionData = rRoot.GenerateDefaultEncryptionData(); + Init( aEncryptionData ); } XclExpBiff8Encrypter::~XclExpBiff8Encrypter() @@ -495,9 +503,22 @@ bool XclExpBiff8Encrypter::IsValid() const return mbValid; } -void XclExpBiff8Encrypter::GetSaltDigest( sal_uInt8 nSaltDigest[16] ) const +void XclExpBiff8Encrypter::GetSaltDigest( sal_uInt8 pnSaltDigest[16] ) const { - memcpy(nSaltDigest, mnSaltDigest, 16); + if ( sizeof( mpnSaltDigest ) == 16 ) + memcpy( pnSaltDigest, mpnSaltDigest, 16 ); +} + +void XclExpBiff8Encrypter::GetSalt( sal_uInt8 pnSalt[16] ) const +{ + if ( sizeof( mpnSalt ) == 16 ) + memcpy( pnSalt, mpnSalt, 16 ); +} + +void XclExpBiff8Encrypter::GetDocId( sal_uInt8 pnDocId[16] ) const +{ + if ( sizeof( mpnDocId ) == 16 ) + memcpy( pnDocId, mpnDocId, 16 ); } void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt8 nData ) @@ -554,46 +575,42 @@ void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_Int32 nData ) Encrypt(rStrm, static_cast<sal_uInt32>(nData)); } -void XclExpBiff8Encrypter::Init( const String& aPass, const sal_uInt8 nDocId[16], - const sal_uInt8 nSalt[16] ) +void XclExpBiff8Encrypter::Init( const Sequence< NamedValue >& rEncryptionData ) { - memset(mnSaltDigest, 0, sizeof(mnSaltDigest)); + mbValid = false; - xub_StrLen nLen = aPass.Len(); - bool bValid = (0 < nLen) && (nLen < 16); - if ( bValid ) + if( maCodec.InitCodec( rEncryptionData ) ) { - // transform String to sal_uInt16 array - memset(mnPassw, 0, sizeof(mnPassw)); - for (xub_StrLen nChar = 0; nChar < nLen; ++nChar) - mnPassw[nChar] = static_cast<sal_uInt16>(aPass.GetChar(nChar)); + maCodec.GetDocId( mpnDocId ); - // copy document ID - memcpy(mnDocId, nDocId, sizeof(mnDocId)); + // generate the salt here + TimeValue aTime; + osl_getSystemTime( &aTime ); + rtlRandomPool aRandomPool = rtl_random_createPool (); + rtl_random_addBytes( aRandomPool, &aTime, 8 ); + rtl_random_getBytes( aRandomPool, mpnSalt, 16 ); + rtl_random_destroyPool( aRandomPool ); - // init codec - maCodec.InitKey(mnPassw, mnDocId); + memset( mpnSaltDigest, 0, sizeof( mpnSaltDigest ) ); // generate salt hash. ::msfilter::MSCodec_Std97 aCodec; - aCodec.InitKey(mnPassw, mnDocId); - aCodec.CreateSaltDigest(nSalt, mnSaltDigest); + aCodec.InitCodec( rEncryptionData ); + aCodec.CreateSaltDigest( mpnSalt, mpnSaltDigest ); // verify to make sure it's in good shape. - bValid = maCodec.VerifyKey(nSalt, mnSaltDigest); + mbValid = maCodec.VerifyKey( mpnSalt, mpnSaltDigest ); } - - mbValid = bValid; } sal_uInt32 XclExpBiff8Encrypter::GetBlockPos( sal_Size nStrmPos ) const { - return static_cast<sal_uInt32>(nStrmPos / EXC_ENCR_BLOCKSIZE); + return static_cast< sal_uInt32 >( nStrmPos / EXC_ENCR_BLOCKSIZE ); } sal_uInt16 XclExpBiff8Encrypter::GetOffsetInBlock( sal_Size nStrmPos ) const { - return static_cast<sal_uInt16>(nStrmPos % EXC_ENCR_BLOCKSIZE); + return static_cast< sal_uInt16 >( nStrmPos % EXC_ENCR_BLOCKSIZE ); } void XclExpBiff8Encrypter::EncryptBytes( SvStream& rStrm, vector<sal_uInt8>& aBytes ) @@ -660,7 +677,7 @@ void XclExpBiff8Encrypter::EncryptBytes( SvStream& rStrm, vector<sal_uInt8>& aBy mnOldPos = nStrmPos; } -static const char* lcl_GetErrorString( USHORT nScErrCode ) +static const char* lcl_GetErrorString( sal_uInt16 nScErrCode ) { sal_uInt8 nXclErrCode = XclTools::GetXclErrorCode( nScErrCode ); switch( nXclErrCode ) @@ -683,7 +700,7 @@ void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& rCell, const char*& rsT case NUMBERFORMAT_NUMBER: { // either value or error code - USHORT nScErrCode = rCell.GetErrCode(); + sal_uInt16 nScErrCode = rCell.GetErrCode(); if( nScErrCode ) { rsType = "e"; @@ -726,7 +743,7 @@ void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& rCell, const char*& rsT rtl::OUString XclXmlUtils::GetStreamName( const char* sStreamDir, const char* sStream, sal_Int32 nId ) { - rtl::OUStringBuffer sBuf; + OUStringBuffer sBuf; if( sStreamDir ) sBuf.appendAscii( sStreamDir ); sBuf.appendAscii( sStream ); @@ -739,7 +756,7 @@ rtl::OUString XclXmlUtils::GetStreamName( const char* sStreamDir, const char* sS return sBuf.makeStringAndClear(); } -rtl::OString XclXmlUtils::ToOString( const Color& rColor ) +OString XclXmlUtils::ToOString( const Color& rColor ) { char buf[9]; sprintf( buf, "%.2X%.2X%.2X%.2X", rColor.GetTransparency(), rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue() ); @@ -747,37 +764,37 @@ rtl::OString XclXmlUtils::ToOString( const Color& rColor ) return OString( buf ); } -rtl::OString XclXmlUtils::ToOString( const ::rtl::OUString& s ) +OString XclXmlUtils::ToOString( const OUString& s ) { return OUStringToOString( s, RTL_TEXTENCODING_UTF8 ); } -rtl::OString XclXmlUtils::ToOString( const String& s ) +OString XclXmlUtils::ToOString( const String& s ) { - return rtl::OString( s.GetBuffer(), s.Len(), RTL_TEXTENCODING_UTF8 ); + return OString( s.GetBuffer(), s.Len(), RTL_TEXTENCODING_UTF8 ); } -rtl::OString XclXmlUtils::ToOString( const ScAddress& rAddress ) +OString XclXmlUtils::ToOString( const ScAddress& rAddress ) { String sAddress; rAddress.Format( sAddress, SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1 ) ); return ToOString( sAddress ); } -rtl::OString XclXmlUtils::ToOString( const ScfUInt16Vec& rBuffer ) +OString XclXmlUtils::ToOString( const ScfUInt16Vec& rBuffer ) { const sal_uInt16* pBuffer = &rBuffer [0]; - return ::rtl::OString( pBuffer, rBuffer.size(), RTL_TEXTENCODING_UTF8 ); + return OString( pBuffer, rBuffer.size(), RTL_TEXTENCODING_UTF8 ); } -rtl::OString XclXmlUtils::ToOString( const ScRange& rRange ) +OString XclXmlUtils::ToOString( const ScRange& rRange ) { String sRange; rRange.Format( sRange, SCA_VALID, NULL, ScAddress::Details( FormulaGrammar::CONV_XL_A1 ) ); return ToOString( sRange ); } -rtl::OString XclXmlUtils::ToOString( const ScRangeList& rRangeList ) +OString XclXmlUtils::ToOString( const ScRangeList& rRangeList ) { String s; rRangeList.Format( s, SCA_VALID, NULL, FormulaGrammar::CONV_XL_A1, ' ' ); @@ -797,12 +814,12 @@ static ScAddress lcl_ToAddress( const XclAddress& rAddress ) return aAddress; } -rtl::OString XclXmlUtils::ToOString( const XclAddress& rAddress ) +OString XclXmlUtils::ToOString( const XclAddress& rAddress ) { return ToOString( lcl_ToAddress( rAddress ) ); } -rtl::OString XclXmlUtils::ToOString( const XclExpString& s ) +OString XclXmlUtils::ToOString( const XclExpString& s ) { DBG_ASSERT( !s.IsRich(), "XclXmlUtils::ToOString(XclExpString): rich text string found!" ); return ToOString( s.GetUnicodeBuffer() ); @@ -852,7 +869,7 @@ OUString XclXmlUtils::ToOUString( const String& s ) return OUString( s.GetBuffer(), s.Len() ); } -rtl::OUString XclXmlUtils::ToOUString( ScDocument& rDocument, const ScAddress& rAddress, ScTokenArray* pTokenArray ) +OUString XclXmlUtils::ToOUString( ScDocument& rDocument, const ScAddress& rAddress, ScTokenArray* pTokenArray ) { ScCompiler aCompiler( &rDocument, rAddress, *pTokenArray); aCompiler.SetGrammar(FormulaGrammar::GRAM_ENGLISH_XL_A1); @@ -1033,7 +1050,7 @@ sax_fastparser::FSHelperPtr XclExpXmlStream::CreateOutputStream ( const Reference< XOutputStream >& xParentRelation, const char* sContentType, const char* sRelationshipType, - ::rtl::OUString* pRelationshipId ) + OUString* pRelationshipId ) { OUString sRelationshipId; if (xParentRelation.is()) @@ -1138,7 +1155,12 @@ OUString XlsxExport_getImplementationName() return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME ) ); } -::rtl::OUString XclExpXmlStream::implGetImplementationName() const +::oox::ole::VbaProject* XclExpXmlStream::implCreateVbaProject() const +{ + return new ::oox::xls::ExcelVbaProject( getComponentContext(), Reference< XSpreadsheetDocument >( getModel(), UNO_QUERY ) ); +} + +OUString XclExpXmlStream::implGetImplementationName() const { return CREATE_OUSTRING( "TODO" ); } @@ -1168,7 +1190,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey ) { - sal_Bool bRet = sal_False; + sal_Bool bRet = false; if( pRegistryKey ) { @@ -1183,7 +1205,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* /* pServiceMan } catch( InvalidRegistryException& ) { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); + OSL_ENSURE( false, "### InvalidRegistryException!" ); } } diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx index b6e6dc02115c..987b25dba294 100644 --- a/sc/source/filter/excel/xestring.cxx +++ b/sc/source/filter/excel/xestring.cxx @@ -38,7 +38,7 @@ #include "xestyle.hxx" #include "xestring.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::rtl::OString; using ::rtl::OUString; diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 8964b9f52366..79b4d1949507 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -837,7 +837,7 @@ void XclExpPalette::WriteBody( XclExpStream& rStrm ) namespace { -typedef ::std::pair< USHORT, sal_Int16 > WhichAndScript; +typedef ::std::pair< sal_uInt16, sal_Int16 > WhichAndScript; sal_Int16 lclCheckFontItems( const SfxItemSet& rItemSet, const WhichAndScript& rWAS1, const WhichAndScript& rWAS2, const WhichAndScript& rWAS3 ) @@ -901,7 +901,7 @@ Font XclExpFontHelper::GetFontFromItemSet( const XclExpRoot& rRoot, const SfxIte nScript = GetFirstUsedScript( rRoot, rItemSet ); // convert to core script type constants - BYTE nScScript = SCRIPTTYPE_LATIN; + sal_uInt8 nScScript = SCRIPTTYPE_LATIN; switch( nScript ) { case ApiScriptType::LATIN: nScScript = SCRIPTTYPE_LATIN; break; @@ -918,14 +918,14 @@ Font XclExpFontHelper::GetFontFromItemSet( const XclExpRoot& rRoot, const SfxIte bool XclExpFontHelper::CheckItems( const XclExpRoot& rRoot, const SfxItemSet& rItemSet, sal_Int16 nScript, bool bDeep ) { - static const USHORT pnCommonIds[] = { + static const sal_uInt16 pnCommonIds[] = { ATTR_FONT_UNDERLINE, ATTR_FONT_CROSSEDOUT, ATTR_FONT_CONTOUR, ATTR_FONT_SHADOWED, ATTR_FONT_COLOR, ATTR_FONT_LANGUAGE, 0 }; - static const USHORT pnLatinIds[] = { + static const sal_uInt16 pnLatinIds[] = { ATTR_FONT, ATTR_FONT_HEIGHT, ATTR_FONT_WEIGHT, ATTR_FONT_POSTURE, 0 }; - static const USHORT pnAsianIds[] = { + static const sal_uInt16 pnAsianIds[] = { ATTR_CJK_FONT, ATTR_CJK_FONT_HEIGHT, ATTR_CJK_FONT_WEIGHT, ATTR_CJK_FONT_POSTURE, 0 }; - static const USHORT pnComplexIds[] = { + static const sal_uInt16 pnComplexIds[] = { ATTR_CTL_FONT, ATTR_CTL_FONT_HEIGHT, ATTR_CTL_FONT_WEIGHT, ATTR_CTL_FONT_POSTURE, 0 }; bool bUsed = ScfTools::CheckItems( rItemSet, pnCommonIds, bDeep ); @@ -1213,8 +1213,8 @@ size_t XclExpFontBuffer::Find( const XclFontData& rFontData ) /** Predicate for search algorithm. */ struct XclExpNumFmtPred { - ULONG mnScNumFmt; - inline explicit XclExpNumFmtPred( ULONG nScNumFmt ) : mnScNumFmt( nScNumFmt ) {} + sal_uLong mnScNumFmt; + inline explicit XclExpNumFmtPred( sal_uLong nScNumFmt ) : mnScNumFmt( nScNumFmt ) {} inline bool operator()( const XclExpNumFmt& rFormat ) const { return rFormat.mnScNumFmt == mnScNumFmt; } }; @@ -1252,7 +1252,7 @@ XclExpNumFmtBuffer::~XclExpNumFmtBuffer() delete[] mpKeywordTable; } -sal_uInt16 XclExpNumFmtBuffer::Insert( ULONG nScNumFmt ) +sal_uInt16 XclExpNumFmtBuffer::Insert( sal_uLong nScNumFmt ) { XclExpNumFmtVec::const_iterator aIt = ::std::find_if( maFormatMap.begin(), maFormatMap.end(), XclExpNumFmtPred( nScNumFmt ) ); @@ -1403,7 +1403,7 @@ bool XclExpCellAlign::FillFromItemSet( bUsed |= ScfTools::CheckItem( rItemSet, ATTR_INDENT, bStyle ); // shrink to fit - mbShrink = GETITEMVALUE( rItemSet, SfxBoolItem, ATTR_SHRINKTOFIT, BOOL ); + mbShrink = GETITEMVALUE( rItemSet, SfxBoolItem, ATTR_SHRINKTOFIT, sal_Bool ); bUsed |= ScfTools::CheckItem( rItemSet, ATTR_SHRINKTOFIT, bStyle ); // CTL text direction @@ -1419,7 +1419,7 @@ bool XclExpCellAlign::FillFromItemSet( bUsed |= ScfTools::CheckItem( rItemSet, ATTR_VER_JUSTIFY, bStyle ); // stacked/rotation - bool bStacked = GETITEMVALUE( rItemSet, SfxBoolItem, ATTR_STACKED, BOOL ); + bool bStacked = GETITEMVALUE( rItemSet, SfxBoolItem, ATTR_STACKED, sal_Bool ); bUsed |= ScfTools::CheckItem( rItemSet, ATTR_STACKED, bStyle ); if( bStacked ) { @@ -1895,7 +1895,7 @@ void XclExpXFId::ConvertXFIndex( const XclExpRoot& rRoot ) XclExpXF::XclExpXF( const XclExpRoot& rRoot, const ScPatternAttr& rPattern, sal_Int16 nScript, - ULONG nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) : + sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) : XclXFBase( true ), XclExpRoot( rRoot ) { @@ -1923,7 +1923,7 @@ XclExpXF::XclExpXF( const XclExpRoot& rRoot, bool bCellXF ) : } bool XclExpXF::Equals( const ScPatternAttr& rPattern, - ULONG nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) const + sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) const { return IsCellXF() && (mpItemSet == &rPattern.GetItemSet()) && (!bForceLineBreak || maAlignment.mbLineBreak) && @@ -1960,7 +1960,7 @@ void XclExpXF::InitDefault() } void XclExpXF::Init( const SfxItemSet& rItemSet, sal_Int16 nScript, - ULONG nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak, bool bDefStyle ) + sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak, bool bDefStyle ) { InitDefault(); mpItemSet = &rItemSet; @@ -1982,7 +1982,7 @@ void XclExpXF::Init( const SfxItemSet& rItemSet, sal_Int16 nScript, // number format mnScNumFmt = (nForceScNumFmt == NUMBERFORMAT_ENTRY_NOT_FOUND) ? - GETITEMVALUE( rItemSet, SfxUInt32Item, ATTR_VALUE_FORMAT, ULONG ) : nForceScNumFmt; + GETITEMVALUE( rItemSet, SfxUInt32Item, ATTR_VALUE_FORMAT, sal_uLong ) : nForceScNumFmt; mnXclNumFmt = GetNumFmtBuffer().Insert( mnScNumFmt ); mbFmtUsed = ScfTools::CheckItem( rItemSet, ATTR_VALUE_FORMAT, IsStyleXF() ); @@ -2304,7 +2304,7 @@ sal_uInt32 XclExpXFBuffer::InsertWithFont( const ScPatternAttr* pPattern, sal_In return InsertCellXF( pPattern, nScript, NUMBERFORMAT_ENTRY_NOT_FOUND, nForceXclFont, bForceLineBreak ); } -sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, ULONG nForceScNumFmt, bool bForceLineBreak ) +sal_uInt32 XclExpXFBuffer::InsertWithNumFmt( const ScPatternAttr* pPattern, sal_Int16 nScript, sal_uLong nForceScNumFmt, bool bForceLineBreak ) { return InsertCellXF( pPattern, nScript, nForceScNumFmt, EXC_FONT_NOTFOUND, bForceLineBreak ); } @@ -2563,7 +2563,7 @@ void XclExpXFBuffer::SaveXFXml( XclExpXmlStream& rStrm, XclExpXF& rXF ) } sal_uInt32 XclExpXFBuffer::FindXF( const ScPatternAttr& rPattern, - ULONG nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) const + sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) const { for( size_t nPos = 0, nSize = maXFList.GetSize(); nPos < nSize; ++nPos ) if( maXFList.GetRecord( nPos )->Equals( rPattern, nForceScNumFmt, nForceXclFont, bForceLineBreak ) ) @@ -2588,7 +2588,7 @@ sal_uInt32 XclExpXFBuffer::FindBuiltInXF( sal_uInt8 nStyleId, sal_uInt8 nLevel ) } sal_uInt32 XclExpXFBuffer::InsertCellXF( const ScPatternAttr* pPattern, sal_Int16 nScript, - ULONG nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) + sal_uLong nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak ) { const ScPatternAttr* pDefPattern = GetDoc().GetDefPattern(); if( !pPattern ) diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index eb113ad932f0..ac86a0b065c4 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -44,7 +44,7 @@ #include "xecontent.hxx" #include "xeescher.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::rtl::OString; using ::rtl::OUString; @@ -779,12 +779,12 @@ XclExpFormulaCell::XclExpFormulaCell( XclExpNumFmtBuffer& rNumFmtBfr = rRoot.GetNumFmtBuffer(); // current cell number format - ULONG nScNumFmt = pPattern ? - GETITEMVALUE( pPattern->GetItemSet(), SfxUInt32Item, ATTR_VALUE_FORMAT, ULONG ) : + sal_uLong nScNumFmt = pPattern ? + GETITEMVALUE( pPattern->GetItemSet(), SfxUInt32Item, ATTR_VALUE_FORMAT, sal_uLong ) : rNumFmtBfr.GetStandardFormat(); // alternative number format passed to XF buffer - ULONG nAltScNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND; + sal_uLong nAltScNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND; /* Xcl doesn't know Boolean number formats, we write "TRUE";"FALSE" (language dependent). Don't do it for automatic formula formats, because Excel gets them right. */ @@ -938,7 +938,7 @@ void XclExpFormulaCell::WriteContents( XclExpStream& rStrm ) case NUMBERFORMAT_NUMBER: { // either value or error code - USHORT nScErrCode = mrScFmlaCell.GetErrCode(); + sal_uInt16 nScErrCode = mrScFmlaCell.GetErrCode(); if( nScErrCode ) rStrm << EXC_FORMULA_RES_ERROR << sal_uInt8( 0 ) << XclTools::GetXclErrorCode( nScErrCode ) @@ -1304,7 +1304,7 @@ XclExpOutlineBuffer::XclExpOutlineBuffer( const XclExpRoot& rRoot, bool bRows ) mpScOLArray = bRows ? pOutlineTable->GetRowArray() : pOutlineTable->GetColArray(); if( mpScOLArray ) - for( USHORT nLevel = 0; nLevel < SC_OL_MAXDEPTH; ++nLevel ) + for( sal_uInt16 nLevel = 0; nLevel < SC_OL_MAXDEPTH; ++nLevel ) if( ScOutlineEntry* pEntry = mpScOLArray->GetEntryByPos( nLevel, 0 ) ) maLevelInfos[ nLevel ].mnScEndPos = pEntry->GetEnd(); } @@ -1314,7 +1314,7 @@ void XclExpOutlineBuffer::UpdateColRow( SCCOLROW nScPos ) if( mpScOLArray ) { // find open level index for passed position - USHORT nNewOpenScLevel = 0; // new open level (0-based Calc index) + sal_uInt16 nNewOpenScLevel = 0; // new open level (0-based Calc index) sal_uInt8 nNewLevel = 0; // new open level (1-based Excel index) if( mpScOLArray->FindTouchedLevel( nScPos, nScPos, nNewOpenScLevel ) ) @@ -1325,7 +1325,7 @@ void XclExpOutlineBuffer::UpdateColRow( SCCOLROW nScPos ) if( nNewLevel >= mnCurrLevel ) { // new level(s) opened, or no level closed - update all level infos - for( USHORT nScLevel = 0; nScLevel <= nNewOpenScLevel; ++nScLevel ) + for( sal_uInt16 nScLevel = 0; nScLevel <= nNewOpenScLevel; ++nScLevel ) { /* In each level: check if a new group is started (there may be neighbored groups without gap - therefore check ALL levels). */ @@ -1343,8 +1343,8 @@ void XclExpOutlineBuffer::UpdateColRow( SCCOLROW nScPos ) { // level(s) closed - check if any of the closed levels are collapsed // Calc uses 0-based level indexes - USHORT nOldOpenScLevel = mnCurrLevel - 1; - for( USHORT nScLevel = nNewOpenScLevel + 1; !mbCurrCollapse && (nScLevel <= nOldOpenScLevel); ++nScLevel ) + sal_uInt16 nOldOpenScLevel = mnCurrLevel - 1; + for( sal_uInt16 nScLevel = nNewOpenScLevel + 1; !mbCurrCollapse && (nScLevel <= nOldOpenScLevel); ++nScLevel ) mbCurrCollapse = maLevelInfos[ nScLevel ].mbHidden; } @@ -1499,7 +1499,7 @@ XclExpColinfo::XclExpColinfo( const XclExpRoot& rRoot, rDoc.GetMostUsedPattern( nScCol, 0, nLastScRow, nScTab ), GetDefApiScript() ); // column width - USHORT nScWidth = rDoc.GetColWidth( nScCol, nScTab ); + sal_uInt16 nScWidth = rDoc.GetColWidth( nScCol, nScTab ); mnWidth = XclTools::GetXclColumnWidth( nScWidth, GetCharWidth() ); // column flags @@ -1726,8 +1726,8 @@ XclExpRow::XclExpRow( const XclExpRoot& rRoot, sal_uInt16 nXclRow, // *** Row flags *** ------------------------------------------------------ - BYTE nRowFlags = GetDoc().GetRowFlags( nScRow, nScTab ); - bool bUserHeight = ::get_flag< BYTE >( nRowFlags, CR_MANUALSIZE ); + sal_uInt8 nRowFlags = GetDoc().GetRowFlags( nScRow, nScTab ); + bool bUserHeight = ::get_flag< sal_uInt8 >( nRowFlags, CR_MANUALSIZE ); bool bHidden = GetDoc().RowHidden(nScRow, nScTab); ::set_flag( mnFlags, EXC_ROW_UNSYNCED, bUserHeight ); ::set_flag( mnFlags, EXC_ROW_HIDDEN, bHidden ); @@ -2273,7 +2273,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : // try to create a Boolean cell if( pPattern && ((fValue == 0.0) || (fValue == 1.0)) ) { - ULONG nScNumFmt = GETITEMVALUE( pPattern->GetItemSet(), SfxUInt32Item, ATTR_VALUE_FORMAT, ULONG ); + sal_uLong nScNumFmt = GETITEMVALUE( pPattern->GetItemSet(), SfxUInt32Item, ATTR_VALUE_FORMAT, sal_uLong ); if( rFormatter.GetType( nScNumFmt ) == NUMBERFORMAT_LOGICAL ) xCell.reset( new XclExpBooleanCell( GetRoot(), aXclPos, pPattern, nMergeBaseXFId, fValue != 0.0 ) ); @@ -2373,7 +2373,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : // data validation if( ScfTools::CheckItem( rItemSet, ATTR_VALIDDATA, false ) ) { - ULONG nScHandle = GETITEMVALUE( rItemSet, SfxUInt32Item, ATTR_VALIDDATA, ULONG ); + sal_uLong nScHandle = GETITEMVALUE( rItemSet, SfxUInt32Item, ATTR_VALIDDATA, sal_uLong ); ScRange aScRange( aScPos ); aScRange.aEnd.SetCol( nLastScCol ); mxDval->InsertCellRange( aScRange, nScHandle ); diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx index 85cd24ece0a5..df69840081cb 100644 --- a/sc/source/filter/excel/xeview.cxx +++ b/sc/source/filter/excel/xeview.cxx @@ -35,7 +35,7 @@ #include "xelink.hxx" #include "xestyle.hxx" -#include <oox/core/tokens.hxx> +using namespace ::oox; using ::rtl::OString; diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index d262342b65a4..0393ad2d45bf 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -44,6 +44,9 @@ #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> #include <com/sun/star/chart/ChartAxisMarkPosition.hpp> #include <com/sun/star/chart/ChartAxisPosition.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> +#include <com/sun/star/chart/TimeInterval.hpp> +#include <com/sun/star/chart/TimeUnit.hpp> #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -60,11 +63,11 @@ #include <com/sun/star/chart2/CurveStyle.hpp> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> #include <com/sun/star/chart2/DataPointLabel.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart2/StackingDirection.hpp> #include <com/sun/star/chart2/TickmarkStyle.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> +#include <com/sun/star/chart2/RelativeSize.hpp> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> @@ -108,6 +111,7 @@ using ::com::sun::star::drawing::XShape; using ::com::sun::star::chart2::IncrementData; using ::com::sun::star::chart2::RelativePosition; +using ::com::sun::star::chart2::RelativeSize; using ::com::sun::star::chart2::ScaleData; using ::com::sun::star::chart2::SubIncrement; using ::com::sun::star::chart2::XAxis; @@ -151,13 +155,12 @@ XclImpStream& operator>>( XclImpStream& rStrm, XclChRectangle& rRect ) return rStrm >> rRect.mnX >> rRect.mnY >> rRect.mnWidth >> rRect.mnHeight; } -template< typename Type > -void lclSetValueOrClearAny( Any& rAny, const Type& rValue, bool bClear ) +inline void lclSetValueOrClearAny( Any& rAny, double fValue, bool bClear ) { if( bClear ) rAny.clear(); else - rAny <<= rValue; + rAny <<= fValue; } void lclSetExpValueOrClearAny( Any& rAny, double fValue, bool bLogScale, bool bClear ) @@ -167,6 +170,50 @@ void lclSetExpValueOrClearAny( Any& rAny, double fValue, bool bLogScale, bool bC lclSetValueOrClearAny( rAny, fValue, bClear ); } +double lclGetSerialDay( const XclImpRoot& rRoot, sal_uInt16 nValue, sal_uInt16 nTimeUnit ) +{ + switch( nTimeUnit ) + { + case EXC_CHDATERANGE_DAYS: + return nValue; + case EXC_CHDATERANGE_MONTHS: + return rRoot.GetDoubleFromDateTime( Date( 1, static_cast< sal_uInt16 >( 1 + nValue % 12 ), static_cast< sal_uInt16 >( rRoot.GetBaseYear() + nValue / 12 ) ) ); + case EXC_CHDATERANGE_YEARS: + return rRoot.GetDoubleFromDateTime( Date( 1, 1, static_cast< sal_uInt16 >( rRoot.GetBaseYear() + nValue ) ) ); + default: + OSL_ENSURE( false, "lclGetSerialDay - unexpected time unit" ); + } + return nValue; +} + +void lclConvertTimeValue( const XclImpRoot& rRoot, Any& rAny, sal_uInt16 nValue, bool bAuto, sal_uInt16 nTimeUnit ) +{ + if( bAuto ) + rAny.clear(); + else + rAny <<= lclGetSerialDay( rRoot, nValue, nTimeUnit ); +} + +sal_Int32 lclGetApiTimeUnit( sal_uInt16 nTimeUnit ) +{ + switch( nTimeUnit ) + { + case EXC_CHDATERANGE_DAYS: return cssc::TimeUnit::DAY; + case EXC_CHDATERANGE_MONTHS: return cssc::TimeUnit::MONTH; + case EXC_CHDATERANGE_YEARS: return cssc::TimeUnit::YEAR; + default: OSL_ENSURE( false, "lclGetApiTimeUnit - unexpected time unit" ); + } + return cssc::TimeUnit::DAY; +} + +void lclConvertTimeInterval( Any& rInterval, sal_uInt16 nValue, bool bAuto, sal_uInt16 nTimeUnit ) +{ + if( bAuto || (nValue == 0) ) + rInterval.clear(); + else + rInterval <<= cssc::TimeInterval( nValue, lclGetApiTimeUnit( nTimeUnit ) ); +} + } // namespace // Common ===================================================================== @@ -296,14 +343,24 @@ sal_Int32 XclImpChRoot::CalcHmmFromChartY( sal_Int32 nPosY ) const CalcHmmFromChartY( rRect.mnHeight ) ); } +double XclImpChRoot::CalcRelativeFromHmmX( sal_Int32 nPosX ) const +{ + return static_cast< double >( nPosX ) / mxChData->maChartRect.GetWidth(); +} + +double XclImpChRoot::CalcRelativeFromHmmY( sal_Int32 nPosY ) const +{ + return static_cast< double >( nPosY ) / mxChData->maChartRect.GetHeight(); +} + double XclImpChRoot::CalcRelativeFromChartX( sal_Int32 nPosX ) const { - return static_cast< double >( CalcHmmFromChartX( nPosX ) ) / mxChData->maChartRect.GetWidth(); + return CalcRelativeFromHmmX( CalcHmmFromChartX( nPosX ) ); } double XclImpChRoot::CalcRelativeFromChartY( sal_Int32 nPosY ) const { - return static_cast< double >( CalcHmmFromChartY( nPosY ) ) / mxChData->maChartRect.GetHeight(); + return CalcRelativeFromHmmY( CalcHmmFromChartY( nPosY ) ); } void XclImpChRoot::ConvertLineFormat( ScfPropertySet& rPropSet, @@ -2460,18 +2517,30 @@ Reference< XLegend > XclImpChLegend::CreateLegend() const manual mode, if the legend is moved or resized). With manual plot areas, Excel ignores the value in maData.mnDockMode completely. */ cssc2::LegendPosition eApiPos = cssc2::LegendPosition_CUSTOM; - cssc2::LegendExpansion eApiExpand = cssc2::LegendExpansion_BALANCED; + cssc::ChartLegendExpansion eApiExpand = cssc::ChartLegendExpansion_CUSTOM; if( !GetChartData().IsManualPlotArea() ) switch( maData.mnDockMode ) { - case EXC_CHLEGEND_LEFT: eApiPos = cssc2::LegendPosition_LINE_START; eApiExpand = cssc2::LegendExpansion_HIGH; break; - case EXC_CHLEGEND_RIGHT: eApiPos = cssc2::LegendPosition_LINE_END; eApiExpand = cssc2::LegendExpansion_HIGH; break; - case EXC_CHLEGEND_TOP: eApiPos = cssc2::LegendPosition_PAGE_START; eApiExpand = cssc2::LegendExpansion_WIDE; break; - case EXC_CHLEGEND_BOTTOM: eApiPos = cssc2::LegendPosition_PAGE_END; eApiExpand = cssc2::LegendExpansion_WIDE; break; + case EXC_CHLEGEND_LEFT: + eApiPos = cssc2::LegendPosition_LINE_START; + eApiExpand = cssc::ChartLegendExpansion_HIGH; + break; + case EXC_CHLEGEND_RIGHT: // top-right not supported - case EXC_CHLEGEND_CORNER: eApiPos = cssc2::LegendPosition_LINE_END; eApiExpand = cssc2::LegendExpansion_HIGH; break; + case EXC_CHLEGEND_CORNER: + eApiPos = cssc2::LegendPosition_LINE_END; + eApiExpand = cssc::ChartLegendExpansion_HIGH; + break; + case EXC_CHLEGEND_TOP: + eApiPos = cssc2::LegendPosition_PAGE_START; + eApiExpand = cssc::ChartLegendExpansion_WIDE; + break; + case EXC_CHLEGEND_BOTTOM: + eApiPos = cssc2::LegendPosition_PAGE_END; + eApiExpand = cssc::ChartLegendExpansion_WIDE; + break; } - // no automatic position: try to find the correct position and size + // no automatic position/size: try to find the correct position and size if( eApiPos == cssc2::LegendPosition_CUSTOM ) { const XclChFramePos* pFramePos = mxFramePos ? &mxFramePos->GetFramePosData() : 0; @@ -2481,38 +2550,35 @@ Reference< XLegend > XclImpChLegend::CreateLegend() const ignored. */ if( pFramePos ) { - RelativePosition aRelPos; - aRelPos.Primary = CalcRelativeFromChartX( pFramePos->maRect.mnX ); - aRelPos.Secondary = CalcRelativeFromChartY( pFramePos->maRect.mnY ); - aRelPos.Anchor = ::com::sun::star::drawing::Alignment_TOP_LEFT; + RelativePosition aRelPos( + CalcRelativeFromChartX( pFramePos->maRect.mnX ), + CalcRelativeFromChartY( pFramePos->maRect.mnY ), + ::com::sun::star::drawing::Alignment_TOP_LEFT ); aLegendProp.SetProperty( EXC_CHPROP_RELATIVEPOSITION, aRelPos ); } else { - // no manual position found, just go for the default + // no manual position/size found, just go for the default eApiPos = cssc2::LegendPosition_LINE_END; } - - /* Legend size. #i71697# It is not possible to set the legend size - directly in the Chart, do some magic here. */ - if( !pFramePos || (pFramePos->mnBRMode != EXC_CHFRAMEPOS_ABSSIZE_POINTS) || - (pFramePos->maRect.mnWidth == 0) || (pFramePos->maRect.mnHeight == 0) ) + /* Legend size. The member mnBRMode specifies whether size is + automatic or changes manually. Manual size is given in points, + not in chart units. */ + if( pFramePos && (pFramePos->mnBRMode == EXC_CHFRAMEPOS_ABSSIZE_POINTS) && + (pFramePos->maRect.mnWidth > 0) && (pFramePos->maRect.mnHeight > 0) ) { - // automatic size: determine entry direction from flags - eApiExpand = ::get_flagvalue( maData.mnFlags, EXC_CHLEGEND_STACKED, - cssc2::LegendExpansion_HIGH, cssc2::LegendExpansion_WIDE ); + eApiExpand = cssc::ChartLegendExpansion_CUSTOM; + sal_Int32 nWidthHmm = static_cast< sal_Int32 >( pFramePos->maRect.mnWidth / EXC_POINTS_PER_HMM ); + sal_Int32 nHeightHmm = static_cast< sal_Int32 >( pFramePos->maRect.mnHeight / EXC_POINTS_PER_HMM ); + RelativeSize aRelSize( CalcRelativeFromHmmX( nWidthHmm ), CalcRelativeFromHmmY( nHeightHmm ) ); + aLegendProp.SetProperty( EXC_CHPROP_RELATIVESIZE, aRelSize ); } else { - // legend size is given in points, not in chart units - double fRatio = static_cast< double >( pFramePos->maRect.mnWidth ) / pFramePos->maRect.mnHeight; - if( fRatio > 1.5 ) - eApiExpand = cssc2::LegendExpansion_WIDE; - else if( fRatio < 0.75 ) - eApiExpand = cssc2::LegendExpansion_HIGH; - else - eApiExpand = cssc2::LegendExpansion_BALANCED; + // automatic size: determine entry direction from flags + eApiExpand = ::get_flagvalue( maData.mnFlags, EXC_CHLEGEND_STACKED, + cssc::ChartLegendExpansion_HIGH, cssc::ChartLegendExpansion_WIDE ); } } aLegendProp.SetProperty( EXC_CHPROP_ANCHORPOSITION, eApiPos ); @@ -2866,20 +2932,60 @@ XclImpChLabelRange::XclImpChLabelRange( const XclImpChRoot& rRoot ) : void XclImpChLabelRange::ReadChLabelRange( XclImpStream& rStrm ) { - rStrm >> maData.mnCross >> maData.mnLabelFreq >> maData.mnTickFreq >> maData.mnFlags; + rStrm >> maLabelData.mnCross >> maLabelData.mnLabelFreq >> maLabelData.mnTickFreq >> maLabelData.mnFlags; +} + +void XclImpChLabelRange::ReadChDateRange( XclImpStream& rStrm ) +{ + rStrm >> maDateData.mnMinDate + >> maDateData.mnMaxDate + >> maDateData.mnMajorStep + >> maDateData.mnMajorUnit + >> maDateData.mnMinorStep + >> maDateData.mnMinorUnit + >> maDateData.mnBaseUnit + >> maDateData.mnCross + >> maDateData.mnFlags; } void XclImpChLabelRange::Convert( ScfPropertySet& rPropSet, ScaleData& rScaleData, bool bMirrorOrient ) const { - // do not overlap text unless all labels are visible - rPropSet.SetBoolProperty( EXC_CHPROP_TEXTOVERLAP, maData.mnLabelFreq == 1 ); - // do not break text into several lines unless all labels are visible - rPropSet.SetBoolProperty( EXC_CHPROP_TEXTBREAK, maData.mnLabelFreq == 1 ); - // do not stagger labels in two lines - rPropSet.SetProperty( EXC_CHPROP_ARRANGEORDER, cssc::ChartAxisArrangeOrderType_SIDE_BY_SIDE ); + // automatic axis type detection + rScaleData.AutoDateAxis = ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTODATE ); + + // the flag EXC_CHDATERANGE_DATEAXIS specifies whether this is a date axis + if( ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS ) ) + { + /* Chart2 requires axis type CATEGORY for automatic category/date axis + (even if it is a date axis currently). */ + rScaleData.AxisType = rScaleData.AutoDateAxis ? cssc2::AxisType::CATEGORY : cssc2::AxisType::DATE; + rScaleData.Scaling.set( ScfApiHelper::CreateInstance( SERVICE_CHART2_LINEARSCALING ), UNO_QUERY ); + /* Min/max values depend on base time unit, they specify the number of + days, months, or years starting from null date. */ + lclConvertTimeValue( GetRoot(), rScaleData.Minimum, maDateData.mnMinDate, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMIN ), maDateData.mnBaseUnit ); + lclConvertTimeValue( GetRoot(), rScaleData.Maximum, maDateData.mnMaxDate, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAX ), maDateData.mnBaseUnit ); + // increment + cssc::TimeIncrement& rTimeIncrement = rScaleData.TimeIncrement; + lclConvertTimeInterval( rTimeIncrement.MajorTimeInterval, maDateData.mnMajorStep, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMAJOR ), maDateData.mnMajorUnit ); + lclConvertTimeInterval( rTimeIncrement.MinorTimeInterval, maDateData.mnMinorStep, ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOMINOR ), maDateData.mnMinorUnit ); + // base unit + if( ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOBASE ) ) + rTimeIncrement.TimeResolution.clear(); + else + rTimeIncrement.TimeResolution <<= lclGetApiTimeUnit( maDateData.mnBaseUnit ); + } + else + { + // do not overlap text unless all labels are visible + rPropSet.SetBoolProperty( EXC_CHPROP_TEXTOVERLAP, maLabelData.mnLabelFreq == 1 ); + // do not break text into several lines unless all labels are visible + rPropSet.SetBoolProperty( EXC_CHPROP_TEXTBREAK, maLabelData.mnLabelFreq == 1 ); + // do not stagger labels in two lines + rPropSet.SetProperty( EXC_CHPROP_ARRANGEORDER, cssc::ChartAxisArrangeOrderType_SIDE_BY_SIDE ); + } // reverse order - bool bReverse = ::get_flag( maData.mnFlags, EXC_CHLABELRANGE_REVERSE ) != bMirrorOrient; + bool bReverse = ::get_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_REVERSE ) != bMirrorOrient; rScaleData.Orientation = bReverse ? cssc2::AxisOrientation_REVERSE : cssc2::AxisOrientation_MATHEMATICAL; //! TODO #i58731# show n-th category @@ -2891,13 +2997,29 @@ void XclImpChLabelRange::ConvertAxisPosition( ScfPropertySet& rPropSet, bool b3d does not move the Y axis in 3D charts, regardless of actual settings. But: the Y axis has to be moved to "end", if the X axis is mirrored, to keep it at the left end of the chart. */ - bool bMaxCross = ::get_flag( maData.mnFlags, b3dChart ? EXC_CHLABELRANGE_REVERSE : EXC_CHLABELRANGE_MAXCROSS ); + bool bMaxCross = ::get_flag( maLabelData.mnFlags, b3dChart ? EXC_CHLABELRANGE_REVERSE : EXC_CHLABELRANGE_MAXCROSS ); cssc::ChartAxisPosition eAxisPos = bMaxCross ? cssc::ChartAxisPosition_END : cssc::ChartAxisPosition_VALUE; rPropSet.SetProperty( EXC_CHPROP_CROSSOVERPOSITION, eAxisPos ); - // crossing position - double fCrossingPos = b3dChart ? 1.0 : maData.mnCross; - rPropSet.SetProperty( EXC_CHPROP_CROSSOVERVALUE, fCrossingPos ); + // crossing position (depending on axis type text/date) + if( ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_DATEAXIS ) ) + { + bool bAutoCross = ::get_flag( maDateData.mnFlags, EXC_CHDATERANGE_AUTOCROSS ); + /* Crossing position value depends on base time unit, it specifies the + number of days, months, or years from null date. Note that Excel + 2007/2010 write broken BIFF8 files, they always stores the number + of days cregardless of the base time unit (and they are reading it + the same way, thus wrongly displaying files written by Excel + 97-2003). This filter sticks to the correct behaviour of Excel + 97-2003. */ + double fCrossingPos = bAutoCross ? 1.0 : lclGetSerialDay( GetRoot(), maDateData.mnCross, maDateData.mnBaseUnit ); + rPropSet.SetProperty( EXC_CHPROP_CROSSOVERVALUE, fCrossingPos ); + } + else + { + double fCrossingPos = b3dChart ? 1.0 : maLabelData.mnCross; + rPropSet.SetProperty( EXC_CHPROP_CROSSOVERVALUE, fCrossingPos ); + } } // ---------------------------------------------------------------------------- @@ -2938,6 +3060,7 @@ void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) co Sequence< SubIncrement >& rSubIncrementSeq = rIncrementData.SubIncrements; rSubIncrementSeq.realloc( 1 ); Any& rIntervalCount = rSubIncrementSeq[ 0 ].IntervalCount; + rIntervalCount.clear(); if( bLogScale ) { if( !bAutoMinor ) @@ -2945,14 +3068,12 @@ void XclImpChValueRange::Convert( ScaleData& rScaleData, bool bMirrorOrient ) co } else { - sal_Int32 nCount = 0; if( !bAutoMajor && !bAutoMinor && (0.0 < maData.mfMinorStep) && (maData.mfMinorStep <= maData.mfMajorStep) ) { double fCount = maData.mfMajorStep / maData.mfMinorStep + 0.5; - if( fCount < 1001.0 ) - nCount = static_cast< sal_Int32 >( fCount ); + if( (1.0 <= fCount) && (fCount < 1001.0) ) + rIntervalCount <<= static_cast< sal_Int32 >( fCount ); } - lclSetValueOrClearAny( rIntervalCount, nCount, nCount == 0 ); } // reverse order @@ -3073,6 +3194,11 @@ void XclImpChAxis::ReadSubRecord( XclImpStream& rStrm ) mxLabelRange.reset( new XclImpChLabelRange( GetChRoot() ) ); mxLabelRange->ReadChLabelRange( rStrm ); break; + case EXC_ID_CHDATERANGE: + if( !mxLabelRange ) + mxLabelRange.reset( new XclImpChLabelRange( GetChRoot() ) ); + mxLabelRange->ReadChDateRange( rStrm ); + break; case EXC_ID_CHVALUERANGE: mxValueRange.reset( new XclImpChValueRange( GetChRoot() ) ); mxValueRange->ReadChValueRange( rStrm ); diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 1d5323645650..40a3e7ab9d23 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -626,7 +626,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) if( !mxScCondFmt.get() ) { - ULONG nKey = 0; + sal_uLong nKey = 0; mxScCondFmt.reset( new ScConditionalFormat( nKey, GetDocPtr() ) ); } @@ -641,7 +641,7 @@ void XclImpCondFormat::Apply() { ScDocument& rDoc = GetDoc(); - ULONG nKey = rDoc.AddCondFormat( *mxScCondFmt ); + sal_uLong nKey = rDoc.AddCondFormat( *mxScCondFmt ); ScPatternAttr aPattern( rDoc.GetPool() ); aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nKey ) ); @@ -863,7 +863,7 @@ void XclImpValidationManager::Apply() { DVItem& rItem = *itr; // set the handle ID - ULONG nHandle = rDoc.AddValidationEntry( rItem.maValidData ); + sal_uLong nHandle = rDoc.AddValidationEntry( rItem.maValidData ); ScPatternAttr aPattern( rDoc.GetPool() ); aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nHandle ) ); @@ -931,14 +931,13 @@ void XclImpWebQuery::ReadWqtables( XclImpStream& rStrm ) String aTables( rStrm.ReadUniString() ); const sal_Unicode cSep = ';'; - aTables.SearchAndReplaceAll( ',', cSep ); String aQuotedPairs( RTL_CONSTASCII_USTRINGPARAM( "\"\"" ) ); - xub_StrLen nTokenCnt = aTables.GetQuotedTokenCount( aQuotedPairs, cSep ); + xub_StrLen nTokenCnt = aTables.GetQuotedTokenCount( aQuotedPairs, ',' ); maTables.Erase(); xub_StrLen nStringIx = 0; for( xub_StrLen nToken = 0; nToken < nTokenCnt; ++nToken ) { - String aToken( aTables.GetQuotedToken( 0, aQuotedPairs, cSep, nStringIx ) ); + String aToken( aTables.GetQuotedToken( 0, aQuotedPairs, ',', nStringIx ) ); sal_Int32 nTabNum = CharClass::isAsciiNumeric( aToken ) ? aToken.ToInt32() : 0; if( nTabNum > 0 ) ScGlobal::AddToken( maTables, ScfTools::GetNameFromHTMLIndex( static_cast< sal_uInt32 >( nTabNum ) ), cSep ); diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index fa0f1dab8b2e..3039fba3b81e 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -481,7 +481,7 @@ void XclImpDrawObjBase::PreProcessSdrObject( XclImpDffConverter& rDffConv, SdrOb if( (maMacroName.Len() > 0 ) || (maHyperlink.Len() > 0) ) { - if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( &rSdrObj, TRUE ) ) + if( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( &rSdrObj, sal_True ) ) { pInfo->SetMacro( XclTools::GetSbMacroUrl( maMacroName, GetDocShell() ) ); pInfo->SetHlink( maHyperlink ); @@ -570,9 +570,9 @@ void XclImpDrawObjBase::ConvertLineStyle( SdrObject& rSdrObj, const XclObjLineDa rSdrObj.SetMergedItem( XLineColorItem( EMPTY_STRING, GetPalette().GetColor( rLineData.mnColorIdx ) ) ); rSdrObj.SetMergedItem( XLineJointItem( XLINEJOINT_MITER ) ); - ULONG nDotLen = ::std::max< ULONG >( 70 * rLineData.mnWidth, 35 ); - ULONG nDashLen = 3 * nDotLen; - ULONG nDist = 2 * nDotLen; + sal_uLong nDotLen = ::std::max< sal_uLong >( 70 * rLineData.mnWidth, 35 ); + sal_uLong nDashLen = 3 * nDotLen; + sal_uLong nDist = 2 * nDotLen; switch( rLineData.mnStyle ) { @@ -668,7 +668,7 @@ void XclImpDrawObjBase::ConvertFillStyle( SdrObject& rSdrObj, const XclObjFillDa aMemStrm << sal_uInt32( pnPattern[ nIdx ] ); // 32-bit little-endian aMemStrm.Seek( STREAM_SEEK_TO_BEGIN ); Bitmap aBitmap; - aBitmap.Read( aMemStrm, FALSE ); + aBitmap.Read( aMemStrm, false ); XOBitmap aXOBitmap( aBitmap ); aXOBitmap.Bitmap2Array(); aXOBitmap.SetBitmapType( XBITMAP_8X8 ); @@ -686,7 +686,7 @@ void XclImpDrawObjBase::ConvertFrameStyle( SdrObject& rSdrObj, sal_uInt16 nFrame { if( ::get_flag( nFrameFlags, EXC_OBJ_FRAME_SHADOW ) ) { - rSdrObj.SetMergedItem( SdrShadowItem( TRUE ) ); + rSdrObj.SetMergedItem( SdrShadowItem( sal_True ) ); rSdrObj.SetMergedItem( SdrShadowXDistItem( 35 ) ); rSdrObj.SetMergedItem( SdrShadowYDistItem( 35 ) ); rSdrObj.SetMergedItem( SdrShadowColorItem( EMPTY_STRING, GetPalette().GetColor( EXC_COLOR_WINDOWTEXT ) ) ); @@ -1082,13 +1082,13 @@ SdrObject* XclImpLineObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const Re { xSdrObj->SetMergedItem( XLineStartItem( EMPTY_STRING, aArrowPolyPoly ) ); xSdrObj->SetMergedItem( XLineStartWidthItem( nWidth ) ); - xSdrObj->SetMergedItem( XLineStartCenterItem( FALSE ) ); + xSdrObj->SetMergedItem( XLineStartCenterItem( false ) ); } if( bLineEnd ) { xSdrObj->SetMergedItem( XLineEndItem( EMPTY_STRING, aArrowPolyPoly ) ); xSdrObj->SetMergedItem( XLineEndWidthItem( nWidth ) ); - xSdrObj->SetMergedItem( XLineEndCenterItem( FALSE ) ); + xSdrObj->SetMergedItem( XLineEndCenterItem( false ) ); } } rDffConv.Progress(); @@ -1373,10 +1373,10 @@ SdrObject* XclImpTextObj::DoCreateSdrObj( XclImpDffConverter& rDffConv, const Re OUString aRectType = CREATE_OUSTRING( "rectangle" ); xSdrObj->MergeDefaultAttributes( &aRectType ); ConvertRectStyle( *xSdrObj ); - BOOL bAutoSize = ::get_flag( maTextData.maData.mnFlags, EXC_OBJ_TEXT_AUTOSIZE ); + sal_Bool bAutoSize = ::get_flag( maTextData.maData.mnFlags, EXC_OBJ_TEXT_AUTOSIZE ); xSdrObj->SetMergedItem( SdrTextAutoGrowWidthItem( bAutoSize ) ); xSdrObj->SetMergedItem( SdrTextAutoGrowHeightItem( bAutoSize ) ); - xSdrObj->SetMergedItem( SdrTextWordWrapItem( TRUE ) ); + xSdrObj->SetMergedItem( SdrTextWordWrapItem( sal_True ) ); rDffConv.Progress(); return xSdrObj.release(); } @@ -3129,7 +3129,7 @@ XclImpSimpleDffConverter::~XclImpSimpleDffConverter() { } -bool XclImpSimpleDffConverter::GetColorFromPalette( USHORT nIndex, Color& rColor ) const +bool XclImpSimpleDffConverter::GetColorFromPalette( sal_uInt16 nIndex, Color& rColor ) const { ColorData nColor = GetPalette().GetColorData( static_cast< sal_uInt16 >( nIndex ) ); @@ -3285,7 +3285,7 @@ SdrObject* XclImpDffConverter::CreateSdrObject( const XclImpTbxObjBase& rTbxObj, ::com::sun::star::awt::Size aDummySize; Reference< XShape > xShape; XclImpDffConvData& rConvData = GetConvData(); - if( rConvData.mxCtrlForm.is() && InsertControl( xFormComp, aDummySize, &xShape, TRUE ) ) + if( rConvData.mxCtrlForm.is() && InsertControl( xFormComp, aDummySize, &xShape, sal_True ) ) { xSdrObj.reset( rTbxObj.CreateSdrObjectFromShape( xShape, rAnchorRect ) ); // try to attach a macro to the control @@ -3321,7 +3321,7 @@ SdrObject* XclImpDffConverter::CreateSdrObject( const XclImpPictureObj& rPicObj, mxCtlsStrm->Seek( rPicObj.GetCtlsStreamPos() ); // read from mxCtlsStrm into xShape, insert the control model into the form Reference< XShape > xShape; - if( GetConvData().mxCtrlForm.is() && ReadOCXExcelKludgeStream( mxCtlsStrm, &xShape, TRUE ) ) + if( GetConvData().mxCtrlForm.is() && ReadOCXExcelKludgeStream( mxCtlsStrm, &xShape, sal_True ) ) xSdrObj.reset( rPicObj.CreateSdrObjectFromShape( xShape, rAnchorRect ) ); } catch( Exception& ) @@ -3485,14 +3485,14 @@ SdrObject* XclImpDffConverter::ProcessObj( SvStream& rDffStrm, DffObjData& rDffO return xSdrObj.release(); } -ULONG XclImpDffConverter::Calc_nBLIPPos( ULONG /*nOrgVal*/, ULONG nStreamPos ) const +sal_uLong XclImpDffConverter::Calc_nBLIPPos( sal_uLong /*nOrgVal*/, sal_uLong nStreamPos ) const { return nStreamPos + 4; } sal_Bool XclImpDffConverter::InsertControl( const Reference< XFormComponent >& rxFormComp, const ::com::sun::star::awt::Size& /*rSize*/, Reference< XShape >* pxShape, - BOOL /*bFloatingCtrl*/ ) + sal_Bool /*bFloatingCtrl*/ ) { if( GetDocShell() ) try { @@ -3520,7 +3520,7 @@ sal_Bool XclImpDffConverter::InsertControl( const Reference< XFormComponent >& r DBG_ERRORFILE( "XclImpDffConverter::InsertControl - cannot create form control" ); } - return sal_False; + return false; } // private -------------------------------------------------------------------- @@ -3917,7 +3917,7 @@ void XclImpDrawing::ReadBmp( Graphic& rGraphic, const XclImpRoot& rRoot, XclImpS // import the graphic from memory stream aMemStrm.Seek( STREAM_SEEK_TO_BEGIN ); Bitmap aBitmap; - if( aBitmap.Read( aMemStrm, FALSE ) ) // read DIB without file header + if( aBitmap.Read( aMemStrm, false ) ) // read DIB without file header rGraphic = aBitmap; } diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index f0bd8425d661..34a02e028070 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -811,7 +811,7 @@ XclImpCachedValue::~XclImpCachedValue() { } -USHORT XclImpCachedValue::GetScError() const +sal_uInt16 XclImpCachedValue::GetScError() const { return (mnType == EXC_CACHEDVAL_ERROR) ? XclTools::GetScErrorCode( mnBoolErr ) : 0; } @@ -851,7 +851,7 @@ ScMatrixRef XclImpCachedMatrix::CreateScMatrix() const { ScMatrixRef xScMatrix; DBG_ASSERT( mnScCols * mnScRows == maValueList.size(), "XclImpCachedMatrix::CreateScMatrix - element count mismatch" ); - if( mnScCols && mnScRows && static_cast< ULONG >( mnScCols * mnScRows ) <= maValueList.size() ) + if( mnScCols && mnScRows && static_cast< sal_uLong >( mnScCols * mnScRows ) <= maValueList.size() ) { xScMatrix = new ScMatrix( mnScCols, mnScRows ); XclImpValueList::const_iterator itValue = maValueList.begin(); diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx index 03a49acfc787..b5eba95c6755 100644 --- a/sc/source/filter/excel/xiname.cxx +++ b/sc/source/filter/excel/xiname.cxx @@ -255,7 +255,7 @@ XclImpNameManager::XclImpNameManager( const XclImpRoot& rRoot ) : void XclImpNameManager::ReadName( XclImpStream& rStrm ) { - ULONG nCount = maNameList.size(); + sal_uLong nCount = maNameList.size(); if( nCount < 0xFFFF ) maNameList.push_back( new XclImpName( rStrm, static_cast< sal_uInt16 >( nCount + 1 ) ) ); } diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx index bcdf78f588f7..b6ba93124e0e 100644 --- a/sc/source/filter/excel/xipivot.cxx +++ b/sc/source/filter/excel/xipivot.cxx @@ -498,7 +498,7 @@ ScDPNumGroupInfo XclImpPCField::GetScNumGroupInfo() const { ScDPNumGroupInfo aNumInfo; aNumInfo.Enable = sal_True; - aNumInfo.DateValues = sal_False; + aNumInfo.DateValues = false; aNumInfo.AutoStart = sal_True; aNumInfo.AutoEnd = sal_True; @@ -522,7 +522,7 @@ ScDPNumGroupInfo XclImpPCField::GetScDateGroupInfo() const { ScDPNumGroupInfo aDateInfo; aDateInfo.Enable = sal_True; - aDateInfo.DateValues = sal_False; + aDateInfo.DateValues = false; aDateInfo.AutoStart = sal_True; aDateInfo.AutoEnd = sal_True; @@ -982,7 +982,7 @@ void XclImpPTField::ConvertRowColField( ScDPSaveData& rSaveData ) const DBG_ASSERT( maFieldInfo.mnAxes & EXC_SXVD_AXIS_ROWCOL, "XclImpPTField::ConvertRowColField - no row/column field" ); // special data orientation field? if( maFieldInfo.mnCacheIdx == EXC_SXIVD_DATA ) - rSaveData.GetDataLayoutDimension()->SetOrientation( static_cast< USHORT >( maFieldInfo.GetApiOrient( EXC_SXVD_AXIS_ROWCOL ) ) ); + rSaveData.GetDataLayoutDimension()->SetOrientation( static_cast< sal_uInt16 >( maFieldInfo.GetApiOrient( EXC_SXVD_AXIS_ROWCOL ) ) ); else ConvertRCPField( rSaveData ); } @@ -1086,7 +1086,7 @@ ScDPSaveDimension* XclImpPTField::ConvertRCPField( ScDPSaveData& rSaveData ) con ScDPSaveDimension& rSaveDim = *rSaveData.GetNewDimensionByName( rFieldName ); // orientation - rSaveDim.SetOrientation( static_cast< USHORT >( maFieldInfo.GetApiOrient( EXC_SXVD_AXIS_ROWCOLPAGE ) ) ); + rSaveDim.SetOrientation( static_cast< sal_uInt16 >( maFieldInfo.GetApiOrient( EXC_SXVD_AXIS_ROWCOLPAGE ) ) ); // general field info ConvertFieldInfo( rSaveDim ); @@ -1160,7 +1160,7 @@ void XclImpPTField::ConvertDataFieldInfo( ScDPSaveDimension& rSaveDim, const Xcl rSaveDim.SetLayoutName( *pVisName ); // aggregation function - rSaveDim.SetFunction( static_cast< USHORT >( rDataInfo.GetApiAggFunc() ) ); + rSaveDim.SetFunction( static_cast< sal_uInt16 >( rDataInfo.GetApiAggFunc() ) ); // result field reference sal_Int32 nRefType = rDataInfo.GetApiRefType(); @@ -1366,7 +1366,7 @@ void XclImpPivotTable::Convert() aSaveData.SetRowGrand( ::get_flag( maPTInfo.mnFlags, EXC_SXVIEW_ROWGRAND ) ); aSaveData.SetColumnGrand( ::get_flag( maPTInfo.mnFlags, EXC_SXVIEW_COLGRAND ) ); - aSaveData.SetFilterButton( FALSE ); + aSaveData.SetFilterButton( false ); aSaveData.SetDrillDown( ::get_flag( maPTExtInfo.mnFlags, EXC_SXEX_DRILLDOWN ) ); // *** fields *** @@ -1435,7 +1435,7 @@ void XclImpPivotTable::Convert() pDPObj->SetSaveData( aSaveData ); pDPObj->SetSheetDesc( aDesc ); pDPObj->SetOutRange( aOutRange ); - pDPObj->SetAlive( TRUE ); + pDPObj->SetAlive( sal_True ); pDPObj->SetHeaderLayout( maPTViewEx9Info.mnGridLayout == 0 ); GetDoc().GetDPCollection()->InsertNewTable(pDPObj); diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index e0af805fa09a..9a4bcfb43d10 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -29,6 +29,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sc.hxx" +#include <comphelper/docpasswordhelper.hxx> +#include <comphelper/sequenceashashmap.hxx> + #include "xistream.hxx" #include "xlstring.hxx" #include "xiroot.hxx" @@ -39,6 +42,8 @@ using ::rtl::OString; using ::rtl::OUString; using ::rtl::OUStringToOString; +using namespace ::com::sun::star; + // ============================================================================ // Decryption // ============================================================================ @@ -70,9 +75,16 @@ XclImpDecrypterRef XclImpDecrypter::Clone() const return xNewDecr; } -::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyPassword( const OUString& rPassword ) +::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyPassword( const ::rtl::OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData ) +{ + o_rEncryptionData = OnVerifyPassword( rPassword ); + mnError = o_rEncryptionData.getLength() ? ERRCODE_NONE : ERRCODE_ABORT; + return o_rEncryptionData.getLength() ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; +} + +::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) { - bool bValid = OnVerify( rPassword ); + bool bValid = OnVerifyEncryptionData( rEncryptionData ); mnError = bValid ? ERRCODE_NONE : ERRCODE_ABORT; return bValid ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD; } @@ -111,7 +123,6 @@ sal_uInt16 XclImpDecrypter::Read( SvStream& rStrm, void* pData, sal_uInt16 nByte // ---------------------------------------------------------------------------- XclImpBiff5Decrypter::XclImpBiff5Decrypter( sal_uInt16 nKey, sal_uInt16 nHash ) : - maPassword( 16 ), mnKey( nKey ), mnHash( nHash ) { @@ -119,12 +130,12 @@ XclImpBiff5Decrypter::XclImpBiff5Decrypter( sal_uInt16 nKey, sal_uInt16 nHash ) XclImpBiff5Decrypter::XclImpBiff5Decrypter( const XclImpBiff5Decrypter& rSrc ) : XclImpDecrypter( rSrc ), - maPassword( rSrc.maPassword ), + maEncryptionData( rSrc.maEncryptionData ), mnKey( rSrc.mnKey ), mnHash( rSrc.mnHash ) { if( IsValid() ) - maCodec.InitKey( &maPassword.front() ); + maCodec.InitCodec( maEncryptionData ); } XclImpBiff5Decrypter* XclImpBiff5Decrypter::OnClone() const @@ -132,24 +143,59 @@ XclImpBiff5Decrypter* XclImpBiff5Decrypter::OnClone() const return new XclImpBiff5Decrypter( *this ); } -bool XclImpBiff5Decrypter::OnVerify( const OUString& rPassword ) +uno::Sequence< beans::NamedValue > XclImpBiff5Decrypter::OnVerifyPassword( const ::rtl::OUString& rPassword ) { + maEncryptionData.realloc( 0 ); + /* 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) ) { - // copy byte string to sal_uInt8 array - maPassword.clear(); - maPassword.resize( 16, 0 ); - memcpy( &maPassword.front(), aBytePassword.getStr(), static_cast< size_t >( nLen ) ); + // init codec + maCodec.InitKey( (sal_uInt8*)aBytePassword.getStr() ); + + if ( maCodec.VerifyKey( mnKey, mnHash ) ) + { + maEncryptionData = maCodec.GetEncryptionData(); + + // since the export uses Std97 encryption always we have to request it here + ::std::vector< sal_uInt16 > aPassVect( 16 ); + ::std::vector< sal_uInt16 >::iterator aIt = aPassVect.begin(); + for( sal_Int32 nInd = 0; nInd < nLen; ++nInd, ++aIt ) + *aIt = static_cast< sal_uInt16 >( rPassword.getStr()[nInd] ); + + uno::Sequence< sal_Int8 > aDocId = ::comphelper::DocPasswordHelper::GenerateRandomByteSequence( 16 ); + OSL_ENSURE( aDocId.getLength() == 16, "Unexpected length of the senquence!" ); + + ::msfilter::MSCodec_Std97 aCodec97; + aCodec97.InitKey( &aPassVect.front(), (sal_uInt8*)aDocId.getConstArray() ); + + // merge the EncryptionData, there should be no conflicts + ::comphelper::SequenceAsHashMap aEncryptionHash( maEncryptionData ); + aEncryptionHash.update( ::comphelper::SequenceAsHashMap( aCodec97.GetEncryptionData() ) ); + aEncryptionHash >> maEncryptionData; + } + } + + return maEncryptionData; +} +bool XclImpBiff5Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) +{ + maEncryptionData.realloc( 0 ); + + if( rEncryptionData.getLength() ) + { // init codec - maCodec.InitKey( &maPassword.front() ); - return maCodec.VerifyKey( mnKey, mnHash ); + maCodec.InitCodec( rEncryptionData ); + + if ( maCodec.VerifyKey( mnKey, mnHash ) ) + maEncryptionData = rEncryptionData; } - return false; + + return maEncryptionData.getLength(); } void XclImpBiff5Decrypter::OnUpdate( sal_Size /*nOldStrmPos*/, sal_Size nNewStrmPos, sal_uInt16 nRecSize ) @@ -169,7 +215,6 @@ sal_uInt16 XclImpBiff5Decrypter::OnRead( SvStream& rStrm, sal_uInt8* pnData, sal 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 ) @@ -178,13 +223,13 @@ XclImpBiff8Decrypter::XclImpBiff8Decrypter( sal_uInt8 pnSalt[ 16 ], XclImpBiff8Decrypter::XclImpBiff8Decrypter( const XclImpBiff8Decrypter& rSrc ) : XclImpDecrypter( rSrc ), - maPassword( rSrc.maPassword ), + maEncryptionData( rSrc.maEncryptionData ), maSalt( rSrc.maSalt ), maVerifier( rSrc.maVerifier ), maVerifierHash( rSrc.maVerifierHash ) { if( IsValid() ) - maCodec.InitKey( &maPassword.front(), &maSalt.front() ); + maCodec.InitCodec( maEncryptionData ); } XclImpBiff8Decrypter* XclImpBiff8Decrypter::OnClone() const @@ -192,25 +237,44 @@ XclImpBiff8Decrypter* XclImpBiff8Decrypter::OnClone() const return new XclImpBiff8Decrypter( *this ); } -bool XclImpBiff8Decrypter::OnVerify( const OUString& rPassword ) +uno::Sequence< beans::NamedValue > XclImpBiff8Decrypter::OnVerifyPassword( const ::rtl::OUString& rPassword ) { + maEncryptionData.realloc( 0 ); + sal_Int32 nLen = rPassword.getLength(); if( (0 < nLen) && (nLen < 16) ) { // copy string to sal_uInt16 array - maPassword.clear(); - maPassword.resize( 16, 0 ); + ::std::vector< sal_uInt16 > aPassVect( 16 ); const sal_Unicode* pcChar = rPassword.getStr(); const sal_Unicode* pcCharEnd = pcChar + nLen; - ::std::vector< sal_uInt16 >::iterator aIt = maPassword.begin(); + ::std::vector< sal_uInt16 >::iterator aIt = aPassVect.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() ); + maCodec.InitKey( &aPassVect.front(), &maSalt.front() ); + if ( maCodec.VerifyKey( &maVerifier.front(), &maVerifierHash.front() ) ) + maEncryptionData = maCodec.GetEncryptionData(); + } + + return maEncryptionData; +} + +bool XclImpBiff8Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) +{ + maEncryptionData.realloc( 0 ); + + if( rEncryptionData.getLength() ) + { + // init codec + maCodec.InitCodec( rEncryptionData ); + + if ( maCodec.VerifyKey( &maVerifier.front(), &maVerifierHash.front() ) ) + maEncryptionData = rEncryptionData; } - return false; + + return maEncryptionData.getLength(); } void XclImpBiff8Decrypter::OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 /*nRecSize*/ ) diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index c3e6ae6b273a..290ce0eebdcf 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -157,6 +157,19 @@ ColorData XclImpPalette::GetColorData( sal_uInt16 nXclIndex ) const return GetDefColorData( nXclIndex ); } +::com::sun::star::uno::Sequence< sal_Int32 > XclImpPalette::CreateColorSequence() const +{ + sal_Int32 nCount = static_cast< sal_Int32 >( maColorTable.size() ); + ::com::sun::star::uno::Sequence< sal_Int32 > aSeq( nCount ); + if( nCount > 0 ) + { + sal_Int32* pnSeqColor = aSeq.getArray(); + for( ColorDataVec::const_iterator aIt = maColorTable.begin(), aEnd = maColorTable.end(); aIt != aEnd; ++aIt, ++pnSeqColor ) + *pnSeqColor = static_cast< sal_Int32 >( *aIt ); + } + return aSeq; +} + void XclImpPalette::ReadPalette( XclImpStream& rStrm ) { sal_uInt16 nCount; @@ -674,7 +687,7 @@ void XclImpNumFmtBuffer::CreateScFormats() } } -ULONG XclImpNumFmtBuffer::GetScFormat( sal_uInt16 nXclNumFmt ) const +sal_uLong XclImpNumFmtBuffer::GetScFormat( sal_uInt16 nXclNumFmt ) const { XclImpIndexMap::const_iterator aIt = maIndexMap.find( nXclNumFmt ); return (aIt != maIndexMap.end()) ? aIt->second : NUMBERFORMAT_ENTRY_NOT_FOUND; @@ -682,17 +695,17 @@ ULONG XclImpNumFmtBuffer::GetScFormat( sal_uInt16 nXclNumFmt ) const void XclImpNumFmtBuffer::FillToItemSet( SfxItemSet& rItemSet, sal_uInt16 nXclNumFmt, bool bSkipPoolDefs ) const { - ULONG nScNumFmt = GetScFormat( nXclNumFmt ); + sal_uLong nScNumFmt = GetScFormat( nXclNumFmt ); if( nScNumFmt == NUMBERFORMAT_ENTRY_NOT_FOUND ) nScNumFmt = GetStdScNumFmt(); FillScFmtToItemSet( rItemSet, nScNumFmt, bSkipPoolDefs ); } -void XclImpNumFmtBuffer::FillScFmtToItemSet( SfxItemSet& rItemSet, ULONG nScNumFmt, bool bSkipPoolDefs ) const +void XclImpNumFmtBuffer::FillScFmtToItemSet( SfxItemSet& rItemSet, sal_uLong nScNumFmt, bool bSkipPoolDefs ) const { DBG_ASSERT( nScNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND, "XclImpNumFmtBuffer::FillScFmtToItemSet - invalid number format" ); ScfTools::PutItem( rItemSet, SfxUInt32Item( ATTR_VALUE_FORMAT, nScNumFmt ), bSkipPoolDefs ); - if( rItemSet.GetItemState( ATTR_VALUE_FORMAT, FALSE ) == SFX_ITEM_SET ) + if( rItemSet.GetItemState( ATTR_VALUE_FORMAT, false ) == SFX_ITEM_SET ) ScGlobal::AddLanguage( rItemSet, GetFormatter() ); } @@ -1632,7 +1645,7 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex ) { XclImpXFRange* pPrevRange; XclImpXFRange* pNextRange; - ULONG nNextIndex; + sal_uLong nNextIndex; Find( pPrevRange, pNextRange, nNextIndex, nScRow ); @@ -1647,7 +1660,7 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex ) SCROW nFirstScRow = pPrevRange->mnScRow1; SCROW nLastScRow = pPrevRange->mnScRow2; - ULONG nIndex = nNextIndex - 1; + sal_uLong nIndex = nNextIndex - 1; XclImpXFRange* pThisRange = pPrevRange; pPrevRange = (nIndex > 0 && nIndex <= maIndexList.size()) ? &(maIndexList[ nIndex - 1 ]) : 0; @@ -1694,14 +1707,14 @@ void XclImpXFRangeColumn::SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex ) Insert( new XclImpXFRange( nScRow, rXFIndex ), nNextIndex ); } -void XclImpXFRangeColumn::Insert(XclImpXFRange* pXFRange, ULONG nIndex) +void XclImpXFRangeColumn::Insert(XclImpXFRange* pXFRange, sal_uLong nIndex) { maIndexList.insert( maIndexList.begin() + nIndex, pXFRange ); } void XclImpXFRangeColumn::Find( XclImpXFRange*& rpPrevRange, XclImpXFRange*& rpNextRange, - ULONG& rnNextIndex, SCROW nScRow ) + sal_uLong& rnNextIndex, SCROW nScRow ) { // test whether list is empty @@ -1737,8 +1750,8 @@ void XclImpXFRangeColumn::Find( // loop: find range entries before and after new row // break the loop if there is no more range between first and last -or- // if rpPrevRange contains nScRow (rpNextRange will never contain nScRow) - ULONG nPrevIndex = 0; - ULONG nMidIndex; + sal_uLong nPrevIndex = 0; + sal_uLong nMidIndex; rnNextIndex = maIndexList.size() - 1; XclImpXFRange* pMidRange; while( ((rnNextIndex - nPrevIndex) > 1) && (rpPrevRange->mnScRow2 < nScRow) ) @@ -1766,7 +1779,7 @@ void XclImpXFRangeColumn::Find( } } -void XclImpXFRangeColumn::TryConcatPrev( ULONG nIndex ) +void XclImpXFRangeColumn::TryConcatPrev( sal_uLong nIndex ) { if( !nIndex || nIndex >= maIndexList.size() ) return; @@ -1865,7 +1878,7 @@ void XclImpXFRangeBuffer::SetColumnDefXF( SCCOL nScCol, sal_uInt16 nXFIndex ) maColumns[ nIndex ]->SetDefaultXF( XclImpXFIndex( nXFIndex ) ); } -void XclImpXFRangeBuffer::SetBorderLine( const ScRange& rRange, SCTAB nScTab, USHORT nLine ) +void XclImpXFRangeBuffer::SetBorderLine( const ScRange& rRange, SCTAB nScTab, sal_uInt16 nLine ) { SCCOL nFromScCol = (nLine == BOX_LINE_RIGHT) ? rRange.aEnd.Col() : rRange.aStart.Col(); SCROW nFromScRow = (nLine == BOX_LINE_BOTTOM) ? rRange.aEnd.Row() : rRange.aStart.Row(); diff --git a/sc/source/filter/excel/xiview.cxx b/sc/source/filter/excel/xiview.cxx index 79bf333fcacd..1220b2afa0c6 100644 --- a/sc/source/filter/excel/xiview.cxx +++ b/sc/source/filter/excel/xiview.cxx @@ -227,8 +227,8 @@ void XclImpTabViewSettings::Finalize() // sheet flags if( maData.mbMirrored ) - // do not call this function with FALSE, it would mirror away all drawing objects - rDoc.SetLayoutRTL( nScTab, TRUE ); + // do not call this function with sal_False, it would mirror away all drawing objects + rDoc.SetLayoutRTL( nScTab, sal_True ); rTabSett.mbSelected = maData.mbSelected || bDisplayed; // first visible cell in top-left pane and in additional pane(s) diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx index 8fcace686292..033468998ea5 100644 --- a/sc/source/filter/excel/xlchart.cxx +++ b/sc/source/filter/excel/xlchart.cxx @@ -331,6 +331,24 @@ XclChLabelRange::XclChLabelRange() : // ---------------------------------------------------------------------------- +XclChDateRange::XclChDateRange() : + mnMinDate( 0 ), + mnMaxDate( 0 ), + mnMajorStep( 0 ), + mnMajorUnit( EXC_CHDATERANGE_DAYS ), + mnMinorStep( 0 ), + mnMinorUnit( EXC_CHDATERANGE_DAYS ), + mnBaseUnit( EXC_CHDATERANGE_DAYS ), + mnCross( 0 ), + mnFlags( EXC_CHDATERANGE_AUTOMIN | EXC_CHDATERANGE_AUTOMAX | + EXC_CHDATERANGE_AUTOMAJOR | EXC_CHDATERANGE_AUTOMINOR | + EXC_CHDATERANGE_AUTOBASE | EXC_CHDATERANGE_AUTOCROSS | + EXC_CHDATERANGE_AUTODATE ) +{ +} + +// ---------------------------------------------------------------------------- + XclChValueRange::XclChValueRange() : mfMin( 0.0 ), mfMax( 0.0 ), @@ -338,7 +356,8 @@ XclChValueRange::XclChValueRange() : mfMinorStep( 0.0 ), mfCross( 0.0 ), mnFlags( EXC_CHVALUERANGE_AUTOMIN | EXC_CHVALUERANGE_AUTOMAX | - EXC_CHVALUERANGE_AUTOMAJOR | EXC_CHVALUERANGE_AUTOMINOR | EXC_CHVALUERANGE_AUTOCROSS | EXC_CHVALUERANGE_BIT8 ) + EXC_CHVALUERANGE_AUTOMAJOR | EXC_CHVALUERANGE_AUTOMINOR | + EXC_CHVALUERANGE_AUTOCROSS | EXC_CHVALUERANGE_BIT8 ) { } @@ -1057,17 +1076,17 @@ void XclChPropSetHelper::WriteEscherProperties( ScfPropertySet& rPropSet, { if( rEscherFmt.mxItemSet ) { - if( const XFillStyleItem* pStyleItem = static_cast< const XFillStyleItem* >( rEscherFmt.mxItemSet->GetItem( XATTR_FILLSTYLE, FALSE ) ) ) + if( const XFillStyleItem* pStyleItem = static_cast< const XFillStyleItem* >( rEscherFmt.mxItemSet->GetItem( XATTR_FILLSTYLE, false ) ) ) { switch( pStyleItem->GetValue() ) { case XFILL_SOLID: // #i84812# Excel 2007 writes Escher properties for solid fill - if( const XFillColorItem* pColorItem = static_cast< const XFillColorItem* >( rEscherFmt.mxItemSet->GetItem( XATTR_FILLCOLOR, FALSE ) ) ) + if( const XFillColorItem* pColorItem = static_cast< const XFillColorItem* >( rEscherFmt.mxItemSet->GetItem( XATTR_FILLCOLOR, false ) ) ) { namespace cssd = ::com::sun::star::drawing; // get solid transparence too - const XFillTransparenceItem* pTranspItem = static_cast< const XFillTransparenceItem* >( rEscherFmt.mxItemSet->GetItem( XATTR_FILLTRANSPARENCE, FALSE ) ); + const XFillTransparenceItem* pTranspItem = static_cast< const XFillTransparenceItem* >( rEscherFmt.mxItemSet->GetItem( XATTR_FILLTRANSPARENCE, false ) ); sal_uInt16 nTransp = pTranspItem ? pTranspItem->GetValue() : 0; ScfPropSetHelper& rAreaHlp = GetAreaHelper( ePropMode ); rAreaHlp.InitializeWrite(); @@ -1076,7 +1095,7 @@ void XclChPropSetHelper::WriteEscherProperties( ScfPropertySet& rPropSet, } break; case XFILL_GRADIENT: - if( const XFillGradientItem* pGradItem = static_cast< const XFillGradientItem* >( rEscherFmt.mxItemSet->GetItem( XATTR_FILLGRADIENT, FALSE ) ) ) + if( const XFillGradientItem* pGradItem = static_cast< const XFillGradientItem* >( rEscherFmt.mxItemSet->GetItem( XATTR_FILLGRADIENT, false ) ) ) { Any aGradientAny; if( pGradItem->QueryValue( aGradientAny, MID_FILLGRADIENT ) ) @@ -1094,7 +1113,7 @@ void XclChPropSetHelper::WriteEscherProperties( ScfPropertySet& rPropSet, } break; case XFILL_BITMAP: - if( const XFillBitmapItem* pBmpItem = static_cast< const XFillBitmapItem* >( rEscherFmt.mxItemSet->GetItem( XATTR_FILLBITMAP, FALSE ) ) ) + if( const XFillBitmapItem* pBmpItem = static_cast< const XFillBitmapItem* >( rEscherFmt.mxItemSet->GetItem( XATTR_FILLBITMAP, false ) ) ) { Any aBitmapAny; if( pBmpItem->QueryValue( aBitmapAny, MID_GRAFURL ) ) diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index c06d4ed07179..336de4ded284 100644..100755 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -394,7 +394,7 @@ static const XclFunctionInfo saFuncTable_Odf[] = EXC_FUNCENTRY_ODF( ocVariationen2, 2, 2, 0, "PERMUTATIONA" ), EXC_FUNCENTRY_ODF( ocPhi, 1, 1, 0, "PHI" ), EXC_FUNCENTRY_ODF( ocZGZ, 3, 3, 0, "RRI" ), - EXC_FUNCENTRY_ODF( ocTable, 1, 1, 0, "SHEET" ), + EXC_FUNCENTRY_ODF( ocTable, 0, 1, 0, "SHEET" ), EXC_FUNCENTRY_ODF( ocTables, 0, 1, 0, "SHEETS" ), EXC_FUNCENTRY_ODF( ocNoName, 1, MX, 0, "SKEWP" ), EXC_FUNCENTRY_ODF( ocUnichar, 1, 1, 0, "UNICHAR" ), @@ -601,7 +601,7 @@ void XclTokenArrayIterator::Init() void XclTokenArrayIterator::Init( const ScTokenArray& rScTokArr, bool bSkipSpaces ) { - USHORT nTokArrLen = rScTokArr.GetLen(); + sal_uInt16 nTokArrLen = rScTokArr.GetLen(); mppScTokenBeg = static_cast< const FormulaToken* const* >( nTokArrLen ? rScTokArr.GetArray() : 0 ); mppScTokenEnd = mppScTokenBeg ? (mppScTokenBeg + nTokArrLen) : 0; mppScToken = (mppScTokenBeg != mppScTokenEnd) ? mppScTokenBeg : 0; diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 5d439a249bc1..418ae1d0f689 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -72,6 +72,8 @@ using ::com::sun::star::frame::XFrame; using ::com::sun::star::frame::XFramesSupplier; using ::com::sun::star::lang::XMultiServiceFactory; +using namespace ::com::sun::star; + // Global data ================================================================ #ifdef DBG_UTIL @@ -257,7 +259,7 @@ String XclRoot::RequestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) { ::std::vector< OUString > aDefaultPasswords; aDefaultPasswords.push_back( mrData.maDefPassword ); - return ScfApiHelper::QueryPasswordForMedium( mrData.mrMedium, rVerifier, &aDefaultPasswords ); + return ScfApiHelper::QueryEncryptionDataForMedium( mrData.mrMedium, rVerifier, &aDefaultPasswords ); } bool XclRoot::HasVbaStorage() const @@ -337,6 +339,12 @@ DateTime XclRoot::GetNullDate() const return *GetFormatter().GetNullDate(); } +sal_uInt16 XclRoot::GetBaseYear() const +{ + // return 1904 for 1904-01-01, and 1900 for 1899-12-30 + return (GetNullDate().GetYear() == 1904) ? 1904 : 1900; +} + double XclRoot::GetDoubleFromDateTime( const DateTime& rDateTime ) const { double fValue = rDateTime - GetNullDate(); @@ -363,8 +371,8 @@ ScEditEngineDefaulter& XclRoot::GetEditEngine() const ScEditEngineDefaulter& rEE = *mrData.mxEditEngine; rEE.SetRefMapMode( MAP_100TH_MM ); rEE.SetEditTextObjectPool( GetDoc().GetEditPool() ); - rEE.SetUpdateMode( FALSE ); - rEE.EnableUndo( FALSE ); + rEE.SetUpdateMode( false ); + rEE.EnableUndo( false ); rEE.SetControlWord( rEE.GetControlWord() & ~EE_CNTRL_ALLOWBIGOBJS ); } return *mrData.mxEditEngine; @@ -374,11 +382,11 @@ ScHeaderEditEngine& XclRoot::GetHFEditEngine() const { if( !mrData.mxHFEditEngine.get() ) { - mrData.mxHFEditEngine.reset( new ScHeaderEditEngine( EditEngine::CreatePool(), TRUE ) ); + mrData.mxHFEditEngine.reset( new ScHeaderEditEngine( EditEngine::CreatePool(), sal_True ) ); ScHeaderEditEngine& rEE = *mrData.mxHFEditEngine; rEE.SetRefMapMode( MAP_TWIP ); // headers/footers use twips as default metric - rEE.SetUpdateMode( FALSE ); - rEE.EnableUndo( FALSE ); + rEE.SetUpdateMode( false ); + rEE.EnableUndo( false ); rEE.SetControlWord( rEE.GetControlWord() & ~EE_CNTRL_ALLOWBIGOBJS ); // set Calc header/footer defaults @@ -401,8 +409,8 @@ EditEngine& XclRoot::GetDrawEditEngine() const mrData.mxDrawEditEng.reset( new EditEngine( &GetDoc().GetDrawLayer()->GetItemPool() ) ); EditEngine& rEE = *mrData.mxDrawEditEng; rEE.SetRefMapMode( MAP_100TH_MM ); - rEE.SetUpdateMode( FALSE ); - rEE.EnableUndo( FALSE ); + rEE.SetUpdateMode( false ); + rEE.EnableUndo( false ); rEE.SetControlWord( rEE.GetControlWord() & ~EE_CNTRL_ALLOWBIGOBJS ); } return *mrData.mxDrawEditEng; diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index 950d92f5a99c..0d0b63c0ebc7 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -217,7 +217,7 @@ sal_uInt8 XclTools::GetXclOrientFromRot( sal_uInt16 nXclRot ) return EXC_ORIENT_NONE; } -sal_uInt8 XclTools::GetXclErrorCode( USHORT nScError ) +sal_uInt8 XclTools::GetXclErrorCode( sal_uInt16 nScError ) { using namespace ScErrorCodes; switch( nScError ) @@ -242,7 +242,7 @@ sal_uInt8 XclTools::GetXclErrorCode( USHORT nScError ) return EXC_ERR_NA; } -USHORT XclTools::GetScErrorCode( sal_uInt8 nXclError ) +sal_uInt16 XclTools::GetScErrorCode( sal_uInt8 nXclError ) { using namespace ScErrorCodes; switch( nXclError ) @@ -330,13 +330,13 @@ sal_Int32 XclTools::GetHmmFromTwips( sal_Int32 nTwips ) return GetHmmFromInch( GetInchFromTwips( nTwips ) ); } -USHORT XclTools::GetScColumnWidth( sal_uInt16 nXclWidth, long nScCharWidth ) +sal_uInt16 XclTools::GetScColumnWidth( sal_uInt16 nXclWidth, long nScCharWidth ) { double fScWidth = static_cast< double >( nXclWidth ) / 256.0 * nScCharWidth + 0.5; - return limit_cast< USHORT >( fScWidth ); + return limit_cast< sal_uInt16 >( fScWidth ); } -sal_uInt16 XclTools::GetXclColumnWidth( USHORT nScWidth, long nScCharWidth ) +sal_uInt16 XclTools::GetXclColumnWidth( sal_uInt16 nScWidth, long nScCharWidth ) { double fXclWidth = static_cast< double >( nScWidth ) * 256.0 / nScCharWidth + 0.5; return limit_cast< sal_uInt16 >( fXclWidth ); @@ -697,9 +697,9 @@ const OUString XclTools::maSbMacroSuffix( RTL_CONSTASCII_USTRINGPARAM( "?languag OUString XclTools::GetSbMacroUrl( const String& rMacroName, SfxObjectShell* pDocShell ) { OSL_ENSURE( rMacroName.Len() > 0, "XclTools::GetSbMacroUrl - macro name is empty" ); - ::ooo::vba::VBAMacroResolvedInfo aMacroInfo = ::ooo::vba::resolveVBAMacro( pDocShell, rMacroName, false ); - if( aMacroInfo.IsResolved() ) - return ::ooo::vba::makeMacroURL( aMacroInfo.ResolvedMacro() ); + ::ooo::vba::MacroResolvedInfo aMacroInfo = ::ooo::vba::resolveVBAMacro( pDocShell, rMacroName, false ); + if( aMacroInfo.mbFound ) + return ::ooo::vba::makeMacroURL( aMacroInfo.msResolvedMacro ); return OUString(); } |