diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2016-04-17 16:36:04 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-04-20 14:26:40 +0000 |
commit | cbae4ec3c9733c16ae69cfc5a23c9a54aadc7fc3 (patch) | |
tree | 88cb89f134495b2141d35c57160503af4c7f429c /sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx | |
parent | SvDDEObject::nError is never read (diff) | |
download | core-cbae4ec3c9733c16ae69cfc5a23c9a54aadc7fc3.tar.gz core-cbae4ec3c9733c16ae69cfc5a23c9a54aadc7fc3.zip |
tdf#99361 Separate checkbox in Sidebar
"Thousands Separator" and "Engineering notation" used the same checkbox,
so help tips texts were the same.
This commit creates a second checkbox which is hiden/shown
according to category selected
Change-Id: I804c2c7b4625497da8e423a952b357fbd8bbfa19
Reviewed-on: https://gerrit.libreoffice.org/24173
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx')
-rw-r--r-- | sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx index 49c1ef96991e..13f0f5312f32 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -20,7 +20,6 @@ #include <sfx2/sidebar/ResourceDefinitions.hrc> #include <sfx2/sidebar/ControlFactory.hxx> #include "NumberFormatPropertyPanel.hxx" -#include <NumberFormatPropertyPanel.hrc> #include "sc.hrc" #include "scresid.hxx" #include <sfx2/bindings.hxx> @@ -43,8 +42,6 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel( const css::uno::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) : PanelLayout(pParent,"NumberFormatPropertyPanel", "modules/scalc/ui/sidebarnumberformat.ui", rxFrame), - maThousandSeparator(ScResId(RID_SFX_STR_THOUSAND_SEP)), - maEngineeringNotation(ScResId(RID_SFX_STR_ENGINEERING)), maNumFormatControl(SID_NUMBER_TYPE_FORMAT, *pBindings, *this), maFormatControl(SID_NUMBER_FORMAT, *pBindings, *this), @@ -52,12 +49,13 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel( maContext(), mpBindings(pBindings) { - get(mpLbCategory, "category"); - get(mpTBCategory, "numberformat"); - get(mpEdDecimals, "decimalplaces"); - get(mpEdLeadZeroes, "leadingzeroes"); - get(mpBtnNegRed, "negativenumbersred"); - get(mpBtnThousand, "thousandseparator"); + get(mpLbCategory, "category"); + get(mpTBCategory, "numberformat"); + get(mpEdDecimals, "decimalplaces"); + get(mpEdLeadZeroes, "leadingzeroes"); + get(mpBtnNegRed, "negativenumbersred"); + get(mpBtnThousand, "thousandseparator"); + get(mpBtnEngineering, "engineeringnotation"); Initialize(); } @@ -75,6 +73,7 @@ void NumberFormatPropertyPanel::dispose() mpEdLeadZeroes.clear(); mpBtnNegRed.clear(); mpBtnThousand.clear(); + mpBtnEngineering.clear(); maNumFormatControl.dispose(); maFormatControl.dispose(); @@ -98,6 +97,7 @@ void NumberFormatPropertyPanel::Initialize() mpBtnNegRed->SetClickHdl( LINK(this, NumberFormatPropertyPanel, NumFormatValueClickHdl) ); mpBtnThousand->SetClickHdl( LINK(this, NumberFormatPropertyPanel, NumFormatValueClickHdl) ); + mpBtnEngineering->SetClickHdl( LINK(this, NumberFormatPropertyPanel, NumFormatValueClickHdl) ); mpTBCategory->SetAccessibleRelationLabeledBy(mpTBCategory); } @@ -120,16 +120,15 @@ IMPL_LINK_NOARG_TYPED( NumberFormatPropertyPanel, NumFormatValueClickHdl, Button } IMPL_LINK_NOARG_TYPED( NumberFormatPropertyPanel, NumFormatValueHdl, Edit&, void ) { - OUString aFormat; - OUString sBreak = ","; - bool bThousand = mpBtnThousand->IsEnabled() - && mpBtnThousand->IsChecked(); - bool bNegRed = mpBtnNegRed->IsEnabled() - && mpBtnNegRed->IsChecked(); - sal_uInt16 nPrecision = (mpEdDecimals->IsEnabled()) + OUString aFormat; + OUString sBreak = ","; + bool bThousand = ( mpBtnThousand->IsVisible() && mpBtnThousand->IsEnabled() && mpBtnThousand->IsChecked() ) + || ( mpBtnEngineering->IsVisible() && mpBtnEngineering->IsEnabled() && mpBtnEngineering->IsChecked() ); + bool bNegRed = mpBtnNegRed->IsEnabled() && mpBtnNegRed->IsChecked(); + sal_uInt16 nPrecision = (mpEdDecimals->IsEnabled()) ? (sal_uInt16)mpEdDecimals->GetValue() : (sal_uInt16)0; - sal_uInt16 nLeadZeroes = (mpEdLeadZeroes->IsEnabled()) + sal_uInt16 nLeadZeroes = (mpEdLeadZeroes->IsEnabled()) ? (sal_uInt16)mpEdLeadZeroes->GetValue() : (sal_uInt16)0; @@ -207,25 +206,36 @@ void NumberFormatPropertyPanel::NotifyItemUpdate( if( nVal < 4 || // General, Number, Percent and Currency nVal == 6 ) // scientific also { - mpBtnThousand->Enable(); + if ( nVal == 6 ) // scientific + { // For scientific, Thousand separator is replaced by Engineering notation + mpBtnThousand->Hide(); + mpBtnEngineering->Show(); + mpBtnEngineering->Enable(); + } + else + { + mpBtnEngineering->Hide(); + mpBtnThousand->Show(); + mpBtnThousand->Enable(); + } mpBtnNegRed->Enable(); mpEdDecimals->Enable(); mpEdLeadZeroes->Enable(); } else { + mpBtnEngineering->Hide(); + mpBtnThousand->Show(); mpBtnThousand->Disable(); mpBtnNegRed->Disable(); mpEdDecimals->Disable(); mpEdLeadZeroes->Disable(); } - if( nVal == 6 ) // For scientific, Thousand separator is replaced by Engineering notation - mpBtnThousand->SetText( maEngineeringNotation ); - else - mpBtnThousand->SetText( maThousandSeparator ); } else { + mpBtnEngineering->Hide(); + mpBtnThousand->Show(); mpLbCategory->SetNoSelection(); mnCategorySelected = 0; mpBtnThousand->Disable(); @@ -265,7 +275,10 @@ void NumberFormatPropertyPanel::NotifyItemUpdate( nPrecision = 0; nLeadZeroes = 1; } - mpBtnThousand->Check(bThousand); + if ( mpBtnThousand->IsVisible() ) + mpBtnThousand->Check(bThousand); + else if ( mpBtnEngineering->IsVisible() ) + mpBtnEngineering->Check(bThousand); mpBtnNegRed->Check(bNegRed); if ( mpLbCategory->GetSelectEntryPos() == 0 ) mpEdDecimals->SetText(""); // tdf#44399 |