summaryrefslogtreecommitdiff
path: root/include/LibreOfficeKit
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-05-06 08:16:00 -0400
committerJan Holesovsky <kendy@collabora.com>2016-05-09 13:58:29 +0200
commit70e8e788beb122b5779693ecece8f65e27192256 (patch)
treed6736252493f2294fa64faf648ad28f5644fc97f /include/LibreOfficeKit
parentbc990b011a928ab55b42361415c6eeb5cb9d172c (diff)
Allow painting for arbitrary part
Painting should not cause any state changes, but to paint a tile on a different part than the current has to change the document, which sends notifications to all clients. A new API, paintPartTile, allows for painting tiles on any part without sending change of part notifications. Furthermore, because we block notifications during this operation, no tile invalidation is issued due to changing of the part. One issue remains in the cases when the LO Core resets the cursor position internally and we resume editing after painting, the cursor might be at the top of the page. This needs fixing separately. Change-Id: If19bd1c90ecad4d5ed5e8d09513741b7994fa6e5 Reviewed-on: https://gerrit.libreoffice.org/24698 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'include/LibreOfficeKit')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h13
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx21
2 files changed, 34 insertions, 0 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 1281a2182b25..110d4d58f8c8 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -228,6 +228,19 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document::getPartHash().
char* (*getPartHash) (LibreOfficeKitDocument* pThis,
int nPart);
+
+ /// Paints a tile from a specific part.
+ /// @see lok::Document::paintTile().
+ void (*paintPartTile) (LibreOfficeKitDocument* pThis,
+ unsigned char* pBuffer,
+ const int nPart,
+ const int nCanvasWidth,
+ const int nCanvasHeight,
+ const int nTilePosX,
+ const int nTilePosY,
+ const int nTileWidth,
+ const int nTileHeight);
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 3e3a0e1d501a..7969ed52d32e 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -414,6 +414,27 @@ public:
return mpDoc->pClass->renderFont(mpDoc, pFontName, pFontWidth, pFontHeight);
}
+ /**
+ * Renders a subset of the document's part to a pre-allocated buffer.
+ *
+ * @param nPart the part number of the document of which the tile is painted.
+ * @see paintTile.
+ */
+ inline void paintPartTile(unsigned char* pBuffer,
+ const int nPart,
+ const int nCanvasWidth,
+ const int nCanvasHeight,
+ const int nTilePosX,
+ const int nTilePosY,
+ const int nTileWidth,
+ const int nTileHeight)
+ {
+ return mpDoc->pClass->paintPartTile(mpDoc, pBuffer, nPart,
+ nCanvasWidth, nCanvasHeight,
+ nTilePosX, nTilePosY,
+ nTileWidth, nTileHeight);
+ }
+
#endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
};