diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-02-19 14:37:19 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-02-23 15:27:43 +0100 |
commit | e208b81540d43e2b7d3012dfe6bebc59ce638c12 (patch) | |
tree | fbd26689203c4f0fa64a0c742f0d68606c269841 | |
parent | 16700331da2087bbb53c1774605cef2d0411206a (diff) |
Don't reformat all connectors every time spellchecking timer fires
Editing document with many (~1k) connectors eats all available CPU
power as every spellchecking event locks and then unlocks SdrModel
which in turn repositions ALL connectors in entire document, so let's
not do that
Additionally, set OutlinerParaObject and broadcast only when something
has actually changed
Change-Id: I647b7309729dce153b8e05eff4677fe7bb9840a7
Reviewed-on: https://gerrit.libreoffice.org/49995
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r-- | sd/source/core/drawdoc4.cxx | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index 8b584df557da..9fec6a7b947b 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -896,20 +896,24 @@ void SdDrawDocument::SpellObject(SdrTextObj* pObj) if (mbHasOnlineSpellErrors) { - sd::ModifyGuard aGuard( this ); - SdrModel* pModel = pObj->GetModel(); - bool bLock = false; - if ( pModel ) + OutlinerParaObject* pOPO = pOutl->CreateParaObject(); + if (pOPO) { - bLock = pModel->isLocked(); - pModel->setLock(true); + if (!( *pOPO == *pObj->GetOutlinerParaObject() ) || + !pObj->GetOutlinerParaObject()->isWrongListEqual( *pOPO )) + { + sd::ModifyGuard aGuard( this ); + + // taking text from the outliner + pObj->SetOutlinerParaObject( pOPO ); + // SetOPO takes care of broadcasting object change + + pOPO = nullptr; + } + else + delete pOPO; } - // taking text from the outliner - pObj->SetOutlinerParaObject( pOutl->CreateParaObject() ); - pObj->BroadcastObjectChange(); - if ( pModel ) - pModel->setLock(bLock); } } |