[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Fri Dec 8 19:37:28 UTC 2017
sc/source/ui/view/formatsh.cxx | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
New commits:
commit 39854837073158555ee26bee9254d1e5ac36a215
Author: Eike Rathke <erack at redhat.com>
Date: Fri Dec 8 20:32:30 2017 +0100
Slightly change state method logic, tdf#86085 follow-up
It is unnecessary to obtain the SvNumberformat, we already have
the type information of the selection, so use that if the item
state is not DONTCARE.
Also, SfxRequest::Done() needs to be called in the excute method
to flag the slot execution as not cancelled.
Change-Id: I2fbb8df9b8233fc45552540b996bc6b45a16cbc2
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 3ffb0c2db725..5cd763ef286d 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1148,7 +1148,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
pDoc->GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat);
const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat);
- if(pEntry)
+ if (pEntry)
eLanguage = pEntry->GetLanguage();
pFormatter->GetFormatSpecialInfo(nCurrentNumberFormat, bThousand, bNegRed, nPrecision, nLeadZeroes);
@@ -1164,6 +1164,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
aSet.Put(SfxBoolItem(nSlot, bThousand));
rBindings.Invalidate(nSlot);
+ rReq.Done();
}
break;
case SID_NUMBER_FORMAT:
@@ -2524,23 +2525,28 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
{
case SID_NUMBER_THOUSANDS:
{
- const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat );
- if ( SfxItemState::DONTCARE != rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) &&
- pFormatEntry && ( pFormatEntry->GetType() &
- ( css::util::NumberFormat::NUMBER |
- css::util::NumberFormat::PERCENT |
- css::util::NumberFormat::CURRENCY |
- css::util::NumberFormat::FRACTION ) ) )
+ bool bEnable = (SfxItemState::DONTCARE != rAttrSet.GetItemState( ATTR_VALUE_FORMAT ));
+ if (bEnable)
{
- bool bThousand( false );
- bool bNegRed( false );
- sal_uInt16 nPrecision( 0 );
- sal_uInt16 nLeadZeroes( 0 );
- pFormatter->GetFormatSpecialInfo( nNumberFormat, bThousand, bNegRed, nPrecision, nLeadZeroes );
- rSet.Put( SfxBoolItem( nWhich, bThousand ) );
+ bEnable = ((nType != css::util::NumberFormat::ALL) && (nType &
+ (css::util::NumberFormat::NUMBER |
+ css::util::NumberFormat::PERCENT |
+ css::util::NumberFormat::CURRENCY |
+ css::util::NumberFormat::FRACTION)));
+ if (bEnable)
+ {
+ bool bThousand( false );
+ bool bNegRed( false );
+ sal_uInt16 nPrecision( 0 );
+ sal_uInt16 nLeadZeroes( 0 );
+ pFormatter->GetFormatSpecialInfo( nNumberFormat, bThousand, bNegRed, nPrecision, nLeadZeroes);
+ rSet.Put( SfxBoolItem( nWhich, bThousand));
+ }
}
- else
+ if (!bEnable)
+ {
rSet.DisableItem( nWhich );
+ }
}
break;
case SID_NUMBER_FORMAT:
More information about the Libreoffice-commits
mailing list