summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2015-11-05 10:31:06 +0100
committerAndrzej Hunt <andrzej@ahunt.org>2015-11-06 08:02:45 +0100
commitbfe4af27e930108942f0e1af2bffd436588286dd (patch)
tree2120cd6a5a03307b73c1d381e6fc603750c2e9c2
parent7020080f693ed8e6843c5099f742887395099477 (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 (cherry picked from commit e7e0d46dba7b1016968a133330bca23a4bf668ec)
-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 49189eb0381d..dfb37b9fdc2c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1282,7 +1282,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)
@@ -1291,29 +1291,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);