Kaydet (Commit) 8353793c authored tarafından Matteo Casalin's avatar Matteo Casalin

Use constants instead of (possibly wrong) magic numbers

Change-Id: I0829d271337b9fe77341c62a1c2ef4d6ae62c727
üst 9d0f8632
...@@ -901,7 +901,7 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) ...@@ -901,7 +901,7 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq)
} }
case SID_SELECTALL: case SID_SELECTALL:
{ {
TextSelection aSel( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, 0xFFFF ) ); TextSelection aSel( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) );
TextView * pView = GetEditView(); TextView * pView = GetEditView();
pView->SetSelection( aSel ); pView->SetSelection( aSel );
pView->GetWindow()->GrabFocus(); pView->GetWindow()->GrabFocus();
...@@ -1245,7 +1245,7 @@ sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem, ...@@ -1245,7 +1245,7 @@ sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem,
if ( !rSearchItem.GetBackward() ) if ( !rSearchItem.GetBackward() )
pView->SetSelection( TextSelection() ); pView->SetSelection( TextSelection() );
else else
pView->SetSelection( TextSelection( TextPaM( 0xFFFFFFFF, 0xFFFF ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) ); pView->SetSelection( TextSelection( TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
} }
bool const bForward = !rSearchItem.GetBackward(); bool const bForward = !rSearchItem.GetBackward();
......
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
#include <vcl/dllapi.h> #include <vcl/dllapi.h>
// for Notify, if all paragraphs were deleted // for Notify, if all paragraphs were deleted
#define TEXT_PARA_ALL 0xFFFFFFFF #define TEXT_PARA_ALL SAL_MAX_UINT32
#define TEXT_INDEX_ALL SAL_MAX_INT32
class TextPaM class TextPaM
{ {
......
...@@ -414,7 +414,7 @@ void SwSrcView::Execute(SfxRequest& rReq) ...@@ -414,7 +414,7 @@ void SwSrcView::Execute(SfxRequest& rReq)
pTextView->Paste(); pTextView->Paste();
break; break;
case SID_SELECTALL: case SID_SELECTALL:
pTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) ); pTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
break; break;
} }
aEditWin->Invalidate(); aEditWin->Invalidate();
...@@ -580,7 +580,7 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, ...@@ -580,7 +580,7 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
bool bAtStart = pTextView->GetSelection() == TextSelection( aPaM, aPaM ); bool bAtStart = pTextView->GetSelection() == TextSelection( aPaM, aPaM );
if( !bForward ) if( !bForward )
aPaM = TextPaM( TEXT_PARA_ALL, USHRT_MAX ); aPaM = TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL );
if( bFromStart ) if( bFromStart )
{ {
......
...@@ -2707,7 +2707,7 @@ void TextEngine::ValidatePaM( TextPaM& rPaM ) const ...@@ -2707,7 +2707,7 @@ void TextEngine::ValidatePaM( TextPaM& rPaM ) const
if ( rPaM.GetPara() >= nParas ) if ( rPaM.GetPara() >= nParas )
{ {
rPaM.GetPara() = nParas ? nParas-1 : 0; rPaM.GetPara() = nParas ? nParas-1 : 0;
rPaM.GetIndex() = 0xFFFF; rPaM.GetIndex() = TEXT_INDEX_ALL;
} }
const sal_Int32 nMaxIndex = GetTextLen( rPaM.GetPara() ); const sal_Int32 nMaxIndex = GetTextLen( rPaM.GetPara() );
......
...@@ -773,7 +773,7 @@ void TextWindow::KeyInput( const KeyEvent& rKEvent ) ...@@ -773,7 +773,7 @@ void TextWindow::KeyInput( const KeyEvent& rKEvent )
( (nCode == KEY_A) && rKEvent.GetKeyCode().IsMod1() && !rKEvent.GetKeyCode().IsMod2() ) ( (nCode == KEY_A) && rKEvent.GetKeyCode().IsMod1() && !rKEvent.GetKeyCode().IsMod2() )
) )
{ {
mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFF, 0xFFFF ) ) ); mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
bDone = true; bDone = true;
} }
else if ( (nCode == KEY_S) && rKEvent.GetKeyCode().IsShift() && rKEvent.GetKeyCode().IsMod1() ) else if ( (nCode == KEY_S) && rKEvent.GetKeyCode().IsShift() && rKEvent.GetKeyCode().IsMod1() )
...@@ -879,7 +879,7 @@ void TextWindow::Command( const CommandEvent& rCEvt ) ...@@ -879,7 +879,7 @@ void TextWindow::Command( const CommandEvent& rCEvt )
mpExtTextEngine->SetModified( true ); mpExtTextEngine->SetModified( true );
mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) ); mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
break; break;
case SV_MENU_EDIT_SELECTALL: mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) ); case SV_MENU_EDIT_SELECTALL: mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
break; break;
case SV_MENU_EDIT_INSERTSYMBOL: case SV_MENU_EDIT_INSERTSYMBOL:
{ {
...@@ -915,7 +915,7 @@ void TextWindow::GetFocus() ...@@ -915,7 +915,7 @@ void TextWindow::GetFocus()
// select everything, but do not scroll // select everything, but do not scroll
bool bAutoScroll = mpExtTextView->IsAutoScroll(); bool bAutoScroll = mpExtTextView->IsAutoScroll();
mpExtTextView->SetAutoScroll( false ); mpExtTextView->SetAutoScroll( false );
mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFF, 0xFFFF ) ) ); mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
mpExtTextView->SetAutoScroll( bAutoScroll ); mpExtTextView->SetAutoScroll( bAutoScroll );
bGotoCursor = false; bGotoCursor = false;
} }
...@@ -1516,7 +1516,7 @@ bool VclMultiLineEdit::PreNotify( NotifyEvent& rNEvt ) ...@@ -1516,7 +1516,7 @@ bool VclMultiLineEdit::PreNotify( NotifyEvent& rNEvt )
{ {
if ( rKEvent.GetKeyCode().IsMod1() ) if ( rKEvent.GetKeyCode().IsMod1() )
pImpVclMEdit->GetTextWindow()->GetTextView()-> pImpVclMEdit->GetTextWindow()->GetTextView()->
SetSelection( TextSelection( TextPaM( 0xFFFF, 0xFFFF ) ) ); SetSelection( TextSelection( TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
} }
break; break;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment