[Libreoffice-commits] core.git: Branch 'feature/gsoc-basic-ide-completion-and-other-bits' - basctl/source cui/source
Gergo Mocsi
gmocsi91 at gmail.com
Mon Aug 19 08:38:40 PDT 2013
basctl/source/basicide/baside2b.cxx | 13 ++++++++-----
cui/source/options/optbasic.cxx | 25 +++++++++++++------------
2 files changed, 21 insertions(+), 17 deletions(-)
New commits:
commit 54704aea436c6dc43a17c8aec5d102cc9652b220
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 2e06232..7d67327 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -788,11 +788,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;
}
More information about the Libreoffice-commits
mailing list