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