summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-11-29 15:32:39 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2021-11-29 21:31:21 +0100
commit7a2616501bba1225df3f6bc0225c3d5a7a692002 (patch)
tree88d8436059c9e88495936c7c9b8101036eeb8263
parentc395be2cce7030506b0913a139a4e9a5677f5753 (diff)
tdf#144308: don't cache DoAutoComplete/AutoInput in ScInputHandler
The setting from /org.openoffice.Office.Calc/Input is already cached in ScModule::m_pAppCfg; synchronizing the two mentioned places was done in commit 8810812e58f1b014d3156235c1ab5a2d6c73c828. Another existing cache in ScInputHandler only complicates things, making the behavior inconsistent when configuring through registry, com.sun.star.sheet.GlobalSheetSettings, and menu. So just read the setting when needed from ScModule in methods of ScInputHandler. For lok, use ScModelObj::initializeForTiledRendering to set it up (as was done in 65990058f041c3f1d280a69d411eb4ceacf5a721). Change-Id: I102d3360aeb45b301f04f4c8bbee1191c23fe0e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126002 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sc/source/ui/app/inputhdl.cxx32
-rw-r--r--sc/source/ui/app/scmod.cxx1
-rw-r--r--sc/source/ui/inc/inputhdl.hxx4
-rw-r--r--sc/source/ui/unoobj/docuno.cxx5
4 files changed, 11 insertions, 31 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 6466c30576f0..f4540b11ddee 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -96,9 +96,6 @@
using namespace formula;
-bool ScInputHandler::bOptLoaded = false; // Evaluate App options
-bool ScInputHandler::bAutoComplete = false; // Is set in KeyInput
-
namespace {
// Formula data replacement character for a pair of parentheses at end of
@@ -846,12 +843,6 @@ ScInputHandler::ScInputHandler()
pDelayTimer.reset( new Timer( "ScInputHandlerDelay timer" ) );
pDelayTimer->SetTimeout( 500 ); // 500 ms delay
pDelayTimer->SetInvokeHandler( LINK( this, ScInputHandler, DelayTimer ) );
-
- if (comphelper::LibreOfficeKit::isActive())
- {
- ScInputHandler::bOptLoaded = true; // Evaluate App options
- ScInputHandler::bAutoComplete = true; // Is set in KeyInput
- }
}
ScInputHandler::~ScInputHandler()
@@ -2543,7 +2534,7 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn
UpdateAdjust( cTyped );
- if ( bAutoComplete )
+ if ( SC_MOD()->GetAppOptions().GetAutoComplete() )
GetColData();
if ( !aStr.isEmpty() && ( aStr[0] == '=' || aStr[0] == '+' || aStr[0] == '-' ) &&
@@ -2757,13 +2748,14 @@ void ScInputHandler::UpdateFormulaMode()
bFormulaMode = true;
pRefViewSh = pActiveViewSh;
pSfxApp->Broadcast( SfxHint( SfxHintId::ScRefModeChanged ) );
- SC_MOD()->SetRefInputHdl(this);
+ ScModule* pMod = SC_MOD();
+ pMod->SetRefInputHdl(this);
if (pInputWin)
pInputWin->SetFormulaMode(true);
// in LOK, we always need to perform the GetFormulaData() call so
// that the formula insertion works
- if (bAutoComplete || comphelper::LibreOfficeKit::isActive())
+ if (comphelper::LibreOfficeKit::isActive() || pMod->GetAppOptions().GetAutoComplete())
GetFormulaData();
UpdateParenthesis();
@@ -3210,7 +3202,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
mpEditEngine->ClearSpellErrors();
pObject = mpEditEngine->CreateTextObject();
}
- else if (bAutoComplete) // Adjust Upper/Lower case
+ else if (SC_MOD()->GetAppOptions().GetAutoComplete()) // Adjust Upper/Lower case
{
// Perform case-matching only when the typed text is partial.
if (pColumnData && aAutoSearch.getLength() < aString.getLength())
@@ -3629,12 +3621,6 @@ void ScInputHandler::ClearText()
bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, bool bStartEdit /* = false */ )
{
- if (!bOptLoaded)
- {
- bAutoComplete = SC_MOD()->GetAppOptions().GetAutoComplete();
- bOptLoaded = true;
- }
-
vcl::KeyCode aCode = rKEvt.GetKeyCode();
sal_uInt16 nModi = aCode.GetModifier();
bool bShift = aCode.IsShift();
@@ -3855,7 +3841,7 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, bool bStartEdit /* = false
}
// AutoInput:
- if ( bUsed && bAutoComplete )
+ if ( bUsed && SC_MOD()->GetAppOptions().GetAutoComplete() )
{
bUseTab = false;
if (pFormulaData)
@@ -3999,12 +3985,6 @@ void ScInputHandler::InputCommand( const CommandEvent& rCEvt )
}
else
{
- if (!bOptLoaded)
- {
- bAutoComplete = SC_MOD()->GetAppOptions().GetAutoComplete();
- bOptLoaded = true;
- }
-
HideTip();
HideTipBelow();
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 8463e67618a0..bbc711bee057 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -392,7 +392,6 @@ void ScModule::Execute( SfxRequest& rReq )
bool bNew = !aNewOpts.GetAutoComplete();
aNewOpts.SetAutoComplete( bNew );
SetAppOptions( aNewOpts );
- ScInputHandler::SetAutoComplete( bNew );
if (pBindings)
pBindings->Invalidate( FID_AUTOCOMPLETE );
rReq.Done();
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index fb3880e97a69..0bc24bcd51db 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -126,8 +126,6 @@ private:
std::unique_ptr<ScRangeFindList>
pRangeFindList;
- static bool bAutoComplete; // from app options
- static bool bOptLoaded;
::std::set< sal_Unicode > maFormulaChar; //fdo 75264
private:
@@ -291,8 +289,6 @@ public:
void SetDocumentDisposing( bool b );
- static void SetAutoComplete(bool bSet) { bAutoComplete = bSet; }
-
static ReferenceMark GetReferenceMark( const ScViewData& rViewData, ScDocShell* pDocSh,
tools::Long nX1, tools::Long nX2, tools::Long nY1, tools::Long nY2,
tools::Long nTab, const Color& rColor );
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 7e05bf657e6a..23305f7bf32a 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1195,6 +1195,11 @@ void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans
{
SolarMutexGuard aGuard;
+ // enable word autocompletion
+ ScAppOptions aAppOptions(SC_MOD()->GetAppOptions());
+ aAppOptions.SetAutoComplete(true);
+ SC_MOD()->SetAppOptions(aAppOptions);
+
for (const beans::PropertyValue& rValue : rArguments)
{
if (rValue.Name == ".uno:SpellOnline" && rValue.Value.has<bool>())