xref: /aoo42x/main/sc/source/ui/inc/output.hxx (revision cdf0e10c)
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 
28*cdf0e10cSrcweir #ifndef SC_OUTPUT_HXX
29*cdf0e10cSrcweir #define SC_OUTPUT_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "address.hxx"
32*cdf0e10cSrcweir #include <tools/list.hxx>
33*cdf0e10cSrcweir #include <tools/color.hxx>
34*cdf0e10cSrcweir #include <tools/fract.hxx>
35*cdf0e10cSrcweir #include <com/sun/star/embed/XEmbeddedObject.hpp>
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir class Rectangle;
38*cdf0e10cSrcweir class Font;
39*cdf0e10cSrcweir class OutputDevice;
40*cdf0e10cSrcweir class Window;
41*cdf0e10cSrcweir class EditEngine;
42*cdf0e10cSrcweir class ScDocument;
43*cdf0e10cSrcweir class ScBaseCell;
44*cdf0e10cSrcweir class ScPatternAttr;
45*cdf0e10cSrcweir class SvxMarginItem;
46*cdf0e10cSrcweir class SdrObject;
47*cdf0e10cSrcweir class SdrOle2Obj;
48*cdf0e10cSrcweir struct RowInfo;
49*cdf0e10cSrcweir struct ScTableInfo;
50*cdf0e10cSrcweir class ScTabViewShell;
51*cdf0e10cSrcweir class ScPageBreakData;
52*cdf0e10cSrcweir class FmFormView;
53*cdf0e10cSrcweir class ScFieldEditEngine;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir // #i74769# SdrPaintWindow predefine
56*cdf0e10cSrcweir class SdrPaintWindow;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir // ---------------------------------------------------------------------------
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir #define SC_SCENARIO_HSPACE		60
61*cdf0e10cSrcweir #define SC_SCENARIO_VSPACE		50
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir // ---------------------------------------------------------------------------
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir #define SC_OBJECTS_NONE			0
66*cdf0e10cSrcweir #define SC_OBJECTS_DRAWING		1
67*cdf0e10cSrcweir #define SC_OBJECTS_OLE			2
68*cdf0e10cSrcweir #define SC_OBJECTS_CHARTS		4
69*cdf0e10cSrcweir #define SC_OBJECTS_ALL			( SC_OBJECTS_DRAWING | SC_OBJECTS_OLE | SC_OBJECTS_CHARTS )
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir enum ScOutputType { OUTTYPE_WINDOW, OUTTYPE_PRINTER };
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir class ScOutputData
74*cdf0e10cSrcweir {
75*cdf0e10cSrcweir friend class ScDrawStringsVars;
76*cdf0e10cSrcweir private:
77*cdf0e10cSrcweir     struct OutputAreaParam
78*cdf0e10cSrcweir     {
79*cdf0e10cSrcweir         Rectangle   maAlignRect;
80*cdf0e10cSrcweir         Rectangle   maClipRect;
81*cdf0e10cSrcweir         long        mnColWidth;
82*cdf0e10cSrcweir         bool        mbLeftClip;
83*cdf0e10cSrcweir         bool        mbRightClip;
84*cdf0e10cSrcweir     };
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 	OutputDevice* pDev;			// Device
87*cdf0e10cSrcweir 	OutputDevice* pRefDevice;	// printer if used for preview
88*cdf0e10cSrcweir 	OutputDevice* pFmtDevice;	// reference for text formatting
89*cdf0e10cSrcweir     ScTableInfo& mrTabInfo;
90*cdf0e10cSrcweir 	RowInfo* pRowInfo;			// Info-Block
91*cdf0e10cSrcweir 	SCSIZE nArrCount;			// belegte Zeilen im Info-Block
92*cdf0e10cSrcweir 	ScDocument* pDoc;			// Dokument
93*cdf0e10cSrcweir 	SCTAB nTab;				    // Tabelle
94*cdf0e10cSrcweir 	long nScrX; 				// Ausgabe Startpos. (Pixel)
95*cdf0e10cSrcweir 	long nScrY;
96*cdf0e10cSrcweir 	long nScrW; 				// Ausgabe Groesse (Pixel)
97*cdf0e10cSrcweir 	long nScrH;
98*cdf0e10cSrcweir 	long nMirrorW;				// Visible output width for mirroring (default: nScrW)
99*cdf0e10cSrcweir 	SCCOL nX1;					// Start-/Endkoordinaten
100*cdf0e10cSrcweir 	SCROW nY1;					//	( incl. versteckte )
101*cdf0e10cSrcweir 	SCCOL nX2;
102*cdf0e10cSrcweir 	SCROW nY2;
103*cdf0e10cSrcweir 	SCCOL nVisX1; 				// Start-/Endkoordinaten
104*cdf0e10cSrcweir 	SCROW nVisY1;				//	( sichtbarer Bereich )
105*cdf0e10cSrcweir 	SCCOL nVisX2;
106*cdf0e10cSrcweir 	SCROW nVisY2;
107*cdf0e10cSrcweir 	ScOutputType eType;			// Bildschirm/Drucker ...
108*cdf0e10cSrcweir 	double nPPTX;				// Pixel per Twips
109*cdf0e10cSrcweir 	double nPPTY;
110*cdf0e10cSrcweir //	sal_uInt16 nZoom;				// Zoom-Faktor (Prozent) - fuer GetFont
111*cdf0e10cSrcweir 	Fraction aZoomX;
112*cdf0e10cSrcweir 	Fraction aZoomY;
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 	SdrObject* pEditObj;		// beim Painten auslassen
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir 	ScTabViewShell* pViewShell;	// zum Connecten von sichtbaren Plug-Ins
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 	// #114135#
119*cdf0e10cSrcweir 	FmFormView* pDrawView;		// SdrView to paint to
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 	sal_Bool bEditMode;				// InPlace editierte Zelle - nicht ausgeben
122*cdf0e10cSrcweir 	SCCOL nEditCol;
123*cdf0e10cSrcweir 	SCROW nEditRow;
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 	sal_Bool bMetaFile;				// Ausgabe auf Metafile (nicht in Pixeln!)
126*cdf0e10cSrcweir 	sal_Bool bSingleGrid;			// beim Gitter bChanged auswerten
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	sal_Bool bPagebreakMode;		// Seitenumbruch-Vorschau
129*cdf0e10cSrcweir 	sal_Bool bSolidBackground;		// weiss statt transparent
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir 	sal_Bool bUseStyleColor;
132*cdf0e10cSrcweir 	sal_Bool bForceAutoColor;
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 	sal_Bool bSyntaxMode;			// Syntax-Highlighting
135*cdf0e10cSrcweir 	Color* pValueColor;
136*cdf0e10cSrcweir 	Color* pTextColor;
137*cdf0e10cSrcweir 	Color* pFormulaColor;
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 	Color	aGridColor;
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 	sal_Bool	bShowNullValues;
142*cdf0e10cSrcweir 	sal_Bool	bShowFormulas;
143*cdf0e10cSrcweir 	sal_Bool	bShowSpellErrors;	// Spell-Errors in EditObjekten anzeigen
144*cdf0e10cSrcweir 	sal_Bool	bMarkClipped;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 	sal_Bool	bSnapPixel;
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 	sal_Bool	bAnyRotated;		// intern
149*cdf0e10cSrcweir 	sal_Bool	bAnyClipped;		// intern
150*cdf0e10cSrcweir 	sal_Bool	bTabProtected;
151*cdf0e10cSrcweir 	sal_uInt8	nTabTextDirection;	// EEHorizontalTextDirection values
152*cdf0e10cSrcweir 	sal_Bool	bLayoutRTL;
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 	// #i74769# use SdrPaintWindow direct, remember it during BeginDrawLayers/EndDrawLayers
155*cdf0e10cSrcweir 	SdrPaintWindow*		mpTargetPaintWindow;
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 							// private methods
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 	sal_Bool			GetMergeOrigin( SCCOL nX, SCROW nY, SCSIZE nArrY,
160*cdf0e10cSrcweir 									SCCOL& rOverX, SCROW& rOverY, sal_Bool bVisRowChanged );
161*cdf0e10cSrcweir 	sal_Bool			IsEmptyCellText( RowInfo* pThisRowInfo, SCCOL nX, SCROW nY );
162*cdf0e10cSrcweir 	void			GetVisibleCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell );
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 	sal_Bool			IsAvailable( SCCOL nX, SCROW nY );
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 	void			GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY,
167*cdf0e10cSrcweir                                    SCCOL nCellX, SCROW nCellY, long nNeeded,
168*cdf0e10cSrcweir                                    const ScPatternAttr& rPattern,
169*cdf0e10cSrcweir                                    sal_uInt16 nHorJustify, bool bCellIsValue,
170*cdf0e10cSrcweir                                    bool bBreak, bool bOverwrite,
171*cdf0e10cSrcweir                                    OutputAreaParam& rParam );
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir     void            ShrinkEditEngine( EditEngine& rEngine, const Rectangle& rAlignRect,
174*cdf0e10cSrcweir                                     long nLeftM, long nTopM, long nRightM, long nBottomM,
175*cdf0e10cSrcweir                                     sal_Bool bWidth, sal_uInt16 nOrient, long nAttrRotate, sal_Bool bPixelToLogic,
176*cdf0e10cSrcweir                                     long& rEngineWidth, long& rEngineHeight, long& rNeededPixel,
177*cdf0e10cSrcweir                                     bool& rLeftClip, bool& rRightClip );
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 	void			SetSyntaxColor( Font* pFont, ScBaseCell* pCell );
180*cdf0e10cSrcweir 	void			SetEditSyntaxColor( EditEngine& rEngine, ScBaseCell* pCell );
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 	double			GetStretch();
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 	void			DrawRotatedFrame( const Color* pForceColor );		// pixel
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir     ScFieldEditEngine* CreateOutputEditEngine();
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir public:
189*cdf0e10cSrcweir 					ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType,
190*cdf0e10cSrcweir                                     ScTableInfo& rTabInfo, ScDocument* pNewDoc,
191*cdf0e10cSrcweir 									SCTAB nNewTab, long nNewScrX, long nNewScrY,
192*cdf0e10cSrcweir 									SCCOL nNewX1, SCROW nNewY1, SCCOL nNewX2, SCROW nNewY2,
193*cdf0e10cSrcweir 									double nPixelPerTwipsX, double nPixelPerTwipsY,
194*cdf0e10cSrcweir 									const Fraction* pZoomX = NULL,
195*cdf0e10cSrcweir 									const Fraction* pZoomY = NULL );
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 					~ScOutputData();
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir     void    SetContentDevice( OutputDevice* pContentDev );
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir 	void	SetRefDevice( OutputDevice* pRDev ) { pRefDevice = pFmtDevice = pRDev; }
202*cdf0e10cSrcweir 	void	SetFmtDevice( OutputDevice* pRDev ) { pFmtDevice = pRDev; }
203*cdf0e10cSrcweir 	void	SetEditObject( SdrObject* pObj )	{ pEditObj = pObj; }
204*cdf0e10cSrcweir 	void	SetViewShell( ScTabViewShell* pSh ) { pViewShell = pSh; }
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir 	// #114135#
207*cdf0e10cSrcweir 	void	SetDrawView( FmFormView* pNew )		{ pDrawView = pNew; }
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 	void	SetSolidBackground( sal_Bool bSet )		{ bSolidBackground = bSet; }
210*cdf0e10cSrcweir 	void	SetUseStyleColor( sal_Bool bSet )		{ bUseStyleColor = bSet; }
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 	void	SetEditCell( SCCOL nCol, SCROW nRow );
213*cdf0e10cSrcweir 	void	SetSyntaxMode( sal_Bool bNewMode );
214*cdf0e10cSrcweir 	void	SetMetaFileMode( sal_Bool bNewMode );
215*cdf0e10cSrcweir 	void	SetSingleGrid( sal_Bool bNewMode );
216*cdf0e10cSrcweir 	void	SetGridColor( const Color& rColor );
217*cdf0e10cSrcweir 	void	SetMarkClipped( sal_Bool bSet );
218*cdf0e10cSrcweir 	void	SetShowNullValues ( sal_Bool bSet = sal_True );
219*cdf0e10cSrcweir 	void	SetShowFormulas   ( sal_Bool bSet = sal_True );
220*cdf0e10cSrcweir 	void	SetShowSpellErrors( sal_Bool bSet = sal_True );
221*cdf0e10cSrcweir 	void	SetMirrorWidth( long nNew );
222*cdf0e10cSrcweir 	long	GetScrW() const		{ return nScrW; }
223*cdf0e10cSrcweir 	long	GetScrH() const		{ return nScrH; }
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 	void	SetSnapPixel( sal_Bool bSet = sal_True );
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 	void	DrawGrid( sal_Bool bGrid, sal_Bool bPage );
228*cdf0e10cSrcweir 	void	DrawStrings( sal_Bool bPixelToLogic = sal_False );
229*cdf0e10cSrcweir 	void	DrawBackground();
230*cdf0e10cSrcweir 	void	DrawShadow();
231*cdf0e10cSrcweir 	void	DrawExtraShadow(sal_Bool bLeft, sal_Bool bTop, sal_Bool bRight, sal_Bool bBottom);
232*cdf0e10cSrcweir 	void	DrawFrame();
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir 					// with logic MapMode set!
235*cdf0e10cSrcweir 	void	DrawEdit(sal_Bool bPixelToLogic);
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir 	void	FindRotated();
238*cdf0e10cSrcweir 	void	DrawRotated(sal_Bool bPixelToLogic);		// logisch
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 	void	DrawClear();
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 	// #i72502# printer only command set
243*cdf0e10cSrcweir 	Point PrePrintDrawingLayer(long nLogStX, long nLogStY );
244*cdf0e10cSrcweir 	void PostPrintDrawingLayer(const Point& rMMOffset); // #i74768# need offset for FormLayer
245*cdf0e10cSrcweir 	void PrintDrawingLayer(const sal_uInt16 nLayer, const Point& rMMOffset);
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir 	// nur Bildschirm:
248*cdf0e10cSrcweir 	void	DrawingSingle(const sal_uInt16 nLayer);
249*cdf0e10cSrcweir 	void	DrawSelectiveObjects(const sal_uInt16 nLayer);
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 	sal_Bool	SetChangedClip();		// sal_False = nix
252*cdf0e10cSrcweir     PolyPolygon GetChangedArea();
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 	void	FindChanged();
255*cdf0e10cSrcweir 	void	SetPagebreakMode( ScPageBreakData* pPageData );
256*cdf0e10cSrcweir #ifdef OLD_SELECTION_PAINT
257*cdf0e10cSrcweir     void    DrawMark( Window* pWin );
258*cdf0e10cSrcweir #endif
259*cdf0e10cSrcweir 	void	DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
260*cdf0e10cSrcweir 						 SCCOL nRefEndX, SCROW nRefEndY,
261*cdf0e10cSrcweir 						 const Color& rColor, sal_Bool bHandle );
262*cdf0e10cSrcweir 	void	DrawOneChange( SCCOL nRefStartX, SCROW nRefStartY,
263*cdf0e10cSrcweir 							SCCOL nRefEndX, SCROW nRefEndY,
264*cdf0e10cSrcweir 							const Color& rColor, sal_uInt16 nType );
265*cdf0e10cSrcweir 	void	DrawChangeTrack();
266*cdf0e10cSrcweir 	void	DrawClipMarks();
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 	void	DrawNoteMarks();
269*cdf0e10cSrcweir     void    AddPDFNotes();
270*cdf0e10cSrcweir };
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir #endif
275*cdf0e10cSrcweir 
276