21#ifndef __kspread_sheetprint_h__
22#define __kspread_sheetprint_h__
26#include <koffice_export.h>
35class PrintNewPageEntry;
38class KSPREAD_EXPORT SheetPrint :
public TQObject
45 SheetPrint( Sheet *sheet );
48 TQString saveOasisSheetStyleLayout( KoGenStyles &mainStyles );
53 bool print( TQPainter &painter, KPrinter *_printer );
58 float prinsheetWidth()
const {
return m_paperWidth - m_leftBorder - m_rightBorder; }
63 float prinsheetWidthPts()
const {
return MM_TO_POINT( prinsheetWidth() / m_dZoom ); }
68 float prinsheetHeight()
const {
return m_paperHeight - m_topBorder - m_bottomBorder; }
73 float prinsheetHeightPts()
const {
return MM_TO_POINT( prinsheetHeight() / m_dZoom ); }
78 float paperHeight()
const {
return m_paperHeight; }
82 float paperHeightPts()
const {
return MM_TO_POINT( m_paperHeight / m_dZoom ); }
86 float paperWidth()
const {
return m_paperWidth; }
90 float paperWidthPts()
const {
return MM_TO_POINT( m_paperWidth / m_dZoom ); }
92 void setPaperHeight(
float _val) { m_paperHeight=_val; }
93 void setPaperWidth(
float _val) { m_paperWidth=_val; }
98 float leftBorder()
const {
return m_leftBorder; }
102 float leftBorderPts()
const {
return MM_TO_POINT( m_leftBorder / m_dZoom ); }
106 float rightBorder()
const {
return m_rightBorder; }
110 float rightBorderPts()
const {
return MM_TO_POINT( m_rightBorder / m_dZoom ); }
114 float topBorder()
const {
return m_topBorder; }
118 float topBorderPts()
const {
return MM_TO_POINT( m_topBorder / m_dZoom ); }
122 float bottomBorder()
const {
return m_bottomBorder; }
126 float bottomBorderPts()
const {
return MM_TO_POINT( m_bottomBorder / m_dZoom ); }
131 KoOrientation orientation()
const {
return m_orientation; }
135 const char* orientationString()
const;
140 KoFormat paperFormat()
const {
return m_paperFormat; }
144 TQString paperFormatString()
const;
146 void setPaperFormat(KoFormat _format) {m_paperFormat=_format;}
148 void setPaperOrientation(KoOrientation _orient);
153 KoPageLayout paperLayout()
const;
158 void setPaperLayout(
float _leftBorder,
float _topBorder,
float _rightBorder,
float _bottomBoder,
159 KoFormat _paper, KoOrientation orientation );
163 void setPaperLayout(
float _leftBorder,
float _topBorder,
float _rightBorder,
float _bottomBoder,
164 const TQString& _paper,
const TQString& _orientation );
166 TQString headLeft(
int _p,
const TQString &_t )
const {
if ( m_headLeft.isNull() )
return "";
167 return completeHeading( m_headLeft, _p, _t ); }
168 TQString headMid(
int _p,
const TQString &_t )
const {
if ( m_headMid.isNull() )
return "";
169 return completeHeading( m_headMid, _p, _t ); }
170 TQString headRight(
int _p,
const TQString &_t )
const {
if ( m_headRight.isNull() )
return "";
171 return completeHeading( m_headRight, _p, _t ); }
172 TQString footLeft(
int _p,
const TQString &_t )
const {
if ( m_footLeft.isNull() )
return "";
173 return completeHeading( m_footLeft, _p, _t ); }
174 TQString footMid(
int _p,
const TQString &_t )
const {
if ( m_footMid.isNull() )
return "";
175 return completeHeading( m_footMid, _p, _t ); }
176 TQString footRight(
int _p,
const TQString &_t )
const {
if ( m_footRight.isNull() )
return "";
177 return completeHeading( m_footRight, _p, _t ); }
179 TQString headLeft()
const {
if ( m_headLeft.isNull() )
return "";
return m_headLeft; }
180 TQString headMid()
const {
if ( m_headMid.isNull() )
return "";
return m_headMid; }
181 TQString headRight()
const {
if ( m_headRight.isNull() )
return "";
return m_headRight; }
182 TQString footLeft()
const {
if ( m_footLeft.isNull() )
return "";
return m_footLeft; }
183 TQString footMid()
const {
if ( m_footMid.isNull() )
return "";
return m_footMid; }
184 TQString footRight()
const {
if ( m_footRight.isNull() )
return "";
return m_footRight; }
190 TQRect printRange()
const {
return m_printRange; }
195 void setPrintRange(
const TQRect &_printRange );
201 int pageLimitX()
const {
return m_iPageLimitX; }
207 int pageLimitY()
const {
return m_iPageLimitY; }
214 void setPageLimitX(
int pages );
221 void setPageLimitY(
int pages );
226 void calculateZoomForPageLimitX();
231 void calculateZoomForPageLimitY();
237 TQPair<int, int> printRepeatColumns()
const {
return m_printRepeatColumns; }
243 void setPrintRepeatColumns( TQPair<int, int> _printRepeatColumns );
249 TQPair<int, int> printRepeatRows()
const {
return m_printRepeatRows; }
255 void setPrintRepeatRows( TQPair<int, int> _printRepeatRows );
262 bool isOnNewPageX(
int _column );
267 void updateNewPageX(
int _column );
274 bool isOnNewPageY(
int _row );
279 void updateNewPageY(
int _row );
284 void updateNewPageListX(
int _col );
289 void updateNewPageListY(
int _row );
297 void replaceHeadFootLineMacro ( TQString &_text,
const TQString &_search,
const TQString &_replace );
301 TQString localizeHeadFootLine (
const TQString &_text );
305 TQString delocalizeHeadFootLine (
const TQString &_text );
310 KoHeadFoot headFootLine()
const;
315 void setHeadFootLine(
const TQString &_headl,
const TQString &_headm,
const TQString &_headr,
316 const TQString &_footl,
const TQString &_footm,
const TQString &_footr );
321 bool printGrid()
const {
return m_bPrintGrid; }
326 void setPrintGrid(
bool _printGrid );
331 bool printObjects()
const {
return m_bPrintObjects; }
336 void setPrintObjects(
bool _printObjects );
341 bool printCharts()
const {
return m_bPrintCharts; }
346 void setPrintCharts(
bool _printCharts );
351 bool printGraphics()
const {
return m_bPrintGraphics; }
356 void setPrintGraphics(
bool _printGraphics );
361 bool printCommentIndicator()
const {
return m_bPrintCommentIndicator; }
366 void setPrintCommentIndicator(
bool _printCommentIndicator );
371 bool printFormulaIndicator()
const {
return m_bPrintFormulaIndicator; }
376 void setPrintFormulaIndicator(
bool _printFormulaIndicator );
381 void updatePrintRepeatColumnsWidth();
386 void updatePrintRepeatRowsHeight();
391 void definePrintRange(Selection* selectionInfo);
395 void resetPrintRange();
400 void insertColumn(
int col,
int nbCol );
404 void removeColumn(
int col,
int nbCol );
408 void insertRow(
int row,
int nbRow );
412 void removeRow(
int row,
int nbRow );
419 void setZoom(
double _zoom,
bool checkPageLimit =
true );
424 double zoom()
const {
return m_dZoom; }
429 bool pageNeedsPrinting( TQRect& page_range );
432 void sig_updateView( Sheet *_sheet );
454 void printPage( TQPainter &_painter,
const TQRect& page_range,
455 const KoRect& view,
const KoPoint _childOffset );
460 void printRect( TQPainter &painter,
const KoPoint& topLeft,
461 const TQRect& printRect,
const KoRect& view,
462 TQRegion &clipRegion );
467 void printHeaderFooter( TQPainter &painter,
int pageNo );
472 void calcPaperSize();
477 TQValueList<PrintNewPageEntry>::iterator findNewPageColumn(
int col );
482 TQValueList<PrintNewPageEntry>::iterator findNewPageRow(
int row );
491 TQString completeHeading(
const TQString &_data,
int _page,
const TQString &_sheet )
const ;
497 TQRect cellsPrintRange();
502 int pagesX(
const TQRect& cellsPrintRange );
507 int pagesY(
const TQRect& cellsPrintRange );
512 KoOrientation m_orientation;
516 KoFormat m_paperFormat;
542 float m_bottomBorder;
553 TQString m_headRight;
568 TQString m_footRight;
588 TQPair<int, int> m_printRepeatColumns;
593 TQPair<int, int> m_printRepeatRows;
603 bool m_bPrintObjects;
613 bool m_bPrintGraphics;
618 bool m_bPrintFormulaIndicator;
623 bool m_bPrintCommentIndicator;
628 double m_dPrintRepeatColumnsWidth;
632 double m_dPrintRepeatRowsHeight;
637 TQValueList<PrintNewPageEntry> m_lnewPageListX;
642 TQValueList<PrintNewPageEntry> m_lnewPageListY;
647 int m_maxCheckedNewPageX;
652 int m_maxCheckedNewPageY;
669 TQValueList<PrintObject*> m_printObjects;
673class PrintNewPageEntry
676 PrintNewPageEntry() :
677 m_iStartItem( 0 ), m_iEndItem( 0 ), m_dSize( 0 ),
680 PrintNewPageEntry(
int startItem,
int endItem = 0,
double size = 0,
681 double offset = 0 ) :
682 m_iStartItem( startItem ), m_iEndItem( endItem ), m_dSize( size ),
683 m_dOffset( offset ) {}
685 int startItem()
const {
return m_iStartItem; }
686 void setStartItem(
int startItem ) { m_iStartItem = startItem; }
688 int endItem()
const {
return m_iEndItem; }
689 void setEndItem(
int endItem ) { m_iEndItem = endItem; }
691 double size()
const {
return m_dSize; }
692 void setSize(
double size ) { m_dSize = size; }
694 double offset()
const {
return m_dOffset; }
695 void setOffset(
double offset ) { m_dOffset = offset; }
697 bool operator==( PrintNewPageEntry
const & entry )
const;
710 PrintObject() : obj(0), p(0) {}