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/basicdllapi.h>
24 #include <rtl/ustring.hxx>
25 #include <svtools/miscopt.hxx>
26 #include <unordered_map>
28 typedef std::unordered_map
< OUString
, OUString
> CodeCompleteVarTypes
;
29 /* variable name, type */
30 typedef std::unordered_map
< OUString
, CodeCompleteVarTypes
> CodeCompleteVarScopes
;
31 /* procedure, CodeCompleteVarTypes */
33 class BASIC_DLLPUBLIC CodeCompleteOptions
36 * class to store basic code completion
40 bool bIsCodeCompleteOn
;
41 bool bIsProcedureAutoCompleteOn
;
42 bool bIsAutoCloseQuotesOn
;
43 bool bIsAutoCloseParenthesisOn
;
44 bool bIsAutoCorrectOn
;
45 bool bExtendedTypeDeclarationOn
;
46 SvtMiscOptions aMiscOptions
;
49 CodeCompleteOptions();
51 static bool IsCodeCompleteOn();
52 static void SetCodeCompleteOn( bool b
);
54 static bool IsExtendedTypeDeclaration();
55 static void SetExtendedTypeDeclaration( bool b
);
57 static bool IsProcedureAutoCompleteOn();
58 static void SetProcedureAutoCompleteOn( bool b
);
60 static bool IsAutoCloseQuotesOn();
61 static void SetAutoCloseQuotesOn( bool b
);
63 static bool IsAutoCloseParenthesisOn();
64 static void SetAutoCloseParenthesisOn( bool b
);
66 static bool IsAutoCorrectOn();
67 static void SetAutoCorrectOn( bool b
);
70 class BASIC_DLLPUBLIC CodeCompleteDataCache final
73 * cache to store data for
77 CodeCompleteVarScopes aVarScopes
;
78 CodeCompleteVarTypes aGlobalVars
;
81 CodeCompleteDataCache(){}
83 friend BASIC_DLLPUBLIC
std::ostream
& operator<< (std::ostream
& aStream
, const CodeCompleteDataCache
& aCache
);
85 void InsertGlobalVar( const OUString
& sVarName
, const OUString
& sVarType
);
86 void InsertLocalVar( const OUString
& sProcName
, const OUString
& sVarName
, const OUString
& sVarType
);
87 OUString
GetVarType( const OUString
& sVarName
) const;
88 OUString
GetCorrectCaseVarName( const OUString
& sVarName
, const OUString
& sActProcName
) const;
92 #endif // INCLUDED_BASIC_CODECOMPLETECACHE_HXX
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */