Kaydet (Commit) 92eb84ec authored tarafından Jim Raykowski's avatar Jim Raykowski Kaydeden (comit) Eike Rathke

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/45731Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarEike Rathke <erack@redhat.com>
üst a126d37a
......@@ -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>
......
......@@ -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)
......
......@@ -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; ]
......
......@@ -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
[
......
......@@ -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
{
......
......@@ -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
......
......@@ -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/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment