20#include "KWDocument.h"
21#include "KWConfigFootNoteDia.h"
22#include "KWConfigFootNoteDia.moc"
23#include "KWVariable.h"
25#include "KWFrameSet.h"
27#include <KoParagDia.h>
28#include <KoUnitWidgets.h>
33#include <tqradiobutton.h>
34#include <tqwhatsthis.h>
35#include <tqvbuttongroup.h>
39#include <tqcombobox.h>
42KWConfigFootNoteDia::KWConfigFootNoteDia( TQWidget *parent,
const char *name, KWDocument *doc )
43 : KDialogBase(Tabbed, TQString(), Ok | Cancel , Ok, parent, name, true)
45 setCaption( i18n(
"Configure Endnote/Footnote") );
54void KWConfigFootNoteDia::setupTab1()
56 TQVBox * page = addVBoxPage( i18n(
"Footnotes" ) );
57 m_footNoteConfig =
new KoCounterStyleWidget(
false,
true,
false, page );
59 m_footNoteConfig->setCounter (
static_cast<KWVariableSettings*
>(m_doc->variableCollection()->variableSetting())->footNoteCounter() );
62void KWConfigFootNoteDia::setupTab2()
64 TQVBox * page = addVBoxPage( i18n(
"Endnotes" ) );
65 m_endNoteConfig =
new KoCounterStyleWidget(
false,
true,
false, page );
67 m_endNoteConfig->setCounter (
static_cast<KWVariableSettings*
>(m_doc->variableCollection()->variableSetting())->endNoteCounter() );
71void KWConfigFootNoteDia::setupTab3()
73 TQFrame * page = addPage( i18n(
"Separator Line" ) );
74 TQString comment= i18n (
"Configure the separator line. The separator line "
75 "is drawn directly above the frame for the footnotes.");
76 TQWhatsThis::add(page, comment);
77 TQVBoxLayout *pageLayout=
new TQVBoxLayout( page, 0, KDialog::spacingHint());
79 TQButtonGroup *positionGroupBox =
new TQButtonGroup( i18n(
"Position"), page );
80 comment= i18n (
"The separator can be positioned horizontally by picking one "
81 "of the three alignments.");
82 TQWhatsThis::add(positionGroupBox, comment);
83 positionGroupBox->setColumnLayout(0, TQt::Vertical );
84 TQVBoxLayout *positionLayout =
new TQVBoxLayout( positionGroupBox->layout() );
85 positionLayout->setAlignment( TQt::AlignTop );
88 rbPosLeft =
new TQRadioButton( i18n(
"Position",
"Left"), positionGroupBox,
"rbPosLeft" );
89 positionLayout->addWidget( rbPosLeft );
91 rbPosCentered =
new TQRadioButton( i18n(
"Position",
"Centered"), positionGroupBox,
"rbPosCentered" );
92 positionLayout->addWidget( rbPosCentered );
94 rbPosRight =
new TQRadioButton( i18n(
"Position",
"Right"), positionGroupBox,
"rbPosRight" );
95 positionLayout->addWidget( rbPosRight );
96 pageLayout->addWidget( positionGroupBox );
97 switch( m_doc->footNoteSeparatorLinePosition() ) {
99 rbPosLeft->setChecked(
true);
102 rbPosCentered->setChecked(
true);
105 rbPosRight->setChecked(
true);
109 TQGridLayout *layout =
new TQGridLayout( 0, 1, 1, 0, KDialog::spacingHint());
111 spWidth =
new KoUnitDoubleSpinBox(page, 0, 5, 0.5, m_doc->footNoteSeparatorLineWidth(), m_doc->unit(), 1);
113 layout->addWidget( spWidth, 1, 1 );
115 spLength =
new KIntNumInput( page,
"spLength" );
116 spLength->setRange( 1, 100, 1,
false );
117 spLength->setValue( m_doc->footNoteSeparatorLineLength());
118 spLength->setSuffix(i18n(
" %"));
119 layout->addWidget( spLength, 0, 1 );
121 TQLabel *lSize =
new TQLabel( i18n(
"&Width:"), page );
122 lSize->setBuddy( spWidth );
123 comment= i18n (
"The width is the thickness of the separator line, set to 0 for no separator line.");
124 TQWhatsThis::add(lSize, comment);
125 TQWhatsThis::add(spWidth, comment);
126 layout->addWidget( lSize, 1, 0 );
128 TQSpacerItem* spacer =
new TQSpacerItem( 0, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
129 layout->addMultiCell( spacer, 0, 1, 2, 2 );
131 TQLabel *lWidth =
new TQLabel( i18n(
"&Size on page:"), page,
"lWidth" );
132 lWidth->setBuddy( spLength );
133 comment= i18n (
"The size of the separator line can be defined as a percentage of the width of the page.");
134 TQWhatsThis::add(spLength, comment);
135 TQWhatsThis::add(lWidth, comment);
136 layout->addWidget( lWidth, 0, 0 );
137 pageLayout->addLayout( layout );
139 TQHBoxLayout *styleLayout =
new TQHBoxLayout( 0, 0, KDialog::spacingHint(),
"styleLayout");
141 TQLabel *styleLabel =
new TQLabel( i18n(
"Style:"), page );
142 styleLayout->addWidget( styleLabel );
144 m_cbLineType =
new TQComboBox( page );
147 lst <<i18n(
"Dash Line");
148 lst <<i18n(
"Dot Line");
149 lst <<i18n(
"Dash Dot Line");
150 lst <<i18n(
"Dash Dot Dot Line");
151 m_cbLineType->insertStringList( lst );
152 m_cbLineType->setCurrentItem(
static_cast<int>(m_doc->footNoteSeparatorLineType()));
153 comment= i18n (
"The separator line can be drawn as a solid line or as a line which has a "
154 "pattern; the pattern can be set in the style-type.");
155 TQWhatsThis::add(styleLabel, comment);
156 TQWhatsThis::add(m_cbLineType, comment);
157 styleLayout->addWidget( m_cbLineType );
159 TQSpacerItem* spacer_2 =
new TQSpacerItem( 0, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
160 styleLayout->addItem( spacer_2 );
161 pageLayout->addLayout( styleLayout );
162 TQSpacerItem* spacer_3 =
new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
163 pageLayout->addItem( spacer_3 );
167void KWConfigFootNoteDia::slotOk()
169 KMacroCommand * macro = 0L;
171 KoParagCounter counter =
static_cast<KWVariableSettings*
>(m_doc->variableCollection()->variableSetting())->footNoteCounter();
172 if (counter != m_footNoteConfig->counter() )
174 macro =
new KMacroCommand(i18n(
"Change End-/Footnote Variable Settings"));
175 cmd=
new KWChangeFootEndNoteSettingsCommand( i18n(
"Change End-/Footnote Variable Settings") , counter, m_footNoteConfig->counter() ,
true ,m_doc);
176 macro->addCommand(cmd );
178 counter =
static_cast<KWVariableSettings*
>(m_doc->variableCollection()->variableSetting())->endNoteCounter();
179 if (counter != m_endNoteConfig->counter() )
182 macro =
new KMacroCommand(i18n(
"Change End-/Footnote Variable Settings"));
183 cmd=
new KWChangeFootEndNoteSettingsCommand( i18n(
"Change End-/Footnote Variable Settings") , counter, m_endNoteConfig->counter() ,
false ,m_doc);
184 macro->addCommand(cmd );
187 int val =spLength->value();
188 double width = spWidth->value();
189 SeparatorLinePos tmp = SLP_LEFT;
190 SeparatorLineLineType type =
static_cast<SeparatorLineLineType
>(m_cbLineType->currentItem());
191 if ( rbPosRight->isChecked())
193 else if ( rbPosCentered->isChecked())
195 else if ( rbPosLeft->isChecked())
198 if ( (val != m_doc->footNoteSeparatorLineLength())||
199 tmp != m_doc->footNoteSeparatorLinePosition()||
200 width!= m_doc->footNoteSeparatorLineWidth() ||
201 type != m_doc->footNoteSeparatorLineType())
204 macro =
new KMacroCommand(i18n(
"Change Footnote Line Separator Settings"));
205 cmd =
new KWChangeFootNoteLineSeparatorParametersCommand( i18n(
"Change Footnote Line Separator Settings") , m_doc->footNoteSeparatorLinePosition(), tmp, m_doc->footNoteSeparatorLineLength(), val,m_doc->footNoteSeparatorLineWidth(), width, m_doc->footNoteSeparatorLineType(), type, m_doc);
206 macro->addCommand( cmd );
212 m_doc->addCommand( macro );
215 KDialogBase::slotOk();