1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27
28#ifndef __com_sun_star_drawing_XSlidePreviewCache_idl__
29#define __com_sun_star_drawing_XSlidePreviewCache_idl__
30
31#ifndef __com_sun_star_container_XIndexAccess_idl__
32#include <com/sun/star/container/XIndexAccess.idl>
33#endif
34#ifndef __com_sun_star_geometry_IntegerSize2D_idl__
35#include <com/sun/star/geometry/IntegerSize2D.idl>
36#endif
37#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
38#include <com/sun/star/lang/IllegalArgumentException.idl>
39#endif
40#ifndef __com_sun_star_rendering_XBitmap_idl__
41#include <com/sun/star/rendering/XBitmap.idl>
42#endif
43#ifndef __com_sun_star_rendering_XCanvas_idl__
44#include <com/sun/star/rendering/XCanvas.idl>
45#endif
46
47module com { module sun { module star { module drawing {
48
49/** Listener for asynchronous preview creations.  Called when a slide
50    preview has been created that was previously requested via a call to
51    <method>XSlidePreviewCache::getSlidePreview()</method>.  The
52    implementor may then call <method>getSlidePreview()</method> a second
53    time to get the up-to-date version of the preview.
54*/
55published interface XSlidePreviewCacheListener
56{
57    /** Called by a <interface>XSlidePreviewCache</interface> object when a
58        preview has been created for the slide with the given index.
59        @param nSlideIndex
60            The index of the slide for which a new preview has been created.
61    */
62    void notifyPreviewCreation ([in] long nSlideIndex);
63};
64
65
66
67
68/** A cache of preview bitmaps for the slides of one Impress or Draw
69    document in one size.  There may be more than one cache for one
70    document.  These are internally connected and for missing previews one
71    cache may take it from another cache and scale it to the desired size.
72    When a preview is not present then it is created asynchronously.  On
73    creation all registered listeners are notified.
74
75    Slides are referenced via their index in an XIndexAccess container in
76    order to allow multiple references to a single slide (custom
77    presentations).
78*/
79published interface XSlidePreviewCache
80{
81    /** Set the set of slides for which the cache will provide the
82        previews.  All slides in the given XIndexAccess are required to come
83        from the given model.
84        @param xSlides
85            The set of slides for which the called cache will provide the
86            previews.  This container defines the indices that are used to
87            look up slides.
88        @param xDocument
89            The model that contains the slides reference by the xSlides argument.
90    */
91    void setDocumentSlides (
92        [in] ::com::sun::star::container::XIndexAccess xSlides,
93        [in] ::com::sun::star::uno::XInterface xDocument);
94
95    /** Define which slides are currently visible on the screen and which
96        are not.  This information is used for give preview creation for
97        visible slides a higher priority than for those slides that are not
98        visible.
99    */
100    void setVisibleRange ([in] long nFirstVisibleSlideIndex, [in] long nLastVisibleSlideIndex);
101
102    /** Define the size of the previews that are managed by the called
103        cache.
104    */
105    void setPreviewSize ([in] ::com::sun::star::geometry::IntegerSize2D aSize);
106
107    /** Return a preview for the given slide index.
108        The returned bitmap may be the requested preview, a preview of the
109        preview, i.e. a scaled up or down version, or an empty reference
110        when the preview is not yet present.
111
112        This call may lead to the asynchronous creation of the requested
113        preview.  In that case all registered listeners are notified when
114        the preview has been created.
115    */
116    ::com::sun::star::rendering::XBitmap getSlidePreview (
117        [in] long nSlideIndex,
118        [in] ::com::sun::star::rendering::XCanvas xCanvas)
119          raises(::com::sun::star::lang::IllegalArgumentException);
120
121    /** Register a listener that is called when a preview has been created
122        asynchronously.
123    */
124    void addPreviewCreationNotifyListener ([in] XSlidePreviewCacheListener xListener);
125
126    /** Remove a previously registered listener for preview creations.
127    */
128    void removePreviewCreationNotifyListener ([in] XSlidePreviewCacheListener xListener);
129
130    /** Stop the asynchronous creation of previews temporarily.
131        Call <method>resume()</method> to restart it.
132    */
133    void pause ();
134
135    /** Resume the asynchronous creation of slide previews.
136    */
137    void resume ();
138};
139
140}; }; }; }; // ::com::sun::star::drawing
141
142#endif
143