36#include <tqcheckbox.h>
41#include <tqfontdatabase.h>
42#include <tqradiobutton.h>
44#include <tqwhatsthis.h>
46#include <kcolorbutton.h>
51#include <tdemessagebox.h>
52#include <knumvalidator.h>
54#include <KoUnitWidgets.h>
56#include "kspread_canvas.h"
57#include "kspread_dlg_layout.h"
58#include "kspread_locale.h"
59#include "kspread_sheet.h"
60#include "kspread_style.h"
61#include "kspread_style_manager.h"
62#include "kspread_undo.h"
63#include "kspread_util.h"
64#include "manipulator.h"
66#include "valueformatter.h"
76PatternSelect::PatternSelect( TQWidget *parent,
const char * )
79 penStyle = TQt::NoPen;
81 penColor = colorGroup().text();
86void PatternSelect::setPattern(
const TQColor &_color,
int _width, TQt::PenStyle _style )
94void PatternSelect::setUndefined()
99void PatternSelect::paintEvent( TQPaintEvent *_ev )
101 TQFrame::paintEvent( _ev );
103 TQPainter painter(
this );
107 TQPen pen( penColor, penWidth, penStyle);
108 painter.setPen( pen );
109 painter.drawLine( 6, height()/2, width() - 6,height()/2 );
113 painter.fillRect( 2, 2, width() - 4, height() - 4, BDiagPattern );
117void PatternSelect::mousePressEvent( TQMouseEvent * )
121 emit clicked(
this );
124void PatternSelect::slotUnselect()
129 setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
133void PatternSelect::slotSelect()
138 setFrameStyle( TQFrame::Panel | TQFrame::Plain );
151 : TQWidget( parent ),
154 TQGridLayout * layout =
new TQGridLayout(
this, 1, 1, KDialog::marginHint(), KDialog::spacingHint(),
"layout");
156 TQGroupBox * groupBox =
new TQGroupBox(
this,
"groupBox1" );
157 groupBox->setColumnLayout(0, TQt::Vertical );
158 groupBox->setTitle( i18n(
"Style" ) );
159 groupBox->layout()->setSpacing( KDialog::spacingHint() );
160 groupBox->layout()->setMargin( KDialog::marginHint() );
162 TQGridLayout * groupBoxLayout =
new TQGridLayout( groupBox->layout() );
163 groupBoxLayout->setAlignment( TQt::AlignTop );
165 TQLabel * label1 =
new TQLabel( groupBox,
"label1" );
166 label1->setText( i18n(
"Name:" ) );
167 groupBoxLayout->addWidget( label1, 0, 0 );
169 m_nameEdit =
new KLineEdit( groupBox,
"m_nameEdit" );
170 m_nameEdit->setText( m_dlg->styleName );
171 groupBoxLayout->addWidget( m_nameEdit, 0, 1 );
173 TQLabel * label2 =
new TQLabel( groupBox,
"label2" );
174 label2->setText( i18n(
"Inherit style:" ) );
175 groupBoxLayout->addWidget( label2, 1, 0 );
177 m_parentBox =
new KComboBox(
false, groupBox,
"m_parentBox" );
178 m_parentBox->clear();
179 m_parentBox->insertItem( i18n(
"<None>" ) );
180 TQStringList tmp = m_dlg->getStyleManager()->styleNames();
181 tmp.remove( m_dlg->styleName );
182 m_parentBox->insertStringList( tmp );
184 if ( m_dlg->getStyle()->parent() )
185 m_parentBox->setCurrentText( m_dlg->getStyle()->parentName() );
188 m_parentBox->setCurrentText( i18n(
"<None>" ) );
190 if ( m_dlg->getStyle()->definesAll() )
191 m_parentBox->setEnabled(
false );
194 connect( m_parentBox, TQ_SIGNAL( textChanged(
const TQString & ) ),
this, TQ_SLOT( slotNewParent(
const TQString & ) ) );
195 connect( m_nameEdit, TQ_SIGNAL( lostFocus() ),
this, TQ_SLOT( slotNameChanged() ) );
197 groupBoxLayout->addWidget( m_parentBox, 1, 1 );
199 TQSpacerItem * spacer =
new TQSpacerItem( 20, 260, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
201 layout->addWidget( groupBox, 0, 0 );
202 layout->addItem( spacer, 1, 0 );
206 m_nameEdit->setEnabled(
false );
207 m_parentBox->setEnabled(
false );
210 resize( TQSize( 534, 447 ).expandedTo(minimumSizeHint()) );
213GeneralTab::~GeneralTab()
217void GeneralTab::slotNameChanged()
222void GeneralTab::slotNewParent(
const TQString & parentName )
224 kdDebug() <<
"New Parent" << endl;
225 if ( !checkParent( parentName ) )
228 if ( parentName.isEmpty() || parentName == i18n(
"<None>" ) )
229 m_dlg->getStyle()->setParent( 0 );
231 m_dlg->getStyle()->setParent( m_dlg->getStyleManager()->style( parentName ) );
237bool GeneralTab::checkName()
239 if ( m_nameEdit->isEnabled() )
241 if ( !m_dlg->getStyleManager()->validateStyleName( m_nameEdit->text(), m_dlg->getStyle() ) )
243 KMessageBox::sorry(
this, i18n(
"A style with this name already exists." ) );
251bool GeneralTab::checkParent(
const TQString & parentName )
253 if ( m_dlg->getStyle()->parentName() != parentName
254 && m_parentBox->isEnabled() && parentName != i18n(
"<None>" ) && !parentName.isEmpty() )
256 if ( m_nameEdit->text() == parentName )
258 KMessageBox::sorry(
this, i18n(
"A style cannot inherit from itself." ) );
261 if ( !m_dlg->checkCircle( m_nameEdit->text(), parentName ) )
263 KMessageBox::sorry(
this,
264 i18n(
"The style cannot inherit from '%1' because of recursive references." )
265 .arg( m_parentBox->currentText() ) );
269 CustomStyle * p = m_dlg->getStyleManager()->style( parentName );
273 KMessageBox::sorry(
this, i18n(
"The parent style does not exist." ) );
283 if ( !checkParent( m_parentBox->currentText() ) )
289 if ( m_nameEdit->isEnabled() )
293 TQString name( style->name() );
294 style->setName( m_nameEdit->text() );
295 if ( m_parentBox->isEnabled() )
297 if ( m_parentBox->currentText() == i18n(
"None" ) || m_parentBox->currentText().isEmpty() )
298 style->setParent( 0 );
300 style->setParent( m_dlg->getStyleManager()->style( m_parentBox->currentText() ) );
302 m_dlg->getStyleManager()->changeName( name, m_nameEdit->text() );
306 if ( style->type() == Style::TENTATIVE )
322 m_doc( _sheet->doc() ),
330 isRowSelected = _view->selectionInfo()->isRowSelected();
331 isColumnSelected = _view->selectionInfo()->isColumnSelected();
333 TQRect range = _view->selectionInfo()->selection();
336 right = range.right();
337 bottom = range.bottom();
349 Cell* obj = m_sheet->cellAt( left, top );
350 oneCell = (left == right && top == bottom &&
358 borders[BorderType_Left].style = obj->
format()->leftBorderStyle( left, top );
359 borders[BorderType_Left].width = obj->
format()->leftBorderWidth( left, top );
360 borders[BorderType_Left].color = obj->
format()->leftBorderColor( left, top );
361 borders[BorderType_Top].style = obj->
format()->topBorderStyle( left, top );
362 borders[BorderType_Top].width = obj->
format()->topBorderWidth( left, top );
363 borders[BorderType_Top].color = obj->
format()->topBorderColor( left, top );
364 borders[BorderType_FallingDiagonal].style =
365 obj->
format()->fallDiagonalStyle( left, top );
366 borders[BorderType_FallingDiagonal].width =
367 obj->
format()->fallDiagonalWidth( left, top );
368 borders[BorderType_FallingDiagonal].color =
369 obj->
format()->fallDiagonalColor( left, top );
370 borders[BorderType_RisingDiagonal].style =
371 obj->
format()->goUpDiagonalStyle( left, top );
372 borders[BorderType_RisingDiagonal].width =
373 obj->
format()->goUpDiagonalWidth( left, top );
374 borders[BorderType_RisingDiagonal].color =
375 obj->
format()->goUpDiagonalColor( left, top );
378 obj = m_sheet->cellAt( right, top );
379 borders[BorderType_Right].style = obj->
format()->rightBorderStyle( right, top );
380 borders[BorderType_Right].width = obj->
format()->rightBorderWidth( right, top );
381 borders[BorderType_Right].color = obj->
format()->rightBorderColor( right, top );
384 obj = m_sheet->cellAt( left, bottom );
385 borders[BorderType_Bottom].style = obj->
format()->bottomBorderStyle( left, bottom );
386 borders[BorderType_Bottom].width = obj->
format()->bottomBorderWidth( left, bottom );
387 borders[BorderType_Bottom].color = obj->
format()->bottomBorderColor( left, bottom );
390 obj = m_sheet->cellAt( right, top );
394 int moveX = obj->
column();
397 int moveY2 = obj->
row();
398 borders[BorderType_Vertical].style = obj->
format()->leftBorderStyle( moveX, moveY );
399 borders[BorderType_Vertical].width = obj->
format()->leftBorderWidth( moveX, moveY );
400 borders[BorderType_Vertical].color = obj->
format()->leftBorderColor( moveX, moveY );
402 obj = m_sheet->cellAt( moveX2, moveY2 );
403 borders[BorderType_Horizontal].style = obj->
format()->topBorderStyle( moveX2, moveY2 );
404 borders[BorderType_Horizontal].width = obj->
format()->topBorderWidth( moveX2, moveY2 );
405 borders[BorderType_Horizontal].color = obj->
format()->topBorderColor( moveX2, moveY2 );
409 borders[BorderType_Vertical].style = obj->
format()->leftBorderStyle( right, top );
410 borders[BorderType_Vertical].width = obj->
format()->leftBorderWidth( right, top );
411 borders[BorderType_Vertical].color = obj->
format()->leftBorderColor( right, top );
412 borders[BorderType_Horizontal].style = obj->
format()->topBorderStyle(right, bottom);
413 borders[BorderType_Horizontal].width = obj->
format()->topBorderWidth(right, bottom);
414 borders[BorderType_Horizontal].color = obj->
format()->topBorderColor(right, bottom);
417 obj = m_sheet->cellAt( left, top );
418 prefix = obj->
format()->prefix( left, top );
419 postfix = obj->
format()->postfix( left, top );
420 precision = obj->
format()->precision( left, top );
421 floatFormat = obj->
format()->floatFormat( left, top );
422 floatColor = obj->
format()->floatColor( left, top );
423 alignX = obj->
format()->align( left, top );
424 alignY = obj->
format()->alignY( left, top );
425 textColor = obj->
format()->textColor( left, top );
426 bgColor = obj->
bgColor( left, top );
427 textFontSize = obj->
format()->textFontSize( left, top );
428 textFontFamily = obj->
format()->textFontFamily( left, top );
429 textFontBold = obj->
format()->textFontBold( left, top );
430 textFontItalic = obj->
format()->textFontItalic( left, top );
431 strike=obj->
format()->textFontStrike( left, top );
432 underline = obj->
format()->textFontUnderline( left, top );
434 textFont = obj->
format()->textFont( left, top );
435 obj->
format()->currencyInfo( cCurrency );
437 brushColor = obj->
format()->backGroundBrushColor( left, top );
438 brushStyle = obj->
format()->backGroundBrushStyle( left,top );
440 bMultiRow = obj->
format()->multiRow( left, top );
441 bVerticalText = obj->
format()->verticalText( left, top );
442 textRotation = obj->
format()->getAngle(left, top);
443 formatType = obj->
format()->getFormatType(left, top);
445 bDontPrintText = obj->
format()->getDontprintText( left, top );
446 bHideFormula = obj->
format()->isHideFormula( left, top );
447 bHideAll = obj->
format()->isHideAll( left, top );
448 bIsProtected = !obj->
format()->notProtected( left, top );
450 indent = obj->
format()->getIndent(left, top);
452 value = obj->
value();
459 if ( !isRowSelected )
461 for (
int x = left; x <= right; x++ )
463 cl = m_pView->activeSheet()->columnFormat( x );
464 widthSize = TQMAX( cl->dblWidth(), widthSize );
468 if ( !isColumnSelected )
470 for (
int y = top; y <= bottom; y++ )
472 rl = m_pView->activeSheet()->rowFormat(y);
473 heightSize = TQMAX( rl->dblHeight(), heightSize );
478 if ( isColumnSelected )
482 for (
int x = left;x <= right; x++)
484 ColumnFormat *obj = m_sheet->nonDefaultColumnFormat(x);
485 initParameters( obj,x,y);
487 for (cell = m_sheet->getFirstCellColumn(x); cell != NULL;
488 cell = m_sheet->getNextCellDown(cell->
column(), cell->
row()))
490 initParameters( cell->
format(), x, cell->
row());
495 else if ( isRowSelected )
499 for (
int y = top;y<=bottom;y++)
501 RowFormat *obj = m_sheet->nonDefaultRowFormat(y);
502 initParameters( obj,x,y);
504 for (c = m_sheet->getFirstCellRow(y); c != NULL;
505 c = m_sheet->getNextCellRight(c->
column(), c->
row()) )
514 for (
int x = left; x <= right; x++ )
516 for (
int y = top; y <= bottom; y++ )
518 Cell *obj = m_sheet->cellAt( x, y );
523 initParameters( obj->
format(),x,y);
527 if ( !bTextRotation )
530 if ( isColumnSelected )
533 ColumnFormat *obj=m_sheet->nonDefaultColumnFormat(left);
534 checkBorderLeft( obj,left, y);
537 for (c = m_sheet->getFirstCellColumn(left); c != NULL;
538 c = m_sheet->getNextCellDown(c->
column(), c->
row()) )
544 obj=m_sheet->nonDefaultColumnFormat(right);
545 checkBorderRight(obj,right,y);
547 for (c = m_sheet->getFirstCellColumn(right); c != NULL;
548 c = m_sheet->getNextCellDown(c->
column(), c->
row()) )
553 for (
int x = left; x <= right; x++ )
555 Cell *obj = m_sheet->cellAt( x, top );
556 checkBorderTop(obj->
format(),x, top);
557 obj = m_sheet->cellAt( x, bottom );
558 checkBorderBottom(obj->
format(),x, bottom);
561 ColumnFormat *obj = m_sheet->nonDefaultColumnFormat(x);
562 checkBorderHorizontal(obj,x, y);
563 checkBorderVertical(obj,x, y);
567 else if ( isRowSelected )
570 for (
int y = top; y <= bottom; y++ )
572 Cell *obj = m_sheet->cellAt( right, y );
573 checkBorderRight(obj->
format(),right,y);
574 obj = m_sheet->cellAt( left, y );
575 checkBorderLeft( obj->
format(),left, y);
578 RowFormat* obj = m_sheet->nonDefaultRowFormat(y);
579 checkBorderHorizontal(obj,x, y);
580 checkBorderVertical(obj,x, y);
584 RowFormat *obj=m_sheet->nonDefaultRowFormat(top);
585 checkBorderTop(obj,x, top);
586 obj=m_sheet->nonDefaultRowFormat(bottom);
587 checkBorderBottom(obj,x, bottom);
591 for (
int y = top; y <= bottom; y++ )
593 Cell *obj = m_sheet->cellAt( left, y );
594 checkBorderLeft( obj->
format(),left, y);
595 obj = m_sheet->cellAt( right, y );
596 checkBorderRight(obj->
format(),right,y);
599 for (
int x = left; x <= right; x++ )
601 Cell *obj = m_sheet->cellAt( x, top );
602 checkBorderTop( obj->
format(), x, top );
603 obj = m_sheet->cellAt( x, bottom );
604 checkBorderBottom( obj->
format(), x, bottom );
608 for (
int x = left; x <= right; x++ )
610 for (
int y = top+1; y <= bottom; y++ )
612 Cell *obj = m_sheet->cellAt( x, y );
613 checkBorderHorizontal(obj->
format(),x, y);
617 for (
int x = left+1; x <= right; x++ )
619 for (
int y = top; y <= bottom; y++ )
621 Cell *obj = m_sheet->cellAt( x, y );
622 checkBorderVertical(obj->
format(),x,y);
631 StyleManager * _manager,
Doc * doc )
637 m_styleManager( _manager )
644void CellFormatDialog::initGUI()
646 isRowSelected =
false;
647 isColumnSelected =
false;
648 styleName = m_style->name();
650 borders[BorderType_Left].style = m_style->leftBorderPen().style();
651 borders[BorderType_Left].width = m_style->leftBorderPen().width();
652 borders[BorderType_Left].color = m_style->leftBorderPen().color();
654 borders[BorderType_Top].style = m_style->topBorderPen().style();
655 borders[BorderType_Top].width = m_style->topBorderPen().width();
656 borders[BorderType_Top].color = m_style->topBorderPen().color();
658 borders[BorderType_Right].style = m_style->rightBorderPen().style();
659 borders[BorderType_Right].width = m_style->rightBorderPen().width();
660 borders[BorderType_Right].color = m_style->rightBorderPen().color();
662 borders[BorderType_Bottom].style = m_style->bottomBorderPen().style();
663 borders[BorderType_Bottom].width = m_style->bottomBorderPen().width();
664 borders[BorderType_Bottom].color = m_style->bottomBorderPen().color();
666 borders[BorderType_FallingDiagonal].style = m_style->fallDiagonalPen().style();
667 borders[BorderType_FallingDiagonal].width = m_style->fallDiagonalPen().width();
668 borders[BorderType_FallingDiagonal].color = m_style->fallDiagonalPen().color();
670 borders[BorderType_RisingDiagonal].style = m_style->goUpDiagonalPen().style();
671 borders[BorderType_RisingDiagonal].width = m_style->goUpDiagonalPen().width();
672 borders[BorderType_RisingDiagonal].color = m_style->goUpDiagonalPen().color();
674 borders[BorderType_Vertical].style = m_style->leftBorderPen().style();
675 borders[BorderType_Vertical].width = m_style->leftBorderPen().width();
676 borders[BorderType_Vertical].color = m_style->leftBorderPen().color();
677 borders[BorderType_Horizontal].style = m_style->topBorderPen().style();
678 borders[BorderType_Horizontal].width = m_style->topBorderPen().width();
679 borders[BorderType_Horizontal].color = m_style->topBorderPen().color();
681 prefix = m_style->prefix();
682 postfix = m_style->postfix();
683 precision = m_style->precision();
684 floatFormat = m_style->floatFormat();
685 floatColor = m_style->floatColor();
686 alignX = m_style->alignX();
687 alignY = m_style->alignY();
688 textColor = m_style->pen().color();
689 bgColor = m_style->bgColor();
690 textFontSize = m_style->fontSize();
691 textFontFamily = m_style->fontFamily();
693 uint flags = m_style->fontFlags();
694 textFontBold = ( flags & (uint) Style::FBold );
695 textFontItalic = ( flags & (uint) Style::FItalic );
696 strike = ( flags & (uint) Style::FStrike );
697 underline = ( flags & (uint) Style::FUnderline );
700 textFont = m_style->font();
701 cCurrency = m_style->currency();
702 brushColor = m_style->backGroundBrush().color();
703 brushStyle = m_style->backGroundBrush().style();
705 bMultiRow = m_style->hasProperty( Style::PMultiRow );
706 bVerticalText = m_style->hasProperty( Style::PVerticalText );
707 textRotation = m_style->rotateAngle();
708 formatType = m_style->formatType();
709 indent = m_style->indent();
711 bDontPrintText = m_style->hasProperty( Style::PDontPrintText );
712 bHideFormula = m_style->hasProperty( Style::PHideFormula );
713 bHideAll = m_style->hasProperty( Style::PHideAll );
714 bIsProtected = !m_style->hasProperty( Style::PNotProtected );
716 widthSize = defaultWidthSize;
717 heightSize = defaultHeightSize;
720CellFormatDialog::~CellFormatDialog()
722 delete formatOnlyNegSignedPixmap;
723 delete formatRedOnlyNegSignedPixmap;
724 delete formatRedNeverSignedPixmap;
725 delete formatAlwaysSignedPixmap;
726 delete formatRedAlwaysSignedPixmap;
729void CellFormatDialog::initMembers()
731 formatOnlyNegSignedPixmap = 0L;
732 formatRedOnlyNegSignedPixmap = 0L;
733 formatRedNeverSignedPixmap = 0L;
734 formatAlwaysSignedPixmap = 0L;
735 formatRedAlwaysSignedPixmap = 0L;
738 for (
int i = 0; i < BorderType_END; ++i )
740 borders[i].bStyle =
true;
741 borders[i].bColor =
true;
747 bTextFontFamily =
true;
748 bTextFontSize =
true;
749 bTextFontBold =
true;
750 bTextFontItalic =
true;
753 bTextRotation =
true;
756 bDontPrintText =
false;
757 bHideFormula =
false;
761 cCurrency.symbol = locale()->currencySymbol();
764 Sheet* sheet = m_pView->activeSheet();
765 defaultWidthSize = sheet ? sheet->columnFormat(0)->dblWidth() : 0;
766 defaultHeightSize = sheet ? sheet->rowFormat(0)->dblHeight() : 0;
769bool CellFormatDialog::checkCircle( TQString
const & name, TQString
const & parent )
771 return m_styleManager->checkCircle( name, parent );
774void CellFormatDialog::checkBorderRight(Format *obj,
int x,
int y)
776 if ( borders[BorderType_Right].style != obj->rightBorderStyle( x, y ) ||
777 borders[BorderType_Right].width != obj->rightBorderWidth( x, y ) )
778 borders[BorderType_Right].bStyle =
false;
779 if ( borders[BorderType_Right].color != obj->rightBorderColor( x, y ) )
780 borders[BorderType_Right].bColor =
false;
783void CellFormatDialog::checkBorderLeft(Format *obj,
int x,
int y)
785 if ( borders[BorderType_Left].style != obj->leftBorderStyle( x, y ) ||
786 borders[BorderType_Left].width != obj->leftBorderWidth( x, y ) )
787 borders[BorderType_Left].bStyle =
false;
788 if ( borders[BorderType_Left].color != obj->leftBorderColor( x, y ) )
789 borders[BorderType_Left].bColor =
false;
792void CellFormatDialog::checkBorderTop(Format *obj,
int x,
int y)
794 if ( borders[BorderType_Top].style != obj->topBorderStyle( x, y ) ||
795 borders[BorderType_Top].width != obj->topBorderWidth( x, y ) )
796 borders[BorderType_Top].bStyle =
false;
797 if ( borders[BorderType_Top].color != obj->topBorderColor( x, y ) )
798 borders[BorderType_Top].bColor =
false;
801void CellFormatDialog::checkBorderBottom(Format *obj,
int x,
int y)
803 if ( borders[BorderType_Bottom].style != obj->bottomBorderStyle( x, y ) ||
804 borders[BorderType_Bottom].width != obj->bottomBorderWidth( x, y ) )
805 borders[BorderType_Bottom].bStyle =
false;
806 if ( borders[BorderType_Bottom].color != obj->bottomBorderColor( x, y ) )
807 borders[BorderType_Bottom].bColor =
false;
810void CellFormatDialog::checkBorderVertical(Format *obj,
int x,
int y)
812 if (borders[BorderType_Vertical].style != obj->leftBorderStyle( x, y ) ||
813 borders[BorderType_Vertical].width != obj->leftBorderWidth( x, y ))
814 borders[BorderType_Vertical].bStyle =
false;
815 if ( borders[BorderType_Vertical].color != obj->leftBorderColor( x, y ) )
816 borders[BorderType_Vertical].bColor =
false;
819void CellFormatDialog::checkBorderHorizontal(Format *obj,
int x,
int y)
821 if ( borders[BorderType_Horizontal].style != obj->topBorderStyle( x, y ) ||
822 borders[BorderType_Horizontal].width != obj->topBorderWidth( x, y ) )
823 borders[BorderType_Horizontal].bStyle =
false;
824 if ( borders[BorderType_Horizontal].color != obj->topBorderColor( x, y ) )
825 borders[BorderType_Horizontal].bColor =
false;
829void CellFormatDialog::initParameters(Format *obj,
int x,
int y)
831 if (borders[BorderType_FallingDiagonal].style != obj->fallDiagonalStyle( x, y ))
832 borders[BorderType_FallingDiagonal].bStyle =
false;
833 if (borders[BorderType_FallingDiagonal].width != obj->fallDiagonalWidth( x, y ))
834 borders[BorderType_FallingDiagonal].bStyle =
false;
835 if (borders[BorderType_FallingDiagonal].color != obj->fallDiagonalColor( x, y ))
836 borders[BorderType_FallingDiagonal].bColor =
false;
838 if (borders[BorderType_RisingDiagonal].style != obj->goUpDiagonalStyle( x, y ))
839 borders[BorderType_RisingDiagonal].bStyle =
false;
840 if (borders[BorderType_RisingDiagonal].width != obj->goUpDiagonalWidth( x, y ))
841 borders[BorderType_RisingDiagonal].bStyle =
false;
842 if (borders[BorderType_RisingDiagonal].color != obj->goUpDiagonalColor( x, y ))
843 borders[BorderType_RisingDiagonal].bColor =
false;
844 if ( strike != obj->textFontStrike( x, y ) )
846 if ( underline != obj->textFontUnderline( x, y ) )
848 if ( prefix != obj->prefix( x, y ) )
850 if ( postfix != obj->postfix( x, y ) )
851 postfix = TQString();
852 if ( floatFormat != obj->floatFormat( x, y ) )
853 bFloatFormat =
false;
854 if ( floatColor != obj->floatColor( x, y ) )
856 if ( textColor != obj->textColor( x, y ) )
858 if ( textFontFamily != obj->textFontFamily( x, y ) )
859 bTextFontFamily =
false;
860 if ( textFontSize != obj->textFontSize( x, y ) )
861 bTextFontSize =
false;
862 if ( textFontBold != obj->textFontBold( x, y ) )
863 bTextFontBold =
false;
864 if ( textFontItalic != obj->textFontItalic( x, y ) )
865 bTextFontItalic =
false;
866 if ( bgColor != obj->bgColor( x, y ) )
868 if ( textRotation != obj->getAngle(left, top) )
869 bTextRotation =
false;
870 if ( formatType != obj->getFormatType(left, top) )
872 if ( bMultiRow != obj->multiRow( left, top ) )
874 if ( bVerticalText!=obj->verticalText( left, top ) )
875 bVerticalText =
false;
876 if ( bDontPrintText!=obj->getDontprintText( left, top ) )
877 bDontPrintText=
false;
879 Format::Currency cur;
880 if (!obj->currencyInfo(cur))
883 if (cur.symbol != cCurrency.symbol)
887void CellFormatDialog::init()
889 TQColorGroup colorGroup = TQApplication::palette().active();
892 if ( formatOnlyNegSignedPixmap == 0L )
894 TQColor black = colorGroup.text();
895 formatOnlyNegSignedPixmap =
paintFormatPixmap(
"123.456", black,
"-123.456", black );
896 formatRedOnlyNegSignedPixmap =
paintFormatPixmap(
"123.456", black,
"-123.456", TQt::red );
897 formatRedNeverSignedPixmap =
paintFormatPixmap(
"123.456", black,
"123.456", TQt::red );
898 formatAlwaysSignedPixmap =
paintFormatPixmap(
"+123.456", black,
"-123.456", black );
899 formatRedAlwaysSignedPixmap =
paintFormatPixmap(
"+123.456", black,
"-123.456", TQt::red );
902 tab =
new TQTabDialog( (TQWidget*)m_pView, 0L,
true );
907 generalPage =
new GeneralTab( tab,
this );
908 tab->addTab( generalPage, i18n(
"&General" ) );
912 tab->addTab( floatPage, i18n(
"&Data Format") );
914 fontPage =
new CellFormatPageFont( tab,
this );
915 tab->addTab( fontPage, i18n(
"&Font") );
920 positionPage =
new CellFormatPagePosition( tab,
this);
921 tab->addTab( positionPage, i18n(
"&Position") );
923 borderPage =
new CellFormatPageBorder( tab,
this );
924 tab->addTab( borderPage, i18n(
"&Border") );
926 patternPage=
new CellFormatPagePattern(tab,
this);
927 tab->addTab( patternPage,i18n(
"Back&ground"));
929 protectPage =
new CellFormatPageProtection( tab,
this );
930 tab->addTab( protectPage, i18n(
"&Cell Protection") );
932 tab->setCancelButton( i18n(
"&Cancel" ) );
933 tab->setOkButton( i18n(
"&OK" ) );
935 tab->setCaption( i18n(
"Cell Format" ) );
939 connect( tab, TQ_SIGNAL( applyButtonPressed() ),
this, TQ_SLOT( slotApply() ) );
945 const char *_string2,
const TQColor & _color2 )
947 TQPixmap * pixmap =
new TQPixmap( 150, 14 );
950 painter.begin( pixmap );
951 painter.fillRect( 0, 0, 150, 14, TQApplication::palette().active().base() );
952 painter.setPen( _color1 );
953 painter.drawText( 2, 11, TQString(_string1) );
954 painter.setPen( _color2 );
955 painter.drawText( 75, 11, TQString(_string2) );
958 TQBitmap bm( pixmap->size() );
960 painter.begin( &bm );
961 painter.setPen( color1 );
962 painter.drawText( 2, 11, TQString(_string1) );
963 painter.drawText( 75, 11, TQString(_string2) );
965 pixmap->setMask( bm );
972 return ( tab->exec() );
975void CellFormatDialog::applyStyle()
977 generalPage->apply( m_style );
979 borderPage->apply(0);
980 floatPage->apply( m_style );
982 fontPage->apply( m_style );
983 positionPage->apply( m_style );
984 patternPage->apply( m_style );
985 protectPage->apply( m_style );
989void CellFormatDialog::slotApply()
1001 KMacroCommand* macroCommand =
new KMacroCommand( i18n(
"Change Format") );
1003 if ( isMerged != positionPage->getMergedCellState() )
1005 if ( positionPage->getMergedCellState() )
1008 manipulator->setSheet(m_pView->activeSheet());
1009 manipulator->setRegisterUndo(
false);
1010 manipulator->
add(*m_pView->selectionInfo());
1011 macroCommand->addCommand( manipulator );
1017 manipulator->setSheet(m_pView->activeSheet());
1018 manipulator->setReverse(
true);
1019 manipulator->setRegisterUndo(
false);
1020 manipulator->
add(*m_pView->selectionInfo());
1021 macroCommand->addCommand( manipulator );
1026 manipulator->setSheet(m_pView->activeSheet());
1027 manipulator->setRegisterUndo(
false);
1028 manipulator->
add(*m_pView->selectionInfo());
1029 borderPage->apply(manipulator);
1030 floatPage->apply(manipulator);
1031 fontPage->apply(manipulator);
1032 positionPage->apply(manipulator);
1033 patternPage->apply(manipulator);
1034 protectPage->apply(manipulator);
1036 if (!manipulator->isEmpty())
1038 macroCommand->addCommand( manipulator );
1045 if (
int( positionPage->getSizeHeight() ) !=
int( heightSize ) )
1048 manipulator->setSheet(m_pView->activeSheet());
1049 manipulator->setSize(positionPage->getSizeHeight());
1051 manipulator->setOldSize(heightSize);
1052 manipulator->
add(*m_pView->selectionInfo());
1053 macroCommand->addCommand( manipulator );
1055 if (
int( positionPage->getSizeWidth() ) !=
int( widthSize ) )
1058 manipulator->setSheet(m_pView->activeSheet());
1059 manipulator->setSize(positionPage->getSizeWidth());
1061 manipulator->setOldSize(widthSize);
1062 manipulator->
add(*m_pView->selectionInfo());
1063 macroCommand->addCommand( manipulator );
1066 macroCommand->execute();
1081CellFormatPageFloat::CellFormatPageFloat( TQWidget* parent,
CellFormatDialog *_dlg )
1082 : TQWidget ( parent ),
1085 TQVBoxLayout* layout =
new TQVBoxLayout(
this, 6,10 );
1087 TQButtonGroup *grp =
new TQButtonGroup( i18n(
"Format"),
this);
1088 TQGridLayout *grid =
new TQGridLayout(grp,11,2,KDialog::marginHint(), KDialog::spacingHint());
1090 int fHeight = grp->fontMetrics().height();
1091 grid->addRowSpacing( 0, fHeight/2 );
1093 grp->setRadioButtonExclusive(
true );
1094 generic=
new TQRadioButton(i18n(
"Generic"),grp);
1095 TQWhatsThis::add(generic, i18n(
"This is the default format and KSpread autodetects the actual data type depending on the current cell data. By default, KSpread right justifies numbers, dates and times within a cell and left justifies anything else." ) );
1096 grid->addWidget(generic,1,0);
1098 number=
new TQRadioButton(i18n(
"Number"),grp);
1099 TQWhatsThis::add(number, i18n(
"The number notation uses the notation you globally choose in KControl -> Regional & Accessibility -> Numbers tab. Numbers are right justified by default." ) );
1100 grid->addWidget(number,2,0);
1102 percent=
new TQRadioButton(i18n(
"Percent"),grp);
1103 TQWhatsThis::add(percent, i18n(
"When you have a number in the current cell and you switch from the dcell format from Generic to Percent, the current cell number will be multiplied by 100%.\nFor example if you enter 12 and set the cell format to Percent, the number will then be 1,200 %. Switching back to Generic cell format will bring it back to 12.\nYou can also use the Percent icon in the Format Toolbar." ) );
1104 grid->addWidget(percent,3,0);
1106 money=
new TQRadioButton(i18n(
"Money"),grp);
1107 TQWhatsThis::add(money, i18n(
"The Money format converts your number into money notation using the settings globally fixed in KControl in Regional & Accessibility -> Money. The currency symbol will be displayed and the precision will be the one set in KControl.\nYou can also use the Currency icon in the Format Toolbar to set the cell formatting to look like your current currency." ) );
1108 grid->addWidget(money,4,0);
1110 scientific=
new TQRadioButton(i18n(
"Scientific"),grp);
1111 TQWhatsThis::add(scientific, i18n(
"The scientific format changes your number using the scientific notation. For example, 0.0012 will be changed to 1.2E-03. Going back using Generic cell format will display 0.0012 again." ) );
1112 grid->addWidget(scientific,5,0);
1114 fraction=
new TQRadioButton(i18n(
"Fraction"),grp);
1115 TQWhatsThis::add(fraction, i18n(
"The fraction format changes your number into a fraction. For example, 0.1 can be changed to 1/8, 2/16, 1/10, etc. You define the type of fraction by choosing it in the field on the right. If the exact fraction is not possible in the fraction mode you choose, the nearest closest match is chosen.\n For example: when we have 1.5 as number, we choose Fraction and Sixteenths 1/16 the text displayed into cell is \"1 8/16\" which is an exact fraction. If you have 1.4 as number in your cell and you choose Fraction and Sixteenths 1/16 then the cell will display \"1 6/16\" which is the nearest closest Sixteenth fraction." ) );
1116 grid->addWidget(fraction,6,0);
1118 date=
new TQRadioButton(i18n(
"Date format"),grp);
1119 TQWhatsThis::add(date, i18n(
"To enter a date, you should enter it in one of the formats set in KControl in Regional & Accessibility ->Time & Dates. There are two formats set here: the date format and the short date format.\nJust like you can drag down numbers you can also drag down dates and the next cells will also get dates." ) );
1120 grid->addWidget(date,7,0);
1122 time=
new TQRadioButton(i18n(
"Time format"),grp);
1123 TQWhatsThis::add(time, i18n(
"This formats your cell content as a time. To enter a time, you should enter it in the Time format set in KControl in Regional & Accessibility ->Time & Dates. In the Cell Format dialog box you can set how the time should be displayed by choosing one of the available time format options. The default format is the system format set in KControl. When the number in the cell does not make sense as a time, KSpread will display 00:00 in the global format you have in KControl." ) );
1124 grid->addWidget(time,8,0);
1126 textFormat=
new TQRadioButton(i18n(
"Text"),grp);
1127 TQWhatsThis::add(textFormat, i18n(
"This formats your cell content as text. This can be useful if you want a number treated as text instead as a number, for example for a ZIP code. Setting a number as text format will left justify it. When numbers are formatted as text, they cannot be used in calculations or formulas. It also change the way the cell is justified." ) );
1128 grid->addWidget(textFormat,9,0);
1130 customFormat=
new TQRadioButton(i18n(
"Custom"),grp);
1131 TQWhatsThis::add(customFormat, i18n(
"The custom format does not work yet. To be enabled in the next release." ) );
1132 grid->addWidget(customFormat,10,0);
1133 customFormat->setEnabled(
false );
1135 TQGroupBox *box2 =
new TQGroupBox( grp,
"Box");
1136 box2->setTitle(i18n(
"Preview"));
1137 TQGridLayout *grid3 =
new TQGridLayout(box2,1,3,KDialog::marginHint(), KDialog::spacingHint());
1139 exampleLabel=
new TQLabel(box2);
1140 TQWhatsThis::add(exampleLabel, i18n(
"This will display a preview of your choice so you can know what it does before clicking the OK button to validate it." ) );
1141 grid3->addWidget(exampleLabel,0,1);
1143 grid->addMultiCellWidget(box2,9,10,1,1);
1145 customFormatEdit =
new TQLineEdit( grp );
1146 grid->addMultiCellWidget( customFormatEdit, 1, 1, 1, 1 );
1147 customFormatEdit->setHidden(
true );
1149 listFormat=
new TQListBox(grp);
1150 grid->addMultiCellWidget(listFormat,2,7,1,1);
1151 TQWhatsThis::add(listFormat, i18n(
"Displays choices of format for the fraction, date or time formats." ) );
1152 layout->addWidget(grp);
1156 TQGroupBox *box =
new TQGroupBox(
this,
"Box");
1158 grid =
new TQGridLayout(box,3,4,KDialog::marginHint(), KDialog::spacingHint());
1160 postfix =
new TQLineEdit( box,
"LineEdit_1" );
1161 TQWhatsThis::add(postfix, i18n(
"You can add here a Postfix such as a $HK symbol to the end of each cell content in the checked format." ) );
1162 grid->addWidget(postfix,2,1);
1163 precision =
new KIntNumInput( dlg->precision, box, 10 );
1164 precision->setSpecialValueText(i18n(
"variable"));
1165 precision->setRange(-1,10,1,
false);
1166 TQWhatsThis::add(precision, i18n(
"You can control how many digits are displayed after the decimal point for numeric values. This can also be changed using the Increase precision or Decrease precision icons in the Format toolbar. " ) );
1167 grid->addWidget(precision,1,1);
1169 prefix =
new TQLineEdit( box,
"LineEdit_3" );
1170 TQWhatsThis::add(prefix, i18n(
"You can add here a Prefix such as a $ symbol at the start of each cell content in the checked format." ) );
1171 grid->addWidget(prefix,0,1);
1173 format =
new TQComboBox( box,
"ListBox_1" );
1174 TQWhatsThis::add(format, i18n(
"You can choose whether positive values are displayed with a leading + sign and whether negative values are shown in red." ) );
1175 grid->addWidget(format,0,3);
1177 TQLabel* tmpTQLabel;
1178 tmpTQLabel =
new TQLabel( box,
"Label_1" );
1179 grid->addWidget(tmpTQLabel,2,0);
1180 tmpTQLabel->setText( i18n(
"Postfix:") );
1182 postfix->setText( dlg->postfix );
1184 tmpTQLabel =
new TQLabel( box,
"Label_2" );
1185 grid->addWidget(tmpTQLabel,0,0);
1187 tmpTQLabel->setText( i18n(
"Prefix:") );
1188 tmpTQLabel =
new TQLabel( box,
"Label_3" );
1189 grid->addWidget(tmpTQLabel,1,0);
1190 tmpTQLabel->setText( i18n(
"Precision:") );
1192 prefix->setText( dlg->prefix );
1194 format->insertItem( *_dlg->formatOnlyNegSignedPixmap, 0 );
1195 format->insertItem( *_dlg->formatRedOnlyNegSignedPixmap, 1 );
1196 format->insertItem( *_dlg->formatRedNeverSignedPixmap, 2 );
1197 format->insertItem( *_dlg->formatAlwaysSignedPixmap, 3 );
1198 format->insertItem( *_dlg->formatRedAlwaysSignedPixmap, 4 );
1200 tmpTQLabel =
new TQLabel( box,
"Label_4" );
1201 grid->addWidget(tmpTQLabel, 0, 2);
1202 tmpTQLabel->setText( i18n(
"Format:") );
1204 currencyLabel =
new TQLabel( box,
"LabelCurrency" );
1205 grid->addWidget(currencyLabel, 1, 2);
1206 currencyLabel->setText( i18n(
"Currency:") );
1208 currency =
new TQComboBox( box,
"ComboCurrency" );
1209 grid->addWidget(currency, 1, 3);
1211 currency->insertItem( i18n(
"Automatic") );
1219 text = Currency::getChooseString( index, ok );
1222 currency->insertItem( text );
1232 currency->setCurrentItem( 0 );
1234 currencyLabel->hide();
1236 if ( !dlg->bFloatFormat || !dlg->bFloatColor )
1237 format->setCurrentItem( 5 );
1238 else if ( dlg->floatFormat == Format::OnlyNegSigned && dlg->floatColor == Format::AllBlack )
1239 format->setCurrentItem( 0 );
1240 else if ( dlg->floatFormat == Format::OnlyNegSigned && dlg->floatColor == Format::NegRed )
1241 format->setCurrentItem( 1 );
1242 else if ( dlg->floatFormat == Format::AlwaysUnsigned && dlg->floatColor == Format::NegRed )
1243 format->setCurrentItem( 2 );
1244 else if ( dlg->floatFormat == Format::AlwaysSigned && dlg->floatColor == Format::AllBlack )
1245 format->setCurrentItem( 3 );
1246 else if ( dlg->floatFormat == Format::AlwaysSigned && dlg->floatColor == Format::NegRed )
1247 format->setCurrentItem( 4 );
1248 layout->addWidget(box);
1250 cellFormatType=dlg->formatType;
1251 newFormatType = cellFormatType;
1253 if (!cellFormatType)
1254 generic->setChecked(
true);
1257 if (cellFormatType==Number_format)
1258 number->setChecked(
true);
1259 else if (cellFormatType==Percentage_format)
1260 percent->setChecked(
true);
1261 else if (cellFormatType==Money_format)
1263 money->setChecked(
true);
1264 currencyLabel->show();
1269 if (dlg->cCurrency.type != 1)
1271 Currency curr(dlg->cCurrency.type);
1273 tmp = Currency::getChooseString(dlg->cCurrency.type, ok);
1275 tmp = dlg->cCurrency.symbol;
1278 tmp = dlg->cCurrency.symbol;
1279 currency->setCurrentText( tmp );
1282 else if ( cellFormatType == Scientific_format )
1283 scientific->setChecked(
true);
1284 else if ( formatIsDate (cellFormatType) )
1285 date->setChecked(
true);
1286 else if ( formatIsTime (cellFormatType) )
1287 time->setChecked(
true);
1288 else if ( formatIsFraction (cellFormatType) )
1289 fraction->setChecked(
true);
1290 else if (cellFormatType == Text_format)
1291 textFormat->setChecked(
true);
1292 else if (cellFormatType == Custom_format)
1293 customFormat->setChecked(
true);
1296 connect(generic,TQ_SIGNAL(clicked ()),
this,TQ_SLOT(slotChangeState()));
1297 connect(fraction,TQ_SIGNAL(clicked ()),
this,TQ_SLOT(slotChangeState()));
1298 connect(money,TQ_SIGNAL(clicked ()),
this,TQ_SLOT(slotChangeState()));
1299 connect(date,TQ_SIGNAL(clicked ()),
this,TQ_SLOT(slotChangeState()));
1300 connect(scientific,TQ_SIGNAL(clicked ()),
this,TQ_SLOT(slotChangeState()));
1301 connect(number,TQ_SIGNAL(clicked ()),
this,TQ_SLOT(slotChangeState()));
1302 connect(percent,TQ_SIGNAL(clicked ()),
this,TQ_SLOT(slotChangeState()));
1303 connect(time,TQ_SIGNAL(clicked ()),
this,TQ_SLOT(slotChangeState()));
1304 connect(textFormat,TQ_SIGNAL(clicked()),
this,TQ_SLOT(slotChangeState()));
1305 connect(customFormat,TQ_SIGNAL(clicked()),
this,TQ_SLOT(slotChangeState()));
1307 connect(listFormat,TQ_SIGNAL(selectionChanged ()),
this,TQ_SLOT(makeformat()));
1308 connect(precision,TQ_SIGNAL(valueChanged(
int)),
this,TQ_SLOT(slotChangeValue(
int)));
1309 connect(prefix,TQ_SIGNAL(textChanged (
const TQString & ) ),
this,TQ_SLOT(makeformat()));
1310 connect(postfix,TQ_SIGNAL(textChanged (
const TQString & ) ),
this,TQ_SLOT(makeformat()));
1311 connect(currency,TQ_SIGNAL(activated (
const TQString & ) ),
this, TQ_SLOT(currencyChanged(
const TQString &)));
1312 connect(format,TQ_SIGNAL(activated (
int ) ),
this,TQ_SLOT(formatChanged(
int)));
1313 connect(format, TQ_SIGNAL(activated(
int)),
this, TQ_SLOT(makeformat()));
1315 m_bFormatColorChanged=
false;
1316 m_bFormatTypeChanged=
false;
1317 this->resize( 400, 400 );
1320void CellFormatPageFloat::formatChanged(
int)
1322 m_bFormatColorChanged=
true;
1325void CellFormatPageFloat::slotChangeValue(
int)
1329void CellFormatPageFloat::slotChangeState()
1332 listFormat->clear();
1334 currencyLabel->hide();
1337 precision->setEnabled(
true);
1338 prefix->setEnabled(
true);
1339 postfix->setEnabled(
true);
1340 format->setEnabled(
true);
1342 if (generic->isChecked() || number->isChecked() || percent->isChecked() ||
1343 scientific->isChecked() || textFormat->isChecked())
1344 listFormat->setEnabled(
false);
1345 else if (money->isChecked())
1347 listFormat->setEnabled(
false);
1348 precision->setValue(2);
1350 currencyLabel->show();
1352 else if (date->isChecked())
1354 format->setEnabled(
false);
1355 precision->setEnabled(
false);
1356 prefix->setEnabled(
false);
1357 postfix->setEnabled(
false);
1358 listFormat->setEnabled(
true);
1361 else if (fraction->isChecked())
1363 precision->setEnabled(
false);
1364 listFormat->setEnabled(
true);
1365 list+=i18n(
"Halves 1/2");
1366 list+=i18n(
"Quarters 1/4");
1367 list+=i18n(
"Eighths 1/8");
1368 list+=i18n(
"Sixteenths 1/16");
1369 list+=i18n(
"Tenths 1/10");
1370 list+=i18n(
"Hundredths 1/100");
1371 list+=i18n(
"One digit 5/9");
1372 list+=i18n(
"Two digits 15/22");
1373 list+=i18n(
"Three digits 153/652");
1374 listFormat->insertStringList(list);
1375 if (cellFormatType == fraction_half)
1376 listFormat->setCurrentItem(0);
1377 else if (cellFormatType == fraction_quarter)
1378 listFormat->setCurrentItem(1);
1379 else if (cellFormatType == fraction_eighth )
1380 listFormat->setCurrentItem(2);
1381 else if (cellFormatType == fraction_sixteenth )
1382 listFormat->setCurrentItem(3);
1383 else if (cellFormatType == fraction_tenth )
1384 listFormat->setCurrentItem(4);
1385 else if (cellFormatType == fraction_hundredth )
1386 listFormat->setCurrentItem(5);
1387 else if (cellFormatType == fraction_one_digit )
1388 listFormat->setCurrentItem(6);
1389 else if (cellFormatType == fraction_two_digits )
1390 listFormat->setCurrentItem(7);
1391 else if (cellFormatType == fraction_three_digits )
1392 listFormat->setCurrentItem(8);
1394 listFormat->setCurrentItem(0);
1396 else if (time->isChecked())
1398 precision->setEnabled(
false);
1399 prefix->setEnabled(
false);
1400 postfix->setEnabled(
false);
1401 format->setEnabled(
false);
1402 listFormat->setEnabled(
true);
1405 list+=i18n(
"System: ")+dlg->locale()->formatTime(TQTime::currentTime(),
false);
1406 list+=i18n(
"System: ")+dlg->locale()->formatTime(TQTime::currentTime(),
true);
1407 TQDateTime tmpTime (TQDate (1, 1, 1900), TQTime (10, 35, 25));
1411 list+= fmt->
timeFormat(tmpTime, Time_format1);
1412 list+= fmt->
timeFormat(tmpTime, Time_format2);
1413 list+= fmt->
timeFormat(tmpTime, Time_format3);
1414 list+= fmt->
timeFormat(tmpTime, Time_format4);
1415 list+= fmt->
timeFormat(tmpTime, Time_format5);
1416 list+= ( fmt->
timeFormat(tmpTime, Time_format6) + i18n(
" (=[mm]::ss)") );
1417 list+= ( fmt->
timeFormat(tmpTime, Time_format7) + i18n(
" (=[hh]::mm::ss)") );
1418 list+= ( fmt->
timeFormat(tmpTime, Time_format8) + i18n(
" (=[hh]::mm)") );
1419 listFormat->insertStringList(list);
1421 if ( cellFormatType == Time_format )
1422 listFormat->setCurrentItem(0);
1423 else if (cellFormatType == SecondeTime_format)
1424 listFormat->setCurrentItem(1);
1425 else if (cellFormatType == Time_format1)
1426 listFormat->setCurrentItem(2);
1427 else if (cellFormatType == Time_format2)
1428 listFormat->setCurrentItem(3);
1429 else if (cellFormatType == Time_format3)
1430 listFormat->setCurrentItem(4);
1431 else if (cellFormatType == Time_format4)
1432 listFormat->setCurrentItem(5);
1433 else if (cellFormatType == Time_format5)
1434 listFormat->setCurrentItem(6);
1435 else if (cellFormatType == Time_format6)
1436 listFormat->setCurrentItem(7);
1437 else if (cellFormatType == Time_format7)
1438 listFormat->setCurrentItem(8);
1439 else if (cellFormatType == Time_format8)
1440 listFormat->setCurrentItem(9);
1442 listFormat->setCurrentItem(0);
1445 if (customFormat->isChecked())
1447 customFormatEdit->setHidden(
false );
1448 precision->setEnabled(
false);
1449 prefix->setEnabled(
false);
1450 postfix->setEnabled(
false);
1451 format->setEnabled(
false);
1452 listFormat->setEnabled(
true);
1455 customFormatEdit->setHidden(
true );
1457 m_bFormatTypeChanged=
true;
1462void CellFormatPageFloat::init()
1467 TQDate tmpDate( 2000,2,18);
1468 list+=i18n(
"System: ")+dlg->locale()->formatDate (TQDate::currentDate(),
true);
1469 list+=i18n(
"System: ")+dlg->locale()->formatDate (TQDate::currentDate(),
false);
1474 list+=fmt->
dateFormat( tmpDate, date_format1);
1476 list+=fmt->
dateFormat( tmpDate, date_format2);
1478 list+=fmt->
dateFormat( tmpDate, date_format3);
1480 list+=fmt->
dateFormat( tmpDate, date_format4);
1482 list+=fmt->
dateFormat( tmpDate, date_format5);
1484 list+=fmt->
dateFormat( tmpDate, date_format6);
1486 list+=fmt->
dateFormat( tmpDate, date_format7);
1488 list+=fmt->
dateFormat( tmpDate, date_format8);
1490 list+=fmt->
dateFormat( tmpDate, date_format9);
1492 list+=fmt->
dateFormat( tmpDate, date_format10);
1494 list+=fmt->
dateFormat( tmpDate, date_format11);
1496 list+=fmt->
dateFormat( tmpDate, date_format12);
1498 list+=fmt->
dateFormat( tmpDate, date_format13);
1500 list+=fmt->
dateFormat( tmpDate, date_format14);
1502 list+=fmt->
dateFormat( tmpDate, date_format15);
1504 list+=fmt->
dateFormat( tmpDate, date_format16);
1506 list+=fmt->
dateFormat( tmpDate, date_format17);
1507 list+=fmt->
dateFormat( tmpDate, date_format18);
1508 list+=fmt->
dateFormat( tmpDate, date_format19);
1509 list+=fmt->
dateFormat( tmpDate, date_format20);
1510 list+=fmt->
dateFormat( tmpDate, date_format21);
1511 list+=fmt->
dateFormat( tmpDate, date_format22);
1512 list+=fmt->
dateFormat( tmpDate, date_format23);
1513 list+=fmt->
dateFormat( tmpDate, date_format24);
1514 list+=fmt->
dateFormat( tmpDate, date_format25);
1515 list+=fmt->
dateFormat( tmpDate, date_format26);
1517 listFormat->insertStringList(list);
1518 if ( cellFormatType == ShortDate_format )
1519 listFormat->setCurrentItem(0);
1520 else if (cellFormatType == TextDate_format)
1521 listFormat->setCurrentItem(1);
1522 else if (cellFormatType == date_format1)
1523 listFormat->setCurrentItem(2);
1524 else if (cellFormatType == date_format2)
1525 listFormat->setCurrentItem(3);
1526 else if (cellFormatType == date_format3)
1527 listFormat->setCurrentItem(4);
1528 else if (cellFormatType == date_format4)
1529 listFormat->setCurrentItem(5);
1530 else if (cellFormatType == date_format5)
1531 listFormat->setCurrentItem(6);
1532 else if (cellFormatType == date_format6)
1533 listFormat->setCurrentItem(7);
1534 else if (cellFormatType == date_format7)
1535 listFormat->setCurrentItem(8);
1536 else if (cellFormatType == date_format8)
1537 listFormat->setCurrentItem(9);
1538 else if (cellFormatType == date_format9)
1539 listFormat->setCurrentItem(10);
1540 else if (cellFormatType == date_format10)
1541 listFormat->setCurrentItem(11);
1542 else if (cellFormatType == date_format11)
1543 listFormat->setCurrentItem(12);
1544 else if (cellFormatType == date_format12)
1545 listFormat->setCurrentItem(13);
1546 else if (cellFormatType == date_format13)
1547 listFormat->setCurrentItem(14);
1548 else if (cellFormatType == date_format14)
1549 listFormat->setCurrentItem(15);
1550 else if (cellFormatType == date_format15)
1551 listFormat->setCurrentItem(16);
1552 else if (cellFormatType == date_format16)
1553 listFormat->setCurrentItem(17);
1554 else if (cellFormatType == date_format17)
1555 listFormat->setCurrentItem(18);
1556 else if (cellFormatType == date_format18)
1557 listFormat->setCurrentItem(19);
1558 else if (cellFormatType == date_format19)
1559 listFormat->setCurrentItem(20);
1560 else if (cellFormatType == date_format20)
1561 listFormat->setCurrentItem(21);
1562 else if (cellFormatType == date_format21)
1563 listFormat->setCurrentItem(22);
1564 else if (cellFormatType == date_format22)
1565 listFormat->setCurrentItem(23);
1566 else if (cellFormatType == date_format23)
1567 listFormat->setCurrentItem(24);
1568 else if (cellFormatType == date_format24)
1569 listFormat->setCurrentItem(25);
1570 else if (cellFormatType == date_format25)
1571 listFormat->setCurrentItem(26);
1572 else if (cellFormatType == date_format26)
1573 listFormat->setCurrentItem(27);
1575 listFormat->setCurrentItem(0);
1579void CellFormatPageFloat::currencyChanged(
const TQString &)
1581 int index = currency->currentItem();
1584 dlg->cCurrency.symbol = Currency::getDisplaySymbol(index);
1585 dlg->cCurrency.type = index;
1590void CellFormatPageFloat::updateFormatType ()
1592 if (generic->isChecked())
1593 newFormatType = Generic_format;
1594 else if (number->isChecked())
1595 newFormatType = Number_format;
1596 else if (percent->isChecked())
1597 newFormatType = Percentage_format;
1598 else if (date->isChecked())
1600 newFormatType=ShortDate_format;
1601 switch (listFormat->currentItem())
1603 case 0: newFormatType=ShortDate_format;
break;
1604 case 1: newFormatType=TextDate_format;
break;
1605 case 2: newFormatType=date_format1;
break;
1606 case 3: newFormatType=date_format2;
break;
1607 case 4: newFormatType=date_format3;
break;
1608 case 5: newFormatType=date_format4;
break;
1609 case 6: newFormatType=date_format5;
break;
1610 case 7: newFormatType=date_format6;
break;
1611 case 8: newFormatType=date_format7;
break;
1612 case 9: newFormatType=date_format8;
break;
1613 case 10: newFormatType=date_format9;
break;
1614 case 11: newFormatType=date_format10;
break;
1615 case 12: newFormatType=date_format11;
break;
1616 case 13: newFormatType=date_format12;
break;
1617 case 14: newFormatType=date_format13;
break;
1618 case 15: newFormatType=date_format14;
break;
1619 case 16: newFormatType=date_format15;
break;
1620 case 17: newFormatType=date_format16;
break;
1621 case 18: newFormatType=date_format17;
break;
1622 case 19: newFormatType=date_format18;
break;
1623 case 20: newFormatType=date_format19;
break;
1624 case 21: newFormatType=date_format20;
break;
1625 case 22: newFormatType=date_format21;
break;
1626 case 23: newFormatType=date_format22;
break;
1627 case 24: newFormatType=date_format23;
break;
1628 case 25: newFormatType=date_format24;
break;
1629 case 26: newFormatType=date_format25;
break;
1630 case 27: newFormatType=date_format26;
break;
1633 else if (money->isChecked())
1634 newFormatType = Money_format;
1635 else if (scientific->isChecked())
1636 newFormatType = Scientific_format;
1637 else if (fraction->isChecked())
1639 newFormatType=fraction_half;
1640 switch (listFormat->currentItem())
1642 case 0: newFormatType=fraction_half;
break;
1643 case 1: newFormatType=fraction_quarter;
break;
1644 case 2: newFormatType=fraction_eighth;
break;
1645 case 3: newFormatType=fraction_sixteenth;
break;
1646 case 4: newFormatType=fraction_tenth;
break;
1647 case 5: newFormatType=fraction_hundredth;
break;
1648 case 6: newFormatType=fraction_one_digit;
break;
1649 case 7: newFormatType=fraction_two_digits;
break;
1650 case 8: newFormatType=fraction_three_digits;
break;
1653 else if (time->isChecked())
1655 newFormatType=Time_format;
1656 switch (listFormat->currentItem())
1658 case 0: newFormatType=Time_format;
break;
1659 case 1: newFormatType=SecondeTime_format;
break;
1660 case 2: newFormatType=Time_format1;
break;
1661 case 3: newFormatType=Time_format2;
break;
1662 case 4: newFormatType=Time_format3;
break;
1663 case 5: newFormatType=Time_format4;
break;
1664 case 6: newFormatType=Time_format5;
break;
1665 case 7: newFormatType=Time_format6;
break;
1666 case 8: newFormatType=Time_format7;
break;
1667 case 9: newFormatType=Time_format8;
break;
1670 else if (textFormat->isChecked())
1671 newFormatType = Text_format;
1672 else if (customFormat->isChecked())
1673 newFormatType = Custom_format;
1676void CellFormatPageFloat::makeformat()
1678 m_bFormatTypeChanged=
true;
1683 Format::FloatFormat floatFormat = Format::OnlyNegSigned;
1684 switch( format->currentItem() )
1687 floatFormat = Format::OnlyNegSigned;
1691 floatFormat = Format::OnlyNegSigned;
1695 floatFormat = Format::AlwaysUnsigned;
1699 floatFormat = Format::AlwaysSigned;
1703 floatFormat = Format::AlwaysSigned;
1707 if (!dlg->value.
isNumber() || dlg->value.
asFloat() >= 0 || !format->isEnabled())
1712 tmp = fmt->
formatText(dlg->value, newFormatType, precision->value(),
1714 prefix->isEnabled() ? prefix->text() : TQString(),
1715 postfix->isEnabled() ? postfix->text() : TQString(),
1716 newFormatType == Money_format ? dlg->cCurrency.symbol : TQString());
1717 if (tmp.length() > 50)
1718 tmp = tmp.left (50);
1719 exampleLabel->setText(tmp.prepend(
"<font color=" + color.name() +
">").append(
"</font>"));
1722void CellFormatPageFloat::apply(
CustomStyle * style )
1724 if ( postfix->text() != dlg->postfix )
1726 if ( postfix->isEnabled())
1727 style->changePostfix( postfix->text() );
1729 style->changePostfix(
"" );
1731 if ( prefix->text() != dlg->prefix )
1733 if (prefix->isEnabled())
1734 style->changePrefix( prefix->text() );
1736 style->changePrefix(
"" );
1739 if ( dlg->precision != precision->value() )
1740 style->changePrecision( precision->value() );
1742 if ( m_bFormatColorChanged )
1744 switch( format->currentItem() )
1747 style->changeFloatFormat( Format::OnlyNegSigned );
1748 style->changeFloatColor( Format::AllBlack );
1751 style->changeFloatFormat( Format::OnlyNegSigned );
1752 style->changeFloatColor( Format::NegRed );
1755 style->changeFloatFormat( Format::AlwaysUnsigned );
1756 style->changeFloatColor( Format::NegRed );
1759 style->changeFloatFormat( Format::AlwaysSigned );
1760 style->changeFloatColor( Format::AllBlack );
1763 style->changeFloatFormat( Format::AlwaysSigned );
1764 style->changeFloatColor( Format::NegRed );
1768 if ( m_bFormatTypeChanged )
1770 style->changeFormatType (newFormatType);
1771 if ( money->isChecked() )
1773 Format::Currency cur;
1774 int index = currency->currentItem();
1777 if ( currency->currentText() == i18n(
"Automatic" ) )
1779 cur.symbol = dlg->locale()->currencySymbol();
1785 cur.symbol = currency->currentText();
1791 cur.symbol = Currency::getDisplaySymbol( index );
1794 style->changeCurrency( cur );
1801 if ( postfix->text() != dlg->postfix )
1802 if ( postfix->isEnabled())
1805 if ( postfix->isEnabled())
1806 _obj->setPostfix( postfix->text() );
1808 _obj->setPostfix(
"" );
1810 if ( prefix->text() != dlg->prefix )
1811 if (prefix->isEnabled())
1812 _obj->setPrefix( prefix->text() );
1814 _obj->setPrefix(
"" );
1816 if ( dlg->precision != precision->value() )
1817 _obj->setPrecision( precision->value() );
1819 if (m_bFormatColorChanged)
1821 switch( format->currentItem() )
1824 _obj->setFloatFormat( Format::OnlyNegSigned );
1825 _obj->setFloatColor( Format::AllBlack );
1828 _obj->setFloatFormat( Format::OnlyNegSigned );
1829 _obj->setFloatColor( Format::NegRed );
1832 _obj->setFloatFormat( Format::AlwaysUnsigned );
1833 _obj->setFloatColor( Format::NegRed );
1836 _obj->setFloatFormat( Format::AlwaysSigned );
1837 _obj->setFloatColor( Format::AllBlack );
1840 _obj->setFloatFormat( Format::AlwaysSigned );
1841 _obj->setFloatColor( Format::NegRed );
1845 if (m_bFormatTypeChanged)
1847 _obj->setFormatType (newFormatType);
1848 if (money->isChecked())
1850 Format::Currency cur;
1851 int index = currency->currentItem();
1854 if ( currency->currentText() == i18n(
"Automatic" ) )
1856 cur.symbol = dlg->locale()->currencySymbol();
1862 cur.symbol = currency->currentText();
1868 cur.symbol = Currency::getDisplaySymbol( index );
1871 _obj->setCurrency( cur.type, cur.symbol );
1884CellFormatPageProtection::CellFormatPageProtection( TQWidget* parent,
CellFormatDialog * _dlg )
1885 : ProtectionTab( parent ),
1888 m_bDontPrint->setChecked( m_dlg->bDontPrintText );
1889 m_bHideAll->setChecked( m_dlg->bHideAll );
1890 m_bHideFormula->setChecked( m_dlg->bHideFormula );
1891 m_bIsProtected->setChecked( m_dlg->bIsProtected );
1894CellFormatPageProtection::~CellFormatPageProtection()
1898void CellFormatPageProtection::apply(
CustomStyle * style )
1900 if ( m_dlg->bDontPrintText != m_bDontPrint->isChecked() )
1902 if ( m_bDontPrint->isChecked() )
1903 style->addProperty( Style::PDontPrintText );
1905 style->removeProperty( Style::PDontPrintText );
1908 if ( m_dlg->bIsProtected != m_bIsProtected->isChecked() )
1910 if ( !m_bIsProtected->isChecked() )
1911 style->addProperty( Style::PNotProtected );
1913 style->removeProperty( Style::PNotProtected );
1916 if ( m_dlg->bHideAll != m_bHideAll->isChecked() )
1918 if ( m_bHideAll->isChecked() )
1919 style->addProperty( Style::PHideAll );
1921 style->removeProperty( Style::PHideAll );
1924 if ( m_dlg->bHideFormula != m_bHideFormula->isChecked() )
1926 if ( m_bHideFormula->isChecked() )
1927 style->addProperty( Style::PHideFormula );
1929 style->removeProperty( Style::PHideFormula );
1935 if ( m_dlg->bDontPrintText != m_bDontPrint->isChecked())
1936 _obj->setDontPrintText( m_bDontPrint->isChecked() );
1938 if ( m_dlg->bIsProtected != m_bIsProtected->isChecked())
1939 _obj->setNotProtected( !m_bIsProtected->isChecked() );
1941 if ( m_dlg->bHideAll != m_bHideAll->isChecked())
1942 _obj->setHideAll( m_bHideAll->isChecked() );
1944 if ( m_dlg->bHideFormula != m_bHideFormula->isChecked())
1945 _obj->setHideFormula( m_bHideFormula->isChecked() );
1956CellFormatPageFont::CellFormatPageFont( TQWidget* parent,
CellFormatDialog *_dlg ) : FontTab( parent )
1960 bTextColorUndefined = !dlg->bTextColor;
1962 connect( textColorButton, TQ_SIGNAL( changed(
const TQColor & ) ),
1963 this, TQ_SLOT( slotSetTextColor(
const TQColor & ) ) );
1966 TQStringList tmpListFont;
1967 TQFontDatabase *fontDataBase =
new TQFontDatabase();
1968 tmpListFont = fontDataBase->families();
1969 delete fontDataBase;
1971 family_combo->insertStringList( tmpListFont);
1972 selFont = dlg->textFont;
1974 if ( dlg->bTextFontFamily )
1976 selFont.setFamily( dlg->textFontFamily );
1977 kdDebug(36001) <<
"Family = " << dlg->textFontFamily << endl;
1979 if ( !family_combo->findItem(dlg->textFontFamily))
1981 family_combo->insertItem(
"",0);
1982 family_combo->setCurrentItem(0);
1985 family_combo->setCurrentItem(family_combo->index(family_combo->findItem(dlg->textFontFamily)));
1989 family_combo->insertItem(
"",0);
1990 family_combo->setCurrentItem(0);
1993 connect( family_combo, TQ_SIGNAL(highlighted(
const TQString &)),
1994 TQ_SLOT(family_chosen_slot(
const TQString &)) );
1998 for (
unsigned int i = 1; i < 100; ++i )
1999 lst.append( TQString(
"%1" ).arg( i ) );
2001 size_combo->insertStringList( lst );
2004 size_combo->setInsertionPolicy(TQComboBox::NoInsertion);
2006 connect( size_combo, TQ_SIGNAL(activated(
const TQString &)),
2007 TQ_SLOT(size_chosen_slot(
const TQString &)) );
2008 connect( size_combo ,TQ_SIGNAL( textChanged(
const TQString &)),
2009 this,TQ_SLOT(size_chosen_slot(
const TQString &)));
2011 connect( weight_combo, TQ_SIGNAL(activated(
const TQString &)),
2012 TQ_SLOT(weight_chosen_slot(
const TQString &)) );
2014 connect( style_combo, TQ_SIGNAL(activated(
const TQString &)),
2015 TQ_SLOT(style_chosen_slot(
const TQString &)) );
2017 strike->setChecked(dlg->strike);
2018 connect( strike, TQ_SIGNAL( clicked()),
2019 TQ_SLOT(strike_chosen_slot()) );
2021 underline->setChecked(dlg->underline);
2022 connect( underline, TQ_SIGNAL( clicked()),
2023 TQ_SLOT(underline_chosen_slot()) );
2025 example_label->setText(i18n(
"Dolor Ipse"));
2027 connect(
this,TQ_SIGNAL(fontSelected(
const TQFont& )),
2028 this,TQ_SLOT(display_example(
const TQFont&)));
2031 display_example( selFont );
2033 this->resize( 400, 400 );
2036void CellFormatPageFont::slotSetTextColor(
const TQColor &_color )
2039 bTextColorUndefined =
false;
2042void CellFormatPageFont::apply(
CustomStyle * style )
2044 if ( !bTextColorUndefined && textColor != dlg->textColor )
2045 style->changeTextColor( textColor );
2047 if ( ( size_combo->currentItem() != 0 )
2048 && ( dlg->textFontSize != selFont.pointSize() ) )
2049 style->changeFontSize( selFont.pointSize() );
2051 if ( ( selFont.family() != dlg->textFontFamily )
2052 && !family_combo->currentText().isEmpty() )
2053 style->changeFontFamily( selFont.family() );
2057 if ( weight_combo->currentItem() != 0 && selFont.bold() )
2058 flags |= Style::FBold;
2060 flags &= ~(uint) Style::FBold;
2062 if ( style_combo->currentItem() != 0 && selFont.italic() )
2063 flags |= Style::FItalic;
2065 flags &= ~(uint) Style::FItalic;
2067 if ( strike->isChecked() )
2068 flags |= Style::FStrike;
2070 flags &= ~(uint) Style::FStrike;
2072 if ( underline->isChecked() )
2073 flags |= Style::FUnderline;
2075 flags &= ~(uint) Style::FUnderline;
2077 style->changeFontFlags( flags );
2082 if ( !bTextColorUndefined && textColor != dlg->textColor )
2083 _obj->setTextColor( textColor );
2086 if ( ( size_combo->currentItem() != 0 )
2087 && ( dlg->textFontSize != selFont.pointSize() ) )
2088 _obj->setFontSize( selFont.pointSize() );
2089 if ( ( selFont.family() != dlg->textFontFamily ) && ( !family_combo->currentText().isEmpty() ) )
2090 _obj->setFontFamily( selFont.family() );
2091 if ( weight_combo->currentItem() != 0 )
2092 _obj->setFontBold( selFont.bold() );
2093 if ( style_combo->currentItem() != 0 )
2094 _obj->setFontItalic( selFont.italic() );
2095 _obj->setFontStrike( strike->isChecked() );
2096 _obj->setFontUnderline(underline->isChecked() );
2100void CellFormatPageFont::underline_chosen_slot()
2102 selFont.setUnderline( underline->isChecked() );
2103 emit fontSelected(selFont);
2106void CellFormatPageFont::strike_chosen_slot()
2108 selFont.setStrikeOut( strike->isChecked() );
2109 emit fontSelected(selFont);
2112void CellFormatPageFont::family_chosen_slot(
const TQString & family)
2114 selFont.setFamily(family);
2115 emit fontSelected(selFont);
2118void CellFormatPageFont::size_chosen_slot(
const TQString & size)
2120 TQString size_string = size;
2122 selFont.setPointSize(size_string.toInt());
2123 emit fontSelected(selFont);
2126void CellFormatPageFont::weight_chosen_slot(
const TQString & weight)
2128 TQString weight_string = weight;
2130 if ( weight_string == i18n(
"Normal"))
2131 selFont.setBold(
false);
2132 if ( weight_string == i18n(
"Bold"))
2133 selFont.setBold(
true);
2134 emit fontSelected(selFont);
2137void CellFormatPageFont::style_chosen_slot(
const TQString & style)
2139 TQString style_string = style;
2141 if ( style_string == i18n(
"Roman"))
2142 selFont.setItalic(
false);
2143 if ( style_string == i18n(
"Italic"))
2144 selFont.setItalic(
true);
2145 emit fontSelected(selFont);
2149void CellFormatPageFont::display_example(
const TQFont& font)
2153 example_label->setFont(font);
2154 example_label->repaint();
2157void CellFormatPageFont::setCombos()
2161 int number_of_entries;
2164 if ( dlg->bTextColor )
2165 textColor = dlg->textColor;
2167 textColor = colorGroup().text();
2169 if ( !textColor.isValid() )
2170 textColor =colorGroup().text();
2172 textColorButton->setColor( textColor );
2176 if ( dlg->bTextFontSize )
2178 kdDebug(36001) <<
"SIZE=" << dlg->textFontSize << endl;
2179 selFont.setPointSize( dlg->textFontSize );
2180 number_of_entries = size_combo->count();
2181 string.setNum( dlg->textFontSize );
2184 for (
int i = 0; i < number_of_entries ; i++){
2185 if (
string == (TQString) combo->text(i)){
2186 combo->setCurrentItem(i);
2194 combo->setCurrentItem( 0 );
2196 if ( !dlg->bTextFontBold )
2197 weight_combo->setCurrentItem(0);
2198 else if ( dlg->textFontBold )
2200 selFont.setBold( dlg->textFontBold );
2201 weight_combo->setCurrentItem(2);
2205 selFont.setBold( dlg->textFontBold );
2206 weight_combo->setCurrentItem(1);
2209 if ( !dlg->bTextFontItalic )
2210 weight_combo->setCurrentItem(0);
2211 else if ( dlg->textFontItalic )
2213 selFont.setItalic( dlg->textFontItalic );
2214 style_combo->setCurrentItem(2);
2218 selFont.setItalic( dlg->textFontItalic );
2219 style_combo->setCurrentItem(1);
2231CellFormatPagePosition::CellFormatPagePosition( TQWidget* parent,
CellFormatDialog *_dlg )
2232 : PositionTab(parent ),
2235 if ( dlg->alignX == Format::Left )
2236 left->setChecked(
true );
2237 else if ( dlg->alignX == Format::Center )
2238 center->setChecked(
true );
2239 else if ( dlg->alignX == Format::Right )
2240 right->setChecked(
true );
2241 else if ( dlg->alignX == Format::Undefined )
2242 standard->setChecked(
true );
2244 connect(horizontalGroup, TQ_SIGNAL(clicked(
int)),
this, TQ_SLOT(slotStateChanged(
int)));
2246 if ( dlg->alignY ==Format::Top )
2247 top->setChecked(
true );
2248 else if ( dlg->alignY ==Format::Middle )
2249 middle->setChecked(
true );
2250 else if ( dlg->alignY ==Format::Bottom )
2251 bottom->setChecked(
true );
2253 multi->setChecked(dlg->bMultiRow);
2255 vertical->setChecked(dlg->bVerticalText);
2257 angleRotation->setValue(-dlg->textRotation);
2258 spinBox3->setValue(-dlg->textRotation);
2259 if ( dlg->textRotation != 0 )
2261 multi->setEnabled(
false );
2262 vertical->setEnabled(
false);
2265 mergeCell->setChecked(dlg->isMerged);
2266 mergeCell->setEnabled(!dlg->oneCell && ((!dlg->isRowSelected) && (!dlg->isColumnSelected)));
2268 TQGridLayout *grid2 =
new TQGridLayout(indentGroup, 1, 1, KDialog::marginHint(), KDialog::spacingHint());
2269 grid2->addRowSpacing( 0, indentGroup->fontMetrics().height()/8 );
2270 m_indent =
new KoUnitDoubleSpinBox( indentGroup, 0.0, 400.0, 10.0,dlg->indent,dlg->getDoc()->unit() );
2271 grid2->addWidget(m_indent, 0, 0);
2273 width =
new KoUnitDoubleSpinBox( m_widthPanel );
2274 TQGridLayout *gridWidth =
new TQGridLayout(m_widthPanel, 1, 1, 0, 0);
2275 gridWidth->addWidget(width, 0, 0);
2276 width->setValue ( dlg->widthSize );
2277 width->setUnit( dlg->getDoc()->unit() );
2279 dlg->widthSize = width->value();
2281 if ( dlg->isRowSelected )
2282 width->setEnabled(
false);
2284 defaultWidth->setText(i18n(
"Default width (%1 %2)").arg(KoUnit::toUserValue(dlg->defaultWidthSize, dlg->getDoc()->unit()), 0,
'f', 2).arg(dlg->getDoc()->
unitName()));
2285 if ( dlg->isRowSelected )
2286 defaultWidth->setEnabled(
false);
2288 height=
new KoUnitDoubleSpinBox( m_heightPanel );
2289 TQGridLayout *gridHeight =
new TQGridLayout(m_heightPanel, 1, 1, 0, 0);
2290 gridHeight->addWidget(height, 0, 0);
2291 height->setValue( dlg->heightSize );
2292 height->setUnit( dlg->getDoc()->unit() );
2294 dlg->heightSize = height->value();
2296 if ( dlg->isColumnSelected )
2297 height->setEnabled(
false);
2299 defaultHeight->setText(i18n(
"Default height (%1 %2)").arg(KoUnit::toUserValue(dlg->defaultHeightSize, dlg->getDoc()->unit()), 0,
'f', 2).arg(dlg->getDoc()->
unitName()));
2300 if ( dlg->isColumnSelected )
2301 defaultHeight->setEnabled(
false);
2304 if (dlg->getStyle())
2306 defaultHeight->setEnabled(
false);
2307 defaultWidth->setEnabled(
false);
2310 connect(defaultWidth , TQ_SIGNAL(clicked() ),
this, TQ_SLOT(slotChangeWidthState()));
2311 connect(defaultHeight , TQ_SIGNAL(clicked() ),
this, TQ_SLOT(slotChangeHeightState()));
2312 connect(vertical , TQ_SIGNAL(clicked() ),
this, TQ_SLOT(slotChangeVerticalState()));
2313 connect(multi , TQ_SIGNAL(clicked() ),
this, TQ_SLOT(slotChangeMultiState()));
2314 connect(angleRotation, TQ_SIGNAL(valueChanged(
int)),
this, TQ_SLOT(slotChangeAngle(
int)));
2316 slotStateChanged( 0 );
2317 m_bOptionText =
false;
2318 this->resize( 400, 400 );
2321void CellFormatPagePosition::slotChangeMultiState()
2323 m_bOptionText =
true;
2324 if (vertical->isChecked())
2326 vertical->setChecked(
false);
2330void CellFormatPagePosition::slotChangeVerticalState()
2333 if (multi->isChecked())
2335 multi->setChecked(
false);
2340void CellFormatPagePosition::slotStateChanged(
int)
2342 if (right->isChecked() || center->isChecked())
2343 m_indent->setEnabled(
false);
2345 m_indent->setEnabled(
true);
2348bool CellFormatPagePosition::getMergedCellState()
const
2350 return mergeCell->isChecked();
2353void CellFormatPagePosition::slotChangeWidthState()
2355 if ( defaultWidth->isChecked())
2356 width->setEnabled(
false);
2358 width->setEnabled(
true);
2361void CellFormatPagePosition::slotChangeHeightState()
2363 if ( defaultHeight->isChecked())
2364 height->setEnabled(
false);
2366 height->setEnabled(
true);
2369void CellFormatPagePosition::slotChangeAngle(
int _angle)
2373 multi->setEnabled(
true );
2374 vertical->setEnabled(
true );
2378 multi->setEnabled(
false );
2379 vertical->setEnabled(
false );
2383void CellFormatPagePosition::apply(
CustomStyle * style )
2385 if ( top->isChecked() && dlg->alignY != Format::Top )
2386 style->changeAlignY( Format::Top );
2387 else if ( bottom->isChecked() && dlg->alignY != Format::Bottom )
2388 style->changeAlignY( Format::Bottom );
2389 else if ( middle->isChecked() && dlg->alignY != Format::Middle )
2390 style->changeAlignY( Format::Middle );
2392 if ( left->isChecked() && dlg->alignX != Format::Left )
2393 style->changeAlignX( Format::Left );
2394 else if ( right->isChecked() && dlg->alignX != Format::Right )
2395 style->changeAlignX( Format::Right );
2396 else if ( center->isChecked() && dlg->alignX != Format::Center )
2397 style->changeAlignX( Format::Center );
2398 else if ( standard->isChecked() && dlg->alignX != Format::Undefined )
2399 style->changeAlignX( Format::Undefined );
2401 if ( m_bOptionText )
2403 if ( multi->isEnabled() )
2405 if ( multi->isChecked() )
2406 style->addProperty( Style::PMultiRow );
2408 style->removeProperty( Style::PMultiRow );
2412 if ( m_bOptionText )
2414 if ( vertical->isEnabled() )
2416 if ( vertical->isChecked() )
2417 style->addProperty( Style::PVerticalText );
2419 style->removeProperty( Style::PVerticalText );
2423 if ( dlg->textRotation != angleRotation->value() )
2424 style->changeRotateAngle( (-angleRotation->value()) );
2426 if ( m_indent->isEnabled()
2427 && dlg->indent != m_indent->value() )
2428 style->changeIndent( m_indent->value() );
2431 if ( dlg->getStyle()->type() ==
Style::BUILTIN && dlg->getStyle()->name() ==
"Default" )
2433 if ( (
int) height->value() != (
int) dlg->heightSize )
2435 Format::setGlobalRowHeight( height->value() );
2437 if ( (
int) width->value() != (
int) dlg->widthSize )
2439 Format::setGlobalColWidth( width->value() );
2449 if ( top->isChecked() )
2451 else if ( bottom->isChecked() )
2452 ay = Format::Bottom;
2453 else if ( middle->isChecked() )
2454 ay = Format::Middle;
2456 ay = Format::Middle;
2458 if ( left->isChecked() )
2460 else if ( right->isChecked() )
2462 else if ( center->isChecked() )
2463 ax = Format::Center;
2464 else if ( standard->isChecked() )
2465 ax = Format::Undefined;
2467 ax = Format::Undefined;
2469 if ( top->isChecked() && ay != dlg->alignY )
2470 _obj->setVerticalAlignment( Format::Top );
2471 else if ( bottom->isChecked() && ay != dlg->alignY )
2472 _obj->setVerticalAlignment( Format::Bottom );
2473 else if ( middle->isChecked() && ay != dlg->alignY )
2474 _obj->setVerticalAlignment( Format::Middle );
2476 if ( left->isChecked() && ax != dlg->alignX )
2477 _obj->setHorizontalAlignment( Format::Left );
2478 else if ( right->isChecked() && ax != dlg->alignX )
2479 _obj->setHorizontalAlignment( Format::Right );
2480 else if ( center->isChecked() && ax != dlg->alignX )
2481 _obj->setHorizontalAlignment( Format::Center );
2482 else if ( standard->isChecked() && ax != dlg->alignX )
2483 _obj->setHorizontalAlignment( Format::Undefined );
2485 if ( m_bOptionText )
2487 if ( multi->isEnabled() )
2488 _obj->setMultiRow( multi->isChecked() );
2490 _obj->setMultiRow(
false );
2493 if ( m_bOptionText )
2495 if ( vertical->isEnabled() )
2496 _obj->setVerticalText( vertical->isChecked() );
2498 _obj->setVerticalText(
false );
2501 if ( dlg->textRotation!=angleRotation->value() )
2502 _obj->setAngle( (-angleRotation->value() ) );
2503 if ( m_indent->isEnabled()
2504 && dlg->indent != m_indent->value() )
2505 _obj->setIndent( m_indent->value() );
2508double CellFormatPagePosition::getSizeHeight()
const
2510 if ( defaultHeight->isChecked() )
2511 return dlg->defaultHeightSize;
2513 return height->value();
2516double CellFormatPagePosition::getSizeWidth()
const
2518 if ( defaultWidth->isChecked() )
2519 return dlg->defaultWidthSize;
2521 return width->value();
2532BorderButton::BorderButton( TQWidget *parent,
const char *_name ) : TQPushButton(parent,_name)
2534 penStyle = TQt::NoPen;
2536 penColor = colorGroup().text();
2537 setToggleButton(
true );
2541void BorderButton::mousePressEvent( TQMouseEvent * )
2544 this->setOn(!isOn());
2545 emit clicked(
this );
2548void BorderButton::setUndefined()
2550 setPenStyle(TQt::SolidLine );
2552 setColor(colorGroup().midlight());
2556void BorderButton::unselect()
2560 setPenStyle(TQt::NoPen);
2561 setColor( colorGroup().text() );
2573Border::Border( TQWidget *parent,
const char *_name,
bool _oneCol,
bool _oneRow )
2574 : TQFrame( parent, _name )
2583void Border::paintEvent( TQPaintEvent *_ev )
2585 TQFrame::paintEvent( _ev );
2588 painter.begin(
this );
2589 pen=TQPen( colorGroup().midlight(),2,SolidLine);
2590 painter.setPen( pen );
2592 painter.drawLine( OFFSETX-5, OFFSETY, OFFSETX , OFFSETY );
2593 painter.drawLine( OFFSETX, OFFSETY-5, OFFSETX , OFFSETY );
2594 painter.drawLine( width()-OFFSETX, OFFSETY, width() , OFFSETY );
2595 painter.drawLine( width()-OFFSETX, OFFSETY-5, width()-OFFSETX , OFFSETY );
2597 painter.drawLine( OFFSETX, height()-OFFSETY, OFFSETX , height() );
2598 painter.drawLine( OFFSETX-5, height()-OFFSETY, OFFSETX , height()-OFFSETY );
2600 painter.drawLine( width()-OFFSETX, height()-OFFSETY, width() , height()-OFFSETY );
2601 painter.drawLine( width()-OFFSETX, height()-OFFSETY, width()-OFFSETX , height() );
2604 painter.drawLine( width()/2, OFFSETY-5, width()/2 , OFFSETY );
2605 painter.drawLine( width()/2-5, OFFSETY, width()/2+5 , OFFSETY );
2606 painter.drawLine( width()/2, height()-OFFSETY, width()/2 , height() );
2607 painter.drawLine( width()/2-5, height()-OFFSETY, width()/2+5 , height()-OFFSETY );
2611 painter.drawLine( OFFSETX-5, height()/2, OFFSETX , height()/2 );
2612 painter.drawLine( OFFSETX, height()/2-5, OFFSETX , height()/2+5 );
2613 painter.drawLine( width()-OFFSETX, height()/2, width(), height()/2 );
2614 painter.drawLine( width()-OFFSETX, height()/2-5, width()-OFFSETX , height()/2+5 );
2620void Border::mousePressEvent( TQMouseEvent* _ev )
2622 emit choosearea(_ev);
2633CellFormatPageBorder::CellFormatPageBorder( TQWidget* parent,
CellFormatDialog *_dlg )
2634 : TQWidget( parent ),
2637 sheet = dlg->getSheet();
2640 InitializeBorderButtons();
2641 InitializePatterns();
2644 preview->slotSelect();
2645 pattern[2]->slotSelect();
2647 style->setEnabled(
false);
2648 size->setEnabled(
false);
2649 preview->setPattern( black , 1, TQt::SolidLine );
2650 this->resize( 400, 400 );
2653void CellFormatPageBorder::InitializeGrids()
2655 TQGridLayout *grid =
new TQGridLayout(
this,5,2,KDialog::marginHint(), KDialog::spacingHint());
2656 TQGridLayout *grid2 = NULL;
2657 TQGroupBox* tmpTQGroupBox = NULL;
2661 const char borderButtonNames[BorderType_END][20] =
2662 {
"top",
"bottom",
"left",
"right",
"vertical",
"fall",
"go",
"horizontal"};
2664 const char shortcutButtonNames[BorderShortcutType_END][20] =
2665 {
"remove",
"all",
"outline"};
2667 TQString borderButtonIconNames[BorderType_END] =
2668 {
"border_top",
"border_bottom",
"border_left",
"border_right",
2669 "border_vertical",
"border_horizontal",
"border_fall",
"border_up"};
2671 TQString shortcutButtonIconNames[BorderShortcutType_END] =
2672 {
"border_remove",
"",
"border_outline"};
2674 int borderButtonPositions[BorderType_END][2] =
2675 {{0,2}, {4,2}, {2,0}, {2,4}, {4,4}, {4,0}, {0,0}, {0,4}};
2677 int shortcutButtonPositions[BorderShortcutType_END][2] =
2678 { {0,0}, {0,1},{0,2} };
2682 tmpTQGroupBox =
new TQGroupBox(
this,
"GroupBox_1" );
2683 tmpTQGroupBox->setFrameStyle( TQFrame::Box | TQFrame::Sunken );
2684 tmpTQGroupBox->setTitle( i18n(
"Border") );
2685 tmpTQGroupBox->setAlignment( AlignLeft );
2686 grid2 =
new TQGridLayout(tmpTQGroupBox,6,5,KDialog::marginHint(), KDialog::spacingHint());
2687 int fHeight = tmpTQGroupBox->fontMetrics().height();
2688 grid2->addRowSpacing( 0, fHeight/2 );
2690 area=
new Border(tmpTQGroupBox,
"area",dlg->oneCol,dlg->oneRow);
2691 grid2->addMultiCellWidget(area,2,4,1,3);
2692 area->setBackgroundColor( colorGroup().base() );
2695 for (
int i=BorderType_Top; i < BorderType_END; i++)
2697 borderButtons[i] =
new BorderButton(tmpTQGroupBox,
2698 borderButtonNames[i]);
2699 loadIcon(borderButtonIconNames[i], borderButtons[i]);
2700 grid2->addWidget(borderButtons[i], borderButtonPositions[i][0] + 1,
2701 borderButtonPositions[i][1]);
2704 grid->addMultiCellWidget(tmpTQGroupBox,0,2,0,0);
2709 tmpTQGroupBox =
new TQGroupBox(
this,
"GroupBox_3" );
2710 tmpTQGroupBox->setFrameStyle( TQFrame::Box | TQFrame::Sunken );
2711 tmpTQGroupBox->setTitle( i18n(
"Preselect") );
2712 tmpTQGroupBox->setAlignment( AlignLeft );
2714 grid2 =
new TQGridLayout(tmpTQGroupBox,1,3,KDialog::marginHint(), KDialog::spacingHint());
2718 if ((dlg->oneRow==
true)&&(dlg->oneCol==
false))
2720 shortcutButtonIconNames[BorderShortcutType_All] =
"border_vertical";
2722 else if ((dlg->oneRow==
false)&&(dlg->oneCol==
true))
2724 shortcutButtonIconNames[BorderShortcutType_All] =
"border_horizontal";
2728 shortcutButtonIconNames[BorderShortcutType_All] =
"border_inside";
2731 for (
int i=BorderShortcutType_Remove; i < BorderShortcutType_END; i++)
2733 shortcutButtons[i] =
new BorderButton(tmpTQGroupBox,
2734 shortcutButtonNames[i]);
2735 loadIcon(shortcutButtonIconNames[i], shortcutButtons[i]);
2736 grid2->addWidget(shortcutButtons[i], shortcutButtonPositions[i][0],
2737 shortcutButtonPositions[i][1]);
2740 if (dlg->oneRow && dlg->oneCol)
2742 shortcutButtons[BorderShortcutType_All]->setEnabled(
false);
2745 grid->addMultiCellWidget(tmpTQGroupBox,3,4,0,0);
2748 tmpTQGroupBox =
new TQGroupBox(
this,
"GroupBox_10" );
2749 tmpTQGroupBox->setFrameStyle( TQFrame::Box | TQFrame::Sunken );
2750 tmpTQGroupBox->setTitle( i18n(
"Pattern") );
2751 tmpTQGroupBox->setAlignment( AlignLeft );
2753 grid2 =
new TQGridLayout(tmpTQGroupBox,7,2,KDialog::marginHint(), KDialog::spacingHint());
2754 fHeight = tmpTQGroupBox->fontMetrics().height();
2755 grid2->addRowSpacing( 0, fHeight/2 );
2757 char name[] =
"PatternXX";
2758 Q_ASSERT(NUM_BORDER_PATTERNS < 100);
2760 for (
int i=0; i < NUM_BORDER_PATTERNS; i++)
2762 name[7] =
'0' + (i+1) / 10;
2763 name[8] =
'0' + (i+1) % 10;
2764 pattern[i] =
new PatternSelect( tmpTQGroupBox, name );
2765 pattern[i]->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
2766 grid2->addWidget(pattern[i], i % 5 + 1, i / 5);
2776 color =
new KColorButton (tmpTQGroupBox,
"PushButton_1" );
2777 grid2->addWidget(color,7,1);
2779 TQLabel *tmpTQLabel =
new TQLabel( tmpTQGroupBox,
"Label_6" );
2780 tmpTQLabel->setText( i18n(
"Color:") );
2781 grid2->addWidget(tmpTQLabel,7,0);
2784 TQGridLayout *grid3 =
new TQGridLayout(
this, 2, 2, KDialog::marginHint(), KDialog::spacingHint() );
2785 customize =
new TQCheckBox(i18n(
"Customize"),tmpTQGroupBox);
2786 grid3->addWidget(customize,0,0);
2787 connect( customize, TQ_SIGNAL( clicked()), TQ_SLOT(cutomize_chosen_slot()) );
2789 size=
new TQComboBox(
true,tmpTQGroupBox);
2790 grid3->addWidget(size,1,1);
2791 size->setValidator(
new KIntValidator( size ));
2793 for (
int i=0;i<10;i++)
2796 size->insertItem(tmp);
2798 size->setCurrentItem(1);
2800 style=
new TQComboBox(tmpTQGroupBox);
2801 grid3->addWidget(style,1,0);
2802 style->insertItem(paintFormatPixmap(DotLine),0 );
2803 style->insertItem(paintFormatPixmap(DashLine) ,1);
2804 style->insertItem(paintFormatPixmap(DashDotLine),2 );
2805 style->insertItem(paintFormatPixmap(DashDotDotLine),3 );
2806 style->insertItem(paintFormatPixmap(SolidLine),4);
2807 style->setBackgroundColor( colorGroup().background() );
2809 grid2->addMultiCell(grid3,6,6,0,1);
2810 grid->addMultiCellWidget(tmpTQGroupBox,0,3,1,1);
2813 tmpTQGroupBox =
new TQGroupBox(
this,
"GroupBox_4" );
2814 tmpTQGroupBox->setFrameStyle( TQFrame::Box | TQFrame::Sunken );
2815 tmpTQGroupBox->setTitle( i18n(
"Preview") );
2816 tmpTQGroupBox->setAlignment( AlignLeft );
2818 grid2 =
new TQGridLayout(tmpTQGroupBox,1,1,KDialog::marginHint(), KDialog::spacingHint());
2819 fHeight = tmpTQGroupBox->fontMetrics().height();
2820 grid2->addRowSpacing( 0, fHeight/2 );
2822 preview =
new PatternSelect( tmpTQGroupBox,
"Pattern_preview" );
2823 preview->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
2824 grid2->addWidget(preview,1,0);
2826 grid->addWidget(tmpTQGroupBox,4,1);
2829void CellFormatPageBorder::InitializeBorderButtons()
2831 for (
int i=BorderType_Top; i < BorderType_END; i++)
2833 if (dlg->borders[i].style != TQt::NoPen ||
2834 !dlg->borders[i].bStyle )
2838 if ((dlg->oneRow ==
true && i == BorderType_Horizontal) ||
2839 (dlg->oneCol ==
true && i == BorderType_Vertical))
2841 borderButtons[i]->setEnabled(
false);
2843 else if ( dlg->borders[i].bColor && dlg->borders[i].bStyle )
2845 borderButtons[i]->setPenStyle(dlg->borders[i].style );
2846 borderButtons[i]->setPenWidth(dlg->borders[i].width);
2847 borderButtons[i]->setColor(dlg->borders[i].color);
2848 borderButtons[i]->setOn(
true);
2852 borderButtons[i]->setUndefined();
2860void CellFormatPageBorder::InitializePatterns()
2862 pattern[0]->setPattern( black, 1, TQt::DotLine );
2863 pattern[1]->setPattern( black, 1, TQt::DashLine );
2864 pattern[2]->setPattern( black, 1, TQt::SolidLine );
2865 pattern[3]->setPattern( black, 1, TQt::DashDotLine );
2866 pattern[4]->setPattern( black, 1, TQt::DashDotDotLine );
2867 pattern[5]->setPattern( black, 2, TQt::SolidLine );
2868 pattern[6]->setPattern( black, 3, TQt::SolidLine );
2869 pattern[7]->setPattern( black, 4, TQt::SolidLine );
2870 pattern[8]->setPattern( black, 5, TQt::SolidLine );
2871 pattern[9]->setPattern( black, 1, TQt::NoPen );
2873 slotSetColorButton( black );
2876void CellFormatPageBorder::SetConnections()
2878 connect( color, TQ_SIGNAL( changed(
const TQColor & ) ),
2879 this, TQ_SLOT( slotSetColorButton(
const TQColor & ) ) );
2881 for (
int i=0; i < NUM_BORDER_PATTERNS; i++)
2883 connect( pattern[i], TQ_SIGNAL( clicked( PatternSelect* ) ),
2884 this, TQ_SLOT( slotUnselect2( PatternSelect* ) ) );
2887 for (
int i = BorderType_Top; i < BorderType_END; i++)
2889 connect( borderButtons[i], TQ_SIGNAL( clicked (BorderButton *) ),
2890 this, TQ_SLOT( changeState( BorderButton *) ) );
2893 for (
int i = BorderShortcutType_Remove; i < BorderShortcutType_END; i++)
2895 connect( shortcutButtons[i], TQ_SIGNAL( clicked(BorderButton *) ),
2896 this, TQ_SLOT( preselect(BorderButton *) ) );
2899 connect( area ,TQ_SIGNAL( redraw()),
this,TQ_SLOT(draw()));
2900 connect( area ,TQ_SIGNAL( choosearea(TQMouseEvent * )),
2901 this,TQ_SLOT( slotPressEvent(TQMouseEvent *)));
2903 connect( style, TQ_SIGNAL( activated(
int)),
this, TQ_SLOT(slotChangeStyle(
int)));
2904 connect( size, TQ_SIGNAL( textChanged(
const TQString &)),
2905 this, TQ_SLOT(slotChangeStyle(
const TQString &)));
2906 connect( size ,TQ_SIGNAL( activated(
int)),
this, TQ_SLOT(slotChangeStyle(
int)));
2909void CellFormatPageBorder::cutomize_chosen_slot()
2911 if ( customize->isChecked() )
2913 style->setEnabled(
true );
2914 size->setEnabled(
true );
2915 slotUnselect2( preview );
2919 style->setEnabled(
false );
2920 size->setEnabled(
false );
2921 pattern[2]->slotSelect();
2922 preview->setPattern( black , 1, TQt::SolidLine );
2926void CellFormatPageBorder::slotChangeStyle(
const TQString &)
2932void CellFormatPageBorder::slotChangeStyle(
int)
2934 int index = style->currentItem();
2936 int penSize = size->currentText().toInt();
2939 preview->setPattern( preview->getColor(), penSize, TQt::NoPen );
2946 preview->setPattern( preview->getColor(), penSize, TQt::DotLine );
2949 preview->setPattern( preview->getColor(), penSize, TQt::DashLine );
2952 preview->setPattern( preview->getColor(), penSize, TQt::DashDotLine );
2955 preview->setPattern( preview->getColor(), penSize, TQt::DashDotDotLine );
2958 preview->setPattern( preview->getColor(), penSize, TQt::SolidLine );
2961 kdDebug(36001)<<
"Error in combobox\n";
2965 slotUnselect2(preview);
2968TQPixmap CellFormatPageBorder::paintFormatPixmap(PenStyle _style)
2970 TQPixmap pixmap( style->width(), 14 );
2973 pen=TQPen( colorGroup().text(),1,_style);
2974 painter.begin( &pixmap );
2975 painter.fillRect( 0, 0, style->width(), 14, colorGroup().background() );
2976 painter.setPen( pen );
2977 painter.drawLine( 0, 7, style->width(), 7 );
2982void CellFormatPageBorder::loadIcon( TQString _pix, BorderButton *_button)
2984 _button->setPixmap( TQPixmap( BarIcon(_pix, Factory::global()) ) );
2989 if (borderButtons[BorderType_Horizontal]->isChanged())
2990 applyHorizontalOutline(obj);
2992 if (borderButtons[BorderType_Vertical]->isChanged())
2993 applyVerticalOutline(obj);
2995 if ( borderButtons[BorderType_Left]->isChanged() )
2996 applyLeftOutline(obj);
2998 if ( borderButtons[BorderType_Right]->isChanged() )
2999 applyRightOutline(obj);
3001 if ( borderButtons[BorderType_Top]->isChanged() )
3002 applyTopOutline(obj);
3004 if ( borderButtons[BorderType_Bottom]->isChanged() )
3005 applyBottomOutline(obj);
3007 if ( borderButtons[BorderType_RisingDiagonal]->isChanged() ||
3008 borderButtons[BorderType_FallingDiagonal]->isChanged() )
3009 applyDiagonalOutline(obj);
3014 BorderButton * top = borderButtons[BorderType_Top];
3016 TQPen tmpPen( top->getColor(), top->getPenWidth(), top->getPenStyle());
3018 if ( dlg->getStyle() )
3020 dlg->getStyle()->changeTopBorderPen( tmpPen );
3024 if (borderButtons[BorderType_Top]->isChanged())
3025 obj->setTopBorderPen( tmpPen );
3031 BorderButton * bottom = borderButtons[BorderType_Bottom];
3033 TQPen tmpPen( bottom->getColor(), bottom->getPenWidth(), bottom->getPenStyle() );
3035 if ( dlg->getStyle() )
3037 dlg->getStyle()->changeBottomBorderPen( tmpPen );
3041 if (borderButtons[BorderType_Bottom]->isChanged())
3042 obj->setBottomBorderPen( tmpPen );
3048 BorderButton * left = borderButtons[BorderType_Left];
3049 TQPen tmpPen( left->getColor(), left->getPenWidth(), left->getPenStyle() );
3051 if ( dlg->getStyle() )
3053 dlg->getStyle()->changeLeftBorderPen( tmpPen );
3057 if (borderButtons[BorderType_Left]->isChanged())
3058 obj->setLeftBorderPen( tmpPen );
3064 BorderButton* right = borderButtons[BorderType_Right];
3065 TQPen tmpPen( right->getColor(), right->getPenWidth(), right->getPenStyle() );
3067 if ( dlg->getStyle() )
3069 dlg->getStyle()->changeRightBorderPen( tmpPen );
3073 if (borderButtons[BorderType_Right]->isChanged())
3074 obj->setRightBorderPen( tmpPen );
3080 BorderButton * fallDiagonal = borderButtons[BorderType_FallingDiagonal];
3081 BorderButton * goUpDiagonal = borderButtons[BorderType_RisingDiagonal];
3082 TQPen tmpPenFall( fallDiagonal->getColor(), fallDiagonal->getPenWidth(),
3083 fallDiagonal->getPenStyle());
3084 TQPen tmpPenGoUp( goUpDiagonal->getColor(), goUpDiagonal->getPenWidth(),
3085 goUpDiagonal->getPenStyle());
3087 if ( dlg->getStyle() )
3089 if ( fallDiagonal->isChanged() )
3090 dlg->getStyle()->changeFallBorderPen( tmpPenFall );
3091 if ( goUpDiagonal->isChanged() )
3092 dlg->getStyle()->changeGoUpBorderPen( tmpPenGoUp );
3096 if ( fallDiagonal->isChanged() )
3097 obj->setFallDiagonalPen( tmpPenFall );
3098 if ( goUpDiagonal->isChanged() )
3099 obj->setGoUpDiagonalPen( tmpPenGoUp );
3105 TQPen tmpPen( borderButtons[BorderType_Horizontal]->getColor(),
3106 borderButtons[BorderType_Horizontal]->getPenWidth(),
3107 borderButtons[BorderType_Horizontal]->getPenStyle());
3109 if ( dlg->getStyle() )
3111 dlg->getStyle()->changeTopBorderPen( tmpPen );
3115 if (borderButtons[BorderType_Horizontal]->isChanged())
3116 obj->setHorizontalPen( tmpPen );
3122 BorderButton* vertical = borderButtons[BorderType_Vertical];
3123 TQPen tmpPen( vertical->getColor(), vertical->getPenWidth(),
3124 vertical->getPenStyle());
3126 if ( dlg->getStyle() )
3128 dlg->getStyle()->changeLeftBorderPen( tmpPen );
3132 if (borderButtons[BorderType_Vertical]->isChanged())
3133 obj->setVerticalPen( tmpPen );
3138void CellFormatPageBorder::slotSetColorButton(
const TQColor &_color )
3140 currentColor = _color;
3142 for (
int i = 0; i < NUM_BORDER_PATTERNS; ++i )
3144 pattern[i]->setColor( currentColor );
3146 preview->setColor( currentColor );
3149void CellFormatPageBorder::slotUnselect2( PatternSelect *_p )
3151 for (
int i = 0; i < NUM_BORDER_PATTERNS; ++i )
3153 if ( pattern[i] != _p )
3155 pattern[i]->slotUnselect();
3158 preview->setPattern( _p->getColor(), _p->getPenWidth(), _p->getPenStyle() );
3161void CellFormatPageBorder::preselect( BorderButton *_p )
3163 BorderButton* top = borderButtons[BorderType_Top];
3164 BorderButton* bottom = borderButtons[BorderType_Bottom];
3165 BorderButton* left = borderButtons[BorderType_Left];
3166 BorderButton* right = borderButtons[BorderType_Right];
3167 BorderButton* vertical = borderButtons[BorderType_Vertical];
3168 BorderButton* horizontal = borderButtons[BorderType_Horizontal];
3169 BorderButton* remove = shortcutButtons[BorderShortcutType_Remove];
3170 BorderButton* outline = shortcutButtons[BorderShortcutType_Outline];
3171 BorderButton* all = shortcutButtons[BorderShortcutType_All];
3176 for (
int i=BorderType_Top; i < BorderType_END; i++)
3178 if (borderButtons[i]->isOn())
3180 borderButtons[i]->unselect();
3187 top->setPenWidth(preview->getPenWidth());
3188 top->setPenStyle(preview->getPenStyle());
3189 top->setColor( currentColor );
3190 top->setChanged(
true);
3191 bottom->setOn(
true);
3192 bottom->setPenWidth(preview->getPenWidth());
3193 bottom->setPenStyle(preview->getPenStyle());
3194 bottom->setColor( currentColor );
3195 bottom->setChanged(
true);
3197 left->setPenWidth(preview->getPenWidth());
3198 left->setPenStyle(preview->getPenStyle());
3199 left->setColor( currentColor );
3200 left->setChanged(
true);
3202 right->setPenWidth(preview->getPenWidth());
3203 right->setPenStyle(preview->getPenStyle());
3204 right->setColor( currentColor );
3205 right->setChanged(
true);
3209 if (dlg->oneRow==
false)
3211 horizontal->setOn(
true);
3212 horizontal->setPenWidth(preview->getPenWidth());
3213 horizontal->setPenStyle(preview->getPenStyle());
3214 horizontal->setColor( currentColor );
3215 horizontal->setChanged(
true);
3217 if (dlg->oneCol==
false)
3219 vertical->setOn(
true);
3220 vertical->setPenWidth(preview->getPenWidth());
3221 vertical->setPenStyle(preview->getPenStyle());
3222 vertical->setColor( currentColor );
3223 vertical->setChanged(
true);
3229void CellFormatPageBorder::changeState( BorderButton *_p)
3231 _p->setChanged(
true);
3235 _p->setPenWidth(preview->getPenWidth());
3236 _p->setPenStyle(preview->getPenStyle());
3237 _p->setColor( currentColor );
3242 _p->setPenStyle(TQt::NoPen);
3243 _p->setColor( colorGroup().text() );
3249void CellFormatPageBorder::draw()
3251 BorderButton* top = borderButtons[BorderType_Top];
3252 BorderButton* bottom = borderButtons[BorderType_Bottom];
3253 BorderButton* left = borderButtons[BorderType_Left];
3254 BorderButton* right = borderButtons[BorderType_Right];
3255 BorderButton* risingDiagonal = borderButtons[BorderType_RisingDiagonal];
3256 BorderButton* fallingDiagonal = borderButtons[BorderType_FallingDiagonal];
3257 BorderButton* vertical = borderButtons[BorderType_Vertical];
3258 BorderButton* horizontal = borderButtons[BorderType_Horizontal];
3261 painter.begin( area );
3263 if ((bottom->getPenStyle())!=TQt::NoPen)
3265 pen=TQPen( bottom->getColor(), bottom->getPenWidth(),bottom->getPenStyle());
3266 painter.setPen( pen );
3267 painter.drawLine( OFFSETX, area->height()-OFFSETY, area->width()-OFFSETX , area->height()-OFFSETY );
3269 if ((top->getPenStyle())!=TQt::NoPen)
3271 pen=TQPen( top->getColor(), top->getPenWidth(),top->getPenStyle());
3272 painter.setPen( pen );
3273 painter.drawLine( OFFSETX, OFFSETY, area->width() -OFFSETX, OFFSETY );
3275 if ((left->getPenStyle())!=TQt::NoPen)
3277 pen=TQPen( left->getColor(), left->getPenWidth(),left->getPenStyle());
3278 painter.setPen( pen );
3279 painter.drawLine( OFFSETX, OFFSETY, OFFSETX , area->height()-OFFSETY );
3281 if ((right->getPenStyle())!=TQt::NoPen)
3283 pen=TQPen( right->getColor(), right->getPenWidth(),right->getPenStyle());
3284 painter.setPen( pen );
3285 painter.drawLine( area->width()-OFFSETX, OFFSETY, area->width()-OFFSETX,
3286 area->height()-OFFSETY );
3289 if ((fallingDiagonal->getPenStyle())!=TQt::NoPen)
3291 pen=TQPen( fallingDiagonal->getColor(), fallingDiagonal->getPenWidth(),
3292 fallingDiagonal->getPenStyle());
3293 painter.setPen( pen );
3294 painter.drawLine( OFFSETX, OFFSETY, area->width()-OFFSETX,
3295 area->height()-OFFSETY );
3296 if (dlg->oneCol==
false&& dlg->oneRow==
false)
3298 painter.drawLine( area->width()/2, OFFSETY, area->width()-OFFSETX,
3300 painter.drawLine( OFFSETX,area->height()/2 , area->width()/2,
3301 area->height()-OFFSETY );
3304 if ((risingDiagonal->getPenStyle())!=TQt::NoPen)
3306 pen=TQPen( risingDiagonal->getColor(), risingDiagonal->getPenWidth(),
3307 risingDiagonal->getPenStyle());
3308 painter.setPen( pen );
3309 painter.drawLine( OFFSETX, area->height()-OFFSETY , area->width()-OFFSETX ,
3311 if (dlg->oneCol==
false&& dlg->oneRow==
false)
3313 painter.drawLine( area->width()/2, OFFSETY, OFFSETX, area->height()/2 );
3314 painter.drawLine( area->width()/2,area->height()-OFFSETY ,
3315 area->width()-OFFSETX, area->height()/2 );
3319 if ((vertical->getPenStyle())!=TQt::NoPen)
3321 pen=TQPen( vertical->getColor(), vertical->getPenWidth(),
3322 vertical->getPenStyle());
3323 painter.setPen( pen );
3324 painter.drawLine( area->width()/2, 5 , area->width()/2 , area->height()-5 );
3326 if ((horizontal->getPenStyle())!=TQt::NoPen)
3328 pen=TQPen( horizontal->getColor(), horizontal->getPenWidth(),
3329 horizontal->getPenStyle());
3330 painter.setPen( pen );
3331 painter.drawLine( OFFSETX,area->height()/2,area->width()-OFFSETX,
3337void CellFormatPageBorder::invertState(BorderButton *_p)
3346 _p->setPenWidth(preview->getPenWidth());
3347 _p->setPenStyle(preview->getPenStyle());
3348 _p->setColor( currentColor );
3349 _p->setChanged(
true);
3353void CellFormatPageBorder::slotPressEvent(TQMouseEvent *_ev)
3355 BorderButton* top = borderButtons[BorderType_Top];
3356 BorderButton* bottom = borderButtons[BorderType_Bottom];
3357 BorderButton* left = borderButtons[BorderType_Left];
3358 BorderButton* right = borderButtons[BorderType_Right];
3359 BorderButton* vertical = borderButtons[BorderType_Vertical];
3360 BorderButton* horizontal = borderButtons[BorderType_Horizontal];
3363 TQRect rect(OFFSETX,OFFSETY-8,area->width()-OFFSETX,OFFSETY+8);
3364 if (rect.contains(TQPoint(_ev->x(),_ev->y())))
3366 if (((top->getPenWidth()!=preview->getPenWidth()) ||
3367 (top->getColor()!=currentColor) ||
3368 (top->getPenStyle()!=preview->getPenStyle()))
3371 top->setPenWidth(preview->getPenWidth());
3372 top->setPenStyle(preview->getPenStyle());
3373 top->setColor( currentColor );
3374 top->setChanged(
true);
3379 rect.setCoords(OFFSETX,area->height()-OFFSETY-8,area->width()-OFFSETX,
3380 area->height()-OFFSETY+8);
3381 if (rect.contains(TQPoint(_ev->x(),_ev->y())))
3383 if (((bottom->getPenWidth()!=preview->getPenWidth()) ||
3384 (bottom->getColor()!=currentColor) ||
3385 (bottom->getPenStyle()!=preview->getPenStyle()))
3388 bottom->setPenWidth(preview->getPenWidth());
3389 bottom->setPenStyle(preview->getPenStyle());
3390 bottom->setColor( currentColor );
3391 bottom->setChanged(
true);
3394 invertState(bottom);
3397 rect.setCoords(OFFSETX-8,OFFSETY,OFFSETX+8,area->height()-OFFSETY);
3398 if (rect.contains(TQPoint(_ev->x(),_ev->y())))
3400 if (((left->getPenWidth()!=preview->getPenWidth()) ||
3401 (left->getColor()!=currentColor) ||
3402 (left->getPenStyle()!=preview->getPenStyle()))
3405 left->setPenWidth(preview->getPenWidth());
3406 left->setPenStyle(preview->getPenStyle());
3407 left->setColor( currentColor );
3408 left->setChanged(
true);
3413 rect.setCoords(area->width()-OFFSETX-8,OFFSETY,area->width()-OFFSETX+8,
3414 area->height()-OFFSETY);
3415 if (rect.contains(TQPoint(_ev->x(),_ev->y())))
3417 if (((right->getPenWidth()!=preview->getPenWidth()) ||
3418 (right->getColor()!=currentColor) ||
3419 (right->getPenStyle()!=preview->getPenStyle()))
3422 right->setPenWidth(preview->getPenWidth());
3423 right->setPenStyle(preview->getPenStyle());
3424 right->setColor( currentColor );
3425 right->setChanged(
true);
3444 if (dlg->oneCol==
false)
3446 rect.setCoords(area->width()/2-8,OFFSETY,area->width()/2+8,
3447 area->height()-OFFSETY);
3449 if (rect.contains(TQPoint(_ev->x(),_ev->y())))
3451 if (((vertical->getPenWidth()!=preview->getPenWidth()) ||
3452 (vertical->getColor()!=currentColor) ||
3453 (vertical->getPenStyle()!=preview->getPenStyle()))
3454 && vertical->isOn())
3456 vertical->setPenWidth(preview->getPenWidth());
3457 vertical->setPenStyle(preview->getPenStyle());
3458 vertical->setColor( currentColor );
3459 vertical->setChanged(
true);
3462 invertState(vertical);
3465 if (dlg->oneRow==
false)
3467 rect.setCoords(OFFSETX,area->height()/2-8,area->width()-OFFSETX,
3468 area->height()/2+8);
3469 if (rect.contains(TQPoint(_ev->x(),_ev->y())))
3471 if (((horizontal->getPenWidth()!=preview->getPenWidth()) ||
3472 (horizontal->getColor()!=currentColor) ||
3473 (horizontal->getPenStyle()!=preview->getPenStyle()))
3474 && horizontal->isOn())
3476 horizontal->setPenWidth(preview->getPenWidth());
3477 horizontal->setPenStyle(preview->getPenStyle());
3478 horizontal->setColor( currentColor );
3479 horizontal->setChanged(
true);
3482 invertState(horizontal);
3497BrushSelect::BrushSelect( TQWidget *parent,
const char * ) : TQFrame( parent )
3499 brushStyle = TQt::NoBrush;
3500 brushColor = TQt::red;
3504void BrushSelect::setPattern(
const TQColor &_color,TQt::BrushStyle _style )
3506 brushStyle = _style;
3507 brushColor = _color;
3512void BrushSelect::paintEvent( TQPaintEvent *_ev )
3514 TQFrame::paintEvent( _ev );
3517 TQBrush brush(brushColor,brushStyle);
3518 painter.begin(
this );
3519 painter.setPen( TQt::NoPen );
3520 painter.setBrush( brush);
3521 painter.drawRect( 2, 2, width()-4, height()-4);
3525void BrushSelect::mousePressEvent( TQMouseEvent * )
3529 emit clicked(
this );
3532void BrushSelect::slotUnselect()
3537 setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3541void BrushSelect::slotSelect()
3546 setFrameStyle( TQFrame::Panel | TQFrame::Plain );
3558CellFormatPagePattern::CellFormatPagePattern( TQWidget* parent,
CellFormatDialog *_dlg ) : TQWidget( parent )
3562 bBgColorUndefined = !dlg->bBgColor;
3564 TQGridLayout *grid =
new TQGridLayout(
this,5,2,KDialog::marginHint(), KDialog::spacingHint());
3566 TQGroupBox* tmpTQGroupBox;
3567 tmpTQGroupBox =
new TQGroupBox(
this,
"GroupBox_20" );
3568 tmpTQGroupBox->setFrameStyle( TQFrame::Box | TQFrame::Sunken );
3569 tmpTQGroupBox->setTitle( i18n(
"Pattern") );
3570 tmpTQGroupBox->setAlignment( AlignLeft );
3572 TQGridLayout *grid2 =
new TQGridLayout(tmpTQGroupBox,8,3,KDialog::marginHint(), KDialog::spacingHint());
3573 int fHeight = tmpTQGroupBox->fontMetrics().height();
3574 grid2->addRowSpacing( 0, fHeight/2 );
3577 brush1 =
new BrushSelect( tmpTQGroupBox,
"Frame_1" );
3578 brush1->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3579 grid2->addWidget(brush1,1,0);
3581 brush2 =
new BrushSelect( tmpTQGroupBox,
"Frame_2" );
3582 brush2->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3583 grid2->addWidget(brush2,1,1);
3585 brush3 =
new BrushSelect( tmpTQGroupBox,
"Frame_3" );
3586 brush3->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3587 grid2->addWidget(brush3,1,2);
3589 brush4 =
new BrushSelect( tmpTQGroupBox,
"Frame_4" );
3590 brush4->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3591 grid2->addWidget(brush4,2,0);
3593 brush5 =
new BrushSelect( tmpTQGroupBox,
"Frame_5" );
3594 brush5->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3595 grid2->addWidget(brush5,2,1);
3597 brush6 =
new BrushSelect( tmpTQGroupBox,
"Frame_6" );
3598 brush6->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3599 grid2->addWidget(brush6,2,2);
3601 brush7 =
new BrushSelect( tmpTQGroupBox,
"Frame_7" );
3602 brush7->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3603 grid2->addWidget(brush7,3,0);
3605 brush8 =
new BrushSelect( tmpTQGroupBox,
"Frame_8" );
3606 brush8->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3607 grid2->addWidget(brush8,3,1);
3609 brush9 =
new BrushSelect( tmpTQGroupBox,
"Frame_9" );
3610 brush9->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3611 grid2->addWidget(brush9,3,2);
3613 brush10 =
new BrushSelect( tmpTQGroupBox,
"Frame_10" );
3614 brush10->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3615 grid2->addWidget(brush10,4,0);
3617 brush11 =
new BrushSelect( tmpTQGroupBox,
"Frame_11" );
3618 brush11->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3619 grid2->addWidget(brush11,4,1);
3621 brush12 =
new BrushSelect( tmpTQGroupBox,
"Frame_12" );
3622 brush12->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3623 grid2->addWidget(brush12,4,2);
3625 brush13 =
new BrushSelect( tmpTQGroupBox,
"Frame_13" );
3626 brush13->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3627 grid2->addWidget(brush13,5,0);
3629 brush14 =
new BrushSelect( tmpTQGroupBox,
"Frame_14" );
3630 brush14->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3631 grid2->addWidget(brush14,5,1);
3633 brush15 =
new BrushSelect( tmpTQGroupBox,
"Frame_15" );
3634 brush15->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3635 grid2->addWidget(brush15,5,2);
3637 TQGridLayout *grid3 =
new TQGridLayout( 1, 2 );
3638 color =
new KColorButton (tmpTQGroupBox,
"ColorButton_1" );
3639 grid3->addWidget(color,0,1);
3641 TQLabel *tmpTQLabel =
new TQLabel( tmpTQGroupBox,
"Label_1" );
3642 tmpTQLabel->setText( i18n(
"Color:") );
3643 grid3->addWidget(tmpTQLabel,0,0);
3645 grid2->addMultiCell(grid3,6,6,0,2);
3647 grid3 =
new TQGridLayout( 1, 3 );
3648 grid3->setSpacing(KDialog::spacingHint());
3650 tmpTQLabel =
new TQLabel( tmpTQGroupBox,
"Label_2" );
3651 grid3->addWidget(tmpTQLabel,0,0);
3652 tmpTQLabel->setText( i18n(
"Background color:") );
3654 bgColorButton =
new KColorButton( tmpTQGroupBox,
"ColorButton" );
3655 grid3->addWidget(bgColorButton,0,1);
3656 if ( dlg->bBgColor )
3657 bgColor = dlg->bgColor;
3659 bgColor = colorGroup().base();
3661 if (!bgColor.isValid())
3662 bgColor = colorGroup().base();
3664 bgColorButton->setColor( bgColor );
3665 connect( bgColorButton, TQ_SIGNAL( changed(
const TQColor & ) ),
3666 this, TQ_SLOT( slotSetBackgroundColor(
const TQColor & ) ) );
3668 notAnyColor=
new TQPushButton(i18n(
"No Color"),tmpTQGroupBox);
3669 grid3->addWidget(notAnyColor,0,2);
3670 connect( notAnyColor, TQ_SIGNAL( clicked( ) ),
3671 this, TQ_SLOT( slotNotAnyColor( ) ) );
3672 b_notAnyColor=
false;
3674 grid2->addMultiCell(grid3,7,7,0,2);
3676 grid->addMultiCellWidget(tmpTQGroupBox,0,3,0,0);
3678 tmpTQGroupBox =
new TQGroupBox(
this,
"GroupBox1" );
3679 tmpTQGroupBox->setTitle( i18n(
"Preview") );
3680 tmpTQGroupBox->setFrameStyle( TQFrame::Box | TQFrame::Sunken );
3681 tmpTQGroupBox->setAlignment( AlignLeft );
3683 grid2 =
new TQGridLayout(tmpTQGroupBox,2,1,KDialog::marginHint(), KDialog::spacingHint());
3684 fHeight = tmpTQGroupBox->fontMetrics().height();
3685 grid2->addRowSpacing( 0, fHeight/2 );
3687 current =
new BrushSelect( tmpTQGroupBox,
"Current" );
3688 current->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
3689 grid2->addWidget(current,1,0);
3690 grid->addWidget( tmpTQGroupBox,4,0);
3692 connect( brush1, TQ_SIGNAL( clicked( BrushSelect* ) ),
3693 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3694 connect( brush2, TQ_SIGNAL( clicked( BrushSelect* ) ),
3695 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3696 connect( brush3, TQ_SIGNAL( clicked( BrushSelect* ) ),
3697 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3698 connect( brush4, TQ_SIGNAL( clicked( BrushSelect* ) ),
3699 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3700 connect( brush5, TQ_SIGNAL( clicked( BrushSelect* ) ),
3701 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3702 connect( brush6, TQ_SIGNAL( clicked( BrushSelect* ) ),
3703 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3704 connect( brush7, TQ_SIGNAL( clicked( BrushSelect* ) ),
3705 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3706 connect( brush8, TQ_SIGNAL( clicked( BrushSelect* ) ),
3707 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3708 connect( brush9, TQ_SIGNAL( clicked( BrushSelect* ) ),
3709 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3710 connect( brush10, TQ_SIGNAL( clicked( BrushSelect* ) ),
3711 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3712 connect( brush11, TQ_SIGNAL( clicked( BrushSelect* ) ),
3713 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3714 connect( brush12, TQ_SIGNAL( clicked( BrushSelect* ) ),
3715 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3716 connect( brush13, TQ_SIGNAL( clicked( BrushSelect* ) ),
3717 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3718 connect( brush14, TQ_SIGNAL( clicked( BrushSelect* ) ),
3719 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3720 connect( brush15, TQ_SIGNAL( clicked( BrushSelect* ) ),
3721 this, TQ_SLOT( slotUnselect2( BrushSelect* ) ) );
3723 brush1->setPattern( TQt::red,TQt::VerPattern );
3724 brush2->setPattern( TQt::red,TQt::HorPattern );
3725 brush3->setPattern( TQt::red,TQt::Dense1Pattern );
3726 brush4->setPattern( TQt::red,TQt::Dense2Pattern );
3727 brush5->setPattern( TQt::red,TQt::Dense3Pattern );
3728 brush6->setPattern( TQt::red,TQt::Dense4Pattern );
3729 brush7->setPattern( TQt::red,TQt::Dense5Pattern );
3730 brush8->setPattern( TQt::red,TQt::Dense6Pattern );
3731 brush9->setPattern( TQt::red,TQt::Dense7Pattern );
3732 brush10->setPattern( TQt::red,TQt::CrossPattern );
3733 brush11->setPattern( TQt::red,TQt::BDiagPattern );
3734 brush12->setPattern( TQt::red,TQt::FDiagPattern );
3735 brush13->setPattern( TQt::red,TQt::VerPattern );
3736 brush14->setPattern( TQt::red,TQt::DiagCrossPattern );
3737 brush15->setPattern( TQt::red,TQt::NoBrush );
3739 current->setPattern(dlg->brushColor,dlg->brushStyle);
3740 current->slotSelect();
3741 selectedBrush=current;
3742 color->setColor(dlg->brushColor);
3743 current->setBackgroundColor( bgColor );
3745 connect( color, TQ_SIGNAL( changed(
const TQColor & ) ),
3746 this, TQ_SLOT( slotSetColorButton(
const TQColor & ) ) );
3748 slotSetColorButton( dlg->brushColor );
3750 this->resize( 400, 400 );
3753void CellFormatPagePattern::slotNotAnyColor()
3755 b_notAnyColor =
true;
3756 bgColorButton->setColor( colorGroup().base() );
3757 current->setBackgroundColor( colorGroup().base() );
3760void CellFormatPagePattern::slotSetBackgroundColor(
const TQColor &_color )
3763 current->setBackgroundColor( bgColor );
3764 bBgColorUndefined =
false;
3765 b_notAnyColor =
false;
3768void CellFormatPagePattern::init()
3770 if (dlg->brushStyle == TQt::VerPattern)
3772 brush1->slotSelect();
3774 else if (dlg->brushStyle == TQt::HorPattern)
3776 brush2->slotSelect();
3778 else if (dlg->brushStyle == TQt::Dense1Pattern)
3780 brush3->slotSelect();
3782 else if (dlg->brushStyle == TQt::Dense2Pattern)
3784 brush4->slotSelect();
3786 else if (dlg->brushStyle == TQt::Dense3Pattern)
3788 brush5->slotSelect();
3790 else if (dlg->brushStyle == TQt::Dense4Pattern)
3792 brush6->slotSelect();
3794 else if (dlg->brushStyle == TQt::Dense5Pattern)
3796 brush7->slotSelect();
3798 else if (dlg->brushStyle == TQt::Dense6Pattern)
3800 brush8->slotSelect();
3802 else if (dlg->brushStyle == TQt::Dense7Pattern)
3804 brush9->slotSelect();
3806 else if (dlg->brushStyle == TQt::CrossPattern)
3808 brush10->slotSelect();
3810 else if (dlg->brushStyle == TQt::BDiagPattern)
3812 brush11->slotSelect();
3814 else if (dlg->brushStyle == TQt::FDiagPattern)
3816 brush12->slotSelect();
3818 else if (dlg->brushStyle == TQt::VerPattern)
3820 brush13->slotSelect();
3822 else if (dlg->brushStyle == TQt::DiagCrossPattern)
3824 brush14->slotSelect();
3826 else if (dlg->brushStyle == TQt::NoBrush)
3828 brush15->slotSelect();
3831 kdDebug(36001) <<
"Error in brushStyle" << endl;
3834void CellFormatPagePattern::slotSetColorButton(
const TQColor &_color )
3836 currentColor = _color;
3838 brush1->setBrushColor( currentColor );
3839 brush2->setBrushColor( currentColor );
3840 brush3->setBrushColor( currentColor );
3841 brush4->setBrushColor( currentColor );
3842 brush5->setBrushColor( currentColor );
3843 brush6->setBrushColor( currentColor );
3844 brush7->setBrushColor( currentColor );
3845 brush8->setBrushColor( currentColor );
3846 brush9->setBrushColor( currentColor );
3847 brush10->setBrushColor( currentColor );
3848 brush11->setBrushColor( currentColor );
3849 brush12->setBrushColor( currentColor );
3850 brush13->setBrushColor( currentColor );
3851 brush14->setBrushColor( currentColor );
3852 brush15->setBrushColor( currentColor );
3853 current->setBrushColor( currentColor );
3856void CellFormatPagePattern::slotUnselect2( BrushSelect *_p )
3861 brush1->slotUnselect();
3863 brush2->slotUnselect();
3865 brush3->slotUnselect();
3867 brush4->slotUnselect();
3869 brush5->slotUnselect();
3871 brush6->slotUnselect();
3873 brush7->slotUnselect();
3875 brush8->slotUnselect();
3877 brush9->slotUnselect();
3878 if ( brush10 != _p )
3879 brush10->slotUnselect();
3880 if ( brush11 != _p )
3881 brush11->slotUnselect();
3882 if ( brush12 != _p )
3883 brush12->slotUnselect();
3884 if ( brush13 != _p )
3885 brush13->slotUnselect();
3886 if ( brush14 != _p )
3887 brush14->slotUnselect();
3888 if ( brush15 != _p )
3889 brush15->slotUnselect();
3891 current->setBrushStyle( selectedBrush->getBrushStyle() );
3894void CellFormatPagePattern::apply(
CustomStyle * style )
3896 if ( selectedBrush != 0L
3897 && ( dlg->brushStyle != selectedBrush->getBrushStyle()
3898 || dlg->brushColor != selectedBrush->getBrushColor() ) )
3899 style->changeBackGroundBrush( TQBrush( selectedBrush->getBrushColor(), selectedBrush->getBrushStyle() ) );
3907 if ( bgColor != dlg->getStyle()->bgColor() )
3908 style->changeBgColor( bgColor );
3913 if ( selectedBrush != 0L
3914 && ( dlg->brushStyle != selectedBrush->getBrushStyle()
3915 || dlg->brushColor != selectedBrush->getBrushColor() ) )
3916 _obj->setBackgroundBrush( TQBrush( selectedBrush->getBrushColor(), selectedBrush->getBrushStyle() ) );
3918 if ( bgColor == dlg->bgColor )
3922 _obj->setBackgroundColor( TQColor() );
3923 else if ( !bBgColorUndefined )
3924 _obj->setBackgroundColor( bgColor );
3927#include "kspread_dlg_layout.moc"
For every cell in the spread sheet there is a Cell object.
int row() const
Returns the cell's row.
const Value value() const
Returns the value that this cell holds.
TQValueList< Cell * > obscuringCells() const
bool doesMergeCells() const
int column() const
Returns the cell's column.
Format * format() const
Returns the format object of this cell.
const TQColor & bgColor(int col, int row) const
bool isPartOfMerged() const
If this cell is part of a merged cell, then the marker may never reside on this cell.
Built-in or custom style defined in StyleManager dialog.
This class holds the data that makes up a spreadsheet.
void addCommand(KCommand *command)
Adds a command to the command history.
TQString unitName() const
Returns the name of the unit used to display margins.
Element * add(const TQPoint &point, Sheet *sheet=0)
Adds the point point to this region.
@ BUILTIN
built-in style (the default style)
@ CUSTOM
custom style (defined in the StyleManager dialog)
bool isNumber() const
Returns true if the type of this value is either integer or floating-point.
double asFloat() const
Returns the floating-point value of this value.
The View class displays a KSpread document.
void refreshView()
refresh view when you hide/show vertical scrollbar
void updateEditWidget()
Fills the EditWidget with the current cells content.