summaryrefslogtreecommitdiff
path: root/basctl/source/basicide/baside2b.cxx
diff options
context:
space:
mode:
authorLaurent Godard <lgodard.libre@laposte.net>2015-02-06 17:51:21 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-02-12 10:49:39 +0000
commitd8a9c74f41355362997c7f8b58942936a4a6d262 (patch)
treeb074acdd26ca227a006ea58c7b7e377ecf2c6390 /basctl/source/basicide/baside2b.cxx
parent0ed14401925d16932ed98bc418d395adac047b39 (diff)
BASIC IDE : add the current procedure name in the status bar
Change-Id: Icecef1748bcc964670b0b95263314d9d8a4555f0 Reviewed-on: https://gerrit.libreoffice.org/14367 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'basctl/source/basicide/baside2b.cxx')
-rw-r--r--basctl/source/basicide/baside2b.cxx78
1 files changed, 50 insertions, 28 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 31721b1c540c..0aadfead07f9 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -428,6 +428,7 @@ void EditorWindow::MouseButtonUp( const MouseEvent &rEvt )
if (SfxBindings* pBindings = GetBindingsPtr())
{
pBindings->Invalidate( SID_BASICIDE_STAT_POS );
+ pBindings->Invalidate( SID_BASICIDE_STAT_TITLE );
}
}
}
@@ -567,8 +568,12 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
if (SfxBindings* pBindings = GetBindingsPtr())
{
pBindings->Invalidate( SID_BASICIDE_STAT_POS );
+ pBindings->Invalidate( SID_BASICIDE_STAT_TITLE );
if ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_CURSOR )
+ {
pBindings->Update( SID_BASICIDE_STAT_POS );
+ pBindings->Update( SID_BASICIDE_STAT_TITLE );
+ }
if ( !bWasModified && pEditEngine->IsModified() )
{
pBindings->Invalidate( SID_SAVEDOC );
@@ -729,42 +734,19 @@ void EditorWindow::HandleAutoCloseDoubleQuotes()
void EditorWindow::HandleProcedureCompletion()
{
+
TextSelection aSel = GetEditView()->GetSelection();
sal_uLong nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) );
- std::vector<HighlightPortion> aPortions;
- aHighlighter.getHighlightPortions( aLine, aPortions );
-
- if( aPortions.empty() )
- return;
-
+ bool bFoundName = false;
OUString sProcType;
OUString sProcName;
- bool bFoundType = false;
- bool bFoundName = false;
-
- for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
- i != aPortions.end(); ++i)
- {
- OUString sTokStr = aLine.copy(i->nBegin, i->nEnd - i->nBegin);
- if( i->tokenType == 9 && ( sTokStr.equalsIgnoreAsciiCase("sub")
- || sTokStr.equalsIgnoreAsciiCase("function")) )
- {
- sProcType = sTokStr;
- bFoundType = true;
- }
- if( i->tokenType == 1 && bFoundType )
- {
- sProcName = sTokStr;
- bFoundName = true;
- break;
- }
- }
+ bFoundName = GetProcedureName(aLine, sProcType, sProcName);
- if( !bFoundType || !bFoundName )
- return;// no sub/function keyword or there is no identifier
+ if (!bFoundName)
+ return;
OUString sText("\nEnd ");
aSel = GetEditView()->GetSelection();
@@ -807,6 +789,43 @@ void EditorWindow::HandleProcedureCompletion()
}
}
+bool EditorWindow::GetProcedureName(OUString& rLine, OUString& rProcType, OUString& rProcName)
+{
+ std::vector<HighlightPortion> aPortions;
+ aHighlighter.getHighlightPortions(rLine, aPortions);
+
+ if( aPortions.empty() )
+ return false;
+
+ bool bFoundType = false;
+ bool bFoundName = false;
+
+ for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
+ i != aPortions.end(); ++i)
+ {
+ OUString sTokStr = rLine.copy(i->nBegin, i->nEnd - i->nBegin);
+
+ if( i->tokenType == 9 && ( sTokStr.equalsIgnoreAsciiCase("sub")
+ || sTokStr.equalsIgnoreAsciiCase("function")) )
+ {
+ rProcType = sTokStr;
+ bFoundType = true;
+ }
+ if( i->tokenType == 1 && bFoundType )
+ {
+ rProcName = sTokStr;
+ bFoundName = true;
+ break;
+ }
+ }
+
+ if( !bFoundType || !bFoundName )
+ return false;// no sub/function keyword or there is no identifier
+
+ return true;
+
+}
+
void EditorWindow::HandleCodeCompletion()
{
rModulWindow.UpdateModule();
@@ -1003,7 +1022,10 @@ void EditorWindow::CreateEditEngine()
InitScrollBars();
if (SfxBindings* pBindings = GetBindingsPtr())
+ {
pBindings->Invalidate( SID_BASICIDE_STAT_POS );
+ pBindings->Invalidate( SID_BASICIDE_STAT_TITLE );
+ }
DBG_ASSERT( rModulWindow.GetBreakPointWindow().GetCurYOffset() == 0, "CreateEditEngine: Brechpunkte verschoben?" );