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 #ifndef _SVX_OPTDICT_HXX 23 #define _SVX_OPTDICT_HXX 24 25 // include --------------------------------------------------------------- 26 27 #include <vcl/dialog.hxx> 28 #include <vcl/fixed.hxx> 29 #include <vcl/lstbox.hxx> 30 #ifndef _SV_BUTTON_HXX //autogen 31 #include <vcl/button.hxx> 32 #endif 33 #include <vcl/group.hxx> 34 #include <vcl/combobox.hxx> 35 #include <vcl/timer.hxx> 36 #include <vcl/edit.hxx> 37 #include <vcl/decoview.hxx> 38 #include <com/sun/star/util/Language.hpp> 39 #include <com/sun/star/uno/Reference.hxx> 40 #include <com/sun/star/uno/Sequence.hxx> 41 42 #include <svx/simptabl.hxx> 43 #include <svx/langbox.hxx> 44 45 namespace com{namespace sun{namespace star{ 46 namespace linguistic2{ 47 class XDictionary; 48 class XSpellChecker1; 49 class XSpellChecker; 50 }}}} 51 52 // forward --------------------------------------------------------------- 53 54 55 // class SvxNewDictionaryDialog ------------------------------------------ 56 57 class SvxNewDictionaryDialog : public ModalDialog 58 { 59 private: 60 FixedLine aNewDictBox; 61 FixedText aNameText; 62 Edit aNameEdit; 63 FixedText aLanguageText; 64 SvxLanguageBox aLanguageLB; 65 CheckBox aExceptBtn; 66 OKButton aOKBtn; 67 CancelButton aCancelBtn; 68 HelpButton aHelpBtn; 69 ::com::sun::star::uno::Reference< 70 ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; 71 ::com::sun::star::uno::Reference< 72 ::com::sun::star::linguistic2::XDictionary > xNewDic; 73 74 #ifdef _SVX_OPTDICT_CXX 75 DECL_LINK( OKHdl_Impl, Button * ); 76 DECL_LINK( ModifyHdl_Impl, Edit * ); 77 #endif 78 79 public: 80 SvxNewDictionaryDialog( Window* pParent, 81 ::com::sun::star::uno::Reference< 82 ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl ); 83 84 ::com::sun::star::uno::Reference< 85 ::com::sun::star::linguistic2::XDictionary > GetNewDictionary()86 GetNewDictionary() { return xNewDic; } 87 }; 88 89 // class SvxDictEdit ---------------------------------------------------- 90 91 class SvxDictEdit : public Edit 92 { 93 Link aActionLink; 94 sal_Bool bSpaces; 95 96 public: SvxDictEdit(Window * pParent,const ResId & rResId)97 SvxDictEdit(Window* pParent, const ResId& rResId) : 98 Edit(pParent, rResId), bSpaces(sal_False){} 99 SetActionHdl(const Link & rLink)100 void SetActionHdl( const Link& rLink ) 101 { aActionLink = rLink;} 102 SetSpaces(sal_Bool bSet)103 void SetSpaces(sal_Bool bSet) 104 {bSpaces = bSet;} 105 106 virtual void KeyInput( const KeyEvent& rKEvent ); 107 }; 108 109 // class SvxEditDictionaryDialog ----------------------------------------- 110 111 class SvxEditDictionaryDialog : public ModalDialog 112 { 113 private: 114 115 FixedText aBookFT; 116 ListBox aAllDictsLB; 117 FixedText aLangFT; 118 SvxLanguageBox aLangLB; 119 120 FixedText aWordFT; 121 SvxDictEdit aWordED; 122 FixedText aReplaceFT; 123 SvxDictEdit aReplaceED; 124 SvTabListBox aWordsLB; 125 PushButton aNewReplacePB; 126 PushButton aDeletePB; 127 GroupBox aEditDictsBox; 128 129 HelpButton aHelpBtn; 130 CancelButton aCloseBtn; 131 String sModify; 132 String sNew; 133 DecorationView aDecoView; 134 135 ::com::sun::star::uno::Sequence< 136 ::com::sun::star::uno::Reference< 137 ::com::sun::star::linguistic2::XDictionary > > aDics; //! snapshot copy to work on 138 ::com::sun::star::uno::Reference< 139 ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; 140 141 short nOld; 142 long nWidth; 143 sal_Bool bFirstSelect; 144 sal_Bool bDoNothing; 145 sal_Bool bDicIsReadonly; 146 147 #ifdef _SVX_OPTDICT_CXX 148 DECL_LINK( SelectBookHdl_Impl, ListBox * ); 149 DECL_LINK( SelectLangHdl_Impl, ListBox * ); 150 DECL_LINK(SelectHdl, SvTabListBox*); 151 DECL_LINK(NewDelHdl, PushButton*); 152 DECL_LINK(ModifyHdl, Edit*); 153 154 155 void ShowWords_Impl( sal_uInt16 nId ); 156 void SetLanguage_Impl( ::com::sun::star::util::Language nLanguage ); IsDicReadonly_Impl() const157 sal_Bool IsDicReadonly_Impl() const { return bDicIsReadonly; } 158 void SetDicReadonly_Impl( ::com::sun::star::uno::Reference< 159 ::com::sun::star::linguistic2::XDictionary > &xDic ); 160 161 void RemoveDictEntry(SvLBoxEntry* pEntry); 162 sal_uInt16 GetLBInsertPos(const String &rDicWord); 163 164 #endif 165 166 protected: 167 168 virtual void Paint( const Rectangle& rRect ); 169 170 public: 171 SvxEditDictionaryDialog( Window* pParent, 172 const String& rName, 173 ::com::sun::star::uno::Reference< 174 ::com::sun::star::linguistic2::XSpellChecker1> &xSpl ); 175 ~SvxEditDictionaryDialog(); 176 GetSelectedDict()177 sal_uInt16 GetSelectedDict() {return aAllDictsLB.GetSelectEntryPos();} 178 }; 179 180 #endif 181 182 /* vim: set noet sw=4 ts=4: */ 183