summaryrefslogtreecommitdiff
path: root/kit
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2019-11-27 22:56:50 +0100
committerMarco Cecchetti <marco.cecchetti@collabora.com>2019-12-02 17:34:13 +0100
commit836ce7d636e8a2d0fec1e9c9801c3125df1c5d65 (patch)
tree50ae9ee0c42dd4fcef57175362b29a03c47c4c80 /kit
parentfe04d685dbed3048c74a7ffdc0cb84d6e6824162 (diff)
formula bar: function complete
lok clients can request to complete a function name partially typed in the formula input box. Change-Id: If8e4485c5ed9f91a594dfcec04e0c0b10becdcd0 Reviewed-on: https://gerrit.libreoffice.org/83985 Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com> Tested-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Diffstat (limited to 'kit')
-rw-r--r--kit/ChildSession.cpp24
-rw-r--r--kit/ChildSession.hpp1
2 files changed, 24 insertions, 1 deletions
diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp
index d07125a5c..7e8c1f70c 100644
--- a/kit/ChildSession.cpp
+++ b/kit/ChildSession.cpp
@@ -296,7 +296,8 @@ bool ChildSession::_handleInput(const char *buffer, int length)
tokens[0] == "exportsignanduploaddocument" ||
tokens[0] == "rendershapeselection" ||
tokens[0] == "removetextcontext" ||
- tokens[0] == "dialogevent");
+ tokens[0] == "dialogevent" ||
+ tokens[0] == "completefunction");
if (tokens[0] == "clientzoom")
{
@@ -432,6 +433,10 @@ bool ChildSession::_handleInput(const char *buffer, int length)
{
return dialogEvent(buffer, length, tokens);
}
+ else if (tokens[0] == "completefunction")
+ {
+ return completeFunction(buffer, length, tokens);
+ }
else
{
assert(false && "Unknown command token.");
@@ -1405,6 +1410,23 @@ bool ChildSession::dialogEvent(const char* /*buffer*/, int /*length*/, const std
return true;
}
+bool ChildSession::completeFunction(const char* /*buffer*/, int /*length*/, const std::vector<std::string>& tokens)
+{
+ int index;
+
+ if (tokens.size() != 2 ||
+ !getTokenInteger(tokens[1], "index", index))
+ {
+ sendTextFrame("error: cmd=completefunction kind=syntax");
+ return false;
+ }
+
+ getLOKitDocument()->setView(_viewId);
+
+ getLOKitDocument()->completeFunction(index);
+ return true;
+}
+
bool ChildSession::unoCommand(const char* /*buffer*/, int /*length*/, const std::vector<std::string>& tokens)
{
if (tokens.size() <= 1)
diff --git a/kit/ChildSession.hpp b/kit/ChildSession.hpp
index 88e445671..8404bcddc 100644
--- a/kit/ChildSession.hpp
+++ b/kit/ChildSession.hpp
@@ -262,6 +262,7 @@ private:
bool mouseEvent(const char* buffer, int length, const std::vector<std::string>& tokens, const LokEventTargetEnum target);
bool gestureEvent(const char* buffer, int length, const std::vector<std::string>& tokens);
bool dialogEvent(const char* buffer, int length, const std::vector<std::string>& tokens);
+ bool completeFunction(const char* buffer, int length, const std::vector<std::string>& tokens);
bool unoCommand(const char* buffer, int length, const std::vector<std::string>& tokens);
bool selectText(const char* buffer, int length, const std::vector<std::string>& tokens);
bool selectGraphic(const char* buffer, int length, const std::vector<std::string>& tokens);