22#include <officecfg/Office/BasicIDE.hxx>
23#include <officecfg/Office/Common.hxx>
36 bIsAutoCorrectOn = officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::get();
40 bIsCodeCompleteOn = officecfg::Office::BasicIDE::Autocomplete::CodeComplete::get();
46 return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bIsCodeCompleteOn;
51 theCodeCompleteOptions().bIsCodeCompleteOn = b;
56 return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bExtendedTypeDeclarationOn;
61 theCodeCompleteOptions().bExtendedTypeDeclarationOn = b;
66 return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bIsProcedureAutoCompleteOn;
71 theCodeCompleteOptions().bIsProcedureAutoCompleteOn = b;
76 return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bIsAutoCloseQuotesOn;
81 theCodeCompleteOptions().bIsAutoCloseQuotesOn = b;
86 return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bIsAutoCloseParenthesisOn;
91 theCodeCompleteOptions().bIsAutoCloseParenthesisOn = b;
96 return officecfg::Office::Common::Misc::ExperimentalMode::get() && theCodeCompleteOptions().bIsAutoCorrectOn;
101 theCodeCompleteOptions().bIsAutoCorrectOn = b;
104std::ostream&
operator<< (std::ostream& aStream,
const CodeCompleteDataCache& aCache)
106 aStream <<
"Global variables" << std::endl;
107 for (
auto const& globalVar : aCache.aGlobalVars)
109 aStream << globalVar.first <<
"," << globalVar.second << std::endl;
111 aStream <<
"Local variables" << std::endl;
112 for (
auto const& varScope : aCache.aVarScopes)
114 aStream << varScope.first << std::endl;
116 for (
auto const& varType : aVarTypes)
118 aStream <<
"\t" << varType.first <<
"," << varType.second << std::endl;
121 aStream <<
"-----------------" << std::endl;
125void CodeCompleteDataCache::Clear()
131void CodeCompleteDataCache::InsertGlobalVar(
const OUString& sVarName,
const OUString& sVarType )
133 aGlobalVars.emplace( sVarName, sVarType );
136void CodeCompleteDataCache::InsertLocalVar(
const OUString& sProcName,
const OUString& sVarName,
const OUString& sVarType )
138 CodeCompleteVarScopes::const_iterator aIt = aVarScopes.find( sProcName );
139 if( aIt == aVarScopes.end() )
142 aTypes.emplace( sVarName, sVarType );
143 aVarScopes.emplace( sProcName, aTypes );
148 aTypes.emplace( sVarName, sVarType );
149 aVarScopes[ sProcName ] =
aTypes;
153OUString CodeCompleteDataCache::GetVarType( std::u16string_view sVarName )
const
155 for (
auto const& varScope : aVarScopes)
158 for (
auto const& elem : aTypes)
160 if( elem.first.equalsIgnoreAsciiCase( sVarName ) )
167 for (
auto const& globalVar : aGlobalVars)
169 if( globalVar.first.equalsIgnoreAsciiCase( sVarName ) )
170 return globalVar.second;
175OUString CodeCompleteDataCache::GetCorrectCaseVarName( std::u16string_view sVarName, std::u16string_view sActProcName )
const
177 for (
auto const& varScope : aVarScopes)
180 for (
auto const& elem : aTypes)
182 if( elem.first.equalsIgnoreAsciiCase( sVarName ) && varScope.first.equalsIgnoreAsciiCase( sActProcName ) )
189 for (
auto const& globalVar : aGlobalVars)
191 if( globalVar.first.equalsIgnoreAsciiCase( sVarName ) )
192 return globalVar.first;
static bool IsExtendedTypeDeclaration()
static void SetAutoCloseQuotesOn(bool b)
static void SetAutoCloseParenthesisOn(bool b)
bool bIsAutoCloseParenthesisOn
static void SetProcedureAutoCompleteOn(bool b)
static bool IsAutoCloseParenthesisOn()
bool bExtendedTypeDeclarationOn
static bool IsAutoCorrectOn()
bool bIsAutoCloseQuotesOn
static void SetAutoCorrectOn(bool b)
static bool IsProcedureAutoCompleteOn()
static void SetCodeCompleteOn(bool b)
static bool IsCodeCompleteOn()
bool bIsProcedureAutoCompleteOn
static void SetExtendedTypeDeclaration(bool b)
static bool IsAutoCloseQuotesOn()
std::ostream & operator<<(std::ostream &aStream, const CodeCompleteDataCache &aCache)
std::unordered_map< OUString, OUString > CodeCompleteVarTypes