summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-12-08 21:21:10 +0100
committerEike Rathke <erack@redhat.com>2017-12-08 21:34:35 +0100
commita5d40188c6f59f3b51d1415ce1f34bf896f75c4c (patch)
treec32e702bf569371881f085819d63adebfd50ce3f
parent20f532b0db9c0c9fd2abdb68db43749ba643f1b2 (diff)
Call GetItemState() only once per WhichID loop
Change-Id: Ic14015692bc934f06fb8371216ae5e3e1afe5afd
-rw-r--r--sc/source/ui/view/formatsh.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 5cd763ef286d..713f2938b827 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2512,6 +2512,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
ScDocument* pDoc = pViewData->GetDocument();
short nType = GetCurrentNumberFormatType();
const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
+ const SfxItemState eItemState = rAttrSet.GetItemState( ATTR_VALUE_FORMAT );
sal_uInt32 nNumberFormat = rAttrSet.Get(ATTR_VALUE_FORMAT).GetValue();
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
NfIndexTableOffset nOffset = pFormatter->GetIndexTableOffset(nNumberFormat);
@@ -2525,7 +2526,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
{
case SID_NUMBER_THOUSANDS:
{
- bool bEnable = (SfxItemState::DONTCARE != rAttrSet.GetItemState( ATTR_VALUE_FORMAT ));
+ bool bEnable = (SfxItemState::DONTCARE != eItemState);
if (bEnable)
{
bEnable = ((nType != css::util::NumberFormat::ALL) && (nType &
@@ -2552,7 +2553,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
case SID_NUMBER_FORMAT:
// symphony version with format interpretation
{
- if(SfxItemState::DONTCARE != rAttrSet.GetItemState(ATTR_VALUE_FORMAT))
+ if(SfxItemState::DONTCARE != eItemState)
{
bool bThousand(false);
bool bNegRed(false);
@@ -2596,7 +2597,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
case SID_NUMBER_TYPE_FORMAT:
{
sal_Int16 aFormatCode = -1;
- if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) >= SfxItemState::DEFAULT ) //Modify for more robust
+ if ( eItemState >= SfxItemState::DEFAULT ) //Modify for more robust
{
const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat );
bool bStandard = false;