Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_BASIC_CODECOMPLETECACHE_HXX
21 : #define INCLUDED_BASIC_CODECOMPLETECACHE_HXX
22 :
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>
29 : #include <vector>
30 :
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 */
35 :
36 0 : class BASIC_DLLPUBLIC CodeCompleteOptions
37 : {
38 : /*
39 : * class to store basic code completion
40 : * options
41 : * */
42 : private:
43 : bool bIsCodeCompleteOn;
44 : bool bIsProcedureAutoCompleteOn;
45 : bool bIsAutoCloseQuotesOn;
46 : bool bIsAutoCloseParenthesisOn;
47 : bool bIsAutoCorrectOn;
48 : bool bExtendedTypeDeclarationOn;
49 : SvtMiscOptions aMiscOptions;
50 :
51 : public:
52 : CodeCompleteOptions();
53 :
54 : static bool IsCodeCompleteOn();
55 : static void SetCodeCompleteOn( const bool& b );
56 :
57 : static bool IsExtendedTypeDeclaration();
58 : static void SetExtendedTypeDeclaration( const bool& b );
59 :
60 : static bool IsProcedureAutoCompleteOn();
61 : static void SetProcedureAutoCompleteOn( const bool& b );
62 :
63 : static bool IsAutoCloseQuotesOn();
64 : static void SetAutoCloseQuotesOn( const bool& b );
65 :
66 : static bool IsAutoCloseParenthesisOn();
67 : static void SetAutoCloseParenthesisOn( const bool& b );
68 :
69 : static bool IsAutoCorrectOn();
70 : static void SetAutoCorrectOn( const bool& b );
71 : };
72 :
73 : class BASIC_DLLPUBLIC CodeCompleteDataCache
74 : {
75 : /*
76 : * cache to store data for
77 : * code completion
78 : * */
79 : private:
80 : CodeCompleteVarScopes aVarScopes;
81 : CodeCompleteVarTypes aGlobalVars;
82 :
83 : public:
84 0 : CodeCompleteDataCache(){}
85 0 : virtual ~CodeCompleteDataCache(){}
86 :
87 : friend BASIC_DLLPUBLIC std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache);
88 :
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;
93 : void Clear();
94 : };
95 :
96 : #endif // INCLUDED_BASIC_CODECOMPLETECACHE_HXX
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|