summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorLaurent Balland-Poirier <laurent.balland-poirier@laposte.net>2016-04-18 19:33:10 +0200
committerEike Rathke <erack@redhat.com>2016-04-20 13:33:06 +0000
commitb24cc067695d7986f231303218e7b853d827b316 (patch)
treeb4def15e8277e83f9d9a8a393da2afd7f9ad004b /cui
parent840a48b5ff2e0262680d3ef02c63173f98c07d1c (diff)
tdf#99361 Separate checkbox in Number dialog
"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: I94913e63e47b760deb747ce7cd3d74ab4c109599 Reviewed-on: https://gerrit.libreoffice.org/24224 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/cuires.src10
-rw-r--r--cui/source/inc/cuires.hrc3
-rw-r--r--cui/source/inc/numfmt.hxx5
-rw-r--r--cui/source/tabpages/numfmt.cxx59
-rw-r--r--cui/uiconfig/ui/numberingformatpage.ui44
5 files changed, 74 insertions, 47 deletions
diff --git a/cui/source/dialogs/cuires.src b/cui/source/dialogs/cuires.src
index b0fa5da214c1..57d1708f2418 100644
--- a/cui/source/dialogs/cuires.src
+++ b/cui/source/dialogs/cuires.src
@@ -65,16 +65,6 @@ String RID_SVXSTR_AUTO_ENTRY
Text [ en-US ] = "Automatic";
};
-String RID_SVXSTR_THOUSAND_SEP
-{
- Text [ en-US ] = "Thousands separator";
-};
-
-String RID_SVXSTR_ENGINEERING
-{
- Text [ en-US ] = "Engineering notation";
-};
-
String RID_SVXSTR_EDIT_GRAPHIC
{
Text [ en-US ] = "Link" ;
diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index ac4b7e6734f8..98cbb8dc7e23 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -444,9 +444,6 @@
#define RID_SVXSTR_PERSONA_MUSIC (RID_SVX_START + 1288)
#define RID_SVXSTR_PERSONA_NATURE (RID_SVX_START + 1289)
-#define RID_SVXSTR_THOUSAND_SEP (RID_SVX_START + 1290)
-#define RID_SVXSTR_ENGINEERING (RID_SVX_START + 1291)
-
#define RID_SVXPAGE_OPENCL (RID_SVX_START + 254)
#endif
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx
index df61c578320f..b94788e4ddfe 100644
--- a/cui/source/inc/numfmt.hxx
+++ b/cui/source/inc/numfmt.hxx
@@ -105,6 +105,7 @@ private:
VclPtr<FixedText> m_pFtLeadZeroes;
VclPtr<NumericField> m_pEdLeadZeroes;
VclPtr<CheckBox> m_pBtnThousand;
+ VclPtr<CheckBox> m_pBtnEngineering;
VclPtr<VclContainer> m_pFormatCodeFrame;
VclPtr<Edit> m_pEdFormat;
@@ -127,8 +128,6 @@ private:
short nFixedCategory;
OUString sAutomaticEntry;
- OUString sThousandSeparator;
- OUString sEngineeringNotation;
VclPtr<vcl::Window> pLastActivWindow;
@@ -137,7 +136,7 @@ private:
void FillFormatListBox_Impl( std::vector<OUString>& rEntries );
void UpdateOptions_Impl( bool bCheckCatChange );
void UpdateFormatListBox_Impl( bool bCat, bool bUpdateEdit );
- void UpdateThousandEngineeringText();
+ void UpdateThousandEngineeringCheckBox();
void Obstructing();
void EnableBySourceFormat_Impl();
void SetCategory( sal_uInt16 nPos );
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index f0b3255373c3..ad5bfd2f547f 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -238,8 +238,6 @@ SvxNumberFormatTabPage::SvxNumberFormatTabPage(vcl::Window* pParent,
, pNumFmtShell(nullptr)
, nInitFormat(ULONG_MAX)
, sAutomaticEntry(CUI_RES(RID_SVXSTR_AUTO_ENTRY))
- , sThousandSeparator(CUI_RES(RID_SVXSTR_THOUSAND_SEP))
- , sEngineeringNotation(CUI_RES(RID_SVXSTR_ENGINEERING))
, pLastActivWindow(nullptr)
{
get(m_pFtCategory, "categoryft");
@@ -261,6 +259,7 @@ SvxNumberFormatTabPage::SvxNumberFormatTabPage(vcl::Window* pParent,
get(m_pFtLeadZeroes, "leadzerosft");
get(m_pEdLeadZeroes, "leadzerosed");
get(m_pBtnThousand, "thousands");
+ get(m_pBtnEngineering, "engineering");
get(m_pFormatCodeFrame, "formatcode");
get(m_pEdFormat, "formatted");
get(m_pIbAdd, "add");
@@ -305,6 +304,7 @@ void SvxNumberFormatTabPage::dispose()
m_pFtLeadZeroes.clear();
m_pEdLeadZeroes.clear();
m_pBtnThousand.clear();
+ m_pBtnEngineering.clear();
m_pFormatCodeFrame.clear();
m_pEdFormat.clear();
m_pIbAdd.clear();
@@ -345,14 +345,16 @@ void SvxNumberFormatTabPage::Init_Impl()
m_pEdDecimals->SetModifyHdl( aLink );
m_pEdLeadZeroes->SetModifyHdl( aLink );
+
m_pBtnNegRed->SetClickHdl( LINK( this, SvxNumberFormatTabPage, OptClickHdl_Impl ) );
m_pBtnThousand->SetClickHdl( LINK( this, SvxNumberFormatTabPage, OptClickHdl_Impl ) );
+ m_pBtnEngineering->SetClickHdl( LINK( this, SvxNumberFormatTabPage, OptClickHdl_Impl ) );
m_pLbFormat->SetDoubleClickHdl( HDL( DoubleClickHdl_Impl ) );
m_pEdFormat->SetModifyHdl( HDL( EditModifyHdl_Impl ) );
m_pIbAdd->SetClickHdl( HDL( ClickHdl_Impl ) );
m_pIbRemove->SetClickHdl( HDL( ClickHdl_Impl ) );
m_pIbInfo->SetClickHdl( HDL( ClickHdl_Impl ) );
- UpdateThousandEngineeringText();
+ UpdateThousandEngineeringCheckBox();
m_pEdComment->SetLoseFocusHdl( LINK( this, SvxNumberFormatTabPage, LostFocusHdl_Impl) );
aResetWinTimer.SetTimeoutHdl(LINK( this, SvxNumberFormatTabPage, TimeHdl_Impl));
@@ -631,6 +633,7 @@ void SvxNumberFormatTabPage::Obstructing()
m_pBtnNegRed->Disable();
m_pBtnThousand->Disable();
+ m_pBtnEngineering->Disable();
m_pFtLeadZeroes->Disable();
m_pFtDecimals->Disable();
m_pEdLeadZeroes->Disable();
@@ -640,6 +643,7 @@ void SvxNumberFormatTabPage::Obstructing()
m_pEdLeadZeroes->SetText( OUString() );
m_pBtnNegRed->Check( false );
m_pBtnThousand->Check( false );
+ m_pBtnEngineering->Check( false );
m_pWndPreview->NotifyChange( OUString() );
m_pLbCategory->SelectEntryPos( 0 );
@@ -673,6 +677,7 @@ void SvxNumberFormatTabPage::EnableBySourceFormat_Impl()
m_pEdLeadZeroes->Enable( bEnable );
m_pBtnNegRed->Enable( bEnable );
m_pBtnThousand->Enable( bEnable );
+ m_pBtnEngineering->Enable( bEnable );
m_pFtOptions->Enable( bEnable );
m_pFormatCodeFrame->Enable( bEnable );
m_pLbFormat->Invalidate(); // #i43322#
@@ -956,6 +961,7 @@ void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_Fa
nCategory=nFixedCategory;
}
+ UpdateThousandEngineeringCheckBox();
switch ( nCategory )
{
case CAT_SCIENTIFIC: // bThousand is for Engineering notation
@@ -965,6 +971,8 @@ void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_Fa
bThousand = true;
else
bThousand = false;
+ m_pBtnEngineering->Enable();
+ m_pBtnEngineering->Check( bThousand );
}
// fallthru
case CAT_NUMBER:
@@ -976,14 +984,17 @@ void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_Fa
m_pFtLeadZeroes->Enable();
m_pEdLeadZeroes->Enable();
m_pBtnNegRed->Enable();
- m_pBtnThousand->Enable();
if ( nCategory == CAT_NUMBER && m_pLbFormat->GetSelectEntryPos() == 0 )
m_pEdDecimals->SetText( "" ); //General format tdf#44399
else
m_pEdDecimals->SetText( OUString::number( nDecimals ) );
m_pEdLeadZeroes->SetText( OUString::number( nZeroes ) );
m_pBtnNegRed->Check( bNegRed );
- m_pBtnThousand->Check( bThousand );
+ if ( nCategory != CAT_SCIENTIFIC )
+ {
+ m_pBtnThousand->Enable();
+ m_pBtnThousand->Check( bThousand );
+ }
break;
case CAT_ALL:
@@ -1001,12 +1012,13 @@ void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_Fa
m_pEdLeadZeroes->Disable();
m_pBtnNegRed->Disable();
m_pBtnThousand->Disable();
+ m_pBtnEngineering->Disable();
m_pEdDecimals->SetText( OUString::number( 0 ) );
m_pEdLeadZeroes->SetText( OUString::number( 0 ) );
m_pBtnNegRed->Check( false );
m_pBtnThousand->Check( false );
+ m_pBtnEngineering->Check( false );
}
- UpdateThousandEngineeringText();
}
@@ -1118,11 +1130,11 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl
/*************************************************************************
-#* Method: UpdateThousandEngineeringText
+#* Method: UpdateThousandEngineeringCheckBox
#*------------------------------------------------------------------------
#*
#* Class: SvxNumberFormatTabPage
-#* Function: Updates the text of Thousands separator checkbox
+#* Function: Change visible checkbox according to category format
#* if scientific format "Engineering notation"
#* else "Thousands separator"
#* Input: ---
@@ -1130,12 +1142,11 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl
#*
#************************************************************************/
-void SvxNumberFormatTabPage::UpdateThousandEngineeringText()
+void SvxNumberFormatTabPage::UpdateThousandEngineeringCheckBox()
{
- if ( m_pLbCategory->GetSelectEntryPos() == CAT_SCIENTIFIC )
- m_pBtnThousand->SetText(sEngineeringNotation);
- else
- m_pBtnThousand->SetText(sThousandSeparator);
+ bool bIsScientific = m_pLbCategory->GetSelectEntryPos() == CAT_SCIENTIFIC;
+ m_pBtnThousand->Show( !bIsScientific );
+ m_pBtnEngineering->Show( bIsScientific );
}
@@ -1579,19 +1590,19 @@ void SvxNumberFormatTabPage::OptHdl_Impl( void* pOptCtrl )
if ( (pOptCtrl == m_pEdLeadZeroes)
|| (pOptCtrl == m_pEdDecimals)
|| (pOptCtrl == m_pBtnNegRed)
- || (pOptCtrl == m_pBtnThousand) )
+ || (pOptCtrl == m_pBtnThousand)
+ || (pOptCtrl == m_pBtnEngineering) )
{
OUString aFormat;
- bool bThousand = m_pBtnThousand->IsEnabled()
- && m_pBtnThousand->IsChecked();
- bool bNegRed = m_pBtnNegRed->IsEnabled()
- && m_pBtnNegRed->IsChecked();
- sal_uInt16 nPrecision = (m_pEdDecimals->IsEnabled())
- ? (sal_uInt16)m_pEdDecimals->GetValue()
- : (sal_uInt16)0;
- sal_uInt16 nLeadZeroes = (m_pEdLeadZeroes->IsEnabled())
- ? (sal_uInt16)m_pEdLeadZeroes->GetValue()
- : (sal_uInt16)0;
+ bool bThousand = ( m_pBtnThousand->IsVisible() && m_pBtnThousand->IsEnabled() && m_pBtnThousand->IsChecked() )
+ || ( m_pBtnEngineering->IsVisible() && m_pBtnEngineering->IsEnabled() && m_pBtnEngineering->IsChecked() );
+ bool bNegRed = m_pBtnNegRed->IsEnabled() && m_pBtnNegRed->IsChecked();
+ sal_uInt16 nPrecision = (m_pEdDecimals->IsEnabled())
+ ? (sal_uInt16)m_pEdDecimals->GetValue()
+ : (sal_uInt16)0;
+ sal_uInt16 nLeadZeroes = (m_pEdLeadZeroes->IsEnabled())
+ ? (sal_uInt16)m_pEdLeadZeroes->GetValue()
+ : (sal_uInt16)0;
if ( pNumFmtShell->GetStandardName() == m_pEdFormat->GetText() )
{
m_pEdDecimals->SetValue( nPrecision );
diff --git a/cui/uiconfig/ui/numberingformatpage.ui b/cui/uiconfig/ui/numberingformatpage.ui
index c98755daac22..87039b262656 100644
--- a/cui/uiconfig/ui/numberingformatpage.ui
+++ b/cui/uiconfig/ui/numberingformatpage.ui
@@ -292,14 +292,44 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="thousands">
- <property name="label" translatable="yes">_Thousands separator</property>
+ <object class="GtkBox" id="box1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">0</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="thousands">
+ <property name="label" translatable="yes">_Thousands separator</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="engineering">
+ <property name="label" translatable="yes">_Engineering notation</property>
+ <property name="visible">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">2</property>