include/tools/date.hxx | 4 include/tools/datetime.hxx | 6 include/tools/time.hxx | 2 sc/qa/extras/accessibility/basics.cxx | 4 sc/qa/unit/ucalc_datatransformation.cxx | 112 ++++++++--------- sc/source/core/tool/chgviset.cxx | 2 sc/source/filter/excel/xichart.cxx | 4 sc/source/filter/excel/xlroot.cxx | 2 sc/source/filter/oox/pivotcachebuffer.cxx | 2 sc/source/filter/oox/pivottablebuffer.cxx | 4 sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx | 2 sfx2/source/doc/objmisc.cxx | 2 svl/source/numbers/zforfind.cxx | 4 svl/source/numbers/zformat.cxx | 4 svx/source/fmcomp/gridcell.cxx | 16 +- sw/source/core/fields/docufld.cxx | 2 sw/source/filter/basflt/shellio.cxx | 2 toolkit/source/awt/vclxwindows.cxx | 20 +-- unotest/source/cpp/macros_test.cxx | 2 vcl/source/control/calendar.cxx | 2 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx | 2 21 files changed, 100 insertions(+), 100 deletions(-)
New commits: commit 3519027515b7ba66aa5303311916b951a8f29e4c Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Jul 18 08:05:18 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jul 18 10:27:41 2024 +0200 make date/time single-arg constructors explicit Change-Id: I943f755d95b90ef8aeb7d5b339f617ff50db4e29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170673 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/tools/date.hxx b/include/tools/date.hxx index 6179d637e8ba..22429670d805 100644 --- a/include/tools/date.hxx +++ b/include/tools/date.hxx @@ -77,11 +77,11 @@ public: Date( sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear ) { setDateFromDMY(nDay, nMonth, nYear); } - Date( const css::util::Date& rUDate ) + explicit Date( const css::util::Date& rUDate ) { setDateFromDMY(rUDate.Day, rUDate.Month, rUDate.Year); } - Date( const css::util::DateTime& _rDateTime ); + explicit Date( const css::util::DateTime& _rDateTime ); bool IsEmpty() const { return mnDate == 0; } diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx index ddf29896c1a2..f50db1049a77 100644 --- a/include/tools/datetime.hxx +++ b/include/tools/datetime.hxx @@ -48,11 +48,11 @@ public: explicit DateTime( DateTimeInitSystem ); DateTime( const DateTime& rDateTime ) : Date( rDateTime ), Time( rDateTime ) {} - DateTime( const Date& rDate ) : Date( rDate ), Time(0) {} - DateTime( const tools::Time& rTime ) : Date(0), Time( rTime ) {} + explicit DateTime( const Date& rDate ) : Date( rDate ), Time(0) {} + explicit DateTime( const tools::Time& rTime ) : Date(0), Time( rTime ) {} DateTime( const Date& rDate, const tools::Time& rTime ) : Date( rDate ), Time( rTime ) {} - DateTime( const css::util::DateTime& rDateTime ); + explicit DateTime( const css::util::DateTime& rDateTime ); css::util::DateTime GetUNODateTime() const diff --git a/include/tools/time.hxx b/include/tools/time.hxx index 6418a50bc23e..24c130389d6a 100644 --- a/include/tools/time.hxx +++ b/include/tools/time.hxx @@ -76,7 +76,7 @@ public: explicit Time( TimeInitSystem ); explicit Time( sal_Int64 _nTime ) { Time::nTime = _nTime; } Time( const tools::Time& rTime ); - Time( const css::util::Time& rTime ); + explicit Time( const css::util::Time& rTime ); explicit Time( const css::util::DateTime& rDateTime ); Time( sal_uInt32 nHour, sal_uInt32 nMin, sal_uInt32 nSec = 0, sal_uInt64 nNanoSec = 0 ); diff --git a/sc/qa/extras/accessibility/basics.cxx b/sc/qa/extras/accessibility/basics.cxx index 7bed8a58f114..e96323625549 100644 --- a/sc/qa/extras/accessibility/basics.cxx +++ b/sc/qa/extras/accessibility/basics.cxx @@ -61,8 +61,8 @@ CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, TestCalcMenu) CPPUNIT_ASSERT(xSupplier->getNumberFormatSettings()->getPropertyValue(u"NullDate"_ustr) >>= nullDate); const Date afterDate(Date::SYSTEM); - CPPUNIT_ASSERT_GREATEREQUAL(double(beforeDate - nullDate), value); - CPPUNIT_ASSERT_LESSEQUAL(double(afterDate - nullDate), value); + CPPUNIT_ASSERT_GREATEREQUAL(double(beforeDate - Date(nullDate)), value); + CPPUNIT_ASSERT_LESSEQUAL(double(afterDate - Date(nullDate)), value); // cell A2 contains time, no date, so we have to be careful passing midnight xCell = sheet->getAccessibleCellAt(1, 0)->getAccessibleContext(); diff --git a/sc/qa/unit/ucalc_datatransformation.cxx b/sc/qa/unit/ucalc_datatransformation.cxx index bc3b9dc7cfc7..e8ccf7f8a790 100644 --- a/sc/qa/unit/ucalc_datatransformation.cxx +++ b/sc/qa/unit/ucalc_datatransformation.cxx @@ -449,10 +449,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetDateString) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -476,10 +476,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetYear) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -503,10 +503,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetStartOfYear) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -530,10 +530,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetEndOfYear) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -557,10 +557,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetMonth) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -584,10 +584,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetMonthName) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -611,10 +611,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetStartOfMonth) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -638,10 +638,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetEndOfMonth) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -665,10 +665,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetDay) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -692,10 +692,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetDayOfWeek) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -719,10 +719,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetDayOfYear) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -746,10 +746,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetQuarter) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -773,10 +773,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetStartOfQuarter) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); @@ -800,10 +800,10 @@ CPPUNIT_TEST_FIXTURE(ScDataTransformationTest, testGetEndOfQuarter) css::util::Date aDate3(23,9,1996); css::util::Date aDate4(15,8,1947); - double nDate1 = static_cast<double>(aDate1 - pFormatter->GetNullDate()); - double nDate2 = static_cast<double>(aDate2 - pFormatter->GetNullDate()); - double nDate3 = static_cast<double>(aDate3 - pFormatter->GetNullDate()); - double nDate4 = static_cast<double>(aDate4 - pFormatter->GetNullDate()); + double nDate1 = static_cast<double>(Date(aDate1) - pFormatter->GetNullDate()); + double nDate2 = static_cast<double>(Date(aDate2) - pFormatter->GetNullDate()); + double nDate3 = static_cast<double>(Date(aDate3) - pFormatter->GetNullDate()); + double nDate4 = static_cast<double>(Date(aDate4) - pFormatter->GetNullDate()); m_pDoc->SetValue(2, 0, 0, nDate1); m_pDoc->SetValue(2, 1, 0, nDate2); diff --git a/sc/source/core/tool/chgviset.cxx b/sc/source/core/tool/chgviset.cxx index 0a394cc86900..1e35922e90a8 100644 --- a/sc/source/core/tool/chgviset.cxx +++ b/sc/source/core/tool/chgviset.cxx @@ -136,7 +136,7 @@ void ScChangeViewSettings::AdjustDateMode( const ScDocument& rDoc ) aFirstDateTime.SetDate( 18990101 ); aFirstDateTime.SetTime( 0 ); } - aLastDateTime = Date( Date::SYSTEM ); + aLastDateTime = DateTime( Date( Date::SYSTEM ) ); aLastDateTime.AddYears( 100 ); } break; diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index e5c8a34bac4d..3d7e47e7f5fc 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -165,9 +165,9 @@ double lclGetSerialDay( const XclImpRoot& rRoot, sal_uInt16 nValue, sal_uInt16 n case EXC_CHDATERANGE_DAYS: return nValue; case EXC_CHDATERANGE_MONTHS: - return rRoot.GetDoubleFromDateTime( Date( 1, static_cast< sal_uInt16 >( 1 + nValue % 12 ), static_cast< sal_uInt16 >( rRoot.GetBaseYear() + nValue / 12 ) ) ); + return rRoot.GetDoubleFromDateTime( DateTime( Date( 1, static_cast< sal_uInt16 >( 1 + nValue % 12 ), static_cast< sal_uInt16 >( rRoot.GetBaseYear() + nValue / 12 ) ) ) ); case EXC_CHDATERANGE_YEARS: - return rRoot.GetDoubleFromDateTime( Date( 1, 1, static_cast< sal_uInt16 >( rRoot.GetBaseYear() + nValue ) ) ); + return rRoot.GetDoubleFromDateTime( DateTime( Date( 1, 1, static_cast< sal_uInt16 >( rRoot.GetBaseYear() + nValue ) ) ) ); default: OSL_ENSURE( false, "lclGetSerialDay - unexpected time unit" ); } diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 593a4d1583da..417a8e8858d7 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -325,7 +325,7 @@ SvNumberFormatter& XclRoot::GetFormatter() const DateTime XclRoot::GetNullDate() const { - return GetFormatter().GetNullDate(); + return DateTime( GetFormatter().GetNullDate() ); } sal_uInt16 XclRoot::GetBaseYear() const diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx index 6f0a13bcd561..929e7b3bdea6 100644 --- a/sc/source/filter/oox/pivotcachebuffer.cxx +++ b/sc/source/filter/oox/pivotcachebuffer.cxx @@ -253,7 +253,7 @@ OUString PivotCacheItem::getFormattedName(const ScDPSaveDimension& rSaveDim, ScD SAL_WARN("sc", "PivotCacheField::getFormattedName - invalid date"); return OUString(); } - return pObj->GetFormattedString(rSaveDim.GetName(), DateTime::Sub(aDateTime, rNullDate)); + return pObj->GetFormattedString(rSaveDim.GetName(), DateTime::Sub(DateTime(aDateTime), rNullDate)); } case XML_e: return maValue.get< OUString >(); } diff --git a/sc/source/filter/oox/pivottablebuffer.cxx b/sc/source/filter/oox/pivottablebuffer.cxx index 1d9ac14b7abc..920432c1e2f9 100644 --- a/sc/source/filter/oox/pivottablebuffer.cxx +++ b/sc/source/filter/oox/pivottablebuffer.cxx @@ -581,7 +581,7 @@ void PivotTableField::convertPageField( const PTPageFieldModel& rPageField ) ScDPObject* pDPObj = mrPivotTable.getDPObject(); ScDPSaveData* pSaveData = pDPObj->GetSaveData(); ScDPSaveDimension* pDim = pSaveData->GetDimensionByName(pCacheField->getName()); - OUString aSelectedPage = pSharedItem->getFormattedName(*pDim, pDPObj, DateTime(getWorkbookSettings().getNullDate())); + OUString aSelectedPage = pSharedItem->getFormattedName(*pDim, pDPObj, ::DateTime(::Date(getWorkbookSettings().getNullDate()))); aPropSet.setProperty( PROP_SelectedPage, aSelectedPage ); } } @@ -798,7 +798,7 @@ Reference< XDataPilotField > PivotTableField::convertRowColPageField( sal_Int32 try { - ScDPSaveMember* pMem = pDim->GetMemberByName(pSharedItem->getFormattedName(*pDim, pDPObj, DateTime(getWorkbookSettings().getNullDate()))); + ScDPSaveMember* pMem = pDim->GetMemberByName(pSharedItem->getFormattedName(*pDim, pDPObj, ::DateTime(::Date(getWorkbookSettings().getNullDate())))); pMem->SetShowDetails(rItem.mbShowDetails); pMem->SetIsVisible(!rItem.mbHidden); } diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx index 80f70da9f53e..00f899342e4a 100644 --- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx @@ -114,7 +114,7 @@ void ScChangeTrackingExportHelper::WriteChangeInfo(const ScChangeAction* pAction { OUStringBuffer sDate; ScXMLConverter::ConvertDateTimeToString(bRemovePersonalInfo - ? util::DateTime(0, 0, 0, 12, 1, 1, 1970, true) + ? DateTime( util::DateTime(0, 0, 0, 12, 1, 1, 1970, true) ) : pAction->GetDateTimeUTC(), sDate); SvXMLElementExport aDateElem(rExport, XML_NAMESPACE_DC, XML_DATE, true, false); diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 60594554b80a..123484e1706e 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1621,7 +1621,7 @@ void SfxHeaderAttributes_Impl::SetAttribute( const SvKeyValue& rKV ) } else { - pDoc->GetMedium()->SetExpired_Impl( Date( 1, 1, 1970 ) ); + pDoc->GetMedium()->SetExpired_Impl( DateTime(Date( 1, 1, 1970 )) ); } } } diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index c14e1b0abe30..f4b6e50451b8 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -1807,7 +1807,7 @@ bool ImpSvNumberInputScan::GetDateRef( double& fDays, sal_uInt16& nCounter ) CalendarWrapper* pCal = mrCurrentLanguageData.GetCalendar(); for ( int nTryOrder = 1; nTryOrder <= nFormatOrder; nTryOrder++ ) { - pCal->setGregorianDateTime( Date( Date::SYSTEM ) ); // today + pCal->setGregorianDateTime( DateTime( Date( Date::SYSTEM ) ) ); // today OUString aOrgCalendar; // empty => not changed yet DateOrder DateFmt; bool bFormatTurn; @@ -2063,7 +2063,7 @@ input for the following reasons: { if ( !bHadExact && nExactDateOrder ) { - pCal->setGregorianDateTime( Date( Date::SYSTEM ) ); // reset today + pCal->setGregorianDateTime( DateTime( Date( Date::SYSTEM ) ) ); // reset today } switch (DateFmt) { diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 4975738df5c4..8576a6dbfdb8 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -3766,7 +3766,7 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, bool bRes = false; CalendarWrapper& rCal = *rCurrentLang.GetCalendar(); - if (!lcl_getValidDate( rScan.GetNullDate(), rCal.getEpochStart(), fNumber)) + if (!lcl_getValidDate( DateTime( rScan.GetNullDate() ), rCal.getEpochStart(), fNumber)) { sBuff = ImpSvNumberformatScan::sErrStr; return false; @@ -4039,7 +4039,7 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, bool bRes = false; CalendarWrapper& rCal = *rCurrentLang.GetCalendar(); - if (!lcl_getValidDate( rScan.GetNullDate(), rCal.getEpochStart(), fNumber)) + if (!lcl_getValidDate( DateTime( rScan.GetNullDate() ), rCal.getEpochStart(), fNumber)) { sBuff = ImpSvNumberformatScan::sErrStr; return false; diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 8d728384cd5c..a8a87a8d0803 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -2267,14 +2267,14 @@ void DbDateField::implAdjustGenericFieldSetting( const Reference< XPropertySet > } rControlFormatter.SetExtDateFormat( static_cast<ExtDateFieldFormat>(nFormat) ); - rControlFormatter.SetMin( aMin ); - rControlFormatter.SetMax( aMax ); + rControlFormatter.SetMin( ::Date(aMin) ); + rControlFormatter.SetMax( ::Date(aMax) ); rControlFormatter.SetStrictFormat( bStrict ); rControlFormatter.EnableEmptyField( true ); rPainterFormatter.SetExtDateFormat( static_cast<ExtDateFieldFormat>(nFormat) ); - rPainterFormatter.SetMin( aMin ); - rPainterFormatter.SetMax( aMax ); + rPainterFormatter.SetMin( ::Date(aMin) ); + rPainterFormatter.SetMax( ::Date(aMax) ); rPainterFormatter.SetStrictFormat( bStrict ); rPainterFormatter.EnableEmptyField( true ); } @@ -2375,8 +2375,8 @@ void DbTimeField::implAdjustGenericFieldSetting( const Reference< XPropertySet > weld::TimeFormatter& rControlFormatter = static_cast<weld::TimeFormatter&>(pControl->get_formatter()); rControlFormatter.SetExtFormat(static_cast<ExtTimeFieldFormat>(nFormat)); - rControlFormatter.SetMin(aMin); - rControlFormatter.SetMax(aMax); + rControlFormatter.SetMin(tools::Time(aMin)); + rControlFormatter.SetMax(tools::Time(aMax)); rControlFormatter.SetStrictFormat(bStrict); rControlFormatter.EnableEmptyField(true); @@ -2384,8 +2384,8 @@ void DbTimeField::implAdjustGenericFieldSetting( const Reference< XPropertySet > weld::TimeFormatter& rPainterFormatter = static_cast<weld::TimeFormatter&>(pPainter->get_formatter()); rPainterFormatter.SetExtFormat(static_cast<ExtTimeFieldFormat>(nFormat)); - rPainterFormatter.SetMin(aMin); - rPainterFormatter.SetMax(aMax); + rPainterFormatter.SetMin(tools::Time(aMin)); + rPainterFormatter.SetMax(tools::Time(aMax)); rPainterFormatter.SetStrictFormat(bStrict); rPainterFormatter.EnableEmptyField(true); } diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 376820d45d76..17fbb40a31f0 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1982,7 +1982,7 @@ bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) case FIELD_PROP_DATE: if( auto aSetDate = o3tl::tryAccess<util::Date>(rAny) ) { - m_aDateTime = Date(aSetDate->Day, aSetDate->Month, aSetDate->Year); + m_aDateTime = DateTime( Date(aSetDate->Day, aSetDate->Month, aSetDate->Year) ); } break; case FIELD_PROP_DATE_TIME: diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 875d67d4321a..943dacb1db3f 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -562,7 +562,7 @@ void Reader::MakeHTMLDummyTemplateDoc() mxTemplate->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, m_bTemplateBrowseMode ); mxTemplate->getIDocumentDeviceAccess().getPrinter( true ); mxTemplate->RemoveAllFormatLanguageDependencies(); - m_aCheckDateTime = Date( 1, 1, 2300 ); // year 2300 should be sufficient + m_aCheckDateTime = DateTime( Date( 1, 1, 2300 ) ); // year 2300 should be sufficient m_aTemplateName = "$$Dummy$$"; } diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 72aecc5152b9..d564c69a099c 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -4750,7 +4750,7 @@ void VCLXDateField::setDate( const util::Date& aDate ) VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) { - pDateField->SetDate( aDate ); + pDateField->SetDate( ::Date(aDate) ); // #107218# Call same listeners like VCL would do after user interaction SetSynthesizingVCLEvent( true ); @@ -4777,7 +4777,7 @@ void VCLXDateField::setMin( const util::Date& aDate ) VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) - pDateField->SetMin( aDate ); + pDateField->SetMin( ::Date(aDate) ); } util::Date VCLXDateField::getMin() @@ -4797,7 +4797,7 @@ void VCLXDateField::setMax( const util::Date& aDate ) VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) - pDateField->SetMax( aDate ); + pDateField->SetMax( ::Date(aDate) ); } util::Date VCLXDateField::getMax() @@ -4817,7 +4817,7 @@ void VCLXDateField::setFirst( const util::Date& aDate ) VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) - pDateField->SetFirst( aDate ); + pDateField->SetFirst( ::Date(aDate) ); } util::Date VCLXDateField::getFirst() @@ -4837,7 +4837,7 @@ void VCLXDateField::setLast( const util::Date& aDate ) VclPtr< DateField > pDateField = GetAs< DateField >(); if ( pDateField ) - pDateField->SetLast( aDate ); + pDateField->SetLast( ::Date(aDate) ); } util::Date VCLXDateField::getLast() @@ -4969,7 +4969,7 @@ void VCLXTimeField::setTime( const util::Time& aTime ) VclPtr< TimeField > pTimeField = GetAs< TimeField >(); if ( pTimeField ) { - pTimeField->SetTime( aTime ); + pTimeField->SetTime( tools::Time(aTime) ); // #107218# Call same listeners like VCL would do after user interaction SetSynthesizingVCLEvent( true ); @@ -4996,7 +4996,7 @@ void VCLXTimeField::setMin( const util::Time& aTime ) VclPtr< TimeField > pTimeField = GetAs< TimeField >(); if ( pTimeField ) - pTimeField->SetMin( aTime ); + pTimeField->SetMin( tools::Time(aTime) ); } util::Time VCLXTimeField::getMin() @@ -5016,7 +5016,7 @@ void VCLXTimeField::setMax( const util::Time& aTime ) VclPtr< TimeField > pTimeField = GetAs< TimeField >(); if ( pTimeField ) - pTimeField->SetMax( aTime ); + pTimeField->SetMax( tools::Time(aTime) ); } util::Time VCLXTimeField::getMax() @@ -5036,7 +5036,7 @@ void VCLXTimeField::setFirst( const util::Time& aTime ) VclPtr< TimeField > pTimeField = GetAs< TimeField >(); if ( pTimeField ) - pTimeField->SetFirst( aTime ); + pTimeField->SetFirst( tools::Time(aTime) ); } util::Time VCLXTimeField::getFirst() @@ -5056,7 +5056,7 @@ void VCLXTimeField::setLast( const util::Time& aTime ) VclPtr< TimeField > pTimeField = GetAs< TimeField >(); if ( pTimeField ) - pTimeField->SetLast( aTime ); + pTimeField->SetLast( tools::Time(aTime) ); } util::Time VCLXTimeField::getLast() diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx index 7106a3d6d132..3cf6a406735e 100644 --- a/unotest/source/cpp/macros_test.cxx +++ b/unotest/source/cpp/macros_test.cxx @@ -219,7 +219,7 @@ struct Valid } bool operator()(const css::uno::Reference<css::security::XCertificate>& cert) const { - if (!now.IsBetween(cert->getNotValidBefore(), cert->getNotValidAfter())) + if (!now.IsBetween(DateTime(cert->getNotValidBefore()), DateTime(cert->getNotValidAfter()))) return false; if (!subjectName.isEmpty() && subjectName != cert->getSubjectName()) return false; diff --git a/vcl/source/control/calendar.cxx b/vcl/source/control/calendar.cxx index d147738e110a..583ad5ca1235 100644 --- a/vcl/source/control/calendar.cxx +++ b/vcl/source/control/calendar.cxx @@ -1173,7 +1173,7 @@ void Calendar::RequestHelp( const HelpEvent& rHEvt ) if ( rHEvt.GetMode() & HelpEventMode::QUICK ) { - maCalendarWrapper.setGregorianDateTime( aDate); + maCalendarWrapper.setGregorianDateTime( DateTime(aDate) ); sal_uInt16 nWeek = static_cast<sal_uInt16>(maCalendarWrapper.getValue( i18n::CalendarFieldIndex::WEEK_OF_YEAR)); sal_uInt16 nMonth = aDate.GetMonth(); OUString aStr = maDayText diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx index cc688397b630..38fcf428be74 100644 --- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx +++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx @@ -141,7 +141,7 @@ bool PDFSigningTest::sign(const OUString& rInURL, const OUString& rOutURL, css::util::DateTime aNotValidBefore = cert->getNotValidBefore(); // Only try certificates that are already active and not expired - if ((now > aNotValidAfter) || (now < aNotValidBefore)) + if ((now > DateTime(aNotValidAfter)) || (now < DateTime(aNotValidBefore))) { SAL_WARN("xmlsecurity.qa", "Skipping a certificate that is not yet valid or already not valid");