convert SvxDateType to scoped enum

Change-Id: I5ce04f252642cb3a6c1b08ee22255f6c7b97f0f8
Reviewed-on: https://gerrit.libreoffice.org/35842
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2017-03-29 14:07:22 +02:00
parent 1cd7edadfe
commit a34b33d2b9
13 changed files with 28 additions and 28 deletions

View File

@ -865,9 +865,9 @@ namespace
const SvxDateField* pDateField = static_cast< const SvxDateField* >(ree.pFieldItem->GetField());
if (pDateField)
{
if (pDateField->GetType() == SVXDATETYPE_FIX)
if (pDateField->GetType() == SvxDateType::Fix)
strFldType = "date (fixed)";
else if (pDateField->GetType() == SVXDATETYPE_VAR)
else if (pDateField->GetType() == SvxDateType::Var)
strFldType = "date (variable)";
}
break;

View File

@ -68,7 +68,7 @@ SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTe
bool bIsFixed = false;
xPropSet->getPropertyValue(UNO_TC_PROP_IS_FIXED) >>= bIsFixed;
SvxDateField* pData = new SvxDateField(aDate, bIsFixed ? SVXDATETYPE_FIX : SVXDATETYPE_VAR);
SvxDateField* pData = new SvxDateField(aDate, bIsFixed ? SvxDateType::Fix : SvxDateType::Var);
sal_Int32 nNumFmt = -1;
xPropSet->getPropertyValue(UNO_TC_PROP_NUMFORMAT) >>= nNumFmt;
if (nNumFmt >= SVXDATEFORMAT_APPDEFAULT && nNumFmt <= SVXDATEFORMAT_F)
@ -363,7 +363,7 @@ SV_IMPL_PERSIST1( SvxDateField, SvxFieldData );
SvxDateField::SvxDateField()
{
nFixDate = Date( Date::SYSTEM ).GetDate();
eType = SVXDATETYPE_VAR;
eType = SvxDateType::Var;
eFormat = SVXDATEFORMAT_STDSMALL;
}
@ -410,7 +410,7 @@ void SvxDateField::Load( SvPersistStream & rStm )
void SvxDateField::Save( SvPersistStream & rStm )
{
rStm.WriteInt32( nFixDate );
rStm.WriteUInt16( eType );
rStm.WriteUInt16( (sal_uInt16)eType );
rStm.WriteUInt16( eFormat );
}
@ -418,7 +418,7 @@ void SvxDateField::Save( SvPersistStream & rStm )
OUString SvxDateField::GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLang ) const
{
Date aDate( Date::EMPTY );
if ( eType == SVXDATETYPE_FIX )
if ( eType == SvxDateType::Fix )
aDate.SetDate( nFixDate );
else
aDate = Date( Date::SYSTEM ); // current date

View File

@ -316,7 +316,7 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > const & xAn
mpImpl->mbBoolean2 = true;
// #i35416# for variable date field, don't use invalid "0000-00-00" date,
// use current date instead
bool bFixed = static_cast<const SvxDateField*>(pData)->GetType() == SVXDATETYPE_FIX;
bool bFixed = static_cast<const SvxDateField*>(pData)->GetType() == SvxDateType::Fix;
mpImpl->maDateTime = getDate( bFixed ?
static_cast<const SvxDateField*>(pData)->GetFixDate() :
Date( Date::SYSTEM ).GetDate() );
@ -392,7 +392,7 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
if( mpImpl->mbBoolean2 ) // IsDate?
{
Date aDate( setDate( mpImpl->maDateTime ) );
pData = new SvxDateField( aDate, mpImpl->mbBoolean1?SVXDATETYPE_FIX:SVXDATETYPE_VAR );
pData = new SvxDateField( aDate, mpImpl->mbBoolean1?SvxDateType::Fix:SvxDateType::Var );
if( mpImpl->mnInt32 >= SVXDATEFORMAT_APPDEFAULT && mpImpl->mnInt32 <= SVXDATEFORMAT_F )
static_cast<SvxDateField*>(pData)->SetFormat( (SvxDateFormat)mpImpl->mnInt32 );
}

View File

@ -6466,7 +6466,7 @@ void PPTFieldEntry::SetDateTime( sal_uInt32 nVal )
SvxTimeFormat eTimeFormat;
GetDateTime( nVal, eDateFormat, eTimeFormat );
if ( eDateFormat != SVXDATEFORMAT_APPDEFAULT )
xField1.reset(new SvxFieldItem(SvxDateField( Date( Date::SYSTEM ), SVXDATETYPE_VAR, eDateFormat ), EE_FEATURE_FIELD));
xField1.reset(new SvxFieldItem(SvxDateField( Date( Date::SYSTEM ), SvxDateType::Var, eDateFormat ), EE_FEATURE_FIELD));
if ( eTimeFormat != SVXTIMEFORMAT_APPDEFAULT )
{
std::unique_ptr<SvxFieldItem> xFieldItem(new SvxFieldItem(SvxExtTimeField( tools::Time( tools::Time::SYSTEM ), SVXTIMETYPE_VAR, eTimeFormat ), EE_FEATURE_FIELD));
@ -6869,7 +6869,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
if (!xEntry->xString)
{
// Handle as previously
xEntry->xField1.reset(new SvxFieldItem( SvxDateField( Date( Date::SYSTEM ), SVXDATETYPE_FIX ), EE_FEATURE_FIELD ));
xEntry->xField1.reset(new SvxFieldItem( SvxDateField( Date( Date::SYSTEM ), SvxDateType::Fix ), EE_FEATURE_FIELD ));
}
}
}

