diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2020-05-05 01:55:37 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.com> | 2020-07-04 09:47:30 +0200 |
commit | 777f9cec0985f99451ecb804d5ae139a0be32253 (patch) | |
tree | 7d93ea019fff61dcac08c17e1c9a814699a98734 /desktop | |
parent | c6073a5a01aafc942ed459e748fe3605a3cc4586 (diff) |
Introduce ITiledRenderable::getSheetGeometryData()
ITiledRenderable::getSheetGeometryData(bool bColumns, bool bRows,
bool bSizes, bool bHidden,
bool bFiltered, bool bGroups)
and implement it for the Calc derivation (ScModelObj).
The aim is to use it actively in LOOL instead of the interface:
ITiledRenderable::getRowColumnHeaders(const tools::Rectangle& /*rRectangle*/)
This is used by the LOOL to fetch the sheet geometry data for just the
current view-area in the clients, so LOOL queries this everytime some
client's view-area changes.
Like the existing interface, the new one will provide all 'kinds' of
sheet geometry info [col/row sizes(twips), hidden/filtered and
grouping]. But the difference is, it generates data for the whole sheet
(not view-area specific). So the method need not be queried every time
the view area changes in the LOOL clients, and more importantly it
enables the clients to locate any cell at any zoom level without any
further help from the core. This means core needn't send various
client(zoom) specific positioning messages in pixel aligned twips. It
just can send all positioning messages in print twips uniformly to all
clients.
Conflicts:
sc/source/core/data/segmenttree.cxx
sc/source/ui/inc/tabview.hxx
sc/source/ui/unoobj/docuno.cxx
Change-Id: Ib6aee9a0c92746b1576ed244e98cb54b572778c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96892
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
(cherry picked from commit 9faf7b5e7abe39c287f28f83fd14a364e959c881)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96963
Tested-by: Jenkins
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a34565e9d0c1..bc6a0e18ed92 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -4875,6 +4875,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo OString aCommand(pCommand); static const OString aViewRowColumnHeaders(".uno:ViewRowColumnHeaders"); + static const OString aSheetGeometryData(".uno:SheetGeometryData"); static const OString aCellCursor(".uno:CellCursor"); static const OString aFontSubset(".uno:FontSubset&name="); @@ -4970,6 +4971,72 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo pDoc->getRowColumnHeaders(aRectangle, aJsonWriter); return aJsonWriter.extractData(); } + else if (aCommand.startsWith(aSheetGeometryData)) + { + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + SetLastExceptionMsg("Document doesn't support tiled rendering"); + return nullptr; + } + + bool bColumns = true; + bool bRows = true; + bool bSizes = true; + bool bHidden = true; + bool bFiltered = true; + bool bGroups = true; + if (aCommand.getLength() > aSheetGeometryData.getLength()) + { + bColumns = bRows = bSizes = bHidden = bFiltered = bGroups = false; + + OString aArguments = aCommand.copy(aSheetGeometryData.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); + + bool bEnableFlag = aValue.isEmpty() || + aValue.equalsIgnoreAsciiCase("true") || aValue.toInt32() > 0; + if (!bEnableFlag) + continue; + + if (aKey == "columns") + bColumns = true; + else if (aKey == "rows") + bRows = true; + else if (aKey == "sizes") + bSizes = true; + else if (aKey == "hidden") + bHidden = true; + else if (aKey == "filtered") + bFiltered = true; + else if (aKey == "groups") + bGroups = true; + + } while (nParamIndex >= 0); + } + + OString aGeomDataStr + = pDoc->getSheetGeometryData(bColumns, bRows, bSizes, bHidden, bFiltered, bGroups); + + if (aGeomDataStr.isEmpty()) + return nullptr; + + return convertOString(aGeomDataStr); + } else if (aCommand.startsWith(aCellCursor)) { ITiledRenderable* pDoc = getTiledRenderable(pThis); |