1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_OUTPUT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_OUTPUT_HXX
23 #include "address.hxx"
24 #include "cellvalue.hxx"
25 #include <tools/color.hxx>
26 #include <tools/fract.hxx>
27 #include <com/sun/star/embed/XEmbeddedObject.hpp>
28 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
31 struct SpellCheckContext
;
35 struct MisspellRanges
;
39 namespace vcl
{ class Font
; }
48 class ScPageBreakData
;
50 class ScFieldEditEngine
;
53 #define SC_SCENARIO_HSPACE 60
54 #define SC_SCENARIO_VSPACE 50
56 enum ScOutputType
{ OUTTYPE_WINDOW
, OUTTYPE_PRINTER
};
58 class ScFieldEditEngine
;
62 friend class ScDrawStringsVars
;
63 friend class ScGridWindow
;
65 struct OutputAreaParam
67 Rectangle maAlignRect
;
70 long mnLeftClipLength
; /// length of the string getting cut off on the left.
71 long mnRightClipLength
; /// length of the string getting cut off on the right.
79 SvxCellHorJustify meHorJustAttr
; ///< alignment attribute
80 SvxCellHorJustify meHorJustContext
; ///< context depending on attribute, content and direction
81 SvxCellHorJustify meHorJustResult
; ///< result for EditEngine
82 SvxCellVerJustify meVerJust
;
83 SvxCellJustifyMethod meHorJustMethod
;
84 SvxCellJustifyMethod meVerJustMethod
;
85 SvxCellOrientation meOrient
;
97 bool mbAsianVertical
:1;
98 bool mbPixelToLogic
:1;
99 bool mbHyphenatorSet
:1;
100 ScFieldEditEngine
* mpEngine
;
101 ScRefCellValue maCell
;
102 const ScPatternAttr
* mpPattern
;
103 const SfxItemSet
* mpCondSet
;
104 const SfxItemSet
* mpPreviewFontSet
;
105 const ScPatternAttr
* mpOldPattern
;
106 const SfxItemSet
* mpOldCondSet
;
107 const SfxItemSet
* mpOldPreviewFontSet
;
108 const RowInfo
* mpThisRowInfo
;
109 const std::vector
<editeng::MisspellRanges
>* mpMisspellRanges
;
111 explicit DrawEditParam(const ScPatternAttr
* pPattern
, const SfxItemSet
* pCondSet
, bool bCellIsValue
);
113 bool readCellContent(ScDocument
* pDoc
, bool bShowNullValues
, bool bShowFormulas
, bool bSyntaxMode
, bool bUseStyleColor
, bool bForceAutoColor
, bool& rWrapFields
);
114 void setPatternToEngine(bool bUseStyleColor
);
115 void calcMargins(long& rTop
, long& rLeft
, long& rBottom
, long& rRight
, double nPPTX
, double nPPTY
) const;
116 void calcPaperSize(Size
& rPaperSize
, const Rectangle
& rAlignRect
, double nPPTX
, double nPPTY
) const;
117 void getEngineSize(ScFieldEditEngine
* pEngine
, long& rWidth
, long& rHeight
) const;
118 bool hasLineBreak() const;
119 bool isHyperlinkCell() const;
122 * When the text is vertically oriented, the text is either rotated 90
123 * degrees to the right or 90 degrees to the left. Note that this is
124 * different from being vertically stacked.
126 bool isVerticallyOriented() const;
129 * Calculate offset position for vertically oriented (either
130 * top-bottom or bottom-top orientation) text.
132 * @param rLogicStart initial position in pixels. When the call is
133 * finished, this parameter will store the new
136 void calcStartPosForVertical(Point
& rLogicStart
, long nCellWidth
, long nEngineWidth
, long nTopM
, OutputDevice
* pRefDevice
);
138 void setAlignmentToEngine();
139 bool adjustHorAlignment(ScFieldEditEngine
* pEngine
);
141 void adjustForHyperlinkInPDF(Point aURLStart
, OutputDevice
* pDev
);
144 VclPtr
<OutputDevice
> mpDev
; // Device
145 VclPtr
<OutputDevice
> mpRefDevice
; // printer if used for preview
146 VclPtr
<OutputDevice
> pFmtDevice
; // reference for text formatting
147 ScTableInfo
& mrTabInfo
;
148 RowInfo
* pRowInfo
; // Info block
149 SCSIZE nArrCount
; // occupied lines in info block
150 ScDocument
* mpDoc
; // Document
152 long nScrX
; // Output Startpos. (Pixel)
154 long nScrW
; // Output size (Pixel)
156 long nMirrorW
; // Visible output width for mirroring (default: nScrW)
157 SCCOL nX1
; // Start-/End coordinates
158 SCROW nY1
; // ( incl. hidden )
161 SCCOL nVisX1
; // Start-/End coordinates
162 SCROW nVisY1
; // ( visible range )
165 ScOutputType eType
; // Screen/Printer ...
166 double mnPPTX
; // Pixel per Twips
171 SdrObject
* pEditObj
; // Omit when painting
173 ScTabViewShell
* pViewShell
; // for connect from visible plug-ins
176 FmFormView
* pDrawView
; // SdrView to paint to
178 bool bEditMode
; // InPlace edited cell - do not output
182 bool bMetaFile
; // Output to metafile (not pixels!)
183 bool bSingleGrid
; // beim Gitter bChanged auswerten
185 bool bPagebreakMode
; // Page break preview
186 bool bSolidBackground
; // white instead of transparant
188 bool mbUseStyleColor
;
189 bool mbForceAutoColor
;
191 bool mbSyntaxMode
; // Syntax highlighting
194 Color
* pFormulaColor
;
198 bool mbShowNullValues
;
200 bool bShowSpellErrors
; // Show spelling errors in EditObjects
205 bool bAnyRotated
; // internal
206 bool bAnyClipped
; // internal
208 sal_uInt8 nTabTextDirection
; // EEHorizontalTextDirection values
211 // #i74769# use SdrPaintWindow direct, remember it during BeginDrawLayers/EndDrawLayers
212 SdrPaintWindow
* mpTargetPaintWindow
;
213 const sc::SpellCheckContext
* mpSpellCheckCxt
;
217 bool GetMergeOrigin( SCCOL nX
, SCROW nY
, SCSIZE nArrY
,
218 SCCOL
& rOverX
, SCROW
& rOverY
, bool bVisRowChanged
);
219 bool IsEmptyCellText( RowInfo
* pThisRowInfo
, SCCOL nX
, SCROW nY
);
220 void GetVisibleCell( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, ScRefCellValue
& rCell
);
222 bool IsAvailable( SCCOL nX
, SCROW nY
);
224 void GetOutputArea( SCCOL nX
, SCSIZE nArrY
, long nPosX
, long nPosY
,
225 SCCOL nCellX
, SCROW nCellY
, long nNeeded
,
226 const ScPatternAttr
& rPattern
,
227 sal_uInt16 nHorJustify
, bool bCellIsValue
,
228 bool bBreak
, bool bOverwrite
,
229 OutputAreaParam
& rParam
);
231 void ShrinkEditEngine( EditEngine
& rEngine
, const Rectangle
& rAlignRect
,
232 long nLeftM
, long nTopM
, long nRightM
, long nBottomM
,
233 bool bWidth
, sal_uInt16 nOrient
, long nAttrRotate
, bool bPixelToLogic
,
234 long& rEngineWidth
, long& rEngineHeight
, long& rNeededPixel
,
235 bool& rLeftClip
, bool& rRightClip
);
237 void SetSyntaxColor( vcl::Font
* pFont
, const ScRefCellValue
& rCell
);
238 void SetEditSyntaxColor( EditEngine
& rEngine
, ScRefCellValue
& rCell
);
242 void DrawRotatedFrame( const Color
* pForceColor
); // pixel
244 drawinglayer::processor2d::BaseProcessor2D
* CreateProcessor2D( );
246 void DrawEditStandard(DrawEditParam
& rParam
);
247 void DrawEditBottomTop(DrawEditParam
& rParam
);
248 void DrawEditTopBottom(DrawEditParam
& rParam
);
249 void DrawEditStacked(DrawEditParam
& rParam
);
250 void DrawEditAsianVertical(DrawEditParam
& rParam
);
252 ScFieldEditEngine
* CreateOutputEditEngine();
254 void ShowClipMarks( DrawEditParam
& rParam
, long nEngineHeight
, const Size
& aCellSize
,
255 bool bMerged
, OutputAreaParam
& aAreaParam
);
257 bool Clip( DrawEditParam
& rParam
, const Size
& aCellSize
, OutputAreaParam
& aAreaParam
,
258 long nEngineHeight
, bool bWrapFields
);
261 ScOutputData( OutputDevice
* pNewDev
, ScOutputType eNewType
,
262 ScTableInfo
& rTabInfo
, ScDocument
* pNewDoc
,
263 SCTAB nNewTab
, long nNewScrX
, long nNewScrY
,
264 SCCOL nNewX1
, SCROW nNewY1
, SCCOL nNewX2
, SCROW nNewY2
,
265 double nPixelPerTwipsX
, double nPixelPerTwipsY
,
266 const Fraction
* pZoomX
= NULL
,
267 const Fraction
* pZoomY
= NULL
);
271 void SetSpellCheckContext( const sc::SpellCheckContext
* pCxt
);
272 void SetContentDevice( OutputDevice
* pContentDev
);
274 void SetRefDevice( OutputDevice
* pRDev
) { mpRefDevice
= pFmtDevice
= pRDev
; }
275 void SetFmtDevice( OutputDevice
* pRDev
) { pFmtDevice
= pRDev
; }
276 void SetEditObject( SdrObject
* pObj
) { pEditObj
= pObj
; }
277 void SetViewShell( ScTabViewShell
* pSh
) { pViewShell
= pSh
; }
280 void SetDrawView( FmFormView
* pNew
) { pDrawView
= pNew
; }
282 void SetSolidBackground( bool bSet
) { bSolidBackground
= bSet
; }
283 void SetUseStyleColor( bool bSet
) { mbUseStyleColor
= bSet
; }
285 void SetEditCell( SCCOL nCol
, SCROW nRow
);
286 void SetSyntaxMode( bool bNewMode
);
287 void SetMetaFileMode( bool bNewMode
);
288 void SetSingleGrid( bool bNewMode
);
289 void SetGridColor( const Color
& rColor
);
290 void SetMarkClipped( bool bSet
);
291 void SetShowNullValues ( bool bSet
= true );
292 void SetShowFormulas ( bool bSet
= true );
293 void SetShowSpellErrors( bool bSet
= true );
294 void SetMirrorWidth( long nNew
);
295 long GetScrW() const { return nScrW
; }
296 long GetScrH() const { return nScrH
; }
298 void SetSnapPixel( bool bSet
= true );
300 void DrawGrid( bool bGrid
, bool bPage
);
301 void DrawStrings( bool bPixelToLogic
= false );
303 /// Draw all strings, or provide Rectangle where the text (defined by rAddress) would be drawn.
304 Rectangle
LayoutStrings(bool bPixelToLogic
= false, bool bPaint
= true, const ScAddress
&rAddress
= ScAddress());
306 void DrawDocumentBackground();
307 void DrawBackground();
309 void DrawExtraShadow(bool bLeft
, bool bTop
, bool bRight
, bool bBottom
);
312 // with logic MapMode set!
313 void DrawEdit(bool bPixelToLogic
);
316 void DrawRotated(bool bPixelToLogic
); // logical
320 // #i72502# printer only command set
321 Point
PrePrintDrawingLayer(long nLogStX
, long nLogStY
);
322 void PostPrintDrawingLayer(const Point
& rMMOffset
); // #i74768# need offset for FormLayer
323 void PrintDrawingLayer(const sal_uInt16 nLayer
, const Point
& rMMOffset
);
326 void DrawingSingle(const sal_uInt16 nLayer
);
327 void DrawSelectiveObjects(const sal_uInt16 nLayer
);
329 bool SetChangedClip(); // sal_False = not
330 vcl::Region
GetChangedAreaRegion();
333 void SetPagebreakMode( ScPageBreakData
* pPageData
);
334 void DrawRefMark( SCCOL nRefStartX
, SCROW nRefStartY
,
335 SCCOL nRefEndX
, SCROW nRefEndY
,
336 const Color
& rColor
, bool bHandle
);
337 void DrawOneChange( SCCOL nRefStartX
, SCROW nRefStartY
,
338 SCCOL nRefEndX
, SCROW nRefEndY
,
339 const Color
& rColor
, sal_uInt16 nType
);
340 void DrawChangeTrack();
341 void DrawClipMarks();
343 void DrawNoteMarks();
349 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */