1*cdf0e10cSrcweir/*************************************************************************
2*cdf0e10cSrcweir *
3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir *
5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir *
21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir *
26*cdf0e10cSrcweir ************************************************************************/
27*cdf0e10cSrcweir#ifndef __com_sun_star_rendering_XSimpleCanvas_idl__
28*cdf0e10cSrcweir#define __com_sun_star_rendering_XSimpleCanvas_idl__
29*cdf0e10cSrcweir
30*cdf0e10cSrcweir#ifndef __com_sun_star_util_Color_idl__
31*cdf0e10cSrcweir#include <com/sun/star/util/Color.idl>
32*cdf0e10cSrcweir#endif
33*cdf0e10cSrcweir#ifndef __com_sun_star_geometry_RealPoint2D_idl__
34*cdf0e10cSrcweir#include <com/sun/star/geometry/RealPoint2D.idl>
35*cdf0e10cSrcweir#endif
36*cdf0e10cSrcweir#ifndef __com_sun_star_geometry_RealRectangle2D_idl__
37*cdf0e10cSrcweir#include <com/sun/star/geometry/RealRectangle2D.idl>
38*cdf0e10cSrcweir#endif
39*cdf0e10cSrcweir#ifndef __com_sun_star_geometry_AffineMatrix2D_idl__
40*cdf0e10cSrcweir#include <com/sun/star/geometry/AffineMatrix2D.idl>
41*cdf0e10cSrcweir#endif
42*cdf0e10cSrcweir#ifndef __com_sun_star_rendering_StringContext_idl__
43*cdf0e10cSrcweir#include <com/sun/star/rendering/StringContext.idl>
44*cdf0e10cSrcweir#endif
45*cdf0e10cSrcweir#ifndef __com_sun_star_rendering_ViewState_idl__
46*cdf0e10cSrcweir#include <com/sun/star/rendering/ViewState.idl>
47*cdf0e10cSrcweir#endif
48*cdf0e10cSrcweir#ifndef __com_sun_star_rendering_RenderState_idl__
49*cdf0e10cSrcweir#include <com/sun/star/rendering/RenderState.idl>
50*cdf0e10cSrcweir#endif
51*cdf0e10cSrcweir#ifndef __com_sun_star_rendering_FontMetrics_idl__
52*cdf0e10cSrcweir#include <com/sun/star/rendering/FontMetrics.idl>
53*cdf0e10cSrcweir#endif
54*cdf0e10cSrcweir
55*cdf0e10cSrcweir//=============================================================================
56*cdf0e10cSrcweir
57*cdf0e10cSrcweirmodule com {  module sun {  module star {  module rendering {
58*cdf0e10cSrcweir
59*cdf0e10cSrcweirinterface XCanvas;
60*cdf0e10cSrcweirinterface XCanvasFont;
61*cdf0e10cSrcweirinterface XBitmap;
62*cdf0e10cSrcweirinterface XGraphicDevice;
63*cdf0e10cSrcweirinterface XPolyPolygon2D;
64*cdf0e10cSrcweir
65*cdf0e10cSrcweir/** Provides the basic graphical output operations for a canvas.<p>
66*cdf0e10cSrcweir
67*cdf0e10cSrcweir    This interface is a simplified version of the <type>XCanvas</type>
68*cdf0e10cSrcweir    interface. It holds explicit state, i.e. the pen and fill color,
69*cdf0e10cSrcweir    the current transformation, clip and font are persistently
70*cdf0e10cSrcweir    remembered.<p>
71*cdf0e10cSrcweir
72*cdf0e10cSrcweir    In contrast to the <type>XCanvas</type> interface, XSimpleCanvas
73*cdf0e10cSrcweir    does not distinguish between stroke and fill operations; instead,
74*cdf0e10cSrcweir    switching between stroke and fill (or taking both) works by
75*cdf0e10cSrcweir    setting appropriate pen and fill colors.<p>
76*cdf0e10cSrcweir */
77*cdf0e10cSrcweirinterface XSimpleCanvas: com::sun::star::uno::XInterface
78*cdf0e10cSrcweir{
79*cdf0e10cSrcweir    /** Select a font.<p>
80*cdf0e10cSrcweir
81*cdf0e10cSrcweir        This method selects the specified font (or a close substitute)
82*cdf0e10cSrcweir        as the current font for text output.<p>
83*cdf0e10cSrcweir
84*cdf0e10cSrcweir        @param sFontName
85*cdf0e10cSrcweir        The name of the font (like e.g. Arial)
86*cdf0e10cSrcweir
87*cdf0e10cSrcweir        @param size
88*cdf0e10cSrcweir        The size of the font (note that this is not the usual points
89*cdf0e10cSrcweir        unit, but in the same coordinate system as the other rendering
90*cdf0e10cSrcweir        operations - usually, device pixel).
91*cdf0e10cSrcweir
92*cdf0e10cSrcweir        @param bold
93*cdf0e10cSrcweir        When true, selected font is bold.
94*cdf0e10cSrcweir
95*cdf0e10cSrcweir        @param italic
96*cdf0e10cSrcweir        When true, selected font is italic
97*cdf0e10cSrcweir     */
98*cdf0e10cSrcweir    void selectFont( [in] string sFontName, [in]double size, [in] boolean bold, [in] boolean italic );
99*cdf0e10cSrcweir
100*cdf0e10cSrcweir    //-------------------------------------------------------------------------
101*cdf0e10cSrcweir
102*cdf0e10cSrcweir    /** Sets the color used by line and text operations.<p>
103*cdf0e10cSrcweir
104*cdf0e10cSrcweir        To disable stroking, simply set this color to something with
105*cdf0e10cSrcweir        zero alpha (i.e. fully transparent).<p>
106*cdf0e10cSrcweir
107*cdf0e10cSrcweir        @param nsRgbaColor
108*cdf0e10cSrcweir        RGBA color tuple, interpreted in the sRGB color space.
109*cdf0e10cSrcweir     */
110*cdf0e10cSrcweir    void setPenColor( [in] com::sun::star::util::Color nsRgbaColor );
111*cdf0e10cSrcweir
112*cdf0e10cSrcweir    //-------------------------------------------------------------------------
113*cdf0e10cSrcweir
114*cdf0e10cSrcweir    /** Sets the fill color.<p>
115*cdf0e10cSrcweir
116*cdf0e10cSrcweir        To disable filling, simply set this color to something with
117*cdf0e10cSrcweir        zero alpha (i.e. fully transparent).<p>
118*cdf0e10cSrcweir
119*cdf0e10cSrcweir        @param nsRgbaColor
120*cdf0e10cSrcweir        RGBA color tuple, interpreted in the sRGB color space.
121*cdf0e10cSrcweir     */
122*cdf0e10cSrcweir    void setFillColor( [in] com::sun::star::util::Color nsRgbaColor );
123*cdf0e10cSrcweir
124*cdf0e10cSrcweir    //-------------------------------------------------------------------------
125*cdf0e10cSrcweir
126*cdf0e10cSrcweir    /** Sets the clip to the specified rectangle.<p>
127*cdf0e10cSrcweir     */
128*cdf0e10cSrcweir    void setRectClip( [in] ::com::sun::star::geometry::RealRectangle2D aRect );
129*cdf0e10cSrcweir
130*cdf0e10cSrcweir    //-------------------------------------------------------------------------
131*cdf0e10cSrcweir
132*cdf0e10cSrcweir    /** Set the current transform matrix.<p>
133*cdf0e10cSrcweir     */
134*cdf0e10cSrcweir    void setTransformation( [in] ::com::sun::star::geometry::AffineMatrix2D aTransform );
135*cdf0e10cSrcweir
136*cdf0e10cSrcweir    //-------------------------------------------------------------------------
137*cdf0e10cSrcweir
138*cdf0e10cSrcweir    /** Sets a single pixel on the canvas.<p>
139*cdf0e10cSrcweir     */
140*cdf0e10cSrcweir    void drawPixel( [in] ::com::sun::star::geometry::RealPoint2D aPoint );
141*cdf0e10cSrcweir
142*cdf0e10cSrcweir    //-------------------------------------------------------------------------
143*cdf0e10cSrcweir
144*cdf0e10cSrcweir    /** Draws a line on the canvas.<p>
145*cdf0e10cSrcweir     */
146*cdf0e10cSrcweir    void drawLine( [in] ::com::sun::star::geometry::RealPoint2D aStartPoint,
147*cdf0e10cSrcweir                   [in] ::com::sun::star::geometry::RealPoint2D aEndPoint );
148*cdf0e10cSrcweir
149*cdf0e10cSrcweir    //-------------------------------------------------------------------------
150*cdf0e10cSrcweir
151*cdf0e10cSrcweir    /** Draws a rectangle on the canvas.<p>
152*cdf0e10cSrcweir     */
153*cdf0e10cSrcweir    void drawRect( [in] ::com::sun::star::geometry::RealRectangle2D aRect );
154*cdf0e10cSrcweir
155*cdf0e10cSrcweir    //-------------------------------------------------------------------------
156*cdf0e10cSrcweir
157*cdf0e10cSrcweir    /** Draws a poly-polygon on the canvas.<p>
158*cdf0e10cSrcweir     */
159*cdf0e10cSrcweir    void drawPolyPolygon( [in] XPolyPolygon2D xPolyPolygon );
160*cdf0e10cSrcweir
161*cdf0e10cSrcweir    //-------------------------------------------------------------------------
162*cdf0e10cSrcweir
163*cdf0e10cSrcweir    /** Draws text on the canvas.<p>
164*cdf0e10cSrcweir
165*cdf0e10cSrcweir        @param aText
166*cdf0e10cSrcweir        Text to render. The text color is the current pen color.
167*cdf0e10cSrcweir
168*cdf0e10cSrcweir        @param aOutPos
169*cdf0e10cSrcweir        Output position of the text. This is the left or right edge,
170*cdf0e10cSrcweir        depending on nTextDirection. Output position is always
171*cdf0e10cSrcweir        relative to the font baseline.
172*cdf0e10cSrcweir
173*cdf0e10cSrcweir        @param nTextDirection
174*cdf0e10cSrcweir        A value from the <type>TextDirection</type> collection,
175*cdf0e10cSrcweir        denoting the main writing direction for this string. The main
176*cdf0e10cSrcweir        writing direction determines the origin of the text output,
177*cdf0e10cSrcweir        i.e. the left edge for left-to-right and the right edge for
178*cdf0e10cSrcweir        right-to-left text.
179*cdf0e10cSrcweir     */
180*cdf0e10cSrcweir    void drawText( [in] StringContext aText,
181*cdf0e10cSrcweir                   [in] ::com::sun::star::geometry::RealPoint2D aOutPos,
182*cdf0e10cSrcweir                   [in] byte nTextDirection );
183*cdf0e10cSrcweir
184*cdf0e10cSrcweir    //-------------------------------------------------------------------------
185*cdf0e10cSrcweir
186*cdf0e10cSrcweir    /** Draws the bitmap on the canvas.<p>
187*cdf0e10cSrcweir
188*cdf0e10cSrcweir        @param xBitmap
189*cdf0e10cSrcweir        Bitmap to render
190*cdf0e10cSrcweir
191*cdf0e10cSrcweir        @param aLeftTop
192*cdf0e10cSrcweir        Left, top position of the bitmap on the destination canvas.
193*cdf0e10cSrcweir     */
194*cdf0e10cSrcweir    void drawBitmap( [in] XBitmap xBitmap,
195*cdf0e10cSrcweir                     [in] ::com::sun::star::geometry::RealPoint2D aLeftTop );
196*cdf0e10cSrcweir
197*cdf0e10cSrcweir    //-------------------------------------------------------------------------
198*cdf0e10cSrcweir
199*cdf0e10cSrcweir    /** Request the associated graphic device for this canvas.<p>
200*cdf0e10cSrcweir
201*cdf0e10cSrcweir        A graphic device provides methods specific to the underlying
202*cdf0e10cSrcweir        output device capabilities, which are common for all canvases
203*cdf0e10cSrcweir        rendering to such a device. This includes device resolution,
204*cdf0e10cSrcweir        color space, or bitmap formats.<p>
205*cdf0e10cSrcweir
206*cdf0e10cSrcweir        @return the associated <type>XGraphicDevice</type>.
207*cdf0e10cSrcweir     */
208*cdf0e10cSrcweir    XGraphicDevice getDevice();
209*cdf0e10cSrcweir
210*cdf0e10cSrcweir    //-------------------------------------------------------------------------
211*cdf0e10cSrcweir
212*cdf0e10cSrcweir    /** Query the underlying <type>XCanvas</type>.<p>
213*cdf0e10cSrcweir
214*cdf0e10cSrcweir        @return the canvas interface this object is internally based
215*cdf0e10cSrcweir        on.
216*cdf0e10cSrcweir     */
217*cdf0e10cSrcweir    XCanvas getCanvas();
218*cdf0e10cSrcweir
219*cdf0e10cSrcweir    //-------------------------------------------------------------------------
220*cdf0e10cSrcweir
221*cdf0e10cSrcweir    /** Request the font metrics of the current font.<p>
222*cdf0e10cSrcweir
223*cdf0e10cSrcweir        @return the font metrics of the currently selected font.
224*cdf0e10cSrcweir     */
225*cdf0e10cSrcweir    FontMetrics getFontMetrics();
226*cdf0e10cSrcweir
227*cdf0e10cSrcweir    //-------------------------------------------------------------------------
228*cdf0e10cSrcweir
229*cdf0e10cSrcweir    /** Retrieve currently selected font.<p>
230*cdf0e10cSrcweir
231*cdf0e10cSrcweir        @return the font instance that's currently used for rendering
232*cdf0e10cSrcweir        text.
233*cdf0e10cSrcweir     */
234*cdf0e10cSrcweir    XCanvasFont getCurrentFont();
235*cdf0e10cSrcweir
236*cdf0e10cSrcweir    //-------------------------------------------------------------------------
237*cdf0e10cSrcweir
238*cdf0e10cSrcweir    /** Retrieve color currently used for lines.
239*cdf0e10cSrcweir     */
240*cdf0e10cSrcweir    com::sun::star::util::Color getCurrentPenColor();
241*cdf0e10cSrcweir
242*cdf0e10cSrcweir    //-------------------------------------------------------------------------
243*cdf0e10cSrcweir
244*cdf0e10cSrcweir    /** Retrieve color currently used for fills
245*cdf0e10cSrcweir     */
246*cdf0e10cSrcweir    com::sun::star::util::Color getCurrentFillColor();
247*cdf0e10cSrcweir
248*cdf0e10cSrcweir    //-------------------------------------------------------------------------
249*cdf0e10cSrcweir
250*cdf0e10cSrcweir    /** Retrieve current clip rect
251*cdf0e10cSrcweir     */
252*cdf0e10cSrcweir    com::sun::star::geometry::RealRectangle2D getCurrentClipRect();
253*cdf0e10cSrcweir
254*cdf0e10cSrcweir    //-------------------------------------------------------------------------
255*cdf0e10cSrcweir
256*cdf0e10cSrcweir    /** Retrieve current transformation matrix
257*cdf0e10cSrcweir     */
258*cdf0e10cSrcweir    com::sun::star::geometry::AffineMatrix2D getCurrentTransformation();
259*cdf0e10cSrcweir
260*cdf0e10cSrcweir    //-------------------------------------------------------------------------
261*cdf0e10cSrcweir
262*cdf0e10cSrcweir    /** Retrieve view state.<p>
263*cdf0e10cSrcweir
264*cdf0e10cSrcweir        @return the view state, that would generate matching output,
265*cdf0e10cSrcweir        when rendering to an XCanvas instead.
266*cdf0e10cSrcweir     */
267*cdf0e10cSrcweir    ViewState getCurrentViewState();
268*cdf0e10cSrcweir
269*cdf0e10cSrcweir    //-------------------------------------------------------------------------
270*cdf0e10cSrcweir
271*cdf0e10cSrcweir    /** Retrieve render state.<p>
272*cdf0e10cSrcweir
273*cdf0e10cSrcweir        @param bUseFillColor
274*cdf0e10cSrcweir        When true, the Color member of the RenderState is initialized
275*cdf0e10cSrcweir        with the current fill color; when false, the current pen color
276*cdf0e10cSrcweir        is used.
277*cdf0e10cSrcweir
278*cdf0e10cSrcweir        @return the render state, that would generate matching output,
279*cdf0e10cSrcweir        when rendering to an XCanvas instead.
280*cdf0e10cSrcweir     */
281*cdf0e10cSrcweir    RenderState getCurrentRenderState( [in] boolean bUseFillColor );
282*cdf0e10cSrcweir
283*cdf0e10cSrcweir    //-------------------------------------------------------------------------
284*cdf0e10cSrcweir
285*cdf0e10cSrcweir};
286*cdf0e10cSrcweir
287*cdf0e10cSrcweir//=============================================================================
288*cdf0e10cSrcweir
289*cdf0e10cSrcweir}; }; }; };
290*cdf0e10cSrcweir
291*cdf0e10cSrcweir#endif
292