summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-05-18 08:36:16 +0100
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-25 13:04:29 +0100
commitfd5f324b0988f62f89216ce01ef23131bffb4e0c (patch)
tree7188ecb033b316620aebfecf6b4f45482613314e /desktop
parent41911db36efa2b97fdca18e468b6dd162d654a4d (diff)
Implement document size retrieval for LibLO.
Change-Id: Ibd69f8e766fd421b05d2305f967179a969bc5b56
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8f32a54e0a57..252d79bc7faa 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -177,6 +177,9 @@ static unsigned char* doc_paintTile(LibreOfficeKitDocument* pThis,
int* pRowStride,
const int nTilePosX, const int nTilePosY,
const int nTileWidth, const int nTileHeight);
+static void doc_getDocumentSize(LibreOfficeDocument* pThis,
+ long* pWidth,
+ long* pHeight);
struct LibLODocument_Impl : public _LibreOfficeKitDocument
{
@@ -198,6 +201,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
m_pDocumentClass->getNumberOfParts = doc_getNumberOfParts;
m_pDocumentClass->setPart = doc_setPart;
m_pDocumentClass->paintTile = doc_paintTile;
+ m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
gDocumentClass = m_pDocumentClass;
}
@@ -444,6 +448,24 @@ static unsigned char* doc_paintTile (LibreOfficeKitDocument* pThis,
return pRet;
}
+static void doc_getDocumentSize(LibreOfficeDocument* pThis,
+ long* pWidth,
+ long* pHeight)
+{
+ LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+
+ if (true) // TODO: test that we have a writer document here (vs calc/impress/etc.)
+ {
+ SwXTextDocument* pTxtDoc = dynamic_cast< SwXTextDocument* >( pDocument->mxComponent.get() );
+ SwDocShell* pDocShell = pTxtDoc->GetDocShell();
+ SwDoc* pDoc = pDocShell->GetDoc();
+ SwViewShell* pViewShell = pDoc->GetCurrentViewShell();
+ Size aDocumentSize = pViewShell->GetDocSize();
+ *pWidth = aDocumentSize.Width();
+ *pHeight = aDocumentSize.Height();
+ }
+}
+
static char* lo_getError (LibreOfficeKit *pThis)
{
LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);