1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_cui.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #define _SVSTDARR_STRINGSISORTDTOR 32*cdf0e10cSrcweir #define _SVSTDARR_STRINGSDTOR 33*cdf0e10cSrcweir #include <svl/svstdarr.hxx> 34*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 35*cdf0e10cSrcweir #include <vcl/field.hxx> 36*cdf0e10cSrcweir #include <vcl/keycodes.hxx> 37*cdf0e10cSrcweir #include <sot/exchange.hxx> 38*cdf0e10cSrcweir #include <svtools/transfer.hxx> 39*cdf0e10cSrcweir #include <unotools/syslocale.hxx> 40*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 41*cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 42*cdf0e10cSrcweir #include <unotools/charclass.hxx> 43*cdf0e10cSrcweir #include <unotools/collatorwrapper.hxx> 44*cdf0e10cSrcweir #include <com/sun/star/i18n/CollatorOptions.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 46*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 47*cdf0e10cSrcweir #include <vcl/svapp.hxx> 48*cdf0e10cSrcweir #include <sfx2/module.hxx> 49*cdf0e10cSrcweir #include <sfx2/request.hxx> 50*cdf0e10cSrcweir #include <sfx2/sfxsids.hrc> 51*cdf0e10cSrcweir #include <svl/eitem.hxx> 52*cdf0e10cSrcweir #include <svl/languageoptions.hxx> 53*cdf0e10cSrcweir #include <svx/SmartTagMgr.hxx> 54*cdf0e10cSrcweir #include <com/sun/star/smarttags/XSmartTagRecognizer.hpp> 55*cdf0e10cSrcweir #include <com/sun/star/smarttags/XSmartTagAction.hpp> 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir #define _OFA_AUTOCDLG_CXX 58*cdf0e10cSrcweir #include "autocdlg.hxx" 59*cdf0e10cSrcweir #include "autocdlg.hrc" 60*cdf0e10cSrcweir #include "helpid.hrc" 61*cdf0e10cSrcweir #include <editeng/acorrcfg.hxx> 62*cdf0e10cSrcweir #include <editeng/svxacorr.hxx> 63*cdf0e10cSrcweir #include "cuicharmap.hxx" 64*cdf0e10cSrcweir #include <editeng/unolingu.hxx> 65*cdf0e10cSrcweir #include <dialmgr.hxx> 66*cdf0e10cSrcweir #include <svx/svxids.hrc> // SID_OPEN_SMARTTAGSOPTIONS 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir static LanguageType eLastDialogLanguage = LANGUAGE_SYSTEM; 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir using namespace ::com::sun::star::util; 71*cdf0e10cSrcweir using namespace ::com::sun::star; 72*cdf0e10cSrcweir using namespace ::rtl; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir static ::com::sun::star::uno::Reference< 75*cdf0e10cSrcweir ::com::sun::star::lang::XMultiServiceFactory >& GetProcessFact() 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir static ::com::sun::star::uno::Reference< 78*cdf0e10cSrcweir ::com::sun::star::lang::XMultiServiceFactory > xMSF = 79*cdf0e10cSrcweir ::comphelper::getProcessServiceFactory(); 80*cdf0e10cSrcweir return xMSF; 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir /*-----------------14.10.96 15.47------------------- 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir --------------------------------------------------*/ 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir OfaAutoCorrDlg::OfaAutoCorrDlg(Window* pParent, const SfxItemSet* _pSet ) : 88*cdf0e10cSrcweir SfxTabDialog(pParent, CUI_RES( RID_OFA_AUTOCORR_DLG ), _pSet), 89*cdf0e10cSrcweir aLanguageFT( this, CUI_RES(FT_LANG )), 90*cdf0e10cSrcweir aLanguageLB( this, CUI_RES(LB_LANG )) 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir sal_Bool bShowSWOptions = sal_False; 93*cdf0e10cSrcweir sal_Bool bOpenSmartTagOptions = sal_False; 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir if ( _pSet ) 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir SFX_ITEMSET_ARG( _pSet, pItem, SfxBoolItem, SID_AUTO_CORRECT_DLG, sal_False ); 98*cdf0e10cSrcweir if ( pItem && pItem->GetValue() ) 99*cdf0e10cSrcweir bShowSWOptions = sal_True; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir SFX_ITEMSET_ARG( _pSet, pItem2, SfxBoolItem, SID_OPEN_SMARTTAGOPTIONS, sal_False ); 102*cdf0e10cSrcweir if ( pItem2 && pItem2->GetValue() ) 103*cdf0e10cSrcweir bOpenSmartTagOptions = sal_True; 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir aLanguageFT.SetZOrder(0, WINDOW_ZORDER_FIRST); 107*cdf0e10cSrcweir aLanguageLB.SetZOrder(&aLanguageFT, WINDOW_ZORDER_BEHIND); 108*cdf0e10cSrcweir aLanguageLB.SetHelpId(HID_AUTOCORR_LANGUAGE); 109*cdf0e10cSrcweir FreeResource(); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir AddTabPage(RID_OFAPAGE_AUTOCORR_OPTIONS, OfaAutocorrOptionsPage::Create, 0); 112*cdf0e10cSrcweir AddTabPage(RID_OFAPAGE_AUTOFMT_APPLY, OfaSwAutoFmtOptionsPage::Create, 0); 113*cdf0e10cSrcweir AddTabPage(RID_OFAPAGE_AUTOCOMPLETE_OPTIONS, OfaAutoCompleteTabPage::Create, 0); 114*cdf0e10cSrcweir AddTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS, OfaSmartTagOptionsTabPage::Create, 0); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir if (!bShowSWOptions) 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir RemoveTabPage(RID_OFAPAGE_AUTOFMT_APPLY); 119*cdf0e10cSrcweir RemoveTabPage(RID_OFAPAGE_AUTOCOMPLETE_OPTIONS); 120*cdf0e10cSrcweir RemoveTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS); 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir else 123*cdf0e10cSrcweir { 124*cdf0e10cSrcweir // remove smart tag tab page if no extensions are installed 125*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 126*cdf0e10cSrcweir SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); 127*cdf0e10cSrcweir if ( !pOpt || !pOpt->pSmartTagMgr || 0 == pOpt->pSmartTagMgr->NumberOfRecognizers() ) 128*cdf0e10cSrcweir RemoveTabPage(RID_OFAPAGE_SMARTTAG_OPTIONS); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir RemoveTabPage(RID_OFAPAGE_AUTOCORR_OPTIONS); 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir AddTabPage(RID_OFAPAGE_AUTOCORR_REPLACE, OfaAutocorrReplacePage::Create, 0); 134*cdf0e10cSrcweir AddTabPage(RID_OFAPAGE_AUTOCORR_EXCEPT, OfaAutocorrExceptPage::Create, 0); 135*cdf0e10cSrcweir AddTabPage(RID_OFAPAGE_AUTOCORR_QUOTE, OfaQuoteTabPage::Create, 0); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir // initialize languages 138*cdf0e10cSrcweir //! LANGUAGE_NONE is displayed as '[All]' and the LanguageType 139*cdf0e10cSrcweir //! will be set to LANGUAGE_DONTKNOW 140*cdf0e10cSrcweir sal_Int16 nLangList = LANG_LIST_WESTERN; 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir if( SvtLanguageOptions().IsCTLFontEnabled() ) 143*cdf0e10cSrcweir nLangList |= LANG_LIST_CTL; 144*cdf0e10cSrcweir aLanguageLB.SetLanguageList( nLangList, sal_True, sal_True ); 145*cdf0e10cSrcweir aLanguageLB.SelectLanguage( LANGUAGE_NONE ); 146*cdf0e10cSrcweir sal_uInt16 nPos = aLanguageLB.GetSelectEntryPos(); 147*cdf0e10cSrcweir DBG_ASSERT( LISTBOX_ENTRY_NOTFOUND != nPos, "listbox entry missing" ); 148*cdf0e10cSrcweir aLanguageLB.SetEntryData( nPos, (void*)(long) LANGUAGE_DONTKNOW ); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // Initialisierung funktionier fuer static nicht unter Linux - deswegen hier 151*cdf0e10cSrcweir if( LANGUAGE_SYSTEM == eLastDialogLanguage ) 152*cdf0e10cSrcweir eLastDialogLanguage = Application::GetSettings().GetLanguage(); 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir LanguageType nSelectLang = LANGUAGE_DONTKNOW; 155*cdf0e10cSrcweir nPos = aLanguageLB.GetEntryPos( (void*)(long) eLastDialogLanguage ); 156*cdf0e10cSrcweir if (LISTBOX_ENTRY_NOTFOUND != nPos) 157*cdf0e10cSrcweir nSelectLang = eLastDialogLanguage; 158*cdf0e10cSrcweir aLanguageLB.SelectLanguage( nSelectLang ); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir aLanguageLB.SetSelectHdl(LINK(this, OfaAutoCorrDlg, SelectLanguageHdl)); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir Size aMinSize(aLanguageFT.CalcMinimumSize()); 163*cdf0e10cSrcweir //reserve some extra space for CJK accelerators that are possible inserted 164*cdf0e10cSrcweir //later (like '(A)') 165*cdf0e10cSrcweir aLanguageFT.SetPosSizePixel( 0, 0, aMinSize.Width() + 20, 0, WINDOW_POSSIZE_WIDTH ); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir if ( bOpenSmartTagOptions ) 168*cdf0e10cSrcweir SetCurPageId( RID_OFAPAGE_SMARTTAG_OPTIONS ); 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir /*-----------------16.10.96 14.06------------------- 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir --------------------------------------------------*/ 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir sal_Bool lcl_FindEntry( ListBox& rLB, const String& rEntry, 175*cdf0e10cSrcweir CollatorWrapper& rCmpClass ) 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir sal_uInt16 nCount = rLB.GetEntryCount(); 178*cdf0e10cSrcweir sal_uInt16 nSelPos = rLB.GetSelectEntryPos(); 179*cdf0e10cSrcweir sal_uInt16 i; 180*cdf0e10cSrcweir for(i = 0; i < nCount; i++) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir if( 0 == rCmpClass.compareString(rEntry, rLB.GetEntry(i) )) 183*cdf0e10cSrcweir { 184*cdf0e10cSrcweir rLB.SelectEntryPos(i, sal_True); 185*cdf0e10cSrcweir return sal_True; 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir if(LISTBOX_ENTRY_NOTFOUND != nSelPos) 189*cdf0e10cSrcweir rLB.SelectEntryPos(nSelPos, sal_False); 190*cdf0e10cSrcweir return sal_False; 191*cdf0e10cSrcweir } 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir /* -----------------23.11.98 10:46------------------- 194*cdf0e10cSrcweir * 195*cdf0e10cSrcweir * --------------------------------------------------*/ 196*cdf0e10cSrcweir IMPL_LINK(OfaAutoCorrDlg, SelectLanguageHdl, ListBox*, pBox) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir sal_uInt16 nPos = pBox->GetSelectEntryPos(); 199*cdf0e10cSrcweir void* pVoid = pBox->GetEntryData(nPos); 200*cdf0e10cSrcweir LanguageType eNewLang = (LanguageType)(long)pVoid; 201*cdf0e10cSrcweir //alte Einstellungen speichern und neu fuellen 202*cdf0e10cSrcweir if(eNewLang != eLastDialogLanguage) 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir sal_uInt16 nPageId = GetCurPageId(); 205*cdf0e10cSrcweir if(RID_OFAPAGE_AUTOCORR_REPLACE == nPageId) 206*cdf0e10cSrcweir ((OfaAutocorrReplacePage*)GetTabPage( nPageId ))->SetLanguage(eNewLang); 207*cdf0e10cSrcweir else if(RID_OFAPAGE_AUTOCORR_EXCEPT == nPageId) 208*cdf0e10cSrcweir ((OfaAutocorrExceptPage*)GetTabPage( nPageId ))->SetLanguage(eNewLang); 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir return 0; 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir /*-----------------14.10.96 15.57------------------- 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir --------------------------------------------------*/ 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir OfaAutocorrOptionsPage::OfaAutocorrOptionsPage( Window* pParent, 217*cdf0e10cSrcweir const SfxItemSet& rSet ) : 218*cdf0e10cSrcweir SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_AUTOCORR_OPTIONS ), rSet), 219*cdf0e10cSrcweir aCheckLB (this, CUI_RES(CLB_SETTINGS )), 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir sInput (CUI_RES(ST_USE_REPLACE )), 222*cdf0e10cSrcweir sDoubleCaps (CUI_RES(ST_CPTL_STT_WORD )), 223*cdf0e10cSrcweir sStartCap (CUI_RES(ST_CPTL_STT_SENT )), 224*cdf0e10cSrcweir sBoldUnderline (CUI_RES(ST_BOLD_UNDER )), 225*cdf0e10cSrcweir sURL (CUI_RES(ST_DETECT_URL )), 226*cdf0e10cSrcweir sNoDblSpaces (CUI_RES(STR_NO_DBL_SPACES )), 227*cdf0e10cSrcweir sDash (CUI_RES(ST_DASH )) 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir FreeResource(); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir aCheckLB.SetHelpId(HID_OFAPAGE_AUTOCORR_CLB); 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir --------------------------------------------------*/ 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir OfaAutocorrOptionsPage::~OfaAutocorrOptionsPage() 240*cdf0e10cSrcweir { 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir --------------------------------------------------*/ 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir SfxTabPage* OfaAutocorrOptionsPage::Create( Window* pParent, 249*cdf0e10cSrcweir const SfxItemSet& rSet) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir return new OfaAutocorrOptionsPage(pParent, rSet); 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir --------------------------------------------------*/ 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir sal_Bool OfaAutocorrOptionsPage::FillItemSet( SfxItemSet& ) 259*cdf0e10cSrcweir { 260*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 261*cdf0e10cSrcweir long nFlags = pAutoCorrect->GetFlags(); 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir sal_uInt16 nPos = 0; 264*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(Autocorrect, aCheckLB.IsChecked(nPos++)); 265*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(CptlSttWrd, aCheckLB.IsChecked(nPos++)); 266*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(CptlSttSntnc, aCheckLB.IsChecked(nPos++)); 267*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(ChgWeightUnderl, aCheckLB.IsChecked(nPos++)); 268*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(SetINetAttr, aCheckLB.IsChecked(nPos++)); 269*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(ChgToEnEmDash, aCheckLB.IsChecked(nPos++)); 270*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(IgnoreDoubleSpace, aCheckLB.IsChecked(nPos++)); 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir sal_Bool bReturn = nFlags != pAutoCorrect->GetFlags(); 273*cdf0e10cSrcweir if(bReturn ) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); 276*cdf0e10cSrcweir pCfg->SetModified(); 277*cdf0e10cSrcweir pCfg->Commit(); 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir return bReturn; 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir /* -----------------23.11.98 16:15------------------- 283*cdf0e10cSrcweir * 284*cdf0e10cSrcweir * --------------------------------------------------*/ 285*cdf0e10cSrcweir void OfaAutocorrOptionsPage::ActivatePage( const SfxItemSet& ) 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(sal_False); 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir --------------------------------------------------*/ 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir void OfaAutocorrOptionsPage::Reset( const SfxItemSet& ) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 298*cdf0e10cSrcweir const long nFlags = pAutoCorrect->GetFlags(); 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir aCheckLB.SetUpdateMode(sal_False); 301*cdf0e10cSrcweir aCheckLB.Clear(); 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir aCheckLB.InsertEntry(sInput); 304*cdf0e10cSrcweir aCheckLB.InsertEntry(sDoubleCaps); 305*cdf0e10cSrcweir aCheckLB.InsertEntry(sStartCap); 306*cdf0e10cSrcweir aCheckLB.InsertEntry(sBoldUnderline); 307*cdf0e10cSrcweir aCheckLB.InsertEntry(sURL); 308*cdf0e10cSrcweir aCheckLB.InsertEntry(sDash); 309*cdf0e10cSrcweir aCheckLB.InsertEntry(sNoDblSpaces); 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir sal_uInt16 nPos = 0; 312*cdf0e10cSrcweir aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & Autocorrect) ); 313*cdf0e10cSrcweir aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & CptlSttWrd) ); 314*cdf0e10cSrcweir aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & CptlSttSntnc) ); 315*cdf0e10cSrcweir aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgWeightUnderl) ); 316*cdf0e10cSrcweir aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & SetINetAttr) ); 317*cdf0e10cSrcweir aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgToEnEmDash) ); 318*cdf0e10cSrcweir aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & IgnoreDoubleSpace) ); 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir aCheckLB.SetUpdateMode(sal_True); 321*cdf0e10cSrcweir } 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir /*********************************************************************/ 324*cdf0e10cSrcweir /* */ 325*cdf0e10cSrcweir /* Hilfs-struct fuer dUserDaten der Checklistbox */ 326*cdf0e10cSrcweir /* */ 327*cdf0e10cSrcweir /*********************************************************************/ 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir struct ImpUserData 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir String *pString; 332*cdf0e10cSrcweir Font* pFont; 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir ImpUserData(String* pText, Font* pFnt) 335*cdf0e10cSrcweir { pString = pText; pFont = pFnt;} 336*cdf0e10cSrcweir }; 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir /*********************************************************************/ 340*cdf0e10cSrcweir /* */ 341*cdf0e10cSrcweir /* Dialog fuer Prozenteinstellung */ 342*cdf0e10cSrcweir /* */ 343*cdf0e10cSrcweir /*********************************************************************/ 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir class OfaAutoFmtPrcntSet : public ModalDialog 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir OKButton aOKPB; 348*cdf0e10cSrcweir CancelButton aCancelPB; 349*cdf0e10cSrcweir FixedLine aPrcntFL; 350*cdf0e10cSrcweir MetricField aPrcntMF; 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir public: 353*cdf0e10cSrcweir OfaAutoFmtPrcntSet(Window* pParent) : 354*cdf0e10cSrcweir ModalDialog(pParent, CUI_RES(RID_OFADLG_PRCNT_SET)), 355*cdf0e10cSrcweir aOKPB(this, CUI_RES(BT_OK)), 356*cdf0e10cSrcweir aCancelPB(this, CUI_RES(BT_CANCEL)), 357*cdf0e10cSrcweir aPrcntFL(this, CUI_RES(FL_PRCNT)), 358*cdf0e10cSrcweir aPrcntMF(this, CUI_RES(ED_RIGHT_MARGIN)) 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir FreeResource(); 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir MetricField& GetPrcntFld(){return aPrcntMF;} 363*cdf0e10cSrcweir }; 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir /*********************************************************************/ 367*cdf0e10cSrcweir /* */ 368*cdf0e10cSrcweir /* veraenderter LBoxString */ 369*cdf0e10cSrcweir /* */ 370*cdf0e10cSrcweir /*********************************************************************/ 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir class OfaImpBrwString : public SvLBoxString 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir public: 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir OfaImpBrwString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, 377*cdf0e10cSrcweir const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr){} 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, 380*cdf0e10cSrcweir SvLBoxEntry* pEntry); 381*cdf0e10cSrcweir }; 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir /*********************************************************************/ 384*cdf0e10cSrcweir /* */ 385*cdf0e10cSrcweir /*********************************************************************/ 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir void __EXPORT OfaImpBrwString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 /*nFlags*/, 389*cdf0e10cSrcweir SvLBoxEntry* pEntry ) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir rDev.DrawText( rPos, GetText() ); 392*cdf0e10cSrcweir if(pEntry->GetUserData()) 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir ImpUserData* pUserData = (ImpUserData* )pEntry->GetUserData(); 395*cdf0e10cSrcweir Point aNewPos(rPos); 396*cdf0e10cSrcweir aNewPos.X() += rDev.GetTextWidth(GetText()); 397*cdf0e10cSrcweir Font aOldFont( rDev.GetFont()); 398*cdf0e10cSrcweir Font aFont( aOldFont ); 399*cdf0e10cSrcweir if(pUserData->pFont) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir aFont = *pUserData->pFont; 402*cdf0e10cSrcweir aFont.SetColor(aOldFont.GetColor()); 403*cdf0e10cSrcweir aFont.SetSize(aOldFont.GetSize()); 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir aFont.SetWeight( WEIGHT_BOLD ); 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir sal_Bool bFett = sal_True; 408*cdf0e10cSrcweir sal_uInt16 nPos = 0; 409*cdf0e10cSrcweir do { 410*cdf0e10cSrcweir String sTxt( pUserData->pString->GetToken( 0, 1, nPos )); 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir if( bFett ) 413*cdf0e10cSrcweir rDev.SetFont( aFont ); 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir rDev.DrawText( aNewPos, sTxt ); 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir if( STRING_NOTFOUND != nPos ) 418*cdf0e10cSrcweir aNewPos.X() += rDev.GetTextWidth( sTxt ); 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir if( bFett ) 421*cdf0e10cSrcweir rDev.SetFont( aOldFont ); 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir bFett = !bFett; 424*cdf0e10cSrcweir } while( STRING_NOTFOUND != nPos ); 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir /*********************************************************************/ 429*cdf0e10cSrcweir /* */ 430*cdf0e10cSrcweir /* TabPage Autoformat anwenden */ 431*cdf0e10cSrcweir /* */ 432*cdf0e10cSrcweir /*********************************************************************/ 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir #define CBCOL_FIRST 0 435*cdf0e10cSrcweir #define CBCOL_SECOND 1 436*cdf0e10cSrcweir #define CBCOL_BOTH 2 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir enum OfaAutoFmtOptions 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir USE_REPLACE_TABLE, 441*cdf0e10cSrcweir CORR_UPPER, 442*cdf0e10cSrcweir BEGIN_UPPER, 443*cdf0e10cSrcweir BOLD_UNDERLINE, 444*cdf0e10cSrcweir DETECT_URL, 445*cdf0e10cSrcweir REPLACE_DASHES, 446*cdf0e10cSrcweir DEL_SPACES_AT_STT_END, 447*cdf0e10cSrcweir DEL_SPACES_BETWEEN_LINES, 448*cdf0e10cSrcweir IGNORE_DBLSPACE, 449*cdf0e10cSrcweir APPLY_NUMBERING, 450*cdf0e10cSrcweir INSERT_BORDER, 451*cdf0e10cSrcweir CREATE_TABLE, 452*cdf0e10cSrcweir REPLACE_STYLES, 453*cdf0e10cSrcweir DEL_EMPTY_NODE, 454*cdf0e10cSrcweir REPLACE_USER_COLL, 455*cdf0e10cSrcweir REPLACE_BULLETS, 456*cdf0e10cSrcweir MERGE_SINGLE_LINE_PARA 457*cdf0e10cSrcweir }; 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage( Window* pParent, 460*cdf0e10cSrcweir const SfxItemSet& rSet ) : 461*cdf0e10cSrcweir SfxTabPage(pParent, CUI_RES(RID_OFAPAGE_AUTOFMT_APPLY), rSet), 462*cdf0e10cSrcweir aCheckLB (this, CUI_RES(CLB_SETTINGS)), 463*cdf0e10cSrcweir aEditPB (this, CUI_RES(PB_EDIT)), 464*cdf0e10cSrcweir aHeader1Expl (this, CUI_RES(FT_HEADER1_EXPLANATION)), 465*cdf0e10cSrcweir aHeader2Expl (this, CUI_RES(FT_HEADER2_EXPLANATION)), 466*cdf0e10cSrcweir sHeader1 (CUI_RES( STR_HEADER1 )), 467*cdf0e10cSrcweir sHeader2 (CUI_RES( STR_HEADER2 )), 468*cdf0e10cSrcweir sDeleteEmptyPara (CUI_RES( ST_DEL_EMPTY_PARA)), 469*cdf0e10cSrcweir sUseReplaceTbl (CUI_RES( ST_USE_REPLACE )), 470*cdf0e10cSrcweir sCptlSttWord (CUI_RES( ST_CPTL_STT_WORD)), 471*cdf0e10cSrcweir sCptlSttSent (CUI_RES( ST_CPTL_STT_SENT)), 472*cdf0e10cSrcweir sUserStyle (CUI_RES( ST_USER_STYLE )), 473*cdf0e10cSrcweir sBullet (CUI_RES( ST_BULLET )), 474*cdf0e10cSrcweir sBoldUnder (CUI_RES( ST_BOLD_UNDER )), 475*cdf0e10cSrcweir sNoDblSpaces (CUI_RES( STR_NO_DBL_SPACES)), 476*cdf0e10cSrcweir sDetectURL (CUI_RES( ST_DETECT_URL )), 477*cdf0e10cSrcweir sDash (CUI_RES( ST_DASH )), 478*cdf0e10cSrcweir sRightMargin (CUI_RES( ST_RIGHT_MARGIN )), 479*cdf0e10cSrcweir sNum (CUI_RES( STR_NUM )), 480*cdf0e10cSrcweir sBorder (CUI_RES( STR_BORDER )), 481*cdf0e10cSrcweir sTable (CUI_RES( STR_TABLE )), 482*cdf0e10cSrcweir sReplaceTemplates (CUI_RES( STR_REPLACE_TEMPLATES)), 483*cdf0e10cSrcweir sDelSpaceAtSttEnd (CUI_RES( STR_DEL_SPACES_AT_STT_END)), 484*cdf0e10cSrcweir sDelSpaceBetweenLines(CUI_RES(STR_DEL_SPACES_BETWEEN_LINES)), 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir nPercent ( 50 ), 487*cdf0e10cSrcweir pCheckButtonData( NULL ) 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir { 490*cdf0e10cSrcweir FreeResource(); 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir //typ. Anfuehrungszeichen einsetzen 493*cdf0e10cSrcweir SvtSysLocale aSysLcl; 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir aCheckLB.SetHelpId(HID_OFAPAGE_AUTOFORMAT_CLB); 496*cdf0e10cSrcweir aCheckLB.SetStyle(aCheckLB.GetStyle()|WB_HSCROLL| WB_VSCROLL); 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir aCheckLB.SetSelectHdl(LINK(this, OfaSwAutoFmtOptionsPage, SelectHdl)); 499*cdf0e10cSrcweir aCheckLB.SetDoubleClickHdl(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl)); 500*cdf0e10cSrcweir 501*cdf0e10cSrcweir static long aStaticTabs[]= 502*cdf0e10cSrcweir { 503*cdf0e10cSrcweir 3, 0, 20, 40 504*cdf0e10cSrcweir }; 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir aCheckLB.SvxSimpleTable::SetTabs(aStaticTabs); 507*cdf0e10cSrcweir String sHeader( sHeader1 ); 508*cdf0e10cSrcweir sHeader += '\t'; 509*cdf0e10cSrcweir sHeader += sHeader2; 510*cdf0e10cSrcweir sHeader += '\t'; 511*cdf0e10cSrcweir aCheckLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, 512*cdf0e10cSrcweir HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED); 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir aEditPB.SetClickHdl(LINK(this, OfaSwAutoFmtOptionsPage, EditHdl)); 515*cdf0e10cSrcweir } 516*cdf0e10cSrcweir 517*cdf0e10cSrcweir /*********************************************************************/ 518*cdf0e10cSrcweir /* */ 519*cdf0e10cSrcweir /*********************************************************************/ 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir SvLBoxEntry* OfaSwAutoFmtOptionsPage::CreateEntry(String& rTxt, sal_uInt16 nCol) 522*cdf0e10cSrcweir { 523*cdf0e10cSrcweir SvLBoxEntry* pEntry = new SvLBoxEntry; 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir if ( !pCheckButtonData ) 526*cdf0e10cSrcweir { 527*cdf0e10cSrcweir pCheckButtonData = new SvLBoxButtonData( &aCheckLB ); 528*cdf0e10cSrcweir aCheckLB.SetCheckButtonData( pCheckButtonData ); 529*cdf0e10cSrcweir } 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! 532*cdf0e10cSrcweir 533*cdf0e10cSrcweir String sEmpty; 534*cdf0e10cSrcweir if (nCol == CBCOL_SECOND) 535*cdf0e10cSrcweir pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte 536*cdf0e10cSrcweir else 537*cdf0e10cSrcweir pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); 538*cdf0e10cSrcweir 539*cdf0e10cSrcweir if (nCol == CBCOL_FIRST) 540*cdf0e10cSrcweir pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte 541*cdf0e10cSrcweir else 542*cdf0e10cSrcweir pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); 543*cdf0e10cSrcweir pEntry->AddItem( new OfaImpBrwString( pEntry, 0, rTxt ) ); 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir return pEntry; 546*cdf0e10cSrcweir } 547*cdf0e10cSrcweir 548*cdf0e10cSrcweir /*********************************************************************/ 549*cdf0e10cSrcweir /* */ 550*cdf0e10cSrcweir /*********************************************************************/ 551*cdf0e10cSrcweir 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir __EXPORT OfaSwAutoFmtOptionsPage::~OfaSwAutoFmtOptionsPage() 554*cdf0e10cSrcweir { 555*cdf0e10cSrcweir delete (ImpUserData*) aCheckLB.GetUserData( REPLACE_BULLETS ); 556*cdf0e10cSrcweir delete (ImpUserData*) aCheckLB.GetUserData( APPLY_NUMBERING ); 557*cdf0e10cSrcweir delete (ImpUserData*) aCheckLB.GetUserData( MERGE_SINGLE_LINE_PARA ); 558*cdf0e10cSrcweir delete pCheckButtonData; 559*cdf0e10cSrcweir } 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir /*********************************************************************/ 562*cdf0e10cSrcweir /* */ 563*cdf0e10cSrcweir /*********************************************************************/ 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir SfxTabPage* __EXPORT OfaSwAutoFmtOptionsPage::Create( Window* pParent, 566*cdf0e10cSrcweir const SfxItemSet& rAttrSet) 567*cdf0e10cSrcweir { 568*cdf0e10cSrcweir return new OfaSwAutoFmtOptionsPage(pParent, rAttrSet); 569*cdf0e10cSrcweir } 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir /*********************************************************************/ 572*cdf0e10cSrcweir /* */ 573*cdf0e10cSrcweir /*********************************************************************/ 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir sal_Bool OfaSwAutoFmtOptionsPage::FillItemSet( SfxItemSet& ) 576*cdf0e10cSrcweir { 577*cdf0e10cSrcweir sal_Bool bModified = sal_False; 578*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 579*cdf0e10cSrcweir SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); 580*cdf0e10cSrcweir long nFlags = pAutoCorrect->GetFlags(); 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir sal_Bool bCheck = aCheckLB.IsChecked(USE_REPLACE_TABLE, CBCOL_FIRST); 583*cdf0e10cSrcweir bModified |= pOpt->bAutoCorrect != bCheck; 584*cdf0e10cSrcweir pOpt->bAutoCorrect = bCheck; 585*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(Autocorrect, 586*cdf0e10cSrcweir aCheckLB.IsChecked(USE_REPLACE_TABLE, CBCOL_SECOND)); 587*cdf0e10cSrcweir 588*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(CORR_UPPER, CBCOL_FIRST); 589*cdf0e10cSrcweir bModified |= pOpt->bCptlSttWrd != bCheck; 590*cdf0e10cSrcweir pOpt->bCptlSttWrd = bCheck; 591*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(CptlSttWrd, 592*cdf0e10cSrcweir aCheckLB.IsChecked(CORR_UPPER, CBCOL_SECOND)); 593*cdf0e10cSrcweir 594*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(BEGIN_UPPER, CBCOL_FIRST); 595*cdf0e10cSrcweir bModified |= pOpt->bCptlSttSntnc != bCheck; 596*cdf0e10cSrcweir pOpt->bCptlSttSntnc = bCheck; 597*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(CptlSttSntnc, 598*cdf0e10cSrcweir aCheckLB.IsChecked(BEGIN_UPPER, CBCOL_SECOND)); 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(BOLD_UNDERLINE, CBCOL_FIRST); 601*cdf0e10cSrcweir bModified |= pOpt->bChgWeightUnderl != bCheck; 602*cdf0e10cSrcweir pOpt->bChgWeightUnderl = bCheck; 603*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(ChgWeightUnderl, 604*cdf0e10cSrcweir aCheckLB.IsChecked(BOLD_UNDERLINE, CBCOL_SECOND)); 605*cdf0e10cSrcweir 606*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(IgnoreDoubleSpace, 607*cdf0e10cSrcweir aCheckLB.IsChecked(IGNORE_DBLSPACE, CBCOL_SECOND)); 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(DETECT_URL, CBCOL_FIRST); 610*cdf0e10cSrcweir bModified |= pOpt->bSetINetAttr != bCheck; 611*cdf0e10cSrcweir pOpt->bSetINetAttr = bCheck; 612*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(SetINetAttr, 613*cdf0e10cSrcweir aCheckLB.IsChecked(DETECT_URL, CBCOL_SECOND)); 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(DEL_EMPTY_NODE, CBCOL_FIRST); 616*cdf0e10cSrcweir bModified |= pOpt->bDelEmptyNode != bCheck; 617*cdf0e10cSrcweir pOpt->bDelEmptyNode = bCheck; 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(REPLACE_USER_COLL, CBCOL_FIRST); 620*cdf0e10cSrcweir bModified |= pOpt->bChgUserColl != bCheck; 621*cdf0e10cSrcweir pOpt->bChgUserColl = bCheck; 622*cdf0e10cSrcweir 623*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(REPLACE_BULLETS, CBCOL_FIRST); 624*cdf0e10cSrcweir bModified |= pOpt->bChgEnumNum != bCheck; 625*cdf0e10cSrcweir pOpt->bChgEnumNum = bCheck; 626*cdf0e10cSrcweir bModified |= aBulletFont != pOpt->aBulletFont; 627*cdf0e10cSrcweir pOpt->aBulletFont = aBulletFont; 628*cdf0e10cSrcweir bModified |= String(pOpt->cBullet) != sBulletChar; 629*cdf0e10cSrcweir pOpt->cBullet = sBulletChar.GetChar(0); 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir bModified |= aByInputBulletFont != pOpt->aByInputBulletFont; 632*cdf0e10cSrcweir bModified |= String(pOpt->cByInputBullet) != sByInputBulletChar; 633*cdf0e10cSrcweir pOpt->aByInputBulletFont = aByInputBulletFont; 634*cdf0e10cSrcweir pOpt->cByInputBullet = sByInputBulletChar.GetChar(0); 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(MERGE_SINGLE_LINE_PARA, CBCOL_FIRST); 637*cdf0e10cSrcweir bModified |= pOpt->bRightMargin != bCheck; 638*cdf0e10cSrcweir pOpt->bRightMargin = bCheck; 639*cdf0e10cSrcweir bModified |= nPercent != pOpt->nRightMargin; 640*cdf0e10cSrcweir pOpt->nRightMargin = (sal_uInt8)nPercent; 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(APPLY_NUMBERING, CBCOL_SECOND); 643*cdf0e10cSrcweir bModified |= pOpt->bSetNumRule != bCheck; 644*cdf0e10cSrcweir pOpt->bSetNumRule = bCheck; 645*cdf0e10cSrcweir 646*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(INSERT_BORDER, CBCOL_SECOND); 647*cdf0e10cSrcweir bModified |= pOpt->bSetBorder != bCheck; 648*cdf0e10cSrcweir pOpt->bSetBorder = bCheck; 649*cdf0e10cSrcweir 650*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(CREATE_TABLE, CBCOL_SECOND); 651*cdf0e10cSrcweir bModified |= pOpt->bCreateTable != bCheck; 652*cdf0e10cSrcweir pOpt->bCreateTable = bCheck; 653*cdf0e10cSrcweir 654*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(REPLACE_STYLES, CBCOL_SECOND); 655*cdf0e10cSrcweir bModified |= pOpt->bReplaceStyles != bCheck; 656*cdf0e10cSrcweir pOpt->bReplaceStyles = bCheck; 657*cdf0e10cSrcweir 658*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(REPLACE_DASHES, CBCOL_FIRST); 659*cdf0e10cSrcweir bModified |= pOpt->bChgToEnEmDash != bCheck; 660*cdf0e10cSrcweir pOpt->bChgToEnEmDash = bCheck; 661*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(ChgToEnEmDash, 662*cdf0e10cSrcweir aCheckLB.IsChecked(REPLACE_DASHES, CBCOL_SECOND)); 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(DEL_SPACES_AT_STT_END, CBCOL_FIRST); 665*cdf0e10cSrcweir bModified |= pOpt->bAFmtDelSpacesAtSttEnd != bCheck; 666*cdf0e10cSrcweir pOpt->bAFmtDelSpacesAtSttEnd = bCheck; 667*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(DEL_SPACES_AT_STT_END, CBCOL_SECOND); 668*cdf0e10cSrcweir bModified |= pOpt->bAFmtByInpDelSpacesAtSttEnd != bCheck; 669*cdf0e10cSrcweir pOpt->bAFmtByInpDelSpacesAtSttEnd = bCheck; 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST); 672*cdf0e10cSrcweir bModified |= pOpt->bAFmtDelSpacesBetweenLines != bCheck; 673*cdf0e10cSrcweir pOpt->bAFmtDelSpacesBetweenLines = bCheck; 674*cdf0e10cSrcweir bCheck = aCheckLB.IsChecked(DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND); 675*cdf0e10cSrcweir bModified |= pOpt->bAFmtByInpDelSpacesBetweenLines != bCheck; 676*cdf0e10cSrcweir pOpt->bAFmtByInpDelSpacesBetweenLines = bCheck; 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir if(bModified || nFlags != pAutoCorrect->GetFlags()) 679*cdf0e10cSrcweir { 680*cdf0e10cSrcweir SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); 681*cdf0e10cSrcweir pCfg->SetModified(); 682*cdf0e10cSrcweir pCfg->Commit(); 683*cdf0e10cSrcweir } 684*cdf0e10cSrcweir 685*cdf0e10cSrcweir return sal_True; 686*cdf0e10cSrcweir } 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir /* -----------------23.11.98 16:15------------------- 689*cdf0e10cSrcweir * 690*cdf0e10cSrcweir * --------------------------------------------------*/ 691*cdf0e10cSrcweir void OfaSwAutoFmtOptionsPage::ActivatePage( const SfxItemSet& ) 692*cdf0e10cSrcweir { 693*cdf0e10cSrcweir ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(sal_False); 694*cdf0e10cSrcweir } 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir /*********************************************************************/ 697*cdf0e10cSrcweir /* */ 698*cdf0e10cSrcweir /*********************************************************************/ 699*cdf0e10cSrcweir 700*cdf0e10cSrcweir 701*cdf0e10cSrcweir void OfaSwAutoFmtOptionsPage::Reset( const SfxItemSet& ) 702*cdf0e10cSrcweir { 703*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 704*cdf0e10cSrcweir SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); 705*cdf0e10cSrcweir const long nFlags = pAutoCorrect->GetFlags(); 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir aCheckLB.SetUpdateMode(sal_False); 708*cdf0e10cSrcweir aCheckLB.Clear(); 709*cdf0e10cSrcweir 710*cdf0e10cSrcweir // Die folgenden Eintraege muessen in der selben Reihenfolge, wie im 711*cdf0e10cSrcweir // OfaAutoFmtOptions-enum eingefuegt werden! 712*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sUseReplaceTbl, CBCOL_BOTH )); 713*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sCptlSttWord, CBCOL_BOTH )); 714*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sCptlSttSent, CBCOL_BOTH )); 715*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sBoldUnder, CBCOL_BOTH )); 716*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sDetectURL, CBCOL_BOTH )); 717*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sDash, CBCOL_BOTH )); 718*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sDelSpaceAtSttEnd, CBCOL_BOTH )); 719*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sDelSpaceBetweenLines, CBCOL_BOTH )); 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sNoDblSpaces, CBCOL_SECOND)); 722*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sNum, CBCOL_SECOND)); 723*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sBorder, CBCOL_SECOND)); 724*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sTable, CBCOL_SECOND)); 725*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sReplaceTemplates, CBCOL_SECOND)); 726*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sDeleteEmptyPara, CBCOL_FIRST )); 727*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sUserStyle, CBCOL_FIRST )); 728*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sBullet, CBCOL_FIRST )); 729*cdf0e10cSrcweir aCheckLB.GetModel()->Insert(CreateEntry(sRightMargin, CBCOL_FIRST )); 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir aCheckLB.CheckEntryPos( USE_REPLACE_TABLE, CBCOL_FIRST, pOpt->bAutoCorrect ); 732*cdf0e10cSrcweir aCheckLB.CheckEntryPos( USE_REPLACE_TABLE, CBCOL_SECOND, 0 != (nFlags & Autocorrect)); 733*cdf0e10cSrcweir aCheckLB.CheckEntryPos( CORR_UPPER, CBCOL_FIRST, pOpt->bCptlSttWrd ); 734*cdf0e10cSrcweir aCheckLB.CheckEntryPos( CORR_UPPER, CBCOL_SECOND, 0 != (nFlags & CptlSttWrd) ); 735*cdf0e10cSrcweir aCheckLB.CheckEntryPos( BEGIN_UPPER, CBCOL_FIRST, pOpt->bCptlSttSntnc ); 736*cdf0e10cSrcweir aCheckLB.CheckEntryPos( BEGIN_UPPER, CBCOL_SECOND, 0 != (nFlags & CptlSttSntnc) ); 737*cdf0e10cSrcweir aCheckLB.CheckEntryPos( BOLD_UNDERLINE, CBCOL_FIRST, pOpt->bChgWeightUnderl ); 738*cdf0e10cSrcweir aCheckLB.CheckEntryPos( BOLD_UNDERLINE, CBCOL_SECOND, 0 != (nFlags & ChgWeightUnderl) ); 739*cdf0e10cSrcweir aCheckLB.CheckEntryPos( IGNORE_DBLSPACE, CBCOL_SECOND, 0 != (nFlags & IgnoreDoubleSpace) ); 740*cdf0e10cSrcweir aCheckLB.CheckEntryPos( DETECT_URL, CBCOL_FIRST, pOpt->bSetINetAttr ); 741*cdf0e10cSrcweir aCheckLB.CheckEntryPos( DETECT_URL, CBCOL_SECOND, 0 != (nFlags & SetINetAttr) ); 742*cdf0e10cSrcweir aCheckLB.CheckEntryPos( REPLACE_DASHES, CBCOL_FIRST, pOpt->bChgToEnEmDash ); 743*cdf0e10cSrcweir aCheckLB.CheckEntryPos( REPLACE_DASHES, CBCOL_SECOND, 0 != (nFlags & ChgToEnEmDash) ); 744*cdf0e10cSrcweir aCheckLB.CheckEntryPos( DEL_SPACES_AT_STT_END, CBCOL_FIRST, pOpt->bAFmtDelSpacesAtSttEnd ); 745*cdf0e10cSrcweir aCheckLB.CheckEntryPos( DEL_SPACES_AT_STT_END, CBCOL_SECOND, pOpt->bAFmtByInpDelSpacesAtSttEnd ); 746*cdf0e10cSrcweir aCheckLB.CheckEntryPos( DEL_SPACES_BETWEEN_LINES, CBCOL_FIRST, pOpt->bAFmtDelSpacesBetweenLines ); 747*cdf0e10cSrcweir aCheckLB.CheckEntryPos( DEL_SPACES_BETWEEN_LINES, CBCOL_SECOND, pOpt->bAFmtByInpDelSpacesBetweenLines ); 748*cdf0e10cSrcweir aCheckLB.CheckEntryPos( DEL_EMPTY_NODE, CBCOL_FIRST, pOpt->bDelEmptyNode ); 749*cdf0e10cSrcweir aCheckLB.CheckEntryPos( REPLACE_USER_COLL, CBCOL_FIRST, pOpt->bChgUserColl ); 750*cdf0e10cSrcweir aCheckLB.CheckEntryPos( REPLACE_BULLETS, CBCOL_FIRST, pOpt->bChgEnumNum ); 751*cdf0e10cSrcweir 752*cdf0e10cSrcweir aBulletFont = pOpt->aBulletFont; 753*cdf0e10cSrcweir sBulletChar = pOpt->cBullet; 754*cdf0e10cSrcweir ImpUserData* pUserData = new ImpUserData(&sBulletChar, &aBulletFont); 755*cdf0e10cSrcweir aCheckLB.SetUserData( REPLACE_BULLETS, pUserData ); 756*cdf0e10cSrcweir 757*cdf0e10cSrcweir nPercent = pOpt->nRightMargin; 758*cdf0e10cSrcweir sMargin = ' '; 759*cdf0e10cSrcweir sMargin += String::CreateFromInt32( nPercent ); 760*cdf0e10cSrcweir sMargin += '%'; 761*cdf0e10cSrcweir pUserData = new ImpUserData(&sMargin, 0); 762*cdf0e10cSrcweir aCheckLB.SetUserData( MERGE_SINGLE_LINE_PARA, pUserData ); 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir aCheckLB.CheckEntryPos( APPLY_NUMBERING, CBCOL_SECOND, pOpt->bSetNumRule ); 765*cdf0e10cSrcweir 766*cdf0e10cSrcweir aByInputBulletFont = pOpt->aByInputBulletFont; 767*cdf0e10cSrcweir sByInputBulletChar = pOpt->cByInputBullet; 768*cdf0e10cSrcweir ImpUserData* pUserData2 = new ImpUserData(&sByInputBulletChar, &aByInputBulletFont); 769*cdf0e10cSrcweir aCheckLB.SetUserData( APPLY_NUMBERING , pUserData2 ); 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir aCheckLB.CheckEntryPos( MERGE_SINGLE_LINE_PARA, CBCOL_FIRST, pOpt->bRightMargin ); 772*cdf0e10cSrcweir aCheckLB.CheckEntryPos( INSERT_BORDER, CBCOL_SECOND, pOpt->bSetBorder ); 773*cdf0e10cSrcweir aCheckLB.CheckEntryPos( CREATE_TABLE, CBCOL_SECOND, pOpt->bCreateTable ); 774*cdf0e10cSrcweir aCheckLB.CheckEntryPos( REPLACE_STYLES, CBCOL_SECOND, pOpt->bReplaceStyles ); 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir aCheckLB.SetUpdateMode(sal_True); 777*cdf0e10cSrcweir } 778*cdf0e10cSrcweir 779*cdf0e10cSrcweir /*********************************************************************/ 780*cdf0e10cSrcweir /* */ 781*cdf0e10cSrcweir /*********************************************************************/ 782*cdf0e10cSrcweir 783*cdf0e10cSrcweir IMPL_LINK(OfaSwAutoFmtOptionsPage, SelectHdl, OfaACorrCheckListBox*, pBox) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir aEditPB.Enable(0 != pBox->FirstSelected()->GetUserData()); 786*cdf0e10cSrcweir return 0; 787*cdf0e10cSrcweir } 788*cdf0e10cSrcweir 789*cdf0e10cSrcweir /*********************************************************************/ 790*cdf0e10cSrcweir /* */ 791*cdf0e10cSrcweir /*********************************************************************/ 792*cdf0e10cSrcweir 793*cdf0e10cSrcweir IMPL_LINK(OfaSwAutoFmtOptionsPage, EditHdl, PushButton*, EMPTYARG) 794*cdf0e10cSrcweir { 795*cdf0e10cSrcweir sal_uLong nSelEntryPos = aCheckLB.GetSelectEntryPos(); 796*cdf0e10cSrcweir if( nSelEntryPos == REPLACE_BULLETS || 797*cdf0e10cSrcweir nSelEntryPos == APPLY_NUMBERING) 798*cdf0e10cSrcweir { 799*cdf0e10cSrcweir SvxCharacterMap *pMapDlg = new SvxCharacterMap(this); 800*cdf0e10cSrcweir ImpUserData* pUserData = (ImpUserData*)aCheckLB.FirstSelected()->GetUserData(); 801*cdf0e10cSrcweir pMapDlg->SetCharFont(*pUserData->pFont); 802*cdf0e10cSrcweir pMapDlg->SetChar( pUserData->pString->GetChar(0) ); 803*cdf0e10cSrcweir if(RET_OK == pMapDlg->Execute()) 804*cdf0e10cSrcweir { 805*cdf0e10cSrcweir Font aFont(pMapDlg->GetCharFont()); 806*cdf0e10cSrcweir *pUserData->pFont = aFont; 807*cdf0e10cSrcweir sal_UCS4 aChar = pMapDlg->GetChar(); 808*cdf0e10cSrcweir // using the UCS4 constructor 809*cdf0e10cSrcweir rtl::OUString aOUStr( &aChar, 1 ); 810*cdf0e10cSrcweir *pUserData->pString = aOUStr; 811*cdf0e10cSrcweir } 812*cdf0e10cSrcweir delete pMapDlg; 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir else if( MERGE_SINGLE_LINE_PARA == nSelEntryPos ) 815*cdf0e10cSrcweir { 816*cdf0e10cSrcweir // Dialog fuer Prozenteinstellung 817*cdf0e10cSrcweir OfaAutoFmtPrcntSet aDlg(this); 818*cdf0e10cSrcweir aDlg.GetPrcntFld().SetValue(nPercent); 819*cdf0e10cSrcweir if(RET_OK == aDlg.Execute()) 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir nPercent = (sal_uInt16)aDlg.GetPrcntFld().GetValue(); 822*cdf0e10cSrcweir sMargin = ' '; 823*cdf0e10cSrcweir sMargin += String::CreateFromInt32( nPercent ); 824*cdf0e10cSrcweir sMargin += '%'; 825*cdf0e10cSrcweir } 826*cdf0e10cSrcweir } 827*cdf0e10cSrcweir aCheckLB.Invalidate(); 828*cdf0e10cSrcweir return 0; 829*cdf0e10cSrcweir } 830*cdf0e10cSrcweir 831*cdf0e10cSrcweir /*********************************************************************/ 832*cdf0e10cSrcweir /* */ 833*cdf0e10cSrcweir /*********************************************************************/ 834*cdf0e10cSrcweir 835*cdf0e10cSrcweir void OfaACorrCheckListBox::SetTabs() 836*cdf0e10cSrcweir { 837*cdf0e10cSrcweir SvxSimpleTable::SetTabs(); 838*cdf0e10cSrcweir sal_uInt16 nAdjust = SV_LBOXTAB_ADJUST_RIGHT|SV_LBOXTAB_ADJUST_LEFT|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_ADJUST_NUMERIC|SV_LBOXTAB_FORCE; 839*cdf0e10cSrcweir 840*cdf0e10cSrcweir if( aTabs.Count() > 1 ) 841*cdf0e10cSrcweir { 842*cdf0e10cSrcweir SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(1); 843*cdf0e10cSrcweir pTab->nFlags &= ~nAdjust; 844*cdf0e10cSrcweir pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; 845*cdf0e10cSrcweir } 846*cdf0e10cSrcweir if( aTabs.Count() > 2 ) 847*cdf0e10cSrcweir { 848*cdf0e10cSrcweir SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(2); 849*cdf0e10cSrcweir pTab->nFlags &= ~nAdjust; 850*cdf0e10cSrcweir pTab->nFlags |= SV_LBOXTAB_PUSHABLE|SV_LBOXTAB_ADJUST_CENTER|SV_LBOXTAB_FORCE; 851*cdf0e10cSrcweir } 852*cdf0e10cSrcweir } 853*cdf0e10cSrcweir 854*cdf0e10cSrcweir /*********************************************************************/ 855*cdf0e10cSrcweir /* */ 856*cdf0e10cSrcweir /*********************************************************************/ 857*cdf0e10cSrcweir 858*cdf0e10cSrcweir void OfaACorrCheckListBox::CheckEntryPos(sal_uLong nPos, sal_uInt16 nCol, sal_Bool bChecked) 859*cdf0e10cSrcweir { 860*cdf0e10cSrcweir if ( nPos < GetEntryCount() ) 861*cdf0e10cSrcweir SetCheckButtonState( 862*cdf0e10cSrcweir GetEntry(nPos), 863*cdf0e10cSrcweir nCol, 864*cdf0e10cSrcweir bChecked ? SvButtonState( SV_BUTTON_CHECKED ) : 865*cdf0e10cSrcweir SvButtonState( SV_BUTTON_UNCHECKED ) ); 866*cdf0e10cSrcweir } 867*cdf0e10cSrcweir 868*cdf0e10cSrcweir /*********************************************************************/ 869*cdf0e10cSrcweir /* */ 870*cdf0e10cSrcweir /*********************************************************************/ 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir sal_Bool OfaACorrCheckListBox::IsChecked(sal_uLong nPos, sal_uInt16 nCol) 873*cdf0e10cSrcweir { 874*cdf0e10cSrcweir return GetCheckButtonState( GetEntry(nPos), nCol ) == SV_BUTTON_CHECKED; 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir 877*cdf0e10cSrcweir /*********************************************************************/ 878*cdf0e10cSrcweir /* */ 879*cdf0e10cSrcweir /*********************************************************************/ 880*cdf0e10cSrcweir 881*cdf0e10cSrcweir void OfaACorrCheckListBox::SetCheckButtonState( SvLBoxEntry* pEntry, sal_uInt16 nCol, SvButtonState eState) 882*cdf0e10cSrcweir { 883*cdf0e10cSrcweir SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); 884*cdf0e10cSrcweir 885*cdf0e10cSrcweir DBG_ASSERT(pItem,"SetCheckButton:Item not found"); 886*cdf0e10cSrcweir if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) 887*cdf0e10cSrcweir { 888*cdf0e10cSrcweir switch( eState ) 889*cdf0e10cSrcweir { 890*cdf0e10cSrcweir case SV_BUTTON_CHECKED: 891*cdf0e10cSrcweir pItem->SetStateChecked(); 892*cdf0e10cSrcweir break; 893*cdf0e10cSrcweir 894*cdf0e10cSrcweir case SV_BUTTON_UNCHECKED: 895*cdf0e10cSrcweir pItem->SetStateUnchecked(); 896*cdf0e10cSrcweir break; 897*cdf0e10cSrcweir 898*cdf0e10cSrcweir case SV_BUTTON_TRISTATE: 899*cdf0e10cSrcweir pItem->SetStateTristate(); 900*cdf0e10cSrcweir break; 901*cdf0e10cSrcweir } 902*cdf0e10cSrcweir InvalidateEntry( pEntry ); 903*cdf0e10cSrcweir } 904*cdf0e10cSrcweir } 905*cdf0e10cSrcweir 906*cdf0e10cSrcweir /*********************************************************************/ 907*cdf0e10cSrcweir /* */ 908*cdf0e10cSrcweir /*********************************************************************/ 909*cdf0e10cSrcweir 910*cdf0e10cSrcweir SvButtonState OfaACorrCheckListBox::GetCheckButtonState( SvLBoxEntry* pEntry, sal_uInt16 nCol ) const 911*cdf0e10cSrcweir { 912*cdf0e10cSrcweir SvButtonState eState = SV_BUTTON_UNCHECKED; 913*cdf0e10cSrcweir SvLBoxButton* pItem = (SvLBoxButton*)(pEntry->GetItem(nCol + 1)); 914*cdf0e10cSrcweir DBG_ASSERT(pItem,"GetChButnState:Item not found"); 915*cdf0e10cSrcweir 916*cdf0e10cSrcweir if (((SvLBoxItem*)pItem)->IsA() == SV_ITEM_ID_LBOXBUTTON) 917*cdf0e10cSrcweir { 918*cdf0e10cSrcweir sal_uInt16 nButtonFlags = pItem->GetButtonFlags(); 919*cdf0e10cSrcweir eState = pCheckButtonData->ConvertToButtonState( nButtonFlags ); 920*cdf0e10cSrcweir } 921*cdf0e10cSrcweir 922*cdf0e10cSrcweir return eState; 923*cdf0e10cSrcweir } 924*cdf0e10cSrcweir 925*cdf0e10cSrcweir void OfaACorrCheckListBox::HBarClick() 926*cdf0e10cSrcweir { 927*cdf0e10cSrcweir // Sortierung durch diese Ueberladung abgeklemmt 928*cdf0e10cSrcweir } 929*cdf0e10cSrcweir /* -----------------------------22.05.2002 11:06------------------------------ 930*cdf0e10cSrcweir 931*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 932*cdf0e10cSrcweir void OfaACorrCheckListBox::KeyInput( const KeyEvent& rKEvt ) 933*cdf0e10cSrcweir { 934*cdf0e10cSrcweir if(!rKEvt.GetKeyCode().GetModifier() && 935*cdf0e10cSrcweir KEY_SPACE == rKEvt.GetKeyCode().GetCode()) 936*cdf0e10cSrcweir { 937*cdf0e10cSrcweir sal_uLong nSelPos = GetSelectEntryPos(); 938*cdf0e10cSrcweir sal_uInt16 nCol = GetCurrentTabPos() - 1; 939*cdf0e10cSrcweir if ( nCol < 2 ) 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir CheckEntryPos( nSelPos, nCol, !IsChecked( nSelPos, nCol ) ); 942*cdf0e10cSrcweir CallImplEventListeners( VCLEVENT_CHECKBOX_TOGGLE, (void*)GetEntry( nSelPos ) ); 943*cdf0e10cSrcweir } 944*cdf0e10cSrcweir else 945*cdf0e10cSrcweir { 946*cdf0e10cSrcweir sal_uInt16 nCheck = IsChecked(nSelPos, 1) ? 1 : 0; 947*cdf0e10cSrcweir if(IsChecked(nSelPos, 0)) 948*cdf0e10cSrcweir nCheck += 2; 949*cdf0e10cSrcweir nCheck--; 950*cdf0e10cSrcweir nCheck &= 3; 951*cdf0e10cSrcweir CheckEntryPos(nSelPos, 1, 0 != (nCheck & 1)); 952*cdf0e10cSrcweir CheckEntryPos(nSelPos, 0, 0 != (nCheck & 2)); 953*cdf0e10cSrcweir } 954*cdf0e10cSrcweir } 955*cdf0e10cSrcweir else 956*cdf0e10cSrcweir SvxSimpleTable::KeyInput(rKEvt); 957*cdf0e10cSrcweir } 958*cdf0e10cSrcweir /* -----------------19.11.98 15:57------------------- 959*cdf0e10cSrcweir * 960*cdf0e10cSrcweir * --------------------------------------------------*/ 961*cdf0e10cSrcweir struct DoubleString 962*cdf0e10cSrcweir { 963*cdf0e10cSrcweir String sShort; 964*cdf0e10cSrcweir String sLong; 965*cdf0e10cSrcweir void* pUserData; // CheckBox -> form. Text Bool -> Selektionstext 966*cdf0e10cSrcweir }; 967*cdf0e10cSrcweir typedef DoubleString* DoubleStringPtr; 968*cdf0e10cSrcweir SV_DECL_PTRARR_DEL(DoubleStringArray, DoubleStringPtr, 4, 4) 969*cdf0e10cSrcweir SV_IMPL_PTRARR(DoubleStringArray, DoubleStringPtr); 970*cdf0e10cSrcweir 971*cdf0e10cSrcweir /* -----------------19.11.98 16:07------------------- 972*cdf0e10cSrcweir * 973*cdf0e10cSrcweir * --------------------------------------------------*/ 974*cdf0e10cSrcweir void lcl_ClearTable(DoubleStringTable& rTable) 975*cdf0e10cSrcweir { 976*cdf0e10cSrcweir DoubleStringArrayPtr pArray = rTable.Last(); 977*cdf0e10cSrcweir while(pArray) 978*cdf0e10cSrcweir { 979*cdf0e10cSrcweir pArray->DeleteAndDestroy(0, pArray->Count()); 980*cdf0e10cSrcweir delete pArray; 981*cdf0e10cSrcweir pArray = rTable.Prev(); 982*cdf0e10cSrcweir } 983*cdf0e10cSrcweir rTable.Clear(); 984*cdf0e10cSrcweir } 985*cdf0e10cSrcweir 986*cdf0e10cSrcweir /*-----------------14.10.96 15.57------------------- 987*cdf0e10cSrcweir 988*cdf0e10cSrcweir --------------------------------------------------*/ 989*cdf0e10cSrcweir 990*cdf0e10cSrcweir OfaAutocorrReplacePage::OfaAutocorrReplacePage( Window* pParent, 991*cdf0e10cSrcweir const SfxItemSet& rSet ) : 992*cdf0e10cSrcweir SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_AUTOCORR_REPLACE ), rSet), 993*cdf0e10cSrcweir aTextOnlyCB( this, CUI_RES(CB_TEXT_ONLY )), 994*cdf0e10cSrcweir aShortFT ( this, CUI_RES(FT_SHORT )), 995*cdf0e10cSrcweir aShortED ( this, CUI_RES(ED_SHORT )), 996*cdf0e10cSrcweir aReplaceFT( this, CUI_RES(FT_REPLACE )), 997*cdf0e10cSrcweir aReplaceED( this, CUI_RES(ED_REPLACE )), 998*cdf0e10cSrcweir aReplaceTLB( this, CUI_RES(TLB_REPLACE )), 999*cdf0e10cSrcweir aNewReplacePB( this, CUI_RES(PB_NEW_REPLACE )), 1000*cdf0e10cSrcweir aDeleteReplacePB(this,CUI_RES(PB_DELETE_REPLACE )), 1001*cdf0e10cSrcweir sModify(CUI_RES(STR_MODIFY)), 1002*cdf0e10cSrcweir sNew(aNewReplacePB.GetText()), 1003*cdf0e10cSrcweir pFormatText(0), 1004*cdf0e10cSrcweir eLang(eLastDialogLanguage), 1005*cdf0e10cSrcweir bHasSelectionText(sal_False), 1006*cdf0e10cSrcweir bFirstSelect(sal_True), 1007*cdf0e10cSrcweir bReplaceEditChanged(sal_False), 1008*cdf0e10cSrcweir bSWriter(sal_True) 1009*cdf0e10cSrcweir { 1010*cdf0e10cSrcweir FreeResource(); 1011*cdf0e10cSrcweir SfxModule *pMod = *(SfxModule**)GetAppData(SHL_WRITER); 1012*cdf0e10cSrcweir bSWriter = pMod == SfxModule::GetActiveModule(); 1013*cdf0e10cSrcweir 1014*cdf0e10cSrcweir ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); 1015*cdf0e10cSrcweir pCompareClass = new CollatorWrapper( GetProcessFact() ); 1016*cdf0e10cSrcweir pCompareCaseClass = new CollatorWrapper( GetProcessFact() ); 1017*cdf0e10cSrcweir pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n:: 1018*cdf0e10cSrcweir CollatorOptions::CollatorOptions_IGNORE_CASE ); 1019*cdf0e10cSrcweir pCompareCaseClass->loadDefaultCollator( aLcl, 0 ); 1020*cdf0e10cSrcweir pCharClass = new CharClass( aLcl ); 1021*cdf0e10cSrcweir 1022*cdf0e10cSrcweir static long nTabs[] = { 2 /* Tab-Count */, 1, 61 }; 1023*cdf0e10cSrcweir aReplaceTLB.SetTabs( &nTabs[0], MAP_APPFONT ); 1024*cdf0e10cSrcweir 1025*cdf0e10cSrcweir aReplaceTLB.SetStyle(aReplaceTLB.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN); 1026*cdf0e10cSrcweir aReplaceTLB.SetSelectHdl(LINK(this, OfaAutocorrReplacePage, SelectHdl)); 1027*cdf0e10cSrcweir aNewReplacePB.SetClickHdl( LINK(this, OfaAutocorrReplacePage, NewDelHdl)); 1028*cdf0e10cSrcweir aDeleteReplacePB.SetClickHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); 1029*cdf0e10cSrcweir aShortED.SetModifyHdl(LINK(this, OfaAutocorrReplacePage, ModifyHdl)); 1030*cdf0e10cSrcweir aReplaceED.SetModifyHdl(LINK(this, OfaAutocorrReplacePage, ModifyHdl)); 1031*cdf0e10cSrcweir aShortED.SetActionHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); 1032*cdf0e10cSrcweir aReplaceED.SetActionHdl(LINK(this, OfaAutocorrReplacePage, NewDelHdl)); 1033*cdf0e10cSrcweir 1034*cdf0e10cSrcweir aReplaceED.SetSpaces(sal_True); 1035*cdf0e10cSrcweir aShortED.SetSpaces(sal_True); 1036*cdf0e10cSrcweir aShortED.SetMaxTextLen(30); 1037*cdf0e10cSrcweir } 1038*cdf0e10cSrcweir 1039*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 1040*cdf0e10cSrcweir 1041*cdf0e10cSrcweir --------------------------------------------------*/ 1042*cdf0e10cSrcweir 1043*cdf0e10cSrcweir 1044*cdf0e10cSrcweir OfaAutocorrReplacePage::~OfaAutocorrReplacePage() 1045*cdf0e10cSrcweir { 1046*cdf0e10cSrcweir delete pFormatText; 1047*cdf0e10cSrcweir lcl_ClearTable(aDoubleStringTable); 1048*cdf0e10cSrcweir delete pCompareClass; 1049*cdf0e10cSrcweir delete pCompareCaseClass; 1050*cdf0e10cSrcweir delete pCharClass; 1051*cdf0e10cSrcweir } 1052*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 1053*cdf0e10cSrcweir 1054*cdf0e10cSrcweir --------------------------------------------------*/ 1055*cdf0e10cSrcweir 1056*cdf0e10cSrcweir SfxTabPage* OfaAutocorrReplacePage::Create( Window* pParent, 1057*cdf0e10cSrcweir const SfxItemSet& rSet) 1058*cdf0e10cSrcweir { 1059*cdf0e10cSrcweir return new OfaAutocorrReplacePage(pParent, rSet); 1060*cdf0e10cSrcweir } 1061*cdf0e10cSrcweir /* -----------------20.11.98 13:26------------------- 1062*cdf0e10cSrcweir * 1063*cdf0e10cSrcweir * --------------------------------------------------*/ 1064*cdf0e10cSrcweir void OfaAutocorrReplacePage::ActivatePage( const SfxItemSet& ) 1065*cdf0e10cSrcweir { 1066*cdf0e10cSrcweir if(eLang != eLastDialogLanguage) 1067*cdf0e10cSrcweir SetLanguage(eLastDialogLanguage); 1068*cdf0e10cSrcweir ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(sal_True); 1069*cdf0e10cSrcweir } 1070*cdf0e10cSrcweir /* -----------------20.11.98 13:26------------------- 1071*cdf0e10cSrcweir * 1072*cdf0e10cSrcweir * --------------------------------------------------*/ 1073*cdf0e10cSrcweir int OfaAutocorrReplacePage::DeactivatePage( SfxItemSet* ) 1074*cdf0e10cSrcweir { 1075*cdf0e10cSrcweir return LEAVE_PAGE; 1076*cdf0e10cSrcweir } 1077*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 1078*cdf0e10cSrcweir 1079*cdf0e10cSrcweir --------------------------------------------------*/ 1080*cdf0e10cSrcweir 1081*cdf0e10cSrcweir sal_Bool OfaAutocorrReplacePage::FillItemSet( SfxItemSet& ) 1082*cdf0e10cSrcweir { 1083*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 1084*cdf0e10cSrcweir DoubleStringArrayPtr pDoubleStringArray = aDoubleStringTable.Last(); 1085*cdf0e10cSrcweir while(pDoubleStringArray) 1086*cdf0e10cSrcweir { 1087*cdf0e10cSrcweir LanguageType eCurLang = (LanguageType)aDoubleStringTable.GetCurKey(); 1088*cdf0e10cSrcweir if(eCurLang != eLang) // die aktuelle Sprache wird weiter hinten behandelt 1089*cdf0e10cSrcweir { 1090*cdf0e10cSrcweir SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eCurLang); 1091*cdf0e10cSrcweir sal_uInt16 nWordListCount = pWordList->Count(); 1092*cdf0e10cSrcweir sal_uInt16 nDoubleStringArrayCount = pDoubleStringArray->Count(); 1093*cdf0e10cSrcweir sal_uInt16 nPos = nDoubleStringArrayCount; 1094*cdf0e10cSrcweir sal_uInt16 nLastPos = nPos; 1095*cdf0e10cSrcweir // 1. Durchlauf: Eintraege loeschen oder veraendern: 1096*cdf0e10cSrcweir 1097*cdf0e10cSrcweir 1098*cdf0e10cSrcweir for( sal_uInt16 nWordListPos = nWordListCount; nWordListPos; nWordListPos-- ) 1099*cdf0e10cSrcweir { 1100*cdf0e10cSrcweir SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(nWordListPos - 1); 1101*cdf0e10cSrcweir String sEntry(pWordPtr->GetShort()); 1102*cdf0e10cSrcweir // formatierter Text steht nur im Writer 1103*cdf0e10cSrcweir sal_Bool bFound = !bSWriter && !pWordPtr->IsTextOnly(); 1104*cdf0e10cSrcweir while(!bFound && nPos) 1105*cdf0e10cSrcweir { 1106*cdf0e10cSrcweir DoubleString* pDouble = pDoubleStringArray->GetObject( nPos - 1); 1107*cdf0e10cSrcweir 1108*cdf0e10cSrcweir if( 0 == pCompareClass->compareString( 1109*cdf0e10cSrcweir sEntry, pDouble->sShort )) 1110*cdf0e10cSrcweir { 1111*cdf0e10cSrcweir nLastPos = nPos - 1; 1112*cdf0e10cSrcweir bFound = sal_True; 1113*cdf0e10cSrcweir if( !(pWordPtr->IsTextOnly() == (0 == pDouble->pUserData) 1114*cdf0e10cSrcweir && 0 == pCompareCaseClass->compareString( 1115*cdf0e10cSrcweir pWordPtr->GetLong(), pDouble->sLong ) ) ) 1116*cdf0e10cSrcweir { 1117*cdf0e10cSrcweir pAutoCorrect->PutText(sEntry, pDouble->sLong, eCurLang); 1118*cdf0e10cSrcweir } 1119*cdf0e10cSrcweir pDoubleStringArray->DeleteAndDestroy(nPos - 1, 1); 1120*cdf0e10cSrcweir break; 1121*cdf0e10cSrcweir } 1122*cdf0e10cSrcweir nPos--; 1123*cdf0e10cSrcweir } 1124*cdf0e10cSrcweir nPos = nLastPos; 1125*cdf0e10cSrcweir if(!bFound) 1126*cdf0e10cSrcweir { 1127*cdf0e10cSrcweir pAutoCorrect->DeleteText(sEntry, eCurLang); 1128*cdf0e10cSrcweir } 1129*cdf0e10cSrcweir } 1130*cdf0e10cSrcweir nDoubleStringArrayCount = pDoubleStringArray->Count(); 1131*cdf0e10cSrcweir for(sal_uInt16 nDoubleStringArrayPos = 0; nDoubleStringArrayPos < nDoubleStringArrayCount; nDoubleStringArrayPos++ ) 1132*cdf0e10cSrcweir { 1133*cdf0e10cSrcweir //jetzt sollte es nur noch neue Eintraege geben 1134*cdf0e10cSrcweir DoubleString* pDouble = pDoubleStringArray->GetObject( nDoubleStringArrayPos ); 1135*cdf0e10cSrcweir if(pDouble->pUserData == &bHasSelectionText) 1136*cdf0e10cSrcweir pAutoCorrect->PutText( pDouble->sShort, 1137*cdf0e10cSrcweir *SfxObjectShell::Current(), eCurLang ); 1138*cdf0e10cSrcweir else 1139*cdf0e10cSrcweir { 1140*cdf0e10cSrcweir pAutoCorrect->PutText( pDouble->sShort, pDouble->sLong, 1141*cdf0e10cSrcweir eCurLang); 1142*cdf0e10cSrcweir } 1143*cdf0e10cSrcweir } 1144*cdf0e10cSrcweir } 1145*cdf0e10cSrcweir pDoubleStringArray->DeleteAndDestroy(0, pDoubleStringArray->Count()); 1146*cdf0e10cSrcweir delete pDoubleStringArray; 1147*cdf0e10cSrcweir pDoubleStringArray = aDoubleStringTable.Prev(); 1148*cdf0e10cSrcweir } 1149*cdf0e10cSrcweir aDoubleStringTable.Clear(); 1150*cdf0e10cSrcweir // jetzt noch die aktuelle Selektion 1151*cdf0e10cSrcweir SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang); 1152*cdf0e10cSrcweir sal_uInt16 nWordListCount = pWordList->Count(); 1153*cdf0e10cSrcweir sal_uInt16 nListBoxCount = (sal_uInt16)aReplaceTLB.GetEntryCount(); 1154*cdf0e10cSrcweir 1155*cdf0e10cSrcweir aReplaceTLB.SetUpdateMode(sal_False); 1156*cdf0e10cSrcweir sal_uInt16 nListBoxPos = nListBoxCount; 1157*cdf0e10cSrcweir sal_uInt16 nLastListBoxPos = nListBoxPos; 1158*cdf0e10cSrcweir // 1. Durchlauf: Eintraege loeschen oder veraendern: 1159*cdf0e10cSrcweir 1160*cdf0e10cSrcweir sal_uInt16 i; 1161*cdf0e10cSrcweir for( i = nWordListCount; i; i-- ) 1162*cdf0e10cSrcweir { 1163*cdf0e10cSrcweir SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(i- 1); 1164*cdf0e10cSrcweir String sEntry(pWordPtr->GetShort()); 1165*cdf0e10cSrcweir // formatierter Text steht nur im Writer 1166*cdf0e10cSrcweir sal_Bool bFound = !bSWriter && !pWordPtr->IsTextOnly(); 1167*cdf0e10cSrcweir while(!bFound && nListBoxPos) 1168*cdf0e10cSrcweir { 1169*cdf0e10cSrcweir SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( nListBoxPos - 1); 1170*cdf0e10cSrcweir if( 0 == pCompareClass->compareString( sEntry, 1171*cdf0e10cSrcweir aReplaceTLB.GetEntryText(pEntry, 0))) 1172*cdf0e10cSrcweir { 1173*cdf0e10cSrcweir nLastListBoxPos = nListBoxPos - 1; 1174*cdf0e10cSrcweir bFound = sal_True; 1175*cdf0e10cSrcweir String sLong = aReplaceTLB.GetEntryText(pEntry, 1); 1176*cdf0e10cSrcweir if( !(pWordPtr->IsTextOnly() == (0 == pEntry->GetUserData()) 1177*cdf0e10cSrcweir && 0 == pCompareCaseClass->compareString( 1178*cdf0e10cSrcweir pWordPtr->GetLong(), sLong ))) 1179*cdf0e10cSrcweir { 1180*cdf0e10cSrcweir pAutoCorrect->PutText(sEntry, sLong, eLang); 1181*cdf0e10cSrcweir } 1182*cdf0e10cSrcweir aReplaceTLB.GetModel()->Remove(pEntry); 1183*cdf0e10cSrcweir break; 1184*cdf0e10cSrcweir 1185*cdf0e10cSrcweir } 1186*cdf0e10cSrcweir nListBoxPos --; 1187*cdf0e10cSrcweir } 1188*cdf0e10cSrcweir nListBoxPos = nLastListBoxPos; 1189*cdf0e10cSrcweir if(!bFound) 1190*cdf0e10cSrcweir { 1191*cdf0e10cSrcweir pAutoCorrect->DeleteText(sEntry, eLang); 1192*cdf0e10cSrcweir } 1193*cdf0e10cSrcweir 1194*cdf0e10cSrcweir } 1195*cdf0e10cSrcweir nListBoxCount = (sal_uInt16)aReplaceTLB.GetEntryCount(); 1196*cdf0e10cSrcweir for(i = 0; i < nListBoxCount; i++ ) 1197*cdf0e10cSrcweir { 1198*cdf0e10cSrcweir //jetzt sollte es nur noch neue Eintraege geben 1199*cdf0e10cSrcweir SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); 1200*cdf0e10cSrcweir String sShort = aReplaceTLB.GetEntryText(pEntry, 0); 1201*cdf0e10cSrcweir if(pEntry->GetUserData() == &bHasSelectionText) 1202*cdf0e10cSrcweir pAutoCorrect->PutText(sShort, *SfxObjectShell::Current(), eLang); 1203*cdf0e10cSrcweir else 1204*cdf0e10cSrcweir { 1205*cdf0e10cSrcweir String sLong = aReplaceTLB.GetEntryText(pEntry, 1); 1206*cdf0e10cSrcweir pAutoCorrect->PutText(sShort, sLong, eLang); 1207*cdf0e10cSrcweir } 1208*cdf0e10cSrcweir } 1209*cdf0e10cSrcweir 1210*cdf0e10cSrcweir return sal_False; 1211*cdf0e10cSrcweir } 1212*cdf0e10cSrcweir 1213*cdf0e10cSrcweir /* -----------------19.11.98 13:16------------------- 1214*cdf0e10cSrcweir * 1215*cdf0e10cSrcweir * --------------------------------------------------*/ 1216*cdf0e10cSrcweir void OfaAutocorrReplacePage::RefillReplaceBox(sal_Bool bFromReset, 1217*cdf0e10cSrcweir LanguageType eOldLanguage, 1218*cdf0e10cSrcweir LanguageType eNewLanguage) 1219*cdf0e10cSrcweir { 1220*cdf0e10cSrcweir eLang = eNewLanguage; 1221*cdf0e10cSrcweir if(bFromReset) 1222*cdf0e10cSrcweir lcl_ClearTable(aDoubleStringTable); 1223*cdf0e10cSrcweir else 1224*cdf0e10cSrcweir { 1225*cdf0e10cSrcweir DoubleStringArray* pArray = 0; 1226*cdf0e10cSrcweir if(aDoubleStringTable.IsKeyValid(eOldLanguage)) 1227*cdf0e10cSrcweir { 1228*cdf0e10cSrcweir pArray = aDoubleStringTable.Seek(sal_uLong(eOldLanguage)); 1229*cdf0e10cSrcweir pArray->DeleteAndDestroy(0, pArray->Count()); 1230*cdf0e10cSrcweir } 1231*cdf0e10cSrcweir else 1232*cdf0e10cSrcweir { 1233*cdf0e10cSrcweir pArray = new DoubleStringArray; 1234*cdf0e10cSrcweir aDoubleStringTable.Insert(sal_uLong(eOldLanguage), pArray); 1235*cdf0e10cSrcweir } 1236*cdf0e10cSrcweir 1237*cdf0e10cSrcweir sal_uInt16 nListBoxCount = (sal_uInt16)aReplaceTLB.GetEntryCount(); 1238*cdf0e10cSrcweir sal_uInt16 i; 1239*cdf0e10cSrcweir for(i = 0; i < nListBoxCount; i++) 1240*cdf0e10cSrcweir { 1241*cdf0e10cSrcweir DoubleString* pDouble = new DoubleString(); 1242*cdf0e10cSrcweir SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); 1243*cdf0e10cSrcweir pDouble->sShort = aReplaceTLB.GetEntryText(pEntry, 0); 1244*cdf0e10cSrcweir pDouble->sLong = aReplaceTLB.GetEntryText(pEntry, 1); 1245*cdf0e10cSrcweir pDouble->pUserData = pEntry->GetUserData(); 1246*cdf0e10cSrcweir pArray->Insert(pDouble, i); 1247*cdf0e10cSrcweir } 1248*cdf0e10cSrcweir } 1249*cdf0e10cSrcweir 1250*cdf0e10cSrcweir aReplaceTLB.Clear(); 1251*cdf0e10cSrcweir if(!bSWriter) 1252*cdf0e10cSrcweir { 1253*cdf0e10cSrcweir if(pFormatText) 1254*cdf0e10cSrcweir pFormatText->DeleteAndDestroy(0, pFormatText->Count()); 1255*cdf0e10cSrcweir else 1256*cdf0e10cSrcweir pFormatText = new SvStringsISortDtor(); 1257*cdf0e10cSrcweir } 1258*cdf0e10cSrcweir 1259*cdf0e10cSrcweir if(aDoubleStringTable.IsKeyValid(eLang)) 1260*cdf0e10cSrcweir { 1261*cdf0e10cSrcweir DoubleStringArray* pArray = aDoubleStringTable.Seek(sal_uLong(eNewLanguage)); 1262*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < pArray->Count(); i++) 1263*cdf0e10cSrcweir { 1264*cdf0e10cSrcweir DoubleString* pDouble = pArray->GetObject(i); 1265*cdf0e10cSrcweir sal_Bool bTextOnly = 0 == pDouble->pUserData; 1266*cdf0e10cSrcweir // formatierter Text wird nur im Writer angeboten 1267*cdf0e10cSrcweir if(bSWriter || bTextOnly) 1268*cdf0e10cSrcweir { 1269*cdf0e10cSrcweir String sEntry(pDouble->sShort); 1270*cdf0e10cSrcweir sEntry += '\t'; 1271*cdf0e10cSrcweir sEntry += pDouble->sLong; 1272*cdf0e10cSrcweir SvLBoxEntry* pEntry = aReplaceTLB.InsertEntry(sEntry); 1273*cdf0e10cSrcweir aTextOnlyCB.Check(bTextOnly); 1274*cdf0e10cSrcweir if(!bTextOnly) 1275*cdf0e10cSrcweir pEntry->SetUserData(pDouble->pUserData); // Das heisst: mit Formatinfo oder sogar mit Selektionstext 1276*cdf0e10cSrcweir } 1277*cdf0e10cSrcweir else 1278*cdf0e10cSrcweir { 1279*cdf0e10cSrcweir pFormatText->Insert(new String(pDouble->sShort)); 1280*cdf0e10cSrcweir } 1281*cdf0e10cSrcweir } 1282*cdf0e10cSrcweir } 1283*cdf0e10cSrcweir else 1284*cdf0e10cSrcweir { 1285*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 1286*cdf0e10cSrcweir SvxAutocorrWordList* pWordList = pAutoCorrect->LoadAutocorrWordList(eLang); 1287*cdf0e10cSrcweir 1288*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < pWordList->Count(); i++) 1289*cdf0e10cSrcweir { 1290*cdf0e10cSrcweir SvxAutocorrWordPtr pWordPtr = pWordList->GetObject(i); 1291*cdf0e10cSrcweir sal_Bool bTextOnly = pWordPtr->IsTextOnly(); 1292*cdf0e10cSrcweir // formatierter Text wird nur im Writer angeboten 1293*cdf0e10cSrcweir if(bSWriter || bTextOnly) 1294*cdf0e10cSrcweir { 1295*cdf0e10cSrcweir String sEntry(pWordPtr->GetShort()); 1296*cdf0e10cSrcweir sEntry += '\t'; 1297*cdf0e10cSrcweir sEntry += pWordPtr->GetLong(); 1298*cdf0e10cSrcweir SvLBoxEntry* pEntry = aReplaceTLB.InsertEntry(sEntry); 1299*cdf0e10cSrcweir aTextOnlyCB.Check(pWordPtr->IsTextOnly()); 1300*cdf0e10cSrcweir if(!bTextOnly) 1301*cdf0e10cSrcweir pEntry->SetUserData(&aTextOnlyCB); // Das heisst: mit Formatinfo 1302*cdf0e10cSrcweir } 1303*cdf0e10cSrcweir else 1304*cdf0e10cSrcweir { 1305*cdf0e10cSrcweir pFormatText->Insert(new String(pWordPtr->GetShort())); 1306*cdf0e10cSrcweir } 1307*cdf0e10cSrcweir } 1308*cdf0e10cSrcweir aNewReplacePB.Enable(sal_False); 1309*cdf0e10cSrcweir aDeleteReplacePB.Enable(sal_False); 1310*cdf0e10cSrcweir 1311*cdf0e10cSrcweir } 1312*cdf0e10cSrcweir 1313*cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::Current(); 1314*cdf0e10cSrcweir if( pViewShell && pViewShell->HasSelection( sal_True ) ) 1315*cdf0e10cSrcweir { 1316*cdf0e10cSrcweir bHasSelectionText = sal_True; 1317*cdf0e10cSrcweir const String sSelection( pViewShell->GetSelectionText() ); 1318*cdf0e10cSrcweir aReplaceED.SetText( sSelection ); 1319*cdf0e10cSrcweir aTextOnlyCB.Check( !bSWriter ); 1320*cdf0e10cSrcweir aTextOnlyCB.Enable( bSWriter && sSelection.Len() ); 1321*cdf0e10cSrcweir } 1322*cdf0e10cSrcweir else 1323*cdf0e10cSrcweir aTextOnlyCB.Enable( sal_False ); 1324*cdf0e10cSrcweir } 1325*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 1326*cdf0e10cSrcweir 1327*cdf0e10cSrcweir --------------------------------------------------*/ 1328*cdf0e10cSrcweir 1329*cdf0e10cSrcweir void OfaAutocorrReplacePage::Reset( const SfxItemSet& ) 1330*cdf0e10cSrcweir { 1331*cdf0e10cSrcweir RefillReplaceBox(sal_True, eLang, eLang); 1332*cdf0e10cSrcweir aShortED.GrabFocus(); 1333*cdf0e10cSrcweir } 1334*cdf0e10cSrcweir 1335*cdf0e10cSrcweir /* -----------------23.11.98 10:33------------------- 1336*cdf0e10cSrcweir * 1337*cdf0e10cSrcweir * --------------------------------------------------*/ 1338*cdf0e10cSrcweir void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet) 1339*cdf0e10cSrcweir { 1340*cdf0e10cSrcweir //save old settings an refill 1341*cdf0e10cSrcweir if(eSet != eLang) 1342*cdf0e10cSrcweir { 1343*cdf0e10cSrcweir RefillReplaceBox(sal_False, eLang, eSet); 1344*cdf0e10cSrcweir eLastDialogLanguage = eSet; 1345*cdf0e10cSrcweir delete pCompareClass; 1346*cdf0e10cSrcweir delete pCompareCaseClass; 1347*cdf0e10cSrcweir delete pCharClass; 1348*cdf0e10cSrcweir 1349*cdf0e10cSrcweir ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); 1350*cdf0e10cSrcweir pCompareClass = new CollatorWrapper( GetProcessFact() ); 1351*cdf0e10cSrcweir pCompareCaseClass = new CollatorWrapper( GetProcessFact() ); 1352*cdf0e10cSrcweir pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n:: 1353*cdf0e10cSrcweir CollatorOptions::CollatorOptions_IGNORE_CASE ); 1354*cdf0e10cSrcweir pCompareCaseClass->loadDefaultCollator( aLcl, 0 ); 1355*cdf0e10cSrcweir pCharClass = new CharClass( aLcl ); 1356*cdf0e10cSrcweir ModifyHdl(&aShortED); 1357*cdf0e10cSrcweir } 1358*cdf0e10cSrcweir } 1359*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 1360*cdf0e10cSrcweir 1361*cdf0e10cSrcweir --------------------------------------------------*/ 1362*cdf0e10cSrcweir 1363*cdf0e10cSrcweir 1364*cdf0e10cSrcweir IMPL_LINK(OfaAutocorrReplacePage, SelectHdl, SvTabListBox*, pBox) 1365*cdf0e10cSrcweir { 1366*cdf0e10cSrcweir if(!bFirstSelect || !bHasSelectionText) 1367*cdf0e10cSrcweir { 1368*cdf0e10cSrcweir SvLBoxEntry* pEntry = pBox->FirstSelected(); 1369*cdf0e10cSrcweir String sTmpShort(pBox->GetEntryText(pEntry, 0)); 1370*cdf0e10cSrcweir // wird der Text ueber den ModifyHdl gesetzt, dann steht der Cursor sonst immer am Wortanfang, 1371*cdf0e10cSrcweir // obwohl man gerade hier editiert 1372*cdf0e10cSrcweir sal_Bool bSameContent = 0 == pCompareClass->compareString( 1373*cdf0e10cSrcweir sTmpShort, aShortED.GetText() ); 1374*cdf0e10cSrcweir Selection aSel = aShortED.GetSelection(); 1375*cdf0e10cSrcweir if(aShortED.GetText() != sTmpShort) 1376*cdf0e10cSrcweir { 1377*cdf0e10cSrcweir aShortED.SetText(sTmpShort); 1378*cdf0e10cSrcweir //war es nur eine andere Schreibweise, dann muss die Selektion auch wieder gesetzt werden 1379*cdf0e10cSrcweir if(bSameContent) 1380*cdf0e10cSrcweir aShortED.SetSelection(aSel); 1381*cdf0e10cSrcweir } 1382*cdf0e10cSrcweir aReplaceED.SetText(pBox->GetEntryText(pEntry, 1)); 1383*cdf0e10cSrcweir // mit UserData gibt es eine Formatinfo 1384*cdf0e10cSrcweir aTextOnlyCB.Check(0 == pEntry->GetUserData()); 1385*cdf0e10cSrcweir } 1386*cdf0e10cSrcweir else 1387*cdf0e10cSrcweir bFirstSelect = sal_False; 1388*cdf0e10cSrcweir 1389*cdf0e10cSrcweir aNewReplacePB.Enable(sal_False); 1390*cdf0e10cSrcweir aDeleteReplacePB.Enable(); 1391*cdf0e10cSrcweir return 0; 1392*cdf0e10cSrcweir }; 1393*cdf0e10cSrcweir 1394*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 1395*cdf0e10cSrcweir 1396*cdf0e10cSrcweir --------------------------------------------------*/ 1397*cdf0e10cSrcweir 1398*cdf0e10cSrcweir 1399*cdf0e10cSrcweir IMPL_LINK(OfaAutocorrReplacePage, NewDelHdl, PushButton*, pBtn) 1400*cdf0e10cSrcweir { 1401*cdf0e10cSrcweir SvLBoxEntry* _pEntry = aReplaceTLB.FirstSelected(); 1402*cdf0e10cSrcweir if(pBtn == &aDeleteReplacePB) 1403*cdf0e10cSrcweir { 1404*cdf0e10cSrcweir DBG_ASSERT(_pEntry, "keine Eintrag selektiert"); 1405*cdf0e10cSrcweir if(_pEntry) 1406*cdf0e10cSrcweir { 1407*cdf0e10cSrcweir aReplaceTLB.GetModel()->Remove(_pEntry); 1408*cdf0e10cSrcweir ModifyHdl(&aShortED); 1409*cdf0e10cSrcweir return 0; 1410*cdf0e10cSrcweir } 1411*cdf0e10cSrcweir } 1412*cdf0e10cSrcweir if(pBtn == &aNewReplacePB || aNewReplacePB.IsEnabled()) 1413*cdf0e10cSrcweir { 1414*cdf0e10cSrcweir SvLBoxEntry* _pNewEntry = aReplaceTLB.FirstSelected(); 1415*cdf0e10cSrcweir String sEntry(aShortED.GetText()); 1416*cdf0e10cSrcweir if(sEntry.Len() && ( aReplaceED.GetText().Len() || 1417*cdf0e10cSrcweir ( bHasSelectionText && bSWriter ) )) 1418*cdf0e10cSrcweir { 1419*cdf0e10cSrcweir aReplaceTLB.SetUpdateMode(sal_False); 1420*cdf0e10cSrcweir sal_uInt16 nPos = USHRT_MAX; 1421*cdf0e10cSrcweir sEntry += '\t'; 1422*cdf0e10cSrcweir sEntry += aReplaceED.GetText(); 1423*cdf0e10cSrcweir if(_pNewEntry) 1424*cdf0e10cSrcweir { 1425*cdf0e10cSrcweir nPos = (sal_uInt16)aReplaceTLB.GetModel()->GetAbsPos(_pNewEntry); 1426*cdf0e10cSrcweir aReplaceTLB.GetModel()->Remove(_pNewEntry); 1427*cdf0e10cSrcweir } 1428*cdf0e10cSrcweir else 1429*cdf0e10cSrcweir { 1430*cdf0e10cSrcweir sal_uInt16 j; 1431*cdf0e10cSrcweir for( j = 0; j < aReplaceTLB.GetEntryCount(); j++ ) 1432*cdf0e10cSrcweir { 1433*cdf0e10cSrcweir SvLBoxEntry* pReplaceEntry = aReplaceTLB.GetEntry(j); 1434*cdf0e10cSrcweir if( 0 >= pCompareClass->compareString(sEntry, 1435*cdf0e10cSrcweir aReplaceTLB.GetEntryText(pReplaceEntry, 0) ) ) 1436*cdf0e10cSrcweir break; 1437*cdf0e10cSrcweir } 1438*cdf0e10cSrcweir nPos = j; 1439*cdf0e10cSrcweir } 1440*cdf0e10cSrcweir SvLBoxEntry* pInsEntry = 1441*cdf0e10cSrcweir aReplaceTLB.InsertEntry( 1442*cdf0e10cSrcweir sEntry, static_cast< SvLBoxEntry * >(NULL), false, 1443*cdf0e10cSrcweir nPos == USHRT_MAX ? LIST_APPEND : nPos); 1444*cdf0e10cSrcweir if( !bReplaceEditChanged && !aTextOnlyCB.IsChecked()) 1445*cdf0e10cSrcweir pInsEntry->SetUserData(&bHasSelectionText); // neuer formatierter Text 1446*cdf0e10cSrcweir 1447*cdf0e10cSrcweir aReplaceTLB.MakeVisible( pInsEntry ); 1448*cdf0e10cSrcweir aReplaceTLB.SetUpdateMode(sal_True); 1449*cdf0e10cSrcweir // falls der Request aus dem ReplaceEdit kam, dann Focus in das ShortEdit setzen 1450*cdf0e10cSrcweir if(aReplaceED.HasFocus()) 1451*cdf0e10cSrcweir aShortED.GrabFocus(); 1452*cdf0e10cSrcweir 1453*cdf0e10cSrcweir } 1454*cdf0e10cSrcweir } 1455*cdf0e10cSrcweir else 1456*cdf0e10cSrcweir { 1457*cdf0e10cSrcweir // das kann nur ein Enter in einem der beiden Edit-Felder sein und das 1458*cdf0e10cSrcweir // bedeutet EndDialog() - muss im KeyInput ausgewertet werden 1459*cdf0e10cSrcweir return 0; 1460*cdf0e10cSrcweir } 1461*cdf0e10cSrcweir ModifyHdl(&aShortED); 1462*cdf0e10cSrcweir return 1; 1463*cdf0e10cSrcweir } 1464*cdf0e10cSrcweir 1465*cdf0e10cSrcweir /*-----------------17.10.96 07.49------------------- 1466*cdf0e10cSrcweir 1467*cdf0e10cSrcweir --------------------------------------------------*/ 1468*cdf0e10cSrcweir IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, Edit*, pEdt) 1469*cdf0e10cSrcweir { 1470*cdf0e10cSrcweir SvLBoxEntry* pFirstSel = aReplaceTLB.FirstSelected(); 1471*cdf0e10cSrcweir sal_Bool bShort = pEdt == &aShortED; 1472*cdf0e10cSrcweir const String rEntry = pEdt->GetText(); 1473*cdf0e10cSrcweir const String rRepString = aReplaceED.GetText(); 1474*cdf0e10cSrcweir String aWordStr( pCharClass->lower( rEntry )); 1475*cdf0e10cSrcweir 1476*cdf0e10cSrcweir if(bShort) 1477*cdf0e10cSrcweir { 1478*cdf0e10cSrcweir if(rEntry.Len()) 1479*cdf0e10cSrcweir { 1480*cdf0e10cSrcweir sal_Bool bFound = sal_False; 1481*cdf0e10cSrcweir sal_Bool bTmpSelEntry=sal_False; 1482*cdf0e10cSrcweir 1483*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < aReplaceTLB.GetEntryCount(); i++) 1484*cdf0e10cSrcweir { 1485*cdf0e10cSrcweir SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( i ); 1486*cdf0e10cSrcweir String aTestStr=aReplaceTLB.GetEntryText(pEntry, 0); 1487*cdf0e10cSrcweir if( 0 == pCompareClass->compareString(rEntry, aTestStr )) 1488*cdf0e10cSrcweir { 1489*cdf0e10cSrcweir if(rRepString.Len()) 1490*cdf0e10cSrcweir bFirstSelect = sal_True; 1491*cdf0e10cSrcweir aReplaceTLB.SetCurEntry(pEntry); 1492*cdf0e10cSrcweir pFirstSel = pEntry; 1493*cdf0e10cSrcweir aNewReplacePB.SetText(sModify); 1494*cdf0e10cSrcweir bFound= sal_True; 1495*cdf0e10cSrcweir break; 1496*cdf0e10cSrcweir } 1497*cdf0e10cSrcweir else 1498*cdf0e10cSrcweir { 1499*cdf0e10cSrcweir pCharClass->toLower( aTestStr ); 1500*cdf0e10cSrcweir if(aTestStr.Search(aWordStr)==0 && !bTmpSelEntry) 1501*cdf0e10cSrcweir { 1502*cdf0e10cSrcweir aReplaceTLB.MakeVisible(pEntry); 1503*cdf0e10cSrcweir bTmpSelEntry=sal_True; 1504*cdf0e10cSrcweir } 1505*cdf0e10cSrcweir } 1506*cdf0e10cSrcweir } 1507*cdf0e10cSrcweir if(!bFound) 1508*cdf0e10cSrcweir { 1509*cdf0e10cSrcweir aReplaceTLB.SelectAll(sal_False); 1510*cdf0e10cSrcweir pFirstSel = 0; 1511*cdf0e10cSrcweir aNewReplacePB.SetText(sNew); 1512*cdf0e10cSrcweir if(bReplaceEditChanged) 1513*cdf0e10cSrcweir aTextOnlyCB.Enable(sal_False); 1514*cdf0e10cSrcweir } 1515*cdf0e10cSrcweir aDeleteReplacePB.Enable(bFound); 1516*cdf0e10cSrcweir } 1517*cdf0e10cSrcweir else if(aReplaceTLB.GetEntryCount()>0) 1518*cdf0e10cSrcweir { 1519*cdf0e10cSrcweir SvLBoxEntry* pEntry = aReplaceTLB.GetEntry( 0 ); 1520*cdf0e10cSrcweir aReplaceTLB.MakeVisible(pEntry); 1521*cdf0e10cSrcweir } 1522*cdf0e10cSrcweir 1523*cdf0e10cSrcweir } 1524*cdf0e10cSrcweir else if(!bShort) 1525*cdf0e10cSrcweir { 1526*cdf0e10cSrcweir bReplaceEditChanged = sal_True; 1527*cdf0e10cSrcweir if(pFirstSel) 1528*cdf0e10cSrcweir { 1529*cdf0e10cSrcweir aNewReplacePB.SetText(sModify); 1530*cdf0e10cSrcweir } 1531*cdf0e10cSrcweir } 1532*cdf0e10cSrcweir 1533*cdf0e10cSrcweir const String& rShortTxt = aShortED.GetText(); 1534*cdf0e10cSrcweir sal_Bool bEnableNew = rShortTxt.Len() && 1535*cdf0e10cSrcweir ( rRepString.Len() || 1536*cdf0e10cSrcweir ( bHasSelectionText && bSWriter )) && 1537*cdf0e10cSrcweir ( !pFirstSel || rRepString != 1538*cdf0e10cSrcweir aReplaceTLB.GetEntryText( pFirstSel, 1 ) ); 1539*cdf0e10cSrcweir if(bEnableNew && pFormatText) 1540*cdf0e10cSrcweir { 1541*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < pFormatText->Count(); i++) 1542*cdf0e10cSrcweir if(*pFormatText->GetObject(i) == rShortTxt) 1543*cdf0e10cSrcweir { 1544*cdf0e10cSrcweir bEnableNew = sal_False; 1545*cdf0e10cSrcweir break; 1546*cdf0e10cSrcweir } 1547*cdf0e10cSrcweir } 1548*cdf0e10cSrcweir aNewReplacePB.Enable(bEnableNew); 1549*cdf0e10cSrcweir 1550*cdf0e10cSrcweir return 0; 1551*cdf0e10cSrcweir } 1552*cdf0e10cSrcweir 1553*cdf0e10cSrcweir /* -----------------20.11.98 13:48------------------- 1554*cdf0e10cSrcweir * 1555*cdf0e10cSrcweir * --------------------------------------------------*/ 1556*cdf0e10cSrcweir 1557*cdf0e10cSrcweir struct StringsArrays 1558*cdf0e10cSrcweir { 1559*cdf0e10cSrcweir 1560*cdf0e10cSrcweir SvStringsDtor aAbbrevStrings; 1561*cdf0e10cSrcweir SvStringsDtor aDoubleCapsStrings; 1562*cdf0e10cSrcweir 1563*cdf0e10cSrcweir StringsArrays() : 1564*cdf0e10cSrcweir aAbbrevStrings(5,5), aDoubleCapsStrings(5,5) {} 1565*cdf0e10cSrcweir }; 1566*cdf0e10cSrcweir typedef StringsArrays* StringsArraysPtr; 1567*cdf0e10cSrcweir /* -----------------19.11.98 16:07------------------- 1568*cdf0e10cSrcweir * 1569*cdf0e10cSrcweir * --------------------------------------------------*/ 1570*cdf0e10cSrcweir sal_Bool lcl_FindInArray(SvStringsDtor& rStrings, const String& rString) 1571*cdf0e10cSrcweir { 1572*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < rStrings.Count(); i++) 1573*cdf0e10cSrcweir if(rString == *rStrings.GetObject(i)) 1574*cdf0e10cSrcweir return sal_True; 1575*cdf0e10cSrcweir return sal_False; 1576*cdf0e10cSrcweir } 1577*cdf0e10cSrcweir 1578*cdf0e10cSrcweir void lcl_ClearTable(StringsTable& rTable) 1579*cdf0e10cSrcweir { 1580*cdf0e10cSrcweir StringsArraysPtr pArrays = rTable.Last(); 1581*cdf0e10cSrcweir while(pArrays) 1582*cdf0e10cSrcweir { 1583*cdf0e10cSrcweir delete pArrays; 1584*cdf0e10cSrcweir pArrays = rTable.Prev(); 1585*cdf0e10cSrcweir } 1586*cdf0e10cSrcweir rTable.Clear(); 1587*cdf0e10cSrcweir } 1588*cdf0e10cSrcweir 1589*cdf0e10cSrcweir /*-----------------14.10.96 15.57------------------- 1590*cdf0e10cSrcweir 1591*cdf0e10cSrcweir --------------------------------------------------*/ 1592*cdf0e10cSrcweir 1593*cdf0e10cSrcweir OfaAutocorrExceptPage::OfaAutocorrExceptPage( Window* pParent, 1594*cdf0e10cSrcweir const SfxItemSet& rSet ) : 1595*cdf0e10cSrcweir SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_AUTOCORR_EXCEPT ), rSet), 1596*cdf0e10cSrcweir aAbbrevFL (this, CUI_RES(FL_ABBREV )), 1597*cdf0e10cSrcweir aAbbrevED (this, CUI_RES(ED_ABBREV )), 1598*cdf0e10cSrcweir aAbbrevLB (this, CUI_RES(LB_ABBREV )), 1599*cdf0e10cSrcweir aNewAbbrevPB (this, CUI_RES(PB_NEWABBREV )), 1600*cdf0e10cSrcweir aDelAbbrevPB (this, CUI_RES(PB_DELABBREV )), 1601*cdf0e10cSrcweir aAutoAbbrevCB (this, CUI_RES(CB_AUTOABBREV )), 1602*cdf0e10cSrcweir aDoubleCapsFL (this, CUI_RES(FL_DOUBLECAPS )), 1603*cdf0e10cSrcweir aDoubleCapsED (this, CUI_RES(ED_DOUBLE_CAPS )), 1604*cdf0e10cSrcweir aDoubleCapsLB (this, CUI_RES(LB_DOUBLE_CAPS )), 1605*cdf0e10cSrcweir aNewDoublePB (this, CUI_RES(PB_NEWDOUBLECAPS)), 1606*cdf0e10cSrcweir aDelDoublePB (this, CUI_RES(PB_DELDOUBLECAPS)), 1607*cdf0e10cSrcweir aAutoCapsCB (this, CUI_RES(CB_AUTOCAPS )), 1608*cdf0e10cSrcweir eLang(eLastDialogLanguage) 1609*cdf0e10cSrcweir { 1610*cdf0e10cSrcweir aNewAbbrevPB.SetAccessibleName(String(CUI_RES(STR_PB_NEWABBREV) ) ); 1611*cdf0e10cSrcweir aDelAbbrevPB.SetAccessibleName(String(CUI_RES(STR_PB_DELABBREV) ) ); 1612*cdf0e10cSrcweir aNewDoublePB.SetAccessibleName(String(CUI_RES(STR_PB_NEWDOUBLECAPS) ) ); 1613*cdf0e10cSrcweir aDelDoublePB.SetAccessibleName(String(CUI_RES(STR_PB_DELDOUBLECAPS) ) ); 1614*cdf0e10cSrcweir 1615*cdf0e10cSrcweir FreeResource(); 1616*cdf0e10cSrcweir 1617*cdf0e10cSrcweir ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage )); 1618*cdf0e10cSrcweir pCompareClass = new CollatorWrapper( GetProcessFact() ); 1619*cdf0e10cSrcweir pCompareClass->loadDefaultCollator( aLcl, ::com::sun::star::i18n:: 1620*cdf0e10cSrcweir CollatorOptions::CollatorOptions_IGNORE_CASE ); 1621*cdf0e10cSrcweir 1622*cdf0e10cSrcweir aNewAbbrevPB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); 1623*cdf0e10cSrcweir aDelAbbrevPB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); 1624*cdf0e10cSrcweir aNewDoublePB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); 1625*cdf0e10cSrcweir aDelDoublePB.SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); 1626*cdf0e10cSrcweir 1627*cdf0e10cSrcweir aAbbrevLB.SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); 1628*cdf0e10cSrcweir aDoubleCapsLB.SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); 1629*cdf0e10cSrcweir aAbbrevED.SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); 1630*cdf0e10cSrcweir aDoubleCapsED.SetModifyHdl(LINK(this, OfaAutocorrExceptPage, ModifyHdl)); 1631*cdf0e10cSrcweir 1632*cdf0e10cSrcweir aAbbrevED.SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); 1633*cdf0e10cSrcweir aDoubleCapsED.SetActionHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); 1634*cdf0e10cSrcweir 1635*cdf0e10cSrcweir aNewAbbrevPB.SetAccessibleRelationMemberOf(&aAbbrevFL); 1636*cdf0e10cSrcweir aDelAbbrevPB.SetAccessibleRelationMemberOf(&aAbbrevFL); 1637*cdf0e10cSrcweir aNewDoublePB.SetAccessibleRelationMemberOf(&aDoubleCapsFL); 1638*cdf0e10cSrcweir aDelDoublePB.SetAccessibleRelationMemberOf(&aDoubleCapsFL); 1639*cdf0e10cSrcweir } 1640*cdf0e10cSrcweir 1641*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 1642*cdf0e10cSrcweir 1643*cdf0e10cSrcweir --------------------------------------------------*/ 1644*cdf0e10cSrcweir 1645*cdf0e10cSrcweir OfaAutocorrExceptPage::~OfaAutocorrExceptPage() 1646*cdf0e10cSrcweir { 1647*cdf0e10cSrcweir lcl_ClearTable(aStringsTable); 1648*cdf0e10cSrcweir delete pCompareClass; 1649*cdf0e10cSrcweir } 1650*cdf0e10cSrcweir 1651*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 1652*cdf0e10cSrcweir 1653*cdf0e10cSrcweir --------------------------------------------------*/ 1654*cdf0e10cSrcweir 1655*cdf0e10cSrcweir SfxTabPage* OfaAutocorrExceptPage::Create( Window* pParent, 1656*cdf0e10cSrcweir const SfxItemSet& rSet) 1657*cdf0e10cSrcweir { 1658*cdf0e10cSrcweir return new OfaAutocorrExceptPage(pParent, rSet); 1659*cdf0e10cSrcweir } 1660*cdf0e10cSrcweir /* -----------------20.11.98 13:26------------------- 1661*cdf0e10cSrcweir * 1662*cdf0e10cSrcweir * --------------------------------------------------*/ 1663*cdf0e10cSrcweir void OfaAutocorrExceptPage::ActivatePage( const SfxItemSet& ) 1664*cdf0e10cSrcweir { 1665*cdf0e10cSrcweir if(eLang != eLastDialogLanguage) 1666*cdf0e10cSrcweir SetLanguage(eLastDialogLanguage); 1667*cdf0e10cSrcweir ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(sal_True); 1668*cdf0e10cSrcweir } 1669*cdf0e10cSrcweir /* -----------------20.11.98 13:26------------------- 1670*cdf0e10cSrcweir * 1671*cdf0e10cSrcweir * --------------------------------------------------*/ 1672*cdf0e10cSrcweir int OfaAutocorrExceptPage::DeactivatePage( SfxItemSet* ) 1673*cdf0e10cSrcweir { 1674*cdf0e10cSrcweir return LEAVE_PAGE; 1675*cdf0e10cSrcweir } 1676*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 1677*cdf0e10cSrcweir 1678*cdf0e10cSrcweir --------------------------------------------------*/ 1679*cdf0e10cSrcweir 1680*cdf0e10cSrcweir sal_Bool OfaAutocorrExceptPage::FillItemSet( SfxItemSet& ) 1681*cdf0e10cSrcweir { 1682*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 1683*cdf0e10cSrcweir StringsArraysPtr pArrays = aStringsTable.Last(); 1684*cdf0e10cSrcweir while(pArrays) 1685*cdf0e10cSrcweir { 1686*cdf0e10cSrcweir LanguageType eCurLang = (LanguageType)aStringsTable.GetCurKey(); 1687*cdf0e10cSrcweir if(eCurLang != eLang) // die aktuelle Sprache wird weiter hinten behandelt 1688*cdf0e10cSrcweir { 1689*cdf0e10cSrcweir SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eCurLang); 1690*cdf0e10cSrcweir 1691*cdf0e10cSrcweir if(pWrdList) 1692*cdf0e10cSrcweir { 1693*cdf0e10cSrcweir sal_uInt16 nCount = pWrdList->Count(); 1694*cdf0e10cSrcweir sal_uInt16 i; 1695*cdf0e10cSrcweir for( i = nCount; i; ) 1696*cdf0e10cSrcweir { 1697*cdf0e10cSrcweir String* pString = pWrdList->GetObject( --i ); 1698*cdf0e10cSrcweir //Eintrag finden u. gfs entfernen 1699*cdf0e10cSrcweir if( !lcl_FindInArray(pArrays->aDoubleCapsStrings, *pString)) 1700*cdf0e10cSrcweir pWrdList->DeleteAndDestroy( i ); 1701*cdf0e10cSrcweir } 1702*cdf0e10cSrcweir nCount = pArrays->aDoubleCapsStrings.Count(); 1703*cdf0e10cSrcweir for( i = 0; i < nCount; ++i ) 1704*cdf0e10cSrcweir { 1705*cdf0e10cSrcweir String* pEntry = new String( *pArrays->aDoubleCapsStrings.GetObject( i ) ); 1706*cdf0e10cSrcweir if( !pWrdList->Insert( pEntry )) 1707*cdf0e10cSrcweir delete pEntry; 1708*cdf0e10cSrcweir } 1709*cdf0e10cSrcweir pAutoCorrect->SaveWrdSttExceptList(eCurLang); 1710*cdf0e10cSrcweir } 1711*cdf0e10cSrcweir 1712*cdf0e10cSrcweir SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eCurLang); 1713*cdf0e10cSrcweir 1714*cdf0e10cSrcweir if(pCplList) 1715*cdf0e10cSrcweir { 1716*cdf0e10cSrcweir sal_uInt16 nCount = pCplList->Count(); 1717*cdf0e10cSrcweir sal_uInt16 i; 1718*cdf0e10cSrcweir for( i = nCount; i; ) 1719*cdf0e10cSrcweir { 1720*cdf0e10cSrcweir String* pString = pCplList->GetObject( --i ); 1721*cdf0e10cSrcweir if( !lcl_FindInArray(pArrays->aAbbrevStrings, *pString)) 1722*cdf0e10cSrcweir pCplList->DeleteAndDestroy( i ); 1723*cdf0e10cSrcweir } 1724*cdf0e10cSrcweir nCount = pArrays->aAbbrevStrings.Count(); 1725*cdf0e10cSrcweir for( i = 0; i < nCount; ++i ) 1726*cdf0e10cSrcweir { 1727*cdf0e10cSrcweir String* pEntry = new String( *pArrays->aAbbrevStrings.GetObject(i) ); 1728*cdf0e10cSrcweir if( !pCplList->Insert( pEntry )) 1729*cdf0e10cSrcweir delete pEntry; 1730*cdf0e10cSrcweir } 1731*cdf0e10cSrcweir pAutoCorrect->SaveCplSttExceptList(eCurLang); 1732*cdf0e10cSrcweir } 1733*cdf0e10cSrcweir } 1734*cdf0e10cSrcweir pArrays = aStringsTable.Prev(); 1735*cdf0e10cSrcweir } 1736*cdf0e10cSrcweir aStringsTable.Clear(); 1737*cdf0e10cSrcweir 1738*cdf0e10cSrcweir SvStringsISortDtor* pWrdList = pAutoCorrect->LoadWrdSttExceptList(eLang); 1739*cdf0e10cSrcweir 1740*cdf0e10cSrcweir if(pWrdList) 1741*cdf0e10cSrcweir { 1742*cdf0e10cSrcweir sal_uInt16 nCount = pWrdList->Count(); 1743*cdf0e10cSrcweir sal_uInt16 i; 1744*cdf0e10cSrcweir for( i = nCount; i; ) 1745*cdf0e10cSrcweir { 1746*cdf0e10cSrcweir String* pString = pWrdList->GetObject( --i ); 1747*cdf0e10cSrcweir if( USHRT_MAX == aDoubleCapsLB.GetEntryPos(*pString) ) 1748*cdf0e10cSrcweir pWrdList->DeleteAndDestroy( i ); 1749*cdf0e10cSrcweir } 1750*cdf0e10cSrcweir nCount = aDoubleCapsLB.GetEntryCount(); 1751*cdf0e10cSrcweir for( i = 0; i < nCount; ++i ) 1752*cdf0e10cSrcweir { 1753*cdf0e10cSrcweir String* pEntry = new String( aDoubleCapsLB.GetEntry( i ) ); 1754*cdf0e10cSrcweir if( !pWrdList->Insert( pEntry )) 1755*cdf0e10cSrcweir delete pEntry; 1756*cdf0e10cSrcweir } 1757*cdf0e10cSrcweir pAutoCorrect->SaveWrdSttExceptList(eLang); 1758*cdf0e10cSrcweir } 1759*cdf0e10cSrcweir 1760*cdf0e10cSrcweir SvStringsISortDtor* pCplList = pAutoCorrect->LoadCplSttExceptList(eLang); 1761*cdf0e10cSrcweir 1762*cdf0e10cSrcweir if(pCplList) 1763*cdf0e10cSrcweir { 1764*cdf0e10cSrcweir sal_uInt16 nCount = pCplList->Count(); 1765*cdf0e10cSrcweir sal_uInt16 i; 1766*cdf0e10cSrcweir for( i = nCount; i; ) 1767*cdf0e10cSrcweir { 1768*cdf0e10cSrcweir String* pString = pCplList->GetObject( --i ); 1769*cdf0e10cSrcweir if( USHRT_MAX == aAbbrevLB.GetEntryPos(*pString) ) 1770*cdf0e10cSrcweir pCplList->DeleteAndDestroy( i ); 1771*cdf0e10cSrcweir } 1772*cdf0e10cSrcweir nCount = aAbbrevLB.GetEntryCount(); 1773*cdf0e10cSrcweir for( i = 0; i < nCount; ++i ) 1774*cdf0e10cSrcweir { 1775*cdf0e10cSrcweir String* pEntry = new String( aAbbrevLB.GetEntry( i ) ); 1776*cdf0e10cSrcweir if( !pCplList->Insert( pEntry )) 1777*cdf0e10cSrcweir delete pEntry; 1778*cdf0e10cSrcweir } 1779*cdf0e10cSrcweir pAutoCorrect->SaveCplSttExceptList(eLang); 1780*cdf0e10cSrcweir } 1781*cdf0e10cSrcweir if(aAutoAbbrevCB.IsChecked() != aAutoAbbrevCB.GetSavedValue()) 1782*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag( SaveWordCplSttLst, aAutoAbbrevCB.IsChecked()); 1783*cdf0e10cSrcweir if(aAutoCapsCB.IsChecked() != aAutoCapsCB.GetSavedValue()) 1784*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag( SaveWordWrdSttLst, aAutoCapsCB.IsChecked()); 1785*cdf0e10cSrcweir return sal_False; 1786*cdf0e10cSrcweir } 1787*cdf0e10cSrcweir 1788*cdf0e10cSrcweir /* -----------------23.11.98 10:33------------------- 1789*cdf0e10cSrcweir * 1790*cdf0e10cSrcweir * --------------------------------------------------*/ 1791*cdf0e10cSrcweir void OfaAutocorrExceptPage::SetLanguage(LanguageType eSet) 1792*cdf0e10cSrcweir { 1793*cdf0e10cSrcweir if(eLang != eSet) 1794*cdf0e10cSrcweir { 1795*cdf0e10cSrcweir //alte Einstellungen speichern und neu fuellen 1796*cdf0e10cSrcweir RefillReplaceBoxes(sal_False, eLang, eSet); 1797*cdf0e10cSrcweir eLastDialogLanguage = eSet; 1798*cdf0e10cSrcweir delete pCompareClass; 1799*cdf0e10cSrcweir pCompareClass = new CollatorWrapper( GetProcessFact() ); 1800*cdf0e10cSrcweir pCompareClass->loadDefaultCollator( SvxCreateLocale( eLastDialogLanguage ), 1801*cdf0e10cSrcweir ::com::sun::star::i18n:: 1802*cdf0e10cSrcweir CollatorOptions::CollatorOptions_IGNORE_CASE ); 1803*cdf0e10cSrcweir ModifyHdl(&aAbbrevED); 1804*cdf0e10cSrcweir ModifyHdl(&aDoubleCapsED); 1805*cdf0e10cSrcweir } 1806*cdf0e10cSrcweir } 1807*cdf0e10cSrcweir /* -----------------20.11.98 14:06------------------- 1808*cdf0e10cSrcweir * 1809*cdf0e10cSrcweir * --------------------------------------------------*/ 1810*cdf0e10cSrcweir void OfaAutocorrExceptPage::RefillReplaceBoxes(sal_Bool bFromReset, 1811*cdf0e10cSrcweir LanguageType eOldLanguage, 1812*cdf0e10cSrcweir LanguageType eNewLanguage) 1813*cdf0e10cSrcweir { 1814*cdf0e10cSrcweir eLang = eNewLanguage; 1815*cdf0e10cSrcweir if(bFromReset) 1816*cdf0e10cSrcweir lcl_ClearTable(aStringsTable); 1817*cdf0e10cSrcweir else 1818*cdf0e10cSrcweir { 1819*cdf0e10cSrcweir StringsArraysPtr pArrays = 0; 1820*cdf0e10cSrcweir if(aStringsTable.IsKeyValid(eOldLanguage)) 1821*cdf0e10cSrcweir { 1822*cdf0e10cSrcweir pArrays = aStringsTable.Seek(sal_uLong(eOldLanguage)); 1823*cdf0e10cSrcweir pArrays->aAbbrevStrings.DeleteAndDestroy( 1824*cdf0e10cSrcweir 0, pArrays->aAbbrevStrings.Count()); 1825*cdf0e10cSrcweir pArrays->aDoubleCapsStrings.DeleteAndDestroy( 1826*cdf0e10cSrcweir 0, pArrays->aDoubleCapsStrings.Count()); 1827*cdf0e10cSrcweir } 1828*cdf0e10cSrcweir else 1829*cdf0e10cSrcweir { 1830*cdf0e10cSrcweir pArrays = new StringsArrays; 1831*cdf0e10cSrcweir aStringsTable.Insert(sal_uLong(eOldLanguage), pArrays); 1832*cdf0e10cSrcweir } 1833*cdf0e10cSrcweir 1834*cdf0e10cSrcweir sal_uInt16 i; 1835*cdf0e10cSrcweir for(i = 0; i < aAbbrevLB.GetEntryCount(); i++) 1836*cdf0e10cSrcweir { 1837*cdf0e10cSrcweir pArrays->aAbbrevStrings.Insert( 1838*cdf0e10cSrcweir new String(aAbbrevLB.GetEntry(i)), i); 1839*cdf0e10cSrcweir 1840*cdf0e10cSrcweir } 1841*cdf0e10cSrcweir for(i = 0; i < aDoubleCapsLB.GetEntryCount(); i++) 1842*cdf0e10cSrcweir { 1843*cdf0e10cSrcweir pArrays->aDoubleCapsStrings.Insert( 1844*cdf0e10cSrcweir new String(aDoubleCapsLB.GetEntry(i)), i); 1845*cdf0e10cSrcweir } 1846*cdf0e10cSrcweir } 1847*cdf0e10cSrcweir aDoubleCapsLB.Clear(); 1848*cdf0e10cSrcweir aAbbrevLB.Clear(); 1849*cdf0e10cSrcweir String sTemp; 1850*cdf0e10cSrcweir aAbbrevED.SetText(sTemp); 1851*cdf0e10cSrcweir aDoubleCapsED.SetText(sTemp); 1852*cdf0e10cSrcweir 1853*cdf0e10cSrcweir if(aStringsTable.IsKeyValid(eLang)) 1854*cdf0e10cSrcweir { 1855*cdf0e10cSrcweir StringsArraysPtr pArrays = aStringsTable.Seek(sal_uLong(eLang)); 1856*cdf0e10cSrcweir sal_uInt16 i; 1857*cdf0e10cSrcweir for(i = 0; i < pArrays->aAbbrevStrings.Count(); i++ ) 1858*cdf0e10cSrcweir { 1859*cdf0e10cSrcweir aAbbrevLB.InsertEntry(*pArrays->aAbbrevStrings.GetObject(i)); 1860*cdf0e10cSrcweir } 1861*cdf0e10cSrcweir for( i = 0; i < pArrays->aDoubleCapsStrings.Count(); i++ ) 1862*cdf0e10cSrcweir { 1863*cdf0e10cSrcweir aDoubleCapsLB.InsertEntry(*pArrays->aDoubleCapsStrings.GetObject(i)); 1864*cdf0e10cSrcweir } 1865*cdf0e10cSrcweir } 1866*cdf0e10cSrcweir else 1867*cdf0e10cSrcweir { 1868*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 1869*cdf0e10cSrcweir const SvStringsISortDtor* pCplList = pAutoCorrect->GetCplSttExceptList(eLang); 1870*cdf0e10cSrcweir const SvStringsISortDtor* pWrdList = pAutoCorrect->GetWrdSttExceptList(eLang); 1871*cdf0e10cSrcweir sal_uInt16 i; 1872*cdf0e10cSrcweir for( i = 0; i < pCplList->Count(); i++ ) 1873*cdf0e10cSrcweir { 1874*cdf0e10cSrcweir aAbbrevLB.InsertEntry(*pCplList->GetObject(i)); 1875*cdf0e10cSrcweir } 1876*cdf0e10cSrcweir for( i = 0; i < pWrdList->Count(); i++ ) 1877*cdf0e10cSrcweir { 1878*cdf0e10cSrcweir aDoubleCapsLB.InsertEntry(*pWrdList->GetObject(i)); 1879*cdf0e10cSrcweir } 1880*cdf0e10cSrcweir } 1881*cdf0e10cSrcweir } 1882*cdf0e10cSrcweir 1883*cdf0e10cSrcweir /*-----------------14.10.96 15.58------------------- 1884*cdf0e10cSrcweir 1885*cdf0e10cSrcweir --------------------------------------------------*/ 1886*cdf0e10cSrcweir 1887*cdf0e10cSrcweir void OfaAutocorrExceptPage::Reset( const SfxItemSet& ) 1888*cdf0e10cSrcweir { 1889*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 1890*cdf0e10cSrcweir RefillReplaceBoxes(sal_True, eLang, eLang); 1891*cdf0e10cSrcweir aAutoAbbrevCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordCplSttLst )); 1892*cdf0e10cSrcweir aAutoCapsCB. Check( pAutoCorrect->IsAutoCorrFlag( SaveWordWrdSttLst )); 1893*cdf0e10cSrcweir aAutoAbbrevCB.SaveValue(); 1894*cdf0e10cSrcweir aAutoCapsCB.SaveValue(); 1895*cdf0e10cSrcweir } 1896*cdf0e10cSrcweir 1897*cdf0e10cSrcweir /*-----------------16.10.96 12.27------------------- 1898*cdf0e10cSrcweir 1899*cdf0e10cSrcweir --------------------------------------------------*/ 1900*cdf0e10cSrcweir 1901*cdf0e10cSrcweir 1902*cdf0e10cSrcweir IMPL_LINK(OfaAutocorrExceptPage, NewDelHdl, PushButton*, pBtn) 1903*cdf0e10cSrcweir { 1904*cdf0e10cSrcweir if((pBtn == &aNewAbbrevPB || pBtn == (PushButton*)&aAbbrevED ) 1905*cdf0e10cSrcweir && aAbbrevED.GetText().Len()) 1906*cdf0e10cSrcweir { 1907*cdf0e10cSrcweir aAbbrevLB.InsertEntry(aAbbrevED.GetText()); 1908*cdf0e10cSrcweir ModifyHdl(&aAbbrevED); 1909*cdf0e10cSrcweir } 1910*cdf0e10cSrcweir else if(pBtn == &aDelAbbrevPB) 1911*cdf0e10cSrcweir { 1912*cdf0e10cSrcweir aAbbrevLB.RemoveEntry(aAbbrevED.GetText()); 1913*cdf0e10cSrcweir ModifyHdl(&aAbbrevED); 1914*cdf0e10cSrcweir } 1915*cdf0e10cSrcweir else if((pBtn == &aNewDoublePB || pBtn == (PushButton*)&aDoubleCapsED ) 1916*cdf0e10cSrcweir && aDoubleCapsED.GetText().Len()) 1917*cdf0e10cSrcweir { 1918*cdf0e10cSrcweir aDoubleCapsLB.InsertEntry(aDoubleCapsED.GetText()); 1919*cdf0e10cSrcweir ModifyHdl(&aDoubleCapsED); 1920*cdf0e10cSrcweir } 1921*cdf0e10cSrcweir else if(pBtn == &aDelDoublePB) 1922*cdf0e10cSrcweir { 1923*cdf0e10cSrcweir aDoubleCapsLB.RemoveEntry(aDoubleCapsED.GetText()); 1924*cdf0e10cSrcweir ModifyHdl(&aDoubleCapsED); 1925*cdf0e10cSrcweir } 1926*cdf0e10cSrcweir return 0; 1927*cdf0e10cSrcweir } 1928*cdf0e10cSrcweir 1929*cdf0e10cSrcweir /*-----------------16.10.96 12.57------------------- 1930*cdf0e10cSrcweir 1931*cdf0e10cSrcweir --------------------------------------------------*/ 1932*cdf0e10cSrcweir 1933*cdf0e10cSrcweir IMPL_LINK(OfaAutocorrExceptPage, SelectHdl, ListBox*, pBox) 1934*cdf0e10cSrcweir { 1935*cdf0e10cSrcweir if(pBox == &aAbbrevLB) 1936*cdf0e10cSrcweir { 1937*cdf0e10cSrcweir aAbbrevED.SetText(pBox->GetSelectEntry()); 1938*cdf0e10cSrcweir aNewAbbrevPB.Enable(sal_False); 1939*cdf0e10cSrcweir aDelAbbrevPB.Enable(); 1940*cdf0e10cSrcweir } 1941*cdf0e10cSrcweir else 1942*cdf0e10cSrcweir { 1943*cdf0e10cSrcweir aDoubleCapsED.SetText(pBox->GetSelectEntry()); 1944*cdf0e10cSrcweir aNewDoublePB.Enable(sal_False); 1945*cdf0e10cSrcweir aDelDoublePB.Enable(); 1946*cdf0e10cSrcweir } 1947*cdf0e10cSrcweir return 0; 1948*cdf0e10cSrcweir } 1949*cdf0e10cSrcweir 1950*cdf0e10cSrcweir /*-----------------16.10.96 13.02------------------- 1951*cdf0e10cSrcweir 1952*cdf0e10cSrcweir --------------------------------------------------*/ 1953*cdf0e10cSrcweir 1954*cdf0e10cSrcweir IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, Edit*, pEdt) 1955*cdf0e10cSrcweir { 1956*cdf0e10cSrcweir // sal_Bool bSame = pEdt->GetText() == ->GetSelectEntry(); 1957*cdf0e10cSrcweir const String& sEntry = pEdt->GetText(); 1958*cdf0e10cSrcweir sal_Bool bEntryLen = 0!= sEntry.Len(); 1959*cdf0e10cSrcweir if(pEdt == &aAbbrevED) 1960*cdf0e10cSrcweir { 1961*cdf0e10cSrcweir sal_Bool bSame = lcl_FindEntry(aAbbrevLB, sEntry, *pCompareClass); 1962*cdf0e10cSrcweir if(bSame && sEntry != aAbbrevLB.GetSelectEntry()) 1963*cdf0e10cSrcweir pEdt->SetText(aAbbrevLB.GetSelectEntry()); 1964*cdf0e10cSrcweir aNewAbbrevPB.Enable(!bSame && bEntryLen); 1965*cdf0e10cSrcweir aDelAbbrevPB.Enable(bSame && bEntryLen); 1966*cdf0e10cSrcweir } 1967*cdf0e10cSrcweir else 1968*cdf0e10cSrcweir { 1969*cdf0e10cSrcweir sal_Bool bSame = lcl_FindEntry(aDoubleCapsLB, sEntry, *pCompareClass); 1970*cdf0e10cSrcweir if(bSame && sEntry != aDoubleCapsLB.GetSelectEntry()) 1971*cdf0e10cSrcweir pEdt->SetText(aDoubleCapsLB.GetSelectEntry()); 1972*cdf0e10cSrcweir aNewDoublePB.Enable(!bSame && bEntryLen); 1973*cdf0e10cSrcweir aDelDoublePB.Enable(bSame && bEntryLen); 1974*cdf0e10cSrcweir } 1975*cdf0e10cSrcweir return 0; 1976*cdf0e10cSrcweir } 1977*cdf0e10cSrcweir 1978*cdf0e10cSrcweir /*-----------------16.10.96 15.03------------------- 1979*cdf0e10cSrcweir 1980*cdf0e10cSrcweir --------------------------------------------------*/ 1981*cdf0e10cSrcweir 1982*cdf0e10cSrcweir void AutoCorrEdit::KeyInput( const KeyEvent& rKEvt ) 1983*cdf0e10cSrcweir { 1984*cdf0e10cSrcweir const KeyCode aKeyCode = rKEvt.GetKeyCode(); 1985*cdf0e10cSrcweir const sal_uInt16 nModifier = aKeyCode.GetModifier(); 1986*cdf0e10cSrcweir if( aKeyCode.GetCode() == KEY_RETURN ) 1987*cdf0e10cSrcweir { 1988*cdf0e10cSrcweir //wird bei Enter nichts getan, dann doch die Basisklasse rufen 1989*cdf0e10cSrcweir // um den Dialog zu schliessen 1990*cdf0e10cSrcweir if(!nModifier && !aActionLink.Call(this)) 1991*cdf0e10cSrcweir Edit::KeyInput(rKEvt); 1992*cdf0e10cSrcweir } 1993*cdf0e10cSrcweir else if(bSpaces || aKeyCode.GetCode() != KEY_SPACE) 1994*cdf0e10cSrcweir Edit::KeyInput(rKEvt); 1995*cdf0e10cSrcweir } 1996*cdf0e10cSrcweir 1997*cdf0e10cSrcweir /*-----------------03.07.97 13:17------------------- 1998*cdf0e10cSrcweir 1999*cdf0e10cSrcweir --------------------------------------------------*/ 2000*cdf0e10cSrcweir 2001*cdf0e10cSrcweir enum OfaQuoteOptions 2002*cdf0e10cSrcweir { 2003*cdf0e10cSrcweir ADD_NONBRK_SPACE, 2004*cdf0e10cSrcweir REPLACE_1ST 2005*cdf0e10cSrcweir }; 2006*cdf0e10cSrcweir 2007*cdf0e10cSrcweir SvLBoxEntry* OfaQuoteTabPage::CreateEntry(String& rTxt, sal_uInt16 nCol) 2008*cdf0e10cSrcweir { 2009*cdf0e10cSrcweir SvLBoxEntry* pEntry = new SvLBoxEntry; 2010*cdf0e10cSrcweir 2011*cdf0e10cSrcweir if ( !pCheckButtonData ) 2012*cdf0e10cSrcweir { 2013*cdf0e10cSrcweir pCheckButtonData = new SvLBoxButtonData( &aSwCheckLB ); 2014*cdf0e10cSrcweir aSwCheckLB.SetCheckButtonData( pCheckButtonData ); 2015*cdf0e10cSrcweir } 2016*cdf0e10cSrcweir 2017*cdf0e10cSrcweir pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0)); // Sonst Puff! 2018*cdf0e10cSrcweir 2019*cdf0e10cSrcweir String sEmpty; 2020*cdf0e10cSrcweir if (nCol == CBCOL_SECOND) 2021*cdf0e10cSrcweir pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte 2022*cdf0e10cSrcweir else 2023*cdf0e10cSrcweir pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); 2024*cdf0e10cSrcweir 2025*cdf0e10cSrcweir if (nCol == CBCOL_FIRST) 2026*cdf0e10cSrcweir pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // Leerspalte 2027*cdf0e10cSrcweir else 2028*cdf0e10cSrcweir pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) ); 2029*cdf0e10cSrcweir 2030*cdf0e10cSrcweir pEntry->AddItem( new OfaImpBrwString( pEntry, 0, rTxt ) ); 2031*cdf0e10cSrcweir 2032*cdf0e10cSrcweir return pEntry; 2033*cdf0e10cSrcweir } 2034*cdf0e10cSrcweir 2035*cdf0e10cSrcweir OfaQuoteTabPage::OfaQuoteTabPage( Window* pParent, const SfxItemSet& rSet ) : 2036*cdf0e10cSrcweir SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_AUTOCORR_QUOTE ), rSet), 2037*cdf0e10cSrcweir aCheckLB (this, CUI_RES(CLB_SETTINGS )), 2038*cdf0e10cSrcweir aSwCheckLB (this, CUI_RES(CLB_SETTINGS )), 2039*cdf0e10cSrcweir sHeader1 (CUI_RES( STR_HEADER1 )), 2040*cdf0e10cSrcweir sHeader2 (CUI_RES( STR_HEADER2 )), 2041*cdf0e10cSrcweir sNonBrkSpace (CUI_RES( ST_NON_BREAK_SPACE )), 2042*cdf0e10cSrcweir sOrdinal (CUI_RES( ST_ORDINAL )), 2043*cdf0e10cSrcweir pCheckButtonData ( NULL ), 2044*cdf0e10cSrcweir 2045*cdf0e10cSrcweir aSingleFL (this, CUI_RES(FL_SINGLE )), 2046*cdf0e10cSrcweir aSingleTypoCB (this, CUI_RES(CB_SGL_TYPO )), 2047*cdf0e10cSrcweir aSglStartQuoteFT (this, CUI_RES(FT_SGL_STARTQUOTE )), 2048*cdf0e10cSrcweir aSglStartQuotePB (this, CUI_RES(PB_SGL_STARTQUOTE )), 2049*cdf0e10cSrcweir aSglStartExFT (this, CUI_RES(FT_SGSTEX )), 2050*cdf0e10cSrcweir aSglEndQuoteFT (this, CUI_RES(FT_SGL_ENDQUOTE )), 2051*cdf0e10cSrcweir aSglEndQuotePB (this, CUI_RES(PB_SGL_ENDQUOTE )), 2052*cdf0e10cSrcweir aSglEndExFT (this, CUI_RES(FT_SGENEX )), 2053*cdf0e10cSrcweir aSglStandardPB (this, CUI_RES(PB_SGL_STD )), 2054*cdf0e10cSrcweir 2055*cdf0e10cSrcweir aDoubleFL (this, CUI_RES(FL_DOUBLE )), 2056*cdf0e10cSrcweir aTypoCB (this, CUI_RES(CB_TYPO )), 2057*cdf0e10cSrcweir aStartQuoteFT (this, CUI_RES(FT_STARTQUOTE )), 2058*cdf0e10cSrcweir aStartQuotePB (this, CUI_RES(PB_STARTQUOTE )), 2059*cdf0e10cSrcweir aDblStartExFT (this, CUI_RES(FT_DBSTEX )), 2060*cdf0e10cSrcweir aEndQuoteFT (this, CUI_RES(FT_ENDQUOTE )), 2061*cdf0e10cSrcweir aEndQuotePB (this, CUI_RES(PB_ENDQUOTE )), 2062*cdf0e10cSrcweir aDblEndExFT (this, CUI_RES(FT_DBECEX )), 2063*cdf0e10cSrcweir aDblStandardPB (this, CUI_RES(PB_DBL_STD )), 2064*cdf0e10cSrcweir 2065*cdf0e10cSrcweir sStartQuoteDlg (CUI_RES(STR_CHANGE_START)), 2066*cdf0e10cSrcweir sEndQuoteDlg (CUI_RES(STR_CHANGE_END)), 2067*cdf0e10cSrcweir 2068*cdf0e10cSrcweir sStandard(CUI_RES(ST_STANDARD)) 2069*cdf0e10cSrcweir { 2070*cdf0e10cSrcweir aSglStandardPB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_STD) ) ); 2071*cdf0e10cSrcweir aDblStandardPB.SetAccessibleName(String(CUI_RES(STR_PB_DBL_STD) ) ); 2072*cdf0e10cSrcweir aStartQuotePB.SetAccessibleName( String(CUI_RES(STR_PB_DBL_START) )); 2073*cdf0e10cSrcweir aEndQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_DBL_END) )); 2074*cdf0e10cSrcweir aSglStartQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_START) )); 2075*cdf0e10cSrcweir aSglEndQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_END) ) ); 2076*cdf0e10cSrcweir 2077*cdf0e10cSrcweir FreeResource(); 2078*cdf0e10cSrcweir 2079*cdf0e10cSrcweir sal_Bool bShowSWOptions = sal_False; 2080*cdf0e10cSrcweir 2081*cdf0e10cSrcweir aCheckLB.SetHelpId( HID_OFAPAGE_QUOTE_CLB ); 2082*cdf0e10cSrcweir aSwCheckLB.SetHelpId( HID_OFAPAGE_QUOTE_SW_CLB ); 2083*cdf0e10cSrcweir 2084*cdf0e10cSrcweir SFX_ITEMSET_ARG( &rSet, pItem, SfxBoolItem, SID_AUTO_CORRECT_DLG, sal_False ); 2085*cdf0e10cSrcweir if ( pItem && pItem->GetValue() ) 2086*cdf0e10cSrcweir bShowSWOptions = sal_True; 2087*cdf0e10cSrcweir 2088*cdf0e10cSrcweir if ( bShowSWOptions ) 2089*cdf0e10cSrcweir { 2090*cdf0e10cSrcweir static long aStaticTabs[]= 2091*cdf0e10cSrcweir { 2092*cdf0e10cSrcweir 3, 0, 20, 40 2093*cdf0e10cSrcweir }; 2094*cdf0e10cSrcweir 2095*cdf0e10cSrcweir aSwCheckLB.SetStyle(aSwCheckLB.GetStyle() | WB_HSCROLL| WB_VSCROLL); 2096*cdf0e10cSrcweir 2097*cdf0e10cSrcweir aSwCheckLB.SvxSimpleTable::SetTabs(aStaticTabs); 2098*cdf0e10cSrcweir String sHeader( sHeader1 ); 2099*cdf0e10cSrcweir sHeader += '\t'; 2100*cdf0e10cSrcweir sHeader += sHeader2; 2101*cdf0e10cSrcweir sHeader += '\t'; 2102*cdf0e10cSrcweir aSwCheckLB.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, 2103*cdf0e10cSrcweir HIB_CENTER | HIB_VCENTER | HIB_FIXEDPOS | HIB_FIXED); 2104*cdf0e10cSrcweir aCheckLB.Hide( sal_True ); 2105*cdf0e10cSrcweir } 2106*cdf0e10cSrcweir else 2107*cdf0e10cSrcweir { 2108*cdf0e10cSrcweir aSwCheckLB.HideTable( ); 2109*cdf0e10cSrcweir } 2110*cdf0e10cSrcweir 2111*cdf0e10cSrcweir aStartQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); 2112*cdf0e10cSrcweir aEndQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); 2113*cdf0e10cSrcweir aSglStartQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); 2114*cdf0e10cSrcweir aSglEndQuotePB.SetClickHdl(LINK(this, OfaQuoteTabPage, QuoteHdl)); 2115*cdf0e10cSrcweir aDblStandardPB.SetClickHdl(LINK(this, OfaQuoteTabPage, StdQuoteHdl)); 2116*cdf0e10cSrcweir aSglStandardPB.SetClickHdl(LINK(this, OfaQuoteTabPage, StdQuoteHdl)); 2117*cdf0e10cSrcweir 2118*cdf0e10cSrcweir aSglStartQuotePB.SetAccessibleRelationLabeledBy( &aSglStartQuoteFT ); 2119*cdf0e10cSrcweir aSglEndQuotePB.SetAccessibleRelationLabeledBy( &aSglEndQuoteFT ); 2120*cdf0e10cSrcweir aSglStartQuotePB.SetAccessibleRelationMemberOf( &aSingleFL ); 2121*cdf0e10cSrcweir aSglEndQuotePB.SetAccessibleRelationMemberOf( &aSingleFL ); 2122*cdf0e10cSrcweir aStartQuotePB.SetAccessibleRelationLabeledBy( &aStartQuoteFT ); 2123*cdf0e10cSrcweir aEndQuotePB.SetAccessibleRelationLabeledBy( &aEndQuoteFT ); 2124*cdf0e10cSrcweir aStartQuotePB.SetAccessibleRelationMemberOf( &aDoubleFL ); 2125*cdf0e10cSrcweir aEndQuotePB.SetAccessibleRelationMemberOf( &aDoubleFL ); 2126*cdf0e10cSrcweir aSglStandardPB.SetAccessibleRelationMemberOf(&aSingleFL); 2127*cdf0e10cSrcweir aDblStandardPB.SetAccessibleRelationMemberOf(&aDoubleFL); 2128*cdf0e10cSrcweir } 2129*cdf0e10cSrcweir /*-----------------03.07.97 13:17------------------- 2130*cdf0e10cSrcweir 2131*cdf0e10cSrcweir --------------------------------------------------*/ 2132*cdf0e10cSrcweir OfaQuoteTabPage::~OfaQuoteTabPage() 2133*cdf0e10cSrcweir { 2134*cdf0e10cSrcweir delete( pCheckButtonData ); 2135*cdf0e10cSrcweir } 2136*cdf0e10cSrcweir /*-----------------03.07.97 13:17------------------- 2137*cdf0e10cSrcweir 2138*cdf0e10cSrcweir --------------------------------------------------*/ 2139*cdf0e10cSrcweir SfxTabPage* OfaQuoteTabPage::Create( Window* pParent, 2140*cdf0e10cSrcweir const SfxItemSet& rAttrSet) 2141*cdf0e10cSrcweir { 2142*cdf0e10cSrcweir return new OfaQuoteTabPage(pParent, rAttrSet); 2143*cdf0e10cSrcweir } 2144*cdf0e10cSrcweir /*-----------------03.07.97 13:18------------------- 2145*cdf0e10cSrcweir 2146*cdf0e10cSrcweir --------------------------------------------------*/ 2147*cdf0e10cSrcweir sal_Bool OfaQuoteTabPage::FillItemSet( SfxItemSet& ) 2148*cdf0e10cSrcweir { 2149*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 2150*cdf0e10cSrcweir 2151*cdf0e10cSrcweir long nFlags = pAutoCorrect->GetFlags(); 2152*cdf0e10cSrcweir 2153*cdf0e10cSrcweir if ( aCheckLB.IsVisible( ) ) 2154*cdf0e10cSrcweir { 2155*cdf0e10cSrcweir sal_uInt16 nPos = 0; 2156*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(AddNonBrkSpace, aCheckLB.IsChecked(nPos++)); 2157*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(ChgOrdinalNumber, aCheckLB.IsChecked(nPos++)); 2158*cdf0e10cSrcweir } 2159*cdf0e10cSrcweir 2160*cdf0e10cSrcweir sal_Bool bModified = sal_False; 2161*cdf0e10cSrcweir if ( aSwCheckLB.IsVisible( ) ) 2162*cdf0e10cSrcweir { 2163*cdf0e10cSrcweir SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); 2164*cdf0e10cSrcweir 2165*cdf0e10cSrcweir sal_Bool bCheck = aSwCheckLB.IsChecked(ADD_NONBRK_SPACE, CBCOL_FIRST); 2166*cdf0e10cSrcweir bModified |= pOpt->bAddNonBrkSpace != bCheck; 2167*cdf0e10cSrcweir pOpt->bAddNonBrkSpace = bCheck; 2168*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(AddNonBrkSpace, 2169*cdf0e10cSrcweir aSwCheckLB.IsChecked(ADD_NONBRK_SPACE, CBCOL_SECOND)); 2170*cdf0e10cSrcweir 2171*cdf0e10cSrcweir bCheck = aSwCheckLB.IsChecked(REPLACE_1ST, CBCOL_FIRST); 2172*cdf0e10cSrcweir bModified |= pOpt->bChgOrdinalNumber != bCheck; 2173*cdf0e10cSrcweir pOpt->bChgOrdinalNumber = bCheck; 2174*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(ChgOrdinalNumber, 2175*cdf0e10cSrcweir aSwCheckLB.IsChecked(REPLACE_1ST, CBCOL_SECOND)); 2176*cdf0e10cSrcweir } 2177*cdf0e10cSrcweir 2178*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(ChgQuotes, aTypoCB.IsChecked()); 2179*cdf0e10cSrcweir pAutoCorrect->SetAutoCorrFlag(ChgSglQuotes, aSingleTypoCB.IsChecked()); 2180*cdf0e10cSrcweir sal_Bool bReturn = nFlags != pAutoCorrect->GetFlags(); 2181*cdf0e10cSrcweir if(cStartQuote != pAutoCorrect->GetStartDoubleQuote()) 2182*cdf0e10cSrcweir { 2183*cdf0e10cSrcweir bReturn = sal_True; 2184*cdf0e10cSrcweir sal_Unicode cUCS2 = static_cast<sal_Unicode>(cStartQuote); //TODO 2185*cdf0e10cSrcweir pAutoCorrect->SetStartDoubleQuote(cUCS2); 2186*cdf0e10cSrcweir } 2187*cdf0e10cSrcweir if(cEndQuote != pAutoCorrect->GetEndDoubleQuote()) 2188*cdf0e10cSrcweir { 2189*cdf0e10cSrcweir bReturn = sal_True; 2190*cdf0e10cSrcweir sal_Unicode cUCS2 = static_cast<sal_Unicode>(cEndQuote); //TODO 2191*cdf0e10cSrcweir pAutoCorrect->SetEndDoubleQuote(cUCS2); 2192*cdf0e10cSrcweir } 2193*cdf0e10cSrcweir if(cSglStartQuote != pAutoCorrect->GetStartSingleQuote()) 2194*cdf0e10cSrcweir { 2195*cdf0e10cSrcweir bReturn = sal_True; 2196*cdf0e10cSrcweir sal_Unicode cUCS2 = static_cast<sal_Unicode>(cSglStartQuote); //TODO 2197*cdf0e10cSrcweir pAutoCorrect->SetStartSingleQuote(cUCS2); 2198*cdf0e10cSrcweir } 2199*cdf0e10cSrcweir if(cSglEndQuote != pAutoCorrect->GetEndSingleQuote()) 2200*cdf0e10cSrcweir { 2201*cdf0e10cSrcweir bReturn = sal_True; 2202*cdf0e10cSrcweir sal_Unicode cUCS2 = static_cast<sal_Unicode>(cSglEndQuote); //TODO 2203*cdf0e10cSrcweir pAutoCorrect->SetEndSingleQuote(cUCS2); 2204*cdf0e10cSrcweir } 2205*cdf0e10cSrcweir 2206*cdf0e10cSrcweir if( bModified || bReturn ) 2207*cdf0e10cSrcweir { 2208*cdf0e10cSrcweir SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); 2209*cdf0e10cSrcweir pCfg->SetModified(); 2210*cdf0e10cSrcweir pCfg->Commit(); 2211*cdf0e10cSrcweir } 2212*cdf0e10cSrcweir return bReturn; 2213*cdf0e10cSrcweir } 2214*cdf0e10cSrcweir /* -----------------23.11.98 16:15------------------- 2215*cdf0e10cSrcweir * 2216*cdf0e10cSrcweir * --------------------------------------------------*/ 2217*cdf0e10cSrcweir void OfaQuoteTabPage::ActivatePage( const SfxItemSet& ) 2218*cdf0e10cSrcweir { 2219*cdf0e10cSrcweir ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage(sal_False); 2220*cdf0e10cSrcweir } 2221*cdf0e10cSrcweir /*-----------------03.07.97 13:18------------------- 2222*cdf0e10cSrcweir 2223*cdf0e10cSrcweir --------------------------------------------------*/ 2224*cdf0e10cSrcweir void OfaQuoteTabPage::Reset( const SfxItemSet& ) 2225*cdf0e10cSrcweir { 2226*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 2227*cdf0e10cSrcweir const long nFlags = pAutoCorrect->GetFlags(); 2228*cdf0e10cSrcweir 2229*cdf0e10cSrcweir // Initialize the Sw options 2230*cdf0e10cSrcweir if ( aSwCheckLB.IsVisible( ) ) 2231*cdf0e10cSrcweir { 2232*cdf0e10cSrcweir SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); 2233*cdf0e10cSrcweir 2234*cdf0e10cSrcweir aSwCheckLB.SetUpdateMode( sal_False ); 2235*cdf0e10cSrcweir aSwCheckLB.Clear(); 2236*cdf0e10cSrcweir 2237*cdf0e10cSrcweir aSwCheckLB.GetModel()->Insert(CreateEntry(sNonBrkSpace, CBCOL_BOTH )); 2238*cdf0e10cSrcweir aSwCheckLB.GetModel()->Insert(CreateEntry(sOrdinal, CBCOL_BOTH )); 2239*cdf0e10cSrcweir 2240*cdf0e10cSrcweir aSwCheckLB.CheckEntryPos( ADD_NONBRK_SPACE, CBCOL_FIRST, pOpt->bAddNonBrkSpace ); 2241*cdf0e10cSrcweir aSwCheckLB.CheckEntryPos( ADD_NONBRK_SPACE, CBCOL_SECOND, 0 != (nFlags & AddNonBrkSpace) ); 2242*cdf0e10cSrcweir aSwCheckLB.CheckEntryPos( REPLACE_1ST, CBCOL_FIRST, pOpt->bChgOrdinalNumber ); 2243*cdf0e10cSrcweir aSwCheckLB.CheckEntryPos( REPLACE_1ST, CBCOL_SECOND, 0 != (nFlags & ChgOrdinalNumber) ); 2244*cdf0e10cSrcweir 2245*cdf0e10cSrcweir aSwCheckLB.SetUpdateMode( sal_True ); 2246*cdf0e10cSrcweir } 2247*cdf0e10cSrcweir 2248*cdf0e10cSrcweir // Initialize the non Sw options 2249*cdf0e10cSrcweir if ( aCheckLB.IsVisible( ) ) 2250*cdf0e10cSrcweir { 2251*cdf0e10cSrcweir aCheckLB.SetUpdateMode( sal_False ); 2252*cdf0e10cSrcweir aCheckLB.Clear( ); 2253*cdf0e10cSrcweir 2254*cdf0e10cSrcweir aCheckLB.InsertEntry( sNonBrkSpace ); 2255*cdf0e10cSrcweir aCheckLB.InsertEntry( sOrdinal ); 2256*cdf0e10cSrcweir 2257*cdf0e10cSrcweir sal_uInt16 nPos = 0; 2258*cdf0e10cSrcweir aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & AddNonBrkSpace) ); 2259*cdf0e10cSrcweir aCheckLB.CheckEntryPos( nPos++, 0 != (nFlags & ChgOrdinalNumber) ); 2260*cdf0e10cSrcweir 2261*cdf0e10cSrcweir aCheckLB.SetUpdateMode( sal_True ); 2262*cdf0e10cSrcweir } 2263*cdf0e10cSrcweir 2264*cdf0e10cSrcweir // Initialize the quote stuffs 2265*cdf0e10cSrcweir aTypoCB .Check(0 != (nFlags & ChgQuotes)); 2266*cdf0e10cSrcweir aSingleTypoCB .Check(0 != (nFlags & ChgSglQuotes)); 2267*cdf0e10cSrcweir aTypoCB .SaveValue(); 2268*cdf0e10cSrcweir aSingleTypoCB .SaveValue(); 2269*cdf0e10cSrcweir 2270*cdf0e10cSrcweir cStartQuote = pAutoCorrect->GetStartDoubleQuote(); 2271*cdf0e10cSrcweir cEndQuote = pAutoCorrect->GetEndDoubleQuote(); 2272*cdf0e10cSrcweir cSglStartQuote = pAutoCorrect->GetStartSingleQuote(); 2273*cdf0e10cSrcweir cSglEndQuote = pAutoCorrect->GetEndSingleQuote(); 2274*cdf0e10cSrcweir 2275*cdf0e10cSrcweir aSglStartExFT .SetText(ChangeStringExt_Impl(cSglStartQuote)); 2276*cdf0e10cSrcweir aSglEndExFT .SetText(ChangeStringExt_Impl(cSglEndQuote)); 2277*cdf0e10cSrcweir aDblStartExFT .SetText(ChangeStringExt_Impl(cStartQuote)); 2278*cdf0e10cSrcweir aDblEndExFT .SetText(ChangeStringExt_Impl(cEndQuote)); 2279*cdf0e10cSrcweir } 2280*cdf0e10cSrcweir 2281*cdf0e10cSrcweir 2282*cdf0e10cSrcweir /*-----------------15.10.96 16.42------------------- 2283*cdf0e10cSrcweir 2284*cdf0e10cSrcweir --------------------------------------------------*/ 2285*cdf0e10cSrcweir #define SGL_START 0 2286*cdf0e10cSrcweir #define DBL_START 1 2287*cdf0e10cSrcweir #define SGL_END 2 2288*cdf0e10cSrcweir #define DBL_END 3 2289*cdf0e10cSrcweir 2290*cdf0e10cSrcweir 2291*cdf0e10cSrcweir IMPL_LINK( OfaQuoteTabPage, QuoteHdl, PushButton*, pBtn ) 2292*cdf0e10cSrcweir { 2293*cdf0e10cSrcweir sal_uInt16 nMode = SGL_START; 2294*cdf0e10cSrcweir if(pBtn == &aSglEndQuotePB) 2295*cdf0e10cSrcweir nMode = SGL_END; 2296*cdf0e10cSrcweir else if(pBtn == &aStartQuotePB) 2297*cdf0e10cSrcweir nMode = DBL_START; 2298*cdf0e10cSrcweir else if(pBtn == &aEndQuotePB) 2299*cdf0e10cSrcweir nMode = DBL_END; 2300*cdf0e10cSrcweir // Zeichenauswahl-Dialog starten 2301*cdf0e10cSrcweir SvxCharacterMap* pMap = new SvxCharacterMap( this, sal_True ); 2302*cdf0e10cSrcweir pMap->SetCharFont( OutputDevice::GetDefaultFont(DEFAULTFONT_LATIN_TEXT, 2303*cdf0e10cSrcweir LANGUAGE_ENGLISH_US, DEFAULTFONT_FLAGS_ONLYONE, 0 )); 2304*cdf0e10cSrcweir pMap->SetText(nMode < SGL_END ? sStartQuoteDlg : sEndQuoteDlg ); 2305*cdf0e10cSrcweir sal_UCS4 cDlg; 2306*cdf0e10cSrcweir //The two lines below are added by BerryJia for Bug95846 Time:2002-8-13 15:50 2307*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 2308*cdf0e10cSrcweir LanguageType eLang = Application::GetSettings().GetLanguage(); 2309*cdf0e10cSrcweir switch( nMode ) 2310*cdf0e10cSrcweir { 2311*cdf0e10cSrcweir case SGL_START: 2312*cdf0e10cSrcweir cDlg = cSglStartQuote; 2313*cdf0e10cSrcweir if(cDlg == 0) 2314*cdf0e10cSrcweir cDlg = pAutoCorrect->GetQuote('\'',sal_True,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 2315*cdf0e10cSrcweir break; 2316*cdf0e10cSrcweir case SGL_END: 2317*cdf0e10cSrcweir cDlg = cSglEndQuote; 2318*cdf0e10cSrcweir if(cDlg == 0) 2319*cdf0e10cSrcweir cDlg = pAutoCorrect->GetQuote('\'',sal_False,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 2320*cdf0e10cSrcweir break; 2321*cdf0e10cSrcweir case DBL_START: 2322*cdf0e10cSrcweir cDlg = cStartQuote; 2323*cdf0e10cSrcweir if(cDlg == 0) 2324*cdf0e10cSrcweir cDlg = pAutoCorrect->GetQuote('\"',sal_True,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 2325*cdf0e10cSrcweir break; 2326*cdf0e10cSrcweir case DBL_END: 2327*cdf0e10cSrcweir cDlg = cEndQuote; 2328*cdf0e10cSrcweir if(cDlg == 0) 2329*cdf0e10cSrcweir cDlg = pAutoCorrect->GetQuote('\"',sal_False,eLang); //add by BerryJia for Bug95846 Time:2002-8-13 15:50 2330*cdf0e10cSrcweir break; 2331*cdf0e10cSrcweir default: 2332*cdf0e10cSrcweir DBG_ERROR("svx::OfaQuoteTabPage::QuoteHdl(), how to initialize cDlg?" ); 2333*cdf0e10cSrcweir cDlg = 0; 2334*cdf0e10cSrcweir break; 2335*cdf0e10cSrcweir 2336*cdf0e10cSrcweir } 2337*cdf0e10cSrcweir pMap->SetChar( cDlg ); 2338*cdf0e10cSrcweir pMap->DisableFontSelection(); 2339*cdf0e10cSrcweir if(pMap->Execute() == RET_OK) 2340*cdf0e10cSrcweir { 2341*cdf0e10cSrcweir sal_UCS4 cNewChar = pMap->GetChar(); 2342*cdf0e10cSrcweir switch( nMode ) 2343*cdf0e10cSrcweir { 2344*cdf0e10cSrcweir case SGL_START: 2345*cdf0e10cSrcweir cSglStartQuote = cNewChar; 2346*cdf0e10cSrcweir aSglStartExFT.SetText(ChangeStringExt_Impl(cNewChar)); 2347*cdf0e10cSrcweir break; 2348*cdf0e10cSrcweir case SGL_END: 2349*cdf0e10cSrcweir cSglEndQuote = cNewChar; 2350*cdf0e10cSrcweir aSglEndExFT.SetText(ChangeStringExt_Impl(cNewChar)); 2351*cdf0e10cSrcweir break; 2352*cdf0e10cSrcweir case DBL_START: 2353*cdf0e10cSrcweir cStartQuote = cNewChar; 2354*cdf0e10cSrcweir aDblStartExFT.SetText(ChangeStringExt_Impl(cNewChar)); 2355*cdf0e10cSrcweir break; 2356*cdf0e10cSrcweir case DBL_END: 2357*cdf0e10cSrcweir cEndQuote = cNewChar; 2358*cdf0e10cSrcweir aDblEndExFT.SetText(ChangeStringExt_Impl(cNewChar)); 2359*cdf0e10cSrcweir break; 2360*cdf0e10cSrcweir } 2361*cdf0e10cSrcweir } 2362*cdf0e10cSrcweir delete pMap; 2363*cdf0e10cSrcweir 2364*cdf0e10cSrcweir return 0; 2365*cdf0e10cSrcweir } 2366*cdf0e10cSrcweir 2367*cdf0e10cSrcweir /*-----------------27.06.97 09.55------------------- 2368*cdf0e10cSrcweir 2369*cdf0e10cSrcweir --------------------------------------------------*/ 2370*cdf0e10cSrcweir IMPL_LINK( OfaQuoteTabPage, StdQuoteHdl, PushButton*, pBtn ) 2371*cdf0e10cSrcweir { 2372*cdf0e10cSrcweir if(pBtn == &aDblStandardPB) 2373*cdf0e10cSrcweir { 2374*cdf0e10cSrcweir cStartQuote = 0; 2375*cdf0e10cSrcweir aDblStartExFT.SetText(ChangeStringExt_Impl(0)); 2376*cdf0e10cSrcweir cEndQuote = 0; 2377*cdf0e10cSrcweir aDblEndExFT.SetText(ChangeStringExt_Impl(0)); 2378*cdf0e10cSrcweir 2379*cdf0e10cSrcweir } 2380*cdf0e10cSrcweir else 2381*cdf0e10cSrcweir { 2382*cdf0e10cSrcweir cSglStartQuote = 0; 2383*cdf0e10cSrcweir aSglStartExFT.SetText(ChangeStringExt_Impl(0)); 2384*cdf0e10cSrcweir cSglEndQuote = 0; 2385*cdf0e10cSrcweir aSglEndExFT.SetText(ChangeStringExt_Impl(0)); 2386*cdf0e10cSrcweir } 2387*cdf0e10cSrcweir return 0; 2388*cdf0e10cSrcweir } 2389*cdf0e10cSrcweir 2390*cdf0e10cSrcweir // -------------------------------------------------- 2391*cdf0e10cSrcweir 2392*cdf0e10cSrcweir String OfaQuoteTabPage::ChangeStringExt_Impl( sal_UCS4 cChar ) 2393*cdf0e10cSrcweir { 2394*cdf0e10cSrcweir if( !cChar ) 2395*cdf0e10cSrcweir return sStandard; 2396*cdf0e10cSrcweir 2397*cdf0e10cSrcweir // convert codepoint value to unicode-hex string 2398*cdf0e10cSrcweir sal_UCS4 aStrCodes[32] = { 0, ' ', '(', 'U', '+', '0' }; 2399*cdf0e10cSrcweir aStrCodes[0] = cChar; 2400*cdf0e10cSrcweir int nFullLen = 5; 2401*cdf0e10cSrcweir int nHexLen = 4; 2402*cdf0e10cSrcweir while( (cChar >> (4*nHexLen)) != 0 ) 2403*cdf0e10cSrcweir ++nHexLen; 2404*cdf0e10cSrcweir for( int i = nHexLen; --i >= 0;) 2405*cdf0e10cSrcweir { 2406*cdf0e10cSrcweir sal_UCS4 cHexDigit = ((cChar >> (4*i)) & 0x0f) + '0'; 2407*cdf0e10cSrcweir if( cHexDigit > '9' ) 2408*cdf0e10cSrcweir cHexDigit += 'A' - ('9' + 1); 2409*cdf0e10cSrcweir aStrCodes[ nFullLen++ ] = cHexDigit; 2410*cdf0e10cSrcweir } 2411*cdf0e10cSrcweir aStrCodes[ nFullLen++ ] = ')'; 2412*cdf0e10cSrcweir // using the new UCS4 constructor 2413*cdf0e10cSrcweir rtl::OUString aOUStr( aStrCodes, nFullLen ); 2414*cdf0e10cSrcweir return aOUStr; 2415*cdf0e10cSrcweir } 2416*cdf0e10cSrcweir 2417*cdf0e10cSrcweir OfaAutoCompleteTabPage::OfaAutoCompleteTabPage( Window* pParent, 2418*cdf0e10cSrcweir const SfxItemSet& rSet ) 2419*cdf0e10cSrcweir : SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_AUTOCOMPLETE_OPTIONS ), rSet), 2420*cdf0e10cSrcweir aCBActiv (this, CUI_RES(CB_ACTIV)), 2421*cdf0e10cSrcweir aCBAppendSpace (this, CUI_RES(CB_APPEND_SPACE)), 2422*cdf0e10cSrcweir aCBAsTip (this, CUI_RES(CB_AS_TIP)), 2423*cdf0e10cSrcweir aCBCollect (this, CUI_RES(CB_COLLECT)), 2424*cdf0e10cSrcweir aCBRemoveList (this, CUI_RES(CB_REMOVE_LIST)), 2425*cdf0e10cSrcweir aFTExpandKey (this, CUI_RES(FT_EXPAND_KEY)), 2426*cdf0e10cSrcweir aDCBExpandKey (this, CUI_RES(DCB_EXPAND_KEY)), 2427*cdf0e10cSrcweir aFTMinWordlen (this, CUI_RES(FT_MIN_WORDLEN)), 2428*cdf0e10cSrcweir aNFMinWordlen (this, CUI_RES(NF_MIN_WORDLEN)), 2429*cdf0e10cSrcweir aFTMaxEntries (this, CUI_RES(FT_MAX_ENTRIES)), 2430*cdf0e10cSrcweir aNFMaxEntries (this, CUI_RES(NF_MAX_ENTRIES)), 2431*cdf0e10cSrcweir aLBEntries (*this, CUI_RES(LB_ENTRIES)), 2432*cdf0e10cSrcweir aPBEntries (this, CUI_RES(PB_ENTRIES)), 2433*cdf0e10cSrcweir pAutoCmpltList( 0 ), 2434*cdf0e10cSrcweir nAutoCmpltListCnt( 0 ) 2435*cdf0e10cSrcweir { 2436*cdf0e10cSrcweir FreeResource(); 2437*cdf0e10cSrcweir 2438*cdf0e10cSrcweir // the defined KEYs 2439*cdf0e10cSrcweir static const sal_uInt16 aKeyCodes[] = { 2440*cdf0e10cSrcweir KEY_END, 2441*cdf0e10cSrcweir KEY_RETURN, 2442*cdf0e10cSrcweir KEY_SPACE, 2443*cdf0e10cSrcweir KEY_RIGHT, 2444*cdf0e10cSrcweir KEY_TAB, 2445*cdf0e10cSrcweir 0 2446*cdf0e10cSrcweir }; 2447*cdf0e10cSrcweir 2448*cdf0e10cSrcweir for( const sal_uInt16* pKeys = aKeyCodes; *pKeys; ++pKeys ) 2449*cdf0e10cSrcweir { 2450*cdf0e10cSrcweir KeyCode aKCode( *pKeys ); 2451*cdf0e10cSrcweir sal_uInt16 nPos = aDCBExpandKey.InsertEntry( aKCode.GetName() ); 2452*cdf0e10cSrcweir aDCBExpandKey.SetEntryData( nPos, (void*)(sal_uLong)*pKeys ); 2453*cdf0e10cSrcweir if( KEY_RETURN == *pKeys ) // default to RETURN 2454*cdf0e10cSrcweir aDCBExpandKey.SelectEntryPos( nPos ); 2455*cdf0e10cSrcweir } 2456*cdf0e10cSrcweir 2457*cdf0e10cSrcweir aPBEntries.SetClickHdl(LINK(this, OfaAutoCompleteTabPage, DeleteHdl)); 2458*cdf0e10cSrcweir aCBActiv.SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl)); 2459*cdf0e10cSrcweir aCBCollect.SetToggleHdl(LINK(this, OfaAutoCompleteTabPage, CheckHdl)); 2460*cdf0e10cSrcweir aLBEntries.SetAccessibleRelationLabeledBy(&aLBEntries); 2461*cdf0e10cSrcweir } 2462*cdf0e10cSrcweir 2463*cdf0e10cSrcweir OfaAutoCompleteTabPage::~OfaAutoCompleteTabPage() 2464*cdf0e10cSrcweir { 2465*cdf0e10cSrcweir } 2466*cdf0e10cSrcweir 2467*cdf0e10cSrcweir SfxTabPage* OfaAutoCompleteTabPage::Create( Window* pParent, 2468*cdf0e10cSrcweir const SfxItemSet& rSet) 2469*cdf0e10cSrcweir { 2470*cdf0e10cSrcweir return new OfaAutoCompleteTabPage( pParent, rSet ); 2471*cdf0e10cSrcweir } 2472*cdf0e10cSrcweir 2473*cdf0e10cSrcweir sal_Bool OfaAutoCompleteTabPage::FillItemSet( SfxItemSet& ) 2474*cdf0e10cSrcweir { 2475*cdf0e10cSrcweir sal_Bool bModified = sal_False, bCheck; 2476*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 2477*cdf0e10cSrcweir SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); 2478*cdf0e10cSrcweir sal_uInt16 nVal; 2479*cdf0e10cSrcweir 2480*cdf0e10cSrcweir bCheck = aCBActiv.IsChecked(); 2481*cdf0e10cSrcweir bModified |= pOpt->bAutoCompleteWords != bCheck; 2482*cdf0e10cSrcweir pOpt->bAutoCompleteWords = bCheck; 2483*cdf0e10cSrcweir bCheck = aCBCollect.IsChecked(); 2484*cdf0e10cSrcweir bModified |= pOpt->bAutoCmpltCollectWords != bCheck; 2485*cdf0e10cSrcweir pOpt->bAutoCmpltCollectWords = bCheck; 2486*cdf0e10cSrcweir bCheck = !aCBRemoveList.IsChecked(); // inverted value! 2487*cdf0e10cSrcweir bModified |= pOpt->bAutoCmpltKeepList != bCheck; 2488*cdf0e10cSrcweir pOpt->bAutoCmpltKeepList = bCheck; 2489*cdf0e10cSrcweir bCheck = aCBAppendSpace.IsChecked(); 2490*cdf0e10cSrcweir bModified |= pOpt->bAutoCmpltAppendBlanc != bCheck; 2491*cdf0e10cSrcweir pOpt->bAutoCmpltAppendBlanc = bCheck; 2492*cdf0e10cSrcweir bCheck = aCBAsTip.IsChecked(); 2493*cdf0e10cSrcweir bModified |= pOpt->bAutoCmpltShowAsTip != bCheck; 2494*cdf0e10cSrcweir pOpt->bAutoCmpltShowAsTip = bCheck; 2495*cdf0e10cSrcweir 2496*cdf0e10cSrcweir nVal = (sal_uInt16)aNFMinWordlen.GetValue(); 2497*cdf0e10cSrcweir bModified |= nVal != pOpt->nAutoCmpltWordLen; 2498*cdf0e10cSrcweir pOpt->nAutoCmpltWordLen = nVal; 2499*cdf0e10cSrcweir 2500*cdf0e10cSrcweir nVal = (sal_uInt16)aNFMaxEntries.GetValue(); 2501*cdf0e10cSrcweir bModified |= nVal != pOpt->nAutoCmpltListLen; 2502*cdf0e10cSrcweir pOpt->nAutoCmpltListLen = nVal; 2503*cdf0e10cSrcweir 2504*cdf0e10cSrcweir nVal = aDCBExpandKey.GetSelectEntryPos(); 2505*cdf0e10cSrcweir if( nVal < aDCBExpandKey.GetEntryCount() ) 2506*cdf0e10cSrcweir { 2507*cdf0e10cSrcweir sal_uLong nKey = (sal_uLong)aDCBExpandKey.GetEntryData( nVal ); 2508*cdf0e10cSrcweir bModified |= nKey != pOpt->nAutoCmpltExpandKey; 2509*cdf0e10cSrcweir pOpt->nAutoCmpltExpandKey = (sal_uInt16)nKey; 2510*cdf0e10cSrcweir } 2511*cdf0e10cSrcweir 2512*cdf0e10cSrcweir if( pAutoCmpltList && nAutoCmpltListCnt != aLBEntries.GetEntryCount() ) 2513*cdf0e10cSrcweir { 2514*cdf0e10cSrcweir bModified = sal_True; 2515*cdf0e10cSrcweir pOpt->pAutoCmpltList = pAutoCmpltList; 2516*cdf0e10cSrcweir } 2517*cdf0e10cSrcweir if( bModified ) 2518*cdf0e10cSrcweir { 2519*cdf0e10cSrcweir SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get(); 2520*cdf0e10cSrcweir pCfg->SetModified(); 2521*cdf0e10cSrcweir pCfg->Commit(); 2522*cdf0e10cSrcweir } 2523*cdf0e10cSrcweir return sal_True; 2524*cdf0e10cSrcweir } 2525*cdf0e10cSrcweir 2526*cdf0e10cSrcweir void OfaAutoCompleteTabPage::Reset( const SfxItemSet& ) 2527*cdf0e10cSrcweir { 2528*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 2529*cdf0e10cSrcweir SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); 2530*cdf0e10cSrcweir 2531*cdf0e10cSrcweir aCBActiv.Check( 0 != pOpt->bAutoCompleteWords ); 2532*cdf0e10cSrcweir aCBCollect.Check( 0 != pOpt->bAutoCmpltCollectWords ); 2533*cdf0e10cSrcweir aCBRemoveList.Check( !pOpt->bAutoCmpltKeepList ); //inverted value! 2534*cdf0e10cSrcweir aCBAppendSpace.Check( 0 != pOpt->bAutoCmpltAppendBlanc ); 2535*cdf0e10cSrcweir aCBAsTip.Check( 0 != pOpt->bAutoCmpltShowAsTip ); 2536*cdf0e10cSrcweir 2537*cdf0e10cSrcweir aNFMinWordlen.SetValue( pOpt->nAutoCmpltWordLen ); 2538*cdf0e10cSrcweir aNFMaxEntries.SetValue( pOpt->nAutoCmpltListLen ); 2539*cdf0e10cSrcweir 2540*cdf0e10cSrcweir // select the specific KeyCode: 2541*cdf0e10cSrcweir { 2542*cdf0e10cSrcweir sal_uLong nKey = pOpt->nAutoCmpltExpandKey; 2543*cdf0e10cSrcweir for( sal_uInt16 n = 0, nCnt = aDCBExpandKey.GetEntryCount(); n < nCnt; ++n ) 2544*cdf0e10cSrcweir if( nKey == (sal_uLong)aDCBExpandKey.GetEntryData( n )) 2545*cdf0e10cSrcweir { 2546*cdf0e10cSrcweir aDCBExpandKey.SelectEntryPos( n ); 2547*cdf0e10cSrcweir break; 2548*cdf0e10cSrcweir } 2549*cdf0e10cSrcweir } 2550*cdf0e10cSrcweir 2551*cdf0e10cSrcweir if( pOpt->pAutoCmpltList && pOpt->pAutoCmpltList->Count() ) 2552*cdf0e10cSrcweir { 2553*cdf0e10cSrcweir pAutoCmpltList = (SvStringsISortDtor*)pOpt->pAutoCmpltList; 2554*cdf0e10cSrcweir pOpt->pAutoCmpltList = 0; 2555*cdf0e10cSrcweir nAutoCmpltListCnt = pAutoCmpltList->Count(); 2556*cdf0e10cSrcweir for( sal_uInt16 n = 0; n < nAutoCmpltListCnt; ++n ) 2557*cdf0e10cSrcweir { 2558*cdf0e10cSrcweir const StringPtr pStr = pAutoCmpltList->GetObject( n ); 2559*cdf0e10cSrcweir sal_uInt16 nPos = aLBEntries.InsertEntry( *pStr ); 2560*cdf0e10cSrcweir aLBEntries.SetEntryData( nPos, (void*)pStr ); 2561*cdf0e10cSrcweir } 2562*cdf0e10cSrcweir } 2563*cdf0e10cSrcweir else 2564*cdf0e10cSrcweir { 2565*cdf0e10cSrcweir aLBEntries.Disable(); 2566*cdf0e10cSrcweir aPBEntries.Disable(); 2567*cdf0e10cSrcweir } 2568*cdf0e10cSrcweir 2569*cdf0e10cSrcweir CheckHdl( &aCBActiv ); 2570*cdf0e10cSrcweir CheckHdl( &aCBCollect ); 2571*cdf0e10cSrcweir } 2572*cdf0e10cSrcweir 2573*cdf0e10cSrcweir void OfaAutoCompleteTabPage::ActivatePage( const SfxItemSet& ) 2574*cdf0e10cSrcweir { 2575*cdf0e10cSrcweir ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage( sal_False ); 2576*cdf0e10cSrcweir } 2577*cdf0e10cSrcweir 2578*cdf0e10cSrcweir IMPL_LINK( OfaAutoCompleteTabPage, DeleteHdl, PushButton*, EMPTYARG ) 2579*cdf0e10cSrcweir { 2580*cdf0e10cSrcweir sal_uInt16 nSelCnt = pAutoCmpltList ? aLBEntries.GetSelectEntryCount() : 0; 2581*cdf0e10cSrcweir while( nSelCnt ) 2582*cdf0e10cSrcweir { 2583*cdf0e10cSrcweir sal_uInt16 nPos = aLBEntries.GetSelectEntryPos( --nSelCnt ); 2584*cdf0e10cSrcweir const StringPtr pStr = (StringPtr)aLBEntries.GetEntryData( nPos ); 2585*cdf0e10cSrcweir aLBEntries.RemoveEntry( nPos ); 2586*cdf0e10cSrcweir nPos = pAutoCmpltList->GetPos( pStr ); 2587*cdf0e10cSrcweir if( USHRT_MAX != nPos ) 2588*cdf0e10cSrcweir pAutoCmpltList->Remove( nPos ); 2589*cdf0e10cSrcweir } 2590*cdf0e10cSrcweir return 0; 2591*cdf0e10cSrcweir } 2592*cdf0e10cSrcweir 2593*cdf0e10cSrcweir IMPL_LINK( OfaAutoCompleteTabPage, CheckHdl, CheckBox*, pBox ) 2594*cdf0e10cSrcweir { 2595*cdf0e10cSrcweir sal_Bool bEnable = pBox->IsChecked(); 2596*cdf0e10cSrcweir if( pBox == &aCBActiv ) 2597*cdf0e10cSrcweir { 2598*cdf0e10cSrcweir aCBAppendSpace.Enable( bEnable ); 2599*cdf0e10cSrcweir aCBAppendSpace.Enable( bEnable ); 2600*cdf0e10cSrcweir aCBAsTip.Enable( bEnable ); 2601*cdf0e10cSrcweir aDCBExpandKey.Enable( bEnable ); 2602*cdf0e10cSrcweir } 2603*cdf0e10cSrcweir else if(&aCBCollect == pBox) 2604*cdf0e10cSrcweir aCBRemoveList.Enable( bEnable ); 2605*cdf0e10cSrcweir return 0; 2606*cdf0e10cSrcweir } 2607*cdf0e10cSrcweir 2608*cdf0e10cSrcweir void OfaAutoCompleteTabPage::CopyToClipboard() const 2609*cdf0e10cSrcweir { 2610*cdf0e10cSrcweir sal_uInt16 nSelCnt = aLBEntries.GetSelectEntryCount(); 2611*cdf0e10cSrcweir if( pAutoCmpltList && nSelCnt ) 2612*cdf0e10cSrcweir { 2613*cdf0e10cSrcweir TransferDataContainer* pCntnr = new TransferDataContainer; 2614*cdf0e10cSrcweir ::com::sun::star::uno::Reference< 2615*cdf0e10cSrcweir ::com::sun::star::datatransfer::XTransferable > xRef( pCntnr ); 2616*cdf0e10cSrcweir 2617*cdf0e10cSrcweir ByteString sData; 2618*cdf0e10cSrcweir const sal_Char* pLineEnd = 2619*cdf0e10cSrcweir #if defined(UNX) 2620*cdf0e10cSrcweir "\012"; 2621*cdf0e10cSrcweir #else 2622*cdf0e10cSrcweir "\015\012"; 2623*cdf0e10cSrcweir #endif 2624*cdf0e10cSrcweir 2625*cdf0e10cSrcweir rtl_TextEncoding nEncode = gsl_getSystemTextEncoding(); 2626*cdf0e10cSrcweir 2627*cdf0e10cSrcweir for( sal_uInt16 n = 0; n < nSelCnt; ++n ) 2628*cdf0e10cSrcweir { 2629*cdf0e10cSrcweir sData += ByteString( aLBEntries.GetSelectEntry( n ), nEncode ); 2630*cdf0e10cSrcweir sData += pLineEnd; 2631*cdf0e10cSrcweir } 2632*cdf0e10cSrcweir pCntnr->CopyByteString( SOT_FORMAT_STRING, sData ); 2633*cdf0e10cSrcweir pCntnr->CopyToClipboard( (Window*)this ); 2634*cdf0e10cSrcweir } 2635*cdf0e10cSrcweir } 2636*cdf0e10cSrcweir 2637*cdf0e10cSrcweir long OfaAutoCompleteTabPage::AutoCompleteMultiListBox::PreNotify( 2638*cdf0e10cSrcweir NotifyEvent& rNEvt ) 2639*cdf0e10cSrcweir { 2640*cdf0e10cSrcweir long nHandled = MultiListBox::PreNotify( rNEvt ); 2641*cdf0e10cSrcweir 2642*cdf0e10cSrcweir if( !nHandled && EVENT_KEYUP == rNEvt.GetType() ) 2643*cdf0e10cSrcweir { 2644*cdf0e10cSrcweir const KeyCode& rKeyCode = rNEvt.GetKeyEvent()->GetKeyCode(); 2645*cdf0e10cSrcweir switch( rKeyCode.GetModifier() | rKeyCode.GetCode() ) 2646*cdf0e10cSrcweir { 2647*cdf0e10cSrcweir case KEY_DELETE: 2648*cdf0e10cSrcweir rPage.DeleteHdl( 0 ); 2649*cdf0e10cSrcweir nHandled = 1; 2650*cdf0e10cSrcweir break; 2651*cdf0e10cSrcweir 2652*cdf0e10cSrcweir default: 2653*cdf0e10cSrcweir if( KEYFUNC_COPY == rKeyCode.GetFunction() ) 2654*cdf0e10cSrcweir { 2655*cdf0e10cSrcweir rPage.CopyToClipboard(); 2656*cdf0e10cSrcweir nHandled = 1; 2657*cdf0e10cSrcweir } 2658*cdf0e10cSrcweir break; 2659*cdf0e10cSrcweir } 2660*cdf0e10cSrcweir } 2661*cdf0e10cSrcweir return nHandled; 2662*cdf0e10cSrcweir } 2663*cdf0e10cSrcweir 2664*cdf0e10cSrcweir // class OfaSmartTagOptionsTabPage --------------------------------------------- 2665*cdf0e10cSrcweir 2666*cdf0e10cSrcweir OfaSmartTagOptionsTabPage::OfaSmartTagOptionsTabPage( Window* pParent, 2667*cdf0e10cSrcweir const SfxItemSet& rSet ) 2668*cdf0e10cSrcweir : SfxTabPage(pParent, CUI_RES( RID_OFAPAGE_SMARTTAG_OPTIONS ), rSet), 2669*cdf0e10cSrcweir m_aMainCB( this, CUI_RES(CB_SMARTTAGS) ), 2670*cdf0e10cSrcweir m_aSmartTagTypesLB( this, CUI_RES(LB_SMARTTAGS) ), 2671*cdf0e10cSrcweir m_aPropertiesPB( this, CUI_RES(PB_SMARTTAGS) ), 2672*cdf0e10cSrcweir m_aTitleFT( this, CUI_RES(FT_SMARTTAGS) ) 2673*cdf0e10cSrcweir { 2674*cdf0e10cSrcweir FreeResource(); 2675*cdf0e10cSrcweir 2676*cdf0e10cSrcweir // some options for the list box: 2677*cdf0e10cSrcweir m_aSmartTagTypesLB.SetStyle( m_aSmartTagTypesLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION ); 2678*cdf0e10cSrcweir m_aSmartTagTypesLB.SetHighlightRange(); 2679*cdf0e10cSrcweir 2680*cdf0e10cSrcweir // set the handlers: 2681*cdf0e10cSrcweir m_aMainCB.SetToggleHdl(LINK(this, OfaSmartTagOptionsTabPage, CheckHdl)); 2682*cdf0e10cSrcweir m_aPropertiesPB.SetClickHdl(LINK(this, OfaSmartTagOptionsTabPage, ClickHdl)); 2683*cdf0e10cSrcweir m_aSmartTagTypesLB.SetSelectHdl(LINK(this, OfaSmartTagOptionsTabPage, SelectHdl)); 2684*cdf0e10cSrcweir } 2685*cdf0e10cSrcweir 2686*cdf0e10cSrcweir OfaSmartTagOptionsTabPage::~OfaSmartTagOptionsTabPage() 2687*cdf0e10cSrcweir { 2688*cdf0e10cSrcweir 2689*cdf0e10cSrcweir } 2690*cdf0e10cSrcweir 2691*cdf0e10cSrcweir SfxTabPage* OfaSmartTagOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet) 2692*cdf0e10cSrcweir { 2693*cdf0e10cSrcweir return new OfaSmartTagOptionsTabPage( pParent, rSet ); 2694*cdf0e10cSrcweir } 2695*cdf0e10cSrcweir 2696*cdf0e10cSrcweir /** This struct is used to associate list box entries with smart tag data 2697*cdf0e10cSrcweir */ 2698*cdf0e10cSrcweir struct ImplSmartTagLBUserData 2699*cdf0e10cSrcweir { 2700*cdf0e10cSrcweir rtl::OUString maSmartTagType; 2701*cdf0e10cSrcweir uno::Reference< smarttags::XSmartTagRecognizer > mxRec; 2702*cdf0e10cSrcweir sal_Int32 mnSmartTagIdx; 2703*cdf0e10cSrcweir 2704*cdf0e10cSrcweir ImplSmartTagLBUserData( const rtl::OUString& rSmartTagType, 2705*cdf0e10cSrcweir uno::Reference< smarttags::XSmartTagRecognizer > xRec, 2706*cdf0e10cSrcweir sal_Int32 nSmartTagIdx ) : 2707*cdf0e10cSrcweir maSmartTagType( rSmartTagType ), 2708*cdf0e10cSrcweir mxRec( xRec ), 2709*cdf0e10cSrcweir mnSmartTagIdx( nSmartTagIdx ) {} 2710*cdf0e10cSrcweir }; 2711*cdf0e10cSrcweir 2712*cdf0e10cSrcweir /** Clears m_aSmartTagTypesLB 2713*cdf0e10cSrcweir */ 2714*cdf0e10cSrcweir void OfaSmartTagOptionsTabPage::ClearListBox() 2715*cdf0e10cSrcweir { 2716*cdf0e10cSrcweir const sal_uLong nCount = m_aSmartTagTypesLB.GetEntryCount(); 2717*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCount; ++i ) 2718*cdf0e10cSrcweir { 2719*cdf0e10cSrcweir const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(i); 2720*cdf0e10cSrcweir const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); 2721*cdf0e10cSrcweir delete pUserData; 2722*cdf0e10cSrcweir } 2723*cdf0e10cSrcweir 2724*cdf0e10cSrcweir m_aSmartTagTypesLB.Clear(); 2725*cdf0e10cSrcweir } 2726*cdf0e10cSrcweir 2727*cdf0e10cSrcweir /** Inserts items into m_aSmartTagTypesLB 2728*cdf0e10cSrcweir */ 2729*cdf0e10cSrcweir void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr ) 2730*cdf0e10cSrcweir { 2731*cdf0e10cSrcweir // first we have to clear the list box: 2732*cdf0e10cSrcweir ClearListBox(); 2733*cdf0e10cSrcweir 2734*cdf0e10cSrcweir // fill list box: 2735*cdf0e10cSrcweir const sal_uInt32 nNumberOfRecognizers = rSmartTagMgr.NumberOfRecognizers(); 2736*cdf0e10cSrcweir const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); 2737*cdf0e10cSrcweir std::vector< ActionReference > aActionReferences; 2738*cdf0e10cSrcweir 2739*cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < nNumberOfRecognizers; ++i ) 2740*cdf0e10cSrcweir { 2741*cdf0e10cSrcweir uno::Reference< smarttags::XSmartTagRecognizer > xRec = rSmartTagMgr.GetRecognizer(i); 2742*cdf0e10cSrcweir 2743*cdf0e10cSrcweir const rtl::OUString aName = xRec->getName( aLocale ); 2744*cdf0e10cSrcweir const rtl::OUString aDesc = xRec->getDescription( aLocale ); 2745*cdf0e10cSrcweir const sal_Int32 nNumberOfSupportedSmartTags = xRec->getSmartTagCount(); 2746*cdf0e10cSrcweir 2747*cdf0e10cSrcweir for ( sal_Int32 j = 0; j < nNumberOfSupportedSmartTags; ++j ) 2748*cdf0e10cSrcweir { 2749*cdf0e10cSrcweir const rtl::OUString aSmartTagType = xRec->getSmartTagName(j); 2750*cdf0e10cSrcweir rtl::OUString aSmartTagCaption = rSmartTagMgr.GetSmartTagCaption( aSmartTagType, aLocale ); 2751*cdf0e10cSrcweir 2752*cdf0e10cSrcweir if ( !aSmartTagCaption.getLength() ) 2753*cdf0e10cSrcweir aSmartTagCaption = aSmartTagType; 2754*cdf0e10cSrcweir 2755*cdf0e10cSrcweir const rtl::OUString aLBEntry = aSmartTagCaption + 2756*cdf0e10cSrcweir OUString::createFromAscii(" (") + 2757*cdf0e10cSrcweir aName + 2758*cdf0e10cSrcweir OUString::createFromAscii(")"); 2759*cdf0e10cSrcweir 2760*cdf0e10cSrcweir SvLBoxEntry* pEntry = m_aSmartTagTypesLB.SvTreeListBox::InsertEntry( aLBEntry ); 2761*cdf0e10cSrcweir if ( pEntry ) 2762*cdf0e10cSrcweir { 2763*cdf0e10cSrcweir const bool bCheck = rSmartTagMgr.IsSmartTagTypeEnabled( aSmartTagType ); 2764*cdf0e10cSrcweir m_aSmartTagTypesLB.SetCheckButtonState( pEntry, bCheck ? SV_BUTTON_CHECKED : SV_BUTTON_UNCHECKED ); 2765*cdf0e10cSrcweir pEntry->SetUserData(static_cast<void*>(new ImplSmartTagLBUserData( aSmartTagType, xRec, j ) ) ); 2766*cdf0e10cSrcweir } 2767*cdf0e10cSrcweir } 2768*cdf0e10cSrcweir } 2769*cdf0e10cSrcweir } 2770*cdf0e10cSrcweir 2771*cdf0e10cSrcweir /** Handler for the push button 2772*cdf0e10cSrcweir */ 2773*cdf0e10cSrcweir IMPL_LINK( OfaSmartTagOptionsTabPage, ClickHdl, PushButton*, EMPTYARG ) 2774*cdf0e10cSrcweir { 2775*cdf0e10cSrcweir const sal_uInt16 nPos = m_aSmartTagTypesLB.GetSelectEntryPos(); 2776*cdf0e10cSrcweir const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(nPos); 2777*cdf0e10cSrcweir const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); 2778*cdf0e10cSrcweir uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec; 2779*cdf0e10cSrcweir const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx; 2780*cdf0e10cSrcweir 2781*cdf0e10cSrcweir const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); 2782*cdf0e10cSrcweir if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) ) 2783*cdf0e10cSrcweir xRec->displayPropertyPage( nSmartTagIdx, aLocale ); 2784*cdf0e10cSrcweir 2785*cdf0e10cSrcweir return 0; 2786*cdf0e10cSrcweir } 2787*cdf0e10cSrcweir 2788*cdf0e10cSrcweir /** Handler for the check box 2789*cdf0e10cSrcweir */ 2790*cdf0e10cSrcweir IMPL_LINK( OfaSmartTagOptionsTabPage, CheckHdl, CheckBox*, EMPTYARG ) 2791*cdf0e10cSrcweir { 2792*cdf0e10cSrcweir const sal_Bool bEnable = m_aMainCB.IsChecked(); 2793*cdf0e10cSrcweir m_aSmartTagTypesLB.Enable( bEnable ); 2794*cdf0e10cSrcweir m_aSmartTagTypesLB.Invalidate(); 2795*cdf0e10cSrcweir m_aPropertiesPB.Enable( false ); 2796*cdf0e10cSrcweir 2797*cdf0e10cSrcweir // if the controls are currently enabled, we still have to check 2798*cdf0e10cSrcweir // if the properties button should be disabled because the currently 2799*cdf0e10cSrcweir // seleted smart tag type does not have a properties dialog. 2800*cdf0e10cSrcweir // We do this by calling SelectHdl: 2801*cdf0e10cSrcweir if ( bEnable ) 2802*cdf0e10cSrcweir SelectHdl( &m_aSmartTagTypesLB ); 2803*cdf0e10cSrcweir 2804*cdf0e10cSrcweir return 0; 2805*cdf0e10cSrcweir } 2806*cdf0e10cSrcweir 2807*cdf0e10cSrcweir /** Handler for the list box 2808*cdf0e10cSrcweir */ 2809*cdf0e10cSrcweir IMPL_LINK(OfaSmartTagOptionsTabPage, SelectHdl, SvxCheckListBox*, EMPTYARG) 2810*cdf0e10cSrcweir { 2811*cdf0e10cSrcweir if ( m_aSmartTagTypesLB.GetEntryCount() < 1 ) 2812*cdf0e10cSrcweir return 0; 2813*cdf0e10cSrcweir 2814*cdf0e10cSrcweir const sal_uInt16 nPos = m_aSmartTagTypesLB.GetSelectEntryPos(); 2815*cdf0e10cSrcweir const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(nPos); 2816*cdf0e10cSrcweir const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); 2817*cdf0e10cSrcweir uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec; 2818*cdf0e10cSrcweir const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx; 2819*cdf0e10cSrcweir 2820*cdf0e10cSrcweir const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) ); 2821*cdf0e10cSrcweir if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) ) 2822*cdf0e10cSrcweir m_aPropertiesPB.Enable( sal_True ); 2823*cdf0e10cSrcweir else 2824*cdf0e10cSrcweir m_aPropertiesPB.Enable( sal_False ); 2825*cdf0e10cSrcweir 2826*cdf0e10cSrcweir return 0; 2827*cdf0e10cSrcweir } 2828*cdf0e10cSrcweir 2829*cdf0e10cSrcweir /** Propagates the current settings to the smart tag manager. 2830*cdf0e10cSrcweir */ 2831*cdf0e10cSrcweir sal_Bool OfaSmartTagOptionsTabPage::FillItemSet( SfxItemSet& ) 2832*cdf0e10cSrcweir { 2833*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 2834*cdf0e10cSrcweir SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); 2835*cdf0e10cSrcweir SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr; 2836*cdf0e10cSrcweir 2837*cdf0e10cSrcweir // robust! 2838*cdf0e10cSrcweir if ( !pSmartTagMgr ) 2839*cdf0e10cSrcweir return sal_False; 2840*cdf0e10cSrcweir 2841*cdf0e10cSrcweir sal_Bool bModifiedSmartTagTypes = sal_False; 2842*cdf0e10cSrcweir std::vector< rtl::OUString > aDisabledSmartTagTypes; 2843*cdf0e10cSrcweir 2844*cdf0e10cSrcweir const sal_uLong nCount = m_aSmartTagTypesLB.GetEntryCount(); 2845*cdf0e10cSrcweir 2846*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCount; ++i ) 2847*cdf0e10cSrcweir { 2848*cdf0e10cSrcweir const SvLBoxEntry* pEntry = m_aSmartTagTypesLB.GetEntry(i); 2849*cdf0e10cSrcweir const ImplSmartTagLBUserData* pUserData = static_cast< ImplSmartTagLBUserData* >(pEntry->GetUserData()); 2850*cdf0e10cSrcweir const sal_Bool bChecked = m_aSmartTagTypesLB.IsChecked(i); 2851*cdf0e10cSrcweir const sal_Bool bIsCurrentlyEnabled = pSmartTagMgr->IsSmartTagTypeEnabled( pUserData->maSmartTagType ); 2852*cdf0e10cSrcweir 2853*cdf0e10cSrcweir bModifiedSmartTagTypes = bModifiedSmartTagTypes || ( !bChecked != !bIsCurrentlyEnabled ); 2854*cdf0e10cSrcweir 2855*cdf0e10cSrcweir if ( !bChecked ) 2856*cdf0e10cSrcweir aDisabledSmartTagTypes.push_back( pUserData->maSmartTagType ); 2857*cdf0e10cSrcweir 2858*cdf0e10cSrcweir delete pUserData; 2859*cdf0e10cSrcweir } 2860*cdf0e10cSrcweir 2861*cdf0e10cSrcweir const sal_Bool bModifiedRecognize = ( !m_aMainCB.IsChecked() != !pSmartTagMgr->IsLabelTextWithSmartTags() ); 2862*cdf0e10cSrcweir if ( bModifiedSmartTagTypes || bModifiedRecognize ) 2863*cdf0e10cSrcweir { 2864*cdf0e10cSrcweir bool bLabelTextWithSmartTags = m_aMainCB.IsChecked() ? true : false; 2865*cdf0e10cSrcweir pSmartTagMgr->WriteConfiguration( bModifiedRecognize ? &bLabelTextWithSmartTags : 0, 2866*cdf0e10cSrcweir bModifiedSmartTagTypes ? &aDisabledSmartTagTypes : 0 ); 2867*cdf0e10cSrcweir } 2868*cdf0e10cSrcweir 2869*cdf0e10cSrcweir return sal_True; 2870*cdf0e10cSrcweir } 2871*cdf0e10cSrcweir 2872*cdf0e10cSrcweir /** Sets the controls based on the current settings at SmartTagMgr. 2873*cdf0e10cSrcweir */ 2874*cdf0e10cSrcweir void OfaSmartTagOptionsTabPage::Reset( const SfxItemSet& ) 2875*cdf0e10cSrcweir { 2876*cdf0e10cSrcweir SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 2877*cdf0e10cSrcweir SvxSwAutoFmtFlags *pOpt = &pAutoCorrect->GetSwFlags(); 2878*cdf0e10cSrcweir const SmartTagMgr* pSmartTagMgr = pOpt->pSmartTagMgr; 2879*cdf0e10cSrcweir 2880*cdf0e10cSrcweir // robust, should not happen! 2881*cdf0e10cSrcweir if ( !pSmartTagMgr ) 2882*cdf0e10cSrcweir return; 2883*cdf0e10cSrcweir 2884*cdf0e10cSrcweir FillListBox( *pSmartTagMgr ); 2885*cdf0e10cSrcweir m_aSmartTagTypesLB.SelectEntryPos( 0 ); 2886*cdf0e10cSrcweir m_aMainCB.Check( pSmartTagMgr->IsLabelTextWithSmartTags() ); 2887*cdf0e10cSrcweir CheckHdl( &m_aMainCB ); 2888*cdf0e10cSrcweir } 2889*cdf0e10cSrcweir 2890*cdf0e10cSrcweir void OfaSmartTagOptionsTabPage::ActivatePage( const SfxItemSet& ) 2891*cdf0e10cSrcweir { 2892*cdf0e10cSrcweir ((OfaAutoCorrDlg*)GetTabDialog())->EnableLanguage( sal_False ); 2893*cdf0e10cSrcweir } 2894*cdf0e10cSrcweir 2895