convert SVX_SEARCHIN_ flags to scoped enum

Change-Id: Iac7216c66afef6cbd355f7047655baaadc0f74db
This commit is contained in:
Noel Grandin 2015-04-16 14:51:57 +02:00
parent 8b98bc855d
commit f87e0957cd
7 changed files with 40 additions and 32 deletions

View File

@ -42,9 +42,12 @@ enum class SvxSearchCmd
};
// search flags
#define SVX_SEARCHIN_FORMULA ((sal_uInt16)0)
#define SVX_SEARCHIN_VALUE ((sal_uInt16)1)
#define SVX_SEARCHIN_NOTE ((sal_uInt16)2)
enum class SvxSearchCellType
{
FORMULA = 0,
VALUE = 1,
NOTE = 2,
};
enum class SvxSearchApp
{
@ -67,7 +70,7 @@ class SVL_DLLPUBLIC SvxSearchItem :
SvxSearchCmd nCommand; // command (Search, Search all, Replace, Replace all)
// Calc-specific
sal_uInt16 nCellType; // Search in Formulas/Values/Notes
SvxSearchCellType nCellType; // Search in Formulas/Values/Notes
SvxSearchApp nAppFlag; // application which the dialog is for
bool bRowDirection; // search direction: row-wise/column-wise
bool bAllTables; // search in all sheets
@ -145,8 +148,8 @@ public:
bool IsSearchFiltered() const { return bSearchFiltered; }
void SetSearchFiltered(bool b) { bSearchFiltered = b; }
sal_uInt16 GetCellType() const { return nCellType; }
void SetCellType(sal_uInt16 nNewCellType) { nCellType = nNewCellType; }
SvxSearchCellType GetCellType() const { return nCellType; }
void SetCellType(SvxSearchCellType nNewCellType) { nCellType = nNewCellType; }
bool GetNotes() const { return bNotes; }
void SetNotes(bool bNew) { bNotes = bNew; }

View File

@ -77,7 +77,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
CellType eCellType = aCell.meType;
switch (rSearchItem.GetCellType())
{
case SVX_SEARCHIN_FORMULA:
case SvxSearchCellType::FORMULA:
{
if ( eCellType == CELLTYPE_FORMULA )
aCell.mpFormula->GetFormula(aString, pDocument->GetGrammar());
@ -89,7 +89,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
}
}
break;
case SVX_SEARCHIN_VALUE:
case SvxSearchCellType::VALUE:
if ( eCellType == CELLTYPE_EDIT )
bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, pDocument, aString);
else
@ -97,7 +97,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
aCol[nCol].GetInputString( nRow, aString );
}
break;
case SVX_SEARCHIN_NOTE:
case SvxSearchCellType::NOTE:
break; // don't search this case here
default:
break;

View File

