[Libreoffice-commits] core.git: Branch 'feature/calc-online-spellcheck' - 8 commits - editeng/source include/editeng sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Sun Sep 1 11:28:34 PDT 2013
editeng/source/editeng/editdoc.cxx | 19 +++++++++++
editeng/source/editeng/editdoc.hxx | 3 +
editeng/source/editeng/editeng.cxx | 5 +++
editeng/source/editeng/impedit.hxx | 1
editeng/source/editeng/impedit4.cxx | 6 +++
include/editeng/editeng.hxx | 1
sc/inc/column.hxx | 2 -
sc/inc/dociter.hxx | 7 ----
sc/inc/document.hxx | 6 ---
sc/inc/spellcheckcontext.hxx | 4 ++
sc/inc/table.hxx | 2 -
sc/source/core/data/column2.cxx | 46 ----------------------------
sc/source/core/data/dociter.cxx | 11 ------
sc/source/core/data/documen8.cxx | 38 -----------------------
sc/source/core/data/table4.cxx | 6 ---
sc/source/ui/app/inputhdl.cxx | 16 ++++++----
sc/source/ui/app/scmod.cxx | 14 +-------
sc/source/ui/app/uiitems.cxx | 47 +++++++++++++++++------------
sc/source/ui/docshell/docfunc.cxx | 1
sc/source/ui/inc/gridwin.hxx | 3 +
sc/source/ui/inc/tabview.hxx | 7 ++++
sc/source/ui/inc/uiitems.hxx | 9 +++++
sc/source/ui/view/cellsh3.cxx | 5 ++-
sc/source/ui/view/gridwin.cxx | 51 +++++++++++++++++++++++++++++++-
sc/source/ui/view/gridwin2.cxx | 9 ++++-
sc/source/ui/view/spellcheckcontext.cxx | 32 ++++++++++++++++++++
sc/source/ui/view/tabview.cxx | 33 ++++++++++++++++++++
sc/source/ui/view/tabview4.cxx | 3 +
sc/source/ui/view/tabvwsh4.cxx | 4 +-
sc/source/ui/view/viewfun3.cxx | 8 +++--
sc/source/ui/view/viewfunc.cxx | 4 ++
31 files changed, 243 insertions(+), 160 deletions(-)
New commits:
commit 820c7a94bf43697661a71206da254bbad5a2e9a0
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sun Sep 1 14:31:36 2013 -0400
Reset auto spell data in the view shell instead of in the doc shell.
It makes more sense that way.
Change-Id: Ib2e2167228b1c2a2a19a750477652e18ae69d105
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index acbee87..15355ee 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -2010,9 +2010,6 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
rDocShell.ErrorMessage(STR_INSERT_FULL); // Spalte/Zeile voll
}
- if (pViewSh)
- pViewSh->ResetAutoSpell();
-
aModificator.SetDocumentModified();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
@@ -2494,10 +2491,6 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
}
}
- ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
- if (pViewSh)
- pViewSh->ResetAutoSpell();
-
aModificator.SetDocumentModified();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index ec74970..aa4b9e9 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1268,11 +1268,9 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc,
true, false, bIncludeFiltered );
}
-
pDocSh->UpdatePaintExt( nExtFlags, nStartCol, nStartRow, nStartTab,
nEndCol, nEndRow, nEndTab ); // content after the change
-
// ggf. Autofilter-Koepfe loeschen
if (bCutMode)
if (pDoc->RefreshAutoFilter( nClipStartX,nClipStartY, nClipStartX+nClipSizeX,
@@ -1355,6 +1353,7 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc,
nPaint, nExtFlags);
// AdjustBlockHeight has already been called above
+ ResetAutoSpell();
aModificator.SetDocumentModified();
PostPasteFromClip(aUserRange, rMark);
@@ -1530,6 +1529,8 @@ bool ScViewFunc::PasteMultiRangesFromClip(
pUndoMgr->LeaveListAction();
}
+
+ ResetAutoSpell();
aModificator.SetDocumentModified();
PostPasteFromClip(aMarkedRange, aMark);
return true;
@@ -1686,6 +1687,8 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
pUndoMgr->AddUndoAction(pUndo, false);
pUndoMgr->LeaveListAction();
}
+
+ ResetAutoSpell();
aModificator.SetDocumentModified();
PostPasteFromClip(aRanges, aMark);
@@ -1808,6 +1811,7 @@ sal_Bool ScViewFunc::MoveBlockTo( const ScRange& rSource, const ScAddress& rDest
pDocSh->UpdateOle(GetViewData());
SelectionChanged();
+ ResetAutoSpell();
}
return bSuccess;
}
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 2096db7..6e026fb 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1489,6 +1489,7 @@ sal_Bool ScViewFunc::InsertCells( InsCellCmd eCmd, sal_Bool bRecord, sal_Bool bP
{
pDocSh->UpdateOle(GetViewData());
CellContentChanged();
+ ResetAutoSpell();
// #i97876# Spreadsheet data changes are not notified
ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
@@ -1552,6 +1553,7 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd, sal_Bool bRecord )
pDocSh->UpdateOle(GetViewData());
CellContentChanged();
+ ResetAutoSpell();
// #i97876# Spreadsheet data changes are not notified
ScModelObj* pModelObj = ScModelObj::getImplementation( pDocSh->GetModel() );
@@ -1750,6 +1752,8 @@ void ScViewFunc::DeleteMulti( sal_Bool bRows, sal_Bool bRecord )
pDocSh->PostPaint( static_cast<SCCOL>(pRanges[0]),0,nTab,
MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_TOP );
}
+
+ ResetAutoSpell();
aModificator.SetDocumentModified();
CellContentChanged();
commit c88109e954645b1bb9149978616fcc903d534fa6
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sun Sep 1 14:06:07 2013 -0400
Fix a crash when inserting a multi-line content into cell.
Change-Id: Idf2b6ca6873860a9bb3d2dae646b0383435e58c9
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 3fefacb..d091980 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1732,6 +1732,12 @@ sal_Unicode ContentNode::GetChar(sal_uInt16 nPos) const
return maString.GetChar(nPos);
}
+void ContentNode::EnsureWrongList()
+{
+ if (!mpWrongList)
+ CreateWrongList();
+}
+
WrongList* ContentNode::GetWrongList()
{
return mpWrongList.get();
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index b2928a6..3a4a4a0 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -283,6 +283,7 @@ public:
void CreateDefFont();
+ void EnsureWrongList();
WrongList* GetWrongList();
const WrongList* GetWrongList() const;
void SetWrongList( WrongList* p );
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 72bfa89..1b094f3 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2285,6 +2285,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, bool bSpellAtC
if ( pThisNodeOnly )
pNode = pThisNodeOnly;
+ pNode->EnsureWrongList();
if (!pNode->GetWrongList()->IsValid())
{
WrongList* pWrongList = pNode->GetWrongList();
commit bd33aa7b3b9e8b90a985057a81c7b0eea13bfc5c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sun Sep 1 13:57:52 2013 -0400
Separate misspelled ranges when entering a new cell value.
And store them at appropriate locations.
Change-Id: Iaf38c0cd01e9b3dc9dc98f7ccc1951d572a422e9
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 8cd17b7..3fefacb 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1893,6 +1893,14 @@ public:
}
};
+struct ClearSpellErrorsHandler : std::unary_function<ContentNode, void>
+{
+ void operator() (ContentNode& rNode)
+ {
+ rNode.DestroyWrongList();
+ }
+};
+
}
void EditDoc::ImplDestroyContents()
@@ -2215,6 +2223,11 @@ EditPaM EditDoc::Clear()
return aPaM;
}
+void EditDoc::ClearSpellErrors()
+{
+ std::for_each(maContents.begin(), maContents.end(), ClearSpellErrorsHandler());
+}
+
void EditDoc::SetModified( bool b )
{
bModified = b;
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 1a6d1d0..b2928a6 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -750,6 +750,8 @@ public:
EditDoc( SfxItemPool* pItemPool );
~EditDoc();
+ void ClearSpellErrors();
+
bool IsModified() const { return bModified; }
void SetModified( bool b );
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 4e34071..e3309d4 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2327,6 +2327,11 @@ EESpellState EditEngine::HasSpellErrors()
return pImpEditEngine->HasSpellErrors();
}
+void EditEngine::ClearSpellErrors()
+{
+ pImpEditEngine->ClearSpellErrors();
+}
+
void EditEngine::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc)
{
DBG_CHKTHIS( EditEngine, 0 );
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index b62bc02..34075af 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -907,6 +907,7 @@ public:
void DoOnlineSpelling( ContentNode* pThisNodeOnly = 0, bool bSpellAtCursorPos = false, bool bInteruptable = true );
EESpellState Spell( EditView* pEditView, sal_Bool bMultipleDoc );
EESpellState HasSpellErrors();
+ void ClearSpellErrors();
EESpellState StartThesaurus( EditView* pEditView );
::com::sun::star::uno::Reference<
::com::sun::star::linguistic2::XSpellAlternatives >
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 99a9101..72bfa89 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2484,6 +2484,11 @@ EESpellState ImpEditEngine::HasSpellErrors()
return EE_SPELL_ERRORFOUND;
}
+void ImpEditEngine::ClearSpellErrors()
+{
+ aEditDoc.ClearSpellErrors();
+}
+
EESpellState ImpEditEngine::StartThesaurus( EditView* pEditView )
{
EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() );
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 7545317..c7debc4 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -416,6 +416,7 @@ public:
// For fast Pre-Test without view:
EESpellState HasSpellErrors();
+ void ClearSpellErrors();
sal_Bool HasText( const SvxSearchItem& rSearchItem );
//initialize sentence spelling
diff --git a/sc/inc/spellcheckcontext.hxx b/sc/inc/spellcheckcontext.hxx
index 5d81ad5..e3f3f74 100644
--- a/sc/inc/spellcheckcontext.hxx
+++ b/sc/inc/spellcheckcontext.hxx
@@ -49,6 +49,7 @@ struct SpellCheckContext
bool isMisspelled( SCCOL nCol, SCROW nRow ) const;
const std::vector<editeng::MisspellRanges>* getMisspellRanges( SCCOL nCol, SCROW nRow ) const;
+ void setMisspellRanges( SCCOL nCol, SCROW nRow, const std::vector<editeng::MisspellRanges>* pRanges );
void reset();
};
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 42cbbb1..7454a74 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -38,6 +38,7 @@
#include <editeng/unolingu.hxx>
#include <editeng/wghtitem.hxx>
#include <editeng/justifyitem.hxx>
+#include "editeng/misspellrange.hxx"
#include <sfx2/bindings.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/dispatch.hxx>
@@ -2557,6 +2558,7 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
}
}
+ std::vector<editeng::MisspellRanges> aMisspellRanges;
pEngine->CompleteOnlineSpelling();
bool bSpellErrors = !bFormulaMode && pEngine->HasOnlineSpellErrors();
if ( bSpellErrors )
@@ -2646,7 +2648,7 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
bool bAttrib = false; // Formatierung vorhanden ?
// check if EditObject is needed
- if ( bSpellErrors || nParCnt > 1 )
+ if (nParCnt > 1)
bAttrib = true;
else
{
@@ -2683,15 +2685,15 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
// (der Test vorher ist trotzdem noetig wegen Zell-Attributen)
}
+ if (bSpellErrors)
+ pEngine->GetAllMisspellRanges(aMisspellRanges);
+
if (bMatrix)
bAttrib = false;
if (bAttrib)
{
- sal_uLong nCtrl = pEngine->GetControlWord();
- sal_uLong nWantBig = bSpellErrors ? EE_CNTRL_ALLOWBIGOBJS : 0;
- if ( ( nCtrl & EE_CNTRL_ALLOWBIGOBJS ) != nWantBig )
- pEngine->SetControlWord( (nCtrl & ~EE_CNTRL_ALLOWBIGOBJS) | nWantBig );
+ pEngine->ClearSpellErrors();
pObject = pEngine->CreateTextObject();
}
else if (bAutoComplete) // Gross-/Kleinschreibung anpassen
@@ -2797,6 +2799,10 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
ScInputStatusItem aItem( FID_INPUTLINE_STATUS,
aCursorPos, aCursorPos, aCursorPos,
aString, pObject );
+
+ if (!aMisspellRanges.empty())
+ aItem.SetMisspellRanges(&aMisspellRanges);
+
const SfxPoolItem* aArgs[2];
aArgs[0] = &aItem;
aArgs[1] = NULL;
diff --git a/sc/source/ui/app/uiitems.cxx b/sc/source/ui/app/uiitems.cxx
index d26337d..ab83063 100644
--- a/sc/source/ui/app/uiitems.cxx
+++ b/sc/source/ui/app/uiitems.cxx
@@ -45,28 +45,27 @@ TYPEINIT1(ScIndexHint, SfxHint);
// ScInputStatusItem - Status-Update fuer Eingabezeile
// -----------------------------------------------------------------------
-ScInputStatusItem::ScInputStatusItem( sal_uInt16 nWhichP,
- const ScAddress& rCurPos,
- const ScAddress& rStartPos,
- const ScAddress& rEndPos,
- const OUString& rString,
- const EditTextObject* pData )
- : SfxPoolItem ( nWhichP ),
- aCursorPos ( rCurPos ),
- aStartPos ( rStartPos ),
- aEndPos ( rEndPos ),
- aString ( rString ),
- pEditData ( pData ? pData->Clone() : NULL )
+ScInputStatusItem::ScInputStatusItem(
+ sal_uInt16 nWhichP, const ScAddress& rCurPos, const ScAddress& rStartPos,
+ const ScAddress& rEndPos, const OUString& rString, const EditTextObject* pData ) :
+ SfxPoolItem ( nWhichP ),
+ aCursorPos ( rCurPos ),
+ aStartPos ( rStartPos ),
+ aEndPos ( rEndPos ),
+ aString ( rString ),
+ pEditData ( pData ? pData->Clone() : NULL ),
+ mpMisspellRanges(NULL)
{
}
-ScInputStatusItem::ScInputStatusItem( const ScInputStatusItem& rItem )
- : SfxPoolItem ( rItem ),
- aCursorPos ( rItem.aCursorPos ),
- aStartPos ( rItem.aStartPos ),
- aEndPos ( rItem.aEndPos ),
- aString ( rItem.aString ),
- pEditData ( rItem.pEditData ? rItem.pEditData->Clone() : NULL )
+ScInputStatusItem::ScInputStatusItem( const ScInputStatusItem& rItem ) :
+ SfxPoolItem ( rItem ),
+ aCursorPos ( rItem.aCursorPos ),
+ aStartPos ( rItem.aStartPos ),
+ aEndPos ( rItem.aEndPos ),
+ aString ( rItem.aString ),
+ pEditData ( rItem.pEditData ? rItem.pEditData->Clone() : NULL ),
+ mpMisspellRanges(rItem.mpMisspellRanges)
{
}
@@ -96,6 +95,16 @@ SfxPoolItem* ScInputStatusItem::Clone( SfxItemPool * ) const
return new ScInputStatusItem( *this );
}
+void ScInputStatusItem::SetMisspellRanges( const std::vector<editeng::MisspellRanges>* pRanges )
+{
+ mpMisspellRanges = pRanges;
+}
+
+const std::vector<editeng::MisspellRanges>* ScInputStatusItem::GetMisspellRanges() const
+{
+ return mpMisspellRanges;
+}
+
//
// ScPaintHint ist nach schints.cxx verschoben
//
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index cbb774b..4288342 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -394,6 +394,7 @@ public:
bool ContinueOnlineSpelling();
void EnableAutoSpell( bool bEnable );
void ResetAutoSpell();
+ void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges );
void DeleteCopySourceOverlay();
void UpdateCopySourceOverlay();
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index cb94eb8..4964e6d 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -30,6 +30,10 @@
#include <boost/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>
+namespace editeng {
+ struct MisspellRanges;
+}
+
class ScEditEngineDefaulter;
class ScGridWindow;
class ScOutlineWindow;
@@ -524,6 +528,7 @@ public:
bool ContinueOnlineSpelling();
void EnableAutoSpell( bool bEnable );
void ResetAutoSpell();
+ void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges );
};
diff --git a/sc/source/ui/inc/uiitems.hxx b/sc/source/ui/inc/uiitems.hxx
index d475289..a74a08d 100644
--- a/sc/source/ui/inc/uiitems.hxx
+++ b/sc/source/ui/inc/uiitems.hxx
@@ -27,8 +27,13 @@
#include "paramisc.hxx"
#include <svl/poolitem.hxx>
+#include <vector>
#include <boost/scoped_ptr.hpp>
+namespace editeng {
+ struct MisspellRanges;
+}
+
class ScEditEngineDefaulter;
class EditTextObject;
class ScViewData;
@@ -46,6 +51,7 @@ class ScInputStatusItem : public SfxPoolItem
ScAddress aEndPos;
OUString aString;
EditTextObject* pEditData;
+ const std::vector<editeng::MisspellRanges>* mpMisspellRanges;
public:
TYPEINFO();
@@ -77,6 +83,9 @@ public:
const OUString& GetString() const { return aString; }
const EditTextObject* GetEditData() const { return pEditData; }
+
+ void SetMisspellRanges( const std::vector<editeng::MisspellRanges>* pRanges );
+ const std::vector<editeng::MisspellRanges>* GetMisspellRanges() const;
};
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 5830838..aa1aeea 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -232,6 +232,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
ScAddress aCursorPos = pStatusItem->GetPos();
String aString = pStatusItem->GetString();
const EditTextObject* pData = pStatusItem->GetEditData();
+
if (pData)
{
if (nSlot == FID_INPUTLINE_BLOCK)
@@ -285,9 +286,11 @@ void ScCellShell::Execute( SfxRequest& rReq )
pTabViewShell->EnterMatrix( aString, pDoc->GetGrammar() );
rReq.Done();
}
-
}
+ pTabViewShell->SetAutoSpellData(
+ aCursorPos.Col(), aCursorPos.Row(), pStatusItem->GetMisspellRanges());
+
// no GrabFocus here, as otherwise on a Mac the tab jumps before the
// sideview, when the input was not finished
// (GrabFocus is called in KillEditView)
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 6949b8f..692fcec 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5533,6 +5533,17 @@ void ScGridWindow::ResetAutoSpell()
}
}
+void ScGridWindow::SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges )
+{
+ if (!mpSpellCheckCxt)
+ return;
+
+ if (!maVisibleRange.isInside(nPosX, nPosY))
+ return;
+
+ mpSpellCheckCxt->setMisspellRanges(nPosX, nPosY, pRanges);
+}
+
// #114409#
void ScGridWindow::CursorChanged()
{
diff --git a/sc/source/ui/view/spellcheckcontext.cxx b/sc/source/ui/view/spellcheckcontext.cxx
index d6cec23..66c218e 100644
--- a/sc/source/ui/view/spellcheckcontext.cxx
+++ b/sc/source/ui/view/spellcheckcontext.cxx
@@ -71,6 +71,26 @@ const std::vector<editeng::MisspellRanges>* SpellCheckContext::getMisspellRanges
return &it->second;
}
+void SpellCheckContext::setMisspellRanges(
+ SCCOL nCol, SCROW nRow, const std::vector<editeng::MisspellRanges>* pRanges )
+{
+ CellPos aPos(nCol, nRow);
+ CellMapType::iterator it = maMisspellCells.find(aPos);
+
+ if (pRanges)
+ {
+ if (it == maMisspellCells.end())
+ maMisspellCells.insert(CellMapType::value_type(aPos, *pRanges));
+ else
+ it->second = *pRanges;
+ }
+ else
+ {
+ if (it != maMisspellCells.end())
+ maMisspellCells.erase(it);
+ }
+}
+
void SpellCheckContext::reset()
{
maPos.reset();
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 2e9e612..7feb1b7 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2369,4 +2369,15 @@ void ScTabView::ResetAutoSpell()
}
}
+void ScTabView::SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges )
+{
+ for (int i = 0; i < 4; ++i)
+ {
+ if (!pGridWin[i])
+ continue;
+
+ pGridWin[i]->SetAutoSpellData(nPosX, nPosY, pRanges);
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d5b44b64caa2f28c2acfd3213b5fbfb98ed75ff9
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sun Sep 1 11:39:57 2013 -0400
Reset autospell data when inserting/deleting cells.
Change-Id: I4ec48afe4a1aebe96dfb0fe5d507c786bdecae66
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index d0b0e50..acbee87 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -2010,6 +2010,9 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
rDocShell.ErrorMessage(STR_INSERT_FULL); // Spalte/Zeile voll
}
+ if (pViewSh)
+ pViewSh->ResetAutoSpell();
+
aModificator.SetDocumentModified();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
@@ -2490,6 +2493,11 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
rDocShell.PostPaint( nPaintStartCol, nPaintStartRow, *itr, nPaintEndCol, nPaintEndRow, *itr+nScenarioCount, PAINT_TOP );
}
}
+
+ ScTabViewShell* pViewSh = rDocShell.GetBestViewShell();
+ if (pViewSh)
+ pViewSh->ResetAutoSpell();
+
aModificator.SetDocumentModified();
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) );
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 91a3774..cbb774b 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -393,6 +393,7 @@ public:
void DrawLayerCreated();
bool ContinueOnlineSpelling();
void EnableAutoSpell( bool bEnable );
+ void ResetAutoSpell();
void DeleteCopySourceOverlay();
void UpdateCopySourceOverlay();
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 75215e8..cb94eb8 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -523,6 +523,7 @@ public:
bool ContinueOnlineSpelling();
void EnableAutoSpell( bool bEnable );
+ void ResetAutoSpell();
};
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 03dc2aa..6949b8f 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5523,6 +5523,16 @@ void ScGridWindow::EnableAutoSpell( bool bEnable )
mpSpellCheckCxt.reset();
}
+void ScGridWindow::ResetAutoSpell()
+{
+ if (mpSpellCheckCxt)
+ {
+ mpSpellCheckCxt->reset();
+ mpSpellCheckCxt->maPos.mnCol = maVisibleRange.mnCol1;
+ mpSpellCheckCxt->maPos.mnRow = maVisibleRange.mnRow1;
+ }
+}
+
// #114409#
void ScGridWindow::CursorChanged()
{
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 2a057b5..ba28604 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -607,10 +607,7 @@ bool ScGridWindow::UpdateVisibleRange()
// Store the current visible range.
bool bChanged = maVisibleRange.set(nPosX, nPosY, nXRight, nYBottom);
if (bChanged)
- {
- if (mpSpellCheckCxt)
- mpSpellCheckCxt->reset();
- }
+ ResetAutoSpell();
return bChanged;
}
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 599b5a6..2e9e612 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2358,4 +2358,15 @@ void ScTabView::EnableAutoSpell( bool bEnable )
}
}
+void ScTabView::ResetAutoSpell()
+{
+ for (int i = 0; i < 4; ++i)
+ {
+ if (!pGridWin[i])
+ continue;
+
+ pGridWin[i]->ResetAutoSpell();
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d8c5263994f5a16c926fd17aa42589b8da21cd18
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sun Sep 1 10:56:29 2013 -0400
These pieces of code are no longer needed.
Change-Id: I93a4abc84856a43d9d3a27ebadf111e589c62604
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 4322c24..7308d22 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -431,8 +431,6 @@ public:
bool TestTabRefAbs(SCTAB nTable) const;
bool GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& rData) const;
- void RemoveAutoSpellObj();
-
void StartListening( SvtListener& rLst, SCROW nRow );
void EndListening( SvtListener& rLst, SCROW nRow );
void StartListening( sc::StartListeningContext& rCxt, SCROW nRow, SvtListener& rListener );
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index 23e310d..8a57ef3 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -440,13 +440,6 @@ public:
/// Set a(nother) sheet and (re)init.
void SetTab( SCTAB nTab );
- /**
- * When modifying a cell while still in iteration, call this to re-fetch
- * the column iterators used internally because the old iterators have
- * been invalidated.
- */
- void RehashCol( SCCOL nCol );
-
private:
void Advance();
};
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index e8aa17d..b91e8d3 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -315,9 +315,6 @@ private:
ScRange aEmbedRange;
ScAddress aCurTextWidthCalcPos;
- ScAddress aOnlineSpellPos; // within whole document
- ScRange aVisSpellRange;
- ScAddress aVisSpellPos; // within aVisSpellRange (see nVisSpellState)
Timer aTrackTimer;
@@ -1658,9 +1655,6 @@ public:
bool IsDetectiveDirty() const { return bDetectiveDirty; }
void SetDetectiveDirty(bool bSet) { bDetectiveDirty = bSet; }
- void RemoveAutoSpellObj();
- void SetOnlineSpellPos( const ScAddress& rPos );
-
sal_uInt8 GetMacroCallMode() const { return nMacroCallMode; }
void SetMacroCallMode(sal_uInt8 nNew) { nMacroCallMode = nNew; }
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 99c506b..69d2520 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -308,8 +308,6 @@ public:
void SetPageSize( const Size& rSize );
void SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
- void RemoveAutoSpellObj();
-
void LockTable();
void UnlockTable();
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 9edca5f..855be2e 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1019,45 +1019,6 @@ public:
}
};
-class RemoveAutoSpellObjHandler : public StrEntries
-{
- ScDocument* mpDoc;
- boost::scoped_ptr<ScTabEditEngine> mpEngine;
-
-public:
- RemoveAutoSpellObjHandler(sc::CellStoreType& rCells, ScDocument* pDoc) : StrEntries(rCells), mpDoc(pDoc) {}
-
- void operator() (size_t nRow, EditTextObject*& pObj)
- {
- // no query on HasOnlineSpellErrors, this makes it also work after loading
-
- // For the test on hard formatting (ScEditAttrTester), are the defaults in the
- // EditEngine of no importance. When the tester would later recognise the same
- // attributes in default and hard formatting and has to remove them, the correct
- // defaults must be set in the EditEngine for each cell.
-
- // test for attributes
- if (!mpEngine)
- mpEngine.reset(new ScTabEditEngine(mpDoc));
-
- mpEngine->SetText(*pObj);
-
- ScEditAttrTester aTester(mpEngine.get());
- if (aTester.NeedsObject()) // only remove spelling errors
- {
- // Overwrite the existing object.
- delete pObj;
- pObj = mpEngine->CreateTextObject();
- }
- else
- {
- // Store the string replacement for later commits.
- OUString aText = ScEditUtil::GetSpaceDelimitedString(*mpEngine);
- maStrEntries.push_back(StrEntry(nRow, aText));
- }
- }
-};
-
class RemoveEditAttribsHandler : public StrEntries
{
ScDocument* mpDoc;
@@ -1138,13 +1099,6 @@ public:
}
-void ScColumn::RemoveAutoSpellObj()
-{
- RemoveAutoSpellObjHandler aFunc(maCells, pDocument);
- sc::ProcessEditText(maCells, aFunc);
- aFunc.commitStrings();
-}
-
void ScColumn::RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow )
{
RemoveEditAttribsHandler aFunc(maCells, pDocument);
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index a31b7aa..f951ea3 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1724,17 +1724,6 @@ void ScHorizontalCellIterator::SetTab( SCTAB nTabP )
Advance();
}
-void ScHorizontalCellIterator::RehashCol( SCCOL nCol )
-{
- if (nCol < nStartCol || nEndCol < nCol)
- return;
-
- ColParam& rParam = maColPositions[nCol-nStartCol];
- ScColumn& rCol = pDoc->maTabs[mnTab]->aCol[nCol];
- rParam.maPos = rCol.maCells.position(mnRow).first;
- rParam.maEnd = rCol.maCells.end();
-}
-
ScRefCellValue* ScHorizontalCellIterator::GetNext( SCCOL& rCol, SCROW& rRow )
{
if (!bMore)
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 67fb76a..db94928 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -721,44 +721,6 @@ bool ScDocument::IdleCalcTextWidth() // true = demnaechst wieder vers
return aScope.getNeedMore();
}
-//------------------------------------------------------------------------
-
-class ScSpellStatus
-{
-public:
- bool bModified;
-
- ScSpellStatus() : bModified(false) {};
-
- DECL_LINK (EventHdl, EditStatus*);
-};
-
-IMPL_LINK( ScSpellStatus, EventHdl, EditStatus *, pStatus )
-{
- sal_uLong nStatus = pStatus->GetStatusWord();
- if ( nStatus & EE_STAT_WRONGWORDCHANGED )
- bModified = true;
-
- return 0;
-}
-
-void ScDocument::SetOnlineSpellPos( const ScAddress& rPos )
-{
- aOnlineSpellPos = rPos;
-
- // skip visible area for aOnlineSpellPos
- if ( aVisSpellRange.In( aOnlineSpellPos ) )
- aOnlineSpellPos = aVisSpellRange.aEnd;
-}
-
-void ScDocument::RemoveAutoSpellObj()
-{
- // alle Spelling-Informationen entfernen
-
- for (SCTAB nTab=0; nTab< static_cast<SCTAB>(maTabs.size()) && maTabs[nTab]; nTab++)
- maTabs[nTab]->RemoveAutoSpellObj();
-}
-
void ScDocument::RepaintRange( const ScRange& rRange )
{
if ( bIsVisible && pShell )
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 3797a90..339ae4a 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -2055,12 +2055,6 @@ bool ScTable::GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel,
return false;
}
-void ScTable::RemoveAutoSpellObj()
-{
- for (SCCOL i=0; i <= MAXCOL; i++)
- aCol[i].RemoveAutoSpellObj();
-}
-
bool ScTable::TestTabRefAbs(SCTAB nTable) const
{
for (SCCOL i=0; i <= MAXCOL; i++)
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 20c2168..2fe4540 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1218,14 +1218,6 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
aNewOpt.SetAutoSpell( bDoAutoSpell );
pDoc->SetDocOptions( aNewOpt );
- if (bDoAutoSpell)
- pDoc->SetOnlineSpellPos( ScAddress(0,0,0) ); // vorne anfangen
- else
- {
- WaitObject aWait( pDocSh->GetActiveDialogParent() );
- pDoc->RemoveAutoSpellObj(); // Edit-Text-Objekte wieder zurueckwandeln
- }
-
if (pViewSh)
pViewSh->EnableAutoSpell(bDoAutoSpell);
commit 7d615176c0c594e617f628875cb0b6869d00a17e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sun Sep 1 10:39:13 2013 -0400
Repaint grid view when the visible area changes.
Change-Id: I2fe1e103b3d7c6a51a2f845e27fee0cfb6309847
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index a643736..20c2168 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1229,10 +1229,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
if (pViewSh)
pViewSh->EnableAutoSpell(bDoAutoSpell);
- //#92038#; don't set document modified, because this flag is no longer saved
-// pDocSh->SetDocumentModified();
-
- bRepaint = sal_True; // weil HideAutoSpell evtl. ungueltig
+ bRepaint = true; // weil HideAutoSpell evtl. ungueltig
//! alle Views painten ???
}
}
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index c945165..2a057b5 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -605,7 +605,7 @@ bool ScGridWindow::UpdateVisibleRange()
if (nYBottom > MAXROW) nYBottom = MAXROW;
// Store the current visible range.
- bool bChanged = maVisibleRange.set(nPosX, nPosY, nXRight, nYBottom);
+ bool bChanged = maVisibleRange.set(nPosX, nPosY, nXRight, nYBottom);
if (bChanged)
{
if (mpSpellCheckCxt)
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index a7c4fac..3aa9a47 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -428,7 +428,10 @@ void ScTabView::UpdateScrollBars()
if ( aViewData.IsActive() )
{
if (UpdateVisibleRange())
+ {
SC_MOD()->AnythingChanged(); // if visible area has changed
+ PaintGrid();
+ }
}
}
commit 5cc8605de6f62853b74fcaf4b617af9b5a0f5366
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sun Sep 1 09:46:07 2013 -0400
Handle enabling / disabling of auto spell check.
Change-Id: I8f3fe06a41b825f233f4116ae8ba3b30cb4f1adc
diff --git a/sc/inc/spellcheckcontext.hxx b/sc/inc/spellcheckcontext.hxx
index c92cee4..5d81ad5 100644
--- a/sc/inc/spellcheckcontext.hxx
+++ b/sc/inc/spellcheckcontext.hxx
@@ -34,6 +34,7 @@ struct SpellCheckContext
void setInvalid();
bool isValid() const;
+ void reset();
bool operator< (const CellPos& r) const;
bool operator== (const CellPos& r) const;
@@ -48,6 +49,8 @@ struct SpellCheckContext
bool isMisspelled( SCCOL nCol, SCROW nRow ) const;
const std::vector<editeng::MisspellRanges>* getMisspellRanges( SCCOL nCol, SCROW nRow ) const;
+
+ void reset();
};
}
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 37dee2f..a643736 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1226,6 +1226,9 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
pDoc->RemoveAutoSpellObj(); // Edit-Text-Objekte wieder zurueckwandeln
}
+ if (pViewSh)
+ pViewSh->EnableAutoSpell(bDoAutoSpell);
+
//#92038#; don't set document modified, because this flag is no longer saved
// pDocSh->SetDocumentModified();
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index ba55617..91a3774 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -392,6 +392,7 @@ public:
void CursorChanged();
void DrawLayerCreated();
bool ContinueOnlineSpelling();
+ void EnableAutoSpell( bool bEnable );
void DeleteCopySourceOverlay();
void UpdateCopySourceOverlay();
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 69d9c54..75215e8 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -522,6 +522,7 @@ public:
void SetInRefMode( bool bRefMode );
bool ContinueOnlineSpelling();
+ void EnableAutoSpell( bool bEnable );
};
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 7fc7050..03dc2aa 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -445,7 +445,6 @@ ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhic
mpOOHeader( NULL ),
mpOOShrink( NULL ),
mpAutoFillRect(static_cast<Rectangle*>(NULL)),
- mpSpellCheckCxt(new sc::SpellCheckContext),
pViewData( pData ),
eWhich( eWhichPos ),
pNoteMarker( NULL ),
@@ -5386,6 +5385,9 @@ IMPL_LINK(SpellCheckStatus, EventHdl, EditStatus*, pStatus)
bool ScGridWindow::ContinueOnlineSpelling()
{
+ if (!mpSpellCheckCxt)
+ return false;
+
if (!mpSpellCheckCxt->maPos.isValid())
return false;
@@ -5513,6 +5515,14 @@ bool ScGridWindow::ContinueOnlineSpelling()
return bChanged;
}
+void ScGridWindow::EnableAutoSpell( bool bEnable )
+{
+ if (bEnable)
+ mpSpellCheckCxt.reset(new sc::SpellCheckContext);
+ else
+ mpSpellCheckCxt.reset();
+}
+
// #114409#
void ScGridWindow::CursorChanged()
{
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index c104b46..c945165 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -40,9 +40,10 @@
#include "checklistmenu.hrc"
#include "strload.hxx"
#include "userlist.hxx"
+#include "scabstdlg.hxx"
+#include "spellcheckcontext.hxx"
#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
-#include "scabstdlg.hxx"
#include <vector>
#include <boost/unordered_map.hpp>
@@ -604,7 +605,14 @@ bool ScGridWindow::UpdateVisibleRange()
if (nYBottom > MAXROW) nYBottom = MAXROW;
// Store the current visible range.
- return maVisibleRange.set(nPosX, nPosY, nXRight, nYBottom);
+ bool bChanged = maVisibleRange.set(nPosX, nPosY, nXRight, nYBottom);
+ if (bChanged)
+ {
+ if (mpSpellCheckCxt)
+ mpSpellCheckCxt->reset();
+ }
+
+ return bChanged;
}
void ScGridWindow::DPMouseMove( const MouseEvent& rMEvt )
diff --git a/sc/source/ui/view/spellcheckcontext.cxx b/sc/source/ui/view/spellcheckcontext.cxx
index c064d2b..d6cec23 100644
--- a/sc/source/ui/view/spellcheckcontext.cxx
+++ b/sc/source/ui/view/spellcheckcontext.cxx
@@ -33,6 +33,12 @@ bool SpellCheckContext::CellPos::isValid() const
return mnCol >= 0 && mnRow >= 0;
}
+void SpellCheckContext::CellPos::reset()
+{
+ mnCol = 0;
+ mnRow = 0;
+}
+
bool SpellCheckContext::CellPos::operator< (const CellPos& r) const
{
if (mnCol != r.mnCol)
@@ -65,6 +71,12 @@ const std::vector<editeng::MisspellRanges>* SpellCheckContext::getMisspellRanges
return &it->second;
}
+void SpellCheckContext::reset()
+{
+ maPos.reset();
+ maMisspellCells.clear();
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 3be9f36..599b5a6 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2347,4 +2347,15 @@ bool ScTabView::ContinueOnlineSpelling()
return bChanged;
}
+void ScTabView::EnableAutoSpell( bool bEnable )
+{
+ for (int i = 0; i < 4; ++i)
+ {
+ if (!pGridWin[i])
+ continue;
+
+ pGridWin[i]->EnableAutoSpell(bEnable);
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 33478ae..3be788d 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -82,6 +82,7 @@
#include "defaultsoptions.hxx"
#include "markdata.hxx"
#include "preview.hxx"
+#include "docoptio.hxx"
#include <com/sun/star/document/XDocumentProperties.hpp>
@@ -1475,9 +1476,10 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode )
SfxApplication* pSfxApp = SFX_APP();
ScDocShell* pDocSh = GetViewData()->GetDocShell();
ScDocument* pDoc = pDocSh->GetDocument();
-
bReadOnly = pDocSh->IsReadOnly();
+ EnableAutoSpell(pDoc->GetDocOptions().IsAutoSpell());
+
SetName(OUString("View")); // fuer SBX
Color aColBlack( COL_BLACK );
SetPool( &SC_MOD()->GetPool() );
commit d2744d37716a3105a202c576c4eddd7095080191
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sun Sep 1 09:09:00 2013 -0400
Be sure to skip pivot table ranges.
Change-Id: I3e57960374772756d31e392966bbf00c9fa5b6e0
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index e91d74f..7fc7050 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5390,12 +5390,20 @@ bool ScGridWindow::ContinueOnlineSpelling()
return false;
ScDocument* pDoc = pViewData->GetDocument();
+ ScDPCollection* pDPs = NULL;
+ if (pDoc->HasPivotTable())
+ pDPs = pDoc->GetDPCollection();
+
SCTAB nTab = pViewData->GetTabNo();
SpellCheckStatus aStatus;
ScHorizontalCellIterator aIter(
pDoc, nTab, maVisibleRange.mnCol1, mpSpellCheckCxt->maPos.mnRow, maVisibleRange.mnCol2, maVisibleRange.mnRow2);
+ ScRangeList aPivotRanges;
+ if (pDPs)
+ aPivotRanges = pDPs->GetAllTableRanges(nTab);
+
SCCOL nCol;
SCROW nRow;
ScRefCellValue* pCell = aIter.GetNext(nCol, nRow);
@@ -5416,6 +5424,16 @@ bool ScGridWindow::ContinueOnlineSpelling()
{
++nTotalCellCount;
+ if (aPivotRanges.In(ScAddress(nCol, nRow, nTab)))
+ {
+ // Don't spell check within pivot tables.
+ if (nTotalCellCount >= 255)
+ break;
+
+ pCell = aIter.GetNext(nCol, nRow);
+ continue;
+ }
+
CellType eType = pCell->meType;
if (eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT)
{
More information about the Libreoffice-commits
mailing list