summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2020-05-05 14:36:16 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2020-05-09 09:36:15 +0200
commitb4bfb45031b3df61e02cafefc7c1e6e7c68bd28a (patch)
tree678ce55ab5e4ee6fe8de1223e1a7190d34c06b44 /sw/source
parent31c2fd5059d6c73ee46ecbbe94bd7578de4ca1a1 (diff)
lok: MSForms: Send also the drop down field params to the client code.
Change-Id: Id42f428b7944d97d1b61a5b60d6e0807cb51cc95
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/crsr/bookmrk.cxx32
1 files changed, 29 insertions, 3 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 0aaa78493e7b..2f8a9e96b183 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -47,6 +47,7 @@
#include <view.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <wrtsh.hxx>
+#include <rtl/strbuf.hxx>
using namespace ::sw::mark;
using namespace ::com::sun::star;
@@ -579,18 +580,43 @@ namespace sw { namespace mark
if (!pEditWin)
return;
- OString sPayload;
+ OStringBuffer sPayload;
if (sAction == "show")
{
sPayload = OStringLiteral("{\"action\": \"show\","
" \"type\": \"drop-down\", \"textArea\": \"") +
- m_aPortionPaintArea.SVRect().toString() + "\"}";
+ m_aPortionPaintArea.SVRect().toString() + "\",";
+ // Add field params to the message
+ sPayload.append(" \"params\": { \"items\": [");
+
+ // List items
+ auto pParameters = this->GetParameters();
+ auto pListEntriesIter = pParameters->find(ODF_FORMDROPDOWN_LISTENTRY);
+ css::uno::Sequence<OUString> vListEntries;
+ if (pListEntriesIter != pParameters->end())
+ {
+ pListEntriesIter->second >>= vListEntries;
+ for (const OUString& sItem : vListEntries)
+ sPayload.append("\"" + OUStringToOString(sItem, RTL_TEXTENCODING_UTF8) + "\", ");
+ sPayload.setLength(sPayload.getLength() - 2);
+ }
+ sPayload.append("], ");
+
+ // Selected item
+ OUString sResultKey = ODF_FORMDROPDOWN_RESULT;
+ auto pSelectedItemIter = pParameters->find(sResultKey);
+ if (pSelectedItemIter != pParameters->end())
+ {
+ sal_Int32 nSelection = -1;
+ pSelectedItemIter->second >>= nSelection;
+ sPayload.append("\"selected\": \"" + OString::number(nSelection) + "\"}}");
+ }
}
else
{
sPayload = "{\"action\": \"hide\", \"type\": \"drop-down\"}";
}
- pEditWin->GetView().GetWrtShell().GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_FORM_FIELD_BUTTON, sPayload.getStr());
+ pEditWin->GetView().GetWrtShell().GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_FORM_FIELD_BUTTON, sPayload.toString().getStr());
}
}