@ -1012,7 +1012,7 @@ void ScUndoReplace::Undo()
SC_FOLLOW_JUMP, false, false );
pDocShell->PostPaintGridAll();
}
else if (pSearchItem->GetCellType() == SVX_SEARCHIN_NOTE)
else if (pSearchItem->GetCellType() == SvxSearchCellType::NOTE)
{
ScPostIt* pNote = rDoc.GetNote(aCursorPos);
OSL_ENSURE( pNote, "ScUndoReplace::Undo - cell does not contain a note" );

View File

@ -82,7 +82,7 @@ ScCellSearchObj::ScCellSearchObj() :
pSearchItem->SetLEVLonger(2);
// Calc-Flags
pSearchItem->SetRowDirection(false);
pSearchItem->SetCellType(SVX_SEARCHIN_FORMULA);
pSearchItem->SetCellType(SvxSearchCellType::FORMULA);
// Selection-Flag wird beim Aufruf gesetzt
}
@ -153,7 +153,7 @@ void SAL_CALL ScCellSearchObj::setPropertyValue(
else if (aString == SC_UNO_SRCHSIMADD) pSearchItem->SetLEVLonger( ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
else if (aString == SC_UNO_SRCHSIMEX) pSearchItem->SetLEVOther( ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
else if (aString == SC_UNO_SRCHSIMREM) pSearchItem->SetLEVShorter( ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
else if (aString == SC_UNO_SRCHTYPE) pSearchItem->SetCellType( ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
else if (aString == SC_UNO_SRCHTYPE) pSearchItem->SetCellType( static_cast<SvxSearchCellType>(ScUnoHelpFunctions::GetInt16FromAny( aValue )) );
else if (aString == SC_UNO_SRCHFILTERED) pSearchItem->SetSearchFiltered( ScUnoHelpFunctions::GetBoolFromAny(aValue) );
}

View File

@ -3182,23 +3182,23 @@ ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& L
sal_Int32 nLookIn = 0;
if( LookIn >>= nLookIn )
{
sal_Int16 nSearchType = 0;
SvxSearchCellType nSearchType;
switch( nLookIn )
{
case excel::XlFindLookIn::xlComments :
nSearchType = SVX_SEARCHIN_NOTE; // Notes
nSearchType = SvxSearchCellType::NOTE; // Notes
break;
case excel::XlFindLookIn::xlFormulas :
nSearchType = SVX_SEARCHIN_FORMULA;
nSearchType = SvxSearchCellType::FORMULA;
break;
case excel::XlFindLookIn::xlValues :
nSearchType = SVX_SEARCHIN_VALUE;
nSearchType = SvxSearchCellType::VALUE;
break;
default:
throw uno::RuntimeException("Range::Replace, illegal value for LookIn." );
}
newOptions.SetCellType( nSearchType );
xDescriptor->setPropertyValue( "SearchType", uno::makeAny( nSearchType ) );
xDescriptor->setPropertyValue( "SearchType", uno::makeAny( static_cast<sal_uInt16>(nSearchType) ) );
}
}

View File

@ -116,7 +116,7 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) :
TransliterationModules_IGNORE_CASE ),
eFamily ( SFX_STYLE_FAMILY_PARA ),
nCommand ( SvxSearchCmd::FIND ),
nCellType ( SVX_SEARCHIN_FORMULA ),
nCellType ( SvxSearchCellType::FORMULA ),
nAppFlag ( SvxSearchApp::WRITER ),
bRowDirection ( true ),
bAllTables ( false ),
@ -378,7 +378,7 @@ bool SvxSearchItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMembe
aSeq[2].Name = SRCH_PARA_COMMAND;
aSeq[2].Value <<= static_cast<sal_uInt16>(nCommand);
aSeq[3].Name = SRCH_PARA_CELLTYPE;
aSeq[3].Value <<= nCellType;
aSeq[3].Value <<= static_cast<sal_uInt16>(nCellType);
aSeq[4].Name = SRCH_PARA_APPFLAG;
aSeq[4].Value <<= static_cast<sal_uInt16>(nAppFlag);
aSeq[5].Name = SRCH_PARA_ROWDIR;
@ -495,8 +495,12 @@ bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nM
}
else if ( aSeq[i].Name == SRCH_PARA_CELLTYPE )
{
if ( aSeq[i].Value >>= nCellType )
sal_uInt16 nTmp;
if ( aSeq[i].Value >>= nTmp )
{
nCellType = static_cast<SvxSearchCellType>(nTmp);
++nConvertedCount;
}
}
else if ( aSeq[i].Name == SRCH_PARA_APPFLAG )
{
@ -553,7 +557,7 @@ bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nM
case MID_SEARCH_STYLEFAMILY:
bRet = (rVal >>= nInt); eFamily = (SfxStyleFamily) (sal_Int16) nInt; break;
case MID_SEARCH_CELLTYPE:
bRet = (rVal >>= nInt); nCellType = (sal_uInt16) nInt; break;
bRet = (rVal >>= nInt); nCellType = static_cast<SvxSearchCellType>(nInt); break;
case MID_SEARCH_ROWDIRECTION:
bRet = (rVal >>= bRowDirection); break;
case MID_SEARCH_ALLTABLES:

View File

@ -765,23 +765,24 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
m_pColumnsBtn->SetClickHdl( aLink );
m_pAllSheetsCB->SetClickHdl( aLink );
sal_uIntPtr nModifyFlagCheck;
switch ( pSearchItem->GetCellType() )
{
case SVX_SEARCHIN_FORMULA:
if ( ( nModifyFlag & MODIFY_FORMULAS ) == 0 )
m_pCalcSearchInLB->SelectEntryPos( SVX_SEARCHIN_FORMULA );
case SvxSearchCellType::FORMULA:
nModifyFlagCheck = MODIFY_FORMULAS;
break;
case SVX_SEARCHIN_VALUE:
if ( ( nModifyFlag & MODIFY_VALUES ) == 0 )
m_pCalcSearchInLB->SelectEntryPos( SVX_SEARCHIN_VALUE );
case SvxSearchCellType::VALUE:
nModifyFlagCheck = MODIFY_VALUES;
break;
case SVX_SEARCHIN_NOTE:
if ( ( nModifyFlag & MODIFY_CALC_NOTES ) == 0 )
m_pCalcSearchInLB->SelectEntryPos( SVX_SEARCHIN_NOTE );
case SvxSearchCellType::NOTE:
nModifyFlagCheck = MODIFY_CALC_NOTES;
break;
}
if ( ( nModifyFlag & MODIFY_FORMULAS ) == 0 )
m_pCalcSearchInLB->SelectEntryPos( static_cast<sal_Int32>(pSearchItem->GetCellType()) );
m_pWordBtn->SetText( aCalcStr.getToken( 0, '#' ) );
if ( pSearchItem->GetRowDirection() &&
@ -1235,7 +1236,7 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
if ( !bWriter )
{
if ( m_pCalcSearchInLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
pSearchItem->SetCellType( m_pCalcSearchInLB->GetSelectEntryPos() );
pSearchItem->SetCellType( static_cast<SvxSearchCellType>(m_pCalcSearchInLB->GetSelectEntryPos()) );
pSearchItem->SetRowDirection( m_pRowsBtn->IsChecked() );
pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() );
@ -2184,7 +2185,7 @@ void SvxSearchDialog::SaveToModule_Impl()
if ( !bWriter )
{
if ( m_pCalcSearchInLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
pSearchItem->SetCellType( m_pCalcSearchInLB->GetSelectEntryPos() );
pSearchItem->SetCellType( static_cast<SvxSearchCellType>(m_pCalcSearchInLB->GetSelectEntryPos()) );
pSearchItem->SetRowDirection( m_pRowsBtn->IsChecked() );
pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() );