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 CGM_OUTACT_HXX_
25 #define CGM_OUTACT_HXX_
26 
27 #include <com/sun/star/awt/Gradient.hpp>
28 #include <com/sun/star/drawing/XDrawPages.hpp>
29 #include <com/sun/star/drawing/XDrawPage.hpp>
30 #include <com/sun/star/drawing/XShape.hpp>
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <com/sun/star/beans/XPropertySet.hpp>
33 
34 
35 #define CGM_OUTACT_MAX_GROUP_LEVEL 64
36 
37 #include "cgm.hxx"
38 #include <chart.hxx>
39 #include <tools/poly.hxx>
40 
41 typedef struct NodeFrameSet
42 {
43 	Point		nTopLeft;
44 	Point		nBottomRight;
45 	::com::sun::star::awt::Size		nSize;
46 } NodeFrameSet;
47 
48 class CGM;
49 class VclGradient;
50 class CGMOutAct
51 {
52 	protected:
53 		sal_uInt16					mnCurrentPage;			// defaulted to zero
54 
55 		sal_uInt32					mnGroupActCount;		// grouping
56 		sal_uInt32					mnGroupLevel;
57 		sal_uInt32* 				mpGroupLevel;
58 
59 		sal_uInt16					mnIndex;				// figure
60 		sal_uInt8*					mpFlags;
61 		Point*					mpPoints;
62 		PolyPolygon				maPolyPolygon;
63 		::com::sun::star::awt::Gradient*			mpGradient;
64 
65 		CGM*					mpCGM;
66 
67 	public:
68 								CGMOutAct( CGM& rCGM );
69 	virtual						~CGMOutAct();
FirstOutPut()70 	virtual void				FirstOutPut() { mpCGM->mbFirstOutPut = sal_False; } ;
InsertPage()71 	virtual void				InsertPage() { mnCurrentPage++; } ;
BeginGroup()72 	virtual void				BeginGroup() {} ;
EndGroup()73 	virtual void				EndGroup() {};
EndGrouping()74 	virtual void				EndGrouping() {} ;
75 	void						BeginFigure() ;
76 	void						CloseRegion() ;
77 	void						NewRegion() ;
78 	void						EndFigure() ;
79 	void						RegPolyLine( Polygon&, sal_Bool bReverse = sal_False ) ;
80 	void						SetGradientOffset( long nHorzOfs, long nVertOfs, sal_uInt32 nType );
81 	void						SetGradientAngle( long nAngle );
82 	void						SetGradientDescriptor( sal_uInt32 nColorFrom, sal_uInt32 nColorTo );
83 	void						SetGradientStyle( sal_uInt32 nStyle, double fRatio );
DrawRectangle(FloatRect &)84 	virtual void				DrawRectangle( FloatRect& ) {} ;
DrawEllipse(FloatPoint &,FloatPoint &,double &)85 	virtual void				DrawEllipse( FloatPoint&, FloatPoint&, double& ) {} ;
DrawEllipticalArc(FloatPoint &,FloatPoint &,double &,sal_uInt32,double &,double &)86 	virtual void				DrawEllipticalArc( FloatPoint&, FloatPoint&, double&,
87 									sal_uInt32, double&, double&) {} ;
DrawBitmap(CGMBitmapDescriptor *)88 	virtual void				DrawBitmap( CGMBitmapDescriptor* ) {} ;
DrawPolygon(Polygon &)89 	virtual void				DrawPolygon( Polygon& ) {} ;
DrawPolyLine(Polygon &)90 	virtual void				DrawPolyLine( Polygon& ) {} ;
DrawPolybezier(Polygon &)91 	virtual void				DrawPolybezier( Polygon& ) {} ;
DrawPolyPolygon(PolyPolygon &)92 	virtual void				DrawPolyPolygon( PolyPolygon& ) {} ;
DrawText(::com::sun::star::awt::Point &,::com::sun::star::awt::Size &,char *,sal_uInt32,FinalFlag)93 	virtual void				DrawText( ::com::sun::star::awt::Point&, ::com::sun::star::awt::Size&, char*, sal_uInt32, FinalFlag ) {} ;
AppendText(char *,sal_uInt32,FinalFlag)94 	virtual void				AppendText( char*, sal_uInt32, FinalFlag ) {} ;
DrawText(TextEntry *,NodeFrameSet &,sal_uInt32)95 	virtual sal_uInt32				DrawText( TextEntry*, NodeFrameSet&, sal_uInt32 ) { return 0; } ;
DrawChart()96 	virtual void				DrawChart(){} ;
97 };
98 
99 class CGMImpressOutAct : public CGMOutAct
100 {
101 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > 				maXDrawPages;
102 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > 				maXDrawPage;
103 
104 //	::com::sun::star::uno::Reference< XServiceRegistry > 			maXServiceRegistry;
105 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > 		maXMultiServiceFactory;
106 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > 		maXServiceManagerSC;
107 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > 					maXShape;
108 	sal_Bool						ImplCreateShape( const ::rtl::OUString& rType );
109 
110 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >  			maXPropSet;
111 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > 					maXShapes;
112 
113 	sal_uInt32						nFinalTextCount;
114 
115 	sal_Bool						ImplInitPage();
116 	void						ImplSetOrientation( FloatPoint& RefPoint, double& Orientation ) ;
117 	void						ImplSetLineBundle() ;
118 	void						ImplSetFillBundle() ;
119 	void						ImplSetTextBundle( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & ) ;
120 public:
121 								CGMImpressOutAct( CGM&, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & ) ;
~CGMImpressOutAct()122 								~CGMImpressOutAct() {} ;
123 	virtual void				InsertPage() ;
124 	virtual void				BeginGroup() ;
125 	virtual void				EndGroup() ;
126 	virtual void				EndGrouping() ;
127 	virtual void				DrawRectangle( FloatRect& ) ;
128 	virtual void				DrawEllipse( FloatPoint& center, FloatPoint&, double& Orientation ) ;
129 	virtual void				DrawEllipticalArc( FloatPoint& center, FloatPoint& size, double& orientation,
130 									sal_uInt32 etype, double& startangle, double& endangle ) ;
131 	virtual void				DrawBitmap( CGMBitmapDescriptor* ) ;
132 	virtual void				DrawPolygon( Polygon& ) ;
133 	virtual void				DrawPolyLine( Polygon& ) ;
134 	virtual void				DrawPolybezier( Polygon& ) ;
135 	virtual void				DrawPolyPolygon( PolyPolygon& ) ;
136 	virtual void				DrawText( ::com::sun::star::awt::Point& TextRectPos, ::com::sun::star::awt::Size& TextRectSize, char* String, sal_uInt32 StringSize, FinalFlag ) ;
137 	virtual void				AppendText( char* String, sal_uInt32 StringSize, FinalFlag ) ;
138 	virtual sal_uInt32				DrawText( TextEntry*, NodeFrameSet&, sal_uInt32 ) ;
139 	virtual void				DrawChart();
140 };
141 
142 
143 #endif
144 
145