summaryrefslogtreecommitdiff
path: root/sw/source/core/crsr/bookmrk.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/crsr/bookmrk.cxx')
-rw-r--r--sw/source/core/crsr/bookmrk.cxx76
1 files changed, 37 insertions, 39 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 4a4aad532aaa..9d184f37daa1 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -652,7 +652,7 @@ namespace sw { namespace mark
}
}
- void DropDownFieldmark::SendLOKMessage(SfxViewShell* pViewShell, const OString& sAction)
+ void DropDownFieldmark::SendLOKShowMessage(SfxViewShell* pViewShell)
{
if (!comphelper::LibreOfficeKit::isActive())
return;
@@ -660,49 +660,47 @@ namespace sw { namespace mark
if (!pViewShell || pViewShell->isLOKMobilePhone())
return;
- OStringBuffer sPayload;
- if (sAction == "show")
- {
- if (m_aPortionPaintArea.IsEmpty())
- return;
-
- sPayload = OStringLiteral("{\"action\": \"show\","
- " \"type\": \"drop-down\", \"textArea\": \"") +
- 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 : std::as_const(vListEntries))
- sPayload.append("\"" + OUStringToOString(sItem, RTL_TEXTENCODING_UTF8) + "\", ");
- sPayload.setLength(sPayload.getLength() - 2);
- }
- sPayload.append("], ");
+ if (m_aPortionPaintArea.IsEmpty())
+ return;
- // Selected item
- OUString sResultKey = ODF_FORMDROPDOWN_RESULT;
- auto pSelectedItemIter = pParameters->find(sResultKey);
- sal_Int32 nSelection = -1;
- if (pSelectedItemIter != pParameters->end())
- {
- pSelectedItemIter->second >>= nSelection;
- }
- sPayload.append("\"selected\": \"" + OString::number(nSelection) + "\", ");
+ OStringBuffer sPayload;
+ sPayload = OStringLiteral("{\"action\": \"show\","
+ " \"type\": \"drop-down\", \"textArea\": \"") +
+ m_aPortionPaintArea.SVRect().toString() + "\",";
+ // Add field params to the message
+ sPayload.append(" \"params\": { \"items\": [");
- // Placeholder text
- sPayload.append("\"placeholderText\": \"" + OUStringToOString(SwResId(STR_DROP_DOWN_EMPTY_LIST), RTL_TEXTENCODING_UTF8) + "\"}}");
+ // 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 : std::as_const(vListEntries))
+ sPayload.append("\"" + OUStringToOString(sItem, RTL_TEXTENCODING_UTF8) + "\", ");
+ sPayload.setLength(sPayload.getLength() - 2);
}
- else
+ sPayload.append("], ");
+
+ // Selected item
+ OUString sResultKey = ODF_FORMDROPDOWN_RESULT;
+ auto pSelectedItemIter = pParameters->find(sResultKey);
+ sal_Int32 nSelection = -1;
+ if (pSelectedItemIter != pParameters->end())
{
- assert(sAction == "hide");
- sPayload = "{\"action\": \"hide\", \"type\": \"drop-down\"}";
+ pSelectedItemIter->second >>= nSelection;
}
+ sPayload.append("\"selected\": \"" + OString::number(nSelection) + "\", ");
+
+ // Placeholder text
+ sPayload.append("\"placeholderText\": \"" + OUStringToOString(SwResId(STR_DROP_DOWN_EMPTY_LIST), RTL_TEXTENCODING_UTF8) + "\"}}");
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_FORM_FIELD_BUTTON, sPayload.toString().getStr());
+ }
+
+ void DropDownFieldmark::SendLOKHideMessage(SfxViewShell* pViewShell)
+ {
+ OStringBuffer sPayload = "{\"action\": \"hide\", \"type\": \"drop-down\"}";
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_FORM_FIELD_BUTTON, sPayload.toString().getStr());
}