1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_BASIC_CODECOMPLETECACHE_HXX
21 #define INCLUDED_BASIC_CODECOMPLETECACHE_HXX
23 #include <basic/sbdef.hxx>
24 #include <basic/sbxobj.hxx>
25 #include <basic/sbxdef.hxx>
26 #include <rtl/ustring.hxx>
27 #include <svtools/miscopt.hxx>
28 #include <unordered_map>
31 typedef std::unordered_map
< OUString
, OUString
, OUStringHash
> CodeCompleteVarTypes
;
32 /* variable name, type */
33 typedef std::unordered_map
< OUString
, CodeCompleteVarTypes
, OUStringHash
> CodeCompleteVarScopes
;
34 /* procedure, CodeCompleteVarTypes */
36 class BASIC_DLLPUBLIC CodeCompleteOptions
39 * class to store basic code completion
43 bool bIsCodeCompleteOn
;
44 bool bIsProcedureAutoCompleteOn
;
45 bool bIsAutoCloseQuotesOn
;
46 bool bIsAutoCloseParenthesisOn
;
47 bool bIsAutoCorrectOn
;
48 bool bExtendedTypeDeclarationOn
;
49 SvtMiscOptions aMiscOptions
;
52 CodeCompleteOptions();
54 static bool IsCodeCompleteOn();
55 static void SetCodeCompleteOn( const bool& b
);
57 static bool IsExtendedTypeDeclaration();
58 static void SetExtendedTypeDeclaration( const bool& b
);
60 static bool IsProcedureAutoCompleteOn();
61 static void SetProcedureAutoCompleteOn( const bool& b
);
63 static bool IsAutoCloseQuotesOn();
64 static void SetAutoCloseQuotesOn( const bool& b
);
66 static bool IsAutoCloseParenthesisOn();
67 static void SetAutoCloseParenthesisOn( const bool& b
);
69 static bool IsAutoCorrectOn();
70 static void SetAutoCorrectOn( const bool& b
);
73 class BASIC_DLLPUBLIC CodeCompleteDataCache
76 * cache to store data for
80 CodeCompleteVarScopes aVarScopes
;
81 CodeCompleteVarTypes aGlobalVars
;
84 CodeCompleteDataCache(){}
85 virtual ~CodeCompleteDataCache(){}
87 friend BASIC_DLLPUBLIC
std::ostream
& operator<< (std::ostream
& aStream
, const CodeCompleteDataCache
& aCache
);
89 void InsertGlobalVar( const OUString
& sVarName
, const OUString
& sVarType
);
90 void InsertLocalVar( const OUString
& sProcName
, const OUString
& sVarName
, const OUString
& sVarType
);
91 OUString
GetVarType( const OUString
& sVarName
) const;
92 OUString
GetCorrectCaseVarName( const OUString
& sVarName
, const OUString
& sActProcName
) const;
96 #endif // INCLUDED_BASIC_CODECOMPLETECACHE_HXX
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */