1*c4eee24dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*c4eee24dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*c4eee24dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*c4eee24dSAndrew Rist * distributed with this work for additional information 6*c4eee24dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*c4eee24dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*c4eee24dSAndrew Rist * "License"); you may not use this file except in compliance 9*c4eee24dSAndrew Rist * with the License. You may obtain a copy of the License at 10*c4eee24dSAndrew Rist * 11*c4eee24dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*c4eee24dSAndrew Rist * 13*c4eee24dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*c4eee24dSAndrew Rist * software distributed under the License is distributed on an 15*c4eee24dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*c4eee24dSAndrew Rist * KIND, either express or implied. See the License for the 17*c4eee24dSAndrew Rist * specific language governing permissions and limitations 18*c4eee24dSAndrew Rist * under the License. 19*c4eee24dSAndrew Rist * 20*c4eee24dSAndrew Rist *************************************************************/ 21*c4eee24dSAndrew Rist 22*c4eee24dSAndrew Rist 23cdf0e10cSrcweir #ifndef _SVX_OPTDICT_HXX 24cdf0e10cSrcweir #define _SVX_OPTDICT_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir // include --------------------------------------------------------------- 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <vcl/dialog.hxx> 29cdf0e10cSrcweir #include <vcl/fixed.hxx> 30cdf0e10cSrcweir #include <vcl/lstbox.hxx> 31cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX //autogen 32cdf0e10cSrcweir #include <vcl/button.hxx> 33cdf0e10cSrcweir #endif 34cdf0e10cSrcweir #include <vcl/group.hxx> 35cdf0e10cSrcweir #include <vcl/combobox.hxx> 36cdf0e10cSrcweir #include <vcl/timer.hxx> 37cdf0e10cSrcweir #include <vcl/edit.hxx> 38cdf0e10cSrcweir #include <vcl/decoview.hxx> 39cdf0e10cSrcweir #include <com/sun/star/util/Language.hpp> 40cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx> 41cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir 44cdf0e10cSrcweir #include <svx/simptabl.hxx> 45cdf0e10cSrcweir #include <svx/langbox.hxx> 46cdf0e10cSrcweir 47cdf0e10cSrcweir namespace com{namespace sun{namespace star{ 48cdf0e10cSrcweir namespace linguistic2{ 49cdf0e10cSrcweir class XDictionary; 50cdf0e10cSrcweir class XSpellChecker1; 51cdf0e10cSrcweir class XSpellChecker; 52cdf0e10cSrcweir }}}} 53cdf0e10cSrcweir 54cdf0e10cSrcweir // forward --------------------------------------------------------------- 55cdf0e10cSrcweir 56cdf0e10cSrcweir 57cdf0e10cSrcweir // class SvxNewDictionaryDialog ------------------------------------------ 58cdf0e10cSrcweir 59cdf0e10cSrcweir class SvxNewDictionaryDialog : public ModalDialog 60cdf0e10cSrcweir { 61cdf0e10cSrcweir private: 62cdf0e10cSrcweir FixedLine aNewDictBox; 63cdf0e10cSrcweir FixedText aNameText; 64cdf0e10cSrcweir Edit aNameEdit; 65cdf0e10cSrcweir FixedText aLanguageText; 66cdf0e10cSrcweir SvxLanguageBox aLanguageLB; 67cdf0e10cSrcweir CheckBox aExceptBtn; 68cdf0e10cSrcweir OKButton aOKBtn; 69cdf0e10cSrcweir CancelButton aCancelBtn; 70cdf0e10cSrcweir HelpButton aHelpBtn; 71cdf0e10cSrcweir ::com::sun::star::uno::Reference< 72cdf0e10cSrcweir ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; 73cdf0e10cSrcweir ::com::sun::star::uno::Reference< 74cdf0e10cSrcweir ::com::sun::star::linguistic2::XDictionary > xNewDic; 75cdf0e10cSrcweir 76cdf0e10cSrcweir #ifdef _SVX_OPTDICT_CXX 77cdf0e10cSrcweir DECL_LINK( OKHdl_Impl, Button * ); 78cdf0e10cSrcweir DECL_LINK( ModifyHdl_Impl, Edit * ); 79cdf0e10cSrcweir #endif 80cdf0e10cSrcweir 81cdf0e10cSrcweir public: 82cdf0e10cSrcweir SvxNewDictionaryDialog( Window* pParent, 83cdf0e10cSrcweir ::com::sun::star::uno::Reference< 84cdf0e10cSrcweir ::com::sun::star::linguistic2::XSpellChecker1 > &xSpl ); 85cdf0e10cSrcweir 86cdf0e10cSrcweir ::com::sun::star::uno::Reference< 87cdf0e10cSrcweir ::com::sun::star::linguistic2::XDictionary > GetNewDictionary()88cdf0e10cSrcweir GetNewDictionary() { return xNewDic; } 89cdf0e10cSrcweir }; 90cdf0e10cSrcweir 91cdf0e10cSrcweir // class SvxDictEdit ---------------------------------------------------- 92cdf0e10cSrcweir 93cdf0e10cSrcweir class SvxDictEdit : public Edit 94cdf0e10cSrcweir { 95cdf0e10cSrcweir Link aActionLink; 96cdf0e10cSrcweir sal_Bool bSpaces; 97cdf0e10cSrcweir 98cdf0e10cSrcweir public: SvxDictEdit(Window * pParent,const ResId & rResId)99cdf0e10cSrcweir SvxDictEdit(Window* pParent, const ResId& rResId) : 100cdf0e10cSrcweir Edit(pParent, rResId), bSpaces(sal_False){} 101cdf0e10cSrcweir SetActionHdl(const Link & rLink)102cdf0e10cSrcweir void SetActionHdl( const Link& rLink ) 103cdf0e10cSrcweir { aActionLink = rLink;} 104cdf0e10cSrcweir SetSpaces(sal_Bool bSet)105cdf0e10cSrcweir void SetSpaces(sal_Bool bSet) 106cdf0e10cSrcweir {bSpaces = bSet;} 107cdf0e10cSrcweir 108cdf0e10cSrcweir virtual void KeyInput( const KeyEvent& rKEvent ); 109cdf0e10cSrcweir }; 110cdf0e10cSrcweir 111cdf0e10cSrcweir // class SvxEditDictionaryDialog ----------------------------------------- 112cdf0e10cSrcweir 113cdf0e10cSrcweir class SvxEditDictionaryDialog : public ModalDialog 114cdf0e10cSrcweir { 115cdf0e10cSrcweir private: 116cdf0e10cSrcweir 117cdf0e10cSrcweir FixedText aBookFT; 118cdf0e10cSrcweir ListBox aAllDictsLB; 119cdf0e10cSrcweir FixedText aLangFT; 120cdf0e10cSrcweir SvxLanguageBox aLangLB; 121cdf0e10cSrcweir 122cdf0e10cSrcweir FixedText aWordFT; 123cdf0e10cSrcweir SvxDictEdit aWordED; 124cdf0e10cSrcweir FixedText aReplaceFT; 125cdf0e10cSrcweir SvxDictEdit aReplaceED; 126cdf0e10cSrcweir SvTabListBox aWordsLB; 127cdf0e10cSrcweir PushButton aNewReplacePB; 128cdf0e10cSrcweir PushButton aDeletePB; 129cdf0e10cSrcweir FixedLine aEditDictsBox; 130cdf0e10cSrcweir 131cdf0e10cSrcweir HelpButton aHelpBtn; 132cdf0e10cSrcweir CancelButton aCloseBtn; 133cdf0e10cSrcweir String sModify; 134cdf0e10cSrcweir String sNew; 135cdf0e10cSrcweir DecorationView aDecoView; 136cdf0e10cSrcweir 137cdf0e10cSrcweir ::com::sun::star::uno::Sequence< 138cdf0e10cSrcweir ::com::sun::star::uno::Reference< 139cdf0e10cSrcweir ::com::sun::star::linguistic2::XDictionary > > aDics; //! snapshot copy to work on 140cdf0e10cSrcweir ::com::sun::star::uno::Reference< 141cdf0e10cSrcweir ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; 142cdf0e10cSrcweir 143cdf0e10cSrcweir short nOld; 144cdf0e10cSrcweir long nWidth; 145cdf0e10cSrcweir sal_Bool bFirstSelect; 146cdf0e10cSrcweir sal_Bool bDoNothing; 147cdf0e10cSrcweir sal_Bool bDicIsReadonly; 148cdf0e10cSrcweir 149cdf0e10cSrcweir #ifdef _SVX_OPTDICT_CXX 150cdf0e10cSrcweir DECL_LINK( SelectBookHdl_Impl, ListBox * ); 151cdf0e10cSrcweir DECL_LINK( SelectLangHdl_Impl, ListBox * ); 152cdf0e10cSrcweir DECL_LINK(SelectHdl, SvTabListBox*); 153cdf0e10cSrcweir DECL_LINK(NewDelHdl, PushButton*); 154cdf0e10cSrcweir DECL_LINK(ModifyHdl, Edit*); 155cdf0e10cSrcweir 156cdf0e10cSrcweir 157cdf0e10cSrcweir void ShowWords_Impl( sal_uInt16 nId ); 158cdf0e10cSrcweir void SetLanguage_Impl( ::com::sun::star::util::Language nLanguage ); IsDicReadonly_Impl() const159cdf0e10cSrcweir sal_Bool IsDicReadonly_Impl() const { return bDicIsReadonly; } 160cdf0e10cSrcweir void SetDicReadonly_Impl( ::com::sun::star::uno::Reference< 161cdf0e10cSrcweir ::com::sun::star::linguistic2::XDictionary > &xDic ); 162cdf0e10cSrcweir 163cdf0e10cSrcweir void RemoveDictEntry(SvLBoxEntry* pEntry); 164cdf0e10cSrcweir sal_uInt16 GetLBInsertPos(const String &rDicWord); 165cdf0e10cSrcweir 166cdf0e10cSrcweir #endif 167cdf0e10cSrcweir 168cdf0e10cSrcweir protected: 169cdf0e10cSrcweir 170cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 171cdf0e10cSrcweir 172cdf0e10cSrcweir public: 173cdf0e10cSrcweir SvxEditDictionaryDialog( Window* pParent, 174cdf0e10cSrcweir const String& rName, 175cdf0e10cSrcweir ::com::sun::star::uno::Reference< 176cdf0e10cSrcweir ::com::sun::star::linguistic2::XSpellChecker1> &xSpl ); 177cdf0e10cSrcweir ~SvxEditDictionaryDialog(); 178cdf0e10cSrcweir GetSelectedDict()179cdf0e10cSrcweir sal_uInt16 GetSelectedDict() {return aAllDictsLB.GetSelectEntryPos();} 180cdf0e10cSrcweir }; 181cdf0e10cSrcweir 182cdf0e10cSrcweir 183cdf0e10cSrcweir #endif 184cdf0e10cSrcweir 185