summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGergo Mocsi <gmocsi91@gmail.com>2013-08-19 17:28:52 +0200
committerGergo Mocsi <gmocsi91@gmail.com>2013-08-19 17:28:52 +0200
commit54704aea436c6dc43a17c8aec5d102cc9652b220 (patch)
tree31545241cebdb0b53d87db50d67ac0e147a7e58a
parentefb6b286d6a3d879533420d57dd80ced590c055b (diff)
GSOC work, options fix
Tools/Options are now saving correctly. I've added a check for empty string in EditorWindow::HandleCodeCompletition. Change-Id: Ib5d75fe840e3c3fd12cd7175fb7828b8a1d76db6
-rw-r--r--basctl/source/basicide/baside2b.cxx13
-rw-r--r--cui/source/options/optbasic.cxx25
2 files changed, 21 insertions, 17 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 2e062320476b..7d67327b4d93 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 21026b302782..88ccc6d81e11 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;
}