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