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