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