xref: /aoo42x/main/cui/source/inc/autocdlg.hxx (revision a9075099)
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 
EnableLanguage(sal_Bool bEnable)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:
OfaACorrCheckListBox(Window * pParent,const ResId & rResId)83 		OfaACorrCheckListBox(Window* pParent, const ResId& rResId ) :
84 			SvxSimpleTable( pParent, rResId ){}
85 
GetUserData(sal_uLong nPos)86 		inline void *GetUserData(sal_uLong nPos) { return GetEntry(nPos)->GetUserData(); }
SetUserData(sal_uLong nPos,void * pData)87 		inline void SetUserData(sal_uLong nPos, void *pData ) { GetEntry(nPos)->SetUserData(pData); }
GetSelectEntryPos()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:
AutoCorrEdit(Window * pParent,const ResId & rResId)199 					AutoCorrEdit(Window* pParent, const ResId& rResId) :
200 						Edit(pParent, rResId), bSpaces(sal_False){}
201 
SetActionHdl(const Link & rLink)202 	void 			SetActionHdl( const Link& rLink )
203 								{ aActionLink = rLink;}
204 
SetSpaces(sal_Bool bSet)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         CharClass*              pCharClass;
239 		LanguageType 			eLang;
240 
241 		sal_Bool			bHasSelectionText;
242 		sal_Bool			bFirstSelect:1;
243 		sal_Bool			bReplaceEditChanged:1;
244 		sal_Bool			bSWriter:1;
245 
246 		DECL_LINK(SelectHdl, SvTabListBox*);
247 		DECL_LINK(NewDelHdl, PushButton*);
248 		DECL_LINK(ModifyHdl, Edit*);
249 
250 		void 			RefillReplaceBox(sal_Bool bFromReset, //Box mit neuer Sprache fuellen
251 										LanguageType eOldLanguage,
252 										LanguageType eNewLanguage);
253 
254 public:
255 						OfaAutocorrReplacePage( Window* pParent, const SfxItemSet& rSet );
256 						~OfaAutocorrReplacePage();
257 
258 	static SfxTabPage*	Create( Window* pParent,
259 								const SfxItemSet& rAttrSet);
260 
261 	virtual	sal_Bool 		FillItemSet( SfxItemSet& rSet );
262 	virtual	void 		Reset( const SfxItemSet& rSet );
263 	virtual void		ActivatePage( const SfxItemSet& );
264 	virtual int			DeactivatePage( SfxItemSet* pSet = 0 );
265 
266 	void				SetLanguage(LanguageType eSet);
267 };
268 
269 // class OfaAutocorrExceptPage ---------------------------------------------
270 
271 struct StringsArrays;
272 typedef StringsArrays* StringsArraysPtr;
273 DECLARE_TABLE(StringsTable, StringsArraysPtr)
274 
275 class OfaAutocorrExceptPage : public SfxTabPage
276 {
277 	using TabPage::ActivatePage;
278 	using TabPage::DeactivatePage;
279 
280 private:
281 		FixedLine		aAbbrevFL;
282 		AutoCorrEdit	aAbbrevED;
283 		ListBox			aAbbrevLB;
284 		PushButton		aNewAbbrevPB;
285 		PushButton		aDelAbbrevPB;
286 		CheckBox        aAutoAbbrevCB;
287 
288 		FixedLine		aDoubleCapsFL;
289 		AutoCorrEdit	aDoubleCapsED;
290 		ListBox			aDoubleCapsLB;
291 		PushButton		aNewDoublePB;
292 		PushButton		aDelDoublePB;
293 		CheckBox        aAutoCapsCB;
294 
295 		StringsTable	aStringsTable;
296 		CollatorWrapper* pCompareClass;
297 		LanguageType 	eLang;
298 
299 	DECL_LINK(NewDelHdl, PushButton*);
300 	DECL_LINK(SelectHdl, ListBox*);
301 	DECL_LINK(ModifyHdl, Edit*);
302 
303 	void 			RefillReplaceBoxes(sal_Bool bFromReset, //Box mit neuer Sprache fuellen
304 										LanguageType eOldLanguage,
305 										LanguageType eNewLanguage);
306 public:
307 						OfaAutocorrExceptPage( Window* pParent, const SfxItemSet& rSet );
308 						~OfaAutocorrExceptPage();
309 
310 	static SfxTabPage*	Create( Window* pParent,
311 								const SfxItemSet& rAttrSet);
312 
313 	virtual	sal_Bool 		FillItemSet( SfxItemSet& rSet );
314 	virtual	void 		Reset( const SfxItemSet& rSet );
315 	virtual void		ActivatePage( const SfxItemSet& );
316 	virtual int			DeactivatePage( SfxItemSet* pSet = 0 );
317 	void				SetLanguage(LanguageType eSet);
318 
319 };
320 
321 // class OfaQuoteTabPage -------------------------------------------------
322 
323 class OfaQuoteTabPage : public SfxTabPage
324 {
325 	using TabPage::ActivatePage;
326 
327 private:
328     // For anything but writer
329 	SvxCheckListBox	aCheckLB;
330 
331     // Just for writer
332 	OfaACorrCheckListBox	aSwCheckLB;
333     String			sHeader1;
334 	String			sHeader2;
335 
336     String          sNonBrkSpace;
337     String          sOrdinal;
338 
339     SvLBoxButtonData*	pCheckButtonData;
340 
341 	FixedLine	aSingleFL;
342 	CheckBox    aSingleTypoCB;
343 	FixedText	aSglStartQuoteFT;
344 	PushButton  aSglStartQuotePB;
345 	FixedText	aSglStartExFT;
346 	FixedText	aSglEndQuoteFT;
347 	PushButton	aSglEndQuotePB;
348 	FixedText	aSglEndExFT;
349 	PushButton	aSglStandardPB;
350 
351 	FixedLine	aDoubleFL;
352 	CheckBox    aTypoCB;
353 	FixedText	aStartQuoteFT;
354 	PushButton  aStartQuotePB;
355 	FixedText	aDblStartExFT;
356 	FixedText	aEndQuoteFT;
357 	PushButton	aEndQuotePB;
358 	FixedText	aDblEndExFT;
359 	PushButton	aDblStandardPB;
360 
361 	String		sStartQuoteDlg;
362 	String		sEndQuoteDlg;
363 
364 	String 		sStandard;
365 
366 
367 	sal_UCS4	cSglStartQuote;
368 	sal_UCS4	cSglEndQuote;
369 
370 	sal_UCS4	cStartQuote;
371 	sal_UCS4	cEndQuote;
372 
373 	DECL_LINK( QuoteHdl, PushButton* );
374 	DECL_LINK( StdQuoteHdl, PushButton* );
375 
376 	String 				ChangeStringExt_Impl( sal_UCS4 );
377 
378     SvLBoxEntry* CreateEntry(String& rTxt, sal_uInt16 nCol);
379 
380 						OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet );
381 public:
382 						~OfaQuoteTabPage();
383 
384 	static SfxTabPage*	Create( Window* pParent,
385 								const SfxItemSet& rAttrSet);
386 
387 	virtual	sal_Bool 		FillItemSet( SfxItemSet& rSet );
388 	virtual	void 		Reset( const SfxItemSet& rSet );
389 	virtual void		ActivatePage( const SfxItemSet& );
390 };
391 
392 // class OfaAutoCompleteTabPage ---------------------------------------------
393 
394 class OfaAutoCompleteTabPage : public SfxTabPage
395 {
396 	using TabPage::ActivatePage;
397 
398 	class AutoCompleteMultiListBox : public MultiListBox
399 	{
400 		OfaAutoCompleteTabPage& rPage;
401 	public:
AutoCompleteMultiListBox(OfaAutoCompleteTabPage & rPg,const ResId & rResId)402 		AutoCompleteMultiListBox( OfaAutoCompleteTabPage& rPg,
403 									const ResId& rResId )
404 			: MultiListBox( &rPg, rResId ), rPage( rPg ) {}
405 
406 		virtual long PreNotify( NotifyEvent& rNEvt );
407 	};
408 
409     CheckBox        aCBActiv; //Enable word completion
410     CheckBox        aCBAppendSpace;//Append space
411     CheckBox        aCBAsTip; //Show as tip
412 
413     CheckBox        aCBCollect;//Collect words
414     CheckBox        aCBRemoveList;//...save the list for later use...
415     //--removed--CheckBox        aCBEndless;//
416 
417     FixedText       aFTExpandKey;
418 	ListBox 		aDCBExpandKey;
419     FixedText       aFTMinWordlen;
420     NumericField    aNFMinWordlen;
421     FixedText       aFTMaxEntries;
422     NumericField    aNFMaxEntries;
423     AutoCompleteMultiListBox    aLBEntries;
424 	PushButton					aPBEntries;
425 	SvStringsISortDtor* 		pAutoCmpltList;
426 	sal_uInt16 						nAutoCmpltListCnt;
427 
428 	DECL_LINK( CheckHdl, CheckBox* );
429 
430 						OfaAutoCompleteTabPage( Window* pParent,
431 												const SfxItemSet& rSet );
432 public:
433 						virtual ~OfaAutoCompleteTabPage();
434 
435 	static SfxTabPage*	Create( Window* pParent,
436 								const SfxItemSet& rAttrSet);
437 
438 	virtual	sal_Bool 		FillItemSet( SfxItemSet& rSet );
439 	virtual	void 		Reset( const SfxItemSet& rSet );
440 	virtual void		ActivatePage( const SfxItemSet& );
441 
442 	void CopyToClipboard() const;
443 	DECL_LINK( DeleteHdl, PushButton* );
444 };
445 
446 // class OfaSmartTagOptionsTabPage ---------------------------------------------
447 
448 /** Smart tag options tab page
449 
450     This tab page is used to enable/disable smart tag types
451 */
452 class OfaSmartTagOptionsTabPage : public SfxTabPage
453 {
454 	using TabPage::ActivatePage;
455 
456 private:
457 
458 	// controls
459     CheckBox				m_aMainCB;
460 	SvxCheckListBox			m_aSmartTagTypesLB;
461 	PushButton				m_aPropertiesPB;
462 	FixedText				m_aTitleFT;
463 
464     // construction via Create()
465     OfaSmartTagOptionsTabPage( Window* pParent,	const SfxItemSet& rSet );
466 
467     /** Inserts items into m_aSmartTagTypesLB
468 
469         Reads out the smart tag types supported by the SmartTagMgr and
470         inserts the associated strings into the list box.
471     */
472     void FillListBox( const SmartTagMgr& rSmartTagMgr );
473 
474     /** Clears the m_aSmartTagTypesLB
475     */
476     void ClearListBox();
477 
478     /** Handler for the check box
479 
480         Enables/disables all controls in the tab page (except from the
481         check box.
482     */
483 	DECL_LINK( CheckHdl, CheckBox* );
484 
485     /** Handler for the push button
486 
487         Calls the displayPropertyPage function of the smart tag recognizer
488         associated with the currently selected smart tag type.
489     */
490 	DECL_LINK( ClickHdl, PushButton* );
491 
492     /** Handler for the list box
493 
494         Enables/disables the properties push button if selection in the
495         smart tag types list box changes.
496     */
497     DECL_LINK( SelectHdl, SvxCheckListBox* );
498 
499 public:
500 
501 	virtual ~OfaSmartTagOptionsTabPage();
502 
503 	static SfxTabPage*	Create( Window* pParent, const SfxItemSet& rAttrSet);
504 
505 	virtual	sal_Bool 		FillItemSet( SfxItemSet& rSet );
506 	virtual	void 		Reset( const SfxItemSet& rSet );
507 	virtual void		ActivatePage( const SfxItemSet& );
508 };
509 
510 #endif // _OFA_AUTOCDLG_CXX
511 
512 #endif //
513 
514