Kaydet (Commit) f858fa26 authored tarafından Ariel Constenla-Haile's avatar Ariel Constenla-Haile Kaydeden (comit) Caolán McNamara

Related: #i121442# - Extend css::awt::XGraphic to draw images

A StatusbarController that draws its status bar item may need to draw a
graphic representing the feature state. css::awt::XGraphics API should
be extended to include VCL's OuptDevice::DrawImage

(cherry picked from commit 3ca8e86d)

Conflicts:
	offapi/com/sun/star/awt/XGraphics.idl
	offapi/com/sun/star/awt/makefile.mk
	offapi/type_reference/types.rdb
	toolkit/inc/toolkit/awt/vclxgraphics.hxx
	toolkit/source/awt/vclxgraphics.cxx

Change-Id: If2c37022e60e8a3c9fce51dac84f4a2af001b5c5
üst 5dd32f76
......@@ -22,6 +22,7 @@
#include <com/sun/star/awt/XGraphics.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <cppuhelper/weak.hxx>
......@@ -64,6 +65,8 @@ private:
RasterOp meRasterOp;
Region* mpClipRegion;
void initAttrs();
public:
VCLXGraphics();
~VCLXGraphics();
......@@ -90,41 +93,48 @@ public:
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::XGraphics
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL getDevice( ) throw(::com::sun::star::uno::RuntimeException);
::com::sun::star::awt::SimpleFontMetric SAL_CALL getFontMetric() throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& xNewFont ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL selectFont( const ::com::sun::star::awt::FontDescriptor& aDescription ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setTextColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setTextFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setLineColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setRasterOp( ::com::sun::star::awt::RasterOperation ROP ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& Clipping ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL intersectClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& xClipping ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL push( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL pop( ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL copy( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >& xSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL draw( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap >& xBitmapHandle, sal_Int32 SourceX, sal_Int32 SourceY, sal_Int32 SourceWidth, sal_Int32 SourceHeight, sal_Int32 DestX, sal_Int32 DestY, sal_Int32 DestWidth, sal_Int32 DestHeight ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawPixel( sal_Int32 X, sal_Int32 Y ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawLine( sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawRect( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawRoundedRect( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawPolyLine( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawPolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataX, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataY ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawEllipse( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawArc( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawPie( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawChord( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawGradient( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 Height, const ::com::sun::star::awt::Gradient& aGradient ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawText( sal_Int32 X, sal_Int32 Y, const OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL drawTextArray( sal_Int32 X, sal_Int32 Y, const OUString& Text, const ::com::sun::star::uno::Sequence< sal_Int32 >& Longs ) throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::XGraphics Attributes
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL getDevice() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getTextColor() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setTextColor( ::sal_Int32 _textcolor ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getTextFillColor() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setTextFillColor( ::sal_Int32 _textfillcolor ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getLineColor() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setLineColor( ::sal_Int32 _linecolor ) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getFillColor() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setFillColor( ::sal_Int32 _fillcolor ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::awt::RasterOperation SAL_CALL getRasterOp() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setRasterOp( ::com::sun::star::awt::RasterOperation _rasterop ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& _font ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::awt::SimpleFontMetric SAL_CALL getFontMetric() throw (::com::sun::star::uno::RuntimeException);
// ::com::sun::star::awt::XGraphics Methods
virtual void SAL_CALL selectFont( const ::com::sun::star::awt::FontDescriptor& aDescription ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& Clipping ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL intersectClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& xClipping ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL push( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL pop( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL clear( const ::com::sun::star::awt::Rectangle& aRect ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL copy( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >& xSource, ::sal_Int32 nSourceX, ::sal_Int32 nSourceY, ::sal_Int32 nSourceWidth, ::sal_Int32 nSourceHeight, ::sal_Int32 nDestX, ::sal_Int32 nDestY, ::sal_Int32 nDestWidth, ::sal_Int32 nDestHeight ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL draw( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap >& xBitmapHandle, ::sal_Int32 SourceX, ::sal_Int32 SourceY, ::sal_Int32 SourceWidth, ::sal_Int32 SourceHeight, ::sal_Int32 DestX, ::sal_Int32 DestY, ::sal_Int32 DestWidth, ::sal_Int32 DestHeight ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawPixel( ::sal_Int32 X, ::sal_Int32 Y ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawLine( ::sal_Int32 X1, ::sal_Int32 Y1, ::sal_Int32 X2, ::sal_Int32 Y2 ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawRect( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawRoundedRect( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int32 nHorzRound, ::sal_Int32 nVertRound ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawPolyLine( const ::com::sun::star::uno::Sequence< ::sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& DataY ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawPolygon( const ::com::sun::star::uno::Sequence< ::sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& DataY ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::sal_Int32 > >& DataX, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::sal_Int32 > >& DataY ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawEllipse( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawArc( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int32 X1, ::sal_Int32 Y1, ::sal_Int32 X2, ::sal_Int32 Y2 ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawPie( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int32 X1, ::sal_Int32 Y1, ::sal_Int32 X2, ::sal_Int32 Y2 ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawChord( ::sal_Int32 nX, ::sal_Int32 nY, ::sal_Int32 nWidth, ::sal_Int32 nHeight, ::sal_Int32 nX1, ::sal_Int32 nY1, ::sal_Int32 nX2, ::sal_Int32 nY2 ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawGradient( ::sal_Int32 nX, ::sal_Int32 nY, ::sal_Int32 nWidth, ::sal_Int32 Height, const ::com::sun::star::awt::Gradient& aGradient ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawText( ::sal_Int32 X, ::sal_Int32 Y, const OUString& Text ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawTextArray( ::sal_Int32 X, ::sal_Int32 Y, const OUString& Text, const ::com::sun::star::uno::Sequence< ::sal_Int32 >& Longs ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL drawImage( ::sal_Int32 nX, ::sal_Int32 nY, ::sal_Int32 nWidth, ::sal_Int32 nHeight, ::sal_Int16 nStyle, const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& aGraphic ) throw (::com::sun::star::uno::RuntimeException);
};
#endif // _TOOLKIT_AWT_VCLXGRAPHICS_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -1723,6 +1723,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt,\
FontWidth \
Gradient \
GradientStyle \
ImageDrawMode \
ImageAlign \
ImagePosition \
ImageScaleMode \
......
/*
* 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/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_awt_ImageDrawMode_idl__
#define __com_sun_star_awt_ImageDrawMode_idl__
module com { module sun { module star { module awt {
/** defines modes how an image is drawn onto a device
@see <member scope="com::sun::star::awt">XGraphics2::drawImage</member>
@since LibreOffice 4.1
*/
constants ImageDrawMode
{
/** the image is drawn as is, without any color transformation.
*/
const short NONE = 0x0000;
/** the image is drawn as if it represented a feature whose state is disabled.
*/
const short DISABLE = 0x0001;
/** the image is drawn as being highlighted.
See <member scope="com::sun::star::awt">XStyleSettings::HighlightColor</member>.
*/
const short HIGHLIGHT = 0x0002;
/** the image is drawn as being deactivated.
See <member scope="com::sun::star::awt">XStyleSettings::DeactiveColor</member>.
*/
const short DEACTIVE = 0x0004;
/** the image is drawn semi-transparent.
*/
const short SEMITRANSPARENT = 0x0010;
};
}; }; }; };
#endif
......@@ -20,98 +20,86 @@
#define __com_sun_star_awt_XGraphics_idl__
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/util/Color.idl>
#include <com/sun/star/awt/SimpleFontMetric.idl>
#include <com/sun/star/awt/FontDescriptor.idl>
#include <com/sun/star/awt/RasterOperation.idl>
#include <com/sun/star/awt/Gradient.idl>
#include <com/sun/star/awt/Rectangle.idl>
#include <com/sun/star/graphic/XGraphic.idl>
module com { module sun { module star { module awt {
module com { module sun { module star { module awt {
published interface XRegion;
published interface XDisplayBitmap;
published interface XFont;
published interface XDevice;
published interface XRegion;
published interface XDisplayBitmap;
published interface XFont;
published interface XDevice;
/** provides the basic output operation of a device.
*/
published interface XGraphics: com::sun::star::uno::XInterface
{
/** returns the device of this graphics.
/** the device of this graphics
*/
XDevice getDevice();
[attribute, readonly] XDevice Device;
/** returns the font metric of the current font.
/** the text color used by text operations.
*/
SimpleFontMetric getFontMetric();
[attribute] com::sun::star::util::Color TextColor;
/** sets the font used by text operations.
/** the fill color used by text operations.
*/
void setFont( [in] XFont xNewFont );
[attribute] com::sun::star::util::Color TextFillColor;
/** creates a new font and sets the font.
/** the line color.
*/
void selectFont( [in] FontDescriptor aDescription );
[attribute] com::sun::star::util::Color LineColor;
/** sets the text color used by text operations.
/** the fill color.
*/
void setTextColor( [in] com::sun::star::util::Color nColor );
[attribute] com::sun::star::util::Color FillColor;
/** the raster operation.
/** sets the fill color used by text operations.
<p>If the device does not support raster operations,
this attribute is ignored.</p>
*/
void setTextFillColor( [in] com::sun::star::util::Color nColor );
[attribute] RasterOperation RasterOp;
/** sets the line color.
/** the font used by text operations.
*/
void setLineColor( [in] com::sun::star::util::Color nColor );
[attribute] XFont Font;
/** sets the fill color.
/** the font metric of the current font.
*/
void setFillColor( [in] com::sun::star::util::Color nColor );
/** sets the raster operation.
[attribute, readonly] SimpleFontMetric FontMetric;
<p>If the device does not support raster operations
then this call is ignored.</p>
/** creates a new font and sets the font.
*/
void setRasterOp( [in] RasterOperation ROP );
void selectFont( [in] FontDescriptor aDescription );
/** sets the clip region to specified clipping.
*/
void setClipRegion( [in] XRegion Clipping );
/** builds the intersection with the current region.
*/
void intersectClipRegion( [in] XRegion xClipping );
/** saves all current settings (Font, TextColor, TextFillColor,
LineColor, FillColor, RasterOp, ClipRegion).
*/
void push();
/** restores all previous saved settings.
*/
void pop();
/** clears the given rectangle on the device
@since LibreOffice 4.1
*/
void clear( [in] Rectangle aRect );
/** copies a rectangle of pixels from another device into this one.
*/
......@@ -125,7 +113,6 @@ published interface XGraphics: com::sun::star::uno::XInterface
[in] long nDestWidth,
[in] long nDestHeight );
/** draws a part of the specified bitmap to the output device.
*/
void draw( [in] XDisplayBitmap xBitmapHandle,
......@@ -138,13 +125,11 @@ published interface XGraphics: com::sun::star::uno::XInterface
[in] long DestWidth,
[in] long DestHeight );
/** sets a single pixel in the output device.
*/
void drawPixel( [in] long X,
[in] long Y );
/** draws a line in the output device.
*/
void drawLine( [in] long X1,
......@@ -152,7 +137,6 @@ published interface XGraphics: com::sun::star::uno::XInterface
[in] long X2,
[in] long Y2 );
/** draws a rectangle in the output device.
*/
void drawRect( [in] long X,
......@@ -160,7 +144,6 @@ published interface XGraphics: com::sun::star::uno::XInterface
[in] long Width,
[in] long Height );
/** draws a rectangle with rounded corners in the output device.
*/
void drawRoundedRect( [in] long X,
......@@ -170,25 +153,21 @@ published interface XGraphics: com::sun::star::uno::XInterface
[in] long nHorzRound,
[in] long nVertRound );
/** draws multiple lines in the output device at once.
*/
void drawPolyLine( [in] sequence<long> DataX,
[in] sequence<long> DataY );
/** draws a polygon line in the output device.
*/
void drawPolygon( [in] sequence<long> DataX,
[in] sequence<long> DataY );
/** draws multiple polygons in the output device at once.
*/
void drawPolyPolygon( [in] sequence< sequence<long> > DataX,
[in] sequence< sequence<long> > DataY );
/** draws an ellipse in the output device.
*/
void drawEllipse( [in] long X,
......@@ -196,7 +175,6 @@ published interface XGraphics: com::sun::star::uno::XInterface
[in] long Width,
[in] long Height );
/** draws an arc (part of a circle) in the output device.
*/
void drawArc( [in] long X,
......@@ -208,7 +186,6 @@ published interface XGraphics: com::sun::star::uno::XInterface
[in] long X2,
[in] long Y2 );
/** draws a circular area in the output device.
*/
void drawPie( [in] long X,
......@@ -220,7 +197,6 @@ published interface XGraphics: com::sun::star::uno::XInterface
[in] long X2,
[in] long Y2 );
/** draws a chord of a circular area in the output device.
<p>A chord is a segment of a circle. You get two chords from a
......@@ -236,7 +212,6 @@ published interface XGraphics: com::sun::star::uno::XInterface
[in] long nX2,
[in] long nY2 );
/** draws a color dispersion in the output device.
*/
void drawGradient( [in] long nX,
......@@ -245,14 +220,12 @@ published interface XGraphics: com::sun::star::uno::XInterface
[in] long Height,
[in] Gradient aGradient );
/** draws text in the output device.
*/
void drawText( [in] long X,
[in] long Y,
[in] string Text );
/** draws texts in the output device using an explicit kerning table.
*/
void drawTextArray( [in] long X,
......@@ -260,8 +233,41 @@ published interface XGraphics: com::sun::star::uno::XInterface
[in] string Text,
[in] sequence<long> Longs );
};
/** draws a <type scope="com::sun::star::graphic">XGraphic</type>
in the output device.
<p>Note that some devices may not support this operation.</p>
@since LibreOffice 4.1
@param nX
the X coordinate on the device where the graphic will be drawn
@param nY
the Y coordinate on the device where the graphic will be drawn
@param nWidth
the width of the region on the device
@param nHeight
the height of the region on the device
@param nStyle
the style used to draw the image.
See <type scope="com::sun::star::awt">ImageDrawMode</type>.
@param aGraphic
the <type scope="com::sun::star::graphic">XGraphic</type>
to be drawn onto the device
*/
void drawImage( [in] long nX,
[in] long nY,
[in] long nWidth,
[in] long nHeight,
[in] short nStyle,
[in] ::com::sun::star::graphic::XGraphic aGraphic );
};
}; }; }; };
......
......@@ -20,6 +20,7 @@
#include <toolkit/awt/vclxgraphics.hxx>
#include <toolkit/awt/vclxdevice.hxx>
#include <toolkit/awt/vclxfont.hxx>
#include <toolkit/helper/macros.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <cppuhelper/typeprovider.hxx>
......@@ -27,30 +28,32 @@
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
#include <vcl/image.hxx>
#include <vcl/gradient.hxx>
#include <tools/debug.hxx>
using namespace com::sun::star;
// ----------------------------------------------------
// class VCLXGraphics
// ----------------------------------------------------
// ::com::sun::star::uno::XInterface
::com::sun::star::uno::Any VCLXGraphics::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
// uno::XInterface
uno::Any VCLXGraphics::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
{
::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
uno::Any aRet = ::cppu::queryInterface( rType,
(static_cast< ::com::sun::star::awt::XGraphics* >(this)),
(static_cast< ::com::sun::star::lang::XTypeProvider* >(this)),
(static_cast< ::com::sun::star::lang::XUnoTunnel* >(this)) );
return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
}
// ::com::sun::star::lang::XUnoTunnel
// lang::XUnoTunnel
IMPL_XUNOTUNNEL( VCLXGraphics )
// ::com::sun::star::lang::XTypeProvider
// lang::XTypeProvider
IMPL_XTYPEPROVIDER_START( VCLXGraphics )
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>* ) NULL )
getCppuType( ( uno::Reference< awt::XGraphics>* ) NULL )
IMPL_XTYPEPROVIDER_END
VCLXGraphics::VCLXGraphics()
......@@ -80,6 +83,7 @@ void VCLXGraphics::SetOutputDevice( OutputDevice* pOutDev )
{
mpOutputDevice = pOutDev;
mxDevice = NULL;
initAttrs();
}
void VCLXGraphics::Init( OutputDevice* pOutDev )
......@@ -87,12 +91,7 @@ void VCLXGraphics::Init( OutputDevice* pOutDev )
DBG_ASSERT( !mpOutputDevice, "VCLXGraphics::Init already has pOutDev !" );
mpOutputDevice = pOutDev;
maFont = mpOutputDevice->GetFont();
maTextColor = COL_BLACK;
maTextFillColor = COL_TRANSPARENT;
maLineColor = COL_BLACK;
maFillColor = COL_WHITE;
meRasterOp = ROP_OVERPAINT;
initAttrs();
mpClipRegion = NULL;
// Register at OutputDevice
......@@ -102,6 +101,19 @@ void VCLXGraphics::Init( OutputDevice* pOutDev )
pLst->push_back( this );
}
void VCLXGraphics::initAttrs()
{
if ( !mpOutputDevice )
return;
maFont = mpOutputDevice->GetFont();
maTextColor = mpOutputDevice->GetTextColor(); /* COL_BLACK */
maTextFillColor = mpOutputDevice->GetTextFillColor(); /* COL_TRANSPARENT */
maLineColor = mpOutputDevice->GetLineColor(); /* COL_BLACK */
maFillColor = mpOutputDevice->GetFillColor(); /* COL_WHITE */
meRasterOp = mpOutputDevice->GetRasterOp(); /* ROP_OVERPAINT */
}
void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags )
{
if(mpOutputDevice)
......@@ -136,7 +148,7 @@ void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags )
}
}
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXGraphics::getDevice() throw(::com::sun::star::uno::RuntimeException)
uno::Reference< awt::XDevice > VCLXGraphics::getDevice() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -149,11 +161,11 @@ void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags )
return mxDevice;
}
::com::sun::star::awt::SimpleFontMetric VCLXGraphics::getFontMetric() throw(::com::sun::star::uno::RuntimeException)
awt::SimpleFontMetric VCLXGraphics::getFontMetric() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
::com::sun::star::awt::SimpleFontMetric aM;
awt::SimpleFontMetric aM;
if( mpOutputDevice )
{
mpOutputDevice->SetFont( maFont );
......@@ -162,56 +174,104 @@ void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags )
return aM;
}
void VCLXGraphics::setFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::setFont( const uno::Reference< awt::XFont >& rxFont ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
maFont = VCLUnoHelper::CreateFont( rxFont );
}
void VCLXGraphics::selectFont( const ::com::sun::star::awt::FontDescriptor& rDescription ) throw(::com::sun::star::uno::RuntimeException)
uno::Reference< awt::XFont > VCLXGraphics::getFont() throw(uno::RuntimeException)
{
uno::Reference< awt::XFont > xFont;
uno::Reference< awt::XDevice > xDevice( getDevice() );
SolarMutexGuard aGuard;
if ( xDevice.is() )
{
VCLXFont *pFont = new VCLXFont;
pFont->Init( *xDevice.get(), maFont );
xFont.set( static_cast< ::cppu::OWeakObject* >( pFont ), uno::UNO_QUERY );
}
return xFont;
}
void VCLXGraphics::selectFont( const awt::FontDescriptor& rDescription ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
maFont = VCLUnoHelper::CreateFont( rDescription, Font() );
}
void VCLXGraphics::setTextColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::setTextColor( sal_Int32 nColor ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
maTextColor = Color( (sal_uInt32)nColor );
}
void VCLXGraphics::setTextFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
::sal_Int32 VCLXGraphics::getTextColor() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
return maTextColor.GetColor();
}
void VCLXGraphics::setTextFillColor( sal_Int32 nColor ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
maTextFillColor = Color( (sal_uInt32)nColor );
}
void VCLXGraphics::setLineColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
::sal_Int32 VCLXGraphics::getTextFillColor() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
return maTextFillColor.GetColor();
}
void VCLXGraphics::setLineColor( sal_Int32 nColor ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
maLineColor = Color( (sal_uInt32)nColor );
}
void VCLXGraphics::setFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
::sal_Int32 VCLXGraphics::getLineColor() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
return maLineColor.GetColor();
}
void VCLXGraphics::setFillColor( sal_Int32 nColor ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
maFillColor = Color( (sal_uInt32)nColor );
}
void VCLXGraphics::setRasterOp( ::com::sun::star::awt::RasterOperation eROP ) throw(::com::sun::star::uno::RuntimeException)
::sal_Int32 VCLXGraphics::getFillColor() throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
return maFillColor.GetColor();
}
void VCLXGraphics::setRasterOp( awt::RasterOperation eROP ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
meRasterOp = (RasterOp)eROP;
}
void VCLXGraphics::setClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
awt::RasterOperation VCLXGraphics::getRasterOp()
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
return (awt::RasterOperation) meRasterOp;
}
void VCLXGraphics::setClipRegion( const uno::Reference< awt::XRegion >& rxRegion ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -222,7 +282,7 @@ void VCLXGraphics::setClipRegion( const ::com::sun::star::uno::Reference< ::com:
mpClipRegion = NULL;
}
void VCLXGraphics::intersectClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::intersectClipRegion( const uno::Reference< awt::XRegion >& rxRegion ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -236,7 +296,7 @@ void VCLXGraphics::intersectClipRegion( const ::com::sun::star::uno::Reference<
}
}
void VCLXGraphics::push( ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::push( ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -245,7 +305,7 @@ void VCLXGraphics::push( ) throw(::com::sun::star::uno::RuntimeException)
mpOutputDevice->Push();
}
void VCLXGraphics::pop( ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::pop( ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -254,7 +314,20 @@ void VCLXGraphics::pop( ) throw(::com::sun::star::uno::RuntimeException)
mpOutputDevice->Pop();
}
void VCLXGraphics::copy( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >& rxSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::clear(
const awt::Rectangle& aRect )
throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
if( mpOutputDevice )
{
const ::Rectangle aVCLRect = VCLUnoHelper::ConvertToVCLRect( aRect );
mpOutputDevice->Erase( aVCLRect );
}
}
void VCLXGraphics::copy( const uno::Reference< awt::XDevice >& rxSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -271,14 +344,14 @@ void VCLXGraphics::copy( const ::com::sun::star::uno::Reference< ::com::sun::sta
}
}
void VCLXGraphics::draw( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap >& rxBitmapHandle, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::draw( const uno::Reference< awt::XDisplayBitmap >& rxBitmapHandle, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
if( mpOutputDevice )
{
InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP);
::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap( rxBitmapHandle, ::com::sun::star::uno::UNO_QUERY );
uno::Reference< awt::XBitmap > xBitmap( rxBitmapHandle, uno::UNO_QUERY );
BitmapEx aBmpEx = VCLUnoHelper::GetBitmap( xBitmap );
Point aPos(nDestX - nSourceX, nDestY - nSourceY);
......@@ -303,7 +376,7 @@ void VCLXGraphics::draw( const ::com::sun::star::uno::Reference< ::com::sun::sta
}
}
void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -314,7 +387,7 @@ void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star:
}
}
void VCLXGraphics::drawLine( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawLine( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -325,7 +398,7 @@ void VCLXGraphics::drawLine( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32
}
}
void VCLXGraphics::drawRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -336,7 +409,7 @@ void VCLXGraphics::drawRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int3
}
}
void VCLXGraphics::drawRoundedRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawRoundedRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -347,7 +420,7 @@ void VCLXGraphics::drawRoundedRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, s
}
}
void VCLXGraphics::drawPolyLine( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawPolyLine( const uno::Sequence< sal_Int32 >& DataX, const uno::Sequence< sal_Int32 >& DataY ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -358,7 +431,7 @@ void VCLXGraphics::drawPolyLine( const ::com::sun::star::uno::Sequence< sal_Int3
}
}
void VCLXGraphics::drawPolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawPolygon( const uno::Sequence< sal_Int32 >& DataX, const uno::Sequence< sal_Int32 >& DataY ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -369,7 +442,7 @@ void VCLXGraphics::drawPolygon( const ::com::sun::star::uno::Sequence< sal_Int32
}
}
void VCLXGraphics::drawPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataX, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataY ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawPolyPolygon( const uno::Sequence< uno::Sequence< sal_Int32 > >& DataX, const uno::Sequence< uno::Sequence< sal_Int32 > >& DataY ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -385,7 +458,7 @@ void VCLXGraphics::drawPolyPolygon( const ::com::sun::star::uno::Sequence< ::com
}
}
void VCLXGraphics::drawEllipse( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawEllipse( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -396,7 +469,7 @@ void VCLXGraphics::drawEllipse( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_I
}
}
void VCLXGraphics::drawArc( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawArc( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -407,7 +480,7 @@ void VCLXGraphics::drawArc( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32
}
}
void VCLXGraphics::drawPie( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawPie( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -418,7 +491,7 @@ void VCLXGraphics::drawPie( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32
}
}
void VCLXGraphics::drawChord( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawChord( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -429,7 +502,7 @@ void VCLXGraphics::drawChord( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int
}
}
void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, const ::com::sun::star::awt::Gradient& rGradient ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, const awt::Gradient& rGradient ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -448,7 +521,7 @@ void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_
}
}
void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const OUString& rText ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -459,7 +532,7 @@ void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const OUString& rText ) t
}
}
void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const OUString& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rLongs ) throw(::com::sun::star::uno::RuntimeException)
void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const OUString& rText, const uno::Sequence< sal_Int32 >& rLongs ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
......@@ -471,6 +544,18 @@ void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const OUString& rTex
}
void VCLXGraphics::drawImage( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int16 nStyle, const uno::Reference< graphic::XGraphic >& xGraphic ) throw(uno::RuntimeException)
{
SolarMutexGuard aGuard;
if( mpOutputDevice && xGraphic.is() )
{
Image aImage( xGraphic );
if ( !!aImage )
{
InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
mpOutputDevice->DrawImage( Point( x, y ), Size( width, height ), aImage, nStyle );
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment