37 #include <kapplication.h> 
   38 #include <kcolorbutton.h> 
   40 #include <kfontdialog.h> 
   42 #include <kdeprintdialog.h> 
   45 #include <klineedit.h> 
   46 #include <knuminput.h> 
   47 #include <kcombobox.h> 
   49 #include <QtGui/QPainter> 
   50 #include <QtGui/QCheckBox> 
   51 #include <QtGui/QGroupBox> 
   52 #include <QtGui/QPrintDialog> 
   53 #include <QtGui/QPrinter> 
   54 #include <QtGui/QApplication> 
   56 #include <QtGui/QLabel> 
   57 #include <QtGui/QLayout> 
   58 #include <QtCore/QStringList> 
   72   KSharedConfigPtr config = KGlobal::config();
 
   73   KConfigGroup group(config, 
"Kate Print Settings");
 
   74   KConfigGroup margins(&group, 
"Margins");
 
   76   qreal left, right, top, bottom;
 
   77   printer.
getPageMargins(&left, &top, &right, &bottom, QPrinter::Millimeter);
 
   79   left = margins.readEntry(
"left", left);
 
   80   top = margins.readEntry(
"top", top);
 
   81   right = margins.readEntry(
"right", right);
 
   82   bottom = margins.readEntry(
"bottom", bottom);
 
   84   printer.
setPageMargins(left, top, right, bottom, QPrinter::Millimeter);
 
   89   KSharedConfigPtr config = KGlobal::config();
 
   90   KConfigGroup group(config, 
"Kate Print Settings");
 
   91   KConfigGroup margins(&group, 
"Margins");
 
   93   qreal left, right, top, bottom;
 
   94   printer.
getPageMargins(&left, &top, &right, &bottom, QPrinter::Millimeter);
 
   96   margins.writeEntry( 
"left", left);
 
   97   margins.writeEntry( 
"top", top);
 
   98   margins.writeEntry( 
"right", right);
 
   99   margins.writeEntry( 
"bottom", bottom);
 
  128     printDialog->setOption(QAbstractPrintDialog::PrintSelection, 
true);
 
  131   if ( printDialog->exec() )
 
  138     renderer.setPrinterFriendly(
true);
 
  147     uint pdmWidth = printer.
width();
 
  148     uint pdmHeight = printer.
height();
 
  152     uint maxWidth = pdmWidth;
 
  153     int headerWidth = pdmWidth;
 
  154     bool pageStarted = 
true;
 
  158     bool selectionOnly = (printDialog->printRange() == QAbstractPrintDialog::Selection);
 
  159     bool useGuide = kpts->printGuide();
 
  161     bool printLineNumbers = kpts->printLineNumbers();
 
  162     uint lineNumberWidth( 0 );
 
  165     QFont headerFont(kphf->font()); 
 
  167     bool useHeader = kphf->useHeader();
 
  168     QColor headerBgColor(kphf->headerBackground());
 
  169     QColor headerFgColor(kphf->headerForeground());
 
  170     uint headerHeight( 0 ); 
 
  172     bool headerDrawBg = 
false; 
 
  174     bool useFooter = kphf->useFooter();
 
  175     QColor footerBgColor(kphf->footerBackground());
 
  176     QColor footerFgColor(kphf->footerForeground());
 
  177     uint footerHeight( 0 ); 
 
  179     bool footerDrawBg = 
false; 
 
  182     renderer.config()->setSchema( kpl->colorScheme() );
 
  183     bool useBackground = kpl->useBackground();
 
  184     bool useBox = kpl->useBox();
 
  185     int boxWidth(kpl->boxWidth());
 
  186     QColor boxColor(kpl->boxColor());
 
  187     int innerMargin = useBox ? kpl->boxMargin() : 6;
 
  190     int maxHeight = (useBox ? pdmHeight-innerMargin : pdmHeight);
 
  191     uint currentPage( 1 );
 
  194     const int fontHeight = renderer.fontHeight();
 
  195     KTextEditor::Range selectionRange;
 
  206         selectionRange = doc->
