diff options
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 20 | ||||
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 1 |
2 files changed, 19 insertions, 2 deletions
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index d68d801f8034..db32a2bcbe82 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1036,9 +1036,18 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) switch ( nSlot ) { case SID_NUMBER_TWODEC: - pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER, 4 ); // Standard+4 = #.##0,00 + { + const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); + sal_uInt32 nNumberFormat = static_cast<const SfxUInt32Item&>(rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue(); + + if ((nType & css::util::NumberFormat::NUMBER) && nNumberFormat == 4) + pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER ); + else + pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER, 4 ); + rBindings.Invalidate( nSlot ); rReq.Done(); - break; + } + break; case SID_NUMBER_SCIENTIFIC: if ((nType & css::util::NumberFormat::SCIENTIFIC)) pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER ); @@ -2597,6 +2606,13 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) case SID_NUMBER_TIME: rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::TIME)) ); break; + case SID_NUMBER_TWODEC: + { + const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); + sal_uInt32 nNumberFormat = static_cast<const SfxUInt32Item&>(rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue(); + rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::NUMBER) && nNumberFormat == 4 ) ); + } + break; } nWhich = aIter.NextWhich(); } diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index abbd807a1ade..9c63bdb7d242 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -319,6 +319,7 @@ void ScTabView::InvalidateAttribs() rBindings.Invalidate( SID_NUMBER_DATE ); rBindings.Invalidate( SID_NUMBER_CURRENCY ); rBindings.Invalidate( SID_NUMBER_PERCENT ); + rBindings.Invalidate( SID_NUMBER_TWODEC ); rBindings.Invalidate( SID_NUMBER_TIME ); } |