diff options
author | Gergo Mocsi <gmocsi91@gmail.com> | 2013-08-15 12:48:42 +0200 |
---|---|---|
committer | Gergo Mocsi <gmocsi91@gmail.com> | 2013-09-02 18:16:59 +0200 |
commit | 2f3f5dced8aa9b8010a33176bc941d5879986bfb (patch) | |
tree | fbaaa89a367a6f66e8258b0f7cd0641274d9daf8 /basctl | |
parent | GSOC work, simplify CodeCompleteWindow::ResizeListBox (diff) | |
download | core-2f3f5dced8aa9b8010a33176bc941d5879986bfb.tar.gz core-2f3f5dced8aa9b8010a33176bc941d5879986bfb.zip |
GSOC work, small code fixes
Added some constants for CodeCompleteWindow::ResizeListBox().
Simplified a condition is EditorWindow::HandleAutoCorrect().
Change-Id: If8aa34273b6170130d95a309ed385a5152418b76
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 6906a3381c56..78a77dc949d1 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -63,6 +63,8 @@ namespace { sal_uInt16 const NoMarker = 0xFFFF; +long const nBasePad = 2; +long const nCursorPad = 5; long nVirtToolBoxHeight; // inited in WatchWindow, used in Stackwindow long nHeaderBarHeight; @@ -624,7 +626,7 @@ void EditorWindow::HandleAutoCorrect() if( r.tokenType == TT_IDENTIFIER ) {// correct uno types OUString sStr = aLine.copy(r.nBegin, r.nEnd - r.nBegin); - if( !sStr.isEmpty() && !aCodeCompleteCache.GetCorrectCaseVarName(sStr).isEmpty() ) + if( sStr != aCodeCompleteCache.GetCorrectCaseVarName(sStr) ) { sStr = aCodeCompleteCache.GetCorrectCaseVarName(sStr); TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() ); @@ -780,7 +782,7 @@ void EditorWindow::HandleCodeCompletition() OUString sBaseName = aVect[0];//variable name OUString sVarType = aCodeCompleteCache.GetVarType( sBaseName ); if( !sVarType.isEmpty() && CodeCompleteOptions::IsAutoCorrectOn() ) - {//correct variable name + {//correct variable name, if autocorrection on TextPaM aStart(nLine, aLine.indexOf(sBaseName) ); TextPaM aEnd(nLine, aLine.indexOf(sBaseName) + sBaseName.getLength() ); TextSelection sTextSelection(aStart, aEnd); @@ -2775,7 +2777,7 @@ void CodeCompleteWindow::ResizeListBox( const TextSelection& aSel ) Rectangle aRect = ( (TextEngine*) pParent->GetEditEngine() )->PaMtoEditCursor( aSel.GetEnd() , false ); long nViewYOffset = pParent->GetEditView()->GetStartDocPos().Y(); Point aPos = aRect.BottomRight();// this variable will be used later (if needed) - aPos.Y() = (aPos.Y() - nViewYOffset) + 2; + aPos.Y() = (aPos.Y() - nViewYOffset) + nBasePad; OUString aLongestEntry = pListBox->GetEntry( 0 );// grab the longest one: max search for( sal_uInt16 i=1; i< pListBox->GetEntryCount(); ++i ) @@ -2794,18 +2796,18 @@ void CodeCompleteWindow::ResizeListBox( const TextSelection& aSel ) Point aBottomPoint = aVisArea.BottomRight(); Point aTopPoint = aVisArea.TopRight(); - long nYDiff = std::abs((aBottomPoint.Y() - aTopPoint.Y()) - GetPosPixel().Y()); + long nYDiff = std::abs( (aBottomPoint.Y() - aTopPoint.Y()) - GetPosPixel().Y() ); - if( (nYDiff + aFont.GetSize().getHeight()) < aSize.Height() ) + if( (nYDiff + aFont.GetHeight()) < aSize.Height() ) {//bottom part is clipped, fix the visibility by placing it over the line (not under) const Font& aParFont = pParent->GetEditEngine()->GetFont();//parent's font (in the IDE): needed for height - aPos.Y() = aPos.Y() - (aSize.getHeight() + aParFont.GetSize().getHeight()+5); + aPos.Y() -= aSize.Height() + aParFont.GetHeight() + nCursorPad; } - long nXDiff = std::abs(aTopPoint.X() - GetPosPixel().X()); + long nXDiff = std::abs( aTopPoint.X() - GetPosPixel().X() ); if( nXDiff < aSize.Width() ) {//clipped at the right side, move it a bit left - aPos.X() = aPos.X() - aSize.Width() + nXDiff; + aPos.X() -= aSize.Width() + nXDiff; } pListBox->SetSizePixel( aSize ); |