xref: /trunk/main/cui/source/inc/autocdlg.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _OFA_AUTOCDLG_HXX
28 #define _OFA_AUTOCDLG_HXX
29 
30 #include <svtools/langtab.hxx>
31 #include <sfx2/tabdlg.hxx>
32 #include <tools/table.hxx>
33 #include <svx/checklbx.hxx>
34 #include <vcl/fixed.hxx>
35 #include <vcl/field.hxx>
36 #include <vcl/metric.hxx>
37 #include <svx/langbox.hxx>
38 
39 class SvxAutoCorrect;
40 class CharClass;
41 class CollatorWrapper;
42 class SmartTagMgr;
43 
44 // class OfaAutoCorrDlg --------------------------------------------------
45 
46 class OfaAutoCorrDlg : public SfxTabDialog
47 {
48     FixedText       aLanguageFT;
49     SvxLanguageBox  aLanguageLB;
50 
51     DECL_LINK(SelectLanguageHdl, ListBox*);
52 public:
53 
54     OfaAutoCorrDlg(Window* pParent, const SfxItemSet *pSet );
55 
56     void    EnableLanguage(sal_Bool bEnable)
57             {   aLanguageFT.Enable(bEnable);
58                 aLanguageLB.Enable(bEnable);}
59 
60 };
61 
62 #ifdef _OFA_AUTOCDLG_CXX
63 #include <vcl/group.hxx>
64 #ifndef _SV_BUTTON_HXX
65 #include <vcl/button.hxx>
66 #endif
67 #include <vcl/lstbox.hxx>
68 #include <svtools/svtabbx.hxx>
69 #include <svx/simptabl.hxx>
70 
71 class SvStringsISortDtor;
72 
73 // class OfaACorrCheckListBox ------------------------------------------
74 
75 class OfaACorrCheckListBox : public SvxSimpleTable
76 {
77     using SvxSimpleTable::SetTabs;
78     using SvTreeListBox::GetCheckButtonState;
79     using SvTreeListBox::SetCheckButtonState;
80 
81     protected:
82         virtual void    SetTabs();
83         virtual void    HBarClick();
84         virtual void    KeyInput( const KeyEvent& rKEvt );
85 
86     public:
87         OfaACorrCheckListBox(Window* pParent, const ResId& rResId ) :
88             SvxSimpleTable( pParent, rResId ){}
89 
90         inline void *GetUserData(sal_uLong nPos) { return GetEntry(nPos)->GetUserData(); }
91         inline void SetUserData(sal_uLong nPos, void *pData ) { GetEntry(nPos)->SetUserData(pData); }
92         inline sal_uLong GetSelectEntryPos() { return GetModel()->GetAbsPos(FirstSelected()); }
93 
94         sal_Bool            IsChecked(sal_uLong nPos, sal_uInt16 nCol = 0);
95         void            CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, sal_Bool bChecked);
96         SvButtonState   GetCheckButtonState( SvLBoxEntry*, sal_uInt16 nCol ) const;
97         void            SetCheckButtonState( SvLBoxEntry*, sal_uInt16 nCol, SvButtonState );
98 };
99 
100 // class OfaAutocorrOptionsPage ------------------------------------------
101 
102 
103 class OfaAutocorrOptionsPage : public SfxTabPage
104 {
105     using TabPage::ActivatePage;
106 
107 private:
108     SvxCheckListBox aCheckLB;
109 
110     String      sInput;
111     String      sDoubleCaps;
112     String      sStartCap;
113     String      sBoldUnderline;
114     String      sURL;
115     String      sNoDblSpaces;
116     String      sDash;
117     String      sNonBrkSpace;
118     String      sFirst;
119 
120 public:
121                         OfaAutocorrOptionsPage( Window* pParent, const SfxItemSet& rSet );
122                         ~OfaAutocorrOptionsPage();
123 
124     static SfxTabPage*  Create( Window* pParent,
125                                 const SfxItemSet& rAttrSet);
126 
127     virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
128     virtual void        Reset( const SfxItemSet& rSet );
129     virtual void        ActivatePage( const SfxItemSet& );
130 
131 };
132 
133 // class OfaSwAutoFmtOptionsPage ----------------------------------------------------
134 
135 class OfaSwAutoFmtOptionsPage : public SfxTabPage
136 {
137     using TabPage::ActivatePage;
138 
139     OfaACorrCheckListBox    aCheckLB;
140     PushButton      aEditPB;
141     FixedText       aHeader1Expl;
142     FixedText       aHeader2Expl;
143 
144     String          sHeader1;
145     String          sHeader2;
146 
147     String          sDeleteEmptyPara;
148     String          sUseReplaceTbl;
149     String          sCptlSttWord;
150     String          sCptlSttSent;
151     String          sUserStyle;
152     String          sBullet;
153     String          sByInputBullet;
154     String          sBoldUnder;
155     String          sNoDblSpaces;
156     String          sDetectURL;
157     String          sDash;
158     String          sNonBrkSpace;
159     String          sOrdinal;
160     String          sRightMargin;
161     String          sNum;
162     String          sBorder;
163     String          sTable;
164     String          sReplaceTemplates;
165     String          sDelSpaceAtSttEnd;
166     String          sDelSpaceBetweenLines;
167 
168     String          sMargin;
169     String          sBulletChar;
170     String          sByInputBulletChar;
171 
172     Font            aBulletFont;
173     Font            aByInputBulletFont;
174     sal_uInt16          nPercent;
175 
176     SvLBoxButtonData*   pCheckButtonData;
177 
178         DECL_LINK(SelectHdl, OfaACorrCheckListBox*);
179         DECL_LINK(EditHdl, PushButton*);
180         SvLBoxEntry* CreateEntry(String& rTxt, sal_uInt16 nCol);
181 
182 
183         OfaSwAutoFmtOptionsPage( Window* pParent,
184                             const SfxItemSet& rSet );
185         ~OfaSwAutoFmtOptionsPage();
186 
187     public:
188         static SfxTabPage*  Create( Window* pParent,
189                                 const SfxItemSet& rAttrSet);
190         virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
191         virtual void        Reset( const SfxItemSet& rSet );
192         virtual void        ActivatePage( const SfxItemSet& );
193 };
194 
195 // class AutoCorrEdit ----------------------------------------------------
196 
197 class AutoCorrEdit : public Edit
198 {
199     Link    aActionLink;
200     sal_Bool    bSpaces;
201 
202     public:
203                     AutoCorrEdit(Window* pParent, const ResId& rResId) :
204                         Edit(pParent, rResId), bSpaces(sal_False){}
205 
206     void            SetActionHdl( const Link& rLink )
207                                 { aActionLink = rLink;}
208 
209     void            SetSpaces(sal_Bool bSet)
210                                 {bSpaces = bSet;}
211 
212     virtual void    KeyInput( const KeyEvent& rKEvent );
213 };
214 
215 // class OfaAutocorrReplacePage ------------------------------------------
216 
217 class DoubleStringArray;
218 typedef DoubleStringArray* DoubleStringArrayPtr;
219 DECLARE_TABLE(DoubleStringTable, DoubleStringArrayPtr)
220 
221 class OfaAutocorrReplacePage : public SfxTabPage
222 {
223         using TabPage::ActivatePage;
224         using TabPage::DeactivatePage;
225 
226 private:
227         CheckBox        aTextOnlyCB;
228         FixedText       aShortFT;
229         AutoCorrEdit    aShortED;
230         FixedText       aReplaceFT;
231         AutoCorrEdit    aReplaceED;
232         SvTabListBox    aReplaceTLB;
233         PushButton      aNewReplacePB;
234         PushButton      aDeleteReplacePB;
235 
236         String          sModify;
237         String          sNew;
238 
239         SvStringsISortDtor*     pFormatText;
240         DoubleStringTable       aDoubleStringTable;
241         CollatorWrapper*        pCompareClass;
242         CollatorWrapper*        pCompareCaseClass;
243         CharClass*              pCharClass;
244         LanguageType            eLang;
245 
246         sal_Bool            bHasSelectionText;
247         sal_Bool            bFirstSelect:1;
248         sal_Bool            bReplaceEditChanged:1;
249         sal_Bool            bSWriter:1;
250 
251         DECL_LINK(SelectHdl, SvTabListBox*);
252         DECL_LINK(NewDelHdl, PushButton*);
253         DECL_LINK(ModifyHdl, Edit*);
254 
255         void            RefillReplaceBox(sal_Bool bFromReset, //Box mit neuer Sprache fuellen
256                                         LanguageType eOldLanguage,
257                                         LanguageType eNewLanguage);
258 
259 public:
260                         OfaAutocorrReplacePage( Window* pParent, const SfxItemSet& rSet );
261                         ~OfaAutocorrReplacePage();
262 
263     static SfxTabPage*  Create( Window* pParent,
264                                 const SfxItemSet& rAttrSet);
265 
266     virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
267     virtual void        Reset( const SfxItemSet& rSet );
268     virtual void        ActivatePage( const SfxItemSet& );
269     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
270 
271     void                SetLanguage(LanguageType eSet);
272 };
273 
274 // class OfaAutocorrExceptPage ---------------------------------------------
275 
276 struct StringsArrays;
277 typedef StringsArrays* StringsArraysPtr;
278 DECLARE_TABLE(StringsTable, StringsArraysPtr)
279 
280 class OfaAutocorrExceptPage : public SfxTabPage
281 {
282     using TabPage::ActivatePage;
283     using TabPage::DeactivatePage;
284 
285 private:
286         FixedLine       aAbbrevFL;
287         AutoCorrEdit    aAbbrevED;
288         ListBox         aAbbrevLB;
289         PushButton      aNewAbbrevPB;
290         PushButton      aDelAbbrevPB;
291         CheckBox        aAutoAbbrevCB;
292 
293         FixedLine       aDoubleCapsFL;
294         AutoCorrEdit    aDoubleCapsED;
295         ListBox         aDoubleCapsLB;
296         PushButton      aNewDoublePB;
297         PushButton      aDelDoublePB;
298         CheckBox        aAutoCapsCB;
299 
300         StringsTable    aStringsTable;
301         CollatorWrapper* pCompareClass;
302         LanguageType    eLang;
303 
304     DECL_LINK(NewDelHdl, PushButton*);
305     DECL_LINK(SelectHdl, ListBox*);
306     DECL_LINK(ModifyHdl, Edit*);
307 
308     void            RefillReplaceBoxes(sal_Bool bFromReset, //Box mit neuer Sprache fuellen
309                                         LanguageType eOldLanguage,
310                                         LanguageType eNewLanguage);
311 public:
312                         OfaAutocorrExceptPage( Window* pParent, const SfxItemSet& rSet );
313                         ~OfaAutocorrExceptPage();
314 
315     static SfxTabPage*  Create( Window* pParent,
316                                 const SfxItemSet& rAttrSet);
317 
318     virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
319     virtual void        Reset( const SfxItemSet& rSet );
320     virtual void        ActivatePage( const SfxItemSet& );
321     virtual int         DeactivatePage( SfxItemSet* pSet = 0 );
322     void                SetLanguage(LanguageType eSet);
323 
324 };
325 
326 // class OfaQuoteTabPage -------------------------------------------------
327 
328 class OfaQuoteTabPage : public SfxTabPage
329 {
330     using TabPage::ActivatePage;
331 
332 private:
333     // For anything but writer
334     SvxCheckListBox aCheckLB;
335 
336     // Just for writer
337     OfaACorrCheckListBox    aSwCheckLB;
338     String          sHeader1;
339     String          sHeader2;
340 
341     String          sNonBrkSpace;
342     String          sOrdinal;
343 
344     SvLBoxButtonData*   pCheckButtonData;
345 
346     FixedLine   aSingleFL;
347     CheckBox    aSingleTypoCB;
348     FixedText   aSglStartQuoteFT;
349     PushButton  aSglStartQuotePB;
350     FixedText   aSglStartExFT;
351     FixedText   aSglEndQuoteFT;
352     PushButton  aSglEndQuotePB;
353     FixedText   aSglEndExFT;
354     PushButton  aSglStandardPB;
355 
356     FixedLine   aDoubleFL;
357     CheckBox    aTypoCB;
358     FixedText   aStartQuoteFT;
359     PushButton  aStartQuotePB;
360     FixedText   aDblStartExFT;
361     FixedText   aEndQuoteFT;
362     PushButton  aEndQuotePB;
363     FixedText   aDblEndExFT;
364     PushButton  aDblStandardPB;
365 
366     String      sStartQuoteDlg;
367     String      sEndQuoteDlg;
368 
369     String      sStandard;
370 
371 
372     sal_UCS4    cSglStartQuote;
373     sal_UCS4    cSglEndQuote;
374 
375     sal_UCS4    cStartQuote;
376     sal_UCS4    cEndQuote;
377 
378     DECL_LINK( QuoteHdl, PushButton* );
379     DECL_LINK( StdQuoteHdl, PushButton* );
380 
381     String              ChangeStringExt_Impl( sal_UCS4 );
382 
383     SvLBoxEntry* CreateEntry(String& rTxt, sal_uInt16 nCol);
384 
385                         OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet );
386 public:
387                         ~OfaQuoteTabPage();
388 
389     static SfxTabPage*  Create( Window* pParent,
390                                 const SfxItemSet& rAttrSet);
391 
392     virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
393     virtual void        Reset( const SfxItemSet& rSet );
394     virtual void        ActivatePage( const SfxItemSet& );
395 };
396 
397 // class OfaAutoCompleteTabPage ---------------------------------------------
398 
399 class OfaAutoCompleteTabPage : public SfxTabPage
400 {
401     using TabPage::ActivatePage;
402 
403     class AutoCompleteMultiListBox : public MultiListBox
404     {
405         OfaAutoCompleteTabPage& rPage;
406     public:
407         AutoCompleteMultiListBox( OfaAutoCompleteTabPage& rPg,
408                                     const ResId& rResId )
409             : MultiListBox( &rPg, rResId ), rPage( rPg ) {}
410 
411         virtual long PreNotify( NotifyEvent& rNEvt );
412     };
413 
414     CheckBox        aCBActiv; //Enable word completion
415     CheckBox        aCBAppendSpace;//Append space
416     CheckBox        aCBAsTip; //Show as tip
417 
418     CheckBox        aCBCollect;//Collect words
419     CheckBox        aCBRemoveList;//...save the list for later use...
420     //--removed--CheckBox        aCBEndless;//
421 
422     FixedText       aFTExpandKey;
423     ListBox         aDCBExpandKey;
424     FixedText       aFTMinWordlen;
425     NumericField    aNFMinWordlen;
426     FixedText       aFTMaxEntries;
427     NumericField    aNFMaxEntries;
428     AutoCompleteMultiListBox    aLBEntries;
429     PushButton                  aPBEntries;
430     SvStringsISortDtor*         pAutoCmpltList;
431     sal_uInt16                      nAutoCmpltListCnt;
432 
433     DECL_LINK( CheckHdl, CheckBox* );
434 
435                         OfaAutoCompleteTabPage( Window* pParent,
436                                                 const SfxItemSet& rSet );
437 public:
438                         virtual ~OfaAutoCompleteTabPage();
439 
440     static SfxTabPage*  Create( Window* pParent,
441                                 const SfxItemSet& rAttrSet);
442 
443     virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
444     virtual void        Reset( const SfxItemSet& rSet );
445     virtual void        ActivatePage( const SfxItemSet& );
446 
447     void CopyToClipboard() const;
448     DECL_LINK( DeleteHdl, PushButton* );
449 };
450 
451 // class OfaSmartTagOptionsTabPage ---------------------------------------------
452 
453 /** Smart tag options tab page
454 
455     This tab page is used to enable/disable smart tag types
456 */
457 class OfaSmartTagOptionsTabPage : public SfxTabPage
458 {
459     using TabPage::ActivatePage;
460 
461 private:
462 
463     // controls
464     CheckBox                m_aMainCB;
465     SvxCheckListBox         m_aSmartTagTypesLB;
466     PushButton              m_aPropertiesPB;
467     FixedText               m_aTitleFT;
468 
469     // construction via Create()
470     OfaSmartTagOptionsTabPage( Window* pParent, const SfxItemSet& rSet );
471 
472     /** Inserts items into m_aSmartTagTypesLB
473 
474         Reads out the smart tag types supported by the SmartTagMgr and
475         inserts the associated strings into the list box.
476     */
477     void FillListBox( const SmartTagMgr& rSmartTagMgr );
478 
479     /** Clears the m_aSmartTagTypesLB
480     */
481     void ClearListBox();
482 
483     /** Handler for the check box
484 
485         Enables/disables all controls in the tab page (except from the
486         check box.
487     */
488     DECL_LINK( CheckHdl, CheckBox* );
489 
490     /** Handler for the push button
491 
492         Calls the displayPropertyPage function of the smart tag recognizer
493         associated with the currently selected smart tag type.
494     */
495     DECL_LINK( ClickHdl, PushButton* );
496 
497     /** Handler for the list box
498 
499         Enables/disables the properties push button if selection in the
500         smart tag types list box changes.
501     */
502     DECL_LINK( SelectHdl, SvxCheckListBox* );
503 
504 public:
505 
506     virtual ~OfaSmartTagOptionsTabPage();
507 
508     static SfxTabPage*  Create( Window* pParent, const SfxItemSet& rAttrSet);
509 
510     virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
511     virtual void        Reset( const SfxItemSet& rSet );
512     virtual void        ActivatePage( const SfxItemSet& );
513 };
514 
515 #endif // _OFA_AUTOCDLG_CXX
516 
517 #endif //
518 
519