summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorLaurent BP <laurent.balland-poirier@laposte.net>2020-05-24 22:30:41 +0200
committerEike Rathke <erack@redhat.com>2020-06-15 19:37:12 +0200
commit1861363d623963461905f42aa0b9dc2301f2eaaa (patch)
treed728c2e2c8f66dcb9cedc00bdcbabe646803c905 /sc
parente542b622aeb70230365971cab4838dbe0b6e0a93 (diff)
tdf#103414 Add/Delete decimal for 100th second
Use Add/Delete decimal to change precision of time and duration Apply only to 100th second Change-Id: I2ff1b01db7ee67645511fcf7ea6bf65055e92a8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94765 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx14
-rw-r--r--sc/source/ui/view/formatsh.cxx4
-rw-r--r--sc/source/ui/view/viewfunc.cxx4
3 files changed, 12 insertions, 10 deletions
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
index eeb46ef316ad..324ebe8f8171 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -197,14 +197,14 @@ void NumberFormatPropertyPanel::NotifyItemUpdate(
sal_uInt16 nVal = pItem->GetValue();
mnCategorySelected = nVal;
mxLbCategory->set_active(nVal);
- if( nVal < 4 || // General, Number, Percent and Currency
- nVal == 6 || // scientific also
- nVal == 7 ) // fraction
+ if (nVal < 8 && // General, Number, Percent, Currency, Time, Scientific, Fraction
+ nVal != 4 ) // not Date
{
bool bIsScientific ( nVal == 6 );// For scientific, Thousand separator is replaced by Engineering notation
bool bIsFraction ( nVal == 7 ); // For fraction, Decimal places is replaced by Denominator places
- mxBtnThousand->set_visible(!bIsScientific);
- mxBtnThousand->set_sensitive(!bIsScientific);
+ bool bIsTime ( nVal == 5 ); // For Time, Decimal places and NegRed available
+ mxBtnThousand->set_visible( !bIsScientific );
+ mxBtnThousand->set_sensitive( !bIsScientific && !bIsTime );
mxBtnThousand->set_active(false);
mxBtnEngineering->set_visible(bIsScientific);
mxBtnEngineering->set_sensitive(bIsScientific);
@@ -218,8 +218,8 @@ void NumberFormatPropertyPanel::NotifyItemUpdate(
mxEdDecimals->set_visible(!bIsFraction);
mxFtDecimals->set_sensitive(!bIsFraction);
mxEdDecimals->set_sensitive(!bIsFraction);
- mxFtLeadZeroes->set_sensitive(true);
- mxEdLeadZeroes->set_sensitive(true);
+ mxFtLeadZeroes->set_sensitive( !bIsTime );
+ mxEdLeadZeroes->set_sensitive( !bIsTime );
}
else
DisableControls();
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 48ee79cafaac..dc685f4996e6 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1165,7 +1165,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
LanguageType eLanguage = pEntry->GetLanguage();
SvNumFormatType eType = pEntry->GetType();
- //Just use eType to judge whether the command is fired for NUMBER/PERCENT/CURRENCY/SCIENTIFIC/FRACTION
+ //Just use eType to judge whether the command is fired for NUMBER/PERCENT/CURRENCY/SCIENTIFIC/FRACTION/TIME
//In sidebar, users can fire SID_NUMBER_FORMAT command by operating the related UI controls before they are disable
if(!(eType == SvNumFormatType::ALL
|| eType == SvNumFormatType::NUMBER
@@ -1176,6 +1176,8 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
|| eType == (SvNumFormatType::CURRENCY | SvNumFormatType::DEFINED)
|| eType == SvNumFormatType::SCIENTIFIC
|| eType == (SvNumFormatType::SCIENTIFIC | SvNumFormatType::DEFINED)
+ || eType == SvNumFormatType::TIME
+ || eType == (SvNumFormatType::TIME | SvNumFormatType::DEFINED)
|| eType == SvNumFormatType::FRACTION
|| eType == (SvNumFormatType::FRACTION | SvNumFormatType::DEFINED)))
pEntry = nullptr;
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index a18986808e1c..ab700220c42a 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2709,9 +2709,9 @@ void ScViewFunc::ChangeNumFmtDecimals( bool bIncrement )
SvNumFormatType nOldType = pOldEntry->GetType();
if ( SvNumFormatType::ALL == ( nOldType & (
- SvNumFormatType::NUMBER | SvNumFormatType::CURRENCY | SvNumFormatType::PERCENT | SvNumFormatType::SCIENTIFIC ) ) )
+ SvNumFormatType::NUMBER | SvNumFormatType::CURRENCY | SvNumFormatType::PERCENT | SvNumFormatType::SCIENTIFIC | SvNumFormatType::TIME ) ) )
{
- // date, time, fraction, logical, text can not be changed
+ // date, fraction, logical, text can not be changed
bError = true;
}