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:09:12 +0000 |
commit | 747d528305e160fb6f4f9c6a66010b920c6cfe23 (patch) | |
tree | 5b1784d44276b5e5c0db107d01047b500d25f3f8 | |
parent | a8d01c66b823c3556081f8678059911f1264547f (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/+/146770
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 14d07ae7da98..39f0c96014fa 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, |