summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorLaurent Balland-Poirier <laurent.balland-poirier@laposte.net>2015-05-03 15:09:20 +0200
committerEike Rathke <erack@redhat.com>2015-05-06 10:45:50 +0000
commitf630f9598f2e328cbe37aff5af0e93c027a94de5 (patch)
tree7b089aa8b8b4ab412037a298c4b0fc2e2308dad4 /cui
parenta5a17610d5eff80387c7330527793de87cc82e58 (diff)
tdf#90258 Toggle Thousand Separator with Engineering Notation
If scientific format is selected, "Thousands separator" option is almost useless. It could be replaced by "Engineering Notation". Rebase of https://gerrit.libreoffice.org/15152 Update with more robust tests. Change-Id: Ie2b88b1f149fce26c32a43ace623cf1f45f38e6e Reviewed-on: https://gerrit.libreoffice.org/15606 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.hxx3
-rw-r--r--cui/source/tabpages/numfmt.cxx38
4 files changed, 52 insertions, 2 deletions
diff --git a/cui/source/dialogs/cuires.src b/cui/source/dialogs/cuires.src
index fe97a9c901c9..a738423f593d 100644
--- a/cui/source/dialogs/cuires.src
+++ b/cui/source/dialogs/cuires.src
@@ -60,6 +60,16 @@ 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 a8cf111a864a..d6852c35c3c3 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -440,6 +440,9 @@
#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 65e9f1aa56e2..c4413ab894fd 100644
--- a/cui/source/inc/numfmt.hxx
+++ b/cui/source/inc/numfmt.hxx
@@ -130,6 +130,8 @@ private:
short nFixedCategory;
OUString sAutomaticEntry;
+ OUString sThousandSeparator;
+ OUString sEngineeringNotation;
VclPtr<vcl::Window> pLastActivWindow;
@@ -138,6 +140,7 @@ private:
void FillFormatListBox_Impl( std::vector<OUString>& rEntries );
void UpdateOptions_Impl( bool bCheckCatChange );
void UpdateFormatListBox_Impl( bool bCat, bool bUpdateEdit );
+ void UpdateThousandEngineeringText();
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 352077ea2721..5720e2d9ccd1 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -243,6 +243,8 @@ SvxNumberFormatTabPage::SvxNumberFormatTabPage(vcl::Window* pParent,
, pNumFmtShell(NULL)
, nInitFormat(ULONG_MAX)
, sAutomaticEntry(CUI_RES(RID_SVXSTR_AUTO_ENTRY))
+ , sThousandSeparator(CUI_RES(RID_SVXSTR_THOUSAND_SEP))
+ , sEngineeringNotation(CUI_RES(RID_SVXSTR_ENGINEERING))
, pLastActivWindow(NULL)
{
get(m_pFtCategory, "categoryft");
@@ -355,6 +357,7 @@ void SvxNumberFormatTabPage::Init_Impl()
m_pIbAdd->SetClickHdl( HDL( ClickHdl_Impl ) );
m_pIbRemove->SetClickHdl( HDL( ClickHdl_Impl ) );
m_pIbInfo->SetClickHdl( HDL( ClickHdl_Impl ) );
+ UpdateThousandEngineeringText();
aLink = LINK( this, SvxNumberFormatTabPage, LostFocusHdl_Impl);
@@ -907,7 +910,7 @@ void SvxNumberFormatTabPage::FillFormatListBox_Impl( std::vector<OUString>& rEnt
void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_False*/ )
{
- OUString theFormat = m_pEdFormat->GetText();
+ OUString theFormat = m_pEdFormat->GetText();
sal_Int32 nCurCategory = m_pLbCategory->GetSelectEntryPos();
sal_uInt16 nCategory = static_cast<sal_uInt16>(nCurCategory);
sal_uInt16 nDecimals = 0;
@@ -965,10 +968,18 @@ void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_Fa
switch ( nCategory )
{
+ case CAT_SCIENTIFIC: // bThousand is for Engineering notation
+ {
+ sal_uInt16 nIntDigits = pNumFmtShell->GetFormatIntegerDigits(theFormat);
+ if ( (nIntDigits > 0) && (nIntDigits % 3 == 0) )
+ bThousand = true;
+ else
+ bThousand = false;
+ }
+ // fallthru
case CAT_NUMBER:
case CAT_PERCENT:
case CAT_CURRENCY:
- case CAT_SCIENTIFIC:
m_pFtOptions->Enable();
m_pFtDecimals->Enable();
m_pEdDecimals->Enable();
@@ -1002,6 +1013,7 @@ void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_Fa
m_pBtnNegRed->Check( false );
m_pBtnThousand->Check( false );
}
+ UpdateThousandEngineeringText();
}
@@ -1113,6 +1125,28 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl
/*************************************************************************
+#* Method: UpdateThousandEngineeringText
+#*------------------------------------------------------------------------
+#*
+#* Class: SvxNumberFormatTabPage
+#* Function: Updates the text of Thousands seprator checkbox
+#* if scientific format "Engineering notation"
+#* else "Thousands separator"
+#* Input: ---
+#* Output: ---
+#*
+#************************************************************************/
+
+void SvxNumberFormatTabPage::UpdateThousandEngineeringText()
+{
+ if ( m_pLbCategory->GetSelectEntryPos() == CAT_SCIENTIFIC )
+ m_pBtnThousand->SetText(sEngineeringNotation);
+ else
+ m_pBtnThousand->SetText(sThousandSeparator);
+}
+
+
+/*************************************************************************
#* Handle: DoubleClickHdl_Impl
#*------------------------------------------------------------------------
#*