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 <boost/utility.hpp>
27 : #include <boost/unordered_map.hpp>
28 : #include <rtl/ustring.hxx>
29 : #include <svtools/miscopt.hxx>
30 : #include <vector>
31 :
32 : typedef boost::unordered_map< OUString, OUString, OUStringHash > CodeCompleteVarTypes;
33 : /* variable name, type */
34 : typedef boost::unordered_map< OUString, CodeCompleteVarTypes, OUStringHash > CodeCompleteVarScopes;
35 : /* procedure, CodeCompleteVarTypes */
36 :
37 0 : class BASIC_DLLPUBLIC CodeCompleteOptions
38 : {
39 : /*
40 : * class to store basic code completion
41 : * options
42 : * */
43 : private:
44 : bool bIsCodeCompleteOn;
45 : bool bIsProcedureAutoCompleteOn;
46 : bool bIsAutoCloseQuotesOn;
47 : bool bIsAutoCloseParenthesisOn;
48 : bool bIsAutoCorrectOn;
49 : bool bExtendedTypeDeclarationOn;
50 : SvtMiscOptions aMiscOptions;
51 :
52 : public:
53 : CodeCompleteOptions();
54 :
55 : static bool IsCodeCompleteOn();
56 : static void SetCodeCompleteOn( const bool& b );
57 :
58 : static bool IsExtendedTypeDeclaration();
59 : static void SetExtendedTypeDeclaration( const bool& b );
60 :
61 : static bool IsProcedureAutoCompleteOn();
62 : static void SetProcedureAutoCompleteOn( const bool& b );
63 :
64 : static bool IsAutoCloseQuotesOn();
65 : static void SetAutoCloseQuotesOn( const bool& b );
66 :
67 : static bool IsAutoCloseParenthesisOn();
68 : static void SetAutoCloseParenthesisOn( const bool& b );
69 :
70 : static bool IsAutoCorrectOn();
71 : static void SetAutoCorrectOn( const bool& b );
72 : };
73 :
74 : class BASIC_DLLPUBLIC CodeCompleteDataCache
75 : {
76 : /*
77 : * cache to store data for
78 : * code completion
79 : * */
80 : private:
81 : CodeCompleteVarScopes aVarScopes;
82 : CodeCompleteVarTypes aGlobalVars;
83 :
84 : public:
85 0 : CodeCompleteDataCache(){}
86 0 : virtual ~CodeCompleteDataCache(){}
87 :
88 : friend BASIC_DLLPUBLIC std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache);
89 :
90 : void InsertGlobalVar( const OUString& sVarName, const OUString& sVarType );
91 : void InsertLocalVar( const OUString& sProcName, const OUString& sVarName, const OUString& sVarType );
92 : OUString GetVarType( const OUString& sVarName ) const;
93 : OUString GetCorrectCaseVarName( const OUString& sVarName, const OUString& sActProcName ) const;
94 : void Clear();
95 : };
96 :
97 : #endif // INCLUDED_BASIC_CODECOMPLETECACHE_HXX
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|