summaryrefslogtreecommitdiff
path: root/vcl/jsdialog/executor.cxx
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2023-03-03 17:01:55 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2023-03-21 07:18:00 +0000
commit7e58604211085caffbbf5dfeefa29385f3267a01 (patch)
tree242b10e0b367d2a9561e742676a3371afcf13d7c /vcl/jsdialog/executor.cxx
parent95e41f4a34262661e90736d9c50fb9ca683d5238 (diff)
jsdialog: textselection action for text view
Change-Id: I11e41b5be897c4341ed0e2baf9fc6772ad0163b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148247 Tested-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149159
Diffstat (limited to 'vcl/jsdialog/executor.cxx')
-rw-r--r--vcl/jsdialog/executor.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 313661557893..5598afa8ba19 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -370,6 +370,28 @@ bool ExecuteAction(const std::string& nWindowId, const OString& rWidget, StringM
LOKTrigger::trigger_changed(*pTextView);
return true;
}
+ else if (sAction == "textselection")
+ {
+ // start;end
+ OUString sTextData = rData["data"];
+ int nSeparatorPos = sTextData.indexOf(';');
+ if (nSeparatorPos <= 0)
+ return true;
+
+ std::u16string_view aStartPos = sTextData.subView(0, nSeparatorPos);
+ std::u16string_view aEndPos = sTextData.subView(nSeparatorPos + 1);
+
+ if (aStartPos.empty() || aEndPos.empty())
+ return true;
+
+ sal_Int32 nStart = o3tl::toInt32(aStartPos);
+ sal_Int32 nEnd = o3tl::toInt32(aEndPos);
+
+ pTextView->select_region(nStart, nEnd);
+ LOKTrigger::trigger_changed(*pTextView);
+
+ return true;
+ }
}
}
else if (sControlType == "treeview")