summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2015-11-05 10:31:06 +0100
committerAndrzej Hunt <andrzej@ahunt.org>2015-11-05 12:59:01 +0100
commite7e0d46dba7b1016968a133330bca23a4bf668ec (patch)
treecb10e7293cbd2aae51ee907c65f7a5eab07df48b /desktop
parent2bcaffd12263e8f3c2a2fbf8ccc4b9bba2642146 (diff)
sc lok: update parameter syntax for .uno:CellCursor
This follows the syntax for .uno:ViewRowColumnHeaders (which was implemented somewhat concurrentl with CellCursor) Change-Id: I8ef03a969abc1716a0e95d95fb7043d75910c828
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx57
1 files changed, 34 insertions, 23 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f45445c6364c..aaa5492087c7 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1274,7 +1274,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
strcpy(pMemory, aString.getStr());
return pMemory;
}
- else if (aCommand.startsWith(aCellCursor)
+ else if (aCommand.startsWith(aCellCursor))
{
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
@@ -1283,29 +1283,40 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
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))
+ // Command has parameters.
+ int nOutputWidth = 0;
+ int nOutputHeight = 0;
+ long nTileWidth = 0;
+ long nTileHeight = 0;
+ if (aCommand.getLength() > aCellCursor.getLength())
{
- gImpl->maLastExceptionMsg = "Can't parse arguments for .uno:CellCursor, no cursor returned";
- return NULL;
+ OString aArguments = aCommand.copy(aCellCursor.getLength() + 1);
+ sal_Int32 nParamIndex = 0;
+ do
+ {
+ OString aParamToken = aArguments.getToken(0, '&', nParamIndex);
+ sal_Int32 nIndex = 0;
+ OString aKey;
+ OString aValue;
+ do
+ {
+ OString aToken = aParamToken.getToken(0, '=', nIndex);
+ if (!aKey.getLength())
+ aKey = aToken;
+ else
+ aValue = aToken;
+ }
+ while (nIndex >= 0);
+ if (aKey == "outputWidth")
+ nOutputWidth = aValue.toInt32();
+ else if (aKey == "outputHeight")
+ nOutputHeight = aValue.toInt32();
+ else if (aKey == "tileWidth")
+ nTileWidth = aValue.toInt64();
+ else if (aKey == "tileHeight")
+ nTileHeight = aValue.toInt64();
+ }
+ while (nParamIndex >= 0);
}
OString aString = pDoc->getCellCursor(nOutputWidth, nOutputHeight, nTileWidth, nTileHeight);