View File

@ -89,7 +89,7 @@ public:
// The following are the derivatives of SvxFieldData ...
enum SvxDateType { SVXDATETYPE_FIX, SVXDATETYPE_VAR };
enum class SvxDateType { Fix, Var };
enum SvxDateFormat { SVXDATEFORMAT_APPDEFAULT = 0, // Set as in App
SVXDATEFORMAT_SYSTEM, // Set as in System
SVXDATEFORMAT_STDSMALL,

View File

@ -673,7 +673,7 @@ static bool lcl_ConvertFields(EditEngine& rEng, const OUString* pCommands)
while ((nPos = aStr.indexOf(pCommands[2])) != -1)
{
ESelection aSel( nPar,nPos, nPar,nPos+pCommands[2].getLength() );
rEng.QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SVXDATETYPE_VAR), EE_FEATURE_FIELD), aSel );
rEng.QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD), aSel );
lcl_SetSpace(aStr, aSel ); bChange = true;
}
while ((nPos = aStr.indexOf(pCommands[3])) != -1)

View File

@ -360,7 +360,7 @@ void ScStyleSheetPool::CreateStandardStyles()
aStr = ", ";
pEdEngine->SetText( aStr );
pEdEngine->QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) );
pEdEngine->QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SVXDATETYPE_VAR), EE_FEATURE_FIELD),
pEdEngine->QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD),
ESelection() );
pTxtObj = pEdEngine->CreateTextObject();
pHeaderItem->SetRightArea( *pTxtObj );

View File

@ -618,7 +618,7 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
ClearTextAreas();
OUString aConfidentialEntry(aUserOpt.GetCompany() + " " + m_pFtConfidential->GetText());
m_pWndLeft->GetEditEngine()->SetText(aConfidentialEntry);
m_pWndCenter->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SVXDATETYPE_VAR), EE_FEATURE_FIELD) );
m_pWndCenter->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD) );
OUString aPageEntry( m_pFtPage->GetText() + " ");
m_pWndRight->GetEditEngine()->SetText(aPageEntry);
@ -717,7 +717,7 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
//aPageEntry += " ";
m_pWndCenter->GetEditEngine()->SetText(aPageEntry);
m_pWndCenter->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
m_pWndRight->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SVXDATETYPE_VAR), EE_FEATURE_FIELD) );
m_pWndRight->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD) );
if(!bTravelling)
m_pWndRight->GrabFocus();
}
@ -728,7 +728,7 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
ClearTextAreas();
OUString aCreatedByEntry( m_pFtCreatedBy->GetText() + " " + aUserOpt.GetFirstName() + " " + aUserOpt.GetLastName());
m_pWndLeft->GetEditEngine()->SetText(aCreatedByEntry);
m_pWndCenter->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SVXDATETYPE_VAR), EE_FEATURE_FIELD) );
m_pWndCenter->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD) );
OUString aPageEntry( m_pFtPage->GetText() );
aPageEntry += " ";
m_pWndRight->GetEditEngine()->SetText(aPageEntry);
@ -791,7 +791,7 @@ IMPL_LINK( ScHFEditPage, ClickHdl, Button*, pBtn, void )
else if ( pBtn == m_pBtnLastPage )
m_pEditFocus->InsertField(SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD));
else if ( pBtn == m_pBtnDate )
m_pEditFocus->InsertField(SvxFieldItem(SvxDateField(Date(Date::SYSTEM),SVXDATETYPE_VAR), EE_FEATURE_FIELD));
m_pEditFocus->InsertField(SvxFieldItem(SvxDateField(Date(Date::SYSTEM),SvxDateType::Var), EE_FEATURE_FIELD));
else if ( pBtn == m_pBtnTime )
m_pEditFocus->InsertField(SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD));
else if ( pBtn == m_pBtnFile )

