Introduce getDataArea in Calc

It will share information about real size of a data inside
spreadsheet so we can easily check where data ends.

Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I67137a4471f7eb4faaeeb680977872ccda8e9411
This commit is contained in:
Szymon Kłos 2022-09-02 12:43:23 +02:00 committed by Gökay ŞATIR
parent b65c82031a
commit eb4743a648
2 changed files with 27 additions and 1 deletions

View file

@ -65,6 +65,10 @@ static int doc_getTileMode(LibreOfficeKitDocument* pThis);
static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
long* pWidth,
long* pHeight);
static void doc_getDataArea(LibreOfficeKitDocument* pThis,
long nPart,
long* pCol,
long* pRow);
static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
const char* pArguments);
@ -152,6 +156,7 @@ LibLODocument_Impl::LibLODocument_Impl()
m_pDocumentClass->paintPartTile = doc_paintPartTile;
m_pDocumentClass->getTileMode = doc_getTileMode;
m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
m_pDocumentClass->getDataArea = doc_getDataArea;
m_pDocumentClass->initializeForRendering = doc_initializeForRendering;
m_pDocumentClass->registerCallback = doc_registerCallback;
m_pDocumentClass->postKeyEvent = doc_postKeyEvent;
@ -358,6 +363,18 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
*pHeight = 10000;
}
static void doc_getDataArea(LibreOfficeKitDocument* pThis,
long nPart,
long* pCol,
long* pRow)
{
(void) pThis;
(void) nPart;
*pCol = 999;
*pRow = 999;
}
static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
const char* pArguments)
{

View file

@ -50,10 +50,11 @@ namespace LOKitHelper
const auto type = static_cast<LibreOfficeKitDocumentType>(loKitDocument->pClass->getDocumentType(loKitDocument));
const int parts = loKitDocument->pClass->getParts(loKitDocument);
const int part = loKitDocument->pClass->getPart(loKitDocument);
std::ostringstream oss;
oss << "type=" << documentTypeToString(type)
<< " parts=" << parts
<< " current=" << loKitDocument->pClass->getPart(loKitDocument);
<< " current=" << part;
long width, height;
loKitDocument->pClass->getDocumentSize(loKitDocument, &width, &height);
@ -61,6 +62,14 @@ namespace LOKitHelper
<< " height=" << height
<< " viewid=" << loKitDocument->pClass->getView(loKitDocument);
if (type == LOK_DOCTYPE_SPREADSHEET)
{
long lastColumn, lastRow;
loKitDocument->pClass->getDataArea(loKitDocument, part, &lastColumn, &lastRow);
oss << " lastcolumn=" << lastColumn
<< " lastrow=" << lastRow;
}
if (type == LOK_DOCTYPE_SPREADSHEET || type == LOK_DOCTYPE_PRESENTATION || type == LOK_DOCTYPE_DRAWING)
{
std::ostringstream hposs;