diff options
Diffstat (limited to 'sw/source/ui/uiview/viewsrch.cxx')
-rw-r--r-- | sw/source/ui/uiview/viewsrch.cxx | 129 |
1 files changed, 64 insertions, 65 deletions
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx index 54b05ab4d3..5a21b7aafb 100644 --- a/sw/source/ui/uiview/viewsrch.cxx +++ b/sw/source/ui/uiview/viewsrch.cxx @@ -60,7 +60,6 @@ #include <view.hrc> #include <SwRewriter.hxx> -#include <undobj.hxx> #include <comcore.hrc> #include "PostItMgr.hxx" @@ -82,9 +81,9 @@ using namespace ::com::sun::star::i18n; struct SwSearchOptions { SwDocPositions eStart, eEnd; - BOOL bDontWrap; + sal_Bool bDontWrap; - SwSearchOptions( SwWrtShell* pSh, BOOL bBackward ); + SwSearchOptions( SwWrtShell* pSh, sal_Bool bBackward ); }; @@ -98,24 +97,24 @@ inline Window* GetParentWindow( SvxSearchDialog* pSrchDlg ) return pWin; } -void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) +void SwView::ExecSearch(SfxRequest& rReq, sal_Bool bNoMessage) { const SfxItemSet* pArgs = rReq.GetArgs(); const SfxPoolItem* pItem = 0; - const USHORT nId = SvxSearchDialogWrapper::GetChildWindowId(); + const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId(); SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId); - BOOL bQuiet = FALSE; - if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_SEARCH_QUIET, FALSE, &pItem)) + sal_Bool bQuiet = sal_False; + if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_SEARCH_QUIET, sal_False, &pItem)) bQuiet = ((const SfxBoolItem*) pItem)->GetValue(); - BOOL bApi = bQuiet | bNoMessage; + sal_Bool bApi = bQuiet | bNoMessage; - USHORT nSlot = rReq.GetSlot(); + sal_uInt16 nSlot = rReq.GetSlot(); if (nSlot == FN_REPEAT_SEARCH && !pSrchItem) { if(bApi) { - rReq.SetReturnValue(SfxBoolItem(nSlot, FALSE)); + rReq.SetReturnValue(SfxBoolItem(nSlot, sal_False)); nSlot = 0; } } @@ -132,7 +131,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) break; case FID_SEARCH_ON: - bJustOpened = TRUE; + bJustOpened = sal_True; GetViewFrame()->GetBindings().Invalidate(SID_SEARCH_ITEM); break; @@ -209,7 +208,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) { case SVX_SEARCHCMD_FIND: { - BOOL bRet = SearchAndWrap(bApi); + sal_Bool bRet = SearchAndWrap(bApi); if( bRet ) Scroll(pWrtShell->GetCharRect().SVRect()); rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); @@ -217,7 +216,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) break; case SVX_SEARCHCMD_FIND_ALL: { - BOOL bRet = SearchAll(); + sal_Bool bRet = SearchAll(); if( !bRet ) { if( !bApi ) @@ -225,7 +224,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) Window* pParentWindow = GetParentWindow( pSrchDlg ); InfoBox( pParentWindow, SW_RES(MSG_NOT_FOUND)).Execute(); } - bFound = FALSE; + bFound = sal_False; } rReq.SetReturnValue(SfxBoolItem(nSlot, bRet)); } @@ -238,7 +237,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) //JP 27.04.95: warum ? // was ist, wenn man das gefundene nur attributieren will?? - USHORT nCmd = SVX_SEARCHCMD_FIND; + sal_uInt16 nCmd = SVX_SEARCHCMD_FIND; if( pSrchItem->GetReplaceString().Len() || !pReplList ) { @@ -246,7 +245,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) // Ersetzungsstring enthalten ist - der ersetzte String // noch einmal gefunden wird. - BOOL bBack = pSrchItem->GetBackward(); + sal_Bool bBack = pSrchItem->GetBackward(); if (bBack) pWrtShell->Push(); String aReplace( pSrchItem->GetReplaceString() ); @@ -271,9 +270,9 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) // 2) Weiter suchen (ohne zu ersetzen!) - USHORT nOldCmd = pSrchItem->GetCommand(); + sal_uInt16 nOldCmd = pSrchItem->GetCommand(); pSrchItem->SetCommand( nCmd ); - BOOL bRet = SearchAndWrap(bApi); + sal_Bool bRet = SearchAndWrap(bApi); if( bRet ) Scroll( pWrtShell->GetCharRect().SVRect()); pSrchItem->SetCommand( nOldCmd ); @@ -290,18 +289,18 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) { // bestehende Selektionen aufheben, // wenn nicht in selektierten Bereichen gesucht werden soll - (pWrtShell->*pWrtShell->fnKillSel)(0, FALSE); + (pWrtShell->*pWrtShell->fnKillSel)(0, sal_False); if( DOCPOS_START == aOpts.eEnd ) pWrtShell->EndDoc(); else pWrtShell->SttDoc(); } - bExtra = FALSE; - ULONG nFound; + bExtra = sal_False; + sal_uLong nFound; { //Scope for SwWait-Object - SwWait aWait( *GetDocShell(), TRUE ); + SwWait aWait( *GetDocShell(), sal_True ); pWrtShell->StartAllAction(); nFound = FUNC_Search( aOpts ); // #i8288# Now that everything has been replaced, restore the original cursor position. @@ -317,7 +316,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) Window* pParentWindow = GetParentWindow( pSrchDlg ); InfoBox( pParentWindow, SW_RES(MSG_NOT_FOUND)).Execute(); } - bFound = FALSE; + bFound = sal_False; return; } @@ -346,7 +345,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) case FID_SEARCH_SEARCHSET: case FID_SEARCH_REPLACESET: { - static const USHORT aNormalAttr[] = + static const sal_uInt16 aNormalAttr[] = { /* 0 */ RES_CHRATR_CASEMAP, RES_CHRATR_CASEMAP, /* 2 */ RES_CHRATR_COLOR, RES_CHRATR_POSTURE, @@ -364,13 +363,13 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) /*24 */ 0 }; - static const USHORT aCJKAttr[] = + static const sal_uInt16 aCJKAttr[] = { RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_WEIGHT, RES_CHRATR_EMPHASIS_MARK, RES_CHRATR_TWO_LINES, RES_PARATR_SCRIPTSPACE, RES_PARATR_FORBIDDEN_RULES }; - static const USHORT aCTLAttr[] = + static const sal_uInt16 aCTLAttr[] = { RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_WEIGHT }; @@ -390,7 +389,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) 14 ); SfxItemSet aSet( pWrtShell->GetAttrPool(), aArr.GetData() ); - USHORT nWhich = SID_SEARCH_SEARCHSET; + sal_uInt16 nWhich = SID_SEARCH_SEARCHSET; if ( FID_SEARCH_REPLACESET == nSlot ) { @@ -425,7 +424,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) } -BOOL SwView::SearchAndWrap(BOOL bApi) +sal_Bool SwView::SearchAndWrap(sal_Bool bApi) { SwSearchOptions aOpts( pWrtShell, pSrchItem->GetBackward() ); @@ -437,12 +436,12 @@ BOOL SwView::SearchAndWrap(BOOL bApi) // falls in selektierten Bereichen gesucht werden soll, duerfen sie // nicht aufgehoben werden if (!pSrchItem->GetSelection()) - (pWrtShell->*pWrtShell->fnKillSel)(0, FALSE); + (pWrtShell->*pWrtShell->fnKillSel)(0, sal_False); - SwWait *pWait = new SwWait( *GetDocShell(), TRUE ); + SwWait *pWait = new SwWait( *GetDocShell(), sal_True ); if( FUNC_Search( aOpts ) ) { - bFound = TRUE; + bFound = sal_True; if(pWrtShell->IsSelFrmMode()) { pWrtShell->UnSelectFrm(); @@ -451,30 +450,30 @@ BOOL SwView::SearchAndWrap(BOOL bApi) pWrtShell->Pop(); pWrtShell->EndAllAction(); delete pWait; - return TRUE; + return sal_True; } delete pWait, pWait = 0; // Suchen in den Sonderbereichen, wenn keine // Suche in Selektionen vorliegt. Bei Suche in Selektionen // wird ohnehin in diesen Sonderbereichen gesucht - BOOL bHasSrchInOther = bExtra; + sal_Bool bHasSrchInOther = bExtra; if (!pSrchItem->GetSelection() && !bExtra ) { - bExtra = TRUE; + bExtra = sal_True; if( FUNC_Search( aOpts ) ) { - bFound = TRUE; + bFound = sal_True; pWrtShell->Pop(); pWrtShell->EndAllAction(); - return TRUE; + return sal_True; } - bExtra = FALSE; + bExtra = sal_False; } else bExtra = !bExtra; - const USHORT nId = SvxSearchDialogWrapper::GetChildWindowId(); + const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId(); SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId); pSrchDlg = pWrp ? static_cast <SvxSearchDialog*> (pWrp->getDialog ()) : 0; @@ -487,9 +486,9 @@ BOOL SwView::SearchAndWrap(BOOL bApi) Window* pParentWindow = GetParentWindow( pSrchDlg ); InfoBox( pParentWindow, SW_RES(MSG_NOT_FOUND)).Execute(); } - bFound = FALSE; + bFound = sal_False; pWrtShell->Pop(); - return FALSE; + return sal_False; } pWrtShell->EndAllAction(); // noch mal mit WrapAround versuchen? @@ -500,15 +499,15 @@ BOOL SwView::SearchAndWrap(BOOL bApi) : MSG_SEARCH_END ) ).Execute() ) { - bFound = FALSE; + bFound = sal_False; pWrtShell->Pop(); - return FALSE; + return sal_False; } pWrtShell->StartAllAction(); - pWrtShell->Pop(FALSE); - pWait = new SwWait( *GetDocShell(), TRUE ); + pWrtShell->Pop(sal_False); + pWait = new SwWait( *GetDocShell(), sal_True ); - BOOL bSrchBkwrd = DOCPOS_START == aOpts.eEnd; + sal_Bool bSrchBkwrd = DOCPOS_START == aOpts.eEnd; aOpts.eEnd = bSrchBkwrd ? DOCPOS_START : DOCPOS_END; aOpts.eStart = bSrchBkwrd ? DOCPOS_END : DOCPOS_START; @@ -532,13 +531,13 @@ BOOL SwView::SearchAndWrap(BOOL bApi) Window* pParentWindow = GetParentWindow( pSrchDlg ); InfoBox( pParentWindow, SW_RES(MSG_NOT_FOUND)).Execute(); } - return bFound = FALSE; + return bFound = sal_False; } -BOOL SwView::SearchAll(USHORT* pFound) +sal_Bool SwView::SearchAll(sal_uInt16* pFound) { - SwWait aWait( *GetDocShell(), TRUE ); + SwWait aWait( *GetDocShell(), sal_True ); pWrtShell->StartAllAction(); SwSearchOptions aOpts( pWrtShell, pSrchItem->GetBackward() ); @@ -547,15 +546,15 @@ BOOL SwView::SearchAll(USHORT* pFound) { // bestehende Selektionen aufheben, // wenn nicht in selektierten Bereichen gesucht werden soll - (pWrtShell->*pWrtShell->fnKillSel)(0, FALSE); + (pWrtShell->*pWrtShell->fnKillSel)(0, sal_False); if( DOCPOS_START == aOpts.eEnd ) pWrtShell->EndDoc(); else pWrtShell->SttDoc(); } - bExtra = FALSE; - USHORT nFound = (USHORT)FUNC_Search( aOpts ); + bExtra = sal_False; + sal_uInt16 nFound = (sal_uInt16)FUNC_Search( aOpts ); if(pFound) *pFound = nFound; bFound = 0 != nFound; @@ -567,7 +566,7 @@ BOOL SwView::SearchAll(USHORT* pFound) void SwView::Replace() { - SwWait aWait( *GetDocShell(), TRUE ); + SwWait aWait( *GetDocShell(), sal_True ); pWrtShell->StartAllAction(); @@ -584,7 +583,7 @@ void SwView::Replace() pSrchItem->GetReplaceString(), SwWrtShell::GETSTYLE_CREATESOME )); - pWrtShell->EndUndo(UNDO_UI_REPLACE_STYLE); + pWrtShell->EndUndo(); } else { @@ -610,7 +609,7 @@ void SwView::Replace() -SwSearchOptions::SwSearchOptions( SwWrtShell* pSh, BOOL bBackward ) +SwSearchOptions::SwSearchOptions( SwWrtShell* pSh, sal_Bool bBackward ) { eStart = DOCPOS_CURR; if( bBackward ) @@ -625,9 +624,9 @@ SwSearchOptions::SwSearchOptions( SwWrtShell* pSh, BOOL bBackward ) } } -ULONG SwView::FUNC_Search( const SwSearchOptions& rOptions ) +sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions ) { - BOOL bDoReplace = pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE || + sal_Bool bDoReplace = pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE || pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL; int eRanges = pSrchItem->GetSelection() ? @@ -638,7 +637,7 @@ ULONG SwView::FUNC_Search( const SwSearchOptions& rOptions ) pWrtShell->SttSelect(); - static USHORT const aSearchAttrRange[] = { + static sal_uInt16 aSearchAttrRange[] = { RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_PARATR_BEGIN, RES_PARATR_END-1, @@ -672,11 +671,11 @@ ULONG SwView::FUNC_Search( const SwSearchOptions& rOptions ) // build SearchOptions to be used // SearchOptions aSearchOpt( pSrchItem->GetSearchOptions() ); - aSearchOpt.Locale = SvxCreateLocale( (USHORT)GetAppLanguage() ); + aSearchOpt.Locale = SvxCreateLocale( (sal_uInt16)GetAppLanguage() ); if( !bDoReplace ) aSearchOpt.replaceString = aEmptyStr; - ULONG nFound; + sal_uLong nFound; if( aSrchSet.Count() || ( pReplSet && pReplSet->Count() )) { nFound = pWrtShell->SearchAttr( @@ -713,7 +712,7 @@ ULONG SwView::FUNC_Search( const SwSearchOptions& rOptions ) LAYOUT_NS Dialog* SwView::GetSearchDialog() { - const USHORT nId = SvxSearchDialogWrapper::GetChildWindowId(); + const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId(); SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)SfxViewFrame::Current()->GetChildWindow(nId); if ( pWrp ) pSrchDlg = pWrp->getDialog (); @@ -725,7 +724,7 @@ LAYOUT_NS Dialog* SwView::GetSearchDialog() void SwView::StateSearch(SfxItemSet &rSet) { SfxWhichIter aIter(rSet); - USHORT nWhich = aIter.FirstWhich(); + sal_uInt16 nWhich = aIter.FirstWhich(); while(nWhich) { @@ -733,7 +732,7 @@ void SwView::StateSearch(SfxItemSet &rSet) { case SID_SEARCH_OPTIONS: { - UINT16 nOpt = 0xFFFF; + sal_uInt16 nOpt = 0xFFFF; if( GetDocShell()->IsReadOnly() ) nOpt &= ~( SEARCH_OPTIONS_REPLACE | SEARCH_OPTIONS_REPLACE_ALL ); @@ -756,13 +755,13 @@ void SwView::StateSearch(SfxItemSet &rSet) ( aTxt = pWrtShell->SwCrsrShell::GetSelTxt() ).Len() ) { pSrchItem->SetSearchString( aTxt ); - pSrchItem->SetSelection( FALSE ); + pSrchItem->SetSelection( sal_False ); } else - pSrchItem->SetSelection( TRUE ); + pSrchItem->SetSelection( sal_True ); } - bJustOpened = FALSE; + bJustOpened = sal_False; rSet.Put( *pSrchItem ); } break; |