View File

@ -838,7 +838,7 @@ void ScEditFieldObj::setPropertyValueDateTime(const OUString& rName, const uno::
}
else if (rName == SC_UNONAME_ISFIXED)
{
SvxDateType eType = rVal.get<bool>() ? SVXDATETYPE_FIX : SVXDATETYPE_VAR;
SvxDateType eType = rVal.get<bool>() ? SvxDateType::Fix : SvxDateType::Var;
p->SetType(eType);
}
else if (rName == SC_UNONAME_DATETIME)
@ -930,7 +930,7 @@ uno::Any ScEditFieldObj::getPropertyValueDateTime(const OUString& rName)
return uno::makeAny(true);
if (rName == SC_UNONAME_ISFIXED)
return uno::makeAny<sal_Bool>(p->GetType() == SVXDATETYPE_FIX);
return uno::makeAny<sal_Bool>(p->GetType() == SvxDateType::Fix);
if (rName == SC_UNONAME_DATETIME)
{

View File

@ -60,7 +60,7 @@ void SdFieldPopup::Fill( LanguageType eLanguage )
const SvxDateField* pDateField = static_cast<const SvxDateField*>( pField );
SvxDateField aDateField( *pDateField );
if( pDateField->GetType() == SVXDATETYPE_FIX )
if( pDateField->GetType() == SvxDateType::Fix )
CheckItem( 1 );
else
CheckItem( 2 );
@ -174,9 +174,9 @@ SvxFieldData* SdFieldPopup::GetField()
sal_uInt16 i;
if( IsItemChecked( 1 ) )
eType = SVXDATETYPE_FIX;
eType = SvxDateType::Fix;
else
eType = SVXDATETYPE_VAR;
eType = SvxDateType::Var;
for( i = 3; i <= nCount; i++ )
{
@ -192,7 +192,7 @@ SvxFieldData* SdFieldPopup::GetField()
static_cast<SvxDateField*>( pNewField )->SetType( eType );
static_cast<SvxDateField*>( pNewField )->SetFormat( eFormat );
if( (pDateField->GetType() == SVXDATETYPE_VAR) && (eType == SVXDATETYPE_FIX) )
if( (pDateField->GetType() == SvxDateType::Var) && (eType == SvxDateType::Fix) )
{
Date aDate( Date::SYSTEM );
static_cast<SvxDateField*>( pNewField )->SetFixDate( aDate );

View File

@ -87,9 +87,9 @@ SvxFieldData* SdModifyFieldDlg::GetField()
SvxDateFormat eFormat;
if( m_pRbtFix->IsChecked() )
eType = SVXDATETYPE_FIX;
eType = SvxDateType::Fix;
else
eType = SVXDATETYPE_VAR;
eType = SvxDateType::Var;
eFormat = (SvxDateFormat) ( m_pLbFormat->GetSelectEntryPos() + 2 );
@ -264,7 +264,7 @@ void SdModifyFieldDlg::FillControls()
const SvxDateField* pDateField = static_cast<const SvxDateField*>(pField);
SvxDateField aDateField( *pDateField );
if( pDateField->GetType() == SVXDATETYPE_FIX )
if( pDateField->GetType() == SvxDateType::Fix )
m_pRbtFix->Check();
else
m_pRbtVar->Check();

View File

@ -1841,7 +1841,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
case SID_INSERT_FLD_DATE_FIX:
pFieldItem.reset(new SvxFieldItem(
SvxDateField( Date( Date::SYSTEM ), SVXDATETYPE_FIX ), EE_FEATURE_FIELD ));
SvxDateField( Date( Date::SYSTEM ), SvxDateType::Fix ), EE_FEATURE_FIELD ));
break;
case SID_INSERT_FLD_DATE_VAR:

View File

@ -490,7 +490,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
{
case SID_INSERT_FLD_DATE_FIX:
pFieldItem.reset(new SvxFieldItem(
SvxDateField( Date( Date::SYSTEM ), SVXDATETYPE_FIX ), EE_FEATURE_FIELD ));
SvxDateField( Date( Date::SYSTEM ), SvxDateType::Fix ), EE_FEATURE_FIELD ));
break;
case SID_INSERT_FLD_DATE_VAR: