diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-17 09:43:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-17 14:46:39 +0200 |
commit | c67b9a4ce5ac3a09437730d8440c84159b581622 (patch) | |
tree | eae4cb82c007fe228d85acb2432c3ceb1c6ef256 /sc | |
parent | c8226655a8d838d15af7de3ba1fa5c47546b6ada (diff) |
rather return ref from GetCalendar
since we never return a nullptr
Change-Id: I4cb4af99752818e323472a372330d1bc2a3df4f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122236
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/global.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dptabsrc.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/dputil.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/global.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 4 |
5 files changed, 8 insertions, 8 deletions
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index a8c885f48155..6a3eab0d837d 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -538,7 +538,7 @@ public: SC_DLLPUBLIC static const LocaleDataWrapper& getLocaleData(); SC_DLLPUBLIC static const CharClass& getCharClass(); - static CalendarWrapper* GetCalendar(); + static CalendarWrapper& GetCalendar(); SC_DLLPUBLIC static CollatorWrapper* GetCollator(); static CollatorWrapper* GetCaseCollator(); static css::lang::Locale* GetLocale(); diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index 1950c8500d39..24ef497b3424 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -2388,14 +2388,14 @@ ScDPMember* ScDPMembers::getByIndex(sal_Int32 nIndex) const else if ( nHier == SC_DAPI_HIERARCHY_WEEK && nLev == SC_DAPI_LEVEL_WEEKDAY ) { nVal = nIndex; // DayOfWeek is 0-based - aName = ScGlobal::GetCalendar()->getDisplayName( + aName = ScGlobal::GetCalendar().getDisplayName( css::i18n::CalendarDisplayIndex::DAY, sal::static_int_cast<sal_Int16>(nVal), 0 ); } else if ( nHier == SC_DAPI_HIERARCHY_QUARTER && nLev == SC_DAPI_LEVEL_MONTH ) { nVal = nIndex; // Month is 0-based - aName = ScGlobal::GetCalendar()->getDisplayName( + aName = ScGlobal::GetCalendar().getDisplayName( css::i18n::CalendarDisplayIndex::MONTH, sal::static_int_cast<sal_Int16>(nVal), 0 ); } diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx index 23f18b906485..b589d4e80156 100644 --- a/sc/source/core/data/dputil.cxx +++ b/sc/source/core/data/dputil.cxx @@ -116,7 +116,7 @@ OUString ScDPUtil::getDateGroupName( case sheet::DataPilotFieldGroupBy::QUARTERS: return ScGlobal::getLocaleData().getQuarterAbbreviation(sal_Int16(nValue-1)); // nValue is 1-based case css::sheet::DataPilotFieldGroupBy::MONTHS: - return ScGlobal::GetCalendar()->getDisplayName( + return ScGlobal::GetCalendar().getDisplayName( i18n::CalendarDisplayIndex::MONTH, sal_Int16(nValue-1), 0); // 0-based, get short name case sheet::DataPilotFieldGroupBy::DAYS: { diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 38ab85a91df9..be6711849c02 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -1018,7 +1018,7 @@ const CharClass& ScGlobal::getCharClass() return oSysLocale->GetCharClass(); } -CalendarWrapper* ScGlobal::GetCalendar() +CalendarWrapper& ScGlobal::GetCalendar() { assert(!bThreadedGroupCalcInProgress); if ( !oCalendar ) @@ -1026,7 +1026,7 @@ CalendarWrapper* ScGlobal::GetCalendar() oCalendar.emplace( ::comphelper::getProcessComponentContext() ); oCalendar->loadDefaultCalendar( *GetLocale() ); } - return &*oCalendar; + return *oCalendar; } namespace { diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index d092a5f60848..32c62ff367e8 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -925,8 +925,8 @@ void ScCheckListMenuControl::addDateMember(const OUString& rsName, double nVal, sal_uInt16 nDay = aDate.GetDay(); // Get the localized month name list. - CalendarWrapper* pCalendar = ScGlobal::GetCalendar(); - uno::Sequence<i18n::CalendarItem2> aMonths = pCalendar->getMonths(); + CalendarWrapper& rCalendar = ScGlobal::GetCalendar(); + uno::Sequence<i18n::CalendarItem2> aMonths = rCalendar.getMonths(); if (aMonths.getLength() < nMonth) return; |