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