use the more efficient getSelectionTypeAndText()
Otherwise calling getSelectionType() first and then getTextSelection() creates the XTransferable2 twice, and then possibly converts it to the text format twice, which may be expensive. Also some cypress tests use selectEntireSheet() and then check the clipboard contents, which with the switch to 16k columns in Calc may be slow enough in debug builds when done twice to time out the test, and this helps a bit there. Signed-off-by: Luboš Luňák <l.lunak@centrum.cz> Change-Id: If166f67c216281d32dbb1d3e10b51177b42a9668
This commit is contained in:
parent
154a177979
commit
f84e758ebc
1 changed files with 5 additions and 4 deletions
|
@ -1142,11 +1142,12 @@ bool ChildSession::getTextSelection(const StringVector& tokens)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string selection;
|
|
||||||
getLOKitDocument()->setView(_viewId);
|
getLOKitDocument()->setView(_viewId);
|
||||||
const int selectionType = getLOKitDocument()->getSelectionType();
|
char* textSelection = nullptr;
|
||||||
if (selectionType == LOK_SELTYPE_LARGE_TEXT || selectionType == LOK_SELTYPE_COMPLEX ||
|
const int selectionType = getLOKitDocument()->getSelectionTypeAndText(mimeType.c_str(), &textSelection);
|
||||||
(selection = getTextSelectionInternal(mimeType)).size() >= 1024 * 1024) // Don't return huge data.
|
std::string selection(textSelection ? textSelection : "");
|
||||||
|
free(textSelection);
|
||||||
|
if (selectionType == LOK_SELTYPE_LARGE_TEXT || selectionType == LOK_SELTYPE_COMPLEX)
|
||||||
{
|
{
|
||||||
// Flag complex data so the client will download async.
|
// Flag complex data so the client will download async.
|
||||||
sendTextFrame("complexselection:");
|
sendTextFrame("complexselection:");
|
||||||
|
|
Loading…
Reference in a new issue