summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-04-16 14:51:57 +0200
committerNoel Grandin <noel@peralex.com>2015-04-22 10:28:39 +0200
commitf87e0957cdcbf9ee12e0615b55a1bb1de1d70efb (patch)
tree382b29377011cb05cf57f67cdecd607ab17cbbd9
parent8b98bc855d7436828553948a1d28d686848e139c (diff)
convert SVX_SEARCHIN_ flags to scoped enum
Change-Id: Iac7216c66afef6cbd355f7047655baaadc0f74db
-rw-r--r--include/svl/srchitem.hxx15
-rw-r--r--sc/source/core/data/table6.cxx6
-rw-r--r--sc/source/ui/undo/undoblk3.cxx2
-rw-r--r--sc/source/ui/unoobj/srchuno.cxx4
-rw-r--r--sc/source/ui/vba/vbarange.cxx10
-rw-r--r--svl/source/items/srchitem.cxx12
-rw-r--r--svx/source/dialog/srchdlg.cxx23
7 files changed, 40 insertions, 32 deletions
diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx
index 2b1eeb627b06..7ce0f77c8922 100644
--- a/include/svl/srchitem.hxx
+++ b/include/svl/srchitem.hxx
@@ -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; }
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index a5b7192f4673..3c24c8fd7c20 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -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;
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 5b765052d421..c403ab43d0d1 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -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" );
diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx
index 2a8b6a59d893..072ff437d798 100644
--- a/sc/source/ui/unoobj/srchuno.cxx
+++ b/sc/source/ui/unoobj/srchuno.cxx
@@ -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) );
}
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 7cd73f319593..d371e949bf75 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -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) ) );
}
}
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index 4a1f981611a5..e46d2557e7d9 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -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:
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 72ad2758a269..1b48ab549043 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -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() );