Kaydet (Commit) 9804cc4e authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Eike Rathke

sc: ScHeaderFieldData always stores a datetime

It does not change only the date part nor the time part
separately, thus holding single DateTime is sufficient.

Change-Id: Ic619608ce7a961287c299698b9a004cbf7038702
Reviewed-on: https://gerrit.libreoffice.org/54058Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
üst 3f8fdfce
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
#include "types.hxx" #include "types.hxx"
#include <editeng/editeng.hxx> #include <editeng/editeng.hxx>
#include <svx/pageitem.hxx> #include <svx/pageitem.hxx>
#include <tools/date.hxx> #include <tools/datetime.hxx>
#include <tools/time.hxx>
#include <tools/gen.hxx> #include <tools/gen.hxx>
#include <tools/fract.hxx> #include <tools/fract.hxx>
#include <vcl/outdev.hxx> #include <vcl/outdev.hxx>
...@@ -190,8 +189,7 @@ struct ScHeaderFieldData ...@@ -190,8 +189,7 @@ struct ScHeaderFieldData
OUString aLongDocName; // path and file name OUString aLongDocName; // path and file name
OUString aShortDocName; // pure file name OUString aShortDocName; // pure file name
OUString aTabName; OUString aTabName;
Date aDate; DateTime aDateTime;
tools::Time aTime;
long nPageNo; long nPageNo;
long nTotalPages; long nTotalPages;
SvxNumType eNumType; SvxNumType eNumType;
......
...@@ -783,9 +783,7 @@ static OUString lcl_GetNumStr(sal_Int32 nNo, SvxNumType eType) ...@@ -783,9 +783,7 @@ static OUString lcl_GetNumStr(sal_Int32 nNo, SvxNumType eType)
} }
ScHeaderFieldData::ScHeaderFieldData() ScHeaderFieldData::ScHeaderFieldData()
: : aDateTime ( DateTime::EMPTY )
aDate( Date::EMPTY ),
aTime( tools::Time::EMPTY )
{ {
nPageNo = nTotalPages = 0; nPageNo = nTotalPages = 0;
eNumType = SVX_NUM_ARABIC; eNumType = SVX_NUM_ARABIC;
...@@ -817,7 +815,7 @@ OUString ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField, ...@@ -817,7 +815,7 @@ OUString ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField,
case text::textfield::Type::EXTENDED_TIME: case text::textfield::Type::EXTENDED_TIME:
case text::textfield::Type::TIME: case text::textfield::Type::TIME:
// For now, time field in the header / footer is always dynamic. // For now, time field in the header / footer is always dynamic.
aRet = ScGlobal::pLocaleData->getTime(aData.aTime); aRet = ScGlobal::pLocaleData->getTime(aData.aDateTime);
break; break;
case text::textfield::Type::DOCINFO_TITLE: case text::textfield::Type::DOCINFO_TITLE:
aRet = aData.aTitle; aRet = aData.aTitle;
...@@ -838,7 +836,7 @@ OUString ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField, ...@@ -838,7 +836,7 @@ OUString ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField,
aRet = aData.aTabName; aRet = aData.aTabName;
break; break;
case text::textfield::Type::DATE: case text::textfield::Type::DATE:
aRet = ScGlobal::pLocaleData->getDate(aData.aDate); aRet = ScGlobal::pLocaleData->getDate(aData.aDateTime);
break; break;
default: default:
aRet = "?"; aRet = "?";
......
...@@ -47,8 +47,7 @@ private: ...@@ -47,8 +47,7 @@ private:
long nTabPage; // Page of sheet long nTabPage; // Page of sheet
long nTabStart; // First (real) page of the sheet long nTabStart; // First (real) page of the sheet
long nDisplayStart; // same as above, relative to the start of counting long nDisplayStart; // same as above, relative to the start of counting
Date aDate; DateTime aDateTime;
tools::Time aTime;
long nTotalPages; long nTotalPages;
Size aPageSize; // for GetOptimalZoom Size aPageSize; // for GetOptimalZoom
ScPrintState aState; ScPrintState aState;
......
...@@ -303,7 +303,7 @@ public: ...@@ -303,7 +303,7 @@ public:
void SetOffset( const Point& rOfs ); void SetOffset( const Point& rOfs );
void SetManualZoom( sal_uInt16 nNewZoom ); void SetManualZoom( sal_uInt16 nNewZoom );
void SetDateTime( const Date& rDate, const tools::Time& rTime ); void SetDateTime( const DateTime& );
void SetClearFlag( bool bFlag ); void SetClearFlag( bool bFlag );
void SetUseStyleColor( bool bFlag ); void SetUseStyleColor( bool bFlag );
......
...@@ -96,8 +96,7 @@ ScPreview::ScPreview( vcl::Window* pParent, ScDocShell* pDocSh, ScPreviewShell* ...@@ -96,8 +96,7 @@ ScPreview::ScPreview( vcl::Window* pParent, ScDocShell* pDocSh, ScPreviewShell*
nTabPage( 0 ), nTabPage( 0 ),
nTabStart( 0 ), nTabStart( 0 ),
nDisplayStart( 0 ), nDisplayStart( 0 ),
aDate( Date::SYSTEM ), aDateTime( DateTime::SYSTEM ),
aTime( tools::Time::SYSTEM ),
nTotalPages( 0 ), nTotalPages( 0 ),
pLocationData( nullptr ), pLocationData( nullptr ),
pDrawView( nullptr ), pDrawView( nullptr ),
...@@ -401,7 +400,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) ...@@ -401,7 +400,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation )
pPrintFunc->SetOffset(aOffset); pPrintFunc->SetOffset(aOffset);
pPrintFunc->SetManualZoom(nZoom); pPrintFunc->SetManualZoom(nZoom);
pPrintFunc->SetDateTime(aDate,aTime); pPrintFunc->SetDateTime(aDateTime);
pPrintFunc->SetClearFlag(true); pPrintFunc->SetClearFlag(true);
pPrintFunc->SetUseStyleColor( pScMod->GetAccessOptions().GetIsForPagePreviews() ); pPrintFunc->SetUseStyleColor( pScMod->GetAccessOptions().GetIsForPagePreviews() );
...@@ -701,10 +700,7 @@ const ScPreviewLocationData& ScPreview::GetLocationData() ...@@ -701,10 +700,7 @@ const ScPreviewLocationData& ScPreview::GetLocationData()
void ScPreview::DataChanged(bool bNewTime) void ScPreview::DataChanged(bool bNewTime)
{ {
if (bNewTime) if (bNewTime)
{ aDateTime = DateTime( DateTime::SYSTEM );
aDate = Date( Date::SYSTEM );
aTime = tools::Time( tools::Time::SYSTEM );
}
bValid = false; bValid = false;
InvalidateLocationData( SfxHintId::ScDataChanged ); InvalidateLocationData( SfxHintId::ScDataChanged );
......
...@@ -1075,7 +1075,7 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) ...@@ -1075,7 +1075,7 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions )
else else
aFieldData.nTotalPages = nTotalPages; aFieldData.nTotalPages = nTotalPages;
SetDateTime( Date( Date::SYSTEM ), tools::Time( tools::Time::SYSTEM ) ); SetDateTime( DateTime( DateTime::SYSTEM ) );
if( pDocShell->getDocProperties()->getTitle().getLength() != 0 ) if( pDocShell->getDocProperties()->getTitle().getLength() != 0 )
aFieldData.aTitle = pDocShell->getDocProperties()->getTitle(); aFieldData.aTitle = pDocShell->getDocProperties()->getTitle();
...@@ -1111,10 +1111,9 @@ void ScPrintFunc::GetScaleData( Size& rPhysSize, long& rDocHdr, long& rDocFtr ) ...@@ -1111,10 +1111,9 @@ void ScPrintFunc::GetScaleData( Size& rPhysSize, long& rDocHdr, long& rDocFtr )
rDocFtr = aFtr.nHeight; rDocFtr = aFtr.nHeight;
} }
void ScPrintFunc::SetDateTime( const Date& rDate, const tools::Time& rTime ) void ScPrintFunc::SetDateTime( const DateTime& rDateTime )
{ {
aFieldData.aDate = rDate; aFieldData.aDateTime = rDateTime;
aFieldData.aTime = rTime;
} }
static void lcl_DrawGraphic( const Graphic &rGraphic, vcl::RenderContext *pOut, static void lcl_DrawGraphic( const Graphic &rGraphic, vcl::RenderContext *pOut,
......
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