diff options
author | Tor Lillqvist <tml@collabora.com> | 2023-03-07 11:43:00 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2023-03-07 14:40:02 +0000 |
commit | 1f4e9eacc36413bba92f119ebed931cfdb975e80 (patch) | |
tree | 7038f3ab5b5f4624bf0cdfc7326fbb2fd4ca39ad /include | |
parent | 311edc37b202f5463a86eddc1f9b476dbe5b47fa (diff) |
Drop the LibreOfficeKit paintThumbnail() API
It turns out that Mert's original idea is actually the simplest and it
is known to work. And in that, the separate paintThumbnail() is rather
pointless, as all paintThumbnail() did was to call paintTile(). The
caller (in Collabora Online) knows when a file is opened specifically
for thumbnailing, and can call paintTile() itself with the appropriate
parameters.
My misguided idea would have had paintThumbnail() somehow figure out
the physical Twip coordinates of the current location (for text
documents, the insertion caret location) in the document. (Or, as
LibreOfficeKit for some reason calls them, "logical" coordinates, even
if a Twip is a very physical length unit.) Then it would have called
paintTile() with those coordinates. But it turned out to be rather
hard to figure out the Twip coordinates of the current location in
the document.
Mert's idea was that when a document is opened for thumbnailing, only
Online actually needs to know that. From LibreOfficeKit's and core's
point of view it is a normal document load operation. Then Online
performs the .uno:OpenHyperlink magic, which makes core move the
current position to the requested "target" or "mark" (the terminology
varies) location. And then a "cursor" callback is used by Online to
get the Twip coordinates of the target. It is a bit unclear to me
whether .uno:HyperLink causes the document to be opened an extra time,
but whatever, this way is said to work. So let's do it like that.
This reverts the paintThumbnail part of
1aa37ca99112c0760552600d7774ba7224581c5b.
Change-Id: I8f3d9917ee362c1518834fc10a57c57ebc4a6edb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148390
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 8 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 25 |
2 files changed, 0 insertions, 33 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index a54c364737c6..3887d3d3c412 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -501,14 +501,6 @@ struct _LibreOfficeKitDocumentClass /// @see lok::Document::setViewTimezone(). void (*setViewTimezone) (LibreOfficeKitDocument* pThis, int nId, const char* timezone); - /// @see lok::Document::paintThumbnail(). - void (*paintThumbnail) (LibreOfficeKitDocument* pThis, - unsigned char* pBuffer, - int bufferWidth, - int bufferHeight, - int width, - const char* pURL); - #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 04a3b82e6eca..d3c2e5de78aa 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -886,31 +886,6 @@ public: mpDoc->pClass->setViewTimezone(mpDoc, nId, timezone); } - /** - * Create a thumbnail of a location in the document. - * - * @param pBuffer Where the thumbnail is painted. Same format as a tile painted - * by paintTile(). - * @param bufferWidth number of pixels in a row of pBuffer. - * @param bufferHeight number of pixels in a column of pBuffer. - * @param width logical width of the rendered rectangle, in TWIPs. - * @param pURL Just the fragment part of a URL, indicating the location in the document - * to render as a thumbnail. As returned by extractRequest(), or null, meaning the start - * of the document. - * - * Note that there is no parameter for the logical height of the - * rendered rectangle. The aspect ratio of the rendered rectangle - * is determined by the bufferWidth and bufferHeight parameters. - */ - void paintThumbnail(unsigned char* pBuffer, - int bufferWidth, - int bufferHeight, - int width, - const char* pURL) - { - return mpDoc->pClass->paintThumbnail(mpDoc, pBuffer, bufferWidth, bufferHeight, width, pURL); - } - #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY }; |