[Libreoffice-commits] core.git: 62 commits - basctl/sdi basctl/source basic/Library_sb.mk basic/source cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk include/basic include/sfx2 include/vcl officecfg/Configuration_officecfg.mk officecfg/files.mk officecfg/registry postprocess/CustomTarget_registry.mk vcl/inc vcl/source
Gergo Mocsi
gmocsi91 at gmail.com
Mon Sep 2 09:23:52 PDT 2013
basctl/sdi/baside.sdi | 1
basctl/source/basicide/baside2.cxx | 2
basctl/source/basicide/baside2.hxx | 99 +
basctl/source/basicide/baside2b.cxx | 770 ++++++++++-
basic/Library_sb.mk | 5
basic/source/classes/codecompletecache.cxx | 208 ++
basic/source/classes/sb.cxx | 1
basic/source/classes/sbunoobj.cxx | 27
basic/source/classes/sbxmod.cxx | 44
basic/source/comp/codegen.cxx | 18
basic/source/comp/dim.cxx | 49
basic/source/comp/parser.cxx | 11
basic/source/comp/sbcomp.cxx | 2
basic/source/comp/token.cxx | 21
basic/source/inc/codegen.hxx | 2
basic/source/inc/parser.hxx | 4
basic/source/inc/token.hxx | 1
basic/source/runtime/runtime.cxx | 3
cui/Library_cui.mk | 1
cui/UIConfig_cui.mk | 1
cui/source/inc/cuires.hrc | 1
cui/source/options/optbasic.cxx | 165 ++
cui/source/options/optbasic.hxx | 53
cui/source/options/treeopt.cxx | 3
cui/source/options/treeopt.src | 1
cui/uiconfig/ui/optbasicidepage.ui | 221 +++
include/basic/codecompletecache.hxx | 103 +
include/basic/sbmod.hxx | 5
include/sfx2/sfxsids.hrc | 1
include/vcl/lstbox.hxx | 2
include/vcl/quickselectionengine.hxx | 2
officecfg/Configuration_officecfg.mk | 1
officecfg/files.mk | 1
officecfg/registry/data/org/openoffice/Office/BasicIDE.xcu | 21
officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs | 67
postprocess/CustomTarget_registry.mk | 2
vcl/inc/ilstbox.hxx | 1
vcl/source/control/ilstbox.cxx | 4
vcl/source/control/lstbox.cxx | 4
vcl/source/control/quickselectionengine.cxx | 92 -
40 files changed, 1958 insertions(+), 62 deletions(-)
New commits:
commit d3ff876f3c7f441fd72a037ed31fb973f223ca6d
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Mon Sep 2 17:55:59 2013 +0200
GSOC work, small fixes after
Fixed some errors after the merge.
Change-Id: I8c0360d7fd04425a00dacb37f673d10efffa0ebe
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index a2df363..beff37d 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -552,11 +552,11 @@ OUString SbiTokenizer::GetKeywordCase( const OUString& sKeyword )
{
if( !nToken )
{
- TokenTable *tp;
+ const TokenTable *tp;
for( nToken = 0, tp = pTokTable; tp->t; nToken++, tp++ )
{}
}
- TokenTable* tp = pTokTable;
+ const TokenTable* tp = pTokTable;
for( short i = 0; i < nToken; i++, tp++ )
{
OUString sStr = OStringToOUString(tp->s, RTL_TEXTENCODING_ASCII_US);
diff --git a/vcl/source/control/quickselectionengine.cxx b/vcl/source/control/quickselectionengine.cxx
index f265bf4..00060bd 100644
--- a/vcl/source/control/quickselectionengine.cxx
+++ b/vcl/source/control/quickselectionengine.cxx
@@ -114,33 +114,18 @@ namespace vcl
{
if( bEnabled )
{
- m_pData->sCurrentSearchString += OUString(c);
- OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: searching for %s", OUStringToOString(m_pData->sCurrentSearchString, RTL_TEXTENCODING_UTF8).getStr() );
-
- if ( m_pData->sCurrentSearchString.getLength() == 1 )
- { // first character in the search -> remmeber
- m_pData->aSingleSearchChar.reset( c );
- }
- else if ( m_pData->sCurrentSearchString.getLength() > 1 )
- {
- if ( !!m_pData->aSingleSearchChar && ( *m_pData->aSingleSearchChar != c ) )
- // we already have a "single char", but the current one is different -> reset
- m_pData->aSingleSearchChar.reset();
- }
-
- OUString aSearchTemp( m_pData->sCurrentSearchString );
sal_Unicode c = _keyEvent.GetCharCode();
if ( ( c >= 32 ) && ( c != 127 ) && !_keyEvent.GetKeyCode().IsMod2() )
{
- m_pData->sCurrentSearchString += c;
+ m_pData->sCurrentSearchString += OUString(c);
OSL_TRACE( "QuickSelectionEngine::HandleKeyEvent: searching for %s", OUStringToOString(m_pData->sCurrentSearchString, RTL_TEXTENCODING_UTF8).getStr() );
- if ( m_pData->sCurrentSearchString.Len() == 1 )
+ if ( m_pData->sCurrentSearchString.getLength() == 1 )
{ // first character in the search -> remmeber
m_pData->aSingleSearchChar.reset( c );
}
- else if ( m_pData->sCurrentSearchString.Len() > 1 )
+ else if ( m_pData->sCurrentSearchString.getLength() > 1 )
{
if ( !!m_pData->aSingleSearchChar && ( *m_pData->aSingleSearchChar != c ) )
// we already have a "single char", but the current one is different -> reset
commit d9e81b8540dd932222400663d746a7ecce4823df
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Thu Aug 29 12:04:06 2013 +0200
GSOC work, renaming+listbox right side fix
Fixed the small bug in positioning the listbox to the right side.
Function ResizeListBox was renamed to ResizeAndPositionListBox.
Change-Id: I3cea54ad5658ee1628935b4975f52fe78c1ff5c3
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 447d77d..9bafa51 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -529,7 +529,7 @@ public:
void ClearListBox();
void SetTextSelection( const TextSelection& aSel );
const TextSelection& GetTextSelection() const;
- void ResizeListBox();
+ void ResizeAndPositionListBox();
void SelectFirstEntry(); //selects first entry in ListBox
void ClearAndHide();
/*
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 89a22d8..a68e77f 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -880,7 +880,7 @@ void EditorWindow::SetupAndShowCodeCompleteWnd( const std::vector< OUString >& a
}
// show it
pCodeCompleteWnd->Show();
- pCodeCompleteWnd->ResizeListBox();
+ pCodeCompleteWnd->ResizeAndPositionListBox();
pCodeCompleteWnd->SelectFirstEntry();
// correct text selection, and set it
aSel.GetStart().GetIndex() += 1;
@@ -2824,7 +2824,7 @@ const TextSelection& CodeCompleteWindow::GetTextSelection() const
return aTextSelection;
}
-void CodeCompleteWindow::ResizeListBox()
+void CodeCompleteWindow::ResizeAndPositionListBox()
{
if( pListBox->GetEntryCount() >= 1 )
{// if there is at least one element inside
@@ -2862,9 +2862,9 @@ void CodeCompleteWindow::ResizeListBox()
aPos.Y() -= aSize.getHeight() + nParentFontHeight + nCursorPad;
}
- if( aVisArea.BottomLeft().getX() + aPos.getX() + aSize.getWidth() > aBottomPoint.getX() )
+ if( aVisArea.TopLeft().getX() + aPos.getX() + aSize.getWidth() > aBottomPoint.getX() )
{//clipped at the right side, move it a bit left
- aPos.X() -= aSize.getWidth();
+ aPos.X() -= aSize.getWidth() + aVisArea.TopLeft().getX();
}
//set the position
SetPosPixel( aPos );
commit 7f9597903f5b5c842fae9b32b06b4d04c2228873
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Fri Aug 23 11:38:03 2013 +0200
GSOC work, fix the clipped listbox
Listbox clipping works correcly on the right side and on the bottom.
The function calculations are done from the initial position: if the actual X/Y coordinate + width/height exceeds the visible area, listbox is poitioned up/a bit left.
Change-Id: I17ff28cd23423819b55d7079c6d35484b567899c
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 5229ed8..89a22d8 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -2647,21 +2647,19 @@ void CodeCompleteListBox::InsertSelectedEntry()
if( !aFuncBuffer.toString().isEmpty() )
{
// if the user typed in something: remove, and insert
- //TextPaM aEnd( GetParentEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetEnd()) );
- //GetParentEditView()->SetSelection(TextSelection(pCodeCompleteWindow->GetTextSelection().GetStart(), aEnd ) );
GetParentEditView()->SetSelection( pCodeCompleteWindow->pParent->GetLastHighlightPortionTextSelection() );
GetParentEditView()->DeleteSelected();
if( !((OUString) GetEntry( GetSelectEntryPos() )).isEmpty() )
{//if the user selected something
- GetParentEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_True );
+ GetParentEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_False );
}
}
else
{
if( !((OUString) GetEntry( GetSelectEntryPos() )).isEmpty() )
{//if the user selected something
- GetParentEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_True );
+ GetParentEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_False );
}
}
HideAndRestoreFocus();
@@ -2701,8 +2699,7 @@ void CodeCompleteListBox::KeyInput( const KeyEvent& rKeyEvt )
TextSelection aTextSelection( GetParentEditView()->GetSelection() );
if( aTextSelection.GetEnd().GetPara() != pCodeCompleteWindow->GetTextSelection().GetEnd().GetPara()-1 )
{
- pCodeCompleteWindow->Hide();
- pCodeCompleteWindow->pParent->GrabFocus();
+ HideAndRestoreFocus();
}
break;
}
@@ -2711,8 +2708,7 @@ void CodeCompleteListBox::KeyInput( const KeyEvent& rKeyEvt )
TextSelection aTextSelection( GetParentEditView()->GetSelection() );
if( aTextSelection.GetStart().GetIndex()-1 < pCodeCompleteWindow->GetTextSelection().GetStart().GetIndex() )
{//leave the cursor where it is
- pCodeCompleteWindow->Hide();
- pCodeCompleteWindow->pParent->GrabFocus();
+ HideAndRestoreFocus();
}
break;
}
@@ -2847,33 +2843,30 @@ void CodeCompleteWindow::ResizeListBox()
// get column/line count
const sal_uInt16& nColumns = aLongestEntry.getLength();
const sal_uInt16& nLines = std::min( (sal_uInt16) 6, pListBox->GetEntryCount() );
- const Font& aFont = pListBox->GetFont();// listbox's font: height is needed
- const Rectangle aVisArea( pParent->GetEditView()->GetStartDocPos(), pParent->GetOutputSizePixel() );
- Size aSize = pListBox->GetOptimalSize();// this sets the correct width
- aSize.setHeight( pListBox->CalcSize( nColumns, nLines ).getHeight() );// correct height
+ Size aSize = pListBox->CalcSize( nColumns, nLines );
+ //set the size
+ SetSizePixel( aSize );
+ //1 px smaller, to see the border
+ aSize.setWidth( aSize.getWidth() - 1 );
+ aSize.setHeight( aSize.getHeight() - 1 );
+ pListBox->SetSizePixel( aSize );
+ //calculate position
+ const Rectangle aVisArea( pParent->GetEditView()->GetStartDocPos(), pParent->GetOutputSizePixel() );//the visible area
const Point& aBottomPoint = aVisArea.BottomRight();
- const Point& aTopPoint = aVisArea.TopRight();
- const long& nYDiff = aBottomPoint.Y() - aTopPoint.Y() - aPos.Y();
- 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() -= aSize.Height() + aParFont.GetHeight() + nCursorPad;
+ if( aVisArea.TopRight().getY() + aPos.getY() + aSize.getHeight() > aBottomPoint.getY() )
+ {//clipped at the bottom: move it up
+ const long& nParentFontHeight = pParent->GetEditEngine()->GetFont().GetHeight();//parent's font (in the IDE): needed for height
+ aPos.Y() -= aSize.getHeight() + nParentFontHeight + nCursorPad;
}
- const long& nXDiff = aBottomPoint.X() - aPos.X();
- if( nXDiff < aSize.Width() )
+ if( aVisArea.BottomLeft().getX() + aPos.getX() + aSize.getWidth() > aBottomPoint.getX() )
{//clipped at the right side, move it a bit left
- aPos.X() -= aSize.Width();
+ aPos.X() -= aSize.getWidth();
}
-
- pListBox->SetSizePixel( aSize );
- aSize.setWidth( aSize.getWidth() + 1 );
- aSize.setHeight( aSize.getHeight() + 1 );
- // set the size and the position of the window
- SetSizePixel( aSize );
+ //set the position
SetPosPixel( aPos );
}
}
commit e7e667fd36098b1d125cde282529fb6a30b7cbdc
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Thu Aug 22 09:36:48 2013 +0200
GSOC work, fixed clipping of the listbox in the bottom
Listbox positioning on the bottom is corrected.
Change-Id: I75af0ff68b24ad26e9c9bd41d91a6ac9d1fa9d1c
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 7e037f8..447d77d 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -529,7 +529,7 @@ public:
void ClearListBox();
void SetTextSelection( const TextSelection& aSel );
const TextSelection& GetTextSelection() const;
- void ResizeListBox( const TextSelection& aSel );
+ void ResizeListBox();
void SelectFirstEntry(); //selects first entry in ListBox
void ClearAndHide();
/*
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 4aab464..5229ed8 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -512,7 +512,8 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
pCodeCompleteWnd->GetListBox()->KeyInput(rKEvt);
if( rKEvt.GetKeyCode().GetCode() == KEY_UP
|| rKEvt.GetKeyCode().GetCode() == KEY_DOWN
- || rKEvt.GetKeyCode().GetCode() == KEY_TAB )
+ || rKEvt.GetKeyCode().GetCode() == KEY_TAB
+ || rKEvt.GetKeyCode().GetCode() == KEY_POINT)
return;
}
@@ -834,6 +835,8 @@ void EditorWindow::HandleCodeCompletition()
aVect.insert( aVect.begin(), aLine.copy(r.nBegin, r.nEnd - r.nBegin) );
}
+ if( aVect.size() == 0 )//nothing to do
+ return;
OUString sBaseName = aVect[0];//variable name
OUString sVarType = aCodeCompleteCache.GetVarType( sBaseName );
if( !sVarType.isEmpty() && CodeCompleteOptions::IsAutoCorrectOn() )
@@ -877,7 +880,7 @@ void EditorWindow::SetupAndShowCodeCompleteWnd( const std::vector< OUString >& a
}
// show it
pCodeCompleteWnd->Show();
- pCodeCompleteWnd->ResizeListBox( aSel );
+ pCodeCompleteWnd->ResizeListBox();
pCodeCompleteWnd->SelectFirstEntry();
// correct text selection, and set it
aSel.GetStart().GetIndex() += 1;
@@ -2644,8 +2647,9 @@ void CodeCompleteListBox::InsertSelectedEntry()
if( !aFuncBuffer.toString().isEmpty() )
{
// if the user typed in something: remove, and insert
- TextPaM aEnd( GetParentEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetEnd()) );
- GetParentEditView()->SetSelection(TextSelection(pCodeCompleteWindow->GetTextSelection().GetStart(), aEnd ) );
+ //TextPaM aEnd( GetParentEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetEnd()) );
+ //GetParentEditView()->SetSelection(TextSelection(pCodeCompleteWindow->GetTextSelection().GetStart(), aEnd ) );
+ GetParentEditView()->SetSelection( pCodeCompleteWindow->pParent->GetLastHighlightPortionTextSelection() );
GetParentEditView()->DeleteSelected();
if( !((OUString) GetEntry( GetSelectEntryPos() )).isEmpty() )
@@ -2824,12 +2828,12 @@ const TextSelection& CodeCompleteWindow::GetTextSelection() const
return aTextSelection;
}
-void CodeCompleteWindow::ResizeListBox( const TextSelection& aSel )
+void CodeCompleteWindow::ResizeListBox()
{
if( pListBox->GetEntryCount() >= 1 )
{// if there is at least one element inside
// calculate basic position: under the current line
- Rectangle aRect = ( (TextEngine*) pParent->GetEditEngine() )->PaMtoEditCursor( aSel.GetEnd() , false );
+ Rectangle aRect = ( (TextEngine*) pParent->GetEditEngine() )->PaMtoEditCursor( pParent->GetEditView()->GetSelection().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) + nBasePad;
@@ -2845,24 +2849,24 @@ void CodeCompleteWindow::ResizeListBox( const TextSelection& aSel )
const sal_uInt16& nLines = std::min( (sal_uInt16) 6, pListBox->GetEntryCount() );
const Font& aFont = pListBox->GetFont();// listbox's font: height is needed
- Rectangle aVisArea( pParent->GetEditView()->GetStartDocPos(), pParent->GetOutputSizePixel() );
+ const Rectangle aVisArea( pParent->GetEditView()->GetStartDocPos(), pParent->GetOutputSizePixel() );
Size aSize = pListBox->GetOptimalSize();// this sets the correct width
aSize.setHeight( pListBox->CalcSize( nColumns, nLines ).getHeight() );// correct height
- Point aBottomPoint = aVisArea.BottomRight();
- Point aTopPoint = aVisArea.TopRight();
- long nYDiff = std::abs( (aBottomPoint.Y() - aTopPoint.Y()) - GetPosPixel().Y() );
+ const Point& aBottomPoint = aVisArea.BottomRight();
+ const Point& aTopPoint = aVisArea.TopRight();
+ const long& nYDiff = aBottomPoint.Y() - aTopPoint.Y() - aPos.Y();
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() -= aSize.Height() + aParFont.GetHeight() + nCursorPad;
}
- long nXDiff = std::abs( aTopPoint.X() - GetPosPixel().X() );
+ const long& nXDiff = aBottomPoint.X() - aPos.X();
if( nXDiff < aSize.Width() )
{//clipped at the right side, move it a bit left
- aPos.X() -= aSize.Width() + nXDiff;
+ aPos.X() -= aSize.Width();
}
pListBox->SetSizePixel( aSize );
@@ -2884,13 +2888,8 @@ void CodeCompleteWindow::SelectFirstEntry()
void CodeCompleteWindow::ClearAndHide()
{
- TextPaM aEnd(aTextSelection.GetEnd().GetPara(), GetTextSelection().GetEnd().GetIndex() + pListBox->aFuncBuffer.getLength());
- TextPaM aStart(aTextSelection.GetEnd().GetPara(), GetTextSelection().GetEnd().GetIndex() );
- pParent->GetEditView()->SetSelection(TextSelection(aStart, aEnd));
- pParent->GetEditView()->DeleteSelected();
- Hide();
ClearListBox();
- pParent->GrabFocus();
+ pListBox->HideAndRestoreFocus();
}
UnoTypeCodeCompletetor::UnoTypeCodeCompletetor( const std::vector< OUString >& aVect, const OUString& sVarType )
commit 251990c06363f85ea5e701b16b5120526d0ac1a6
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Wed Aug 21 14:53:41 2013 +0200
GSOC work, arrow navigation+TextSelection problems fixed
I've added a new function called EditorWindow::GetLastHighlightPortionTextSelection, which gets the last edited word (from the highlight portion), and creates a TextSelection from it. Later, this is used to remove/replace text in the listbox when pressing the tab key. The proble was, that is cleared the whole line, but now, it just clears the newly edited word.
Change-Id: I61b6721696e89002705c9980579023b42ad1faaa
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index df6b451..7e037f8 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -130,6 +130,7 @@ private:
void HandleAutoCloseDoubleQuotes();
void HandleCodeCompletition();
void HandleProcedureCompletition();
+ TextSelection GetLastHighlightPortionTextSelection();
protected:
virtual void Paint( const Rectangle& );
@@ -490,7 +491,6 @@ friend class CodeCompleteWindow;
friend class EditorWindow;
private:
OUStringBuffer aFuncBuffer;
- OUString aPrevStr;
/* a buffer to build up function name when typing
* a function name, used for showing/hiding listbox values
* */
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index eb3931a..4aab464 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -619,7 +619,7 @@ void EditorWindow::HandleAutoCorrect()
//create the appropriate TextSelection, and update the cache
TextPaM aStart( nLine, r.nBegin );
TextPaM aEnd( nLine, r.nBegin + sStr.getLength() );
- TextSelection sTextSelection(aStart, aEnd );
+ TextSelection sTextSelection( aStart, aEnd );
rModulWindow.UpdateModule();
rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse( aCodeCompleteCache );
// correct the last entered keyword
@@ -662,6 +662,36 @@ void EditorWindow::HandleAutoCorrect()
}
}
+TextSelection EditorWindow::GetLastHighlightPortionTextSelection()
+{//creates a text selection from the highlight portion on the cursor
+ sal_uLong nLine = GetEditView()->GetSelection().GetStart().GetPara();
+ sal_uLong nIndex = GetEditView()->GetSelection().GetStart().GetIndex();
+ OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
+ HighlightPortions aPortions;
+ aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
+
+ HighlightPortion& r = aPortions[aPortions.size()-1];
+ if( nIndex != aPortions.size()-1 )
+ {//cursor is not standing at the end of the line
+ for( size_t i = 0; i < aPortions.size(); i++ )
+ {
+ if( aPortions[i].nEnd == nIndex )
+ {
+ r = aPortions[i];
+ break;
+ }
+ }
+ }
+
+ if( aPortions.size() == 0 )
+ return TextSelection();
+
+ OUString sStr = aLine.copy( r.nBegin, r.nEnd - r.nBegin );
+ TextPaM aStart( nLine, r.nBegin );
+ TextPaM aEnd( nLine, r.nBegin + sStr.getLength() );
+ return TextSelection( aStart, aEnd );
+}
+
void EditorWindow::HandleAutoCloseParen()
{
TextSelection aSel = GetEditView()->GetSelection();
@@ -2646,7 +2676,6 @@ void CodeCompleteListBox::SetMatchingEntries()
}
}
-
void CodeCompleteListBox::KeyInput( const KeyEvent& rKeyEvt )
{
sal_Unicode aChar = rKeyEvt.GetKeyCode().GetCode();
@@ -2685,8 +2714,7 @@ void CodeCompleteListBox::KeyInput( const KeyEvent& rKeyEvt )
}
case KEY_TAB:
{
- TextPaM aTextEnd( GetParentEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetEnd()) );
- TextSelection aTextSelection( pCodeCompleteWindow->GetTextSelection().GetStart(), aTextEnd );
+ TextSelection aTextSelection = pCodeCompleteWindow->pParent->GetLastHighlightPortionTextSelection();
OUString sTypedText = pCodeCompleteWindow->pParent->GetEditEngine()->GetText(aTextSelection);
if( !aFuncBuffer.isEmpty() )
{
@@ -2710,8 +2738,7 @@ void CodeCompleteListBox::KeyInput( const KeyEvent& rKeyEvt )
if( !bFound )
SetMatchingEntries();
- TextPaM aEnd( GetParentEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetEnd()) );
- GetParentEditView()->SetSelection(TextSelection(pCodeCompleteWindow->GetTextSelection().GetStart(), aEnd ) );
+ GetParentEditView()->SetSelection( aTextSelection );
GetParentEditView()->DeleteSelected();
GetParentEditView()->InsertText( GetSelectEntry(), sal_False );
}
@@ -2757,7 +2784,6 @@ void CodeCompleteListBox::KeyInput( const KeyEvent& rKeyEvt )
void CodeCompleteListBox::HideAndRestoreFocus()
{
pCodeCompleteWindow->Hide();
- GetParentEditView()->SetSelection( GetParentEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetStart()) );
pCodeCompleteWindow->pParent->GrabFocus();
}
commit f05fa6e67f56a748b0087c287d23a67dfa2cbde2
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Tue Aug 20 17:55:59 2013 +0200
GSOC work, fix strange TextPaM errors
Wrong TextPaM's caused the autocorrection to insert the string multiple times, this is now fixed. I use the values from the HighlightPortion struct.
Change-Id: I5ff5f01c06738088639186c35eb58ee9ff497d95
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 06e9567..eb3931a 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -587,10 +587,9 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
void EditorWindow::HandleAutoCorrect()
{
- rModulWindow.UpdateModule();
- rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse( aCodeCompleteCache );
TextSelection aSel = GetEditView()->GetSelection();
sal_uLong nLine = aSel.GetStart().GetPara();
+ sal_uLong nIndex = aSel.GetStart().GetIndex();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
const OUString& sActSubName = GetActualSubName( nLine ); // the actual procedure
@@ -601,48 +600,63 @@ void EditorWindow::HandleAutoCorrect()
return;
HighlightPortion& r = aPortions[aPortions.size()-1];
- OUString sStr = aLine.copy(r.nBegin, r.nEnd - r.nBegin);
- if( r.tokenType == TT_KEYWORDS && !sStr.isEmpty() ) // correct the last entered keyword
+ if( nIndex != aPortions.size()-1 )
+ {//cursor is not standing at the end of the line
+ for( size_t i = 0; i < aPortions.size(); i++ )
+ {
+ if( aPortions[i].nEnd == nIndex )
+ {
+ r = aPortions[i];
+ break;
+ }
+ }
+ }
+
+ OUString sStr = aLine.copy( r.nBegin, r.nEnd - r.nBegin );
+ //if WS or empty string: stop, nothing to do
+ if( ( r.tokenType == TT_WHITESPACE ) || sStr.isEmpty() )
+ return;
+ //create the appropriate TextSelection, and update the cache
+ TextPaM aStart( nLine, r.nBegin );
+ TextPaM aEnd( nLine, r.nBegin + sStr.getLength() );
+ TextSelection sTextSelection(aStart, aEnd );
+ rModulWindow.UpdateModule();
+ rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse( aCodeCompleteCache );
+ // correct the last entered keyword
+ if( r.tokenType == TT_KEYWORDS )
{
sStr = sStr.toAsciiLowerCase();
if( !rModulWindow.GetSbModule()->GetKeywordCase(sStr).isEmpty() )
// if it is a keyword, get its correct case
sStr = rModulWindow.GetSbModule()->GetKeywordCase(sStr);
else
- {// else capitalize first letter/select the correct one, and replace
+ // else capitalize first letter/select the correct one, and replace
sStr = sStr.replaceAt( 0, 1, OUString(sStr[0]).toAsciiUpperCase() );
- }
- TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
- TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
pEditEngine->ReplaceText( sTextSelection, sStr );
pEditView->SetSelection( aSel );
- return;
}
if( r.tokenType == TT_IDENTIFIER )
{// correct variables
if( !aCodeCompleteCache.GetCorrectCaseVarName( sStr, sActSubName ).isEmpty() )
{
sStr = aCodeCompleteCache.GetCorrectCaseVarName( sStr, sActSubName );
- TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
- TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
pEditEngine->ReplaceText( sTextSelection, sStr );
pEditView->SetSelection( aSel );
- return;
}
-
- //autocorrect procedures
- SbxArray* pArr = rModulWindow.GetSbModule()->GetMethods();
- for( sal_uInt32 i=0; i< pArr->Count32(); ++i )
+ else
{
- if( pArr->Get32(i)->GetName().equalsIgnoreAsciiCase( sStr ) )
+ //autocorrect procedures
+ SbxArray* pArr = rModulWindow.GetSbModule()->GetMethods();
+ for( sal_uInt32 i=0; i < pArr->Count32(); ++i )
{
- sStr = pArr->Get32(i)->GetName(); //get the correct case
- TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
- TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
- pEditEngine->ReplaceText( sTextSelection, sStr );
- pEditView->SetSelection( aSel );
- return;
+ if( pArr->Get32(i)->GetName().equalsIgnoreAsciiCase( sStr ) )
+ {
+ sStr = pArr->Get32(i)->GetName(); //if found, get the correct case
+ pEditEngine->ReplaceText( sTextSelection, sStr );
+ pEditView->SetSelection( aSel );
+ return;
+ }
}
}
}
@@ -675,7 +689,7 @@ void EditorWindow::HandleAutoCloseDoubleQuotes()
if( aPortions.size() == 0 )
return;
- if( aLine.getLength() > 0 && aLine[aLine.getLength()-1] != '"' && (aPortions[aPortions.size()-1].tokenType != 4) )
+ if( aLine.getLength() > 0 && aLine[aLine.getLength()-1] != '"' && (aPortions[aPortions.size()-1].tokenType != TT_STRING) )
{
GetEditView()->InsertText(OUString("\""));
//leave the cursor on it's place: inside the two double quotes
@@ -2654,7 +2668,8 @@ void CodeCompleteListBox::KeyInput( const KeyEvent& rKeyEvt )
TextSelection aTextSelection( GetParentEditView()->GetSelection() );
if( aTextSelection.GetEnd().GetPara() != pCodeCompleteWindow->GetTextSelection().GetEnd().GetPara()-1 )
{
- HideAndRestoreFocus();
+ pCodeCompleteWindow->Hide();
+ pCodeCompleteWindow->pParent->GrabFocus();
}
break;
}
commit 755a74906ef3564f17d694787ba8de650e577677
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Tue Aug 20 13:29:18 2013 +0200
GSOC work, multiple fixes
Code completion: parser recognizes extended types ony when the checkbox is checked.
Fixed a crash caused by a misspelled uno type.
Fixed function CodeCompleteDataCache::Clear() to clear both internal variables.
Change-Id: I82fdd2e1cf749237e2e2de4a9a2fc7d07fb7eb4a
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index e73d66d..06e9567 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -2905,7 +2905,7 @@ UnoTypeCodeCompletetor::UnoTypeCodeCompletetor( const std::vector< OUString >& a
std::vector< OUString > UnoTypeCodeCompletetor::GetXIdlClassMethods() const
{
std::vector< OUString > aRetVect;
- if( bCanComplete )
+ if( bCanComplete && ( xClass != NULL ) )
{
Sequence< Reference< reflection::XIdlMethod > > aMethods = xClass->getMethods();
if( aMethods.getLength() != 0 )
@@ -2922,7 +2922,7 @@ std::vector< OUString > UnoTypeCodeCompletetor::GetXIdlClassMethods() const
std::vector< OUString > UnoTypeCodeCompletetor::GetXIdlClassFields() const
{
std::vector< OUString > aRetVect;
- if( bCanComplete )
+ if( bCanComplete && ( xClass != NULL ) )
{
Sequence< Reference< reflection::XIdlField > > aFields = xClass->getFields();
if( aFields.getLength() != 0 )
diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx
index a5b9ce6..aad0e4f 100644
--- a/basic/source/classes/codecompletecache.cxx
+++ b/basic/source/classes/codecompletecache.cxx
@@ -136,6 +136,7 @@ void CodeCompleteDataCache::print() const
void CodeCompleteDataCache::Clear()
{
aVarScopes.clear();
+ aGlobalVars.clear();
}
void CodeCompleteDataCache::InsertGlobalVar( const OUString& sVarName, const OUString& sVarType )
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index 2b94c39..64d0565 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -407,13 +407,13 @@ void SbiParser::DefVar( SbiOpcode eOp, bool bStatic )
OUString aTypeName( aGblStrings.Find( pDef->GetTypeId() ) );
if( rTypeArray->Find( aTypeName, SbxCLASS_OBJECT ) == NULL )
{
- if(!CodeCompleteOptions::IsCodeCompleteOn())
- Error( SbERR_UNDEF_TYPE, aTypeName );
- else
+ if( CodeCompleteOptions::IsExtendedTypeDeclaration() )
{
if(!IsUnoInterface(aTypeName))
Error( SbERR_UNDEF_TYPE, aTypeName );
}
+ else
+ Error( SbERR_UNDEF_TYPE, aTypeName );
}
}
commit 31f3859884618cc19d0810795c45c9f6ed73e622
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Mon Aug 19 17:28:52 2013 +0200
GSOC work, options fix
Tools/Options are now saving correctly.
I've added a check for empty string in EditorWindow::HandleCodeCompletition.
Change-Id: Ib5d75fe840e3c3fd12cd7175fb7828b8a1d76db6
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 6f8bc61..e73d66d 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -794,11 +794,14 @@ void EditorWindow::HandleCodeCompletition()
OUString sVarType = aCodeCompleteCache.GetVarType( sBaseName );
if( !sVarType.isEmpty() && CodeCompleteOptions::IsAutoCorrectOn() )
{//correct variable name, if autocorrection on
- TextPaM aStart(nLine, aLine.indexOf(sBaseName) );
- TextPaM aEnd(nLine, aLine.indexOf(sBaseName) + sBaseName.getLength() );
- TextSelection sTextSelection(aStart, aEnd);
- pEditEngine->ReplaceText( sTextSelection, aCodeCompleteCache.GetCorrectCaseVarName(sBaseName, GetActualSubName(nLine)) );
- pEditView->SetSelection( aSel );
+ const OUString& sStr = aCodeCompleteCache.GetCorrectCaseVarName( sBaseName, GetActualSubName(nLine) );
+ if( !sStr.isEmpty() )
+ {
+ TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
+ TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
+ pEditEngine->ReplaceText( sTextSelection, sStr );
+ pEditView->SetSelection( aSel );
+ }
}
UnoTypeCodeCompletetor aTypeCompletor( aVect, sVarType );
diff --git a/cui/source/options/optbasic.cxx b/cui/source/options/optbasic.cxx
index 21026b3..88ccc6d 100644
--- a/cui/source/options/optbasic.cxx
+++ b/cui/source/options/optbasic.cxx
@@ -82,55 +82,56 @@ void SvxBasicIDEOptionsPage::SaveConfig()
sal_Bool SvxBasicIDEOptionsPage::FillItemSet( SfxItemSet& /*rCoreSet*/ )
{
sal_Bool bModified = sal_False;
+ boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
if( pAutocloseProcChk->IsChecked() != pAutocloseProcChk->GetSavedValue() )
{
- boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::set( pAutocloseProcChk->IsChecked(), batch );
- batch->commit();
+ CodeCompleteOptions::SetProcedureAutoCompleteOn( pAutocloseProcChk->IsChecked() );
+ //batch->commit();
bModified = sal_True;
}
if( pCodeCompleteChk->IsChecked() != pCodeCompleteChk->GetSavedValue() )
{
- boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
+ //boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
officecfg::Office::BasicIDE::Autocomplete::CodeComplete::set( pCodeCompleteChk->IsChecked(), batch );
- batch->commit();
+ CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() );
+ //batch->commit();
bModified = sal_True;
}
if( pUseExtendedTypesChk->IsChecked() != pUseExtendedTypesChk->GetSavedValue() )
{
- boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
officecfg::Office::BasicIDE::Autocomplete::UseExtended::set( pUseExtendedTypesChk->IsChecked(), batch );
- batch->commit();
+ CodeCompleteOptions::SetExtendedTypeDeclaration( pUseExtendedTypesChk->IsChecked() );
bModified = sal_True;
}
if( pAutocloseParenChk->IsChecked() != pAutocloseParenChk->GetSavedValue() )
{
- boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::set( pAutocloseParenChk->IsChecked(), batch );
- batch->commit();
+ CodeCompleteOptions::SetAutoCloseParenthesisOn( pAutocloseParenChk->IsChecked() );
bModified = sal_True;
}
if( pAutocloseQuotesChk->IsChecked() != pAutocloseQuotesChk->GetSavedValue() )
{
- boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::set( pAutocloseQuotesChk->IsChecked(), batch );
- batch->commit();
+ CodeCompleteOptions::SetAutoCloseQuotesOn( pAutocloseQuotesChk->IsChecked() );
bModified = sal_True;
}
if( pAutoCorrectChk->IsChecked() != pAutoCorrectChk->GetSavedValue() )
{
- boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::set( pAutoCorrectChk->IsChecked(), batch );
- batch->commit();
+ CodeCompleteOptions::SetAutoCorrectOn( pAutoCorrectChk->IsChecked() );
bModified = sal_True;
}
+ if( bModified )
+ batch->commit();
+
return bModified;
}
commit d977f5951443aa45ab2e44aa2cb72ac0bbf0af57
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Mon Aug 19 15:52:01 2013 +0200
GSOC work, small fixes
Some code fixes in function EditorWindow::HandleAutoCorrect():
updating the module and getting the data from parse is necessary(not just when code complete is on).
Removed some duplicate code when checking for the type of the actual highlight portion.
Change-Id: I29a62dae23f2c28e54f9185ac59ff2747c64e0d7
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index f25a41f..6f8bc61 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -587,11 +587,8 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
void EditorWindow::HandleAutoCorrect()
{
- if( CodeCompleteOptions::IsExtendedTypeDeclaration() )
- {
- rModulWindow.UpdateModule();
- rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse( aCodeCompleteCache );
- }
+ rModulWindow.UpdateModule();
+ rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse( aCodeCompleteCache );
TextSelection aSel = GetEditView()->GetSelection();
sal_uLong nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
@@ -604,32 +601,29 @@ void EditorWindow::HandleAutoCorrect()
return;
HighlightPortion& r = aPortions[aPortions.size()-1];
- if( r.tokenType == TT_KEYWORDS ) // correct the last entered keyword
+ OUString sStr = aLine.copy(r.nBegin, r.nEnd - r.nBegin);
+ if( r.tokenType == TT_KEYWORDS && !sStr.isEmpty() ) // correct the last entered keyword
{
- OUString sStr = aLine.copy(r.nBegin, r.nEnd - r.nBegin);
- if( !sStr.isEmpty() )
- {
- sStr = sStr.toAsciiLowerCase();
- if( !rModulWindow.GetSbModule()->GetKeywordCase(sStr).isEmpty() )
- // if it is a keyword, get its correct case
- sStr = rModulWindow.GetSbModule()->GetKeywordCase(sStr);
- else
- {// else capitalize first letter/select the correct one, and replace
- sStr = sStr.replaceAt( 0, 1, OUString(sStr[0]).toAsciiUpperCase() );
- }
-
- TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
- TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
- pEditEngine->ReplaceText( sTextSelection, sStr );
- pEditView->SetSelection( aSel );
+ sStr = sStr.toAsciiLowerCase();
+ if( !rModulWindow.GetSbModule()->GetKeywordCase(sStr).isEmpty() )
+ // if it is a keyword, get its correct case
+ sStr = rModulWindow.GetSbModule()->GetKeywordCase(sStr);
+ else
+ {// else capitalize first letter/select the correct one, and replace
+ sStr = sStr.replaceAt( 0, 1, OUString(sStr[0]).toAsciiUpperCase() );
}
+
+ TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
+ TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
+ pEditEngine->ReplaceText( sTextSelection, sStr );
+ pEditView->SetSelection( aSel );
+ return;
}
if( r.tokenType == TT_IDENTIFIER )
- {// correct uno types
- const OUString& sVarName = aLine.copy(r.nBegin, r.nEnd - r.nBegin);
- if( !aCodeCompleteCache.GetCorrectCaseVarName( sVarName, sActSubName ).isEmpty() )
+ {// correct variables
+ if( !aCodeCompleteCache.GetCorrectCaseVarName( sStr, sActSubName ).isEmpty() )
{
- const OUString& sStr = aCodeCompleteCache.GetCorrectCaseVarName( sVarName, sActSubName );
+ sStr = aCodeCompleteCache.GetCorrectCaseVarName( sStr, sActSubName );
TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
pEditEngine->ReplaceText( sTextSelection, sStr );
@@ -641,9 +635,9 @@ void EditorWindow::HandleAutoCorrect()
SbxArray* pArr = rModulWindow.GetSbModule()->GetMethods();
for( sal_uInt32 i=0; i< pArr->Count32(); ++i )
{
- if( pArr->Get32(i)->GetName().equalsIgnoreAsciiCase( sVarName ) )
+ if( pArr->Get32(i)->GetName().equalsIgnoreAsciiCase( sStr ) )
{
- const OUString& sStr = pArr->Get32(i)->GetName();
+ sStr = pArr->Get32(i)->GetName(); //get the correct case
TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
pEditEngine->ReplaceText( sTextSelection, sStr );
commit 67596f4cc67cab14ccd3005be1f1c7c9ef6df557
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Mon Aug 19 13:53:38 2013 +0200
GSOC work, autocorrect procedures+variables
Fixed some small issue with the right arrow key in the ListBox.
Autocorrection now correct all variable types and procedure names.
Change-Id: Iff1abaf10c621aef04772837faa272bb6f987e37
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 78a77dc..f25a41f 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -590,11 +590,12 @@ void EditorWindow::HandleAutoCorrect()
if( CodeCompleteOptions::IsExtendedTypeDeclaration() )
{
rModulWindow.UpdateModule();
- rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse(aCodeCompleteCache);
+ rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse( aCodeCompleteCache );
}
TextSelection aSel = GetEditView()->GetSelection();
sal_uLong nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
+ const OUString& sActSubName = GetActualSubName( nLine ); // the actual procedure
HighlightPortions aPortions;
aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
@@ -625,14 +626,30 @@ void EditorWindow::HandleAutoCorrect()
}
if( r.tokenType == TT_IDENTIFIER )
{// correct uno types
- OUString sStr = aLine.copy(r.nBegin, r.nEnd - r.nBegin);
- if( sStr != aCodeCompleteCache.GetCorrectCaseVarName(sStr) )
+ const OUString& sVarName = aLine.copy(r.nBegin, r.nEnd - r.nBegin);
+ if( !aCodeCompleteCache.GetCorrectCaseVarName( sVarName, sActSubName ).isEmpty() )
{
- sStr = aCodeCompleteCache.GetCorrectCaseVarName(sStr);
+ const OUString& sStr = aCodeCompleteCache.GetCorrectCaseVarName( sVarName, sActSubName );
TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
pEditEngine->ReplaceText( sTextSelection, sStr );
pEditView->SetSelection( aSel );
+ return;
+ }
+
+ //autocorrect procedures
+ SbxArray* pArr = rModulWindow.GetSbModule()->GetMethods();
+ for( sal_uInt32 i=0; i< pArr->Count32(); ++i )
+ {
+ if( pArr->Get32(i)->GetName().equalsIgnoreAsciiCase( sVarName ) )
+ {
+ const OUString& sStr = pArr->Get32(i)->GetName();
+ TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
+ TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
+ pEditEngine->ReplaceText( sTextSelection, sStr );
+ pEditView->SetSelection( aSel );
+ return;
+ }
}
}
}
@@ -786,7 +803,7 @@ void EditorWindow::HandleCodeCompletition()
TextPaM aStart(nLine, aLine.indexOf(sBaseName) );
TextPaM aEnd(nLine, aLine.indexOf(sBaseName) + sBaseName.getLength() );
TextSelection sTextSelection(aStart, aEnd);
- pEditEngine->ReplaceText( sTextSelection, aCodeCompleteCache.GetCorrectCaseVarName(sBaseName) );
+ pEditEngine->ReplaceText( sTextSelection, aCodeCompleteCache.GetCorrectCaseVarName(sBaseName, GetActualSubName(nLine)) );
pEditView->SetSelection( aSel );
}
@@ -2638,7 +2655,7 @@ void CodeCompleteListBox::KeyInput( const KeyEvent& rKeyEvt )
case KEY_RIGHT:
{
TextSelection aTextSelection( GetParentEditView()->GetSelection() );
- if( aTextSelection.GetEnd().GetPara() != pCodeCompleteWindow->GetTextSelection().GetEnd().GetPara() )
+ if( aTextSelection.GetEnd().GetPara() != pCodeCompleteWindow->GetTextSelection().GetEnd().GetPara()-1 )
{
HideAndRestoreFocus();
}
diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx
index 9d78455..a5b9ce6 100644
--- a/basic/source/classes/codecompletecache.cxx
+++ b/basic/source/classes/codecompletecache.cxx
@@ -182,20 +182,20 @@ OUString CodeCompleteDataCache::GetVarType( const OUString& sVarName ) const
return OUString(""); //not found
}
-OUString CodeCompleteDataCache::GetCorrectCaseVarName( const OUString& sVarName ) const
+OUString CodeCompleteDataCache::GetCorrectCaseVarName( const OUString& sVarName, const OUString& sActProcName ) const
{
for( CodeCompleteVarScopes::const_iterator aIt = aVarScopes.begin(); aIt != aVarScopes.end(); ++aIt )
{
CodeCompleteVarTypes aTypes = aIt->second;
for( CodeCompleteVarTypes::const_iterator aOtherIt = aTypes.begin(); aOtherIt != aTypes.end(); ++aOtherIt )
{
- if( aOtherIt->first.equalsIgnoreAsciiCase( sVarName ) )
+ if( aOtherIt->first.equalsIgnoreAsciiCase( sVarName ) && aIt->first.equalsIgnoreAsciiCase( sActProcName ) )
{
return aOtherIt->first;
}
}
}
- //not a local, search global scope
+ // search global scope
for( CodeCompleteVarTypes::const_iterator aIt = aGlobalVars.begin(); aIt != aGlobalVars.end(); ++aIt )
{
if( aIt->first.equalsIgnoreAsciiCase( sVarName ) )
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index a3fa779..567d26f 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1790,40 +1790,23 @@ void SbModule::GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache)
while( pParser->Parse() ) {}
SbiSymPool* pPool = pParser->pPool;
- //CodeCompleteVarTypes aGlobVarTypes;
aCache.Clear();
for( sal_uInt16 i = 0; i < pPool->GetSize(); ++i )
{
SbiSymDef* pSymDef = pPool->Get(i);
- //std::cerr << "i: " << i << ", type: " << pSymDef->GetType() << std::endl;
- if( pSymDef->GetType() == SbxOBJECT )
- {
- if( !pParser->aGblStrings.Find( pSymDef->GetTypeId() ).isEmpty() )
- {
- //aGlobVarTypes.insert( CodeCompleteVarTypes::value_type( pSymDef->GetName(), pParser->aGblStrings.Find( pSymDef->GetTypeId() ) ) );
- aCache.InsertGlobalVar( pSymDef->GetName(), pParser->aGblStrings.Find(pSymDef->GetTypeId()) );
- }
- }
+ //std::cerr << "i: " << i << ", type: " << pSymDef->GetType() << "; name:" << pSymDef->GetName() << std::endl;
+ if( (pSymDef->GetType() != SbxEMPTY) || (pSymDef->GetType() != SbxNULL) )
+ aCache.InsertGlobalVar( pSymDef->GetName(), pParser->aGblStrings.Find(pSymDef->GetTypeId()) );
SbiSymPool& pChildPool = pSymDef->GetPool();
- //CodeCompleteVarTypes aLocVarTypes;
for(sal_uInt16 j = 0; j < pChildPool.GetSize(); ++j )
{
SbiSymDef* pChildSymDef = pChildPool.Get(j);
- //std::cerr << "j: " << j << ", type: " << pChildSymDef->GetType() << std::endl;
- if( pChildSymDef->GetType() == SbxOBJECT )
- {
- if( !pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ).isEmpty() )
- {
- //aLocVarTypes.insert( CodeCompleteVarTypes::value_type( pChildSymDef->GetName(), pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ) ) );
- aCache.InsertLocalVar( pSymDef->GetName(), pChildSymDef->GetName(), pParser->aGblStrings.Find(pChildSymDef->GetTypeId()) );
- }
- }
+ //std::cerr << "j: " << j << ", type: " << pChildSymDef->GetType() << "; name:" << pChildSymDef->GetName() << std::endl;
+ if( (pChildSymDef->GetType() != SbxEMPTY) || (pChildSymDef->GetType() != SbxNULL) )
+ aCache.InsertLocalVar( pSymDef->GetName(), pChildSymDef->GetName(), pParser->aGblStrings.Find(pChildSymDef->GetTypeId()) );
}
- //aCache.InsertProcedure( pSymDef->GetName(), aLocVarTypes );
}
- //aCache.InsertProcedure( CodeCompleteDataCache::GLOB_KEY, aGlobVarTypes );
-
delete pParser;
}
diff --git a/include/basic/codecompletecache.hxx b/include/basic/codecompletecache.hxx
index d455fa7..e85b0d8 100644
--- a/include/basic/codecompletecache.hxx
+++ b/include/basic/codecompletecache.hxx
@@ -93,7 +93,7 @@ public:
void InsertGlobalVar( const OUString& sVarName, const OUString& sVarType );
void InsertLocalVar( const OUString& sProcName, const OUString& sVarName, const OUString& sVarType );
OUString GetVarType( const OUString& sVarName ) const;
- OUString GetCorrectCaseVarName( const OUString& sVarName ) const;
+ OUString GetCorrectCaseVarName( const OUString& sVarName, const OUString& sActProcName ) const;
void print() const; // wrapper for operator<<, prints to std::cerr
void Clear();
};
commit 2f3f5dced8aa9b8010a33176bc941d5879986bfb
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Thu Aug 15 12:48:42 2013 +0200
GSOC work, small code fixes
Added some constants for CodeCompleteWindow::ResizeListBox().
Simplified a condition is EditorWindow::HandleAutoCorrect().
Change-Id: If8aa34273b6170130d95a309ed385a5152418b76
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 6906a33..78a77dc 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 );
commit a8d78a367e6e66a52db330326d6a2dec8acfdaa7
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Thu Aug 15 11:21:20 2013 +0200
GSOC work, simplify CodeCompleteWindow::ResizeListBox
Now all calculations are done in this function, plus the initial TextSelection is passed as a parameter (it it needed to determine the location of the ListBox).
Some local variables were made constant.
Change-Id: I36942ded72cc988c8fd5114e0d666f447b80d396
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 4c4ac34..df6b451 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -529,7 +529,7 @@ public:
void ClearListBox();
void SetTextSelection( const TextSelection& aSel );
const TextSelection& GetTextSelection() const;
- void ResizeListBox();
+ void ResizeListBox( const TextSelection& aSel );
void SelectFirstEntry(); //selects first entry in ListBox
void ClearAndHide();
/*
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index d253e61..6906a33 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -808,25 +808,22 @@ void EditorWindow::HandleCodeCompletition()
void EditorWindow::SetupAndShowCodeCompleteWnd( const std::vector< OUString >& aEntryVect, TextSelection aSel )
{
- // calculate position
- Rectangle aRect = ( (TextEngine*) GetEditEngine() )->PaMtoEditCursor( aSel.GetEnd() , false );
- long nViewYOffset = pEditView->GetStartDocPos().Y();
- Point aPoint = aRect.BottomRight();
- aPoint.Y() = (aPoint.Y() - nViewYOffset) + 2;
- aSel.GetStart().GetIndex() += 1;
- aSel.GetEnd().GetIndex() += 1;
+ // clear the listbox
pCodeCompleteWnd->ClearListBox();
- pCodeCompleteWnd->SetTextSelection(aSel);
- //fill the listbox
+ // fill the listbox
for(unsigned int l = 0; l < aEntryVect.size(); ++l)
{
pCodeCompleteWnd->InsertEntry( aEntryVect[l] );
}
- //show it
- pCodeCompleteWnd->SetPosPixel( aPoint );
+ // show it
pCodeCompleteWnd->Show();
- pCodeCompleteWnd->ResizeListBox();
+ pCodeCompleteWnd->ResizeListBox( aSel );
pCodeCompleteWnd->SelectFirstEntry();
+ // correct text selection, and set it
+ aSel.GetStart().GetIndex() += 1;
+ aSel.GetEnd().GetIndex() += 1;
+ pCodeCompleteWnd->SetTextSelection( aSel );
+ //give the focus to the EditView
pEditView->GetWindow()->GrabFocus();
}
@@ -2770,26 +2767,30 @@ const TextSelection& CodeCompleteWindow::GetTextSelection() const
return aTextSelection;
}
-void CodeCompleteWindow::ResizeListBox()
+void CodeCompleteWindow::ResizeListBox( const TextSelection& aSel )
{
- if( pListBox->GetEntryCount() > 0 )
+ if( pListBox->GetEntryCount() >= 1 )
{// if there is at least one element inside
- OUString aLongestEntry = pListBox->GetEntry( 0 );//grab the longest one: max search
- if( pListBox->GetEntryCount() > 0 )
+ // calculate basic position: under the current line
+ 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;
+
+ OUString aLongestEntry = pListBox->GetEntry( 0 );// grab the longest one: max search
+ for( sal_uInt16 i=1; i< pListBox->GetEntryCount(); ++i )
{
- for( sal_uInt16 i=1; i< pListBox->GetEntryCount(); ++i )
- {
- if( ((OUString) pListBox->GetEntry( i )).getLength() > aLongestEntry.getLength() )
- aLongestEntry = pListBox->GetEntry( i );
- }
+ if( ((OUString) pListBox->GetEntry( i )).getLength() > aLongestEntry.getLength() )
+ aLongestEntry = pListBox->GetEntry( i );
}
- sal_uInt16 nColumns = aLongestEntry.getLength();
- sal_uInt16 nLines = std::min( (sal_uInt16) 6, pListBox->GetEntryCount() );
- const Font& aFont = pListBox->GetUnzoomedControlPointFont();
+ // get column/line count
+ const sal_uInt16& nColumns = aLongestEntry.getLength();
+ const sal_uInt16& nLines = std::min( (sal_uInt16) 6, pListBox->GetEntryCount() );
+ const Font& aFont = pListBox->GetFont();// listbox's font: height is needed
Rectangle aVisArea( pParent->GetEditView()->GetStartDocPos(), pParent->GetOutputSizePixel() );
- Size aSize = pListBox->GetOptimalSize();//this sets the correct width
- aSize.setHeight( pListBox->CalcSize( nColumns, nLines ).getHeight() );
+ Size aSize = pListBox->GetOptimalSize();// this sets the correct width
+ aSize.setHeight( pListBox->CalcSize( nColumns, nLines ).getHeight() );// correct height
Point aBottomPoint = aVisArea.BottomRight();
Point aTopPoint = aVisArea.TopRight();
@@ -2797,23 +2798,22 @@ void CodeCompleteWindow::ResizeListBox()
if( (nYDiff + aFont.GetSize().getHeight()) < aSize.Height() )
{//bottom part is clipped, fix the visibility by placing it over the line (not under)
- Point aPos = GetPosPixel();
- Font aParFont = pParent->GetEditEngine()->GetFont();
+ 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);
- SetPosPixel(aPos);
}
long nXDiff = std::abs(aTopPoint.X() - GetPosPixel().X());
if( nXDiff < aSize.Width() )
{//clipped at the right side, move it a bit left
- Point aPos = GetPosPixel();
aPos.X() = aPos.X() - aSize.Width() + nXDiff;
- SetPosPixel(aPos);
}
+
pListBox->SetSizePixel( aSize );
aSize.setWidth( aSize.getWidth() + 1 );
aSize.setHeight( aSize.getHeight() + 1 );
+ // set the size and the position of the window
SetSizePixel( aSize );
+ SetPosPixel( aPos );
}
}
commit 703f0e095da4e1c32d9df5c1b0e05c746b5bfe10
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Wed Aug 14 16:39:49 2013 +0200
GSOC work, autocorrect fix
Autocorrect fixes the new types independently from code completition(not just pressing the "." after the variable).
Change-Id: Icc31af29f1dcc0de662d7fc191c3f215188b571b
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 1246566..d253e61 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -585,6 +585,11 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
void EditorWindow::HandleAutoCorrect()
{
+ if( CodeCompleteOptions::IsExtendedTypeDeclaration() )
+ {
+ rModulWindow.UpdateModule();
+ rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse(aCodeCompleteCache);
+ }
TextSelection aSel = GetEditView()->GetSelection();
sal_uLong nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
@@ -596,7 +601,7 @@ void EditorWindow::HandleAutoCorrect()
return;
HighlightPortion& r = aPortions[aPortions.size()-1];
- if( r.tokenType == 9 ) // correct the last entered keyword
+ if( r.tokenType == TT_KEYWORDS ) // correct the last entered keyword
{
OUString sStr = aLine.copy(r.nBegin, r.nEnd - r.nBegin);
if( !sStr.isEmpty() )
@@ -606,8 +611,9 @@ void EditorWindow::HandleAutoCorrect()
// if it is a keyword, get its correct case
sStr = rModulWindow.GetSbModule()->GetKeywordCase(sStr);
else
- // else capitalize first letter/select the correct one, and replace
+ {// else capitalize first letter/select the correct one, and replace
sStr = sStr.replaceAt( 0, 1, OUString(sStr[0]).toAsciiUpperCase() );
+ }
TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
@@ -615,6 +621,18 @@ void EditorWindow::HandleAutoCorrect()
pEditView->SetSelection( aSel );
}
}
+ 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() )
+ {
+ sStr = aCodeCompleteCache.GetCorrectCaseVarName(sStr);
+ TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
+ TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
+ pEditEngine->ReplaceText( sTextSelection, sStr );
+ pEditView->SetSelection( aSel );
+ }
+ }
}
void EditorWindow::HandleAutoCloseParen()
commit 82a4ad7a5c18801c64a28e9df6a96c0e1abf5b64
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Wed Aug 14 12:56:39 2013 +0200
GSOC work, renaming + options fix
Options now work correctly: I've added the missing function.
Rename: renamed some variables and methods to kep the consistence( Autocorrect keywords -> Autocorrect).
Change-Id: I6b4914575f1a06eb3268c133b8b990364e3d24e4
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 90f49a5..1246566 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -516,7 +516,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
if( (rKEvt.GetKeyCode().GetCode() == KEY_SPACE ||
rKEvt.GetKeyCode().GetCode() == KEY_TAB ||
- rKEvt.GetKeyCode().GetCode() == KEY_RETURN ) && CodeCompleteOptions::IsAutoCorrectKeywordsOn() )
+ rKEvt.GetKeyCode().GetCode() == KEY_RETURN ) && CodeCompleteOptions::IsAutoCorrectOn() )
{
HandleAutoCorrect();
}
@@ -761,7 +761,7 @@ void EditorWindow::HandleCodeCompletition()
OUString sBaseName = aVect[0];//variable name
OUString sVarType = aCodeCompleteCache.GetVarType( sBaseName );
- if( !sVarType.isEmpty() && CodeCompleteOptions::IsAutoCorrectKeywordsOn() )
+ if( !sVarType.isEmpty() && CodeCompleteOptions::IsAutoCorrectOn() )
{//correct variable name
TextPaM aStart(nLine, aLine.indexOf(sBaseName) );
TextPaM aEnd(nLine, aLine.indexOf(sBaseName) + sBaseName.getLength() );
diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx
index 999c324..9d78455 100644
--- a/basic/source/classes/codecompletecache.cxx
+++ b/basic/source/classes/codecompletecache.cxx
@@ -29,7 +29,7 @@ namespace
CodeCompleteOptions::CodeCompleteOptions()
{
- bIsAutoCorrectKeywordsOn = officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::get();
+ bIsAutoCorrectOn = officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::get();
bIsAutoCloseParenthesisOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get();
bIsAutoCloseQuotesOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get();
bIsProcedureAutoCompleteOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::get();
@@ -87,14 +87,14 @@ void CodeCompleteOptions::SetAutoCloseParenthesisOn( const bool& b )
theCodeCompleteOptions::get().bIsAutoCloseParenthesisOn = b;
}
-bool CodeCompleteOptions::IsAutoCorrectKeywordsOn()
+bool CodeCompleteOptions::IsAutoCorrectOn()
{
- return theCodeCompleteOptions::get().aMiscOptions.IsExperimentalMode() && theCodeCompleteOptions::get().bIsAutoCorrectKeywordsOn;
+ return theCodeCompleteOptions::get().aMiscOptions.IsExperimentalMode() && theCodeCompleteOptions::get().bIsAutoCorrectOn;
}
-void CodeCompleteOptions::SetAutoCorrectKeywordsOn( const bool& b )
+void CodeCompleteOptions::SetAutoCorrectOn( const bool& b )
{
- theCodeCompleteOptions::get().bIsAutoCorrectKeywordsOn = b;
+ theCodeCompleteOptions::get().bIsAutoCorrectOn = b;
}
std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache)
diff --git a/cui/source/options/optbasic.cxx b/cui/source/options/optbasic.cxx
index 717f526..21026b3 100644
--- a/cui/source/options/optbasic.cxx
+++ b/cui/source/options/optbasic.cxx
@@ -155,4 +155,10 @@ SfxTabPage* SvxBasicIDEOptionsPage::Create( Window* pParent, const SfxItemSet& r
return ( new SvxBasicIDEOptionsPage( pParent, rAttrSet ) );
}
+void SvxBasicIDEOptionsPage::FillUserData()
+{
+ OUString aUserData;
+ SetUserData( aUserData );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optbasic.hxx b/cui/source/options/optbasic.hxx
index 2ca4820..fe1b52e 100644
--- a/cui/source/options/optbasic.hxx
+++ b/cui/source/options/optbasic.hxx
@@ -44,6 +44,7 @@ public:
static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
virtual sal_Bool FillItemSet( SfxItemSet& rSet );
virtual void Reset( const SfxItemSet& rSet );
+ virtual void FillUserData();
};
diff --git a/include/basic/codecompletecache.hxx b/include/basic/codecompletecache.hxx
index a218607..d455fa7 100644
--- a/include/basic/codecompletecache.hxx
+++ b/include/basic/codecompletecache.hxx
@@ -45,7 +45,7 @@ private:
bool bIsProcedureAutoCompleteOn;
bool bIsAutoCloseQuotesOn;
bool bIsAutoCloseParenthesisOn;
- bool bIsAutoCorrectKeywordsOn;
+ bool bIsAutoCorrectOn;
bool bExtendedTypeDeclarationOn;
SvtMiscOptions aMiscOptions;
@@ -67,8 +67,8 @@ public:
static bool IsAutoCloseParenthesisOn();
static void SetAutoCloseParenthesisOn( const bool& b );
- static bool IsAutoCorrectKeywordsOn();
- static void SetAutoCorrectKeywordsOn( const bool& b );
+ static bool IsAutoCorrectOn();
+ static void SetAutoCorrectOn( const bool& b );
};
class BASIC_DLLPUBLIC CodeCompleteDataCache
commit 9b534193a3132764f7c5a659025ab2c49bfb2605
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Tue Aug 13 18:11:26 2013 +0200
GSOC work, behavior fixes
Code completition: left/right arrow keys handled. Left arrow dismisses the dialog when reaches the dot. Right arrow dismissed the dialog when reaches the next line.
ListBox appearance fixed.
TAB key can insert the first matching entry.
Autocorrect:
"Autocorrect Keywords" has been renamed to "Autcorrect" (in the UI, and the config file, after this patch a make dev-install is needed). Keyword case correction is not just capitalizing the first letter ( eg. Elseif -> ElseIf ).
Autoclose procedures:
cursor is being placed inside the preocedure.
Change-Id: Ie7e9ae96b49bd94562db83f96e1c4ad63ab3f3d6
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 0b04481..90f49a5 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -536,8 +536,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
HandleProcedureCompletition();
}
- if( rKEvt.GetKeyCode().GetCode() == KEY_POINT &&
- (CodeCompleteOptions::IsCodeCompleteOn() || CodeCompleteOptions::IsExtendedTypeDeclaration()) )
+ if( rKEvt.GetKeyCode().GetCode() == KEY_POINT && CodeCompleteOptions::IsCodeCompleteOn() )
{
HandleCodeCompletition();
}
@@ -602,9 +601,13 @@ void EditorWindow::HandleAutoCorrect()
OUString sStr = aLine.copy(r.nBegin, r.nEnd - r.nBegin);
if( !sStr.isEmpty() )
{
- //capitalize first letter and replace
sStr = sStr.toAsciiLowerCase();
- sStr = sStr.replaceAt( 0, 1, OUString(sStr[0]).toAsciiUpperCase() );
+ if( !rModulWindow.GetSbModule()->GetKeywordCase(sStr).isEmpty() )
+ // if it is a keyword, get its correct case
+ sStr = rModulWindow.GetSbModule()->GetKeywordCase(sStr);
+ else
+ // else capitalize first letter/select the correct one, and replace
+ sStr = sStr.replaceAt( 0, 1, OUString(sStr[0]).toAsciiUpperCase() );
TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
@@ -690,13 +693,17 @@ void EditorWindow::HandleProcedureCompletition()
return;// no sub/function keyword or there is no identifier
OUString sText("\nEnd ");
+ aSel = GetEditView()->GetSelection();
if( sProcType.equalsIgnoreAsciiCase("function") )
sText += OUString( "Function\n" );
if( sProcType.equalsIgnoreAsciiCase("sub") )
sText += OUString( "Sub\n" );
if( nLine+1 == pEditEngine->GetParagraphCount() )
+ {
pEditView->InsertText( sText );//append to the end
+ GetEditView()->SetSelection(aSel);
+ }
else
{
for( sal_uLong i = nLine+1; i < pEditEngine->GetParagraphCount(); ++i )
@@ -714,7 +721,8 @@ void EditorWindow::HandleProcedureCompletition()
{
if( sStr.equalsIgnoreAsciiCase("sub") || sStr.equalsIgnoreAsciiCase("function") )
{
- pEditView->InsertText( sText );
+ pEditView->InsertText( sText );//append to the end
+ GetEditView()->SetSelection(aSel);
break;
}
if( sStr.equalsIgnoreAsciiCase("end") )
@@ -735,15 +743,16 @@ void EditorWindow::HandleCodeCompletition()
std::vector< OUString > aVect; //vector to hold the base variable+methods for the nested reflection
HighlightPortions aPortions;
+ aLine = aLine.copy(0, aSel.GetEnd().GetIndex());
aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
if( aPortions.size() > 0 )
{//use the syntax highlighter to grab out nested reflection calls, eg. aVar.aMethod("aa").aOtherMethod ..
- for( auto aIt = aPortions.crbegin(); aIt != aPortions.crend(); ++aIt )
+ for( HighlightPortions::reverse_iterator aIt = aPortions.rbegin(); aIt != aPortions.rend(); ++aIt )
{
HighlightPortion r = *aIt;
- if( r.tokenType == 2 ) // a whitespace: stop; if there is no ws, it goes to the beginning of the line
+ if( r.tokenType == TT_WHITESPACE ) // a whitespace: stop; if there is no ws, it goes to the beginning of the line
break;
- if( r.tokenType == 1 || r.tokenType == 9 ) // extract the identifers(methods, base variable)
+ if( r.tokenType == TT_IDENTIFIER || r.tokenType == TT_KEYWORDS ) // extract the identifers(methods, base variable)
/* an example: Dim aLocVar2 as com.sun.star.beans.PropertyValue
* here, aLocVar2.Name, and PropertyValue's Name field is treated as a keyword(?!)
* */
@@ -2609,19 +2618,43 @@ void CodeCompleteListBox::KeyInput( const KeyEvent& rKeyEvt )
case KEY_ESCAPE: // hide, do nothing
HideAndRestoreFocus();
break;
+ case KEY_RIGHT:
+ {
+ TextSelection aTextSelection( GetParentEditView()->GetSelection() );
+ if( aTextSelection.GetEnd().GetPara() != pCodeCompleteWindow->GetTextSelection().GetEnd().GetPara() )
+ {
+ HideAndRestoreFocus();
+ }
+ break;
+ }
+ case KEY_LEFT:
+ {
+ TextSelection aTextSelection( GetParentEditView()->GetSelection() );
+ if( aTextSelection.GetStart().GetIndex()-1 < pCodeCompleteWindow->GetTextSelection().GetStart().GetIndex() )
+ {//leave the cursor where it is
+ pCodeCompleteWindow->Hide();
+ pCodeCompleteWindow->pParent->GrabFocus();
+ }
+ break;
+ }
case KEY_TAB:
+ {
+ TextPaM aTextEnd( GetParentEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetEnd()) );
+ TextSelection aTextSelection( pCodeCompleteWindow->GetTextSelection().GetStart(), aTextEnd );
+ OUString sTypedText = pCodeCompleteWindow->pParent->GetEditEngine()->GetText(aTextSelection);
if( !aFuncBuffer.isEmpty() )
{
sal_uInt16 nInd = GetSelectEntryPos();
- if( nInd+1 != LISTBOX_ENTRY_NOTFOUND )
+ if( nInd != LISTBOX_ENTRY_NOTFOUND )
{//if there is something selected
bool bFound = false;
if( nInd == GetEntryCount() )
nInd = 0;
- for( sal_uInt16 i = nInd+1; i != GetEntryCount(); ++i )
+ for( sal_uInt16 i = nInd; i != GetEntryCount(); ++i )
{
OUString sEntry = (OUString) GetEntry(i);
- if( sEntry.startsWithIgnoreAsciiCase( aFuncBuffer.toString() ) )
+ if( sEntry.startsWithIgnoreAsciiCase( aFuncBuffer.toString() )
+ && (aFuncBuffer.toString() != sTypedText) && (i != nInd) )
{
SelectEntry( sEntry );
bFound = true;
@@ -2638,6 +2671,7 @@ void CodeCompleteListBox::KeyInput( const KeyEvent& rKeyEvt )
}
}
break;
+ }
case KEY_SPACE:
HideAndRestoreFocus();
break;
diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx
index 1729543..999c324 100644
--- a/basic/source/classes/codecompletecache.cxx
+++ b/basic/source/classes/codecompletecache.cxx
@@ -29,7 +29,7 @@ namespace
CodeCompleteOptions::CodeCompleteOptions()
{
- bIsAutoCorrectKeywordsOn = officecfg::Office::BasicIDE::Autocomplete::AutoCorrectKeywords::get();
+ bIsAutoCorrectKeywordsOn = officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::get();
bIsAutoCloseParenthesisOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get();
bIsAutoCloseQuotesOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get();
bIsProcedureAutoCompleteOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::get();
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 053c13e..a3fa779 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1832,6 +1832,11 @@ SbxArrayRef SbModule::GetMethods()
return pMethods;
}
+OUString SbModule::GetKeywordCase( const OUString& sKeyword ) const
+{
+ return SbiParser::GetKeywordCase( sKeyword );
+}
+
bool SbModule::HasExeCode()
{
// And empty Image always has the Global Chain set up
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index e24f89b..680f4dc 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -155,7 +155,6 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
}
-
// part of the runtime-library?
SbiSymDef* SbiParser::CheckRTLForSym( const OUString& rSym, SbxDataType eType )
{
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index 5761427..a2df363 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -547,4 +547,25 @@ bool SbiTokenizer::MayBeLabel( bool bNeedsColon )
}
}
+
+OUString SbiTokenizer::GetKeywordCase( const OUString& sKeyword )
+{
+ if( !nToken )
+ {
+ TokenTable *tp;
+ for( nToken = 0, tp = pTokTable; tp->t; nToken++, tp++ )
+ {}
+ }
+ TokenTable* tp = pTokTable;
+ for( short i = 0; i < nToken; i++, tp++ )
+ {
+ OUString sStr = OStringToOUString(tp->s, RTL_TEXTENCODING_ASCII_US);
+ if( sStr.equalsIgnoreAsciiCase(sKeyword) )
+ {
+ return sStr;
+ }
+ }
+ return OUString("");
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx
index 0ce9cf4..cf127bc 100644
--- a/basic/source/inc/token.hxx
+++ b/basic/source/inc/token.hxx
@@ -167,6 +167,7 @@ public:
{ return t >= FIRSTKWD && t <= LASTKWD; }
static bool IsExtra( SbiToken t )
{ return t >= FIRSTEXTRA; }
+ static OUString GetKeywordCase( const OUString& sKeyword );
};
diff --git a/cui/source/options/optbasic.cxx b/cui/source/options/optbasic.cxx
index 93d8fc5..717f526 100644
--- a/cui/source/options/optbasic.cxx
+++ b/cui/source/options/optbasic.cxx
@@ -39,7 +39,7 @@ SvxBasicIDEOptionsPage::SvxBasicIDEOptionsPage( Window* pParent, const SfxItemSe
get(pAutocloseProcChk, "autoclose_proc");
get(pAutocloseParenChk, "autoclose_paren");
get(pAutocloseQuotesChk, "autoclose_quotes");
- get(pAutoCorrectKeywordsChk, "autocorrect_keywords");
+ get(pAutoCorrectChk, "autocorrect");
get(pUseExtendedTypesChk, "extendedtypes_enable");
LoadConfig();
@@ -57,13 +57,13 @@ void SvxBasicIDEOptionsPage::LoadConfig()
bool bCodeCompleteOn = officecfg::Office::BasicIDE::Autocomplete::CodeComplete::get();
bool bParenClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get();
bool bQuoteClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get();
- bool bCorrect = officecfg::Office::BasicIDE::Autocomplete::AutoCorrectKeywords::get();
+ bool bCorrect = officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::get();
pCodeCompleteChk->Check( bCodeCompleteOn );
pAutocloseProcChk->Check( bProcClose );
pAutocloseQuotesChk->Check( bQuoteClose );
pAutocloseParenChk->Check( bParenClose );
- pAutoCorrectKeywordsChk->Check( bCorrect );
+ pAutoCorrectChk->Check( bCorrect );
pUseExtendedTypesChk->Check( bExtended );
}
@@ -75,7 +75,7 @@ void SvxBasicIDEOptionsPage::SaveConfig()
officecfg::Office::BasicIDE::Autocomplete::UseExtended::set( pUseExtendedTypesChk->IsChecked(), batch );
officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::set( pAutocloseParenChk->IsChecked(), batch );
officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::set( pAutocloseQuotesChk->IsChecked(), batch );
- officecfg::Office::BasicIDE::Autocomplete::AutoCorrectKeywords::set( pAutoCorrectKeywordsChk->IsChecked(), batch );
+ officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::set( pAutoCorrectChk->IsChecked(), batch );
batch->commit();
}
@@ -123,10 +123,10 @@ sal_Bool SvxBasicIDEOptionsPage::FillItemSet( SfxItemSet& /*rCoreSet*/ )
bModified = sal_True;
}
- if( pAutoCorrectKeywordsChk->IsChecked() != pAutoCorrectKeywordsChk->GetSavedValue() )
+ if( pAutoCorrectChk->IsChecked() != pAutoCorrectChk->GetSavedValue() )
{
boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
- officecfg::Office::BasicIDE::Autocomplete::AutoCorrectKeywords::set( pAutoCorrectKeywordsChk->IsChecked(), batch );
+ officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::set( pAutoCorrectChk->IsChecked(), batch );
batch->commit();
bModified = sal_True;
}
@@ -145,7 +145,7 @@ void SvxBasicIDEOptionsPage::Reset( const SfxItemSet& /*rSet*/ )
pAutocloseParenChk->SaveValue();
- pAutoCorrectKeywordsChk->SaveValue();
+ pAutoCorrectChk->SaveValue();
pUseExtendedTypesChk->SaveValue();
}
diff --git a/cui/source/options/optbasic.hxx b/cui/source/options/optbasic.hxx
index 4265f57..2ca4820 100644
--- a/cui/source/options/optbasic.hxx
+++ b/cui/source/options/optbasic.hxx
@@ -31,7 +31,7 @@ private:
CheckBox* pAutocloseProcChk;
CheckBox* pAutocloseParenChk;
CheckBox* pAutocloseQuotesChk;
- CheckBox* pAutoCorrectKeywordsChk;
+ CheckBox* pAutoCorrectChk;
CheckBox* pUseExtendedTypesChk;
void LoadConfig();
diff --git a/cui/uiconfig/ui/optbasicidepage.ui b/cui/uiconfig/ui/optbasicidepage.ui
index 3dde65f..5785ca6 100644
--- a/cui/uiconfig/ui/optbasicidepage.ui
+++ b/cui/uiconfig/ui/optbasicidepage.ui
@@ -126,11 +126,12 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="autocorrect_keywords">
- <property name="label" translatable="yes">Autocorrect Keywords</property>
+ <object class="GtkCheckButton" id="autocorrect">
+ <property name="label" translatable="yes">Autocorrection</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
+ <property name="relief">none</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx
index 543a199..cdeeddf 100644
--- a/include/basic/sbmod.hxx
+++ b/include/basic/sbmod.hxx
@@ -136,6 +136,7 @@ public:
bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject );
void GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache);
SbxArrayRef GetMethods();
+ OUString GetKeywordCase( const OUString& sKeyword ) const;
};
SV_DECL_IMPL_REF(SbModule)
diff --git a/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs b/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs
index 7aecd13..2d8ffc4 100644
--- a/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/BasicIDE.xcs
@@ -56,9 +56,9 @@
</info>
<value>false</value>
</prop>
- <prop oor:name="AutoCorrectKeywords" oor:type="xs:boolean" oor:nillable="false">
+ <prop oor:name="AutoCorrect" oor:type="xs:boolean" oor:nillable="false">
<info>
- <desc>Sets the auto correction of keywords on/off. Default is false.</desc>
+ <desc>Sets the auto correction of keywords, variables, etc. on/off. Default is false.</desc>
</info>
<value>false</value>
</prop>
commit 8a1e19f4ff627d9ac15bbdf7ef04d27158b45569
Author: Gergo Mocsi <gmocsi91 at gmail.com>
Date: Mon Aug 12 13:53:09 2013 +0200
GSOC work, Tool/Options/Basic IDE Options created
Created a new tab in Tools/Options/Basic IDE options instead of the ModalDialog.
The original dialog under Basic IDE/View/IDE Options was removed.
Tab page is disabled when experimetal flag is off, entry node in the treebox is visible.
Change-Id: Iaad1ea5fadc3f05ca81f2240dceb513f25be35b9
diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk
index 9e4b94e..cff14f7 100644
--- a/basctl/Library_basctl.mk
+++ b/basctl/Library_basctl.mk
@@ -90,7 +90,6 @@ $(eval $(call gb_Library_add_exception_objects,basctl,\
basctl/source/basicide/linenumberwindow \
basctl/source/basicide/localizationmgr \
basctl/source/basicide/macrodlg \
- basctl/source/basicide/basicideoptionsdlg \
basctl/source/basicide/moduldl2 \
basctl/source/basicide/moduldlg \
basctl/source/basicide/objdlg \
diff --git a/basctl/UIConfig_basicide.mk b/basctl/UIConfig_basicide.mk
index 4be0d4d..013df6e 100644
--- a/basctl/UIConfig_basicide.mk
+++ b/basctl/UIConfig_basicide.mk
@@ -30,7 +30,6 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/BasicIDE,\
$(eval $(call gb_UIConfig_add_uifiles,modules/BasicIDE,\
basctl/uiconfig/basicide/ui/basicmacrodialog \
- basctl/uiconfig/basicide/ui/basicideoptionsdialog \
))
# vim: set noet sw=4 ts=4:
diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi
index b00b65e..271441c 100644
--- a/basctl/sdi/baside.sdi
+++ b/basctl/sdi/baside.sdi
@@ -36,12 +36,6 @@ shell basctl_Shell
ExecMethod = ExecuteCurrent;
]
- SID_BASICIDE_IDEOPTIONS
- [
- StateMethod = GetState;
- ExecMethod = ExecuteCurrent;
- ]
-
SID_BASICIDE_HIDECURPAGE
[
ExecMethod = ExecuteCurrent;
diff --git a/basctl/source/basicide/basicideoptionsdlg.cxx b/basctl/source/basicide/basicideoptionsdlg.cxx
deleted file mode 100644
index 765cffa..0000000
--- a/basctl/source/basicide/basicideoptionsdlg.cxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "basicideoptionsdlg.hxx"
-#include <basic/codecompletecache.hxx>
-#include <svtools/miscopt.hxx>
-#include <basidesh.hrc>
-#include <iostream>
-#include <officecfg/Office/BasicIDE.hxx>
-#include <boost/shared_ptr.hpp>
-
-namespace basctl
-{
-
-BasicIDEOptionsDlg::BasicIDEOptionsDlg( Window* pWindow )
-: ModalDialog(pWindow, "BasicIDEOptionsDlg", "modules/BasicIDE/ui/basicideoptionsdialog.ui")
-{
- get(pCancelBtn, "cancel");
- get(pOkBtn, "ok");
-
- get(pCodeCompleteChk, "codecomplete_enable");
- get(pAutocloseProcChk, "autoclose_proc");
- get(pAutocloseParenChk, "autoclose_paren");
- get(pAutocloseQuotesChk, "autoclose_quotes");
- get(pAutoCorrectKeywordsChk, "autocorrect_keywords");
- get(pUseExtendedTypesChk, "extendedtypes_enable");
-
- pOkBtn->SetClickHdl( LINK( this, BasicIDEOptionsDlg, OkHdl ) );
- pCancelBtn->SetClickHdl( LINK( this, BasicIDEOptionsDlg, CancelHdl ) );
-
- LoadConfig();
-
-}
-
-BasicIDEOptionsDlg::~BasicIDEOptionsDlg()
-{
-}
-
-IMPL_LINK_NOARG(BasicIDEOptionsDlg, OkHdl)
-{
- CodeCompleteOptions::SetCodeCompleteOn( pCodeCompleteChk->IsChecked() );
- CodeCompleteOptions::SetProcedureAutoCompleteOn( pAutocloseProcChk->IsChecked() );
- CodeCompleteOptions::SetAutoCloseQuotesOn( pAutocloseQuotesChk->IsChecked() );
- CodeCompleteOptions::SetAutoCloseParenthesisOn( pAutocloseParenChk->IsChecked() );
- CodeCompleteOptions::SetAutoCorrectKeywordsOn( pAutoCorrectKeywordsChk->IsChecked() );
- CodeCompleteOptions::SetExtendedTypeDeclaration( pUseExtendedTypesChk->IsChecked() );
-
- SaveConfig();
- Close();
- return 0;
-}
-
-IMPL_LINK_NOARG(BasicIDEOptionsDlg, CancelHdl)
-{
- Close();
- return 0;
-}
-
-short BasicIDEOptionsDlg::Execute()
-{
- return ModalDialog::Execute();
-}
-
-void BasicIDEOptionsDlg::LoadConfig()
-{
- bool bProcClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::get();
- bool bExtended = officecfg::Office::BasicIDE::Autocomplete::UseExtended::get();
- bool bCodeCompleteOn = officecfg::Office::BasicIDE::Autocomplete::CodeComplete::get();
- bool bParenClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get();
- bool bQuoteClose = officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get();
- bool bCorrect = officecfg::Office::BasicIDE::Autocomplete::AutoCorrectKeywords::get();
-
- pCodeCompleteChk->Check( bCodeCompleteOn );
- pAutocloseProcChk->Check( bProcClose );
- pAutocloseQuotesChk->Check( bQuoteClose );
- pAutocloseParenChk->Check( bParenClose );
- pAutoCorrectKeywordsChk->Check( bCorrect );
- pUseExtendedTypesChk->Check( bExtended );
-}
-
-void BasicIDEOptionsDlg::SaveConfig()
-{
- boost::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() );
- officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::set( pAutocloseProcChk->IsChecked(), batch );
- officecfg::Office::BasicIDE::Autocomplete::CodeComplete::set( pCodeCompleteChk->IsChecked(), batch );
- officecfg::Office::BasicIDE::Autocomplete::UseExtended::set( pUseExtendedTypesChk->IsChecked(), batch );
- officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::set( pAutocloseParenChk->IsChecked(), batch );
- officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::set( pAutocloseQuotesChk->IsChecked(), batch );
- officecfg::Office::BasicIDE::Autocomplete::AutoCorrectKeywords::set( pAutoCorrectKeywordsChk->IsChecked(), batch );
- batch->commit();
-}
-
-} // namespace basctl
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index ae17932..667bae5 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -54,7 +54,6 @@
#include <cassert>
#include <basic/codecompletecache.hxx>
#include <svtools/miscopt.hxx>
-#include "basicideoptionsdlg.hxx"
namespace basctl
{
@@ -1012,12 +1011,6 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq)
rLayout.BasicRemoveWatch();
}
break;
- case SID_BASICIDE_IDEOPTIONS:
- {
- boost::scoped_ptr< BasicIDEOptionsDlg > pDlg( new BasicIDEOptionsDlg( this ) );
- pDlg->Execute();
- }
- break;
case SID_CUT:
{
if ( !IsReadOnly() )
@@ -1164,15 +1157,6 @@ void ModulWindow::GetState( SfxItemSet &rSet )
rSet.Put(SfxBoolItem(nWh, bSourceLinesEnabled));
break;
}
- case SID_BASICIDE_IDEOPTIONS:
- {
- SvtMiscOptions aMiscOptions;
- if( !aMiscOptions.IsExperimentalMode() )
- {
- rSet.Put( SfxVisibilityItem(nWh, false) );
- }
- }
- break;
}
}
}
diff --git a/basctl/uiconfig/basicide/menubar/menubar.xml b/basctl/uiconfig/basicide/menubar/menubar.xml
index 34288e2..2c12262 100644
--- a/basctl/uiconfig/basicide/menubar/menubar.xml
+++ b/basctl/uiconfig/basicide/menubar/menubar.xml
@@ -61,7 +61,6 @@
<menu:menuitem menu:id=".uno:StatusBarVisible"/>
<menu:menuitem menu:id=".uno:ShowImeStatusWindow"/>
<menu:menuitem menu:id=".uno:ShowLines"/>
- <menu:menuitem menu:id=".uno:BasicIDEOptionsDialog"/>
<menu:menuitem menu:id=".uno:GotoLine"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:FullScreen"/>
diff --git a/basctl/uiconfig/basicide/ui/basicideoptionsdialog.ui b/basctl/uiconfig/basicide/ui/basicideoptionsdialog.ui
deleted file mode 100644
index e293ccd..0000000
--- a/basctl/uiconfig/basicide/ui/basicideoptionsdialog.ui
+++ /dev/null
@@ -1,279 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <!-- interface-requires gtk+ 3.0 -->
- <object class="GtkDialog" id="BasicIDEOptionsDlg">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">IDE Options</property>
- <property name="resizable">False</property>
- <property name="modal">True</property>
- <property name="type_hint">dialog</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox1">
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkFrame" id="frame3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkBox" id="box2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkCheckButton" id="extendedtypes_enable">
- <property name="label" translatable="yes">Use extended types</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Language Features</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="cancel">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="ok">
- <property name="label">gtk-ok</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <property name="image_position">right</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="box1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <child>
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list