summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-12-08 21:33:49 +0100
committerEike Rathke <erack@redhat.com>2017-12-08 21:34:35 +0100
commit0c003b9acf14b426ae7c4193ca24718211294e3f (patch)
tree68e8323f660a8fb4fc62f0ee058730132efed08b /sc
parenta5d40188c6f59f3b51d1415ce1f34bf896f75c4c (diff)
Avoid iterating over selected cells' attribute ranges
Change-Id: Ieb233f6e952dfea0461976c3a7ea9df862f72969
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/formatsh.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 713f2938b827..cac33f075b87 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2510,11 +2510,17 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
{
ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
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();
+ // If item state is default or set it
+ // indicates one number format so we
+ // don't have to iterate over all
+ // selected cells' attribute ranges to
+ // determine selected types.
+ const short nType = (eItemState >= SfxItemState::DEFAULT ? pFormatter->GetType( nNumberFormat) :
+ GetCurrentNumberFormatType());
NfIndexTableOffset nOffset = pFormatter->GetIndexTableOffset(nNumberFormat);
SfxWhichIter aIter(rSet);