sc/source/core/tool/interpr2.cxx | 64 ++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 33 deletions(-)
New commits: commit 8b4d64c8916364d96c03dd371fe802413861ba7d Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Feb 10 16:44:37 2023 +0300 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Feb 13 11:54:02 2023 +0000 Flatten ScInterpreter::ScStyle Change-Id: I64c622d2c2cacccc7eda02e8739657fe345f9be8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146777 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 2844670d2a47c606cbebb99f73389f30154a3c5e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146767 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index a417c9d4ba74..b1492bb1c77e 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -2596,48 +2596,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,