summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-11-03 15:05:37 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-11-03 15:39:55 +0100
commit75303695eb4bfe6c8fdea2cad0d3ed3f912f95c9 (patch)
tree4cac531cdbd4c7f01870f3d62e3636c9616a743c /desktop/source
parentcce7d78baa91ab348e85407ada8387c9c89176cb (diff)
sc lok: allow requesting row headers only for a logic area
So that for large documents it's not needed to query all of them on load, but (similar to tiled rendering itself) it's possible to query the data that affects the visible area. One catch is that the row sizes are relative, so there is a placeholder row in case the visible area is not the top left corner, and constructing its size needs special care. Normally the handed out twip values have to be floored after twip->px conversion, but this one is already rounded (as the total is a sum of px values, again becase of the previous floor rule), so need to play the +0.5 trick to allow clients always just flooring the logic conversion result they get. Change-Id: I64a155582acdee7b2acc741d77a2c462409b91a8
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/lib/init.cxx45
1 files changed, 43 insertions, 2 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8d09c3933384..ca06d50b4f4a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1205,6 +1205,9 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCommand)
{
+ OString aCommand(pCommand);
+ static const OString aViewRowColumnHeaders(".uno:ViewRowColumnHeaders");
+
if (!strcmp(pCommand, ".uno:CharFontName"))
{
return getFonts(pCommand);
@@ -1213,7 +1216,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
{
return getStyles(pThis, pCommand);
}
- else if (OString(pCommand) == ".uno:ViewRowColumnHeaders")
+ else if (aCommand.startsWith(aViewRowColumnHeaders))
{
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (!pDoc)
@@ -1222,7 +1225,45 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
return 0;
}
- OUString aHeaders = pDoc->getRowColumnHeaders();
+ Rectangle aRectangle;
+ if (aCommand.getLength() > aViewRowColumnHeaders.getLength())
+ {
+ // Command has parameters.
+ int nX = 0;
+ int nY = 0;
+ int nWidth = 0;
+ int nHeight = 0;
+ OString aArguments = aCommand.copy(aViewRowColumnHeaders.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 == "x")
+ nX = aValue.toInt32();
+ else if (aKey == "y")
+ nY = aValue.toInt32();
+ else if (aKey == "width")
+ nWidth = aValue.toInt32();
+ else if (aKey == "height")
+ nHeight = aValue.toInt32();
+ }
+ while (nParamIndex >= 0);
+ aRectangle = Rectangle(nX, nY, nX + nWidth, nY + nHeight);
+ }
+
+ 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());