[Libreoffice-commits] core.git: 2 commits - chart2/source sc/source svl/source svx/source

Eike Rathke erack at redhat.com
Mon Feb 20 19:58:41 UTC 2017


 chart2/source/controller/dialogs/tp_Scale.cxx |    4 ++--
 sc/source/core/data/column3.cxx               |    2 +-
 sc/source/ui/view/viewfun6.cxx                |    2 +-
 svl/source/numbers/zforlist.cxx               |   11 +++++------
 svx/source/items/numfmtsh.cxx                 |   14 +++++++-------
 5 files changed, 16 insertions(+), 17 deletions(-)

New commits:
commit 2f6d2c0c47ebfd1b98f9610aec99566fe3a1a982
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Feb 20 20:55:39 2017 +0100

    use SvNumberformat::GetMaskedType()
    
    ... instead of manually masking out css::util::NumberFormat::DEFINED
    
    Change-Id: I0761132800b2b1693df41085695f36cd3cc1236b

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index dd33288..9bd32c0 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -1700,7 +1700,7 @@ bool ScColumn::ParseString(
                     bool bOverwrite = false;
                     if ( pOldFormat )
                     {
-                        short nOldType = pOldFormat->GetType() & ~css::util::NumberFormat::DEFINED;
+                        short nOldType = pOldFormat->GetMaskedType();
                         if ( nOldType == css::util::NumberFormat::NUMBER || nOldType == css::util::NumberFormat::DATE ||
                              nOldType == css::util::NumberFormat::TIME || nOldType == css::util::NumberFormat::LOGICAL )
                         {
diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx
index 92a1804..97ca1bd 100644
--- a/sc/source/ui/view/viewfun6.cxx
+++ b/sc/source/ui/view/viewfun6.cxx
@@ -269,7 +269,7 @@ void ScViewFunc::InsertCurrentTime(short nReqFmt, const OUString& rUndoStr)
     SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
     const SvNumberformat* pCurNumFormatEntry = pFormatter->GetEntry(nCurNumFormat);
     const short nCurNumFormatType = (pCurNumFormatEntry ?
-            (pCurNumFormatEntry->GetType() & ~css::util::NumberFormat::DEFINED) : css::util::NumberFormat::UNDEFINED);
+            pCurNumFormatEntry->GetMaskedType() : css::util::NumberFormat::UNDEFINED);
 
     if (bInputMode)
     {
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 71a0718..2ddd642 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -928,7 +928,7 @@ SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable(
         else
         {
             rLnge = pFormat->GetLanguage();
-            eType = pFormat->GetType()&~css::util::NumberFormat::DEFINED;
+            eType = pFormat->GetMaskedType();
             if (eType == 0)
             {
                 eType = css::util::NumberFormat::DEFINED;
@@ -1081,7 +1081,7 @@ bool SvNumberFormatter::IsNumberFormat(const OUString& sString,
     }
     else
     {
-        FType = pFormat->GetType() &~css::util::NumberFormat::DEFINED;
+        FType = pFormat->GetMaskedType();
         if (FType == 0)
         {
             FType = css::util::NumberFormat::DEFINED;
@@ -1249,8 +1249,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
         while ( it2 != aFTable.end() && (nKey = it2->first ) >= CLOffset && nKey < nStopKey )
         {
             const SvNumberformat* pEntry = it2->second;
-            if ( pEntry->IsStandard() && ((pEntry->GetType() &
-                            ~css::util::NumberFormat::DEFINED) == nType) )
+            if ( pEntry->IsStandard() && (pEntry->GetMaskedType() == nType) )
             {
                 nDefaultFormat = nKey;
                 break;  // while
@@ -1490,7 +1489,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
     LanguageType eLang = pFormat->GetLanguage();
     ChangeIntl( eLang );
 
-    short eType = pFormat->GetType() & ~css::util::NumberFormat::DEFINED;
+    short eType = pFormat->GetMaskedType();
     if (eType == 0)
     {
         // Mixed types in subformats, use first.
@@ -3039,7 +3038,7 @@ short SvNumberFormatter::GetType(sal_uInt32 nFIndex)
     }
     else
     {
-        eType = pFormat->GetType() &~css::util::NumberFormat::DEFINED;
+        eType = pFormat->GetMaskedType();
         if (eType == 0)
         {
             eType = css::util::NumberFormat::DEFINED;
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index 765ec8d..b0a8d92 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -692,7 +692,7 @@ short SvxNumberFormatShell::FillEListWithFormats_Impl( std::vector<OUString>& rL
 
         if(pNumEntry==nullptr) continue;
 
-        nMyCat=pNumEntry->GetType() & ~css::util::NumberFormat::DEFINED;
+        nMyCat=pNumEntry->GetMaskedType();
         aStrComment=pNumEntry->GetComment();
         CategoryToPos_Impl(nMyCat,nMyType);
         aNewFormNInfo=  pNumEntry->GetFormatstring();
@@ -727,7 +727,7 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( std::vector<OUString>& r
         const SvNumberformat* pNumEntry   = pFormatter->GetEntry(nNFEntry);
         if(pNumEntry!=nullptr)
         {
-            nMyCat=pNumEntry->GetType() & ~css::util::NumberFormat::DEFINED;
+            nMyCat=pNumEntry->GetMaskedType();
             aStrComment=pNumEntry->GetComment();
             CategoryToPos_Impl(nMyCat,nMyType);
             aNewFormNInfo=  pNumEntry->GetFormatstring();
@@ -811,7 +811,7 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<OUString>& rL
 
         if(pNumEntry==nullptr) continue;
 
-        nMyCat=pNumEntry->GetType() & ~css::util::NumberFormat::DEFINED;
+        nMyCat=pNumEntry->GetMaskedType();
         aStrComment=pNumEntry->GetComment();
         CategoryToPos_Impl(nMyCat,nMyType);
         aNewFormNInfo=  pNumEntry->GetFormatstring();
@@ -850,7 +850,7 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<OUString>& rL
 
                 if(!bUserNewCurrency &&(pNumEntry->GetType() & css::util::NumberFormat::DEFINED))
                 {
-                    nMyCat=pNumEntry->GetType() & ~css::util::NumberFormat::DEFINED;
+                    nMyCat=pNumEntry->GetMaskedType();
                     aStrComment=pNumEntry->GetComment();
                     CategoryToPos_Impl(nMyCat,nMyType);
                     aNewFormNInfo=  pNumEntry->GetFormatstring();
@@ -935,7 +935,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<OUString>& r
             if( pNumEntry->GetType() & css::util::NumberFormat::DEFINED ||
                 pNumEntry->IsAdditionalBuiltin() )
             {
-                nMyCat=pNumEntry->GetType() & ~css::util::NumberFormat::DEFINED;
+                nMyCat=pNumEntry->GetMaskedType();
                 aStrComment = pNumEntry->GetComment();
                 CategoryToPos_Impl(nMyCat,nMyType);
                 aNewFormNInfo =  pNumEntry->GetFormatstring();
@@ -1086,7 +1086,7 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<OUString>& rList,
             if( (pNumEntry->GetType() & css::util::NumberFormat::DEFINED) ||
                     (bAdditional && pNumEntry->IsAdditionalBuiltin()) )
             {
-                nMyCat=pNumEntry->GetType() & ~css::util::NumberFormat::DEFINED;
+                nMyCat=pNumEntry->GetMaskedType();
                 aStrComment=pNumEntry->GetComment();
                 CategoryToPos_Impl(nMyCat,nMyType);
                 aNewFormNInfo=  pNumEntry->GetFormatstring();
@@ -1262,7 +1262,7 @@ short SvxNumberFormatShell::GetCategory4Entry(short nEntry) const
             sal_uInt16 nMyCat,nMyType;
             if(pNumEntry!=nullptr)
             {
-                nMyCat=pNumEntry->GetType() & ~css::util::NumberFormat::DEFINED;
+                nMyCat=pNumEntry->GetMaskedType();
                 CategoryToPos_Impl(nMyCat,nMyType);
 
                 return (short) nMyType;
commit ce315ac12119f30be5789784010889e38b6f75a4
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Feb 20 20:42:29 2017 +0100

    SvNumberFormatter::GetType() does not include NumberFormat::DEFINED
    
    ... so masking it out is unnecessary.
    
    Change-Id: I4b25ced640f9287c4db52a6257020fce4e4c1303

diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
index c588718..29ff326 100644
--- a/chart2/source/controller/dialogs/tp_Scale.cxx
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -422,11 +422,11 @@ DeactivateRC ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
     bool bDateAxis = chart2::AxisType::DATE == m_nAxisType;
 
     sal_uInt32 nMinMaxOriginFmt = m_pFmtFldMax->GetFormatKey();
-    if ((pNumFormatter->GetType(nMinMaxOriginFmt) & ~css::util::NumberFormat::DEFINED) == css::util::NumberFormat::TEXT)
+    if (pNumFormatter->GetType(nMinMaxOriginFmt) == css::util::NumberFormat::TEXT)
         nMinMaxOriginFmt = 0;
     // numberformat_text cause numbers to fail being numbers...  Shouldn't happen, but can.
     sal_uInt32 nStepFmt = m_pFmtFldStepMain->GetFormatKey();
-    if ((pNumFormatter->GetType(nStepFmt) & ~css::util::NumberFormat::DEFINED) == css::util::NumberFormat::TEXT)
+    if (pNumFormatter->GetType(nStepFmt) == css::util::NumberFormat::TEXT)
         nStepFmt = 0;
 
     Control* pControl = nullptr;


More information about the Libreoffice-commits mailing list