summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-02-27 10:08:03 +0200
committerNoel Grandin <noel@peralex.com>2015-03-02 08:59:18 +0200
commit3c866bb8e42554ac96d3588208e167e7786e2d00 (patch)
tree9214124ed0b7d8274c5609725ed72a97466bbfce
parentf9ba16e44b2813dd1fc9b0e06994f67c6350f050 (diff)
replace SVX_SEARCHCMD_ constants with enum class
Change-Id: I675c488742219cc19624a21d1fc8e5033e7cbefa
-rw-r--r--basctl/source/basicide/baside2.cxx10
-rw-r--r--basctl/source/basicide/basides1.cxx2
-rw-r--r--editeng/source/editeng/impedit4.cxx8
-rw-r--r--include/svl/srchitem.hxx17
-rw-r--r--sc/qa/unit/ucalc.cxx2
-rw-r--r--sc/source/core/data/documen3.cxx12
-rw-r--r--sc/source/core/data/table6.cxx52
-rw-r--r--sc/source/ui/undo/undoblk3.cxx6
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx6
-rw-r--r--sc/source/ui/view/tabvwshe.cxx8
-rw-r--r--sc/source/ui/view/viewfun2.cxx26
-rw-r--r--sd/source/ui/view/Outliner.cxx16
-rw-r--r--svl/source/items/srchitem.cxx12
-rw-r--r--svx/source/dialog/srchdlg.cxx10
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx2
-rw-r--r--sw/source/uibase/uiview/srcview.cxx8
-rw-r--r--sw/source/uibase/uiview/viewsrch.cxx26
17 files changed, 115 insertions, 108 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index af77aec82b7e..d73ecd3899be 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1273,17 +1273,17 @@ sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem,
bool const bForward = !rSearchItem.GetBackward();
sal_uInt16 nFound = 0;
- if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND ) ||
- ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL ) )
+ if ( ( rSearchItem.GetCommand() == SvxSearchCmd::FIND ) ||
+ ( rSearchItem.GetCommand() == SvxSearchCmd::FIND_ALL ) )
{
nFound = pView->Search( rSearchItem.GetSearchOptions() , bForward ) ? 1 : 0;
}
- else if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE ) ||
- ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL ) )
+ else if ( ( rSearchItem.GetCommand() == SvxSearchCmd::REPLACE ) ||
+ ( rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL ) )
{
if ( !IsReadOnly() )
{
- bool const bAll = rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL;
+ bool const bAll = rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL;
nFound = pView->Replace( rSearchItem.GetSearchOptions() , bAll , bForward );
}
}
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 1ec577b743bd..4d1bedb402e8 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -87,7 +87,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq )
// memorize item because of the adjustments...
GetExtraData()->SetSearchItem(rSearchItem);
sal_Int32 nFound = 0;
- if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL)
+ if (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL)
{
sal_uInt16 nActModWindows = 0;
for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it)
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index b375a58cc15a..f843a6308763 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2516,13 +2516,13 @@ sal_Int32 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSe
EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() );
// FIND_ALL is not possible without multiple selection.
- if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND ) ||
- ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL ) )
+ if ( ( rSearchItem.GetCommand() == SvxSearchCmd::FIND ) ||
+ ( rSearchItem.GetCommand() == SvxSearchCmd::FIND_ALL ) )
{
if ( Search( rSearchItem, pEditView ) )
nFound++;
}
- else if ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE )
+ else if ( rSearchItem.GetCommand() == SvxSearchCmd::REPLACE )
{
// The word is selected if the user not altered the selection
// in between:
@@ -2535,7 +2535,7 @@ sal_Int32 ImpEditEngine::StartSearchAndReplace( EditView* pEditView, const SvxSe
if( Search( rSearchItem, pEditView ) )
nFound = 1;
}
- else if ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL )
+ else if ( rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL )
{
// The Writer replaces all front beginning to end ...
SvxSearchItem aTmpItem( rSearchItem );
diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx
index 0b2ef01c3ccf..33d101a0596d 100644
--- a/include/svl/srchitem.hxx
+++ b/include/svl/srchitem.hxx
@@ -33,10 +33,13 @@
// defines ---------------------------------------------------------------
// commands
-#define SVX_SEARCHCMD_FIND ((sal_uInt16)0)
-#define SVX_SEARCHCMD_FIND_ALL ((sal_uInt16)1)
-#define SVX_SEARCHCMD_REPLACE ((sal_uInt16)2)
-#define SVX_SEARCHCMD_REPLACE_ALL ((sal_uInt16)3)
+enum class SvxSearchCmd
+{
+ FIND = 0,
+ FIND_ALL = 1,
+ REPLACE = 2,
+ REPLACE_ALL = 3,
+};
// search flags
#define SVX_SEARCHIN_FORMULA ((sal_uInt16)0)
@@ -57,7 +60,7 @@ class SVL_DLLPUBLIC SvxSearchItem :
SfxStyleFamily eFamily; // style family
- sal_uInt16 nCommand; // command (Search, Search all, Replace, Replace all)
+ SvxSearchCmd nCommand; // command (Search, Search all, Replace, Replace all)
// Calc-specific
sal_uInt16 nCellType; // Search in Formulas/Values/Notes
@@ -94,8 +97,8 @@ public:
virtual void Notify( const com::sun::star::uno::Sequence< OUString > &rPropertyNames ) SAL_OVERRIDE;
virtual void Commit() SAL_OVERRIDE;
- sal_uInt16 GetCommand() const { return nCommand; }
- void SetCommand(sal_uInt16 nNewCommand) { nCommand = nNewCommand; }
+ SvxSearchCmd GetCommand() const { return nCommand; }
+ void SetCommand(SvxSearchCmd nNewCommand) { nCommand = nNewCommand; }
inline const OUString GetSearchString() const;
inline void SetSearchString(const OUString& rNewString);
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 535ca0ecf37d..330ff68982f1 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4306,7 +4306,7 @@ void Test::testSearchCells()
SvxSearchItem aItem(SID_SEARCH_ITEM);
aItem.SetSearchString(OUString("A"));
- aItem.SetCommand(SVX_SEARCHCMD_FIND_ALL);
+ aItem.SetCommand(SvxSearchCmd::FIND_ALL);
ScMarkData aMarkData;
aMarkData.SelectOneTable(0);
SCCOL nCol = 0;
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index b98e43d71f16..57a20e108d82 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1155,9 +1155,9 @@ void ScDocument::GetAutoFormatData(SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
void ScDocument::GetSearchAndReplaceStart( const SvxSearchItem& rSearchItem,
SCCOL& rCol, SCROW& rRow )
{
- sal_uInt16 nCommand = rSearchItem.GetCommand();
- bool bReplace = ( nCommand == SVX_SEARCHCMD_REPLACE ||
- nCommand == SVX_SEARCHCMD_REPLACE_ALL );
+ SvxSearchCmd nCommand = rSearchItem.GetCommand();
+ bool bReplace = ( nCommand == SvxSearchCmd::REPLACE ||
+ nCommand == SvxSearchCmd::REPLACE_ALL );
if ( rSearchItem.GetBackward() )
{
if ( rSearchItem.GetRowDirection() )
@@ -1252,9 +1252,9 @@ bool ScDocument::SearchAndReplace(
SCCOL nCol;
SCROW nRow;
SCTAB nTab;
- sal_uInt16 nCommand = rSearchItem.GetCommand();
- if ( nCommand == SVX_SEARCHCMD_FIND_ALL ||
- nCommand == SVX_SEARCHCMD_REPLACE_ALL )
+ SvxSearchCmd nCommand = rSearchItem.GetCommand();
+ if ( nCommand == SvxSearchCmd::FIND_ALL ||
+ nCommand == SvxSearchCmd::REPLACE_ALL )
{
SCTAB nMax = maTabs.size();
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 3375df4a366d..a5b7192f4673 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -132,8 +132,8 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
sal_uInt8 cMatrixFlag = MM_NONE;
if ( bFound &&
- ( (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE)
- ||(rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL) ) &&
+ ( (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE)
+ ||(rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL) ) &&
// Don't split the matrix, only replace Matrix formulas
!( (eCellType == CELLTYPE_FORMULA &&
((cMatrixFlag = aCell.mpFormula->GetMatrixFlag()) == MM_REFERENCE))
@@ -142,7 +142,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
IsBlockEditable(nCol, nRow, nCol, nRow)
)
{
- if ( cMatrixFlag == MM_NONE && rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE )
+ if ( cMatrixFlag == MM_NONE && rSearchItem.GetCommand() == SvxSearchCmd::REPLACE )
rUndoStr = aString;
else if (pUndoDoc)
{
@@ -189,7 +189,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRo
// continue search ?
if (bRepeat)
{
- if ( rSearchItem.GetCommand() != SVX_SEARCHCMD_REPLACE_ALL || nStart >= nEnd )
+ if ( rSearchItem.GetCommand() != SvxSearchCmd::REPLACE_ALL || nStart >= nEnd )
bRepeat = false;
else if (bDoBack)
{
@@ -289,8 +289,8 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc)
{
bool bFound = false;
- bool bAll = (rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL)
- ||(rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL);
+ bool bAll = (rSearchItem.GetCommand() == SvxSearchCmd::FIND_ALL)
+ ||(rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL);
SCCOL nCol = rCol;
SCROW nRow = rRow;
@@ -695,10 +695,10 @@ bool ScTable::SearchAndReplace(
const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark,
ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc)
{
- sal_uInt16 nCommand = rSearchItem.GetCommand();
+ SvxSearchCmd nCommand = rSearchItem.GetCommand();
bool bFound = false;
if ( ValidColRow(rCol, rRow) ||
- ((nCommand == SVX_SEARCHCMD_FIND || nCommand == SVX_SEARCHCMD_REPLACE) &&
+ ((nCommand == SvxSearchCmd::FIND || nCommand == SvxSearchCmd::REPLACE) &&
(((rCol == MAXCOLCOUNT || rCol == -1) && ValidRow(rRow)) ||
((rRow == MAXROWCOUNT || rRow == -1) && ValidCol(rCol))
)
@@ -708,13 +708,13 @@ bool ScTable::SearchAndReplace(
bool bStyles = rSearchItem.GetPattern();
if (bStyles)
{
- if (nCommand == SVX_SEARCHCMD_FIND)
+ if (nCommand == SvxSearchCmd::FIND)
bFound = SearchStyle(rSearchItem, rCol, rRow, rMark);
- else if (nCommand == SVX_SEARCHCMD_REPLACE)
+ else if (nCommand == SvxSearchCmd::REPLACE)
bFound = ReplaceStyle(rSearchItem, rCol, rRow, rMark, false);
- else if (nCommand == SVX_SEARCHCMD_FIND_ALL)
+ else if (nCommand == SvxSearchCmd::FIND_ALL)
bFound = SearchAllStyle(rSearchItem, rMark, rMatchedRanges);
- else if (nCommand == SVX_SEARCHCMD_REPLACE_ALL)
+ else if (nCommand == SvxSearchCmd::REPLACE_ALL)
bFound = ReplaceAllStyle(rSearchItem, rMark, rMatchedRanges, pUndoDoc);
}
else
@@ -739,13 +739,13 @@ bool ScTable::SearchAndReplace(
pSearchText = new utl::TextSearch( aSearchOptions );
- if (nCommand == SVX_SEARCHCMD_FIND)
+ if (nCommand == SvxSearchCmd::FIND)
bFound = Search(rSearchItem, rCol, rRow, rMark, rUndoStr, pUndoDoc);
- else if (nCommand == SVX_SEARCHCMD_FIND_ALL)
+ else if (nCommand == SvxSearchCmd::FIND_ALL)
bFound = SearchAll(rSearchItem, rMark, rMatchedRanges, rUndoStr, pUndoDoc);
- else if (nCommand == SVX_SEARCHCMD_REPLACE)
+ else if (nCommand == SvxSearchCmd::REPLACE)
bFound = Replace(rSearchItem, rCol, rRow, rMark, rUndoStr, pUndoDoc);
- else if (nCommand == SVX_SEARCHCMD_REPLACE_ALL)
+ else if (nCommand == SvxSearchCmd::REPLACE_ALL)
bFound = ReplaceAll(rSearchItem, rMark, rMatchedRanges, rUndoStr, pUndoDoc);
delete pSearchText;
@@ -799,8 +799,8 @@ bool ScTable::SearchAndReplaceEmptyCells(
aRanges = aNewRanges;
}
- sal_uInt16 nCommand = rSearchItem.GetCommand();
- if (nCommand == SVX_SEARCHCMD_FIND || nCommand == SVX_SEARCHCMD_REPLACE)
+ SvxSearchCmd nCommand = rSearchItem.GetCommand();
+ if (nCommand == SvxSearchCmd::FIND || nCommand == SvxSearchCmd::REPLACE)
{
if (rSearchItem.GetBackward())
{
@@ -821,7 +821,7 @@ bool ScTable::SearchAndReplaceEmptyCells(
}
}
}
- else if (nCommand == SVX_SEARCHCMD_FIND_ALL || nCommand == SVX_SEARCHCMD_REPLACE_ALL)
+ else if (nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL)
{
bool bFound = false;
for ( size_t i = 0, nListSize = aRanges.size(); i < nListSize; ++i )
@@ -845,7 +845,7 @@ bool lcl_maybeReplaceCellString(
// empty cell found.
rCol = nCol;
rRow = nRow;
- if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE &&
+ if (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE &&
!rSearchItem.GetReplaceString().isEmpty())
{
rColObj.SetRawString(nRow, rSearchItem.GetReplaceString());
@@ -862,7 +862,7 @@ bool ScTable::SearchRangeForEmptyCell(
const ScRange& rRange, const SvxSearchItem& rSearchItem,
SCCOL& rCol, SCROW& rRow, OUString& rUndoStr)
{
- sal_uInt16 nCmd = rSearchItem.GetCommand();
+ SvxSearchCmd nCmd = rSearchItem.GetCommand();
bool bSkipFiltered = rSearchItem.IsSearchFiltered();
if (rSearchItem.GetBackward())
{
@@ -882,7 +882,7 @@ bool ScTable::SearchRangeForEmptyCell(
SCCOL nBeginCol = rRange.aEnd.Col();
if (nRow == rRow && nBeginCol >= rCol)
// always start from one cell before the cursor.
- nBeginCol = rCol - (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0);
+ nBeginCol = rCol - (nCmd == SvxSearchCmd::FIND ? 1 : 0);
for (SCCOL nCol = nBeginCol; nCol >= rRange.aStart.Col(); --nCol)
{
@@ -901,7 +901,7 @@ bool ScTable::SearchRangeForEmptyCell(
SCROW nBeginRow = rRange.aEnd.Row();
if (nCol == rCol && nBeginRow >= rRow)
// always start from one cell before the cursor.
- nBeginRow = rRow - (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0);
+ nBeginRow = rRow - (nCmd == SvxSearchCmd::FIND ? 1 : 0);
for (SCROW nRow = nBeginRow; nRow >= rRange.aStart.Row(); --nRow)
{
if (bSkipFiltered)
@@ -933,7 +933,7 @@ bool ScTable::SearchRangeForEmptyCell(
SCCOL nBeginCol = rRange.aStart.Col();
if (nRow == rRow && nBeginCol <= rCol)
// always start from one cell past the cursor.
- nBeginCol = rCol + (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0);
+ nBeginCol = rCol + (nCmd == SvxSearchCmd::FIND ? 1 : 0);
for (SCCOL nCol = nBeginCol; nCol <= rRange.aEnd.Col(); ++nCol)
{
if (lcl_maybeReplaceCellString(aCol[nCol], rCol, rRow, rUndoStr, nCol, nRow, rSearchItem))
@@ -951,7 +951,7 @@ bool ScTable::SearchRangeForEmptyCell(
SCROW nBeginRow = rRange.aStart.Row();
if (nCol == rCol && nBeginRow <= rRow)
// always start from one cell past the cursor.
- nBeginRow = rRow + (nCmd == SVX_SEARCHCMD_FIND ? 1 : 0);
+ nBeginRow = rRow + (nCmd == SvxSearchCmd::FIND ? 1 : 0);
for (SCROW nRow = nBeginRow; nRow <= rRange.aEnd.Row(); ++nRow)
{
if (bSkipFiltered)
@@ -973,7 +973,7 @@ bool ScTable::SearchRangeForAllEmptyCells(
ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc)
{
bool bFound = false;
- bool bReplace = (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL) &&
+ bool bReplace = (rSearchItem.GetCommand() == SvxSearchCmd::REPLACE_ALL) &&
!rSearchItem.GetReplaceString().isEmpty();
bool bSkipFiltered = rSearchItem.IsSearchFiltered();
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 494fd3dcfc2e..5b765052d421 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -979,7 +979,7 @@ void ScUndoReplace::Undo()
if (pUndoDoc) // only for ReplaceAll !!
{
- OSL_ENSURE(pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL,
+ OSL_ENSURE(pSearchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL,
"ScUndoReplace:: Wrong Mode");
SetViewMarkData( aMarkData );
@@ -997,7 +997,7 @@ void ScUndoReplace::Undo()
pDocShell->PostPaintGridAll();
}
else if (pSearchItem->GetPattern() &&
- pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE)
+ pSearchItem->GetCommand() == SvxSearchCmd::REPLACE)
{
OUString aTempStr = pSearchItem->GetSearchString(); // toggle
pSearchItem->SetSearchString(pSearchItem->GetReplaceString());
@@ -1066,7 +1066,7 @@ void ScUndoReplace::Redo()
}
}
else if (pSearchItem->GetPattern() &&
- pSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE)
+ pSearchItem->GetCommand() == SvxSearchCmd::REPLACE)
{
rDoc.ReplaceStyle( *pSearchItem,
aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(),
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 752314e43f15..7fa1c76c76c8 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -3924,7 +3924,7 @@ uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll(
if (pSearchItem)
{
ScDocument& rDoc = pDocShell->GetDocument();
- pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL );
+ pSearchItem->SetCommand( SvxSearchCmd::FIND_ALL );
// immer nur innerhalb dieses Objekts
pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
@@ -3962,7 +3962,7 @@ uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl(
if (pSearchItem)
{
ScDocument& rDoc = pDocShell->GetDocument();
- pSearchItem->SetCommand( SVX_SEARCHCMD_FIND );
+ pSearchItem->SetCommand( SvxSearchCmd::FIND );
// immer nur innerhalb dieses Objekts
pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
@@ -4049,7 +4049,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea
{
ScDocument& rDoc = pDocShell->GetDocument();
bool bUndo(rDoc.IsUndoEnabled());
- pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL );
+ pSearchItem->SetCommand( SvxSearchCmd::REPLACE_ALL );
// immer nur innerhalb dieses Objekts
pSearchItem->SetSelection( !lcl_WholeSheet(aRanges) );
diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx
index 464f8011e04b..d2298c25cd93 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -287,13 +287,13 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq )
aSearchItem.SetReplaceString(static_cast<const SfxStringItem*>(pItem)->GetValue());
if (nSlot == FID_SEARCH)
- aSearchItem.SetCommand(SVX_SEARCHCMD_FIND);
+ aSearchItem.SetCommand(SvxSearchCmd::FIND);
else if(nSlot == FID_REPLACE)
- aSearchItem.SetCommand(SVX_SEARCHCMD_REPLACE);
+ aSearchItem.SetCommand(SvxSearchCmd::REPLACE);
else if(nSlot == FID_REPLACE_ALL)
- aSearchItem.SetCommand(SVX_SEARCHCMD_REPLACE_ALL);
+ aSearchItem.SetCommand(SvxSearchCmd::REPLACE_ALL);
else
- aSearchItem.SetCommand(SVX_SEARCHCMD_FIND_ALL);
+ aSearchItem.SetCommand(SvxSearchCmd::FIND_ALL);
// Request ausfuehren (dabei wird das SearchItem gespeichert)
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index dd46c18143c3..9cf4091204c7 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1504,7 +1504,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
nRow = nOldRow = GetViewData().GetCurY();
nTab = nOldTab = GetViewData().GetTabNo();
- sal_uInt16 nCommand = pSearchItem->GetCommand();
+ SvxSearchCmd nCommand = pSearchItem->GetCommand();
bool bAllTables = pSearchItem->IsAllTables();
std::set<SCTAB> aOldSelectedTables;
SCTAB nLastTab = rDoc.GetTableCount() - 1;
@@ -1522,8 +1522,8 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
nEndTab = rMark.GetLastSelected();
}
- if ( nCommand == SVX_SEARCHCMD_FIND
- || nCommand == SVX_SEARCHCMD_FIND_ALL)
+ if ( nCommand == SvxSearchCmd::FIND
+ || nCommand == SvxSearchCmd::FIND_ALL)
bAddUndo = false;
//! account for bAttrib during Undo !!!
@@ -1534,7 +1534,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
if (bAddUndo)
{
pUndoMark.reset(new ScMarkData(rMark)); // Mark is being modified
- if ( nCommand == SVX_SEARCHCMD_REPLACE_ALL )
+ if ( nCommand == SvxSearchCmd::REPLACE_ALL )
{
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
@@ -1574,7 +1574,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
aUndoStr, pUndoDoc.release(), pSearchItem ) );
}
- if (nCommand == SVX_SEARCHCMD_FIND_ALL || nCommand == SVX_SEARCHCMD_REPLACE_ALL)
+ if (nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL)
{
SfxViewFrame* pViewFrm = SfxViewFrame::Current();
if (pViewFrm)
@@ -1600,8 +1600,8 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
break; // break 'while (TRUE)'
}
- else if ( bFirst && (nCommand == SVX_SEARCHCMD_FIND ||
- nCommand == SVX_SEARCHCMD_REPLACE) )
+ else if ( bFirst && (nCommand == SvxSearchCmd::FIND ||
+ nCommand == SvxSearchCmd::REPLACE) )
{
bFirst = false;
GetFrameWin()->LeaveWait();
@@ -1625,7 +1625,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
}
else // nothing found
{
- if ( nCommand == SVX_SEARCHCMD_FIND_ALL || nCommand == SVX_SEARCHCMD_REPLACE_ALL )
+ if ( nCommand == SvxSearchCmd::FIND_ALL || nCommand == SvxSearchCmd::REPLACE_ALL )
{
pDocSh->PostPaintGridAll(); // Mark
}
@@ -1673,10 +1673,10 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
AlignToCursor( nCol, nRow, SC_FOLLOW_JUMP );
SetCursor( nCol, nRow, true );
- if ( nCommand == SVX_SEARCHCMD_REPLACE
- || nCommand == SVX_SEARCHCMD_REPLACE_ALL )
+ if ( nCommand == SvxSearchCmd::REPLACE
+ || nCommand == SvxSearchCmd::REPLACE_ALL )
{
- if ( nCommand == SVX_SEARCHCMD_REPLACE )
+ if ( nCommand == SvxSearchCmd::REPLACE )
{
pDocSh->PostPaint( nCol,nRow,nTab, nCol,nRow,nTab, PAINT_GRID );
@@ -1685,7 +1685,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
if ( nCol == nOldCol && nRow == nOldRow && nTab == nOldTab )
{
SvxSearchItem aSearchItem = ScGlobal::GetSearchItem();
- aSearchItem.SetCommand(SVX_SEARCHCMD_FIND);
+ aSearchItem.SetCommand(SvxSearchCmd::FIND);
aSearchItem.SetWhich(SID_SEARCH_ITEM);
ScRangeList aMatchedRanges;
@@ -1702,7 +1702,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
pDocSh->PostPaintGridAll();
pDocSh->SetDocumentModified();
}
- else if ( nCommand == SVX_SEARCHCMD_FIND_ALL )
+ else if ( nCommand == SvxSearchCmd::FIND_ALL )
pDocSh->PostPaintGridAll(); // mark
GetFrameWin()->LeaveWait();
}
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 9b1226a5225c..1077a24b5c81 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -483,8 +483,8 @@ bool Outliner::StartSearchAndReplace (const SvxSearchItem* pSearchItem)
Initialize ( ! mpSearchItem->GetBackward());
- const sal_uInt16 nCommand (mpSearchItem->GetCommand());
- if (nCommand == SVX_SEARCHCMD_REPLACE_ALL)
+ const SvxSearchCmd nCommand (mpSearchItem->GetCommand());
+ if (nCommand == SvxSearchCmd::REPLACE_ALL)
bEndOfSearch = SearchAndReplaceAll ();
else
{
@@ -653,19 +653,19 @@ bool Outliner::SearchAndReplaceOnce (void)
// following call to StartSearchAndReplace will then search for
// the next match.
if (meMode == SEARCH
- && mpSearchItem->GetCommand() == SVX_SEARCHCMD_REPLACE)
+ && mpSearchItem->GetCommand() == SvxSearchCmd::REPLACE)
if (pOutlinerView->GetSelection().HasRange())
pOutlinerView->StartSearchAndReplace(*mpSearchItem);
// Search for the next match.
sal_uLong nMatchCount = 0;
- if (mpSearchItem->GetCommand() != SVX_SEARCHCMD_REPLACE_ALL)
+ if (mpSearchItem->GetCommand() != SvxSearchCmd::REPLACE_ALL)
nMatchCount = pOutlinerView->StartSearchAndReplace(*mpSearchItem);
// Go to the next text object when there have been no matches in
// the current object or the whole object has already been
// processed.
- if (nMatchCount==0 || mpSearchItem->GetCommand()==SVX_SEARCHCMD_REPLACE_ALL)
+ if (nMatchCount==0 || mpSearchItem->GetCommand()==SvxSearchCmd::REPLACE_ALL)
{
ProvideNextTextObject ();
@@ -1084,9 +1084,9 @@ bool Outliner::ShowWrapArroundDialog (void)
if (mpSearchItem != NULL)
{
// When searching display the dialog only for single find&replace.
- const sal_uInt16 nCommand (mpSearchItem->GetCommand());
- bShowDialog = (nCommand==SVX_SEARCHCMD_REPLACE)
- || (nCommand==SVX_SEARCHCMD_FIND);
+ const SvxSearchCmd nCommand (mpSearchItem->GetCommand());
+ bShowDialog = (nCommand==SvxSearchCmd::REPLACE)
+ || (nCommand==SvxSearchCmd::FIND);
}
else
// Spell checking needs the dialog, too.
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index 0c69751c66cf..9e9a045d851e 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -112,7 +112,7 @@ SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) :
2, 2, 2,
TransliterationModules_IGNORE_CASE ),
eFamily ( SFX_STYLE_FAMILY_PARA ),
- nCommand ( 0 ),
+ nCommand ( SvxSearchCmd::FIND ),
nCellType ( SVX_SEARCHIN_FORMULA ),
nAppFlag ( SVX_SEARCHAPP_WRITER ),
bRowDirection ( true ),
@@ -373,7 +373,7 @@ bool SvxSearchItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMembe
aSeq[1].Name = SRCH_PARA_FAMILY;
aSeq[1].Value <<= sal_Int16( eFamily );
aSeq[2].Name = SRCH_PARA_COMMAND;
- aSeq[2].Value <<= nCommand;
+ aSeq[2].Value <<= static_cast<sal_uInt16>(nCommand);
aSeq[3].Name = SRCH_PARA_CELLTYPE;
aSeq[3].Value <<= nCellType;
aSeq[4].Name = SRCH_PARA_APPFLAG;
@@ -483,8 +483,12 @@ bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nM
}
else if ( aSeq[i].Name == SRCH_PARA_COMMAND )
{
- if ( aSeq[i].Value >>= nCommand )
+ sal_uInt16 nTmp;
+ if ( aSeq[i].Value >>= nTmp )
+ {
+ nCommand = static_cast<SvxSearchCmd>(nTmp);
++nConvertedCount;
+ }
}
else if ( aSeq[i].Name == SRCH_PARA_CELLTYPE )
{
@@ -538,7 +542,7 @@ bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nM
break;
}
case MID_SEARCH_COMMAND:
- bRet = (rVal >>= nInt); nCommand = (sal_uInt16) nInt; break;
+ bRet = (rVal >>= nInt); nCommand = static_cast<SvxSearchCmd>(nInt); break;
case MID_SEARCH_STYLEFAMILY:
bRet = (rVal >>= nInt); eFamily = (SfxStyleFamily) (sal_Int16) nInt; break;
case MID_SEARCH_CELLTYPE:
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index d4368985e5b9..943ac9b66c86 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -1241,13 +1241,13 @@ IMPL_LINK( SvxSearchDialog, CommandHdl_Impl, Button *, pBtn )
}
if (pBtn == m_pSearchBtn)
- pSearchItem->SetCommand( SVX_SEARCHCMD_FIND );
+ pSearchItem->SetCommand( SvxSearchCmd::FIND );
else if ( pBtn == m_pSearchAllBtn )
- pSearchItem->SetCommand( SVX_SEARCHCMD_FIND_ALL );
+ pSearchItem->SetCommand( SvxSearchCmd::FIND_ALL );
else if ( pBtn == m_pReplaceBtn )
- pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE );
+ pSearchItem->SetCommand( SvxSearchCmd::REPLACE );
else if ( pBtn == m_pReplaceAllBtn )
- pSearchItem->SetCommand( SVX_SEARCHCMD_REPLACE_ALL );
+ pSearchItem->SetCommand( SvxSearchCmd::REPLACE_ALL );
// when looking for templates, delete format lists
if ( !bFormat && pSearchItem->GetPattern() )
@@ -2189,7 +2189,7 @@ void SvxSearchDialog::SaveToModule_Impl()
pSearchItem->SetAllTables( m_pAllSheetsCB->IsChecked() );
}
- pSearchItem->SetCommand( SVX_SEARCHCMD_FIND );
+ pSearchItem->SetCommand( SvxSearchCmd::FIND );
nModifyFlag = 0;
const SfxPoolItem* ppArgs[] = { pSearchItem, 0 };
rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SfxCallMode::SLOT, ppArgs );
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index a60f9ccafb19..618469133efc 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -115,7 +115,7 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
lArgs[3].Value <<= nFlags;
lArgs[4].Name = SEARCHITEM_COMMAND;
lArgs[4].Value <<= (sal_Int16)(aFindAll ?
- SVX_SEARCHCMD_FIND_ALL : SVX_SEARCHCMD_FIND );
+ SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND );
lArgs[5].Name = SEARCHITEM_ALGORITHMTYPE;
lArgs[5].Value <<= (sal_Int16)0; // 0 == SearchAlgorithms_ABSOLUTE
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 798b58c03bdb..13eebe75f2ff 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -594,13 +594,13 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
bool bAll = false;
switch( rSearchItem.GetCommand() )
{
- case SVX_SEARCHCMD_FIND:
- case SVX_SEARCHCMD_FIND_ALL:
+ case SvxSearchCmd::FIND:
+ case SvxSearchCmd::FIND_ALL:
nFound = pTextView->Search( aSearchOpt, bForward ) ? 1 : 0;
break;
- case SVX_SEARCHCMD_REPLACE_ALL: bAll = true;
- case SVX_SEARCHCMD_REPLACE:
+ case SvxSearchCmd::REPLACE_ALL: bAll = true;
+ case SvxSearchCmd::REPLACE:
nFound = pTextView->Replace( aSearchOpt, bAll, bForward );
break;
diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index c329193587ad..8ed5c40b764c 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -186,7 +186,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
}
switch (m_pSrchItem->GetCommand())
{
- case SVX_SEARCHCMD_FIND:
+ case SvxSearchCmd::FIND:
{
bool bRet = SearchAndWrap(bApi);
if( bRet )
@@ -206,7 +206,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
#endif
}
break;
- case SVX_SEARCHCMD_FIND_ALL:
+ case SvxSearchCmd::FIND_ALL:
{
bool bRet = SearchAll();
if( !bRet )
@@ -233,14 +233,14 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
#endif
}
break;
- case SVX_SEARCHCMD_REPLACE:
+ case SvxSearchCmd::REPLACE:
{
// 1) Replace selection (Not if only attributes should be replaced)
//JP 27.04.95: Why?
// what if you only want to assign attributes to the found??
- sal_uInt16 nCmd = SVX_SEARCHCMD_FIND;
+ SvxSearchCmd nCmd = SvxSearchCmd::FIND;
if( !m_pSrchItem->GetReplaceString().isEmpty() ||
!m_pReplList )
{
@@ -267,11 +267,11 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
}
}
else if( m_pReplList )
- nCmd = SVX_SEARCHCMD_REPLACE;
+ nCmd = SvxSearchCmd::REPLACE;
// 2) Search further (without replacing!)
- sal_uInt16 nOldCmd = m_pSrchItem->GetCommand();
+ SvxSearchCmd nOldCmd = m_pSrchItem->GetCommand();
m_pSrchItem->SetCommand( nCmd );
bool bRet = SearchAndWrap(bApi);
if( bRet )
@@ -294,7 +294,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
#endif
break;
- case SVX_SEARCHCMD_REPLACE_ALL:
+ case SvxSearchCmd::REPLACE_ALL:
{
SwSearchOptions aOpts( m_pWrtShell, m_pSrchItem->GetBackward() );
m_bExtra = false;
@@ -613,10 +613,10 @@ void SwView::Replace()
SwPosition aStartPos = (* m_pWrtShell->GetSwCrsr()->Start());
SwPosition aEndPos = (* m_pWrtShell->GetSwCrsr()->End());
bool bHasSelection = m_pSrchItem->GetSelection();
- sal_uInt16 nOldCmd = m_pSrchItem->GetCommand();
+ SvxSearchCmd nOldCmd = m_pSrchItem->GetCommand();
//set state for checking if current selection has a match
- m_pSrchItem->SetCommand( SVX_SEARCHCMD_FIND );
+ m_pSrchItem->SetCommand( SvxSearchCmd::FIND );
m_pSrchItem->SetSelection(true);
//check if it matchs
@@ -692,13 +692,13 @@ sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions )
#if HAVE_FEATURE_DESKTOP
SvxSearchDialogWrapper::SetSearchLabel(SL_Empty);
#endif
- bool bDoReplace = m_pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE ||
- m_pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL;
+ bool bDoReplace = m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE ||
+ m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL;
int eRanges = m_pSrchItem->GetSelection() ?
FND_IN_SEL : m_bExtra ? FND_IN_OTHER : FND_IN_BODY;
- if (m_pSrchItem->GetCommand() == SVX_SEARCHCMD_FIND_ALL ||
- m_pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL)
+ if (m_pSrchItem->GetCommand() == SvxSearchCmd::FIND_ALL ||
+ m_pSrchItem->GetCommand() == SvxSearchCmd::REPLACE_ALL)
eRanges |= FND_IN_SELALL;
m_pWrtShell->SttSelect();