[Libreoffice-commits] core.git: officecfg/registry sc/inc sc/sdi sc/source sc/uiconfig
Jim Raykowski
raykowj at gmail.com
Fri Dec 8 17:34:31 UTC 2017
officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 8 +
sc/inc/sc.hrc | 1
sc/sdi/formatsh.sdi | 1
sc/sdi/scalc.sdi | 18 +++
sc/source/ui/view/formatsh.cxx | 55 +++++++++-
sc/source/ui/view/tabview3.cxx | 1
sc/uiconfig/scalc/menubar/menubar.xml | 2
7 files changed, 85 insertions(+), 1 deletion(-)
New commits:
commit 92eb84ec047cd091d467fd02c8e8bc8d85002b2e
Author: Jim Raykowski <raykowj at gmail.com>
Date: Thu Nov 30 20:17:20 2017 -0900
tdf#86085 add slot for toggling thousands separator
In preparation of adding a button to the toolbar.
Change-Id: Icd97f828def1aacbb92297e8e74bdd2310c4d0f8
Reviewed-on: https://gerrit.libreoffice.org/45731
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index d4fd477c22e6..065f4c3f9ac2 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1916,6 +1916,14 @@
<value>1</value>
</prop>
</node>
+ <node oor:name=".uno:NumberFormatThousands" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Thousands Separator</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
<node oor:name=".uno:EditLinks" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Edit Lin~ks...</value>
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 5c128a402ee8..7d2da96617bd 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -107,6 +107,7 @@
#define SID_NUMBER_TIME (SC_VIEW_START + 56)
#define SID_NUMBER_INCDEC (SC_VIEW_START + 57)
#define SID_NUMBER_DECDEC (SC_VIEW_START + 58)
+#define SID_NUMBER_THOUSANDS (SC_VIEW_START + 59)
// misc:
#define SID_LINKS (SC_VIEW_START + 60)
diff --git a/sc/sdi/formatsh.sdi b/sc/sdi/formatsh.sdi
index 54771a8dbb80..7c188bba403b 100644
--- a/sc/sdi/formatsh.sdi
+++ b/sc/sdi/formatsh.sdi
@@ -113,6 +113,7 @@ interface FormatForSelection
SID_NUMBER_STANDARD [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
SID_NUMBER_INCDEC [ ExecMethod = ExecuteNumFormat;]
SID_NUMBER_DECDEC [ ExecMethod = ExecuteNumFormat;]
+ SID_NUMBER_THOUSANDS [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
SID_NUMBER_TYPE_FORMAT [ ExecMethod = ExecuteNumFormat;StateMethod = GetNumFormatState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index db1a738fe8c8..071ed56e250f 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -3723,6 +3723,24 @@ SfxVoidItem NumberFormatTime SID_NUMBER_TIME
]
+SfxVoidItem NumberFormatThousands SID_NUMBER_THOUSANDS
+()
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = SfxGroupId::Format;
+]
+
+
SfxInt32Item ObjectHeight SID_OBJECT_HEIGHT
[
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 005a1c7a5174..3ffb0c2db725 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1013,6 +1013,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
case SID_NUMBER_FORMAT:
case SID_NUMBER_INCDEC:
case SID_NUMBER_DECDEC:
+ case SID_NUMBER_THOUSANDS:
case FID_DEFINE_NAME:
case FID_ADD_NAME:
case FID_USE_NAME:
@@ -1133,7 +1134,38 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
pTabViewShell->ChangeNumFmtDecimals( false );
rReq.Done();
break;
-
+ case SID_NUMBER_THOUSANDS:
+ {
+ ScDocument* pDoc = pViewData->GetDocument();
+ SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ sal_uInt32 nCurrentNumberFormat;
+ bool bThousand(false);
+ bool bNegRed(false);
+ sal_uInt16 nPrecision(0);
+ sal_uInt16 nLeadZeroes(0);
+ LanguageType eLanguage = ScGlobal::eLnge;
+
+ pDoc->GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat);
+ const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat);
+
+ if(pEntry)
+ eLanguage = pEntry->GetLanguage();
+
+ pFormatter->GetFormatSpecialInfo(nCurrentNumberFormat, bThousand, bNegRed, nPrecision, nLeadZeroes);
+ bThousand = !bThousand;
+ OUString aCode = pFormatter->GenerateFormat(
+ nCurrentNumberFormat,
+ eLanguage,
+ bThousand,
+ bNegRed,
+ nPrecision,
+ nLeadZeroes);
+ pTabViewShell->SetNumFmtByStr(aCode);
+
+ aSet.Put(SfxBoolItem(nSlot, bThousand));
+ rBindings.Invalidate(nSlot);
+ }
+ break;
case SID_NUMBER_FORMAT:
// symphony version with format interpretation
if(pReqArgs)
@@ -2490,6 +2522,27 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
{
switch ( nWhich )
{
+ 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 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
+ rSet.DisableItem( nWhich );
+ }
+ break;
case SID_NUMBER_FORMAT:
// symphony version with format interpretation
{
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 69bc8035b421..d1db0c9e9d97 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -323,6 +323,7 @@ void ScTabView::InvalidateAttribs()
rBindings.Invalidate( SID_NUMBER_TWODEC );
rBindings.Invalidate( SID_NUMBER_TIME );
rBindings.Invalidate( SID_NUMBER_STANDARD );
+ rBindings.Invalidate( SID_NUMBER_THOUSANDS );
}
// SetCursor - Cursor, set, draw, update InputWin
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml
index 0a4136d3c242..98b754f5748b 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -374,6 +374,8 @@
<menu:menuitem menu:id=".uno:NumberFormatDate"/>
<menu:menuitem menu:id=".uno:NumberFormatTime"/>
<menu:menuitem menu:id=".uno:NumberFormatScientific"/>
+ <menu:menuseparator/>
+ <menu:menuitem menu:id=".uno:NumberFormatThousands"/>
</menu:menupopup>
</menu:menu>
<menu:menuseparator/>
More information about the Libreoffice-commits
mailing list