summaryrefslogtreecommitdiff
path: root/sc/source/core/data/documen8.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-08-31 22:35:27 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-09-01 14:48:48 -0400
commit5f62f8e19d07c795b98ca85350b00b5d1edef3e2 (patch)
treebb434122387f66b09d920f934b4dbc9b0b73c041 /sc/source/core/data/documen8.cxx
parent547f4fec93a023ff244e3bf509baf4b8001effa0 (diff)
Auto spell-check is no longer done in ScDocument.
Change-Id: I7ecfd6160443299887e31d784322a00580aac067
Diffstat (limited to 'sc/source/core/data/documen8.cxx')
-rw-r--r--sc/source/core/data/documen8.cxx249
1 files changed, 0 insertions, 249 deletions
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 4dfd029e53dc..67fb76a46b80 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -91,10 +91,6 @@
#include <memory>
#include <boost/scoped_ptr.hpp>
-// states for online spelling in the visible range (0 is set initially)
-#define VSPL_START 0
-#define VSPL_DONE 1
-
using namespace com::sun::star;
// STATIC DATA -----------------------------------------------------------
@@ -746,225 +742,6 @@ IMPL_LINK( ScSpellStatus, EventHdl, EditStatus *, pStatus )
return 0;
}
-// SPELL_MAXCELLS muss mindestens 256 sein, solange am Iterator keine
-// Start-Spalte gesetzt werden kann
-
-//! SPELL_MAXTEST fuer Timer und Idle unterschiedlich ???
-
-// SPELL_MAXTEST now divided between visible and rest of document
-
-#define SPELL_MAXTEST_VIS 1
-#define SPELL_MAXTEST_ALL 3
-#define SPELL_MAXCELLS 256
-
-bool ScDocument::OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpellPos,
- sal_uInt16 nMaxTest )
-{
- ScEditEngineDefaulter* pEngine = NULL; //! am Dokument speichern
- SfxItemSet* pDefaults = NULL;
- ScSpellStatus aStatus;
-
- sal_uInt16 nCellCount = 0; // Zellen insgesamt
- sal_uInt16 nTestCount = 0; // Aufrufe Spelling
- bool bChanged = false; // Aenderungen?
-
- SCCOL nCol = rSpellRange.aStart.Col(); // iterator always starts on the left edge
- SCROW nRow = rSpellPos.Row();
- SCTAB nTab = rSpellPos.Tab();
- if ( nTab >= static_cast<SCTAB>(maTabs.size()) || !maTabs[nTab] ) // sheet deleted?
- {
- nTab = rSpellRange.aStart.Tab();
- nRow = rSpellRange.aStart.Row();
- if ( nTab >= static_cast<SCTAB>(maTabs.size()) || !maTabs[nTab] )
- {
- // may happen for visible range
- return false;
- }
- }
-
- ScRangeList aPivotRanges;
- if (pDPCollection)
- aPivotRanges = pDPCollection->GetAllTableRanges(nTab);
-
- ScHorizontalCellIterator aIter( this, nTab,
- rSpellRange.aStart.Col(), nRow,
- rSpellRange.aEnd.Col(), rSpellRange.aEnd.Row() );
- ScRefCellValue* pCell = aIter.GetNext( nCol, nRow );
- // skip everything left of rSpellPos:
- while ( pCell && nRow == rSpellPos.Row() && nCol < rSpellPos.Col() )
- pCell = aIter.GetNext( nCol, nRow );
-
- for (; pCell; pCell = aIter.GetNext(nCol, nRow))
- {
- if (!aPivotRanges.empty() && aPivotRanges.In(ScAddress(nCol, nRow, nTab)))
- // Don't spell check within pivot tables.
- continue;
-
- CellType eType = pCell->meType;
- if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT )
- {
- if (!pEngine)
- {
- // ScTabEditEngine is needed
- // because MapMode must be set for some old documents
- pEngine = new ScTabEditEngine( this );
- pEngine->SetControlWord( pEngine->GetControlWord() |
- ( EE_CNTRL_ONLINESPELLING | EE_CNTRL_ALLOWBIGOBJS ) );
- pEngine->SetStatusEventHdl( LINK( &aStatus, ScSpellStatus, EventHdl ) );
- // Delimiters hier wie in inputhdl.cxx !!!
- pEngine->SetWordDelimiters(
- ScEditUtil::ModifyDelimiters( pEngine->GetWordDelimiters() ) );
- pDefaults = new SfxItemSet( pEngine->GetEmptyItemSet() );
-
- com::sun::star::uno::Reference<com::sun::star::linguistic2::XSpellChecker1> xXSpellChecker1( LinguMgr::GetSpellChecker() );
-
- pEngine->SetSpeller( xXSpellChecker1 );
- }
-
- const ScPatternAttr* pPattern = GetPattern( nCol, nRow, nTab );
- if ( ScStyleSheet* pPreviewStyle = GetPreviewCellStyle( nCol, nRow, nTab ) )
- {
- ScPatternAttr* pPreviewPattern = new ScPatternAttr( *pPattern );
- pPreviewPattern->SetStyleSheet(pPreviewStyle);
- pPreviewPattern->FillEditItemSet( pDefaults );
- delete pPreviewPattern;
- }
- else
- {
- SfxItemSet* pFontSet = GetPreviewFont( nCol, nRow, nTab );
- pPattern->FillEditItemSet( pDefaults, pFontSet );
- }
- pEngine->SetDefaults( pDefaults, false ); //! noetig ?
-
- sal_uInt16 nCellLang = ((const SvxLanguageItem&)
- pPattern->GetItem(ATTR_FONT_LANGUAGE)).GetValue();
- if ( nCellLang == LANGUAGE_SYSTEM )
- nCellLang = Application::GetSettings().GetLanguageTag().getLanguageType(); // never use SYSTEM for spelling
- pEngine->SetDefaultLanguage( nCellLang );
-
- if ( eType == CELLTYPE_STRING )
- {
- pEngine->SetText(*pCell->mpString);
- }
- else if (pCell->mpEditText)
- pEngine->SetText(*pCell->mpEditText);
- else
- pEngine->SetText(EMPTY_OUSTRING);
-
- aStatus.bModified = false;
- pEngine->CompleteOnlineSpelling();
- if ( aStatus.bModified ) // Fehler dazu oder weggekommen?
- {
- bool bNeedEdit = true; // Test auf einfachen Text
- if ( !pEngine->HasOnlineSpellErrors() )
- {
- ScEditAttrTester aTester( pEngine );
- bNeedEdit = aTester.NeedsObject();
- }
-
- if ( bNeedEdit )
- {
- // The cell will take ownership of pNewData.
- SetEditText(ScAddress(nCol,nRow,nTab), pEngine->CreateTextObject());
- aIter.RehashCol(nCol);
- }
- else
- {
- ScSetStringParam aParam;
- aParam.setTextInput();
- SetString(ScAddress(nCol,nRow,nTab), pEngine->GetText(), &aParam);
- aIter.RehashCol(nCol);
- }
-
- // Paint
- if (pShell)
- {
- // Seitenvorschau ist davon nicht betroffen
- // (sollte jedenfalls nicht)
- ScPaintHint aHint( ScRange( nCol, nRow, nTab ), PAINT_GRID );
- aHint.SetPrintFlag( false );
- pShell->Broadcast( aHint );
- }
-
- bChanged = true;
- }
-
- if ( ++nTestCount >= nMaxTest ) // checked enough text?
- break;
- }
-
- if ( ++nCellCount >= SPELL_MAXCELLS ) // seen enough cells?
- break;
- }
-
- if ( pCell )
- {
- ++nCol; // continue after last cell
- if ( nCol > rSpellRange.aEnd.Col() )
- {
- nCol = rSpellRange.aStart.Col();
- ++nRow;
- if ( nRow > rSpellRange.aEnd.Row() )
- pCell = NULL;
- }
- }
-
- if (!pCell) // end of range reached -> next sheet
- {
- ++nTab;
- if ( nTab > rSpellRange.aEnd.Tab() || nTab >= static_cast<SCTAB>(maTabs.size()) || !maTabs[nTab] )
- nTab = rSpellRange.aStart.Tab();
- nCol = rSpellRange.aStart.Col();
- nRow = rSpellRange.aStart.Row();
-
- nVisSpellState = VSPL_DONE; //! only if this is for the visible range
- }
- rSpellPos.Set( nCol, nRow, nTab );
-
- delete pDefaults;
- delete pEngine; // bevor aStatus out of scope geht
-
- return bChanged;
-}
-
-
-bool ScDocument::ContinueOnlineSpelling()
-{
- if (!mbIdleEnabled || !pDocOptions->IsAutoSpell() || (pShell && pShell->IsReadOnly()))
- return 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 );
-
- //! use one EditEngine for both calls
-
- // first check visible range
- bool bResult = OnlineSpellInRange( aVisSpellRange, aVisSpellPos, SPELL_MAXTEST_VIS );
-
- // during first pass through visible range, always continue
- if ( nVisSpellState == VSPL_START )
- bResult = true;
-
- if (bResult)
- {
- // if errors found, continue there
- OnlineSpellInRange( aVisSpellRange, aVisSpellPos, SPELL_MAXTEST_ALL );
- }
- else
- {
- // if nothing found there, continue with rest of document
- ScRange aTotalRange( 0,0,0, MAXCOL,MAXROW,MAXTAB );
- bResult = OnlineSpellInRange( aTotalRange, aOnlineSpellPos, SPELL_MAXTEST_ALL );
- }
-
- SetInsertingFromOtherDoc( bOldInserting );
-
- return bResult;
-}
-
-
void ScDocument::SetOnlineSpellPos( const ScAddress& rPos )
{
aOnlineSpellPos = rPos;
@@ -974,32 +751,6 @@ void ScDocument::SetOnlineSpellPos( const ScAddress& rPos )
aOnlineSpellPos = aVisSpellRange.aEnd;
}
-bool ScDocument::SetVisibleSpellRange( const ScRange& rNewRange )
-{
- bool bChange = ( aVisSpellRange != rNewRange );
- if (bChange)
- {
- // continue spelling through visible range when scrolling down
- 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() );
-
- aVisSpellRange = rNewRange;
-
- if ( !bContDown )
- {
- aVisSpellPos = aVisSpellRange.aStart;
- nVisSpellState = VSPL_START;
- }
-
- // skip visible area for aOnlineSpellPos
- if ( aVisSpellRange.In( aOnlineSpellPos ) )
- aOnlineSpellPos = aVisSpellRange.aEnd;
- }
- return bChange;
-}
-
void ScDocument::RemoveAutoSpellObj()
{
// alle Spelling-Informationen entfernen