1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef SC_PRINTFUN_HXX
30 #define SC_PRINTFUN_HXX
33 #include "pagepar.hxx"
34 #include "editutil.hxx"
36 #include <vcl/print.hxx>
47 class ScHeaderEditEngine
;
48 class ScPageBreakData
;
49 class ScPreviewLocationData
;
56 #define RANGENO_NORANGE USHRT_MAX
58 #define PRINT_HEADER_WIDTH (1.0 * TWIPS_PER_CM)
59 #define PRINT_HEADER_HEIGHT (12.8 * TWIPS_PER_POINT)
60 #define PRINT_HEADER_FONTHEIGHT 200
63 // Einstellungen fuer Kopf-/Fusszeilen
69 long nHeight
; // insgesamt (Hoehe+Abstand+Rahmen)
70 long nManHeight
; // eingestellte Groesse (Min. bei dynamisch)
72 sal_uInt16 nLeft
; // Raender
74 const ScPageHFItem
* pLeft
;
75 const ScPageHFItem
* pRight
;
76 const SvxBoxItem
* pBorder
;
77 const SvxBrushItem
* pBack
;
78 const SvxShadowItem
* pShadow
;
82 // "Ersatz" fuer SV-JobSetup:
87 ScJobSetup( SfxPrinter
* pPrinter
);
92 Orientation eOrientation
;
96 struct ScPrintState
// Variablen aus ScPrintFunc retten
119 //! Anzahl wirklich sichtbarer cachen???
122 ScPageRowEntry() { nStartRow
= nEndRow
= 0; nPagesX
= 0; pHidden
= NULL
; }
123 ~ScPageRowEntry() { delete[] pHidden
; }
125 ScPageRowEntry(const ScPageRowEntry
& r
);
126 const ScPageRowEntry
& operator=(const ScPageRowEntry
& r
);
128 SCROW
GetStartRow() const { return nStartRow
; }
129 SCROW
GetEndRow() const { return nEndRow
; }
130 size_t GetPagesX() const { return nPagesX
; }
131 void SetStartRow(SCROW n
) { nStartRow
= n
; }
132 void SetEndRow(SCROW n
) { nEndRow
= n
; }
134 void SetPagesX(size_t nNew
);
135 void SetHidden(size_t nX
);
136 sal_Bool
IsHidden(size_t nX
) const;
138 size_t CountVisible() const;
144 ScDocShell
* pDocShell
;
146 SfxPrinter
* pPrinter
;
148 FmFormView
* pDrawView
;
150 MapMode aOldPrinterMode
; // MapMode vor dem Aufruf
152 Point aSrcOffset
; // Papier-1/100 mm
153 Point aOffset
; // mit Faktor aus Seitenformat skaliert
154 sal_uInt16 nManualZoom
; // Zoom in Preview (Prozent)
155 sal_Bool bClearWin
; // Ausgabe vorher loeschen
156 sal_Bool bUseStyleColor
;
160 long nPageStart
; // Offset fuer erste Seite
161 long nDocPages
; // Seiten im Dokument
163 const ScRange
* pUserArea
; // Selektion, wenn im Dialog eingestellt
165 const SfxItemSet
* pParamSet
; // eingestellte Vorlage
166 sal_Bool bState
; // aus State-struct erzeugt
168 // Parameter aus Vorlage:
169 sal_uInt16 nLeftMargin
;
170 sal_uInt16 nTopMargin
;
171 sal_uInt16 nRightMargin
;
172 sal_uInt16 nBottomMargin
;
176 sal_Bool bSourceRangeValid
;
178 sal_uInt16 nPageUsage
;
179 Size aPageSize
; // Drucker-Twips
180 const SvxBoxItem
* pBorderItem
;
181 const SvxBrushItem
* pBackgroundItem
;
182 const SvxShadowItem
* pShadowItem
;
184 ScRange aLastSourceRange
;
187 ScPageTableParam aTableParam
;
188 ScPageAreaParam aAreaParam
;
192 sal_Bool bPrintCurrentTable
;
197 Rectangle aPageRect
; // Dokument-Twips
199 MapMode aLogicMode
; // in DoPrint gesetzt
205 SCCOL nRepeatStartCol
;
207 SCROW nRepeatStartRow
;
215 SCCOL
* pPageEndX
; // Seitenaufteilung
217 ScPageRowEntry
* pPageRows
;
222 ScHeaderEditEngine
* pEditEngine
;
223 SfxItemSet
* pEditDefaults
;
225 ScHeaderFieldData aFieldData
;
227 std::vector
<ScAddress
> aNotePosList
; // Reihenfolge der Notizen
229 ScPageBreakData
* pPageData
; // zum Eintragen der Umbrueche etc.
232 ScPrintFunc( ScDocShell
* pShell
, SfxPrinter
* pNewPrinter
, SCTAB nTab
,
233 long nPage
= 0, long nDocP
= 0,
234 const ScRange
* pArea
= NULL
,
235 const ScPrintOptions
* pOptions
= NULL
,
236 ScPageBreakData
* pData
= NULL
);
238 // ctors for device other than printer - for preview and pdf:
240 ScPrintFunc( OutputDevice
* pOutDev
, ScDocShell
* pShell
, SCTAB nTab
,
241 long nPage
= 0, long nDocP
= 0,
242 const ScRange
* pArea
= NULL
,
243 const ScPrintOptions
* pOptions
= NULL
);
245 ScPrintFunc( OutputDevice
* pOutDev
, ScDocShell
* pShell
,
246 const ScPrintState
& rState
,
247 const ScPrintOptions
* pOptions
);
251 static void DrawToDev( ScDocument
* pDoc
, OutputDevice
* pDev
, double nPrintFactor
,
252 const Rectangle
& rBound
, ScViewData
* pViewData
, sal_Bool bMetaFile
);
254 void SetDrawView( FmFormView
* pNew
);
256 void SetOffset( const Point
& rOfs
);
257 void SetManualZoom( sal_uInt16 nNewZoom
);
258 void SetDateTime( const Date
& rDate
, const Time
& rTime
);
260 void SetClearFlag( sal_Bool bFlag
);
261 void SetUseStyleColor( sal_Bool bFlag
);
262 void SetRenderFlag( sal_Bool bFlag
);
264 void SetExclusivelyDrawOleAndDrawObjects();//for printing selected objects without surrounding cell contents
266 sal_Bool
UpdatePages();
268 void ApplyPrintSettings(); // aus DoPrint() schon gerufen
269 long DoPrint( const MultiSelection
& rPageRanges
,
270 long nStartPage
, long nDisplayStart
, bool bDoPrint
,
271 SfxProgress
* pProgress
, ScPreviewLocationData
* pLocationData
);
273 // Werte abfragen - sofort
275 Size
GetPageSize() const { return aPageSize
; }
276 Size
GetDataSize() const;
277 void GetScaleData( Size
& rPhysSize
, long& rDocHdr
, long& rDocFtr
);
278 long GetFirstPageNo() const { return aTableParam
.nFirstPageNo
; }
280 // letzte Werte abfragen - nach DoPrint !!!
282 double GetScaleX() const { return nScaleX
; }
283 double GetScaleY() const { return nScaleY
; }
284 long GetTotalPages() const { return nTotalPages
; }
285 sal_uInt16
GetZoom() const { return nZoom
; }
287 void ResetBreaks( SCTAB nTab
);
289 void GetPrintState( ScPrintState
& rState
);
290 sal_Bool
GetLastSourceRange( ScRange
& rRange
) const;
291 sal_uInt16
GetLeftMargin() const{return nLeftMargin
;}
292 sal_uInt16
GetRightMargin() const{return nRightMargin
;}
293 sal_uInt16
GetTopMargin() const{return nTopMargin
;}
294 sal_uInt16
GetBottomMargin() const{return nBottomMargin
;}
295 void SetLeftMargin(sal_uInt16 nRulerLeftDistance
){ nLeftMargin
= nRulerLeftDistance
; }
296 void SetRightMargin(sal_uInt16 nRulerRightDistance
){ nRightMargin
= nRulerRightDistance
; }
297 void SetTopMargin(sal_uInt16 nRulerTopDistance
){ nTopMargin
= nRulerTopDistance
; }
298 void SetBottomMargin(sal_uInt16 nRulerBottomDistance
){ nBottomMargin
= nRulerBottomDistance
; }
299 ScPrintHFParam
GetHeader(){return aHdr
;}
300 ScPrintHFParam
GetFooter(){return aFtr
;}
303 void Construct( const ScPrintOptions
* pOptions
);
304 void InitParam( const ScPrintOptions
* pOptions
);
305 void CalcZoom( sal_uInt16 nRangeNo
);
308 long CountNotePages();
310 sal_Bool
AdjustPrintArea( sal_Bool bNew
);
312 Size
GetDocPageSize();
314 long TextHeight( const EditTextObject
* pObject
);
315 void MakeEditEngine();
316 void UpdateHFHeight( ScPrintHFParam
& rParam
);
320 sal_Bool
IsLeft( long nPageNo
);
321 sal_Bool
IsMirror( long nPageNo
);
322 void ReplaceFields( long nPageNo
); // aendert Text in pEditEngine
323 void MakeTableString(); // setzt aTableStr
325 void PrintPage( long nPageNo
,
326 SCCOL nX1
, SCROW nY1
, SCCOL nX2
, SCROW nY2
,
327 sal_Bool bDoPrint
, ScPreviewLocationData
* pLocationData
);
328 void PrintArea( SCCOL nX1
, SCROW nY1
, SCCOL nX2
, SCROW nY2
,
329 long nScrX
, long nScrY
,
330 sal_Bool bShLeft
, sal_Bool bShTop
, sal_Bool bShRight
, sal_Bool bShBottom
);
331 void LocateArea( SCCOL nX1
, SCROW nY1
, SCCOL nX2
, SCROW nY2
,
332 long nScrX
, long nScrY
, sal_Bool bRepCol
, sal_Bool bRepRow
,
333 ScPreviewLocationData
& rLocationData
);
334 void PrintColHdr( SCCOL nX1
, SCCOL nX2
, long nScrX
, long nScrY
);
335 void PrintRowHdr( SCROW nY1
, SCROW nY2
, long nScrX
, long nScrY
);
336 void LocateColHdr( SCCOL nX1
, SCCOL nX2
, long nScrX
, long nScrY
,
337 sal_Bool bRepCol
, ScPreviewLocationData
& rLocationData
);
338 void LocateRowHdr( SCROW nY1
, SCROW nY2
, long nScrX
, long nScrY
,
339 sal_Bool bRepRow
, ScPreviewLocationData
& rLocationData
);
340 void PrintHF( long nPageNo
, sal_Bool bHeader
, long nStartY
,
341 sal_Bool bDoPrint
, ScPreviewLocationData
* pLocationData
);
343 long PrintNotes( long nPageNo
, long nNoteStart
, sal_Bool bDoPrint
, ScPreviewLocationData
* pLocationData
);
344 long DoNotes( long nNoteStart
, sal_Bool bDoPrint
, ScPreviewLocationData
* pLocationData
);
346 void DrawBorder( long nScrX
, long nScrY
, long nScrW
, long nScrH
,
347 const SvxBoxItem
* pBorderData
,
348 const SvxBrushItem
* pBackground
,
349 const SvxShadowItem
* pShadow
);
358 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */