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