svtools: Convert EditBrowseBox::RowStatus to enum class
Also drop the explicit int values, as they are irrelevant. Change-Id: I407ffe3c6a3c6d8e2f05ce57434da32db75acc5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204452 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
@@ -404,18 +404,18 @@ EditBrowseBox::RowStatus OTableEditorCtrl::GetRowStatus(sal_Int32 nRow) const
|
||||
{
|
||||
const_cast<OTableEditorCtrl*>(this)->SetDataPtr( nRow );
|
||||
if( !pActRow )
|
||||
return EditBrowseBox::CLEAN;
|
||||
return RowStatus::CLEAN;
|
||||
if (nRow >= 0 && nRow == m_nDataPos)
|
||||
{
|
||||
if( pActRow->IsPrimaryKey() )
|
||||
return EditBrowseBox::CURRENT_PRIMARYKEY;
|
||||
return EditBrowseBox::CURRENT;
|
||||
return RowStatus::CURRENT_PRIMARYKEY;
|
||||
return RowStatus::CURRENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pActRow->IsPrimaryKey() )
|
||||
return EditBrowseBox::PRIMARYKEY;
|
||||
return EditBrowseBox::CLEAN;
|
||||
return RowStatus::PRIMARYKEY;
|
||||
return RowStatus::CLEAN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -167,9 +167,9 @@ void OTableRowView::Paste( sal_Int32 nRow )
|
||||
EditBrowseBox::RowStatus OTableRowView::GetRowStatus(sal_Int32 nRow) const
|
||||
{
|
||||
if (nRow >= 0 && m_nDataPos == nRow)
|
||||
return CURRENT;
|
||||
return RowStatus::CURRENT;
|
||||
else
|
||||
return CLEAN;
|
||||
return RowStatus::CLEAN;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -802,18 +802,18 @@ class SVT_DLLPUBLIC EditBrowseBox : public BrowseBox
|
||||
};
|
||||
|
||||
public:
|
||||
enum RowStatus
|
||||
enum class RowStatus
|
||||
{
|
||||
CLEAN = 0,
|
||||
CURRENT = 1,
|
||||
CURRENTNEW = 2,
|
||||
MODIFIED = 3,
|
||||
NEW = 4,
|
||||
DELETED = 5,
|
||||
PRIMARYKEY = 6,
|
||||
CURRENT_PRIMARYKEY = 7,
|
||||
FILTER = 8,
|
||||
HEADERFOOTER = 9
|
||||
CLEAN,
|
||||
CURRENT,
|
||||
CURRENTNEW,
|
||||
MODIFIED,
|
||||
NEW,
|
||||
DELETED,
|
||||
PRIMARYKEY,
|
||||
CURRENT_PRIMARYKEY,
|
||||
FILTER,
|
||||
HEADERFOOTER,
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
@@ -566,20 +566,21 @@ void OFieldExpressionControl::PaintCell( OutputDevice& rDev, const tools::Rectan
|
||||
EditBrowseBox::RowStatus OFieldExpressionControl::GetRowStatus(sal_Int32 nRow) const
|
||||
{
|
||||
if (nRow >= 0 && nRow == m_nDataPos)
|
||||
return EditBrowseBox::CURRENT;
|
||||
return RowStatus::CURRENT;
|
||||
if ( nRow != BROWSER_ENDOFSELECTION && nRow < static_cast<tools::Long>(m_aGroupPositions.size()) && m_aGroupPositions[nRow] != NO_GROUP )
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< report::XGroup> xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]);
|
||||
return (xGroup->getHeaderOn() || xGroup->getFooterOn())? EditBrowseBox::HEADERFOOTER : EditBrowseBox::CLEAN;
|
||||
return (xGroup->getHeaderOn() || xGroup->getFooterOn()) ? RowStatus::HEADERFOOTER
|
||||
: RowStatus::CLEAN;
|
||||
}
|
||||
catch(uno::Exception&)
|
||||
{
|
||||
TOOLS_WARN_EXCEPTION( "reportdesign", "Exception caught while try to get a group!");
|
||||
}
|
||||
}
|
||||
return EditBrowseBox::CLEAN;
|
||||
return RowStatus::CLEAN;
|
||||
}
|
||||
|
||||
// XContainerListener
|
||||
|
||||
@@ -237,35 +237,35 @@ Image EditBrowseBox::GetImage(RowStatus eStatus) const
|
||||
bool bNeedMirror = IsRTLEnabled();
|
||||
switch (eStatus)
|
||||
{
|
||||
case CURRENT:
|
||||
case RowStatus::CURRENT:
|
||||
aBitmap = Bitmap(BMP_CURRENT);
|
||||
break;
|
||||
case CURRENTNEW:
|
||||
case RowStatus::CURRENTNEW:
|
||||
aBitmap = Bitmap(BMP_CURRENTNEW);
|
||||
break;
|
||||
case MODIFIED:
|
||||
case RowStatus::MODIFIED:
|
||||
aBitmap = Bitmap(BMP_MODIFIED);
|
||||
bNeedMirror = false; // the pen is not mirrored
|
||||
break;
|
||||
case NEW:
|
||||
case RowStatus::NEW:
|
||||
aBitmap = Bitmap(BMP_NEW);
|
||||
break;
|
||||
case DELETED:
|
||||
case RowStatus::DELETED:
|
||||
aBitmap = Bitmap(BMP_DELETED);
|
||||
break;
|
||||
case PRIMARYKEY:
|
||||
case RowStatus::PRIMARYKEY:
|
||||
aBitmap = Bitmap(BMP_PRIMARYKEY);
|
||||
break;
|
||||
case CURRENT_PRIMARYKEY:
|
||||
case RowStatus::CURRENT_PRIMARYKEY:
|
||||
aBitmap = Bitmap(BMP_CURRENT_PRIMARYKEY);
|
||||
break;
|
||||
case FILTER:
|
||||
case RowStatus::FILTER:
|
||||
aBitmap = Bitmap(BMP_FILTER);
|
||||
break;
|
||||
case HEADERFOOTER:
|
||||
case RowStatus::HEADERFOOTER:
|
||||
aBitmap = Bitmap(BMP_HEADERFOOTER);
|
||||
break;
|
||||
case CLEAN:
|
||||
case RowStatus::CLEAN:
|
||||
break;
|
||||
}
|
||||
if ( bNeedMirror )
|
||||
@@ -293,7 +293,7 @@ void EditBrowseBox::PaintStatusCell(OutputDevice& rDev, const tools::Rectangle&
|
||||
DrawTextFlags::Center | DrawTextFlags::VCenter | DrawTextFlags::Clip );
|
||||
}
|
||||
// draw an image
|
||||
else if (eStatus != CLEAN && rDev.GetOutDevType() == OUTDEV_WINDOW)
|
||||
else if (eStatus != RowStatus::CLEAN && rDev.GetOutDevType() == OUTDEV_WINDOW)
|
||||
{
|
||||
Image aImage(GetImage(eStatus));
|
||||
// calc the image position
|
||||
@@ -358,12 +358,7 @@ void EditBrowseBox::RowHeightChanged()
|
||||
BrowseBox::RowHeightChanged();
|
||||
}
|
||||
|
||||
|
||||
EditBrowseBox::RowStatus EditBrowseBox::GetRowStatus(sal_Int32) const
|
||||
{
|
||||
return CLEAN;
|
||||
}
|
||||
|
||||
EditBrowseBox::RowStatus EditBrowseBox::GetRowStatus(sal_Int32) const { return RowStatus::CLEAN; }
|
||||
|
||||
void EditBrowseBox::KeyInput( const KeyEvent& rEvt )
|
||||
{
|
||||
|
||||
@@ -1776,25 +1776,25 @@ void DbGridControl::AdjustRows()
|
||||
svt::EditBrowseBox::RowStatus DbGridControl::GetRowStatus(sal_Int32 nRow) const
|
||||
{
|
||||
if (IsFilterRow(nRow))
|
||||
return EditBrowseBox::FILTER;
|
||||
return EditBrowseBox::RowStatus::FILTER;
|
||||
else if (m_nCurrentPos >= 0 && nRow == m_nCurrentPos)
|
||||
{
|
||||
// new row
|
||||
if (!IsValid(m_xCurrentRow))
|
||||
return EditBrowseBox::DELETED;
|
||||
return RowStatus::DELETED;
|
||||
else if (IsModified())
|
||||
return EditBrowseBox::MODIFIED;
|
||||
return RowStatus::MODIFIED;
|
||||
else if (m_xCurrentRow->IsNew())
|
||||
return EditBrowseBox::CURRENTNEW;
|
||||
return RowStatus::CURRENTNEW;
|
||||
else
|
||||
return EditBrowseBox::CURRENT;
|
||||
return RowStatus::CURRENT;
|
||||
}
|
||||
else if (IsInsertionRow(nRow))
|
||||
return EditBrowseBox::NEW;
|
||||
return RowStatus::NEW;
|
||||
else if (!IsValid(m_xSeekRow))
|
||||
return EditBrowseBox::DELETED;
|
||||
return RowStatus::DELETED;
|
||||
else
|
||||
return EditBrowseBox::CLEAN;
|
||||
return RowStatus::CLEAN;
|
||||
}
|
||||
|
||||
void DbGridControl::PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId) const
|
||||
@@ -3331,7 +3331,7 @@ void DbGridControl::FieldValueChanged(sal_uInt16 _nId)
|
||||
{
|
||||
osl::MutexGuard aPreventDestruction(m_aDestructionSafety);
|
||||
// needed as this may run in a thread other than the main one
|
||||
if (GetRowStatus(GetCurRow()) != EditBrowseBox::MODIFIED)
|
||||
if (GetRowStatus(GetCurRow()) != EditBrowseBox::RowStatus::MODIFIED)
|
||||
// all other cases are handled elsewhere
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user