activeView()->selectionRange();
 
  207         firstline = selectionRange.start().line();
 
  208         lastline = selectionRange.end().line();
 
  209         lineCount = firstline;
 
  212       if ( printLineNumbers )
 
  218         lineNumberWidth = renderer.currentFontMetrics().width( s );
 
  220         int _adj = renderer.currentFontMetrics().width( 
"5" );
 
  222         maxWidth -= (lineNumberWidth + _adj);
 
  223         xstart += lineNumberWidth + _adj;
 
  226       if ( useHeader || useFooter )
 
  235         KUser u (KUser::UseRealUserID);
 
  236         tags[
"u"] = u.loginName();
 
  238         tags[
"d"] = KGlobal::locale()->formatDateTime(dt, KLocale::ShortDate);
 
  239         tags[
"D"] =  KGlobal::locale()->formatDateTime(dt, KLocale::LongDate);
 
  240         tags[
"h"] =  KGlobal::locale()->formatTime(dt.
time(), 
false);
 
  241         tags[
"y"] =  KGlobal::locale()->formatDate(dt.
date(), KLocale::ShortDate);
 
  242         tags[
"Y"] =  KGlobal::locale()->formatDate(dt.
date(), KLocale::LongDate);
 
  243         tags[
"f"] =  doc->url().fileName();
 
  244         tags[
"U"] =  doc->url().pathOrUrl();
 
  248           tags[
"f"].prepend( s );
 
  249           tags[
"U"].prepend( s );
 
  252         QRegExp reTags( 
"%([dDfUhuyY])" ); 
 
  256           headerDrawBg = kphf->useHeaderBackground();
 
  258           if ( useBox || headerDrawBg )
 
  259             headerHeight += innerMargin * 2;
 
  263           headerTagList = kphf->headerFormat();
 
  264           QMutableStringListIterator it(headerTagList);
 
  265           while ( it.hasNext() ) {
 
  267             int pos = reTags.
indexIn( tag );
 
  271               rep = tags[reTags.
cap( 1 )];
 
  272               tag.
replace( (uint)pos, 2, rep );
 
  274               pos = reTags.
indexIn( tag, pos );
 
  279           if (!headerBgColor.isValid())
 
  280             headerBgColor = Qt::lightGray;
 
  281           if (!headerFgColor.isValid())
 
  282             headerFgColor = Qt::black;
 
  287           footerDrawBg = kphf->useFooterBackground();
 
  289           if ( useBox || footerDrawBg )
 
  290             footerHeight += 2*innerMargin;
 
  294           footerTagList = kphf->footerFormat();
 
  295           QMutableStringListIterator it(footerTagList);
 
  296           while ( it.hasNext() ) {
 
  298             int pos = reTags.
indexIn( tag );
 
  302               rep = tags[reTags.
cap( 1 )];
 
  303               tag.
replace( (uint)pos, 2, rep );
 
  305               pos = reTags.
indexIn( tag, pos );
 
  310           if (!footerBgColor.isValid())
 
  311             footerBgColor = Qt::lightGray;
 
  312           if (!footerFgColor.isValid())
 
  313             footerFgColor = Qt::black;
 
  315           maxHeight -= footerHeight;
 
  323           xstart += innerMargin;
 
  324           maxWidth -= innerMargin * 2;
 
  330         if (!boxColor.isValid())
 
  331           boxColor = Qt::black;
 
  335         maxWidth -= ( ( boxWidth + innerMargin )  * 2 );
 
  336         xstart += boxWidth + innerMargin;
 
  338         maxHeight -= boxWidth;
 
  348         kDebug(13020)<<
"'%P' found! calculating number of pages...";
 
  349         int pageHeight = maxHeight;
 
  351           pageHeight -= ( headerHeight + innerMargin );
 
  353           pageHeight -= innerMargin;
 
  354         const int linesPerPage = pageHeight / fontHeight;
 
  360         for (
unsigned int i = firstline; i <= lastline; ++i) {
 
  362           rangeptr->setLine(i);
 
  363           renderer.layoutLine(rangeptr, (
int)maxWidth, 
false);
 
  364           totalLines += rangeptr->viewLineCount();
 
  366         int totalPages = (totalLines / linesPerPage)
 
  367                       + ((totalLines % linesPerPage) > 0 ? 1 : 0);
 
  378         for ( it=headerTagList.
begin(); it!=headerTagList.
end(); ++it )
 
  379           (*it).replace( re, 
QString( 
"%1" ).arg( totalPages ) );
 
  380         for ( it=footerTagList.
begin(); it!=footerTagList.
end(); ++it )
 
  381           (*it).replace( re, 
QString( 
"%1" ).arg( totalPages ) );
 
  388     while (  lineCount <= lastline  )
 
  390       if ( y + fontHeight > maxHeight )
 
  392         kDebug(13020)<<
"Starting new page,"<<lineCount<<
"lines up to now.";
 
  404           paint.
setPen(headerFgColor);
 
  407             paint.
fillRect(0, 0, headerWidth, headerHeight, headerBgColor);
 
  408           if (headerTagList.
count() == 3)
 
  410             int valign = ( (useBox||headerDrawBg||useBackground) ?
 
  411             Qt::AlignVCenter : Qt::AlignTop );
 
  412             int align = valign|Qt::AlignLeft;
 
  413             int marg = ( useBox || headerDrawBg ) ? innerMargin : 0;
 
  414             if ( useBox ) marg += boxWidth;
 
  416             for (
int i=0; i<3; i++)
 
  418               s = headerTagList[i];
 
  420               paint.
drawText(marg, 0, headerWidth-(marg*2), headerHeight, align, s);
 
  421               align = valign|(i == 0 ? Qt::AlignHCenter : Qt::AlignRight);
 
  424           if ( ! ( headerDrawBg || useBox || useBackground ) ) 
 
  426             paint.
drawLine( 0, headerHeight-1, headerWidth, headerHeight-1 );
 
  429           y += headerHeight + innerMargin;
 
  434           paint.
setPen(footerFgColor);
 
  435           if ( ! ( footerDrawBg || useBox || useBackground ) ) 
 
  436             paint.
drawLine( 0, maxHeight + innerMargin - 1, headerWidth, maxHeight + innerMargin - 1 );
 
  438             paint.
fillRect(0, maxHeight+innerMargin+boxWidth, headerWidth, footerHeight, footerBgColor);
 
  439           if (footerTagList.
count() == 3)
 
  441             int align = Qt::AlignVCenter|Qt::AlignLeft;
 
  442             int marg = ( useBox || footerDrawBg ) ? innerMargin : 0;
 
  443             if ( useBox ) marg += boxWidth;
 
  445             for (
int i=0; i<3; i++)
 
  447               s = footerTagList[i];
 
  449               paint.
drawText(marg, maxHeight+innerMargin, headerWidth-(marg*2), footerHeight, align, s);
 
  450               align = Qt::AlignVCenter|(i == 0 ? Qt::AlignHCenter : Qt::AlignRight);
 
  459           int _y = y, _h = maxHeight - y;
 
  463             _h += 2 * innerMargin;
 
  477           paint.
fillRect( 0, _y, pdmWidth, _h, renderer.config()->backgroundColor());
 
  483           paint.
drawRect(0, 0, pdmWidth, pdmHeight);
 
  485             paint.
drawLine(0, headerHeight, headerWidth, headerHeight);
 
  490             paint.
fillRect( 0, maxHeight+innerMargin, headerWidth, boxWidth, boxColor );
 
  493         if ( useGuide && currentPage == 1 )
 
  505           QColor _defaultPen = _defaultAttributes.
at(0)->foreground().color();
 
  506           paint.
setPen(_defaultPen);
 
  510             _marg += (2*boxWidth) + (2*innerMargin);
 
  514               _marg += 2*innerMargin;
 
  516             y += 1 + innerMargin;
 
  520           QFont _titleFont = renderer.config()->font();
 
  524           paint.
drawText( 
QRect(_marg, y, pdmWidth-(2*_marg), maxHeight - y),
 
  525             Qt::AlignTop|Qt::AlignHCenter,
 
  526             i18n(
"Typographical Conventions for %1", _hlName ), &_r );
 
  527           int _w = pdmWidth - (_marg*2) - (innerMargin*2);
 
  528           int _x = _marg + innerMargin;
 
  529           y += _r.
height() + innerMargin;
 
  530           paint.
drawLine( _x, y, _x + _w, y );
 
  531           y += 1 + innerMargin;
 
  535             _widest = qMax(
QFontMetrics(attribute->font()).width(attribute->name().section(
':',1,1)), _widest);
 
  537           int _guideCols = _w/( _widest + innerMargin );
 
  540           int _cw = _w/_guideCols;
 
  549             if ( _hl != _hlName && _hl != _currentHlName ) {
 
  550               _currentHlName = _hl;
 
  555               paint.
setPen(_defaultPen);
 
  556               paint.
drawText( _x, y, _w, fontHeight, Qt::AlignTop, _hl + 
' ' + 
i18n(
"text") );
 
  561             KTextEditor::Attribute _attr =  *_defaultAttributes[attribute->defaultStyleIndex()];
 
  563             paint.
setPen( _attr.foreground().color() );
 
  566             if (_attr.hasProperty(QTextFormat::BackgroundBrush) ) {
 
  568               _rect.
moveTo(_x + ((_i%_guideCols)*_cw), y);
 
  569                paint.
fillRect(_rect, _attr.background() );
 
  572             paint.
drawText(( _x + ((_i%_guideCols)*_cw)), y, _cw, fontHeight, Qt::AlignTop, _name );
 
  575             if ( _i && ! ( _i%_guideCols ) )
 
  583           paint.
setPen ( _defaultPen );
 
  585             paint.
fillRect( 0, y+innerMargin, headerWidth, boxWidth, boxColor );
 
  589             paint.
drawRect( _marg, _ystart, pdmWidth-(2*_marg), y-_ystart+innerMargin );
 
  592           y += ( useBox ? boxWidth : 1 ) + (innerMargin*2);
 
  599       if ( printLineNumbers  ) 
 
  601         paint.
setFont( renderer.config()->font() );
 
  602         paint.
setPen( renderer.config()->lineNumberColor() );
 
  603         paint.
drawText( (( useBox || useBackground ) ? innerMargin : 0)-xstart, 0,
 
  604                     lineNumberWidth, fontHeight,
 
  605                     Qt::AlignRight, 
QString(
"%1").arg( lineCount + 1 ) );
 
  611       rangeptr->setLine(lineCount);
 
  612       renderer.layoutLine(rangeptr, (
int)maxWidth, 
false);
 
  618           int _x = renderer.cursorToX(rangeptr->viewLine(0), selectionRange.start());
 
  619           int _x1 = renderer.cursorToX(rangeptr->viewLine(rangeptr->viewLineCount()-1), selectionRange.end());
 
  625         else if (lineCount == firstline || lineCount == lastline) {
 
  626           QRegion region(0, 0, maxWidth, rangeptr->viewLineCount()*fontHeight);
 
  628           if ( lineCount == firstline) {
 
  629             region = region.
subtracted(
QRegion(0, 0, renderer.cursorToX(rangeptr->viewLine(0), selectionRange.start()), fontHeight));
 
  632           if (lineCount == lastline) {
 
  633             int _x = renderer.cursorToX(rangeptr->viewLine(rangeptr->viewLineCount()-1), selectionRange.end());
 
  643       int _lines = rangeptr->viewLineCount(); 
 
  645       int proceedLines = _lines;
 
  647         proceedLines = qMin((maxHeight - y) / fontHeight, remainder);
 
  649         paint.
translate(0, -(_lines-remainder)*fontHeight+1);
 
  650         paint.
setClipRect(0, (_lines-remainder)*fontHeight+1, maxWidth, proceedLines*fontHeight); 
 
  651         remainder -= proceedLines;
 
  653       else if (y + fontHeight * _lines > maxHeight) {
 
  654         remainder = _lines - ((maxHeight-y)/fontHeight);
 
  655         paint.
setClipRect(0, 0, maxWidth, (_lines-remainder)*fontHeight+1); 
 
  658       renderer.paintTextLine(paint, rangeptr, 0, (
int)maxWidth);
 
  661       paint.
translate(_xadjust, (fontHeight * (_lines-remainder)));
 
  663       y += fontHeight * proceedLines;
 
  684   cbLineNumbers = 
new QCheckBox( 
i18n(
"Print line &numbers"), 
this );
 
  696         "<p>If enabled, line numbers will be printed on the left side of the page(s).</p>") );
 
  698         "<p>Print a box displaying typographical conventions for the document type, as " 
  699         "defined by the syntax highlighting being used.</p>") );
 
  719 void KatePrintTextSettings::readSettings()
 
  721   KSharedConfigPtr config = KGlobal::config();
 
  722   KConfigGroup printGroup( config, 
"Kate Print Settings" );
 
  724   KConfigGroup textGroup( &printGroup, 
"Text" );
 
  725   bool isLineNumbersChecked = textGroup.readEntry( 
"LineNumbers", 
false );
 
  726   cbLineNumbers->
setChecked( isLineNumbersChecked );
 
  728   bool isLegendChecked = textGroup.readEntry( 
"Legend", 
false );
 
  732 void KatePrintTextSettings::writeSettings()
 
  734   KSharedConfigPtr config = KGlobal::config();
 
  735   KConfigGroup printGroup( config, 
"Kate Print Settings" );
 
  737   KConfigGroup textGroup( &printGroup, 
"Text" );
 
  739   textGroup.writeEntry( 
"Legend", 
printGuide() );
 
  757   cbEnableHeader = 
new QCheckBox( 
i18n(
"Pr&int header"), 
this );
 
  759   cbEnableFooter = 
new QCheckBox( 
i18n(
"Pri&nt footer"), 
this );
 
  766   lFontPreview = 
new QLabel( 
this );
 
  783   KHBox *hbHeaderFormat = 
new KHBox( gbHeader );
 
  786   leHeaderLeft = 
new KLineEdit( hbHeaderFormat );
 
  787   leHeaderCenter = 
new KLineEdit( hbHeaderFormat );
 
  788   leHeaderRight = 
new KLineEdit( hbHeaderFormat );
 
  789   lHeaderFormat->
setBuddy( leHeaderLeft );
 
  791   leHeaderLeft->setContextMenuPolicy(Qt::CustomContextMenu);
 
  792   leHeaderCenter->setContextMenuPolicy(Qt::CustomContextMenu);
 
  793   leHeaderRight->setContextMenuPolicy(Qt::CustomContextMenu);
 
  800   KHBox *hbHeaderColors = 
new KHBox( gbHeader );
 
  803   hbHeaderColors->setSpacing( -1 );
 
  805   kcbtnHeaderFg = 
new KColorButton( hbHeaderColors );
 
  806   lHeaderFgCol->
setBuddy( kcbtnHeaderFg );
 
  807   cbHeaderEnableBgColor = 
new QCheckBox( 
i18n(
"Bac&kground"), hbHeaderColors );
 
  808   kcbtnHeaderBg = 
new KColorButton( hbHeaderColors );
 
  819   KHBox *hbFooterFormat = 
new KHBox( gbFooter );
 
  822   hbFooterFormat->setSpacing( -1 );
 
  823   leFooterLeft = 
new KLineEdit( hbFooterFormat );
 
  824   leFooterCenter = 
new KLineEdit( hbFooterFormat );
 
  825   leFooterRight = 
new KLineEdit( hbFooterFormat );
 
  826   lFooterFormat->
setBuddy( leFooterLeft );
 
  828   leFooterLeft->setContextMenuPolicy(Qt::CustomContextMenu);
 
  829   leFooterCenter->setContextMenuPolicy(Qt::CustomContextMenu);
 
  830   leFooterRight->setContextMenuPolicy(Qt::CustomContextMenu);
 
  837   KHBox *hbFooterColors = 
new KHBox( gbFooter );
 
  840   hbFooterColors->setSpacing( -1 );
 
  842   kcbtnFooterFg = 
new KColorButton( hbFooterColors );
 
  843   lFooterBgCol->
setBuddy( kcbtnFooterFg );
 
  844   cbFooterEnableBgColor = 
new QCheckBox( 
i18n(
"&Background"), hbFooterColors );
 
  845   kcbtnFooterBg = 
new KColorButton( hbFooterColors );
 
  850   connect( cbEnableHeader, SIGNAL(toggled(
bool)), gbHeader, SLOT(
setEnabled(
bool)) );
 
  851   connect( cbEnableFooter, SIGNAL(toggled(
bool)), gbFooter, SLOT(
setEnabled(
bool)) );
 
  852   connect( cbHeaderEnableBgColor, SIGNAL(toggled(
bool)), kcbtnHeaderBg, SLOT(
setEnabled(
bool)) );
 
  853   connect( cbFooterEnableBgColor, SIGNAL(toggled(
bool)), kcbtnFooterBg, SLOT(
setEnabled(
bool)) );
 
  857   leHeaderLeft->setText( 
"%y" );
 
  858   leHeaderCenter->setText( 
"%f" );
 
  859   leHeaderRight->setText( 
"%p" );
 
  860   kcbtnHeaderFg->setColor( 
QColor(
"black") );
 
  862   kcbtnHeaderBg->setColor( 
QColor(
"lightgrey") );
 
  865   leFooterRight->setText( 
"%U" );
 
  866   kcbtnFooterFg->setColor( 
QColor(
"black") );
 
  868   kcbtnFooterBg->setColor( 
QColor(
"lightgrey") );
 
  871   QString  s = 
i18n(
"<p>Format of the page header. The following tags are supported:</p>");
 
  873       "<ul><li><tt>%u</tt>: current user name</li>" 
  874       "<li><tt>%d</tt>: complete date/time in short format</li>" 
  875       "<li><tt>%D</tt>: complete date/time in long format</li>" 
  876       "<li><tt>%h</tt>: current time</li>" 
  877       "<li><tt>%y</tt>: current date in short format</li>" 
  878       "<li><tt>%Y</tt>: current date in long format</li>" 
  879       "<li><tt>%f</tt>: file name</li>" 
  880       "<li><tt>%U</tt>: full URL of the document</li>" 
  881       "<li><tt>%p</tt>: page number</li>" 
  882       "<li><tt>%P</tt>: total amount of pages</li>" 
  884   leHeaderRight->setWhatsThis(s + s1 );
 
  885   leHeaderCenter->setWhatsThis(s + s1 );
 
  886   leHeaderLeft->setWhatsThis(s + s1 );
 
  887   s = 
i18n(
"<p>Format of the page footer. The following tags are supported:</p>");
 
  888   leFooterRight->setWhatsThis(s + s1 );
 
  889   leFooterCenter->setWhatsThis(s + s1 );
 
  890   leFooterLeft->setWhatsThis(s + s1 );
 
  902     return lFontPreview->
font();
 
  913   l << leHeaderLeft->text() << leHeaderCenter->text() << leHeaderRight->text();
 
  919   return kcbtnHeaderFg->color();
 
  924   return kcbtnHeaderBg->color();
 
  929   return cbHeaderEnableBgColor->
isChecked();
 
  940   l<< leFooterLeft->text() << leFooterCenter->text() << leFooterRight->text();
 
  946   return kcbtnFooterFg->color();
 
  951   return kcbtnFooterBg->color();
 
  956   return cbFooterEnableBgColor->
isChecked();
 
  963   if ( KFontDialog::getFont( fnt, KFontChooser::NoDisplayFlags, 
this ) == KFontDialog::Accepted )
 
  967     lFontPreview->
setText( 
QString(fnt.family() + 
", %1pt").arg( fnt.pointSize() ) );
 
  979   if (contextMenu == NULL) {
 
  986   menu->
setIcon(KIcon(
"list-add"));
 
  989   a = menu->
addAction(
i18n(
"Complete Date/Time (short format)") + 
"\t%d");
 
  991   a = menu->
addAction(
i18n(
"Complete Date/Time (long format)") + 
"\t%D");
 
  995   a = menu->
addAction(
i18n(
"Current Date (short format)") + 
"\t%y");
 
  997   a = menu->
addAction(
i18n(
"Current Date (long format)") + 
"\t%Y");
 
 1005   a = menu->
addAction(
i18n(
"Total Amount of Pages") + 
"\t%P");
 
 1012       lineEdit->
insert(placeHolder);
 
 1017 void KatePrintHeaderFooter::readSettings()
 
 1019   KSharedConfigPtr config = KGlobal::config();
 
 1020   KConfigGroup printGroup( config, 
"Kate Print Settings" );
 
 1023   KConfigGroup headerFooterGroup( &printGroup, 
"HeaderFooter" );
 
 1024   bool isHeaderEnabledChecked = headerFooterGroup.readEntry( 
"HeaderEnabled", 
true );
 
 1025   cbEnableHeader->
setChecked( isHeaderEnabledChecked );
 
 1027   QString headerFormatLeft = headerFooterGroup.readEntry( 
"HeaderFormatLeft", 
"%y" );
 
 1028   leHeaderLeft->setText( headerFormatLeft );
 
 1030   QString headerFormatCenter = headerFooterGroup.readEntry( 
"HeaderFormatCenter", 
"%f" );
 
 1031   leHeaderCenter->setText( headerFormatCenter );
 
 1033   QString headerFormatRight = headerFooterGroup.readEntry( 
"HeaderFormatRight", 
"%p" );
 
 1034   leHeaderRight->setText( headerFormatRight );
 
 1037   kcbtnHeaderFg->setColor( headerForeground );
 
 1039   bool isHeaderBackgroundChecked = headerFooterGroup.readEntry( 
"HeaderBackgroundEnabled", 
false );
 
 1040   cbHeaderEnableBgColor->
setChecked( isHeaderBackgroundChecked );
 
 1043   kcbtnHeaderBg->setColor( headerBackground );
 
 1046   bool isFooterEnabledChecked = headerFooterGroup.readEntry( 
"FooterEnabled", 
true );
 
 1047   cbEnableFooter->
setChecked( isFooterEnabledChecked );
 
 1049   QString footerFormatLeft = headerFooterGroup.readEntry( 
"FooterFormatLeft", 
QString() );
 
 1050   leFooterLeft->setText( footerFormatLeft );
 
 1052   QString footerFormatCenter = headerFooterGroup.readEntry( 
"FooterFormatCenter", 
QString() );
 
 1053   leFooterCenter->setText( footerFormatCenter );
 
 1055   QString footerFormatRight = headerFooterGroup.readEntry( 
"FooterFormatRight", 
"%U" );
 
 1056   leFooterRight->setText( footerFormatRight );
 
 1059   kcbtnFooterFg->setColor( footerForeground );
 
 1061   bool isFooterBackgroundChecked = headerFooterGroup.readEntry( 
"FooterBackgroundEnabled", 
false );
 
 1062   cbFooterEnableBgColor->
setChecked( isFooterBackgroundChecked );
 
 1065   kcbtnFooterBg->setColor( footerBackground );
 
 1068   QFont headerFooterFont = headerFooterGroup.readEntry( 
"HeaderFooterFont", 
QFont() );
 
 1069   lFontPreview->
setFont( headerFooterFont );
 
 1073 void KatePrintHeaderFooter::writeSettings()
 
 1075   KSharedConfigPtr config = KGlobal::config();
 
 1076   KConfigGroup printGroup( config, 
"Kate Print Settings" );
 
 1079   KConfigGroup headerFooterGroup( &printGroup, 
"HeaderFooter" );
 
 1080   headerFooterGroup.writeEntry( 
"HeaderEnabled", 
useHeader() );
 
 1083   headerFooterGroup.writeEntry( 
"HeaderFormatLeft", format[0] );
 
 1084   headerFooterGroup.writeEntry( 
"HeaderFormatCenter", format[1] );
 
 1085   headerFooterGroup.writeEntry( 
"HeaderFormatRight", format[2] );
 
 1091   headerFooterGroup.writeEntry( 
"FooterEnabled", 
useFooter() );
 
 1094   headerFooterGroup.writeEntry( 
"FooterFormatLeft", format[0] );
 
 1095   headerFooterGroup.writeEntry( 
"FooterFormatCenter", format[1] );
 
 1096   headerFooterGroup.writeEntry( 
"FooterFormatRight", format[2] );
 
 1102   headerFooterGroup.writeEntry( 
"HeaderFooterFont", 
font() );
 
 1118   KHBox *hb = 
new KHBox( 
this );
 
 1121   cmbSchema = 
new KComboBox( hb );
 
 1122   cmbSchema->setEditable( 
false );
 
 1125   cbDrawBackground = 
new QCheckBox( 
i18n(
"Draw bac&kground color"), 
this );
 
 1138   sbBoxWidth = 
new KIntSpinBox( gbBoxProps );
 
 1139   sbBoxWidth->setRange( 1, 100 );
 
 1140   sbBoxWidth->setSingleStep( 1 );
 
 1146   sbBoxMargin = 
new KIntSpinBox( gbBoxProps );
 
 1147   sbBoxMargin->setRange( 0, 100 );
 
 1148   sbBoxMargin->setSingleStep( 1 );
 
 1150   lBoxMargin->
setBuddy( sbBoxMargin );
 
 1154   kcbtnBoxColor = 
new KColorButton( gbBoxProps );
 
 1156   lBoxColor->
setBuddy( kcbtnBoxColor );
 
 1158   connect( cbEnableBox, SIGNAL(toggled(
bool)), gbBoxProps, SLOT(
setEnabled(
bool)) );
 
 1162   sbBoxMargin->setValue( 6 );
 
 1169   cmbSchema->setCurrentIndex (cmbSchema->findData (
QVariant(
"Printing")));
 
 1172   cmbSchema->setWhatsThis(
i18n(
 
 1173         "Select the color scheme to use for the print." ) );
 
 1175         "<p>If enabled, the background color of the editor will be used.</p>" 
 1176         "<p>This may be useful if your color scheme is designed for a dark background.</p>") );
 
 1178         "<p>If enabled, a box as defined in the properties below will be drawn " 
 1179         "around the contents of each page. The Header and Footer will be separated " 
 1180         "from the contents with a line as well.</p>") );
 
 1181   sbBoxWidth->setWhatsThis(
i18n(
 
 1182         "The width of the box outline" ) );
 
 1183   sbBoxMargin->setWhatsThis(
i18n(
 
 1184         "The margin inside boxes, in pixels") );
 
 1185   kcbtnBoxColor->setWhatsThis(
i18n(
 
 1186         "The line color to use for boxes") );
 
 1198   return cmbSchema->itemData(cmbSchema->currentIndex()).toString();
 
 1213   return sbBoxWidth->value();
 
 1218   return sbBoxMargin->value();
 
 1223   return kcbtnBoxColor->color();
 
 1226 void KatePrintLayout::readSettings()
 
 1228   KSharedConfigPtr config = KGlobal::config();
 
 1229   KConfigGroup printGroup(config, 
"Kate Print Settings");
 
 1231   KConfigGroup layoutGroup(&printGroup, 
"Layout");
 
 1235   int index = cmbSchema->findData (
QVariant (colorScheme));
 
 1237     cmbSchema->setCurrentIndex ( index );
 
 1239   bool isBackgroundChecked = layoutGroup.readEntry( 
"BackgroundColorEnabled", 
false );
 
 1240   cbDrawBackground->
setChecked( isBackgroundChecked );
 
 1242   bool isBoxChecked = layoutGroup.readEntry( 
"BoxEnabled", 
false );
 
 1245   int boxWidth = layoutGroup.readEntry( 
"BoxWidth", 1 );
 
 1246   sbBoxWidth->setValue( boxWidth );
 
 1248   int boxMargin = layoutGroup.readEntry( 
"BoxMargin", 6 );
 
 1249   sbBoxMargin->setValue( boxMargin );
 
 1252   kcbtnBoxColor->setColor( boxColor );
 
 1255 void KatePrintLayout::writeSettings()
 
 1257   KSharedConfigPtr config = KGlobal::config();
 
 1258   KConfigGroup printGroup(config, 
"Kate Print Settings");
 
 1260   KConfigGroup layoutGroup(&printGroup, 
"Layout");
 
 1261   layoutGroup.writeEntry( 
"ColorScheme", 
colorScheme() );
 
 1262   layoutGroup.writeEntry( 
"BackgroundColorEnabled", 
useBackground() );
 
 1263   layoutGroup.writeEntry( 
"BoxEnabled", 
useBox() );
 
 1264   layoutGroup.writeEntry( 
"BoxWidth", 
boxWidth() );
 
 1265   layoutGroup.writeEntry( 
"BoxMargin", 
boxMargin() );
 
 1266   layoutGroup.writeEntry( 
"BoxColor", 
boxColor() );
 
 1273 #include "kateprinter.moc" 
virtual const QString & documentName() const 
 
KateBuffer & buffer()
Get access to buffer of this document. 
 
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
 
void setSchema(const QString &schema)
 
QString cap(int nth) const
 
QScriptValue i18n(QScriptContext *context, QScriptEngine *engine)
i18n("text", arguments [optional]) 
 
QString & fill(QChar ch, int size)
 
void fillRect(const QRectF &rectangle, const QBrush &brush)
 
KateHighlighting * highlight() const 
 
virtual KTextEditor::View * activeView() const 
 
KSharedPtr< KateExtendedAttribute > Ptr
 
void setClipping(bool enable)
 
const T & at(int i) const
 
void setUnderline(bool enable)
 
QMenu * createStandardContextMenu()
 
static KateGlobal * self()
Kate Part Internal stuff ;) 
 
void setClipRegion(const QRegion ®ion, Qt::ClipOperation operation)
 
void setFrameStyle(int style)
 
void drawLine(const QLineF &line)
 
QString translatedName() const 
construct translated name for shipped schemas 
 
virtual QWidget * widget()
 
int lastLine() const 
gets the last line number (lines() - 1) 
 
void moveTo(int x, int y)
 
void setBuddy(QWidget *buddy)
 
void setBold(bool enable)
 
int indexIn(const QString &str, int offset, CaretMode caretMode) const
 
void drawRect(const QRectF &rectangle)
 
Handles all of the work of rendering the text (used for the views and printing) 
 
void setFont(const QFont &font)
 
QString number(int n, int base)
 
int count(const T &value) const
 
KatePrintLayout(QWidget *parent=0)
 
KateRendererConfig * config() const 
Configuration. 
 
QRegion subtracted(const QRegion &r) const
 
void setPen(const QColor &color)
 
virtual int lines() const 
 
void drawText(const QPointF &position, const QString &text)
 
void setDocName(const QString &name)
 
void setText(const QString &)
 
Class representing the folding information for a TextBuffer. 
 
void setData(const QVariant &userData)
 
void insert(const QString &newText)
 
void setPageMargins(qreal left, qreal top, qreal right, qreal bottom, Unit unit)
 
void getKateExtendedAttributeList(const QString &schema, QList< KateExtendedAttribute::Ptr > &, KConfig *cfg=0)
 
void getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, Unit unit) const
 
QString & replace(int position, int n, QChar after)
 
QDateTime currentDateTime()
 
void setClipRect(const QRectF &rectangle, Qt::ClipOperation operation)
 
static void writeSettings(QPrinter &printer)
 
void addStretch(int stretch)
 
void setTitle(const QString &title)
 
KatePrintTextSettings(QWidget *parent=0)
 
void translate(const QPointF &offset)
 
void getDefaults(const QString &schema, KateAttributeList &, KConfig *cfg=0)
 
QString section(QChar sep, int start, int end, QFlags< QString::SectionFlag > flags) const
 
void setPrintRange(PrintRange range)
 
static bool print(KateDocument *doc)
 
static void readSettings(QPrinter &printer)
 
const QString & name() const 
 
QStringList filter(const QString &str, Qt::CaseSensitivity cs) const
 
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
KateView * activeKateView() const 
 
KSharedPtr< KateLineLayout > KateLineLayoutPtr
 
static KateHlManager * self()
 
bool setStretchFactor(QWidget *widget, int stretch)
 
void addLayout(QLayout *layout, int stretch)