summaryrefslogtreecommitdiff
path: root/touch/idl/org/libreoffice/touch/XDocument.idl
blob: 3d61160fd3cc8623ccefaf4213b34314e4e42f31 (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
74
75
76
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 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.

    // At this API level buffer is represented as the address of its bytes as
    // a 64-bit integer, i.e. on Android it must be a "direct" ByteBuffer for
    // that to be meaningful.

    // width and height must be powers of two

    // 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 width,
                 [in] long height,
                 [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: */