21#include "KWDocument.h"
22#include "KWResizeTableDia.h"
23#include "KWTableFrameSet.h"
26#include <KoUnitWidgets.h>
32 : KDialogBase( parent,
"resize column dialog" , true,
"", Ok | Cancel | User1 | Apply )
34 setButtonText( KDialogBase::User1, i18n(
"Reset") );
35 setCaption( i18n(
"Resize Column" ) );
40 setupTab1(resizeColumn);
43void KWResizeTableDia::setupTab1(
int resizeColumn) {
44 TQVBox *page = makeVBoxMainWidget();
45 TQLabel *rc =
new TQLabel( i18n(
"Column:" ), page );
46 rc->resize( rc->sizeHint() );
47 rc->setAlignment( AlignLeft | AlignBottom );
48 m_value =
new TQSpinBox( 1, m_table->
getColumns(), 1, page );
49 m_value->resize( m_value->sizeHint() );
50 m_value->setValue( resizeColumn );
52 rc =
new TQLabel( i18n(
"Width:" ), page );
54 slotValueChanged( m_value->value());
55 connect( m_value, TQ_SIGNAL( valueChanged (
int )),
this, TQ_SLOT( slotValueChanged(
int )));
58bool KWResizeTableDia::doResize()
60 unsigned int resize= m_value->value() - 1;
61 KWFrame *frm = m_table->cell( 0, resize )->frame(0);
63 FrameIndex index( frm );
64 KoRect newRect( frm->normalize() );
65 newRect.setWidth( m_position->value() );
66 FrameResizeStruct resizeStruct( frm->normalize(), frm->
minimumFrameHeight(), newRect );
67 KWFrameResizeCommand * cmd =
new KWFrameResizeCommand( i18n(
"Resize Column"), index, resizeStruct );
69 m_doc->addCommand( cmd );
74void KWResizeTableDia::slotValueChanged(
int pos)
76 KWFrame *frm = m_table->cell( 0, pos-1 )->frame(0);
78 m_position->setValue( KoUnit::toUserValue( TQMAX(0.00, frm->normalize().width()), m_doc->unit() ) );
79 m_resetValue = m_position->value();
83void KWResizeTableDia::slotUser1()
85 m_position->setValue( KoUnit::toUserValue(m_resetValue, m_doc->unit() ) );
89void KWResizeTableDia::slotApply()
94void KWResizeTableDia::slotOk()
98 KDialogBase::slotOk();
102#include "KWResizeTableDia.moc"
bool isFloating() const
Return true if this frameset is floating (inline), false if it's fixed.
KWTextFrameSet * anchorFrameset() const
Return the frameset in which our anchor is - assuming isFloating().
KWFrame * frame(unsigned int _num) const
get a frame by number
double minimumFrameHeight(void) const
KWResizeTableDia(TQWidget *parent, KWTableFrameSet *table, KWDocument *doc, int resizeColumn)
Constructor.
This class implements tables by acting as the manager for the frame(set)s which make up the table cel...
unsigned int getColumns() const
returns the number of columns