1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: autocdlg.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _OFA_AUTOCDLG_HXX
31 #define _OFA_AUTOCDLG_HXX
33 #include <svtools/langtab.hxx>
34 #include <sfx2/tabdlg.hxx>
35 #include <tools/table.hxx>
36 #include <svx/checklbx.hxx>
37 #include <vcl/fixed.hxx>
38 #include <vcl/field.hxx>
39 #include <vcl/metric.hxx>
40 #include <svx/langbox.hxx>
44 class CollatorWrapper
;
47 // class OfaAutoCorrDlg --------------------------------------------------
49 class OfaAutoCorrDlg
: public SfxTabDialog
51 FixedText aLanguageFT
;
52 SvxLanguageBox aLanguageLB
;
54 DECL_LINK(SelectLanguageHdl
, ListBox
*);
57 OfaAutoCorrDlg(Window
* pParent
, const SfxItemSet
*pSet
);
59 void EnableLanguage(BOOL bEnable
)
60 { aLanguageFT
.Enable(bEnable
);
61 aLanguageLB
.Enable(bEnable
);}
65 #ifdef _OFA_AUTOCDLG_CXX
66 #include <vcl/group.hxx>
67 #ifndef _SV_BUTTON_HXX
68 #include <vcl/button.hxx>
70 #include <vcl/lstbox.hxx>
71 #include <svtools/svtabbx.hxx>
72 #include <svx/simptabl.hxx>
74 class SvStringsISortDtor
;
76 // class OfaACorrCheckListBox ------------------------------------------
78 class OfaACorrCheckListBox
: public SvxSimpleTable
80 using SvxSimpleTable::SetTabs
;
81 using SvTreeListBox::GetCheckButtonState
;
82 using SvTreeListBox::SetCheckButtonState
;
85 virtual void SetTabs();
86 virtual void HBarClick();
87 virtual void KeyInput( const KeyEvent
& rKEvt
);
90 OfaACorrCheckListBox(Window
* pParent
, const ResId
& rResId
) :
91 SvxSimpleTable( pParent
, rResId
){}
93 inline void *GetUserData(ULONG nPos
) { return GetEntry(nPos
)->GetUserData(); }
94 inline void SetUserData(ULONG nPos
, void *pData
) { GetEntry(nPos
)->SetUserData(pData
); }
95 inline ULONG
GetSelectEntryPos() { return GetModel()->GetAbsPos(FirstSelected()); }
97 BOOL
IsChecked(ULONG nPos
, USHORT nCol
= 0);
98 void CheckEntryPos(ULONG nPos
, USHORT nCol
, BOOL bChecked
);
99 SvButtonState
GetCheckButtonState( SvLBoxEntry
*, USHORT nCol
) const;
100 void SetCheckButtonState( SvLBoxEntry
*, USHORT nCol
, SvButtonState
);
103 // class OfaAutocorrOptionsPage ------------------------------------------
106 class OfaAutocorrOptionsPage
: public SfxTabPage
108 using TabPage::ActivatePage
;
111 SvxCheckListBox aCheckLB
;
116 String sBoldUnderline
;
123 String sAccidentalCaps
;
126 OfaAutocorrOptionsPage( Window
* pParent
, const SfxItemSet
& rSet
);
127 ~OfaAutocorrOptionsPage();
129 static SfxTabPage
* Create( Window
* pParent
,
130 const SfxItemSet
& rAttrSet
);
132 virtual BOOL
FillItemSet( SfxItemSet
& rSet
);
133 virtual void Reset( const SfxItemSet
& rSet
);
134 virtual void ActivatePage( const SfxItemSet
& );
138 // class OfaSwAutoFmtOptionsPage ----------------------------------------------------
140 class OfaSwAutoFmtOptionsPage
: public SfxTabPage
142 using TabPage::ActivatePage
;
144 OfaACorrCheckListBox aCheckLB
;
146 FixedText aHeader1Expl
;
147 FixedText aHeader2Expl
;
152 String sDeleteEmptyPara
;
153 String sUseReplaceTbl
;
159 String sByInputBullet
;
162 String sCorrectCapsLock
;
172 String sReplaceTemplates
;
173 String sDelSpaceAtSttEnd
;
174 String sDelSpaceBetweenLines
;
178 String sByInputBulletChar
;
181 Font aByInputBulletFont
;
184 SvLBoxButtonData
* pCheckButtonData
;
186 DECL_LINK(SelectHdl
, OfaACorrCheckListBox
*);
187 DECL_LINK(EditHdl
, PushButton
*);
188 SvLBoxEntry
* CreateEntry(String
& rTxt
, USHORT nCol
);
191 OfaSwAutoFmtOptionsPage( Window
* pParent
,
192 const SfxItemSet
& rSet
);
193 ~OfaSwAutoFmtOptionsPage();
196 static SfxTabPage
* Create( Window
* pParent
,
197 const SfxItemSet
& rAttrSet
);
198 virtual BOOL
FillItemSet( SfxItemSet
& rSet
);
199 virtual void Reset( const SfxItemSet
& rSet
);
200 virtual void ActivatePage( const SfxItemSet
& );
203 // class AutoCorrEdit ----------------------------------------------------
205 class AutoCorrEdit
: public Edit
211 AutoCorrEdit(Window
* pParent
, const ResId
& rResId
) :
212 Edit(pParent
, rResId
), bSpaces(FALSE
){}
214 void SetActionHdl( const Link
& rLink
)
215 { aActionLink
= rLink
;}
217 void SetSpaces(BOOL bSet
)
220 virtual void KeyInput( const KeyEvent
& rKEvent
);
223 // class OfaAutocorrReplacePage ------------------------------------------
225 class DoubleStringArray
;
226 typedef DoubleStringArray
* DoubleStringArrayPtr
;
227 DECLARE_TABLE(DoubleStringTable
, DoubleStringArrayPtr
)
229 class OfaAutocorrReplacePage
: public SfxTabPage
231 using TabPage::ActivatePage
;
232 using TabPage::DeactivatePage
;
235 CheckBox aTextOnlyCB
;
237 AutoCorrEdit aShortED
;
238 FixedText aReplaceFT
;
239 AutoCorrEdit aReplaceED
;
240 SvTabListBox aReplaceTLB
;
241 PushButton aNewReplacePB
;
242 PushButton aDeleteReplacePB
;
247 SvStringsISortDtor
* pFormatText
;
248 DoubleStringTable aDoubleStringTable
;
249 CollatorWrapper
* pCompareClass
;
250 CollatorWrapper
* pCompareCaseClass
;
251 CharClass
* pCharClass
;
254 BOOL bHasSelectionText
;
256 BOOL bReplaceEditChanged
:1;
259 DECL_LINK(SelectHdl
, SvTabListBox
*);
260 DECL_LINK(NewDelHdl
, PushButton
*);
261 DECL_LINK(ModifyHdl
, Edit
*);
263 void RefillReplaceBox(BOOL bFromReset
, //Box mit neuer Sprache fuellen
264 LanguageType eOldLanguage
,
265 LanguageType eNewLanguage
);
268 OfaAutocorrReplacePage( Window
* pParent
, const SfxItemSet
& rSet
);
269 ~OfaAutocorrReplacePage();
271 static SfxTabPage
* Create( Window
* pParent
,
272 const SfxItemSet
& rAttrSet
);
274 virtual BOOL
FillItemSet( SfxItemSet
& rSet
);
275 virtual void Reset( const SfxItemSet
& rSet
);
276 virtual void ActivatePage( const SfxItemSet
& );
277 virtual int DeactivatePage( SfxItemSet
* pSet
= 0 );
279 void SetLanguage(LanguageType eSet
);
282 // class OfaAutocorrExceptPage ---------------------------------------------
284 struct StringsArrays
;
285 typedef StringsArrays
* StringsArraysPtr
;
286 DECLARE_TABLE(StringsTable
, StringsArraysPtr
)
288 class OfaAutocorrExceptPage
: public SfxTabPage
290 using TabPage::ActivatePage
;
291 using TabPage::DeactivatePage
;
295 AutoCorrEdit aAbbrevED
;
297 PushButton aNewAbbrevPB
;
298 PushButton aDelAbbrevPB
;
299 CheckBox aAutoAbbrevCB
;
301 FixedLine aDoubleCapsFL
;
302 AutoCorrEdit aDoubleCapsED
;
303 ListBox aDoubleCapsLB
;
304 PushButton aNewDoublePB
;
305 PushButton aDelDoublePB
;
306 CheckBox aAutoCapsCB
;
308 StringsTable aStringsTable
;
309 CollatorWrapper
* pCompareClass
;
312 DECL_LINK(NewDelHdl
, PushButton
*);
313 DECL_LINK(SelectHdl
, ListBox
*);
314 DECL_LINK(ModifyHdl
, Edit
*);
316 void RefillReplaceBoxes(BOOL bFromReset
, //Box mit neuer Sprache fuellen
317 LanguageType eOldLanguage
,
318 LanguageType eNewLanguage
);
320 OfaAutocorrExceptPage( Window
* pParent
, const SfxItemSet
& rSet
);
321 ~OfaAutocorrExceptPage();
323 static SfxTabPage
* Create( Window
* pParent
,
324 const SfxItemSet
& rAttrSet
);
326 virtual BOOL
FillItemSet( SfxItemSet
& rSet
);
327 virtual void Reset( const SfxItemSet
& rSet
);
328 virtual void ActivatePage( const SfxItemSet
& );
329 virtual int DeactivatePage( SfxItemSet
* pSet
= 0 );
330 void SetLanguage(LanguageType eSet
);
334 // class OfaQuoteTabPage -------------------------------------------------
336 class OfaQuoteTabPage
: public SfxTabPage
338 using TabPage::ActivatePage
;
343 CheckBox aSingleTypoCB
;
344 FixedText aSglStartQuoteFT
;
345 PushButton aSglStartQuotePB
;
346 FixedText aSglStartExFT
;
347 FixedText aSglEndQuoteFT
;
348 PushButton aSglEndQuotePB
;
349 FixedText aSglEndExFT
;
350 PushButton aSglStandardPB
;
354 FixedText aStartQuoteFT
;
355 PushButton aStartQuotePB
;
356 FixedText aDblStartExFT
;
357 FixedText aEndQuoteFT
;
358 PushButton aEndQuotePB
;
359 FixedText aDblEndExFT
;
360 PushButton aDblStandardPB
;
362 String sStartQuoteDlg
;
368 sal_UCS4 cSglStartQuote
;
369 sal_UCS4 cSglEndQuote
;
371 sal_UCS4 cStartQuote
;
374 DECL_LINK( QuoteHdl
, PushButton
* );
375 DECL_LINK( StdQuoteHdl
, PushButton
* );
377 String
ChangeStringExt_Impl( sal_UCS4
);
379 OfaQuoteTabPage( Window
* pParent
, const SfxItemSet
& rSet
);
383 static SfxTabPage
* Create( Window
* pParent
,
384 const SfxItemSet
& rAttrSet
);
386 virtual BOOL
FillItemSet( SfxItemSet
& rSet
);
387 virtual void Reset( const SfxItemSet
& rSet
);
388 virtual void ActivatePage( const SfxItemSet
& );
391 // class OfaAutoCompleteTabPage ---------------------------------------------
393 class OfaAutoCompleteTabPage
: public SfxTabPage
395 using TabPage::ActivatePage
;
397 class AutoCompleteMultiListBox
: public MultiListBox
399 OfaAutoCompleteTabPage
& rPage
;
401 AutoCompleteMultiListBox( OfaAutoCompleteTabPage
& rPg
,
402 const ResId
& rResId
)
403 : MultiListBox( &rPg
, rResId
), rPage( rPg
) {}
405 virtual long PreNotify( NotifyEvent
& rNEvt
);
408 CheckBox aCBActiv
; //Enable word completion
409 CheckBox aCBAppendSpace
;//Append space
410 CheckBox aCBAsTip
; //Show as tip
412 CheckBox aCBCollect
;//Collect words
413 CheckBox aCBRemoveList
;//...save the list for later use...
414 //--removed--CheckBox aCBEndless;//
416 FixedText aFTExpandKey
;
417 ListBox aDCBExpandKey
;
418 FixedText aFTMinWordlen
;
419 NumericField aNFMinWordlen
;
420 FixedText aFTMaxEntries
;
421 NumericField aNFMaxEntries
;
422 AutoCompleteMultiListBox aLBEntries
;
423 PushButton aPBEntries
;
424 SvStringsISortDtor
* pAutoCmpltList
;
425 USHORT nAutoCmpltListCnt
;
427 DECL_LINK( CheckHdl
, CheckBox
* );
429 OfaAutoCompleteTabPage( Window
* pParent
,
430 const SfxItemSet
& rSet
);
432 virtual ~OfaAutoCompleteTabPage();
434 static SfxTabPage
* Create( Window
* pParent
,
435 const SfxItemSet
& rAttrSet
);
437 virtual BOOL
FillItemSet( SfxItemSet
& rSet
);
438 virtual void Reset( const SfxItemSet
& rSet
);
439 virtual void ActivatePage( const SfxItemSet
& );
441 void CopyToClipboard() const;
442 DECL_LINK( DeleteHdl
, PushButton
* );
445 // class OfaSmartTagOptionsTabPage ---------------------------------------------
447 /** Smart tag options tab page
449 This tab page is used to enable/disable smart tag types
451 class OfaSmartTagOptionsTabPage
: public SfxTabPage
453 using TabPage::ActivatePage
;
459 SvxCheckListBox m_aSmartTagTypesLB
;
460 PushButton m_aPropertiesPB
;
461 FixedText m_aTitleFT
;
463 // construction via Create()
464 OfaSmartTagOptionsTabPage( Window
* pParent
, const SfxItemSet
& rSet
);
466 /** Inserts items into m_aSmartTagTypesLB
468 Reads out the smart tag types supported by the SmartTagMgr and
469 inserts the associated strings into the list box.
471 void FillListBox( const SmartTagMgr
& rSmartTagMgr
);
473 /** Clears the m_aSmartTagTypesLB
477 /** Handler for the check box
479 Enables/disables all controls in the tab page (except from the
482 DECL_LINK( CheckHdl
, CheckBox
* );
484 /** Handler for the push button
486 Calls the displayPropertyPage function of the smart tag recognizer
487 associated with the currently selected smart tag type.
489 DECL_LINK( ClickHdl
, PushButton
* );
491 /** Handler for the list box
493 Enables/disables the properties push button if selection in the
494 smart tag types list box changes.
496 DECL_LINK( SelectHdl
, SvxCheckListBox
* );
500 virtual ~OfaSmartTagOptionsTabPage();
502 static SfxTabPage
* Create( Window
* pParent
, const SfxItemSet
& rAttrSet
);
504 virtual BOOL
FillItemSet( SfxItemSet
& rSet
);
505 virtual void Reset( const SfxItemSet
& rSet
);
506 virtual void ActivatePage( const SfxItemSet
& );
509 #endif // _OFA_AUTOCDLG_CXX