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