From 12553d62d3738a51b1021c9a5d37a70cb2bc1e45 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Mon, 23 Nov 2015 09:32:37 +0100
Subject: [PATCH 352/398] LOK: add Document::getTileMode()
So that clients can know if they get old-style RGBA or new-style ARGB
output in paintTile().
Change-Id: Icfde4b3259444b3524e64478ccd976664a3fe0ed
(cherry picked from commit fc06f801ee79fd49d54c27121ae9b2904d99f09c)
---
desktop/source/lib/init.cxx | 7 +++++++
include/LibreOfficeKit/LibreOfficeKit.h | 3 +++
include/LibreOfficeKit/LibreOfficeKit.hxx | 10 ++++++++++
include/LibreOfficeKit/LibreOfficeKitEnums.h | 7 +++++++
4 files changed, 27 insertions(+)
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3c6be03a7132..00c1f63ddf4c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -311,6 +311,7 @@ void doc_paintTile(LibreOfficeKitDocument* pThis,
const int nCanvasWidth, const int nCanvasHeight,
const int nTilePosX, const int nTilePosY,
const int nTileWidth, const int nTileHeight);
+static int doc_getTileMode(LibreOfficeKitDocument* pThis);
static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
long* pWidth,
long* pHeight);
@@ -384,6 +385,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
m_pDocumentClass->getPartName = doc_getPartName;
m_pDocumentClass->setPartMode = doc_setPartMode;
m_pDocumentClass->paintTile = doc_paintTile;
+ m_pDocumentClass->getTileMode = doc_getTileMode;
m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
m_pDocumentClass->initializeForRendering = doc_initializeForRendering;
m_pDocumentClass->registerCallback = doc_registerCallback;
@@ -956,6 +958,11 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
#endif
}
+static int doc_getTileMode(LibreOfficeKitDocument* /*pThis*/)
+{
+ return LOK_TILEMODE_RGBA;
+}
+
static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
long* pWidth,
long* pHeight)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 93f7dca6d455..5189cca5eb5e 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -118,6 +118,9 @@ struct _LibreOfficeKitDocumentClass
const int nTileWidth,
const int nTileHeight);
+ /// @see lok::Document::getTileMode().
+ int (*getTileMode) (LibreOfficeKitDocument* pThis);
+
/// @see lok::Document::getDocumentSize().
void (*getDocumentSize) (LibreOfficeKitDocument* pThis,
long* pWidth,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 152d0f415f17..e592bbe549ab 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -143,6 +143,16 @@ public:
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
}
+ /**
+ * Gets the tile mode: the pixel format used for the pBuffer of paintTile().
+ *
+ * @return an element of the LibreOfficeKitTileMode enum.
+ */
+ inline int getTileMode()
+ {
+ return mpDoc->pClass->getTileMode(mpDoc);
+ }
+
/// Get the document sizes in TWIPs.
inline void getDocumentSize(long* pWidth, long* pHeight)
{
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 7b23fcbab1c3..b713f0ed49b7 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -35,6 +35,13 @@ LibreOfficeKitPartMode;
typedef enum
{
+ LOK_TILEMODE_RGBA,
+ LOK_TILEMODE_ARGB
+}
+LibreOfficeKitTileMode;
+
+typedef enum
+{
/**
* Any tiles which are over the rectangle described in the payload are no
* longer valid.
--
2.12.0