summaryrefslogtreecommitdiff
path: root/touch/idl/org/libreoffice/touch/XDocument.idl
blob: bc3d563d8708f83f6ea2d63ce98e68ee4feccaf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-

// Copyright 2012 LibreOffice contributors.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef org_libreoffice_touch_XDocument_idl
#define org_libreoffice_touch_XDocument_idl

#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/lang/IllegalArgumentException.idl>

module org { module libreoffice { module touch {

// Note that this is work in progress

// Error handling? Presumably for true errors expected to be uncommon, or
// invalid usage, the methods should throw exceptions.

// Multithreaded use of this is undefined (the intent obviously is that this
// API is called in another thread than the "main" UI thread, but calling this
// stuff on the same object simultaneously in multiple threads is undefined).

// Represents one (Writer, for now) document

interface XDocumentRenderCallback;

interface XDocument: com::sun::star::uno::XInterface
{
    [attribute, readonly] long numberOfPages;

    // Renders a (part of a) page into a square bitmap, for Android in the
    // android.graphics.Bitmap.Config.ARGB_8888 format. Despite the name, the
    // order of bytes is R,G,B,A. Is this reliable, or coincidental depending
    // on Android version and/or hardware? TBD. Will the same format be useful
    // also for iOS? TBD.

    // buffer must have an exact number of bytes for a square number of
    // pixels, At the UNO level buffer is represented as the address of its
    // bytes, i.e. on Android it must be a "direct" ByteBuffer for that to be
    // meaningful.

    // listener gets a "reasonable" number of callbacks during the rendering
    // if it takes "significantly" long, and can inerrupt the rendering.

    // zoomLevel is 0 for whole page, 1 for tiled into four, etc.

    // x and y are in [0..2^zoomLevel]

    // Should we have this method copy the rendered buffer into a Bitmap
    // instead and return that? A Bitmap is presumably what the caller wants
    // anyway?

    // Or should we just go OpenGL ES and render into a texture?

    void render( [in] hyper buffer,
                 [in] long bufferSize,
                 [in] XDocumentRenderCallback listener,
                 [in] long pageNo,
                 [in] long zoomLevel,
                 [in] long x,
                 [in] long y)
        raises( com::sun::star::lang::IllegalArgumentException );

};

}; }; };

#endif

// vim:set shiftwidth=4 softtabstop=4 expandtab: