[Libreoffice-commits] core.git: 3 commits - sc/source
Eike Rathke
erack at redhat.com
Fri Dec 8 23:11:15 UTC 2017
sc/source/ui/view/formatsh.cxx | 49 +++++++++++++++--------------------------
1 file changed, 18 insertions(+), 31 deletions(-)
New commits:
commit 0bb0299b29960c3a27427eba5d5fc34e5e913a8b
Author: Eike Rathke <erack at redhat.com>
Date: Sat Dec 9 00:09:00 2017 +0100
Name it what it is, the format category for the sidebar
Change-Id: Ice6bbfc5f9412ba2d7bce7fb63782a12b48304a1
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index dda99fc78495..0716ff89a815 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2604,7 +2604,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
case SID_NUMBER_TYPE_FORMAT:
{
- sal_Int16 aFormatCode = -1;
+ sal_Int16 nFormatCategory = -1;
if ( eItemState >= SfxItemState::DEFAULT ) //Modify for more robust
{
switch(nType)
@@ -2612,43 +2612,43 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
case css::util::NumberFormat::NUMBER:
// Determine if General format.
if ((nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
- aFormatCode = 0;
+ nFormatCategory = 0;
else
- aFormatCode = 1;
+ nFormatCategory = 1;
break;
case css::util::NumberFormat::PERCENT:
- aFormatCode = 2;
+ nFormatCategory = 2;
break;
case css::util::NumberFormat::CURRENCY:
- aFormatCode = 3;
+ nFormatCategory = 3;
break;
case css::util::NumberFormat::DATE:
//Add
case css::util::NumberFormat::DATETIME:
- aFormatCode = 4;
+ nFormatCategory = 4;
break;
case css::util::NumberFormat::TIME:
- aFormatCode = 5;
+ nFormatCategory = 5;
break;
case css::util::NumberFormat::SCIENTIFIC:
- aFormatCode = 6;
+ nFormatCategory = 6;
break;
case css::util::NumberFormat::FRACTION:
- aFormatCode = 7;
+ nFormatCategory = 7;
break;
case css::util::NumberFormat::LOGICAL:
- aFormatCode = 8;
+ nFormatCategory = 8;
break;
case css::util::NumberFormat::TEXT:
- aFormatCode = 9;
+ nFormatCategory = 9;
break;
default:
- aFormatCode = -1; //for more robust
+ nFormatCategory = -1; //for more robust
}
- if( aFormatCode == -1 )
+ if( nFormatCategory == -1 )
rSet.InvalidateItem( nWhich );
else
- rSet.Put( SfxInt16Item( nWhich, aFormatCode ) );
+ rSet.Put( SfxInt16Item( nWhich, nFormatCategory ) );
}
else
{
commit 3679eccc0b4f2aa33a8b3e812f1230e0664c2010
Author: Eike Rathke <erack at redhat.com>
Date: Sat Dec 9 00:04:48 2017 +0100
Rip out already masked out css::util::NumberFormat::DEFINED in cases
Change-Id: Ic769a755fba5cf89596509098ec6dff4fc011598
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index eee8fd2f5c94..dda99fc78495 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2519,6 +2519,8 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
// don't have to iterate over all
// selected cells' attribute ranges to
// determine selected types.
+ // Does *NOT* include the
+ // css::util::NumberFormat::DEFINED bit.
const short nType = (eItemState >= SfxItemState::DEFAULT ? pFormatter->GetType( nNumberFormat) :
GetCurrentNumberFormatType());
NfIndexTableOffset nOffset = pFormatter->GetIndexTableOffset(nNumberFormat);
@@ -2608,7 +2610,6 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
switch(nType)
{
case css::util::NumberFormat::NUMBER:
- case css::util::NumberFormat::NUMBER| css::util::NumberFormat::DEFINED:
// Determine if General format.
if ((nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
aFormatCode = 0;
@@ -2616,38 +2617,29 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
aFormatCode = 1;
break;
case css::util::NumberFormat::PERCENT:
- case css::util::NumberFormat::PERCENT| css::util::NumberFormat::DEFINED:
aFormatCode = 2;
break;
case css::util::NumberFormat::CURRENCY:
- case css::util::NumberFormat::CURRENCY| css::util::NumberFormat::DEFINED:
aFormatCode = 3;
break;
case css::util::NumberFormat::DATE:
- case css::util::NumberFormat::DATE| css::util::NumberFormat::DEFINED:
//Add
case css::util::NumberFormat::DATETIME:
- case css::util::NumberFormat::DATETIME | css::util::NumberFormat::DEFINED:
aFormatCode = 4;
break;
case css::util::NumberFormat::TIME:
- case css::util::NumberFormat::TIME| css::util::NumberFormat::DEFINED:
aFormatCode = 5;
break;
case css::util::NumberFormat::SCIENTIFIC:
- case css::util::NumberFormat::SCIENTIFIC| css::util::NumberFormat::DEFINED:
aFormatCode = 6;
break;
case css::util::NumberFormat::FRACTION:
- case css::util::NumberFormat::FRACTION| css::util::NumberFormat::DEFINED:
aFormatCode = 7;
break;
case css::util::NumberFormat::LOGICAL:
- case css::util::NumberFormat::LOGICAL| css::util::NumberFormat::DEFINED:
aFormatCode = 8;
break;
case css::util::NumberFormat::TEXT:
- case css::util::NumberFormat::TEXT| css::util::NumberFormat::DEFINED:
aFormatCode = 9;
break;
default:
commit 5a2daafe383a54c7b85c8259633b0bab7be935d6
Author: Eike Rathke <erack at redhat.com>
Date: Fri Dec 8 23:54:30 2017 +0100
GetCurrentNumberFormatType() mask out the user defined bit
SvNumberformat::GetType() includes
css::util::NumberFormat::DEFINED whereas
SvNumberFormatter::GetType() does not. For the type determination
we don't need the user defined bit, or even don't want it to be a
different type.
Change-Id: I713eeb25af01110a0f27bc0c082a7483efdf55db
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 8afb1072c1dd..eee8fd2f5c94 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2871,11 +2871,7 @@ short ScFormatShell::GetCurrentNumberFormatType()
ScRange aColRange(nCol, nRow1, aRange.aStart.Tab());
aColRange.aEnd.SetRow(nRow2);
sal_uInt32 nNumFmt = pDoc->GetNumberFormat(aColRange);
- const SvNumberformat* pEntry = pFormatter->GetEntry(nNumFmt);
- if (!pEntry)
- return 0;
-
- short nThisType = pEntry->GetType();
+ short nThisType = pFormatter->GetType(nNumFmt);
if (bFirstItem)
{
bFirstItem = false;
@@ -2893,8 +2889,7 @@ short ScFormatShell::GetCurrentNumberFormatType()
sal_uInt32 nNumFmt;
pDoc->GetNumberFormat( pViewData->GetCurX(), pViewData->GetCurY(),
pViewData->GetTabNo(), nNumFmt );
- const SvNumberformat* pEntry = pFormatter->GetEntry( nNumFmt );
- nType = pEntry ? pEntry->GetType() : 0;
+ nType = pFormatter->GetType( nNumFmt );
}
return nType;
}
More information about the Libreoffice-commits
mailing list