KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1143 lines
38KB

  1. /* This file is part of the KDE project
  2. Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
  3. 2001, 2002 Sven Leiber <s.leiber@web.de>
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public License
  13. along with this library; see the file COPYING.LIB. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. * Boston, MA 02110-1301, USA.
  16. */
  17. #include "KoAutoFormatDia.h"
  18. #include "KoAutoFormat.h"
  19. #include "KoCharSelectDia.h"
  20. #include <KoSearchDia.h>
  21. #include <tdelocale.h>
  22. #include <tdemessagebox.h>
  23. #include <tdelistview.h>
  24. #include <kstandarddirs.h>
  25. #include <tqlayout.h>
  26. #include <tqwhatsthis.h>
  27. #include <tqcheckbox.h>
  28. #include <tqpushbutton.h>
  29. #include <tqtooltip.h>
  30. #include <tqcombobox.h>
  31. #include <tqdir.h>
  32. #include <tqapplication.h>
  33. KoAutoFormatLineEdit::KoAutoFormatLineEdit ( TQWidget * parent, const char * name )
  34. : TQLineEdit(parent,name)
  35. {
  36. }
  37. void KoAutoFormatLineEdit::keyPressEvent ( TQKeyEvent *ke )
  38. {
  39. if( ke->key() == Qt::Key_Return ||
  40. ke->key() == Qt::Key_Enter )
  41. {
  42. emit keyReturnPressed();
  43. return;
  44. }
  45. TQLineEdit::keyPressEvent (ke);
  46. }
  47. /******************************************************************/
  48. /* Class: KoAutoFormatExceptionWidget */
  49. /******************************************************************/
  50. KoAutoFormatExceptionWidget::KoAutoFormatExceptionWidget(TQWidget *parent, const TQString &name,const TQStringList &_list, bool _autoInclude, bool _abreviation)
  51. :TQWidget( parent )
  52. {
  53. m_bAbbreviation=_abreviation;
  54. m_listException=_list;
  55. TQGridLayout *grid = new TQGridLayout(this, 4, 2, 0, KDialog::spacingHint());
  56. TQLabel *lab=new TQLabel(name,this);
  57. grid->addMultiCellWidget(lab,0,0,0,1);
  58. exceptionLine = new KoAutoFormatLineEdit( this );
  59. grid->addWidget(exceptionLine,1,0);
  60. connect(exceptionLine,TQT_SIGNAL(keyReturnPressed()),TQT_SLOT(slotAddException()));
  61. connect(exceptionLine ,TQT_SIGNAL(textChanged ( const TQString & )),
  62. TQT_SLOT(textChanged ( const TQString & )));
  63. pbAddException=new TQPushButton(i18n("Add"),this);
  64. connect(pbAddException, TQT_SIGNAL(clicked()),TQT_SLOT(slotAddException()));
  65. grid->addWidget(pbAddException,1,1);
  66. pbAddException->setEnabled(false);
  67. pbRemoveException=new TQPushButton(i18n("Remove"),this);
  68. connect(pbRemoveException, TQT_SIGNAL(clicked()),TQT_SLOT(slotRemoveException()));
  69. grid->addWidget(pbRemoveException,2,1,TQt::AlignTop);
  70. exceptionList=new TQListBox(this);
  71. exceptionList->insertStringList(m_listException);
  72. exceptionList->sort();
  73. grid->addWidget(exceptionList,2,0);
  74. grid->setRowStretch( 2, 1 );
  75. connect( exceptionList , TQT_SIGNAL(selectionChanged () ),
  76. this,TQT_SLOT(slotExceptionListSelected()) );
  77. pbRemoveException->setEnabled( exceptionList->currentItem()!=-1);
  78. cbAutoInclude = new TQCheckBox( i18n("Autoinclude"), this );
  79. grid->addWidget(cbAutoInclude,3,0);
  80. cbAutoInclude->setChecked( _autoInclude );
  81. }
  82. void KoAutoFormatExceptionWidget::textChanged ( const TQString &_text )
  83. {
  84. pbAddException->setEnabled(!_text.isEmpty());
  85. }
  86. void KoAutoFormatExceptionWidget::slotAddException()
  87. {
  88. TQString text=exceptionLine->text().stripWhiteSpace();
  89. if(!text.isEmpty())
  90. {
  91. if(text.at(text.length()-1)!='.' && m_bAbbreviation)
  92. text=text+".";
  93. if( m_listException.findIndex( text )==-1)
  94. {
  95. m_listException<<text;
  96. exceptionList->clear();
  97. exceptionList->insertStringList(m_listException);
  98. exceptionList->sort();
  99. pbRemoveException->setEnabled( exceptionList->currentItem()!=-1);
  100. pbAddException->setEnabled(false);
  101. }
  102. exceptionLine->clear();
  103. }
  104. }
  105. void KoAutoFormatExceptionWidget::slotRemoveException()
  106. {
  107. if(!exceptionList->currentText().isEmpty())
  108. {
  109. m_listException.remove(exceptionList->currentText());
  110. exceptionList->clear();
  111. pbAddException->setEnabled(false);
  112. pbRemoveException->setEnabled( exceptionList->currentItem()!=-1);
  113. exceptionList->insertStringList(m_listException);
  114. exceptionLine->clear();
  115. }
  116. }
  117. bool KoAutoFormatExceptionWidget::autoInclude()
  118. {
  119. return cbAutoInclude->isChecked();
  120. }
  121. void KoAutoFormatExceptionWidget::setListException( const TQStringList &list)
  122. {
  123. exceptionList->clear();
  124. exceptionList->insertStringList(list);
  125. }
  126. void KoAutoFormatExceptionWidget::setAutoInclude(bool b)
  127. {
  128. cbAutoInclude->setChecked( b );
  129. }
  130. void KoAutoFormatExceptionWidget::slotExceptionListSelected()
  131. {
  132. pbRemoveException->setEnabled( exceptionList->currentItem()!=-1 );
  133. }
  134. /******************************************************************/
  135. /* Class: KoAutoFormatDia */
  136. /******************************************************************/
  137. KoAutoFormatDia::KoAutoFormatDia( TQWidget *parent, const char *name,
  138. KoAutoFormat * autoFormat )
  139. : KDialogBase( Tabbed, i18n("Autocorrection"), Ok | Cancel | User1, Ok,
  140. parent, name, true, true, KGuiItem( i18n( "&Reset" ), "undo" )),
  141. oSimpleBegin( autoFormat->getConfigTypographicSimpleQuotes().begin ),
  142. oSimpleEnd( autoFormat->getConfigTypographicSimpleQuotes().end ),
  143. oDoubleBegin( autoFormat->getConfigTypographicDoubleQuotes().begin ),
  144. oDoubleEnd( autoFormat->getConfigTypographicDoubleQuotes().end ),
  145. bulletStyle( autoFormat->getConfigBulletStyle()),
  146. m_autoFormat( *autoFormat ),
  147. m_docAutoFormat( autoFormat )
  148. {
  149. noSignal=true;
  150. newEntry = 0L;
  151. autocorrectionEntryChanged= false;
  152. changeLanguage = false;
  153. setupTab1();
  154. setupTab2();
  155. setupTab3();
  156. setupTab4();
  157. setInitialSize( TQSize(500, 300) );
  158. connect( this, TQT_SIGNAL( user1Clicked() ), this, TQT_SLOT(slotResetConf()));
  159. noSignal=false;
  160. }
  161. KoAutoFormatDia::~KoAutoFormatDia()
  162. {
  163. delete newEntry;
  164. }
  165. void KoAutoFormatDia::slotResetConf()
  166. {
  167. switch( activePageIndex() ) {
  168. case 0:
  169. initTab1();
  170. break;
  171. case 1:
  172. initTab2();
  173. break;
  174. case 2:
  175. initTab3();
  176. break;
  177. case 3:
  178. initTab4();
  179. break;
  180. default:
  181. break;
  182. }
  183. }
  184. void KoAutoFormatDia::setupTab1()
  185. {
  186. tab1 = addPage( i18n( "Simple Autocorrection" ) );
  187. TQVBoxLayout *vbox = new TQVBoxLayout(tab1, 0, KDialog::spacingHint());
  188. cbUpperCase = new TQCheckBox( tab1 );
  189. cbUpperCase->setText( i18n(
  190. "Convert &first letter of a sentence automatically to uppercase\n"
  191. "(e.g. \"my house. in this town\" to \"my house. In this town\")"
  192. ) );
  193. TQWhatsThis::add( cbUpperCase, i18n(
  194. "Detect when a new sentence is started and always ensure that"
  195. " the first character is an uppercase character."));
  196. vbox->addWidget(cbUpperCase);
  197. cbUpperUpper = new TQCheckBox( tab1 );
  198. cbUpperUpper->setText( i18n(
  199. "Convert &two uppercase characters to one uppercase and one"
  200. " lowercase character\n (e.g. PErfect to Perfect)" ) );
  201. TQWhatsThis::add( cbUpperUpper, i18n(
  202. "All words are checked for the common mistake of holding the "
  203. "shift key down a bit too long. If some words must have two "
  204. "uppercase characters, then those exceptions should be added in "
  205. "the 'Exceptions' tab."));
  206. vbox->addWidget(cbUpperUpper);
  207. cbDetectUrl=new TQCheckBox( tab1 );
  208. cbDetectUrl->setText( i18n( "Autoformat &URLs" ) );
  209. TQWhatsThis::add( cbDetectUrl, i18n(
  210. "Detect when a URL (Uniform Resource Locator) is typed and "
  211. "provide formatting that matches the way an Internet browser "
  212. "would show a URL."));
  213. vbox->addWidget(cbDetectUrl);
  214. cbIgnoreDoubleSpace=new TQCheckBox( tab1 );
  215. cbIgnoreDoubleSpace->setText( i18n( "&Suppress double spaces" ) );
  216. TQWhatsThis::add( cbIgnoreDoubleSpace, i18n(
  217. "Make sure that more than one space cannot be typed, as this is a "
  218. "common mistake which is quite hard to find in formatted text."));
  219. vbox->addWidget(cbIgnoreDoubleSpace);
  220. cbRemoveSpaceBeginEndLine=new TQCheckBox( tab1 );
  221. cbRemoveSpaceBeginEndLine->setText( i18n(
  222. "R&emove spaces at the beginning and end of paragraphs" ) );
  223. TQWhatsThis::add( cbRemoveSpaceBeginEndLine, i18n(
  224. "Keep correct formatting and indenting of sentences by "
  225. "automatically removing spaces typed at the beginning and end of "
  226. "a paragraph."));
  227. vbox->addWidget(cbRemoveSpaceBeginEndLine);
  228. cbAutoChangeFormat=new TQCheckBox( tab1 );
  229. cbAutoChangeFormat->setText( i18n(
  230. "Automatically do &bold and underline formatting") );
  231. TQWhatsThis::add( cbAutoChangeFormat, i18n(
  232. "When you use _underline_ or *bold*, the text between the "
  233. "underscores or asterisks will be converted to underlined or "
  234. "bold text.") );
  235. vbox->addWidget(cbAutoChangeFormat);
  236. cbAutoReplaceNumber=new TQCheckBox( tab1 );
  237. cbAutoReplaceNumber->setText( i18n(
  238. "We add the 1/2 char at the %1", "Re&place 1/2... with %1..." )
  239. .arg( TQString( "½" ) ) );
  240. TQWhatsThis::add( cbAutoReplaceNumber, i18n(
  241. "Most standard fraction notations will be converted when available"
  242. ) );
  243. vbox->addWidget(cbAutoReplaceNumber);
  244. cbUseNumberStyle=new TQCheckBox( tab1 );
  245. cbUseNumberStyle->setText( i18n(
  246. "Use &autonumbering for numbered paragraphs" ) );
  247. TQWhatsThis::add( cbUseNumberStyle, i18n(
  248. "When typing '1)' or similar in front of a paragraph, "
  249. "automatically convert the paragraph to use that numbering style. "
  250. "This has the advantage that further paragraphs will also be "
  251. "numbered and the spacing is done correctly.") );
  252. vbox->addWidget(cbUseNumberStyle);
  253. cbAutoSuperScript = new TQCheckBox( tab1 );
  254. cbAutoSuperScript->setText( i18n("Rep&lace 1st... with 1^st..."));
  255. cbAutoSuperScript->setEnabled( m_docAutoFormat->nbSuperScriptEntry()>0 );
  256. vbox->addWidget(cbAutoSuperScript);
  257. cbCapitalizeDaysName = new TQCheckBox( tab1 );
  258. cbCapitalizeDaysName->setText( i18n("Capitalize name of days"));
  259. vbox->addWidget(cbCapitalizeDaysName);
  260. cbUseBulletStyle=new TQCheckBox( tab1 );
  261. cbUseBulletStyle->setText( i18n(
  262. "Use l&ist-formatting for bulleted paragraphs" ) );
  263. TQWhatsThis::add( cbUseBulletStyle, i18n(
  264. "When typing '*' or '-' in front of a paragraph, automatically "
  265. "convert the paragraph to use that list-style. Using a list-style "
  266. "formatting means that a correct bullet is used to draw the list."
  267. ) );
  268. connect( cbUseBulletStyle, TQT_SIGNAL( toggled( bool ) ),
  269. TQT_SLOT( slotBulletStyleToggled( bool ) ) );
  270. vbox->addWidget(cbUseBulletStyle);
  271. TQHBoxLayout *hbox = new TQHBoxLayout();
  272. hbox->addSpacing( 20 );
  273. hbox->setSpacing(KDialog::spacingHint());
  274. pbBulletStyle = new TQPushButton( tab1 );
  275. pbBulletStyle->setFixedSize( pbBulletStyle->sizeHint() );
  276. hbox->addWidget( pbBulletStyle );
  277. pbDefaultBulletStyle = new TQPushButton( tab1 );
  278. pbDefaultBulletStyle->setText(i18n("Default"));
  279. pbDefaultBulletStyle->setFixedSize( pbDefaultBulletStyle->sizeHint() );
  280. hbox->addWidget( pbDefaultBulletStyle );
  281. hbox->addStretch( 1 );
  282. vbox->addItem(hbox);
  283. vbox->addStretch( 1 );
  284. initTab1();
  285. connect( pbBulletStyle, TQT_SIGNAL( clicked() ), TQT_SLOT( chooseBulletStyle() ) );
  286. connect( pbDefaultBulletStyle, TQT_SIGNAL( clicked()),
  287. TQT_SLOT( defaultBulletStyle() ) );
  288. }
  289. void KoAutoFormatDia::initTab1()
  290. {
  291. cbUpperCase->setChecked( m_autoFormat.getConfigUpperCase() );
  292. cbUpperUpper->setChecked( m_autoFormat.getConfigUpperUpper() );
  293. cbDetectUrl->setChecked( m_autoFormat.getConfigAutoDetectUrl());
  294. cbIgnoreDoubleSpace->setChecked( m_autoFormat.getConfigIgnoreDoubleSpace());
  295. cbRemoveSpaceBeginEndLine->setChecked( m_autoFormat.getConfigRemoveSpaceBeginEndLine());
  296. cbAutoChangeFormat->setChecked( m_autoFormat.getConfigAutoChangeFormat());
  297. cbAutoReplaceNumber->setChecked( m_autoFormat.getConfigAutoReplaceNumber());
  298. cbUseNumberStyle->setChecked( m_autoFormat.getConfigAutoNumberStyle());
  299. cbUseBulletStyle->setChecked( m_autoFormat.getConfigUseBulletSyle());
  300. cbAutoSuperScript->setChecked( m_docAutoFormat->getConfigAutoSuperScript());
  301. pbBulletStyle->setText( bulletStyle );
  302. cbCapitalizeDaysName->setChecked( m_autoFormat.getConfigCapitalizeNameOfDays());
  303. slotBulletStyleToggled( cbUseBulletStyle->isChecked() );
  304. }
  305. void KoAutoFormatDia::slotBulletStyleToggled( bool b )
  306. {
  307. pbBulletStyle->setEnabled( b );
  308. pbDefaultBulletStyle->setEnabled( b );
  309. }
  310. void KoAutoFormatDia::setupTab2()
  311. {
  312. tab2 = addPage( i18n( "Custom Quotes" ) );
  313. TQVBoxLayout *vbox = new TQVBoxLayout(tab2, 0, KDialog::spacingHint());
  314. cbTypographicDoubleQuotes = new TQCheckBox( tab2 );
  315. cbTypographicDoubleQuotes->setText( i18n(
  316. "Replace &double quotes with typographical quotes" ) );
  317. connect( cbTypographicDoubleQuotes,TQT_SIGNAL(toggled ( bool)),
  318. TQT_SLOT(slotChangeStateDouble(bool)));
  319. vbox->addWidget( cbTypographicDoubleQuotes );
  320. TQHBoxLayout *hbox = new TQHBoxLayout( );
  321. hbox->addSpacing( 20 );
  322. pbDoubleQuote1 = new TQPushButton( tab2 );
  323. pbDoubleQuote1->setFixedSize( pbDoubleQuote1->sizeHint() );
  324. pbDoubleQuote2 = new TQPushButton( tab2 );
  325. pbDoubleQuote2->setFixedSize( pbDoubleQuote2->sizeHint() );
  326. if (TQApplication::reverseLayout()) {
  327. hbox->addWidget( pbDoubleQuote2 );
  328. hbox->addWidget( pbDoubleQuote1 );
  329. } else {
  330. hbox->addWidget( pbDoubleQuote1 );
  331. hbox->addWidget( pbDoubleQuote2 );
  332. }
  333. hbox->addSpacing( KDialog::spacingHint() );
  334. pbDoubleDefault = new TQPushButton( tab2 );
  335. pbDoubleDefault->setText(i18n("Default"));
  336. pbDoubleDefault->setFixedSize( pbDoubleDefault->sizeHint() );
  337. hbox->addWidget( pbDoubleDefault );
  338. hbox->addStretch( 1 );
  339. connect(pbDoubleQuote1, TQT_SIGNAL( clicked() ), TQT_SLOT( chooseDoubleQuote1() ));
  340. connect(pbDoubleQuote2, TQT_SIGNAL( clicked() ), TQT_SLOT( chooseDoubleQuote2() ));
  341. connect(pbDoubleDefault, TQT_SIGNAL( clicked()), TQT_SLOT( defaultDoubleQuote() ));
  342. vbox->addItem( hbox );
  343. cbTypographicSimpleQuotes = new TQCheckBox( tab2 );
  344. cbTypographicSimpleQuotes->setText( i18n(
  345. "Replace &single quotes with typographical quotes" ) );
  346. connect( cbTypographicSimpleQuotes,TQT_SIGNAL(toggled ( bool)),
  347. TQT_SLOT(slotChangeStateSimple(bool)));
  348. vbox->addWidget( cbTypographicSimpleQuotes );
  349. hbox = new TQHBoxLayout( );
  350. hbox->addSpacing( 20 );
  351. pbSimpleQuote1 = new TQPushButton( tab2 );
  352. pbSimpleQuote1->setFixedSize( pbSimpleQuote1->sizeHint() );
  353. pbSimpleQuote2 = new TQPushButton( tab2 );
  354. pbSimpleQuote2->setFixedSize( pbSimpleQuote2->sizeHint() );
  355. if (TQApplication::reverseLayout()) {
  356. hbox->addWidget( pbSimpleQuote2 );
  357. hbox->addWidget( pbSimpleQuote1 );
  358. } else {
  359. hbox->addWidget( pbSimpleQuote1 );
  360. hbox->addWidget( pbSimpleQuote2 );
  361. }
  362. hbox->addSpacing( KDialog::spacingHint() );
  363. pbSimpleDefault = new TQPushButton( tab2 );
  364. pbSimpleDefault->setText(i18n("Default"));
  365. pbSimpleDefault->setFixedSize( pbSimpleDefault->sizeHint() );
  366. hbox->addWidget( pbSimpleDefault );
  367. hbox->addStretch( 1 );
  368. connect(pbSimpleQuote1, TQT_SIGNAL( clicked() ), TQT_SLOT( chooseSimpleQuote1() ));
  369. connect(pbSimpleQuote2, TQT_SIGNAL( clicked() ), TQT_SLOT( chooseSimpleQuote2() ));
  370. connect(pbSimpleDefault, TQT_SIGNAL( clicked()), TQT_SLOT( defaultSimpleQuote() ));
  371. vbox->addItem( hbox );
  372. vbox->addStretch( 1 );
  373. initTab2();
  374. }
  375. void KoAutoFormatDia::initTab2()
  376. {
  377. bool state=m_autoFormat.getConfigTypographicDoubleQuotes().replace;
  378. cbTypographicDoubleQuotes->setChecked( state );
  379. pbDoubleQuote1->setText( oDoubleBegin );
  380. pbDoubleQuote2->setText(oDoubleEnd );
  381. slotChangeStateDouble(state);
  382. state=m_autoFormat.getConfigTypographicSimpleQuotes().replace;
  383. cbTypographicSimpleQuotes->setChecked( state );
  384. pbSimpleQuote1->setText( oSimpleBegin );
  385. pbSimpleQuote2->setText(oSimpleEnd );
  386. slotChangeStateSimple(state);
  387. }
  388. void KoAutoFormatDia::setupTab3()
  389. {
  390. tab3 = addPage( i18n( "Advanced Autocorrection" ) );
  391. TQLabel *lblFind, *lblReplace;
  392. TQGridLayout *grid = new TQGridLayout( tab3, 11, 7, 0, KDialog::spacingHint() );
  393. autoFormatLanguage = new TQComboBox(tab3);
  394. TQStringList lst;
  395. lst<<i18n("Default");
  396. lst<<i18n("All Languages");
  397. exceptionLanguageName.insert( i18n("Default"), "");
  398. exceptionLanguageName.insert( i18n("All Languages"), "all_languages");
  399. TDEStandardDirs *standard = new TDEStandardDirs();
  400. TQStringList tmp = standard->findDirs("data", "koffice/autocorrect/");
  401. TQString path = *(tmp.end());
  402. for ( TQStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it )
  403. {
  404. path =*it;
  405. }
  406. delete standard;
  407. TQDir dir( path);
  408. tmp =dir.entryList (TQDir::Files);
  409. for ( TQStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it )
  410. {
  411. if ( !(*it).contains("autocorrect"))
  412. {
  413. TQString readableName = TDEGlobal::locale()->twoAlphaToCountryName((*it).left((*it).length()-4));
  414. TQString tmp;
  415. if ( readableName.isEmpty() )
  416. tmp =(*it).left((*it).length()-4);
  417. else
  418. tmp =readableName;
  419. exceptionLanguageName.insert( tmp, (*it).left((*it).length()-4));
  420. lst<<tmp;
  421. }
  422. }
  423. autoFormatLanguage->insertStringList(lst);
  424. connect(autoFormatLanguage->listBox(), TQT_SIGNAL(selected ( const TQString & )), this, TQT_SLOT(changeAutoformatLanguage(const TQString & )));
  425. grid->addMultiCellWidget( autoFormatLanguage, 0, 0, 4, 6 );
  426. TQLabel *lblAutoFormatLanguage = new TQLabel( i18n("Replacements and exceptions for language:"), tab3);
  427. grid->addMultiCellWidget( lblAutoFormatLanguage, 0, 0, 0, 3 );
  428. cbAdvancedAutoCorrection = new TQCheckBox( tab3 );
  429. cbAdvancedAutoCorrection->setText( i18n("Enable word replacement") );
  430. connect( cbAdvancedAutoCorrection, TQT_SIGNAL(clicked ()), this, TQT_SLOT( slotChangeAdvancedAutoCorrection()));
  431. grid->addMultiCellWidget( cbAdvancedAutoCorrection, 1, 1, 0, 6 );
  432. cbAutoCorrectionWithFormat = new TQCheckBox( tab3 );
  433. cbAutoCorrectionWithFormat->setText( i18n("Replace text with format") );
  434. grid->addMultiCellWidget( cbAutoCorrectionWithFormat, 2, 2, 0, 6 );
  435. lblFind = new TQLabel( i18n( "&Find:" ), tab3 );
  436. grid->addWidget( lblFind, 3, 0 );
  437. m_find = new KoAutoFormatLineEdit( tab3 );
  438. grid->addWidget( m_find, 3, 1 );
  439. lblFind->setBuddy( m_find );
  440. connect( m_find, TQT_SIGNAL( textChanged( const TQString & ) ),
  441. TQT_SLOT( slotfind( const TQString & ) ) );
  442. connect( m_find, TQT_SIGNAL( keyReturnPressed() ),
  443. TQT_SLOT( slotAddEntry()));
  444. pbSpecialChar1 = new TQPushButton( "...", tab3 );
  445. TQToolTip::add( pbSpecialChar1, i18n( "Insert a special character..." ) );
  446. pbSpecialChar1->setFixedWidth( 40 );
  447. grid->addWidget( pbSpecialChar1, 3, 2 );
  448. connect(pbSpecialChar1,TQT_SIGNAL(clicked()), TQT_SLOT(chooseSpecialChar1()));
  449. lblReplace = new TQLabel( i18n( "&Replace:" ), tab3 );
  450. grid->addWidget( lblReplace, 3, 3 );
  451. m_replace = new KoAutoFormatLineEdit( tab3 );
  452. grid->addWidget( m_replace, 3, 4 );
  453. lblReplace->setBuddy( m_replace );
  454. connect( m_replace, TQT_SIGNAL( textChanged( const TQString & ) ),
  455. TQT_SLOT( slotfind2( const TQString & ) ) );
  456. connect( m_replace, TQT_SIGNAL( keyReturnPressed() ),
  457. TQT_SLOT( slotAddEntry()));
  458. pbSpecialChar2 = new TQPushButton( "...", tab3 );
  459. TQToolTip::add( pbSpecialChar2, i18n( "Insert a special character..." ) );
  460. pbSpecialChar2->setFixedWidth( 40 );
  461. grid->addWidget( pbSpecialChar2, 3, 5 );
  462. connect(pbSpecialChar2,TQT_SIGNAL(clicked()), TQT_SLOT(chooseSpecialChar2()));
  463. pbAdd = new TQPushButton( i18n( "&Add"), tab3 );
  464. grid->addWidget( pbAdd, 3, 6 );
  465. connect(pbAdd,TQT_SIGNAL(clicked()),this, TQT_SLOT(slotAddEntry()));
  466. m_pListView = new TDEListView( tab3 );
  467. m_pListView->addColumn( i18n( "Find" ) );
  468. m_pListView->addColumn( i18n( "Replace" ) );
  469. m_pListView->setAllColumnsShowFocus( true );
  470. grid->addMultiCellWidget( m_pListView, 4, 10, 0, 5 );
  471. connect(m_pListView, TQT_SIGNAL(doubleClicked ( TQListViewItem * )),
  472. TQT_SLOT(slotChangeTextFormatEntry()) );
  473. connect(m_pListView, TQT_SIGNAL(clicked ( TQListViewItem * ) ),
  474. TQT_SLOT(slotEditEntry()) );
  475. pbRemove = new TQPushButton( i18n( "Remove" ), tab3 );
  476. grid->addWidget( pbRemove, 4, 6, TQt::AlignTop );
  477. connect(pbRemove,TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveEntry()));
  478. pbChangeFormat= new TQPushButton( i18n( "Change Format..." ), tab3 );
  479. grid->addWidget( pbChangeFormat, 5, 6, TQt::AlignTop );
  480. connect( pbChangeFormat, TQT_SIGNAL(clicked()), TQT_SLOT(slotChangeTextFormatEntry()));
  481. pbClearFormat= new TQPushButton( i18n( "Clear Format" ), tab3 );
  482. grid->addWidget( pbClearFormat, 6, 6, TQt::AlignTop );
  483. connect( pbClearFormat, TQT_SIGNAL(clicked()), TQT_SLOT(slotClearTextFormatEntry()));
  484. grid->setRowStretch( 10, 1 );
  485. initTab3();
  486. slotChangeAdvancedAutoCorrection();
  487. pbRemove->setEnabled(false);
  488. pbChangeFormat->setEnabled( false );
  489. pbAdd->setEnabled(false);
  490. pbClearFormat->setEnabled( false);
  491. }
  492. void KoAutoFormatDia::initTab3()
  493. {
  494. if ( !changeLanguage || noSignal)
  495. {
  496. initialLanguage=m_autoFormat.getConfigAutoFormatLanguage( );
  497. if ( initialLanguage.isEmpty() )
  498. autoFormatLanguage->setCurrentItem(0);
  499. else
  500. {
  501. KoExceptionLanguageName::Iterator it = exceptionLanguageName.begin();
  502. for ( ; it != exceptionLanguageName.end() ; ++it )
  503. {
  504. if ( it.data() == initialLanguage)
  505. {
  506. autoFormatLanguage->setCurrentText(it.key());
  507. break;
  508. }
  509. }
  510. }
  511. }
  512. //force to re-readconfig when we reset config and we change a entry
  513. if ( autocorrectionEntryChanged )
  514. {
  515. if ( !changeLanguage )
  516. m_docAutoFormat->configAutoFormatLanguage( initialLanguage);
  517. m_docAutoFormat->readConfig( true );
  518. }
  519. cbAdvancedAutoCorrection->setChecked(m_autoFormat.getConfigAdvancedAutoCorrect());
  520. cbAutoCorrectionWithFormat->setChecked( m_autoFormat.getConfigCorrectionWithFormat());
  521. m_pListView->clear();
  522. TQDictIterator<KoAutoFormatEntry> it( m_docAutoFormat->getAutoFormatEntries());
  523. for( ; it.current(); ++it )
  524. {
  525. ( void )new TQListViewItem( m_pListView, it.currentKey(), it.current()->replace() );
  526. }
  527. }
  528. void KoAutoFormatDia::slotChangeAdvancedAutoCorrection()
  529. {
  530. bool state = cbAdvancedAutoCorrection->isChecked();
  531. cbAutoCorrectionWithFormat->setEnabled( state );
  532. pbSpecialChar2->setEnabled( state );
  533. pbSpecialChar1->setEnabled( state );
  534. m_replace->setEnabled( state);
  535. m_find->setEnabled( state);
  536. m_pListView->setEnabled( state);
  537. state = state && !m_replace->text().isEmpty() && !m_find->text().isEmpty();
  538. KoAutoFormatEntry * entry=m_docAutoFormat->findFormatEntry(m_find->text());
  539. pbRemove->setEnabled(state && entry);
  540. pbChangeFormat->setEnabled(state && entry);
  541. pbClearFormat->setEnabled(state && entry);
  542. pbAdd->setEnabled(state);
  543. }
  544. void KoAutoFormatDia::changeAutoformatLanguage(const TQString & text)
  545. {
  546. if ( text==i18n("Default"))
  547. m_docAutoFormat->configAutoFormatLanguage( TQString());
  548. else
  549. {
  550. m_docAutoFormat->configAutoFormatLanguage( exceptionLanguageName.find(text).data());
  551. }
  552. if ( !noSignal )
  553. {
  554. changeLanguage=true;
  555. m_docAutoFormat->readConfig( true );
  556. initTab3();
  557. initTab4();
  558. autocorrectionEntryChanged=true;
  559. cbAutoSuperScript->setEnabled( m_docAutoFormat->nbSuperScriptEntry()>0 );
  560. oSimpleBegin= m_docAutoFormat->getConfigTypographicSimpleQuotes().begin ;
  561. oSimpleEnd= m_docAutoFormat->getConfigTypographicSimpleQuotes().end;
  562. oDoubleBegin= m_docAutoFormat->getConfigTypographicDoubleQuotes().begin;
  563. oDoubleEnd= m_docAutoFormat->getConfigTypographicDoubleQuotes().end;
  564. bulletStyle= m_docAutoFormat->getConfigBulletStyle();
  565. delete newEntry;
  566. newEntry=0L;
  567. changeLanguage=false;
  568. }
  569. }
  570. void KoAutoFormatDia::setupTab4()
  571. {
  572. tab4 = addPage( i18n( "Exceptions" ) );
  573. TQVBoxLayout *vbox = new TQVBoxLayout(tab4, 0, KDialog::spacingHint());
  574. abbreviation=new KoAutoFormatExceptionWidget(tab4,
  575. i18n("Do not treat as the end of a sentence:"),
  576. m_autoFormat.listException(),
  577. m_autoFormat.getConfigIncludeAbbreviation() , true);
  578. vbox->addWidget( abbreviation );
  579. twoUpperLetter=new KoAutoFormatExceptionWidget(tab4,
  580. i18n("Accept two uppercase letters in:"),
  581. m_autoFormat.listTwoUpperLetterException(),
  582. m_autoFormat.getConfigIncludeTwoUpperUpperLetterException());
  583. vbox->addWidget( twoUpperLetter );
  584. initTab4();
  585. }
  586. void KoAutoFormatDia::initTab4()
  587. {
  588. abbreviation->setListException( !changeLanguage ? m_autoFormat.listException(): m_docAutoFormat->listException() );
  589. if ( !changeLanguage )
  590. {
  591. abbreviation->setAutoInclude( m_docAutoFormat->getConfigIncludeAbbreviation() );
  592. twoUpperLetter->setAutoInclude( m_docAutoFormat->getConfigIncludeTwoUpperUpperLetterException() );
  593. }
  594. twoUpperLetter->setListException( !changeLanguage ? m_autoFormat.listTwoUpperLetterException():m_docAutoFormat->listTwoUpperLetterException() );
  595. }
  596. void KoAutoFormatDia::slotClearTextFormatEntry()
  597. {
  598. bool addNewEntry = (pbAdd->text() == i18n( "&Add" ));
  599. if ( m_pListView->currentItem() || addNewEntry)
  600. {
  601. if ( addNewEntry )
  602. {
  603. if (newEntry)
  604. newEntry->clearFormatEntryContext();
  605. }
  606. else
  607. {
  608. KoAutoFormatEntry *entry = m_docAutoFormat->findFormatEntry(m_pListView->currentItem()->text(0));
  609. entry->clearFormatEntryContext();
  610. }
  611. autocorrectionEntryChanged= true;
  612. }
  613. }
  614. void KoAutoFormatDia::slotChangeTextFormatEntry()
  615. {
  616. bool addNewEntry = (pbAdd->text() == i18n( "&Add" ));
  617. if ( m_pListView->currentItem() || addNewEntry)
  618. {
  619. KoAutoFormatEntry *entry = 0L;
  620. if ( addNewEntry )
  621. {
  622. if ( m_replace->text().isEmpty() )
  623. return;
  624. if ( !newEntry )
  625. newEntry = new KoAutoFormatEntry( m_replace->text());
  626. entry =newEntry;
  627. }
  628. else
  629. entry = m_docAutoFormat->findFormatEntry(m_pListView->currentItem()->text(0));
  630. KoSearchContext *tmpFormat = entry->formatEntryContext();
  631. bool createNewFormat = false;
  632. if ( !tmpFormat )
  633. {
  634. tmpFormat = new KoSearchContext();
  635. createNewFormat = true;
  636. }
  637. KoFormatDia *dia = new KoFormatDia( this, i18n("Change Text Format"), tmpFormat , 0L);
  638. if ( dia->exec())
  639. {
  640. dia->ctxOptions( );
  641. if ( createNewFormat )
  642. entry->setFormatEntryContext( tmpFormat );
  643. autocorrectionEntryChanged= true;
  644. }
  645. else
  646. {
  647. if ( createNewFormat )
  648. delete tmpFormat;
  649. }
  650. delete dia;
  651. }
  652. }
  653. void KoAutoFormatDia::slotRemoveEntry()
  654. {
  655. //find entry in listbox
  656. if(m_pListView->currentItem())
  657. {
  658. m_docAutoFormat->removeAutoFormatEntry(m_pListView->currentItem()->text(0));
  659. pbAdd->setText(i18n("&Add"));
  660. refreshEntryList();
  661. autocorrectionEntryChanged= true;
  662. }
  663. }
  664. void KoAutoFormatDia::slotfind( const TQString & )
  665. {
  666. KoAutoFormatEntry *entry = m_docAutoFormat->findFormatEntry(m_find->text());
  667. if ( entry )
  668. {
  669. m_replace->setText(entry->replace().latin1());
  670. pbAdd->setText(i18n("&Modify"));
  671. m_pListView->setCurrentItem(m_pListView->findItem(m_find->text(),0));
  672. } else {
  673. m_replace->clear();
  674. pbAdd->setText(i18n("&Add"));
  675. m_pListView->setCurrentItem(0L);
  676. }
  677. slotfind2("");
  678. }
  679. void KoAutoFormatDia::slotfind2( const TQString & )
  680. {
  681. bool state = !m_replace->text().isEmpty() && !m_find->text().isEmpty();
  682. KoAutoFormatEntry * entry=m_docAutoFormat->findFormatEntry(m_find->text());
  683. pbRemove->setEnabled(state && entry);
  684. if ( state && entry )
  685. {
  686. delete newEntry;
  687. newEntry = 0L;
  688. }
  689. pbChangeFormat->setEnabled(state);
  690. pbClearFormat->setEnabled(state);
  691. pbAdd->setEnabled(state);
  692. }
  693. void KoAutoFormatDia::refreshEntryList()
  694. {
  695. m_pListView->clear();
  696. TQDictIterator<KoAutoFormatEntry> it( m_docAutoFormat->getAutoFormatEntries());
  697. for( ; it.current(); ++it )
  698. {
  699. ( void )new TQListViewItem( m_pListView, it.currentKey(), it.current()->replace() );
  700. }
  701. m_pListView->setCurrentItem(m_pListView->firstChild ());
  702. bool state = !(m_replace->text().isEmpty()) && !(m_find->text().isEmpty());
  703. //we can delete item, as we search now in listbox and not in m_find lineedit
  704. pbRemove->setEnabled(m_pListView->currentItem() && m_pListView->selectedItem()!=0 );
  705. pbChangeFormat->setEnabled(state && m_pListView->currentItem() && m_pListView->selectedItem()!=0 );
  706. pbClearFormat->setEnabled(state && m_pListView->currentItem() && m_pListView->selectedItem()!=0 );
  707. pbAdd->setEnabled(state);
  708. }
  709. void KoAutoFormatDia::addEntryList(const TQString &key, KoAutoFormatEntry *_autoEntry)
  710. {
  711. m_docAutoFormat->addAutoFormatEntry( key, _autoEntry );
  712. }
  713. void KoAutoFormatDia::editEntryList(const TQString &key,const TQString &newFindString, KoAutoFormatEntry *_autoEntry)
  714. {
  715. if ( m_docAutoFormat->findFormatEntry(key) && m_docAutoFormat->findFormatEntry(key)->formatEntryContext())
  716. _autoEntry->setFormatEntryContext( new KoSearchContext(*(m_docAutoFormat->findFormatEntry(key)->formatEntryContext()) ));
  717. m_docAutoFormat->removeAutoFormatEntry( key );
  718. m_docAutoFormat->addAutoFormatEntry( newFindString, _autoEntry );
  719. }
  720. void KoAutoFormatDia::slotAddEntry()
  721. {
  722. if(!pbAdd->isEnabled())
  723. return;
  724. TQString repl = m_replace->text();
  725. TQString find = m_find->text();
  726. if(repl.isEmpty() || find.isEmpty())
  727. {
  728. KMessageBox::sorry( 0L, i18n( "An area is empty" ) );
  729. return;
  730. }
  731. if(repl==find)
  732. {
  733. KMessageBox::sorry( 0L, i18n( "Find string is the same as replace string!" ) );
  734. return;
  735. }
  736. KoAutoFormatEntry *tmp = new KoAutoFormatEntry( repl );
  737. if(pbAdd->text() == i18n( "&Add" ))
  738. {
  739. if ( newEntry )
  740. {
  741. newEntry->changeReplace( m_replace->text());
  742. addEntryList(find, newEntry);
  743. delete tmp;
  744. newEntry = 0L;
  745. }
  746. else
  747. addEntryList(find, tmp);
  748. }
  749. else
  750. editEntryList(find, find, tmp);
  751. m_replace->clear();
  752. m_find->clear();
  753. refreshEntryList();
  754. autocorrectionEntryChanged= true;
  755. }
  756. void KoAutoFormatDia::chooseSpecialChar1()
  757. {
  758. TQString f = font().family();
  759. TQChar c = ' ';
  760. bool const focus = m_find->hasFocus();
  761. if ( KoCharSelectDia::selectChar( f, c, false ) )
  762. {
  763. int const cursorpos = m_find->cursorPosition();
  764. if (focus)
  765. m_find->setText( m_find->text().insert( cursorpos, c ) );
  766. else
  767. m_find->setText( m_find->text().append(c) );
  768. m_find->setCursorPosition( cursorpos+1 );
  769. }
  770. }
  771. void KoAutoFormatDia::chooseSpecialChar2()
  772. {
  773. TQString f = font().family();
  774. TQChar c = ' ';
  775. bool const focus = m_replace->hasFocus();
  776. if ( KoCharSelectDia::selectChar( f, c, false ) )
  777. {
  778. int const cursorpos = m_replace->cursorPosition();
  779. if (focus)
  780. m_replace->setText( m_replace->text().insert(m_replace->cursorPosition(), c ) );
  781. else
  782. m_replace->setText( m_replace->text().append(c) );
  783. m_replace->setCursorPosition( cursorpos+1 );
  784. }
  785. }
  786. void KoAutoFormatDia::slotItemRenamed(TQListViewItem *, const TQString & , int )
  787. {
  788. // Wow. This need a redesign (we don't have the old key anymore at this point !)
  789. // -> inherit TQListViewItem and store the KoAutoFormatEntry pointer in it.
  790. }
  791. void KoAutoFormatDia::slotEditEntry()
  792. {
  793. if(m_pListView->currentItem()==0)
  794. return;
  795. delete newEntry;
  796. newEntry=0L;
  797. m_find->setText(m_pListView->currentItem()->text(0));
  798. m_replace->setText(m_pListView->currentItem()->text(1));
  799. bool state = !m_replace->text().isEmpty() && !m_find->text().isEmpty();
  800. pbRemove->setEnabled(state);
  801. pbChangeFormat->setEnabled( state );
  802. pbClearFormat->setEnabled(state);
  803. pbAdd->setEnabled(state);
  804. }
  805. bool KoAutoFormatDia::applyConfig()
  806. {
  807. // First tab
  808. KoAutoFormat::TypographicQuotes tq = m_autoFormat.getConfigTypographicSimpleQuotes();
  809. tq.replace = cbTypographicSimpleQuotes->isChecked();
  810. tq.begin = pbSimpleQuote1->text()[ 0 ];
  811. tq.end = pbSimpleQuote2->text()[ 0 ];
  812. m_docAutoFormat->configTypographicSimpleQuotes( tq );
  813. tq = m_autoFormat.getConfigTypographicDoubleQuotes();
  814. tq.replace = cbTypographicDoubleQuotes->isChecked();
  815. tq.begin = pbDoubleQuote1->text()[ 0 ];
  816. tq.end = pbDoubleQuote2->text()[ 0 ];
  817. m_docAutoFormat->configTypographicDoubleQuotes( tq );
  818. m_docAutoFormat->configUpperCase( cbUpperCase->isChecked() );
  819. m_docAutoFormat->configUpperUpper( cbUpperUpper->isChecked() );
  820. m_docAutoFormat->configAutoDetectUrl( cbDetectUrl->isChecked() );
  821. m_docAutoFormat->configIgnoreDoubleSpace( cbIgnoreDoubleSpace->isChecked());
  822. m_docAutoFormat->configRemoveSpaceBeginEndLine( cbRemoveSpaceBeginEndLine->isChecked());
  823. m_docAutoFormat->configUseBulletStyle(cbUseBulletStyle->isChecked());
  824. m_docAutoFormat->configBulletStyle(pbBulletStyle->text()[ 0 ]);
  825. m_docAutoFormat->configAutoChangeFormat( cbAutoChangeFormat->isChecked());
  826. m_docAutoFormat->configAutoReplaceNumber( cbAutoReplaceNumber->isChecked());
  827. m_docAutoFormat->configAutoNumberStyle(cbUseNumberStyle->isChecked());
  828. m_docAutoFormat->configAutoSuperScript ( cbAutoSuperScript->isChecked() );
  829. m_docAutoFormat->configCapitalizeNameOfDays( cbCapitalizeDaysName->isChecked());
  830. // Second tab
  831. //m_docAutoFormat->copyAutoFormatEntries( m_autoFormat );
  832. m_docAutoFormat->copyListException(abbreviation->getListException());
  833. m_docAutoFormat->copyListTwoUpperCaseException(twoUpperLetter->getListException());
  834. m_docAutoFormat->configAdvancedAutocorrect( cbAdvancedAutoCorrection->isChecked() );
  835. m_docAutoFormat->configCorrectionWithFormat( cbAutoCorrectionWithFormat->isChecked());
  836. m_docAutoFormat->configIncludeTwoUpperUpperLetterException( twoUpperLetter->autoInclude());
  837. m_docAutoFormat->configIncludeAbbreviation( abbreviation->autoInclude());
  838. TQString lang = exceptionLanguageName.find(autoFormatLanguage->currentText()).data();
  839. if ( lang == i18n("Default") )
  840. m_docAutoFormat->configAutoFormatLanguage(TQString());
  841. else
  842. m_docAutoFormat->configAutoFormatLanguage(lang);
  843. // Save to config file
  844. m_docAutoFormat->saveConfig();
  845. return true;
  846. }
  847. void KoAutoFormatDia::slotOk()
  848. {
  849. if (applyConfig())
  850. {
  851. KDialogBase::slotOk();
  852. }
  853. }
  854. void KoAutoFormatDia::slotCancel()
  855. {
  856. //force to reload
  857. if ( autocorrectionEntryChanged )
  858. {
  859. m_docAutoFormat->configAutoFormatLanguage( initialLanguage);
  860. m_docAutoFormat->readConfig( true );
  861. }
  862. KDialogBase::slotCancel();
  863. }
  864. void KoAutoFormatDia::chooseDoubleQuote1()
  865. {
  866. TQString f = font().family();
  867. TQChar c = oDoubleBegin;
  868. if ( KoCharSelectDia::selectChar( f, c, false ) )
  869. {
  870. pbDoubleQuote1->setText( c );
  871. }
  872. }
  873. void KoAutoFormatDia::chooseDoubleQuote2()
  874. {
  875. TQString f = font().family();
  876. TQChar c = oDoubleEnd;
  877. if ( KoCharSelectDia::selectChar( f, c, false ) )
  878. {
  879. pbDoubleQuote2->setText( c );
  880. }
  881. }
  882. void KoAutoFormatDia::defaultDoubleQuote()
  883. {
  884. pbDoubleQuote1->setText(m_docAutoFormat->getDefaultTypographicDoubleQuotes().begin);
  885. pbDoubleQuote2->setText(m_docAutoFormat->getDefaultTypographicDoubleQuotes().end);
  886. }
  887. void KoAutoFormatDia::chooseSimpleQuote1()
  888. {
  889. TQString f = font().family();
  890. TQChar c = oSimpleBegin;
  891. if ( KoCharSelectDia::selectChar( f, c, false ) )
  892. {
  893. pbSimpleQuote1->setText( c );
  894. }
  895. }
  896. void KoAutoFormatDia::chooseSimpleQuote2()
  897. {
  898. TQString f = font().family();
  899. TQChar c = oSimpleEnd;
  900. if ( KoCharSelectDia::selectChar( f, c, false ) )
  901. {
  902. pbSimpleQuote2->setText( c );
  903. }
  904. }
  905. void KoAutoFormatDia::defaultSimpleQuote()
  906. {
  907. pbSimpleQuote1->setText(m_docAutoFormat->getDefaultTypographicSimpleQuotes().begin);
  908. pbSimpleQuote2->setText(m_docAutoFormat->getDefaultTypographicSimpleQuotes().end);
  909. }
  910. void KoAutoFormatDia::chooseBulletStyle()
  911. {
  912. TQString f = font().family();
  913. TQChar c = bulletStyle;
  914. if ( KoCharSelectDia::selectChar( f, c, false ) )
  915. {
  916. pbBulletStyle->setText( c );
  917. }
  918. }
  919. void KoAutoFormatDia::defaultBulletStyle()
  920. {
  921. pbBulletStyle->setText( "" );
  922. }
  923. void KoAutoFormatDia::slotChangeStateSimple(bool b)
  924. {
  925. pbSimpleQuote1->setEnabled(b);
  926. pbSimpleQuote2->setEnabled(b);
  927. pbSimpleDefault->setEnabled(b);
  928. }
  929. void KoAutoFormatDia::slotChangeStateDouble(bool b)
  930. {
  931. pbDoubleQuote1->setEnabled(b);
  932. pbDoubleQuote2->setEnabled(b);
  933. pbDoubleDefault->setEnabled(b);
  934. }
  935. #include "KoAutoFormatDia.moc"