20#include "KoLayoutTab.h"
21#include "KoTextFormat.h"
25#include <tqbuttongroup.h>
26#include <tqcheckbox.h>
29#include "KoLayoutTab.moc"
31KoLayoutTab::KoLayoutTab(
bool withSubSuperScript, TQWidget* parent,
const char* name, WFlags fl )
32 : KoLayoutTabBase( parent,
name, fl )
34 if ( !withSubSuperScript ) positionButtonGroup->hide();
36 connect( positionButtonGroup, TQ_SIGNAL( clicked(
int ) ),
this, TQ_SLOT( slotSubSuperScriptChanged(
int ) ) );
37 connect( offsetSpinBox, TQ_SIGNAL( valueChanged(
int ) ),
this, TQ_SIGNAL( offsetChanged(
int ) ) );
38 connect( relativeSizeKDoubleSpinBox, TQ_SIGNAL( valueChanged(
double ) ),
this, TQ_SLOT( slotRelativeSizeChanged(
double ) ) );
39 connect( hyphenateCheckBox, TQ_SIGNAL( toggled(
bool ) ),
this, TQ_SIGNAL( hyphenationChanged(
bool ) ) );
42KoLayoutTab::~KoLayoutTab()
46KoTextFormat::VerticalAlignment KoLayoutTab::getSubSuperScript()
const
48 switch ( positionButtonGroup->selectedId() )
51 return KoTextFormat::AlignNormal;
53 return KoTextFormat::AlignSubScript;
55 return KoTextFormat::AlignSuperScript;
57 return KoTextFormat::AlignCustom;
59 return KoTextFormat::AlignNormal;
63int KoLayoutTab::getOffsetFromBaseline()
const
65 switch ( positionButtonGroup->selectedId() )
74 return offsetSpinBox->value();
80double KoLayoutTab::getRelativeTextSize()
const
82 switch ( positionButtonGroup->selectedId() )
87 return relativeSizeKDoubleSpinBox->value() / 100;
89 return relativeSizeKDoubleSpinBox->value() / 100;
91 return relativeSizeKDoubleSpinBox->value() / 100;
97bool KoLayoutTab::getAutoHyphenation()
const
99 return hyphenateCheckBox->isOn();
102void KoLayoutTab::setSubSuperScript( KoTextFormat::VerticalAlignment subSuperScript,
int offset,
double relativeSize )
104 switch (
static_cast< int >( subSuperScript ) )
107 positionButtonGroup->setButton( 0 );
110 positionButtonGroup->setButton( 1 );
111 relativeSizeKDoubleSpinBox->setValue( relativeSize * 100 );
114 positionButtonGroup->setButton( 2 );
115 relativeSizeKDoubleSpinBox->setValue( relativeSize * 100 );
118 positionButtonGroup->setButton( 3 );
119 offsetSpinBox->setValue( offset );
120 relativeSizeKDoubleSpinBox->setValue( relativeSize * 100 );
123 positionButtonGroup->setButton( 0 );
126 slotSubSuperScriptChanged(
static_cast< int >( subSuperScript ) );
129void KoLayoutTab::setAutoHyphenation(
bool state )
131 hyphenateCheckBox->setChecked( state );
134void KoLayoutTab::slotSubSuperScriptChanged(
int item )
136 if ( item == 1 || item == 2 ) offsetSpinBox->setValue( 0 );
137 emit subSuperScriptChanged();
139 emit relativeSizeChanged( relativeSizeKDoubleSpinBox->value() / 100 );
140 emit offsetChanged( offsetSpinBox->value() );
144void KoLayoutTab::slotRelativeSizeChanged(
double relativeSize )
146 emit relativeSizeChanged( relativeSize / 100 );
const char * name(StdAction id)