1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: outact.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_goodies.hxx"
35 #include <vcl/gradient.hxx>
37 using namespace ::com::sun::star
;
39 // ---------------------------------------------------------------
41 CGMOutAct::CGMOutAct( CGM
& rCGM
)
45 mnGroupActCount
= mnGroupLevel
= 0;
46 mpGroupLevel
= new sal_uInt32
[ CGM_OUTACT_MAX_GROUP_LEVEL
];
47 mpPoints
= (Point
*)new sal_Int8
[ 0x2000 * sizeof( Point
) ];
48 mpFlags
= new BYTE
[ 0x2000 ];
54 // ---------------------------------------------------------------
56 CGMOutAct::~CGMOutAct()
58 delete[] (sal_Int8
*) mpPoints
;
60 delete[] mpGroupLevel
;
66 // ---------------------------------------------------------------
68 void CGMOutAct::BeginFigure()
77 // ---------------------------------------------------------------
79 void CGMOutAct::CloseRegion()
84 DrawPolyPolygon( maPolyPolygon
);
85 maPolyPolygon
.Clear();
89 // ---------------------------------------------------------------
91 void CGMOutAct::NewRegion()
95 Polygon
aPolygon( mnIndex
, mpPoints
, mpFlags
);
96 maPolyPolygon
.Insert( aPolygon
);
101 // ---------------------------------------------------------------
103 void CGMOutAct::EndFigure()
106 DrawPolyPolygon( maPolyPolygon
);
107 maPolyPolygon
.Clear();
112 // ---------------------------------------------------------------
114 void CGMOutAct::RegPolyLine( Polygon
& rPolygon
, sal_Bool bReverse
)
116 USHORT nPoints
= rPolygon
.GetSize();
121 for ( USHORT i
= 0; i
< nPoints
; i
++ )
123 mpPoints
[ mnIndex
+ i
] = rPolygon
.GetPoint( nPoints
- i
- 1 );
124 mpFlags
[ mnIndex
+ i
] = (sal_Int8
)rPolygon
.GetFlags( nPoints
- i
- 1 );
129 for ( USHORT i
= 0; i
< nPoints
; i
++ )
131 mpPoints
[ mnIndex
+ i
] = rPolygon
.GetPoint( i
);
132 mpFlags
[ mnIndex
+ i
] = (sal_Int8
)rPolygon
.GetFlags( i
);
135 mnIndex
= mnIndex
+ nPoints
;
139 // ---------------------------------------------------------------
141 void CGMOutAct::SetGradientOffset( long nHorzOfs
, long nVertOfs
, sal_uInt32
/*nType*/ )
144 mpGradient
= new awt::Gradient
;
145 mpGradient
->XOffset
= ( (sal_uInt16
)nHorzOfs
& 0x7f );
146 mpGradient
->YOffset
= ( (sal_uInt16
)nVertOfs
& 0x7f );
149 // ---------------------------------------------------------------
151 void CGMOutAct::SetGradientAngle( long nAngle
)
154 mpGradient
= new awt::Gradient
;
155 mpGradient
->Angle
= sal::static_int_cast
< sal_Int16
>(nAngle
);
158 // ---------------------------------------------------------------
160 void CGMOutAct::SetGradientDescriptor( sal_uInt32 nColorFrom
, sal_uInt32 nColorTo
)
163 mpGradient
= new awt::Gradient
;
164 mpGradient
->StartColor
= nColorFrom
;
165 mpGradient
->EndColor
= nColorTo
;
168 // ---------------------------------------------------------------
170 void CGMOutAct::SetGradientStyle( sal_uInt32 nStyle
, double /*fRatio*/ )
173 mpGradient
= new awt::Gradient
;
178 mpGradient
->Style
= awt::GradientStyle_AXIAL
;
183 mpGradient
->Style
= awt::GradientStyle_RADIAL
; // CONICAL
188 mpGradient
->Style
= awt::GradientStyle_RECT
;
193 mpGradient
->Style
= awt::GradientStyle_ELLIPTICAL
;
198 mpGradient
->Style
= awt::GradientStyle_LINEAR
;