diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-02-10 16:44:37 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-02-21 13:08:47 +0000 |
commit | 68b0f41f49678d8faf9b910967315f1f61e6b1d3 (patch) | |
tree | b00f4710848a7b75c955cc9bf97f6974622dc09a | |
parent | b14f914901e50a2dd15cbce7832d72cb5a6a9b9f (diff) |
Flatten ScInterpreter::ScStyle
Change-Id: I64c622d2c2cacccc7eda02e8739657fe345f9be8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146777
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 2844670d2a47c606cbebb99f73389f30154a3c5e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146772
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 632b04643a28..233ec71660cf 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2595,48 +2595,46 @@ void ScInterpreter::ScCurrent() void ScInterpreter::ScStyle() { sal_uInt8 nParamCount = GetByte(); - if (nParamCount >= 1 && nParamCount <= 3) - { - OUString aStyle2; // Template after timer - if (nParamCount >= 3) - aStyle2 = GetString().getString(); - tools::Long nTimeOut = 0; // timeout - if (nParamCount >= 2) - nTimeOut = static_cast<tools::Long>(GetDouble()*1000.0); - OUString aStyle1 = GetString().getString(); // Template for immediate + if (!MustHaveParamCount(nParamCount, 1, 3)) + return; - if (nTimeOut < 0) - nTimeOut = 0; + OUString aStyle2; // Template after timer + if (nParamCount >= 3) + aStyle2 = GetString().getString(); + tools::Long nTimeOut = 0; // timeout + if (nParamCount >= 2) + nTimeOut = static_cast<tools::Long>(GetDouble()*1000.0); + OUString aStyle1 = GetString().getString(); // Template for immediate - // Execute request to apply template - if ( !mrDoc.IsClipOrUndo() ) + if (nTimeOut < 0) + nTimeOut = 0; + + // Execute request to apply template + if ( !mrDoc.IsClipOrUndo() ) + { + SfxObjectShell* pShell = mrDoc.GetDocumentShell(); + if (pShell) { - SfxObjectShell* pShell = mrDoc.GetDocumentShell(); - if (pShell) + // notify object shell directly! + bool bNotify = true; + if (aStyle2.isEmpty()) { - // notify object shell directly! - bool bNotify = true; - if (aStyle2.isEmpty()) - { - const ScStyleSheet* pStyle = mrDoc.GetStyle(aPos.Col(), aPos.Row(), aPos.Tab()); + const ScStyleSheet* pStyle = mrDoc.GetStyle(aPos.Col(), aPos.Row(), aPos.Tab()); - if (pStyle && pStyle->GetName() == aStyle1) - bNotify = false; - } + if (pStyle && pStyle->GetName() == aStyle1) + bNotify = false; + } - if (bNotify) - { - ScRange aRange(aPos); - ScAutoStyleHint aHint( aRange, aStyle1, nTimeOut, aStyle2 ); - pShell->Broadcast( aHint ); - } + if (bNotify) + { + ScRange aRange(aPos); + ScAutoStyleHint aHint( aRange, aStyle1, nTimeOut, aStyle2 ); + pShell->Broadcast( aHint ); } } - - PushDouble(0.0); } - else - PushIllegalParameter(); + + PushDouble(0.0); } static ScDdeLink* lcl_GetDdeLink( const sfx2::LinkManager* pLinkMgr, |