1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24#ifndef __com_sun_star_drawing_XSlidePreviewCache_idl__
25#define __com_sun_star_drawing_XSlidePreviewCache_idl__
26
27#ifndef __com_sun_star_container_XIndexAccess_idl__
28#include <com/sun/star/container/XIndexAccess.idl>
29#endif
30#ifndef __com_sun_star_geometry_IntegerSize2D_idl__
31#include <com/sun/star/geometry/IntegerSize2D.idl>
32#endif
33#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
34#include <com/sun/star/lang/IllegalArgumentException.idl>
35#endif
36#ifndef __com_sun_star_rendering_XBitmap_idl__
37#include <com/sun/star/rendering/XBitmap.idl>
38#endif
39#ifndef __com_sun_star_rendering_XCanvas_idl__
40#include <com/sun/star/rendering/XCanvas.idl>
41#endif
42
43module com { module sun { module star { module drawing {
44
45/** Listener for asynchronous preview creations.  Called when a slide
46    preview has been created that was previously requested via a call to
47    <method>XSlidePreviewCache::getSlidePreview()</method>.  The
48    implementor may then call <method>getSlidePreview()</method> a second
49    time to get the up-to-date version of the preview.
50*/
51published interface XSlidePreviewCacheListener
52{
53    /** Called by a <interface>XSlidePreviewCache</interface> object when a
54        preview has been created for the slide with the given index.
55        @param nSlideIndex
56            The index of the slide for which a new preview has been created.
57    */
58    void notifyPreviewCreation ([in] long nSlideIndex);
59};
60
61
62
63
64/** A cache of preview bitmaps for the slides of one Impress or Draw
65    document in one size.  There may be more than one cache for one
66    document.  These are internally connected and for missing previews one
67    cache may take it from another cache and scale it to the desired size.
68    When a preview is not present then it is created asynchronously.  On
69    creation all registered listeners are notified.
70
71    Slides are referenced via their index in an XIndexAccess container in
72    order to allow multiple references to a single slide (custom
73    presentations).
74*/
75published interface XSlidePreviewCache
76{
77    /** Set the set of slides for which the cache will provide the
78        previews.  All slides in the given XIndexAccess are required to come
79        from the given model.
80        @param xSlides
81            The set of slides for which the called cache will provide the
82            previews.  This container defines the indices that are used to
83            look up slides.
84        @param xDocument
85            The model that contains the slides reference by the xSlides argument.
86    */
87    void setDocumentSlides (
88        [in] ::com::sun::star::container::XIndexAccess xSlides,
89        [in] ::com::sun::star::uno::XInterface xDocument);
90
91    /** Define which slides are currently visible on the screen and which
92        are not.  This information is used for give preview creation for
93        visible slides a higher priority than for those slides that are not
94        visible.
95    */
96    void setVisibleRange ([in] long nFirstVisibleSlideIndex, [in] long nLastVisibleSlideIndex);
97
98    /** Define the size of the previews that are managed by the called
99        cache.
100    */
101    void setPreviewSize ([in] ::com::sun::star::geometry::IntegerSize2D aSize);
102
103    /** Return a preview for the given slide index.
104        The returned bitmap may be the requested preview, a preview of the
105        preview, i.e. a scaled up or down version, or an empty reference
106        when the preview is not yet present.
107
108        This call may lead to the asynchronous creation of the requested
109        preview.  In that case all registered listeners are notified when
110        the preview has been created.
111    */
112    ::com::sun::star::rendering::XBitmap getSlidePreview (
113        [in] long nSlideIndex,
114        [in] ::com::sun::star::rendering::XCanvas xCanvas)
115          raises(::com::sun::star::lang::IllegalArgumentException);
116
117    /** Register a listener that is called when a preview has been created
118        asynchronously.
119    */
120    void addPreviewCreationNotifyListener ([in] XSlidePreviewCacheListener xListener);
121
122    /** Remove a previously registered listener for preview creations.
123    */
124    void removePreviewCreationNotifyListener ([in] XSlidePreviewCacheListener xListener);
125
126    /** Stop the asynchronous creation of previews temporarily.
127        Call <method>resume()</method> to restart it.
128    */
129    void pause ();
130
131    /** Resume the asynchronous creation of slide previews.
132    */
133    void resume ();
134};
135
136}; }; }; }; // ::com::sun::star::drawing
137
138#endif
139