diff options
Diffstat (limited to 'sc/source/core/data/documen8.cxx')
-rw-r--r-- | sc/source/core/data/documen8.cxx | 325 |
1 files changed, 168 insertions, 157 deletions
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index bc2bf8c34..70b2dd500 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -94,6 +94,7 @@ #include "sc.hrc" #include "charthelper.hxx" #include "dpobject.hxx" +#include "docuno.hxx" #define GET_SCALEVALUE(set,id) ((const SfxUInt16Item&)(set.Get( id ))).GetValue() @@ -123,7 +124,7 @@ void ScDocument::ImplDeleteOptions() //------------------------------------------------------------------------ -SfxPrinter* ScDocument::GetPrinter(BOOL bCreateIfNotExist) +SfxPrinter* ScDocument::GetPrinter(sal_Bool bCreateIfNotExist) { if ( !pPrinter && bCreateIfNotExist ) { @@ -136,7 +137,7 @@ SfxPrinter* ScDocument::GetPrinter(BOOL bCreateIfNotExist) NULL ); ::utl::MiscCfg aMisc; - USHORT nFlags = 0; + sal_uInt16 nFlags = 0; if ( aMisc.IsPaperOrientationWarning() ) nFlags |= SFX_PRINTER_CHG_ORIENTATION; if ( aMisc.IsPaperSizeWarning() ) @@ -172,7 +173,7 @@ void ScDocument::SetPrinter( SfxPrinter* pNewPrinter ) pPrinter->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() ); delete pOld; } - InvalidateTextWidth(NULL, NULL, FALSE); // in both cases + InvalidateTextWidth(NULL, NULL, sal_False); // in both cases } //------------------------------------------------------------------------ @@ -187,7 +188,7 @@ void ScDocument::SetPrintOptions() ::utl::MiscCfg aMisc; SfxItemSet aOptSet( pPrinter->GetOptions() ); - USHORT nFlags = 0; + sal_uInt16 nFlags = 0; if ( aMisc.IsPaperOrientationWarning() ) nFlags |= SFX_PRINTER_CHG_ORIENTATION; if ( aMisc.IsPaperSizeWarning() ) @@ -239,11 +240,11 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet, { case SFX_STYLE_FAMILY_PAGE: { - const USHORT nOldScale = GET_SCALEVALUE(rSet,ATTR_PAGE_SCALE); - const USHORT nOldScaleToPages = GET_SCALEVALUE(rSet,ATTR_PAGE_SCALETOPAGES); + const sal_uInt16 nOldScale = GET_SCALEVALUE(rSet,ATTR_PAGE_SCALE); + const sal_uInt16 nOldScaleToPages = GET_SCALEVALUE(rSet,ATTR_PAGE_SCALETOPAGES); rSet.Put( rChanges ); - const USHORT nNewScale = GET_SCALEVALUE(rSet,ATTR_PAGE_SCALE); - const USHORT nNewScaleToPages = GET_SCALEVALUE(rSet,ATTR_PAGE_SCALETOPAGES); + const sal_uInt16 nNewScale = GET_SCALEVALUE(rSet,ATTR_PAGE_SCALE); + const sal_uInt16 nNewScaleToPages = GET_SCALEVALUE(rSet,ATTR_PAGE_SCALETOPAGES); if ( (nOldScale != nNewScale) || (nOldScaleToPages != nNewScaleToPages) ) InvalidateTextWidth( rStyleSheet.GetName() ); @@ -251,7 +252,7 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet, if( SvtLanguageOptions().IsCTLFontEnabled() ) { const SfxPoolItem *pItem = NULL; - if( rChanges.GetItemState(ATTR_WRITINGDIR, TRUE, &pItem ) == SFX_ITEM_SET ) + if( rChanges.GetItemState(ATTR_WRITINGDIR, sal_True, &pItem ) == SFX_ITEM_SET ) ScChartHelper::DoUpdateAllCharts( this ); } } @@ -259,19 +260,19 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet, case SFX_STYLE_FAMILY_PARA: { - BOOL bNumFormatChanged; + sal_Bool bNumFormatChanged; if ( ScGlobal::CheckWidthInvalidate( bNumFormatChanged, rSet, rChanges ) ) InvalidateTextWidth( NULL, NULL, bNumFormatChanged ); for (SCTAB nTab=0; nTab<=MAXTAB; ++nTab) if (pTab[nTab] && pTab[nTab]->IsStreamValid()) - pTab[nTab]->SetStreamValid( FALSE ); + pTab[nTab]->SetStreamValid( sal_False ); - ULONG nOldFormat = + sal_uLong nOldFormat = ((const SfxUInt32Item*)&rSet.Get( ATTR_VALUE_FORMAT ))->GetValue(); - ULONG nNewFormat = + sal_uLong nNewFormat = ((const SfxUInt32Item*)&rChanges.Get( ATTR_VALUE_FORMAT ))->GetValue(); LanguageType eNewLang, eOldLang; @@ -288,10 +289,10 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet, // Dontcare - Default setzen // Default - keine Aenderung // ("keine Aenderung" geht nicht mit PutExtended, darum Schleife) - for (USHORT nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; nWhich++) + for (sal_uInt16 nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; nWhich++) { const SfxPoolItem* pItem; - SfxItemState eState = rChanges.GetItemState( nWhich, FALSE, &pItem ); + SfxItemState eState = rChanges.GetItemState( nWhich, sal_False, &pItem ); if ( eState == SFX_ITEM_SET ) rSet.Put( *pItem ); else if ( eState == SFX_ITEM_DONTCARE ) @@ -336,14 +337,14 @@ void ScDocument::InvalidateTextWidth( SCTAB nTab ) { ScAddress aAdrFrom( 0, 0, nTab ); ScAddress aAdrTo ( MAXCOL, MAXROW, nTab ); - InvalidateTextWidth( &aAdrFrom, &aAdrTo, FALSE ); + InvalidateTextWidth( &aAdrFrom, &aAdrTo, sal_False ); } //------------------------------------------------------------------------ -BOOL ScDocument::IsPageStyleInUse( const String& rStrPageStyle, SCTAB* pInTab ) +sal_Bool ScDocument::IsPageStyleInUse( const String& rStrPageStyle, SCTAB* pInTab ) { - BOOL bInUse = FALSE; + sal_Bool bInUse = sal_False; const SCTAB nCount = GetTableCount(); SCTAB i; @@ -358,30 +359,30 @@ BOOL ScDocument::IsPageStyleInUse( const String& rStrPageStyle, SCTAB* pInTab ) //------------------------------------------------------------------------ -BOOL ScDocument::RemovePageStyleInUse( const String& rStyle ) +sal_Bool ScDocument::RemovePageStyleInUse( const String& rStyle ) { - BOOL bWasInUse = FALSE; + sal_Bool bWasInUse = sal_False; const SCTAB nCount = GetTableCount(); for ( SCTAB i=0; i<nCount && pTab[i]; i++ ) if ( pTab[i]->GetPageStyle() == rStyle ) { - bWasInUse = TRUE; + bWasInUse = sal_True; pTab[i]->SetPageStyle( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) ); } return bWasInUse; } -BOOL ScDocument::RenamePageStyleInUse( const String& rOld, const String& rNew ) +sal_Bool ScDocument::RenamePageStyleInUse( const String& rOld, const String& rNew ) { - BOOL bWasInUse = FALSE; + sal_Bool bWasInUse = sal_False; const SCTAB nCount = GetTableCount(); for ( SCTAB i=0; i<nCount && pTab[i]; i++ ) if ( pTab[i]->GetPageStyle() == rOld ) { - bWasInUse = TRUE; + bWasInUse = sal_True; pTab[i]->SetPageStyle( rNew ); } @@ -390,7 +391,7 @@ BOOL ScDocument::RenamePageStyleInUse( const String& rOld, const String& rNew ) //------------------------------------------------------------------------ -BYTE ScDocument::GetEditTextDirection(SCTAB nTab) const +sal_uInt8 ScDocument::GetEditTextDirection(SCTAB nTab) const { EEHorizontalTextDirection eRet = EE_HTEXTDIR_DEFAULT; @@ -409,15 +410,15 @@ BYTE ScDocument::GetEditTextDirection(SCTAB nTab) const // else (invalid for EditEngine): keep "default" } - return sal::static_int_cast<BYTE>(eRet); + return sal::static_int_cast<sal_uInt8>(eRet); } //------------------------------------------------------------------------ void ScDocument::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo, - BOOL bNumFormatChanged ) + sal_Bool bNumFormatChanged ) { - BOOL bBroadcast = (bNumFormatChanged && GetDocOptions().IsCalcAsShown() && !IsImportingXML() && !IsClipboard()); + sal_Bool bBroadcast = (bNumFormatChanged && GetDocOptions().IsCalcAsShown() && !IsImportingXML() && !IsClipboard()); if ( pAdrFrom && !pAdrTo ) { const SCTAB nTab = pAdrFrom->Tab(); @@ -441,17 +442,17 @@ void ScDocument::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress #define CALCMAX 1000 // Berechnungen #define ABORT_EVENTS (INPUT_ANY & ~INPUT_TIMER & ~INPUT_OTHER) -BOOL ScDocument::IdleCalcTextWidth() // TRUE = demnaechst wieder versuchen +sal_Bool ScDocument::IdleCalcTextWidth() // sal_True = demnaechst wieder versuchen { // #i75610# if a printer hasn't been set or created yet, don't create one for this - if ( bIdleDisabled || IsInLinkUpdate() || GetPrinter(FALSE) == NULL ) - return FALSE; - bIdleDisabled = TRUE; + if ( bIdleDisabled || IsInLinkUpdate() || GetPrinter(sal_False) == NULL ) + return sal_False; + bIdleDisabled = sal_True; -// ULONG nMs = 0; -// USHORT nIter = 0; +// sal_uLong nMs = 0; +// sal_uInt16 nIter = 0; - const ULONG nStart = Time::GetSystemTicks(); + const sal_uLong nStart = Time::GetSystemTicks(); double nPPTX = 0.0; double nPPTY = 0.0; OutputDevice* pDev = NULL; @@ -464,9 +465,9 @@ BOOL ScDocument::IdleCalcTextWidth() // TRUE = demnaechst wieder versuchen SCTAB nTab = aCurTextWidthCalcPos.Tab(); SCROW nRow = aCurTextWidthCalcPos.Row(); SCsCOL nCol = aCurTextWidthCalcPos.Col(); - USHORT nRestart = 0; - USHORT nZoom = 0; - BOOL bNeedMore= FALSE; + sal_uInt16 nRestart = 0; + sal_uInt16 nZoom = 0; + sal_Bool bNeedMore= sal_False; if ( !ValidRow(nRow) ) nRow = 0, nCol--; @@ -482,7 +483,7 @@ BOOL ScDocument::IdleCalcTextWidth() // TRUE = demnaechst wieder versuchen // Query-Box aufgemacht wird !!! ScStyleSheetPool* pStylePool = xPoolHelper->GetStylePool(); - USHORT nOldMask = pStylePool->GetSearchMask(); + sal_uInt16 nOldMask = pStylePool->GetSearchMask(); SfxStyleFamily eOldFam = pStylePool->GetSearchFamily(); pTable = pTab[nTab]; @@ -492,10 +493,10 @@ BOOL ScDocument::IdleCalcTextWidth() // TRUE = demnaechst wieder versuchen DBG_ASSERT( pStyle, "Missing StyleSheet :-/" ); - BOOL bProgress = FALSE; + sal_Bool bProgress = sal_False; if ( pStyle && 0 == GET_SCALEVALUE(pStyle->GetItemSet(),ATTR_PAGE_SCALETOPAGES) ) { - USHORT nCount = 0; + sal_uInt16 nCount = 0; nZoom = GET_SCALEVALUE(pStyle->GetItemSet(),ATTR_PAGE_SCALE); Fraction aZoomFract( nZoom, 100 ); @@ -521,28 +522,28 @@ BOOL ScDocument::IdleCalcTextWidth() // TRUE = demnaechst wieder versuchen if ( !bProgress && pCell->GetCellType() == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell)->GetDirty() ) { - ScProgress::CreateInterpretProgress( this, FALSE ); - bProgress = TRUE; + ScProgress::CreateInterpretProgress( this, sal_False ); + bProgress = sal_True; } // DBG_ERROR( String("t,c,r = ") + String(nTab) + String(',') + String(nCol) + String(',') + String(nRow) ); // DBG_ERROR( String("nOldWidth = ") + String(pCell->GetTextWidth()) ); - USHORT nNewWidth = (USHORT)GetNeededSize( nCol, nRow, nTab, + sal_uInt16 nNewWidth = (sal_uInt16)GetNeededSize( nCol, nRow, nTab, pDev, nPPTX, nPPTY, - aZoomFract,aZoomFract, TRUE, - TRUE ); // bTotalSize + aZoomFract,aZoomFract, sal_True, + sal_True ); // bTotalSize // DBG_ERROR( String("nNewWidth = ") + String(nNewWidth) ); pCell->SetTextWidth( nNewWidth ); - bNeedMore = TRUE; + bNeedMore = sal_True; } } else { - BOOL bNewTab = FALSE; + sal_Bool bNewTab = sal_False; nRow = 0; nCol--; @@ -551,14 +552,14 @@ BOOL ScDocument::IdleCalcTextWidth() // TRUE = demnaechst wieder versuchen { nCol = MAXCOL; nTab++; - bNewTab = TRUE; + bNewTab = sal_True; } if ( !ValidTab(nTab) || !pTab[nTab] ) { nTab = 0; nRestart++; - bNewTab = TRUE; + bNewTab = sal_True; } if ( nRestart < 2 ) @@ -630,7 +631,7 @@ BOOL ScDocument::IdleCalcTextWidth() // TRUE = demnaechst wieder versuchen // DBG_ERROR( String(nMs) + String(" ms (") + String(nIter) + String(')') ); pStylePool->SetSearchMask( eOldFam, nOldMask ); - bIdleDisabled = FALSE; + bIdleDisabled = sal_False; return bNeedMore; } @@ -640,18 +641,18 @@ BOOL ScDocument::IdleCalcTextWidth() // TRUE = demnaechst wieder versuchen class ScSpellStatus { public: - BOOL bModified; + sal_Bool bModified; - ScSpellStatus() : bModified(FALSE) {}; + ScSpellStatus() : bModified(sal_False) {}; DECL_LINK (EventHdl, EditStatus*); }; IMPL_LINK( ScSpellStatus, EventHdl, EditStatus *, pStatus ) { - ULONG nStatus = pStatus->GetStatusWord(); + sal_uLong nStatus = pStatus->GetStatusWord(); if ( nStatus & EE_STAT_WRONGWORDCHANGED ) - bModified = TRUE; + bModified = sal_True; return 0; } @@ -667,16 +668,16 @@ IMPL_LINK( ScSpellStatus, EventHdl, EditStatus *, pStatus ) #define SPELL_MAXTEST_ALL 3 #define SPELL_MAXCELLS 256 -BOOL ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpellPos, - USHORT nMaxTest ) +sal_Bool ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpellPos, + sal_uInt16 nMaxTest ) { ScEditEngineDefaulter* pEngine = NULL; //! am Dokument speichern SfxItemSet* pDefaults = NULL; ScSpellStatus aStatus; - USHORT nCellCount = 0; // Zellen insgesamt - USHORT nTestCount = 0; // Aufrufe Spelling - BOOL bChanged = FALSE; // Aenderungen? + sal_uInt16 nCellCount = 0; // Zellen insgesamt + sal_uInt16 nTestCount = 0; // Aufrufe Spelling + sal_Bool bChanged = sal_False; // Aenderungen? SCCOL nCol = rSpellRange.aStart.Col(); // iterator always starts on the left edge SCROW nRow = rSpellPos.Row(); @@ -688,7 +689,7 @@ BOOL ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe if ( !pTab[nTab] ) { // may happen for visible range - return FALSE; + return sal_False; } } ScHorizontalCellIterator aIter( this, nTab, @@ -728,9 +729,9 @@ BOOL ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe const ScPatternAttr* pPattern = GetPattern( nCol, nRow, nTab ); pPattern->FillEditItemSet( pDefaults ); - pEngine->SetDefaults( pDefaults, FALSE ); //! noetig ? + pEngine->SetDefaults( pDefaults, sal_False ); //! noetig ? - USHORT nCellLang = ((const SvxLanguageItem&) + sal_uInt16 nCellLang = ((const SvxLanguageItem&) pPattern->GetItem(ATTR_FONT_LANGUAGE)).GetValue(); if ( nCellLang == LANGUAGE_SYSTEM ) nCellLang = Application::GetSettings().GetLanguage(); // never use SYSTEM for spelling @@ -745,11 +746,11 @@ BOOL ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe else pEngine->SetText( *((ScEditCell*)pCell)->GetData() ); - aStatus.bModified = FALSE; + aStatus.bModified = sal_False; pEngine->CompleteOnlineSpelling(); if ( aStatus.bModified ) // Fehler dazu oder weggekommen? { - BOOL bNeedEdit = TRUE; // Test auf einfachen Text + sal_Bool bNeedEdit = sal_True; // Test auf einfachen Text if ( !pEngine->HasOnlineSpellErrors() ) { ScEditAttrTester aTester( pEngine ); @@ -776,11 +777,11 @@ BOOL ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe // #47751# Seitenvorschau ist davon nicht betroffen // (sollte jedenfalls nicht) ScPaintHint aHint( ScRange( nCol, nRow, nTab ), PAINT_GRID ); - aHint.SetPrintFlag( FALSE ); + aHint.SetPrintFlag( sal_False ); pShell->Broadcast( aHint ); } - bChanged = TRUE; + bChanged = sal_True; } if ( ++nTestCount >= nMaxTest ) // checked enough text? @@ -822,24 +823,24 @@ BOOL ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpe } -BOOL ScDocument::ContinueOnlineSpelling() +sal_Bool ScDocument::ContinueOnlineSpelling() { if ( bIdleDisabled || !pDocOptions->IsAutoSpell() || (pShell && pShell->IsReadOnly()) ) - return FALSE; + return sal_False; // #i48433# set bInsertingFromOtherDoc flag so there are no broadcasts when PutCell is called // (same behavior as in RemoveAutoSpellObj: just transfer the broadcaster) - BOOL bOldInserting = IsInsertingFromOtherDoc(); - SetInsertingFromOtherDoc( TRUE ); + sal_Bool bOldInserting = IsInsertingFromOtherDoc(); + SetInsertingFromOtherDoc( sal_True ); //! use one EditEngine for both calls // #41504# first check visible range - BOOL bResult = OnlineSpellInRange( aVisSpellRange, aVisSpellPos, SPELL_MAXTEST_VIS ); + sal_Bool bResult = OnlineSpellInRange( aVisSpellRange, aVisSpellPos, SPELL_MAXTEST_VIS ); // during first pass through visible range, always continue if ( nVisSpellState == VSPL_START ) - bResult = TRUE; + bResult = sal_True; if (bResult) { @@ -868,13 +869,13 @@ void ScDocument::SetOnlineSpellPos( const ScAddress& rPos ) aOnlineSpellPos = aVisSpellRange.aEnd; } -BOOL ScDocument::SetVisibleSpellRange( const ScRange& rNewRange ) +sal_Bool ScDocument::SetVisibleSpellRange( const ScRange& rNewRange ) { - BOOL bChange = ( aVisSpellRange != rNewRange ); + sal_Bool bChange = ( aVisSpellRange != rNewRange ); if (bChange) { // continue spelling through visible range when scrolling down - BOOL bContDown = ( nVisSpellState == VSPL_START && rNewRange.In( aVisSpellPos ) && + sal_Bool bContDown = ( nVisSpellState == VSPL_START && rNewRange.In( aVisSpellPos ) && rNewRange.aStart.Row() > aVisSpellRange.aStart.Row() && rNewRange.aStart.Col() == aVisSpellRange.aStart.Col() && rNewRange.aEnd.Col() == aVisSpellRange.aEnd.Col() ); @@ -902,17 +903,27 @@ void ScDocument::RemoveAutoSpellObj() pTab[nTab]->RemoveAutoSpellObj(); } +void ScDocument::RepaintRange( const ScRange& rRange ) +{ + if ( bIsVisible && pShell ) + { + ScModelObj* pModel = ScModelObj::getImplementation( pShell->GetModel() ); + if ( pModel ) + pModel->RepaintRange( rRange ); // locked repaints are checked there + } +} + //------------------------------------------------------------------------ -BOOL ScDocument::IdleCheckLinks() // TRUE = demnaechst wieder versuchen +sal_Bool ScDocument::IdleCheckLinks() // sal_True = demnaechst wieder versuchen { - BOOL bAnyLeft = FALSE; + sal_Bool bAnyLeft = sal_False; if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); - for (USHORT i=0; i<nCount; i++) + sal_uInt16 nCount = rLinks.Count(); + for (sal_uInt16 i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; if (pBase->ISA(ScDdeLink)) @@ -922,7 +933,7 @@ BOOL ScDocument::IdleCheckLinks() // TRUE = demnaechst wieder versuchen { pDdeLink->TryUpdate(); if (pDdeLink->NeedsUpdate()) // war nix? - bAnyLeft = TRUE; + bAnyLeft = sal_True; } } } @@ -934,15 +945,15 @@ BOOL ScDocument::IdleCheckLinks() // TRUE = demnaechst wieder versuchen void ScDocument::SaveDdeLinks(SvStream& rStream) const { // bei 4.0-Export alle mit Modus != DEFAULT weglassen - BOOL bExport40 = ( rStream.GetVersion() <= SOFFICE_FILEFORMAT_40 ); + sal_Bool bExport40 = ( rStream.GetVersion() <= SOFFICE_FILEFORMAT_40 ); const ::sfx2::SvBaseLinks& rLinks = GetLinkManager()->GetLinks(); - USHORT nCount = rLinks.Count(); + sal_uInt16 nCount = rLinks.Count(); // erstmal zaehlen... - USHORT nDdeCount = 0; - USHORT i; + sal_uInt16 nDdeCount = 0; + sal_uInt16 i; for (i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; @@ -975,9 +986,9 @@ void ScDocument::LoadDdeLinks(SvStream& rStream) ScMultipleReadHeader aHdr( rStream ); GetLinkManager(); - USHORT nCount; + sal_uInt16 nCount; rStream >> nCount; - for (USHORT i=0; i<nCount; i++) + for (sal_uInt16 i=0; i<nCount; i++) { ScDdeLink* pLink = new ScDdeLink( this, rStream, aHdr ); pLinkManager->InsertDDELink( pLink, @@ -985,21 +996,21 @@ void ScDocument::LoadDdeLinks(SvStream& rStream) } } -BOOL ScDocument::HasDdeLinks() const +sal_Bool ScDocument::HasDdeLinks() const { if (GetLinkManager()) // Clipboard z.B. hat keinen LinkManager { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); - for (USHORT i=0; i<nCount; i++) + sal_uInt16 nCount = rLinks.Count(); + for (sal_uInt16 i=0; i<nCount; i++) if ((*rLinks[i])->ISA(ScDdeLink)) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } -void ScDocument::SetInLinkUpdate(BOOL bSet) +void ScDocument::SetInLinkUpdate(sal_Bool bSet) { // called from TableLink and AreaLink @@ -1007,7 +1018,7 @@ void ScDocument::SetInLinkUpdate(BOOL bSet) bInLinkUpdate = bSet; } -BOOL ScDocument::IsInLinkUpdate() const +sal_Bool ScDocument::IsInLinkUpdate() const { return bInLinkUpdate || IsInDdeLinkUpdate(); } @@ -1018,10 +1029,10 @@ void ScDocument::UpdateExternalRefLinks() return; const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); + sal_uInt16 nCount = rLinks.Count(); bool bAny = false; - for (USHORT i = 0; i < nCount; ++i) + for (sal_uInt16 i = 0; i < nCount; ++i) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; ScExternalRefLink* pRefLink = dynamic_cast<ScExternalRefLink*>(pBase); @@ -1040,7 +1051,7 @@ void ScDocument::UpdateExternalRefLinks() // #i101960# set document modified, as in TrackTimeHdl for DDE links if (!pShell->IsModified()) { - pShell->SetModified( TRUE ); + pShell->SetModified( sal_True ); SfxBindings* pBindings = GetViewBindings(); if (pBindings) { @@ -1056,19 +1067,19 @@ void ScDocument::UpdateDdeLinks() if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); - USHORT i; + sal_uInt16 nCount = rLinks.Count(); + sal_uInt16 i; // #49226# falls das Updaten laenger dauert, erstmal alle Werte // zuruecksetzen, damit nichts altes (falsches) stehen bleibt - BOOL bAny = FALSE; + sal_Bool bAny = sal_False; for (i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; if (pBase->ISA(ScDdeLink)) { ((ScDdeLink*)pBase)->ResetValue(); - bAny = TRUE; + bAny = sal_True; } } if (bAny) @@ -1092,18 +1103,18 @@ void ScDocument::UpdateDdeLinks() } } -BOOL ScDocument::UpdateDdeLink( const String& rAppl, const String& rTopic, const String& rItem ) +sal_Bool ScDocument::UpdateDdeLink( const String& rAppl, const String& rTopic, const String& rItem ) { // fuer refresh() per StarOne Api // ResetValue() fuer einzelnen Link nicht noetig //! wenn's mal alles asynchron wird, aber auch hier - BOOL bFound = FALSE; + sal_Bool bFound = sal_False; if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); - for (USHORT i=0; i<nCount; i++) + sal_uInt16 nCount = rLinks.Count(); + for (sal_uInt16 i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; if (pBase->ISA(ScDdeLink)) @@ -1114,7 +1125,7 @@ BOOL ScDocument::UpdateDdeLink( const String& rAppl, const String& rTopic, const pDdeLink->GetItem() == rItem ) { pDdeLink->TryUpdate(); - bFound = TRUE; // koennen theoretisch mehrere sein (Mode), darum weitersuchen + bFound = sal_True; // koennen theoretisch mehrere sein (Mode), darum weitersuchen } } } @@ -1127,8 +1138,8 @@ void ScDocument::DisconnectDdeLinks() if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); - for (USHORT i=0; i<nCount; i++) + sal_uInt16 nCount = rLinks.Count(); + for (sal_uInt16 i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; if (pBase->ISA(ScDdeLink)) @@ -1150,8 +1161,8 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const else if (GetLinkManager()) // Links direkt kopieren { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); - for (USHORT i=0; i<nCount; i++) + sal_uInt16 nCount = rLinks.Count(); + for (sal_uInt16 i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; if (pBase->ISA(ScDdeLink)) @@ -1165,14 +1176,14 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const } } -USHORT ScDocument::GetDdeLinkCount() const +sal_uInt16 ScDocument::GetDdeLinkCount() const { - USHORT nDdeCount = 0; + sal_uInt16 nDdeCount = 0; if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); - for (USHORT i=0; i<nCount; i++) + sal_uInt16 nCount = rLinks.Count(); + for (sal_uInt16 i=0; i<nCount; i++) if ((*rLinks[i])->ISA(ScDdeLink)) ++nDdeCount; } @@ -1189,15 +1200,15 @@ namespace { @return The DDE link, if it exists, otherwise 0. */ ScDdeLink* lclGetDdeLink( const sfx2::LinkManager* pLinkManager, - const String& rAppl, const String& rTopic, const String& rItem, BYTE nMode, - USHORT* pnDdePos = NULL ) + const String& rAppl, const String& rTopic, const String& rItem, sal_uInt8 nMode, + sal_uInt16* pnDdePos = NULL ) { if( pLinkManager ) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); + sal_uInt16 nCount = rLinks.Count(); if( pnDdePos ) *pnDdePos = 0; - for( USHORT nIndex = 0; nIndex < nCount; ++nIndex ) + for( sal_uInt16 nIndex = 0; nIndex < nCount; ++nIndex ) { ::sfx2::SvBaseLink* pLink = *rLinks[ nIndex ]; if( ScDdeLink* pDdeLink = PTR_CAST( ScDdeLink, pLink ) ) @@ -1217,14 +1228,14 @@ ScDdeLink* lclGetDdeLink( /** Returns a pointer to the specified DDE link. @param nDdePos Index of the DDE link (does not include other links from link manager). @return The DDE link, if it exists, otherwise 0. */ -ScDdeLink* lclGetDdeLink( const sfx2::LinkManager* pLinkManager, USHORT nDdePos ) +ScDdeLink* lclGetDdeLink( const sfx2::LinkManager* pLinkManager, sal_uInt16 nDdePos ) { if( pLinkManager ) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); - USHORT nDdeIndex = 0; // counts only the DDE links - for( USHORT nIndex = 0; nIndex < nCount; ++nIndex ) + sal_uInt16 nCount = rLinks.Count(); + sal_uInt16 nDdeIndex = 0; // counts only the DDE links + for( sal_uInt16 nIndex = 0; nIndex < nCount; ++nIndex ) { ::sfx2::SvBaseLink* pLink = *rLinks[ nIndex ]; if( ScDdeLink* pDdeLink = PTR_CAST( ScDdeLink, pLink ) ) @@ -1242,12 +1253,12 @@ ScDdeLink* lclGetDdeLink( const sfx2::LinkManager* pLinkManager, USHORT nDdePos // ---------------------------------------------------------------------------- -bool ScDocument::FindDdeLink( const String& rAppl, const String& rTopic, const String& rItem, BYTE nMode, USHORT& rnDdePos ) +bool ScDocument::FindDdeLink( const String& rAppl, const String& rTopic, const String& rItem, sal_uInt8 nMode, sal_uInt16& rnDdePos ) { return lclGetDdeLink( GetLinkManager(), rAppl, rTopic, rItem, nMode, &rnDdePos ) != NULL; } -bool ScDocument::GetDdeLinkData( USHORT nDdePos, String& rAppl, String& rTopic, String& rItem ) const +bool ScDocument::GetDdeLinkData( sal_uInt16 nDdePos, String& rAppl, String& rTopic, String& rItem ) const { if( const ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos ) ) { @@ -1259,7 +1270,7 @@ bool ScDocument::GetDdeLinkData( USHORT nDdePos, String& rAppl, String& rTopic, return false; } -bool ScDocument::GetDdeLinkMode( USHORT nDdePos, BYTE& rnMode ) const +bool ScDocument::GetDdeLinkMode( sal_uInt16 nDdePos, sal_uInt8& rnMode ) const { if( const ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos ) ) { @@ -1269,13 +1280,13 @@ bool ScDocument::GetDdeLinkMode( USHORT nDdePos, BYTE& rnMode ) const return false; } -const ScMatrix* ScDocument::GetDdeLinkResultMatrix( USHORT nDdePos ) const +const ScMatrix* ScDocument::GetDdeLinkResultMatrix( sal_uInt16 nDdePos ) const { const ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos ); return pDdeLink ? pDdeLink->GetResult() : NULL; } -bool ScDocument::CreateDdeLink( const String& rAppl, const String& rTopic, const String& rItem, BYTE nMode, ScMatrix* pResults ) +bool ScDocument::CreateDdeLink( const String& rAppl, const String& rTopic, const String& rItem, sal_uInt8 nMode, ScMatrix* pResults ) { /* Create a DDE link without updating it (i.e. for Excel import), to prevent unwanted connections. First try to find existing link. Set result array @@ -1301,7 +1312,7 @@ bool ScDocument::CreateDdeLink( const String& rAppl, const String& rTopic, const return false; } -bool ScDocument::SetDdeLinkResultMatrix( USHORT nDdePos, ScMatrix* pResults ) +bool ScDocument::SetDdeLinkResultMatrix( sal_uInt16 nDdePos, ScMatrix* pResults ) { if( ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos ) ) { @@ -1313,18 +1324,18 @@ bool ScDocument::SetDdeLinkResultMatrix( USHORT nDdePos, ScMatrix* pResults ) //------------------------------------------------------------------------ -BOOL ScDocument::HasAreaLinks() const +sal_Bool ScDocument::HasAreaLinks() const { if (GetLinkManager()) // Clipboard z.B. hat keinen LinkManager { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); - for (USHORT i=0; i<nCount; i++) + sal_uInt16 nCount = rLinks.Count(); + for (sal_uInt16 i=0; i<nCount; i++) if ((*rLinks[i])->ISA(ScAreaLink)) - return TRUE; + return sal_True; } - return FALSE; + return sal_False; } void ScDocument::UpdateAreaLinks() @@ -1332,8 +1343,8 @@ void ScDocument::UpdateAreaLinks() if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); - for (USHORT i=0; i<nCount; i++) + sal_uInt16 nCount = rLinks.Count(); + for (sal_uInt16 i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; if (pBase->ISA(ScAreaLink)) @@ -1347,7 +1358,7 @@ void ScDocument::DeleteAreaLinksOnTab( SCTAB nTab ) if (GetLinkManager()) { const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nPos = 0; + sal_uInt16 nPos = 0; while ( nPos < rLinks.Count() ) { const ::sfx2::SvBaseLink* pBase = *rLinks[nPos]; @@ -1368,8 +1379,8 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode, bool bAnyUpdate = false; const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); - USHORT nCount = rLinks.Count(); - for (USHORT i=0; i<nCount; i++) + sal_uInt16 nCount = rLinks.Count(); + for (sal_uInt16 i=0; i<nCount; i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; if (pBase->ISA(ScAreaLink)) @@ -1403,7 +1414,7 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode, // If several links start at the same cell, the one with the lower index is removed // (file format specifies only one link definition for a cell). - USHORT nFirstIndex = 0; + sal_uInt16 nFirstIndex = 0; while ( nFirstIndex < nCount ) { bool bFound = false; @@ -1411,7 +1422,7 @@ void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode, if ( pFirst->ISA(ScAreaLink) ) { ScAddress aFirstPos = static_cast<ScAreaLink*>(pFirst)->GetDestArea().aStart; - for ( USHORT nSecondIndex = nFirstIndex + 1; nSecondIndex < nCount && !bFound; ++nSecondIndex ) + for ( sal_uInt16 nSecondIndex = nFirstIndex + 1; nSecondIndex < nCount && !bFound; ++nSecondIndex ) { ::sfx2::SvBaseLink* pSecond = *rLinks[nSecondIndex]; if ( pSecond->ISA(ScAreaLink) && @@ -1444,12 +1455,12 @@ void ScDocument::KeyInput( const KeyEvent& ) // ---------------------------------------------------------------------------- -BOOL ScDocument::CheckMacroWarn() +sal_Bool ScDocument::CheckMacroWarn() { // The check for macro configuration, macro warning and disabling is now handled // in SfxObjectShell::AdjustMacroMode, called by SfxObjectShell::CallBasic. - return TRUE; + return sal_True; } //------------------------------------------------------------------------ @@ -1480,23 +1491,23 @@ SfxBindings* ScDocument::GetViewBindings() void lcl_TransliterateEditEngine( ScEditEngineDefaulter& rEngine, utl::TransliterationWrapper& rTranslitarationWrapper, - BOOL bConsiderLanguage, ScDocument* pDoc ) + sal_Bool bConsiderLanguage, ScDocument* pDoc ) { //! should use TransliterateText method of EditEngine instead, when available! sal_uInt16 nLanguage = LANGUAGE_SYSTEM; - USHORT nParCount = rEngine.GetParagraphCount(); - for (USHORT nPar=0; nPar<nParCount; nPar++) + sal_uInt16 nParCount = rEngine.GetParagraphCount(); + for (sal_uInt16 nPar=0; nPar<nParCount; nPar++) { SvUShorts aPortions; - rEngine.GetPortions( (USHORT)nPar, aPortions ); + rEngine.GetPortions( (sal_uInt16)nPar, aPortions ); - for ( USHORT nPos = aPortions.Count(); nPos; ) + for ( sal_uInt16 nPos = aPortions.Count(); nPos; ) { --nPos; - USHORT nEnd = aPortions.GetObject( nPos ); - USHORT nStart = nPos ? aPortions.GetObject( nPos - 1 ) : 0; + sal_uInt16 nEnd = aPortions.GetObject( nPos ); + sal_uInt16 nStart = nPos ? aPortions.GetObject( nPos - 1 ) : 0; ESelection aSel( nPar, nStart, nPar, nEnd ); String aOldStr = rEngine.GetText( aSel ); @@ -1506,8 +1517,8 @@ void lcl_TransliterateEditEngine( ScEditEngineDefaulter& rEngine, { if ( bConsiderLanguage ) { - BYTE nScript = pDoc->GetStringScriptType( aOldStr ); - USHORT nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? EE_CHAR_LANGUAGE_CJK : + sal_uInt8 nScript = pDoc->GetStringScriptType( aOldStr ); + sal_uInt16 nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? EE_CHAR_LANGUAGE_CJK : ( ( nScript == SCRIPTTYPE_COMPLEX ) ? EE_CHAR_LANGUAGE_CTL : EE_CHAR_LANGUAGE ); nLanguage = ((const SvxLanguageItem&)aAttr.Get(nWhich)).GetValue(); @@ -1534,7 +1545,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp DBG_ASSERT( rMultiMark.IsMultiMarked(), "TransliterateText: no selection" ); utl::TransliterationWrapper aTranslitarationWrapper( xServiceManager, nType ); - BOOL bConsiderLanguage = aTranslitarationWrapper.needLanguageForTheMode(); + sal_Bool bConsiderLanguage = aTranslitarationWrapper.needLanguageForTheMode(); sal_uInt16 nLanguage = LANGUAGE_SYSTEM; ScEditEngineDefaulter* pEngine = NULL; // not using pEditEngine member because of defaults @@ -1546,7 +1557,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp SCCOL nCol = 0; SCROW nRow = 0; - BOOL bFound = rMultiMark.IsCellMarked( nCol, nRow ); + sal_Bool bFound = rMultiMark.IsCellMarked( nCol, nRow ); if (!bFound) bFound = GetNextMarkedCell( nCol, nRow, nTab, rMultiMark ); @@ -1563,8 +1574,8 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp if ( bConsiderLanguage ) { - BYTE nScript = GetStringScriptType( aOldStr ); //! cell script type? - USHORT nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? ATTR_CJK_FONT_LANGUAGE : + sal_uInt8 nScript = GetStringScriptType( aOldStr ); //! cell script type? + sal_uInt16 nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? ATTR_CJK_FONT_LANGUAGE : ( ( nScript == SCRIPTTYPE_COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : ATTR_FONT_LANGUAGE ); nLanguage = ((const SvxLanguageItem*)GetAttr( nCol, nRow, nTab, nWhich ))->GetValue(); @@ -1585,7 +1596,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp const ScPatternAttr* pPattern = GetPattern( nCol, nRow, nTab ); SfxItemSet* pDefaults = new SfxItemSet( pEngine->GetEmptyItemSet() ); pPattern->FillEditItemSet( pDefaults ); - pEngine->SetDefaults( pDefaults, TRUE ); + pEngine->SetDefaults( pDefaults, sal_True ); const EditTextObject* pData = ((const ScEditCell*)pCell)->GetData(); pEngine->SetText( *pData ); @@ -1601,7 +1612,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp { // remove defaults (paragraph attributes) before creating text object SfxItemSet* pEmpty = new SfxItemSet( pEngine->GetEmptyItemSet() ); - pEngine->SetDefaults( pEmpty, TRUE ); + pEngine->SetDefaults( pEmpty, sal_True ); EditTextObject* pNewData = pEngine->CreateTextObject(); PutCell( nCol, nRow, nTab, |