34#include <KoUnitWidgets.h>
36#include <kspread_canvas.h>
37#include <kspread_doc.h>
38#include <kspread_global.h>
39#include <kspread_locale.h>
40#include <kspread_sheet.h>
41#include <kspread_undo.h>
42#include <kspread_view.h>
43#include "manipulator.h"
46#include "kspread_dlg_resize2.h"
50ResizeRow::ResizeRow(
View* parent,
const char* name )
51 : KDialogBase( parent, name, true, i18n(
"Resize Row"), Ok|Cancel|Default )
55 TQWidget *page =
new TQWidget(
this );
56 setMainWidget( page );
58 TQVBoxLayout *vLay =
new TQVBoxLayout( page, 0, spacingHint() );
59 TQHBoxLayout *hLay =
new TQHBoxLayout( vLay );
61 TQRect selection( m_pView->selectionInfo()->selection() );
62 RowFormat* rl = m_pView->activeSheet()->rowFormat( selection.top() );
63 rowHeight = rl->dblHeight();
65 TQLabel * label1 =
new TQLabel( page,
"label1" );
66 label1->setText( i18n(
"Height:" ) );
67 hLay->addWidget( label1 );
69 m_pHeight =
new KoUnitDoubleSpinBox( page );
70 m_pHeight->setValue( rowHeight );
71 m_pHeight->setUnit( m_pView->doc()->unit() );
73 hLay->addWidget( m_pHeight );
75 TQWidget *hSpacer =
new TQWidget( page );
76 hSpacer->setMinimumSize( spacingHint(), spacingHint() );
77 hLay->addWidget( hSpacer );
79 TQWidget *vSpacer =
new TQWidget( page );
80 vSpacer->setMinimumSize( spacingHint(), spacingHint() );
81 vLay->addWidget( vSpacer );
83 m_pHeight->setFocus();
86 rowHeight = m_pHeight->value();
89void ResizeRow::slotOk()
91 double height = m_pHeight->value();
94 if ( fabs( height - rowHeight ) > DBL_EPSILON )
96 ResizeRowManipulator* manipulator =
new ResizeRowManipulator();
97 manipulator->setSheet(m_pView->activeSheet());
98 manipulator->setSize(height);
100 manipulator->setOldSize(rowHeight);
101 manipulator->
add(*m_pView->selectionInfo());
102 manipulator->execute();
107void ResizeRow::slotDefault()
109 Sheet* sheet = m_pView->activeSheet();
112 double points = sheet->rowFormat(0)->dblHeight();
113 m_pHeight->setValue(KoUnit::toUserValue(points, m_pView->doc()->unit()));
116ResizeColumn::ResizeColumn(
View* parent,
const char* name )
117 : KDialogBase( parent, name, true, i18n(
"Resize Column"), Ok|Cancel|Default )
121 TQWidget *page =
new TQWidget(
this );
124 TQVBoxLayout *vLay =
new TQVBoxLayout( page, 0, spacingHint() );
125 TQHBoxLayout *hLay =
new TQHBoxLayout( vLay );
127 TQRect selection( m_pView->selectionInfo()->selection() );
128 ColumnFormat* cl = m_pView->activeSheet()->columnFormat( selection.left() );
129 columnWidth = cl->dblWidth();
131 TQLabel * label1 =
new TQLabel( page,
"label1" );
132 label1->setText( i18n(
"Width:" ) );
133 hLay->addWidget( label1 );
135 m_pWidth =
new KoUnitDoubleSpinBox( page );
136 m_pWidth->setValue( columnWidth );
137 m_pWidth->setUnit( m_pView->doc()->unit() );
139 hLay->addWidget( m_pWidth );
141 TQWidget *hSpacer =
new TQWidget( page );
142 hSpacer->setMinimumSize( spacingHint(), spacingHint() );
143 hLay->addWidget( hSpacer );
145 TQWidget *vSpacer =
new TQWidget( page );
146 vSpacer->setMinimumSize( spacingHint(), spacingHint() );
147 vLay->addWidget( vSpacer );
149 m_pWidth->setFocus();
152 columnWidth = m_pWidth->value();
155void ResizeColumn::slotOk()
157 double width = m_pWidth->value();
160 if ( fabs( width - columnWidth ) > DBL_EPSILON )
162 ResizeColumnManipulator* manipulator =
new ResizeColumnManipulator();
163 manipulator->setSheet(m_pView->activeSheet());
164 manipulator->setSize(width);
166 manipulator->setOldSize(columnWidth);
167 manipulator->
add(*m_pView->selectionInfo());
168 manipulator->execute();
173void ResizeColumn::slotDefault()
175 Sheet* sheet = m_pView->activeSheet();
178 double points = sheet->columnFormat(0)->dblWidth();
179 m_pWidth->setValue(KoUnit::toUserValue(points, m_pView->doc()->unit()));
183#include "kspread_dlg_resize2.moc"
Element * add(const TQPoint &point, Sheet *sheet=0)
Adds the point point to this region.
The View class displays a KSpread document.