summaryrefslogtreecommitdiff
path: root/include/basic
diff options
context:
space:
mode:
authorGergo Mocsi <gmocsi91@gmail.com>2013-07-25 19:12:37 +0200
committerGergo Mocsi <gmocsi91@gmail.com>2013-09-02 18:16:49 +0200
commit9a7b942a0a3bb113cf356f2642766f7a9f909bd6 (patch)
treeddc5cfca7dbd2fedaa03d2bc620ba6e75aac9496 /include/basic
parentd5aa9c3b23f6c9b5ff0b6af11ff6d6827c5f24bd (diff)
GSOC work, procedure autoclose implementation
Now, function procedure autoclose is working. Created a struct named IncompleteProcData to store the line number, type and name of the inclomplete procedure. Procedures are store in a vector (IncompleteProcedures), and are as a member in SbModule. I've created a function called SbModule::GetIncompleteProcedures() to extract the data. Data extraction uses SbModule::SetSource32, beacuse that one tokenizes sthe source file, and recognizes procedures. Closing procedures is triggered ky pressing the Enter key when typing. It checks the actual sub, and if it's incomplete, adds the correct ending( End Sub/End Function). There is only one problem: function SbModule::SetSource32 is not too often calle, maybe extraction should be done by a timer. Change-Id: Id88daaef329e8b5c194b765c5261d356bfb3a0c9
Diffstat (limited to 'include/basic')
-rw-r--r--include/basic/codecompletecache.hxx16
-rw-r--r--include/basic/sbmod.hxx20
2 files changed, 17 insertions, 19 deletions
diff --git a/include/basic/codecompletecache.hxx b/include/basic/codecompletecache.hxx
index 480c3c1dcf4c..e03c0576fdb7 100644
--- a/include/basic/codecompletecache.hxx
+++ b/include/basic/codecompletecache.hxx
@@ -27,12 +27,26 @@
#include <boost/unordered_map.hpp>
#include <rtl/ustring.hxx>
#include <svtools/miscopt.hxx>
+#include <vector>
+
+enum BASIC_DLLPUBLIC AutocompleteType
+{
+ ACSUB,
+ ACFUNC
+};
+
+struct IncompleteProcData
+{
+ OUString sProcName;
+ sal_uInt16 nLine;
+ AutocompleteType aType;
+};
typedef boost::unordered_map< OUString, OUString, OUStringHash > CodeCompleteVarTypes;
/* variable name, type */
typedef boost::unordered_map< OUString, CodeCompleteVarTypes, OUStringHash > CodeCompleteVarScopes;
/* procedure, CodeCompleteVarTypes */
-
+typedef std::vector< IncompleteProcData > IncompleteProcedures;
class BASIC_DLLPUBLIC CodeCompleteOptions
{
diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx
index b3e694bf624c..dbf3e69fb115 100644
--- a/include/basic/sbmod.hxx
+++ b/include/basic/sbmod.hxx
@@ -45,24 +45,6 @@ class ModuleInitDependencyMap;
struct ClassModuleRunInitItem;
struct SbClassData;
-/*
-struct CodeCompleteData
-{
- OUString sVarName;
- OUString sVarParent;
- OUString sVarType;
-
- inline bool operator==( const CodeCompleteData& aOther )
- {
- return (sVarName == aOther.sVarName && sVarParent == aOther.sVarParent);
- }
-
- inline bool IsGlobal() const
- {
- return ( sVarParent == OUString("") );
- }
-};*/
-
class BASIC_DLLPUBLIC SbModule : public SbxObject, private ::boost::noncopyable
{
friend class SbiCodeGen;
@@ -74,6 +56,7 @@ class BASIC_DLLPUBLIC SbModule : public SbxObject, private ::boost::noncopyable
std::vector< OUString > mModuleVariableNames;
BASIC_DLLPRIVATE void implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic );
+ IncompleteProcedures aIncompleteProcs;
protected:
com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
@@ -155,6 +138,7 @@ public:
//CodeCompleteDataCache GetCodeCompleteDataFromParse();
void GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache);
SbxArrayRef GetMethods();
+ IncompleteProcedures GetIncompleteProcedures() const;
};
SV_DECL_IMPL_REF(SbModule)