1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_cui.hxx" 26 27 // include --------------------------------------------------------------- 28 #include <tools/shl.hxx> 29 #include <vcl/svapp.hxx> 30 #include <vcl/msgbox.hxx> 31 #include <unotools/saveopt.hxx> 32 #include <svl/intitem.hxx> 33 34 #define _SVX_OPTGENRL_CXX 35 36 #include <cuires.hrc> 37 #include "optgenrl.hrc" 38 #include <unotools/useroptions.hxx> 39 #include "cuioptgenrl.hxx" 40 #include <dialmgr.hxx> 41 #include <svx/dlgutil.hxx> 42 #include <svx/strarray.hxx> 43 #include <svx/svxids.hrc> // SID_FIELD_GRABFOCUS 44 45 #define TRIM(s) s.EraseLeadingChars().EraseTrailingChars() 46 47 // struct GeneralTabPage_Impl -------------------------------------------- 48 49 struct GeneralTabPage_Impl 50 { 51 sal_Bool mbStreetEnabled; 52 sal_Bool mbPLZEnabled; 53 sal_Bool mbCityEnabled; 54 sal_Bool mbUsCityEnabled; 55 sal_Bool mbUsZipEnabled; 56 57 String maQueryStr; 58 59 GeneralTabPage_Impl() : 60 mbStreetEnabled ( sal_False ), 61 mbPLZEnabled ( sal_False ), 62 mbCityEnabled ( sal_False ), 63 mbUsCityEnabled ( sal_False ), 64 mbUsZipEnabled ( sal_False ) {} 65 }; 66 67 // ----------------------------------------------------------------------- 68 69 SvxGeneralTabPage::SvxGeneralTabPage( Window* pParent, const SfxItemSet& rCoreSet ) : 70 71 SfxTabPage( pParent, CUI_RES(RID_SFXPAGE_GENERAL), rCoreSet ), 72 73 aAddrFrm ( this, CUI_RES( GB_ADDRESS ) ), 74 aCompanyLbl ( this, CUI_RES( FT_COMPANY ), true ), 75 aCompanyEdit ( this, CUI_RES( ED_COMPANY ), INDEX_NOTSET, &aCompanyLbl ), 76 aNameLbl ( this, CUI_RES( FT_NAME ), true ), 77 aNameLblRuss ( this, CUI_RES( FT_NAME_RUSS ), true ), 78 aNameLblEastern ( this, CUI_RES( FT_NAME_EASTERN ), true ), 79 aFirstName ( this, CUI_RES( ED_FIRSTNAME ), 0, &aNameLbl ), 80 aFatherName ( this, CUI_RES( ED_FATHERNAME ) ), 81 aName ( this, CUI_RES( ED_NAME ), 1, &aNameLbl ), 82 aShortName ( this, CUI_RES( ED_SHORTNAME ), 2, &aNameLbl ), 83 aStreetLbl ( this, CUI_RES( FT_STREET ), true ), 84 aStreetLblRuss ( this, CUI_RES( FT_STREET_RUSS ), true ), 85 aStreetEdit ( this, CUI_RES( ED_STREET ), 0, &aStreetLbl ), 86 aApartmentNrEdit( this, CUI_RES( ED_APARTMENTNR ), 1, &aStreetLblRuss ), 87 aCityLbl ( this, CUI_RES( FT_CITY ), true ), 88 aPLZEdit ( this, CUI_RES( ED_PLZ ), 0, &aCityLbl ), 89 aCityEdit ( this, CUI_RES( ED_CITY ), 1, &aCityLbl ), 90 aUsCityEdit ( this, CUI_RES( ED_US_CITY ), 0, &aCityLbl ), 91 aUsStateEdit ( this, CUI_RES( ED_US_STATE ), 1, &aCityLbl ), 92 aUsZipEdit ( this, CUI_RES( ED_US_ZIPCODE ), 2, &aCityLbl ), 93 aCountryLbl ( this, CUI_RES( FT_COUNTRY ), true ), 94 aCountryEdit ( this, CUI_RES( ED_COUNTRY ), INDEX_NOTSET, &aCountryLbl ), 95 aTitlePosLbl ( this, CUI_RES( FT_TITLEPOS ), true ), 96 aTitleEdit ( this, CUI_RES( ED_TITLE ), 0, &aTitlePosLbl ), 97 aPositionEdit ( this, CUI_RES( ED_POSITION ), 1, &aTitlePosLbl ), 98 aPhoneLbl ( this, CUI_RES( FT_PHONE ), true ), 99 aTelPrivEdit ( this, CUI_RES( ED_TELPRIVAT ), 0, &aPhoneLbl ), 100 aTelCompanyEdit ( this, CUI_RES( ED_TELCOMPANY ), 1, &aPhoneLbl ), 101 aFaxMailLbl ( this, CUI_RES( FT_FAXMAIL ), true ), 102 aFaxEdit ( this, CUI_RES( ED_FAX ), 0, &aFaxMailLbl ), 103 aEmailEdit ( this, CUI_RES( ED_EMAIL ), 1, &aFaxMailLbl ), 104 aUseDataCB ( this, CUI_RES( CB_USEDATA ) ), 105 pImpl ( new GeneralTabPage_Impl ) 106 107 { 108 LanguageType eLang = Application::GetSettings().GetUILanguage(); 109 pImpl->maQueryStr = String( CUI_RES( STR_QUERY_REG ) ); 110 111 if ( LANGUAGE_ENGLISH_US == eLang ) 112 { 113 // amerikanische Postadresse aufbauen 114 aPLZEdit.Hide(); 115 aCityEdit.Hide(); 116 aCityLbl.SetText( CUI_RES( STR_US_STATE ) ); 117 } 118 else if ( LANGUAGE_RUSSIAN == eLang ) 119 { 120 aUsCityEdit.Hide(); 121 aUsStateEdit.Hide(); 122 aUsZipEdit.Hide(); 123 aNameLbl.Hide(); 124 aNameLblRuss.Show(); 125 aStreetLbl.Hide(); 126 aStreetLblRuss.Show(); 127 aFatherName.Show(); 128 aName.SetIndex( 0 ); 129 aName.SetLabel( &aNameLblRuss ); 130 aFirstName.SetIndex( 1 ); 131 aFirstName.SetLabel( &aNameLblRuss ); 132 aFatherName.SetIndex( 2 ); 133 aFatherName.SetLabel( &aNameLblRuss ); 134 aShortName.SetIndex( 3 ); 135 aShortName.SetLabel( &aNameLblRuss ); 136 137 Point aEditPoint = LogicToPixel( Point( MID, LINE(1) ), MAP_APPFONT ); 138 Point aRightPoint = LogicToPixel( Point( RIGHT, LINE(1) ), MAP_APPFONT ); 139 Size aEditSize = LogicToPixel( Size( 42, 12 ), MAP_APPFONT ); 140 Size a2Size = LogicToPixel( Size( 2, 2 ), MAP_APPFONT ); 141 long nDelta = aEditSize.Width() + a2Size.Width(); 142 aName.SetPosSizePixel( aEditPoint, aEditSize ); 143 aEditPoint.X() = aEditPoint.X() + nDelta; 144 aFirstName.SetPosSizePixel( aEditPoint, aEditSize ); 145 aEditPoint.X() = aEditPoint.X() + nDelta; 146 aFatherName.SetPosSizePixel( aEditPoint, aEditSize ); 147 aEditPoint.X() = aEditPoint.X() + nDelta; 148 aEditSize.Width() = aRightPoint.X() - aEditPoint.X(); 149 aShortName.SetPosSizePixel( aEditPoint, aEditSize ); 150 151 Size aStreetSize = aStreetEdit.GetSizePixel(); 152 aStreetSize.Width() = aStreetSize.Width() - aEditSize.Width() - a2Size.Width(); 153 aStreetEdit.SetSizePixel( aStreetSize ); 154 aApartmentNrEdit.Show(); 155 Point aApartmentPoint = LogicToPixel( Point( MID, LINE(2) ), MAP_APPFONT ); 156 aApartmentPoint.X() = aEditPoint.X(); 157 aApartmentNrEdit.SetPosSizePixel( aApartmentPoint, aEditSize ); 158 159 aName.SetZOrder( &aNameLblRuss, WINDOW_ZORDER_BEHIND ); 160 aFirstName.SetZOrder( &aName, WINDOW_ZORDER_BEHIND ); 161 aFatherName.SetZOrder( &aFirstName, WINDOW_ZORDER_BEHIND ); 162 } 163 else if ( LANGUAGE_JAPANESE == eLang || 164 LANGUAGE_KOREAN == eLang || 165 LANGUAGE_CHINESE_TRADITIONAL == eLang || 166 LANGUAGE_CHINESE_SIMPLIFIED == eLang) 167 { 168 aUsCityEdit.Hide(); 169 aUsStateEdit.Hide(); 170 aUsZipEdit.Hide(); 171 aNameLbl.Hide(); 172 aNameLblEastern.Show(); 173 174 // swap "first name" field and "last name" field 175 Point aPosTmp = aFirstName.GetPosPixel(); 176 aFirstName.SetPosPixel( aName.GetPosPixel() ); 177 aName.SetPosPixel( aPosTmp ); 178 aFirstName.SetZOrder( &aName, WINDOW_ZORDER_BEHIND ); 179 } 180 else 181 { 182 aUsCityEdit.Hide(); 183 aUsStateEdit.Hide(); 184 aUsZipEdit.Hide(); 185 } 186 187 FreeResource(); 188 189 // diese Page braucht ExchangeSupport 190 SetExchangeSupport(); 191 192 Link aLink = LINK( this, SvxGeneralTabPage, ModifyHdl_Impl ); 193 aFirstName.SetModifyHdl( aLink ); 194 aName.SetModifyHdl( aLink ); 195 196 // because some labels have text for more than one edit field we have to split these texts 197 // and set these texts as accessible name of the corresponding edit fields 198 SvxUserEdit* pEdits[] = 199 { 200 &aCompanyEdit, &aFirstName, &aFatherName, &aName, &aShortName, &aStreetEdit, 201 &aApartmentNrEdit, &aPLZEdit, &aCityEdit, &aUsCityEdit, &aUsStateEdit, &aUsZipEdit, 202 &aCountryEdit, &aTitleEdit, &aPositionEdit, &aTelPrivEdit, &aTelCompanyEdit, 203 &aFaxEdit, &aEmailEdit, NULL 204 }; 205 SvxUserEdit** pCurrent = pEdits; 206 while ( *pCurrent ) 207 { 208 Window* pLabel = (*pCurrent)->GetLabel(); 209 if ( pLabel ) 210 { 211 String sName, sText = pLabel->GetDisplayText(); 212 sal_Int16 nIndex = (*pCurrent)->GetIndex(); 213 if ( INDEX_NOTSET == nIndex ) 214 sName = sText; 215 else 216 sName = sText.GetToken( nIndex, '/' ); 217 sName.EraseAllChars( '(' ); 218 sName.EraseAllChars( ')' ); 219 if ( sName.Len() > 0 ) 220 (*pCurrent)->SetAccessibleName( sName ); 221 } 222 pCurrent++; 223 } 224 } 225 226 //------------------------------------------------------------------------ 227 228 SvxGeneralTabPage::~SvxGeneralTabPage() 229 { 230 delete pImpl; 231 } 232 233 //------------------------------------------------------------------------ 234 235 SfxTabPage* SvxGeneralTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) 236 { 237 return ( new SvxGeneralTabPage( pParent, rAttrSet ) ); 238 } 239 240 //------------------------------------------------------------------------ 241 242 sal_Bool SvxGeneralTabPage::FillItemSet( SfxItemSet& ) 243 { 244 // Eingaben trimmen (f"uhrende und nachfolgende Leerzeichen entfernen) 245 aCompanyEdit.SetText( TRIM(aCompanyEdit.GetText()) ); 246 aFirstName.SetText( TRIM(aFirstName.GetText()) ); 247 aName.SetText( TRIM(aName.GetText()) ); 248 aShortName.SetText( TRIM(aShortName.GetText()) ); 249 aStreetEdit.SetText( TRIM(aStreetEdit.GetText()) ); 250 aCountryEdit.SetText( TRIM(aCountryEdit.GetText()) ); 251 aPLZEdit.SetText( TRIM(aPLZEdit.GetText()) ); 252 aCityEdit.SetText( TRIM(aCityEdit.GetText()) ); 253 aUsCityEdit.SetText( TRIM(aUsCityEdit.GetText()) ); 254 aUsStateEdit.SetText( TRIM(aUsStateEdit.GetText()) ); 255 aUsZipEdit.SetText( TRIM(aUsZipEdit.GetText()) ); 256 aTitleEdit.SetText( TRIM(aTitleEdit.GetText()) ); 257 aPositionEdit.SetText( TRIM(aPositionEdit.GetText()) ); 258 aTelPrivEdit.SetText( TRIM(aTelPrivEdit.GetText()) ); 259 aTelCompanyEdit.SetText( TRIM(aTelCompanyEdit.GetText()) ); 260 aFaxEdit.SetText( TRIM(aFaxEdit.GetText()) ); 261 aEmailEdit.SetText( TRIM(aEmailEdit.GetText()) ); 262 263 sal_Bool bModified = sal_False; 264 bModified |= GetAddress_Impl(); 265 SvtSaveOptions aSaveOpt; 266 if ( aUseDataCB.IsChecked() != aSaveOpt.IsUseUserData() ) 267 { 268 aSaveOpt.SetUseUserData( aUseDataCB.IsChecked() ); 269 bModified |= sal_True; 270 } 271 return bModified; 272 } 273 274 //------------------------------------------------------------------------ 275 276 void SvxGeneralTabPage::Reset( const SfxItemSet& rSet ) 277 { 278 SetAddress_Impl(); 279 280 sal_uInt16 nWhich = GetWhich( SID_FIELD_GRABFOCUS ); 281 if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) 282 { 283 sal_uInt16 nField = ( (SfxUInt16Item&)rSet.Get( nWhich ) ).GetValue(); 284 285 switch ( nField ) 286 { 287 case COMPANY_EDIT: aCompanyEdit.GrabFocus(); break; 288 case FIRSTNAME_EDIT: aFirstName.GrabFocus(); break; 289 case LASTNAME_EDIT: aName.GrabFocus(); break; 290 case STREET_EDIT: aStreetEdit.GrabFocus(); break; 291 case COUNTRY_EDIT: aCountryEdit.GrabFocus(); break; 292 case PLZ_EDIT: 293 if ( aPLZEdit.IsVisible() ) 294 aPLZEdit.GrabFocus(); 295 else 296 aUsZipEdit.GrabFocus(); 297 break; 298 case CITY_EDIT: 299 if ( aCityEdit.IsVisible() ) 300 aCityEdit.GrabFocus(); 301 else 302 aUsCityEdit.GrabFocus(); 303 break; 304 case STATE_EDIT: 305 if ( aUsStateEdit.IsVisible() ) 306 aUsStateEdit.GrabFocus(); 307 else 308 aCityEdit.GrabFocus(); 309 break; 310 case TITLE_EDIT: aTitleEdit.GrabFocus(); break; 311 case POSITION_EDIT: aPositionEdit.GrabFocus(); break; 312 case SHORTNAME_EDIT: aShortName.GrabFocus(); break; 313 case TELPRIV_EDIT: aTelPrivEdit.GrabFocus(); break; 314 case TELCOMPANY_EDIT: aTelCompanyEdit.GrabFocus(); break; 315 case FAX_EDIT: aFaxEdit.GrabFocus(); break; 316 case EMAIL_EDIT: aEmailEdit.GrabFocus(); break; 317 default: aCompanyEdit.GrabFocus(); 318 } 319 } 320 321 aUseDataCB.Check( SvtSaveOptions().IsUseUserData() ); 322 } 323 324 //------------------------------------------------------------------------ 325 326 IMPL_LINK( SvxGeneralTabPage, ModifyHdl_Impl, Edit *, pEdit ) 327 { 328 if ( aShortName.IsEnabled() ) 329 { 330 String aShortStr( aShortName.GetText() ); 331 switch ( aShortStr.Len() ) 332 { 333 case 0: 334 aShortStr = String( RTL_CONSTASCII_STRINGPARAM(" ") ); 335 break; 336 337 case 1: 338 aShortStr += ' '; 339 break; 340 } 341 342 sal_uInt16 nPos = ( pEdit == &aFirstName ) ? 0 : 1; 343 String aTxt = pEdit->GetText(); 344 sal_Unicode cChar = ( aTxt.Len() > 0 ) ? aTxt.GetChar(0) : ' '; 345 aShortStr.SetChar( nPos, cChar ); 346 aShortStr.EraseTrailingChars(); 347 aShortName.SetText( aShortStr ); 348 } 349 return 0; 350 } 351 352 //------------------------------------------------------------------------ 353 354 sal_Bool SvxGeneralTabPage::GetAddress_Impl() 355 { 356 sal_Bool bRet = 357 ( aCompanyEdit.GetSavedValue() != aCompanyEdit.GetText() || 358 aFirstName.GetSavedValue() != aFirstName.GetText() || 359 aFatherName.GetSavedValue() != aFatherName.GetText() || 360 aName.GetSavedValue() != aName.GetText() || 361 aShortName.GetSavedValue() != aShortName.GetText() || 362 aStreetEdit.GetSavedValue() != aStreetEdit.GetText() || 363 aApartmentNrEdit.GetSavedValue() != aApartmentNrEdit.GetText() || 364 aPLZEdit.GetSavedValue() != aPLZEdit.GetText() || 365 aCityEdit.GetSavedValue() != aCityEdit.GetText() || 366 aUsCityEdit.GetSavedValue() != aUsCityEdit.GetText() || 367 aUsStateEdit.GetSavedValue() != aUsStateEdit.GetText() || 368 aUsZipEdit.GetSavedValue() != aUsZipEdit.GetText() || 369 aCountryEdit.GetSavedValue() != aCountryEdit.GetText() || 370 aTitleEdit.GetSavedValue() != aTitleEdit.GetText() || 371 aPositionEdit.GetSavedValue() != aPositionEdit.GetText() || 372 aTelPrivEdit.GetSavedValue() != aTelPrivEdit.GetText() || 373 aTelCompanyEdit.GetSavedValue() != aTelCompanyEdit.GetText() || 374 aFaxEdit.GetSavedValue() != aFaxEdit.GetText() || 375 aEmailEdit.GetSavedValue() != aEmailEdit.GetText() ); 376 377 LanguageType eLang = Application::GetSettings().GetUILanguage(); 378 sal_Bool bUS = ( LANGUAGE_ENGLISH_US == eLang ); 379 380 SvtUserOptions aUserOpt; 381 aUserOpt.SetCompany(aCompanyEdit.GetText()); 382 aUserOpt.SetFirstName(aFirstName.GetText()); 383 aUserOpt.SetLastName(aName.GetText()); 384 aUserOpt.SetID( aShortName.GetText()); 385 386 aUserOpt.SetStreet(aStreetEdit.GetText() ); 387 388 aUserOpt.SetCountry(aCountryEdit.GetText() ); 389 390 aUserOpt.SetZip(bUS ? aUsZipEdit.GetText() : aPLZEdit.GetText() ); 391 aUserOpt.SetCity(bUS ? aUsCityEdit.GetText() : aCityEdit.GetText() ); 392 393 aUserOpt.SetTitle( aTitleEdit.GetText() ); 394 aUserOpt.SetPosition(aPositionEdit.GetText() ); 395 aUserOpt.SetTelephoneHome( aTelPrivEdit.GetText() ); 396 aUserOpt.SetTelephoneWork( aTelCompanyEdit.GetText() ); 397 aUserOpt.SetFax( aFaxEdit.GetText() ); 398 aUserOpt.SetEmail( aEmailEdit.GetText() ); 399 aUserOpt.SetState( bUS ? aUsStateEdit.GetText() : String() ); 400 401 if ( LANGUAGE_RUSSIAN == eLang ) 402 { 403 aUserOpt.SetFathersName( aFatherName.GetText() ); 404 aUserOpt.SetApartment( aApartmentNrEdit.GetText() ); 405 } 406 return bRet; 407 } 408 409 //------------------------------------------------------------------------ 410 411 void SvxGeneralTabPage::SetAddress_Impl() 412 { 413 LanguageType eLang = Application::GetSettings().GetUILanguage(); 414 sal_Bool bUS = ( LANGUAGE_ENGLISH_US == eLang ); 415 SvtUserOptions aUserOpt; 416 aCompanyEdit.SetText( aUserOpt.GetCompany() ); 417 if ( aUserOpt.IsTokenReadonly( USER_OPT_COMPANY ) ) 418 { 419 aCompanyLbl.Disable(); 420 aCompanyEdit.Disable(); 421 } 422 sal_Int16 nEditCount = 0; 423 aFirstName.SetText( aUserOpt.GetFirstName() ); 424 if ( aUserOpt.IsTokenReadonly( USER_OPT_FIRSTNAME ) ) 425 { 426 aFirstName.Disable(); 427 nEditCount++; 428 } 429 aName.SetText( aUserOpt.GetLastName() ); 430 if ( aUserOpt.IsTokenReadonly( USER_OPT_LASTNAME ) ) 431 { 432 aName.Disable(); 433 nEditCount++; 434 } 435 aShortName.SetText( aUserOpt.GetID() ); 436 if ( aUserOpt.IsTokenReadonly( USER_OPT_ID ) ) 437 { 438 aShortName.Disable(); 439 nEditCount++; 440 } 441 aNameLbl.Enable( ( nEditCount != 3 ) ); 442 aStreetEdit.SetText( aUserOpt.GetStreet() ); 443 if ( aUserOpt.IsTokenReadonly( USER_OPT_STREET ) ) 444 { 445 aStreetLbl.Disable(); 446 aStreetEdit.Disable(); 447 } 448 Edit* pPLZEdit = bUS ? &aUsZipEdit : &aPLZEdit; 449 Edit* pCityEdit = bUS ? &aUsCityEdit : &aCityEdit; 450 pPLZEdit->SetText( aUserOpt.GetZip() ); 451 pCityEdit->SetText( aUserOpt.GetCity() ); 452 nEditCount = 0; 453 if ( aUserOpt.IsTokenReadonly( USER_OPT_ZIP ) ) 454 { 455 pPLZEdit->Disable(); 456 nEditCount++; 457 } 458 if ( aUserOpt.IsTokenReadonly( USER_OPT_CITY ) ) 459 { 460 pCityEdit->Disable(); 461 nEditCount++; 462 } 463 if ( bUS ) 464 { 465 aUsStateEdit.SetText( aUserOpt.GetState() ); 466 if ( aUserOpt.IsTokenReadonly( USER_OPT_STATE ) ) 467 { 468 aUsStateEdit.Disable(); 469 nEditCount++; 470 } 471 } 472 aCityLbl.Enable( ( nEditCount != ( bUS ? 3 : 2 ) ) ); 473 aCountryEdit.SetText( aUserOpt.GetCountry() ); 474 if ( aUserOpt.IsTokenReadonly( USER_OPT_COUNTRY ) ) 475 { 476 aCountryLbl.Disable(); 477 aCountryEdit.Disable(); 478 } 479 aTitleEdit.SetText( aUserOpt.GetTitle() ); 480 aPositionEdit.SetText( aUserOpt.GetPosition() ); 481 nEditCount = 0; 482 if ( aUserOpt.IsTokenReadonly( USER_OPT_TITLE ) ) 483 { 484 aTitleEdit.Disable(); 485 nEditCount++; 486 } 487 if ( aUserOpt.IsTokenReadonly( USER_OPT_POSITION ) ) 488 { 489 aPositionEdit.Disable(); 490 nEditCount++; 491 } 492 aTitlePosLbl.Enable( ( nEditCount != 2 ) ); 493 aTelPrivEdit.SetText( aUserOpt.GetTelephoneHome() ); 494 aTelCompanyEdit.SetText( aUserOpt.GetTelephoneWork() ); 495 nEditCount = 0; 496 if ( aUserOpt.IsTokenReadonly( USER_OPT_TELEPHONEHOME ) ) 497 { 498 aTelPrivEdit.Disable(); 499 nEditCount++; 500 } 501 if ( aUserOpt.IsTokenReadonly( USER_OPT_TELEPHONEWORK ) ) 502 { 503 aTelCompanyEdit.Disable(); 504 nEditCount++; 505 } 506 aPhoneLbl.Enable( ( nEditCount != 2 ) ); 507 aFaxEdit.SetText( aUserOpt.GetFax() ); 508 aEmailEdit.SetText( aUserOpt.GetEmail() ); 509 nEditCount = 0; 510 if ( aUserOpt.IsTokenReadonly( USER_OPT_FAX ) ) 511 { 512 aFaxEdit.Disable(); 513 nEditCount++; 514 } 515 if ( aUserOpt.IsTokenReadonly( USER_OPT_EMAIL ) ) 516 { 517 aEmailEdit.Disable(); 518 nEditCount++; 519 } 520 aFaxMailLbl.Enable( ( nEditCount != 2 ) ); 521 522 if ( LANGUAGE_RUSSIAN == eLang ) 523 { 524 aFatherName.SetText( aUserOpt.GetFathersName() ); 525 aApartmentNrEdit.SetText( aUserOpt.GetApartment() ); 526 } 527 528 aCompanyEdit.SaveValue(); 529 aFirstName.SaveValue(); 530 aFatherName.SaveValue(); 531 aName.SaveValue(); 532 aShortName.SaveValue(); 533 aStreetEdit.SaveValue(); 534 aApartmentNrEdit.SaveValue(); 535 aPLZEdit.SaveValue(); 536 aCityEdit.SaveValue(); 537 aUsCityEdit.SaveValue(); 538 aUsStateEdit.SaveValue(); 539 aUsZipEdit.SaveValue(); 540 aCountryEdit.SaveValue(); 541 aTitleEdit.SaveValue(); 542 aPositionEdit.SaveValue(); 543 aTelPrivEdit.SaveValue(); 544 aTelCompanyEdit.SaveValue(); 545 aFaxEdit.SaveValue(); 546 aEmailEdit.SaveValue(); 547 } 548 549 // ----------------------------------------------------------------------- 550 551 int SvxGeneralTabPage::DeactivatePage( SfxItemSet* _pSet ) 552 { 553 if ( _pSet ) 554 FillItemSet( *_pSet ); 555 return LEAVE_PAGE; 556 } 557 558