diff options
author | Andrzej Hunt <andrzej@ahunt.org> | 2015-11-04 17:24:15 +0100 |
---|---|---|
committer | Andrzej Hunt <andrzej@ahunt.org> | 2015-11-05 12:59:00 +0100 |
commit | 2bcaffd12263e8f3c2a2fbf8ccc4b9bba2642146 (patch) | |
tree | 119105313d79c52efc488fd4c8de2ef04fcadd89 /desktop | |
parent | f859dac52e40759fb8202d891df4e1442bc35803 (diff) |
sc lok: tdf#94605 introduce uno:CellCursor
This allows the client to rerequest the current cursor position,
which is necessary e.g. on zoom-level changes.
Conflicts:
desktop/source/lib/init.cxx
sc/inc/docuno.hxx
Change-Id: I10d81e220a56a36e2ec0c59005cd1d4f134857d5
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index bcc215be170c..f45445c6364c 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -32,6 +32,7 @@ #include <comphelper/dispatchcommand.hxx> #include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -1209,6 +1210,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo { OString aCommand(pCommand); static const OString aViewRowColumnHeaders(".uno:ViewRowColumnHeaders"); + static const OString aCellCursor(".uno:CellCursor"); if (!strcmp(pCommand, ".uno:CharFontName")) { @@ -1267,6 +1269,47 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo OUString aHeaders = pDoc->getRowColumnHeaders(aRectangle); OString aString = OUStringToOString(aHeaders, RTL_TEXTENCODING_UTF8); + + char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1)); + strcpy(pMemory, aString.getStr()); + return pMemory; + } + else if (aCommand.startsWith(aCellCursor) + { + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return 0; + } + + OString aString; + OString aParams = aCommand.copy(OString(".uno:CellCursor:").getLength()); + + sal_Int32 nIndex = 0; + OString aOutputWidth = aParams.getToken(0, ',', nIndex); + OString aOutputHeight = aParams.getToken(0, ',', nIndex); + OString aTileWidth = aParams.getToken(0, ',', nIndex); + OString aTileHeight = aParams.getToken(0, ',', nIndex); + + int nOutputWidth, nOutputHeight; + long nTileWidth, nTileHeight; + if (!(comphelper::string::getTokenCount(aParams, ',') == 4 + && !aOutputWidth.isEmpty() + && (nOutputWidth = aOutputWidth.toInt32()) != 0 + && !aOutputHeight.isEmpty() + && (nOutputHeight = aOutputHeight.toInt32()) != 0 + && !aTileWidth.isEmpty() + && (nTileWidth = aTileWidth.toInt64()) != 0 + && !aTileHeight.isEmpty() + && (nTileHeight = aTileHeight.toInt64()) != 0)) + { + gImpl->maLastExceptionMsg = "Can't parse arguments for .uno:CellCursor, no cursor returned"; + return NULL; + } + + OString aString = pDoc->getCellCursor(nOutputWidth, nOutputHeight, nTileWidth, nTileHeight); + char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1)); strcpy(pMemory, aString.getStr()); return pMemory; |