diff options
author | Samuel Cantrell <samuelcantrell@gmail.com> | 2011-06-16 09:57:53 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2011-06-16 09:57:53 +0200 |
commit | 24cad429294b20bb5ab6dd00aab202e209946b5b (patch) | |
tree | ae193abd5cb8cba6b2c68a1e22e1482fe9ea32b7 /cui/source/options/optinet2.cxx | |
parent | f9c2beb2cdb4ae448d22ae390c63159b88df9e9e (diff) |
remove Search Options page from Internet group on Options dialog fdo#38146
Diffstat (limited to 'cui/source/options/optinet2.cxx')
-rw-r--r-- | cui/source/options/optinet2.cxx | 407 |
1 files changed, 0 insertions, 407 deletions
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 87979ed9b402..1921d3655ff0 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -635,413 +635,6 @@ IMPL_LINK( SvxProxyTabPage, LoseFocusHdl_Impl, Edit *, pEdit ) } -/********************************************************************/ -/* */ -/* SvxSearchTabPage */ -/* */ -/********************************************************************/ - -SvxSearchTabPage::SvxSearchTabPage(Window* pParent, const SfxItemSet& rSet ) : - - SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_INET_SEARCH ), rSet ), - - aSearchGB ( this, CUI_RES( GB_SEARCH ) ), - aSearchLB ( this, CUI_RES( LB_SEARCH ) ), - aSearchNameFT ( this, CUI_RES( FT_SEARCH_NAME ) ), - aSearchNameED ( this, CUI_RES( ED_SEARCH_NAME ) ), - aSearchFT ( this, CUI_RES( FT_SEARCH ) ), - aAndRB ( this, CUI_RES( RB_AND ) ), - aOrRB ( this, CUI_RES( RB_OR ) ), - aExactRB ( this, CUI_RES( RB_EXACT ) ), - - aURLFT ( this, CUI_RES( FT_URL ) ), - aURLED ( this, CUI_RES( ED_URL ) ), - - aPostFixFT ( this, CUI_RES( FT_POSTFIX ) ), - aPostFixED ( this, CUI_RES( ED_POSTFIX ) ), - aSeparatorFT ( this, CUI_RES( FT_SEPARATOR ) ), - aSeparatorED ( this, CUI_RES( ED_SEPARATOR ) ), - aCaseFT ( this, CUI_RES( FT_CASE ) ), - aCaseED ( this, CUI_RES( ED_CASE ) ), - - aNewPB ( this, CUI_RES( PB_NEW ) ), - aAddPB ( this, CUI_RES( PB_ADD ) ), - aChangePB ( this, CUI_RES( PB_CHANGE ) ), - aDeletePB ( this, CUI_RES( PB_DELETE ) ), - - sModifyMsg(CUI_RES(MSG_MODIFY)) -{ - FreeResource(); - - SetExchangeSupport(); - aCaseED.SelectEntryPos(0); // falls kein Eintrag vorhanden ist, kann es sonst "Arger geben - - aNewPB.SetClickHdl(LINK( this, SvxSearchTabPage, NewSearchHdl_Impl ) ); - aAddPB.SetClickHdl(LINK( this, SvxSearchTabPage, AddSearchHdl_Impl ) ); - aChangePB.SetClickHdl(LINK( this, SvxSearchTabPage, ChangeSearchHdl_Impl ) ); - aDeletePB.SetClickHdl(LINK( this, SvxSearchTabPage, DeleteSearchHdl_Impl ) ); - aSearchLB.SetSelectHdl(LINK( this, SvxSearchTabPage, SearchEntryHdl_Impl ) ); - - Link aLink = LINK( this, SvxSearchTabPage, SearchModifyHdl_Impl ); - aSearchNameED.SetModifyHdl( aLink ); - aURLED.SetModifyHdl( aLink ); - aSeparatorED.SetModifyHdl( aLink ); - aPostFixED.SetModifyHdl( aLink ); - aCaseED.SetSelectHdl( aLink ); - - aLink = LINK( this, SvxSearchTabPage, SearchPartHdl_Impl ); - aAndRB.SetClickHdl( aLink ); - aOrRB.SetClickHdl( aLink ); - aExactRB.SetClickHdl( aLink ); - - InitControls_Impl(); -} - -// ----------------------------------------------------------------------- -SvxSearchTabPage::~SvxSearchTabPage() -{ -} -// ----------------------------------------------------------------------- - -SfxTabPage* SvxSearchTabPage::Create(Window* pParent, const SfxItemSet& rAttrSet ) -{ - return new SvxSearchTabPage(pParent, rAttrSet); -} - -// ----------------------------------------------------------------------- - -void SvxSearchTabPage::Reset( const SfxItemSet& ) -{ - //The two lines below are moved here from the last part of this method - aChangePB.Disable(); - aAddPB.Disable(); - - sal_uInt16 nCount = aSearchConfig.Count(); - aSearchLB.Clear(); - for(sal_uInt16 i = 0; i < nCount; i++) - { - const SvxSearchEngineData& rData = aSearchConfig.GetData(i); - aSearchLB.InsertEntry(rData.sEngineName); - } - - if ( nCount ) - { - aSearchLB.SelectEntryPos(0); - SearchEntryHdl_Impl( &aSearchLB ); - } - else - aDeletePB.Disable(); -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxSearchTabPage::FillItemSet( SfxItemSet& ) -{ - if(aSearchConfig.IsModified()) - aSearchConfig.Commit(); - return sal_True; -} -/*--------------------------------------------------------------------*/ - -void SvxSearchTabPage::ActivatePage( const SfxItemSet& ) -{ -} - -/*--------------------------------------------------------------------*/ - -int SvxSearchTabPage::DeactivatePage( SfxItemSet* _pSet ) -{ - if(!ConfirmLeave(String())) - return KEEP_PAGE; - - if ( _pSet ) - FillItemSet( *_pSet ); - return LEAVE_PAGE; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxSearchTabPage::ConfirmLeave( const String& rStringSelection) -{ - if(aChangePB.IsEnabled()) - { - QueryBox aQuery(this, WB_YES_NO_CANCEL|WB_DEF_YES, sModifyMsg); - sal_uInt16 nRet = aQuery.Execute(); - if(RET_CANCEL == nRet) - { - if(rStringSelection.Len()) - aSearchLB.SelectEntry(sLastSelectedEntry); - return sal_False; - } - else if(RET_YES == nRet) - { - sal_uInt16 nEntryPos = aSearchLB.GetEntryPos( aSearchNameED.GetText() ); - if ( nEntryPos != LISTBOX_ENTRY_NOTFOUND ) - aSearchLB.SelectEntryPos(nEntryPos); - else - aSearchLB.SetNoSelection(); - ChangeSearchHdl_Impl(0); - if(rStringSelection.Len()) - aSearchLB.SelectEntry(rStringSelection); - } - else if(RET_NO == nRet) - { - aChangePB.Enable(sal_False); - aAddPB.Enable(sal_False); - SearchEntryHdl_Impl(&aSearchLB); - } - } - if(aAddPB.IsEnabled()) - { - QueryBox aQuery(this, WB_YES_NO_CANCEL|WB_DEF_YES, sModifyMsg); - sal_uInt16 nRet = aQuery.Execute(); - if(RET_CANCEL == nRet) - { - aSearchLB.SetNoSelection(); - return sal_False; - } - else if(RET_YES == nRet) - { - aSearchLB.SetNoSelection(); - AddSearchHdl_Impl(0); - if(rStringSelection.Len()) - aSearchLB.SelectEntry(rStringSelection); - } - else if(RET_NO == nRet) - { - aAddPB.Enable(sal_False); - aChangePB.Enable(sal_False); - NewSearchHdl_Impl(0); - } - - } - return sal_True; -} - -// ----------------------------------------------------------------------- - -void SvxSearchTabPage::InitControls_Impl() -{ - // detect longest label text - sal_Int32 i = 0; - long nLabelTextWidth = 0; - Window* pLabels[] = { &aSearchNameFT, &aSearchFT, &aURLFT, &aPostFixFT, &aSeparatorFT, &aCaseFT }; - Window** pLabel = pLabels; - const sal_Int32 nLabelCount = SAL_N_ELEMENTS( pLabels ); - for ( ; i < nLabelCount; ++i, ++pLabel ) - { - long nTemp = (*pLabel)->GetCtrlTextWidth( (*pLabel)->GetText() ); - if ( nTemp > nLabelTextWidth ) - nLabelTextWidth = nTemp; - } - - // resize all labels - nLabelTextWidth = nLabelTextWidth * 120 / 100; // additional space looks better - const long nLabelWidth = aSearchNameFT.GetSizePixel().Width(); - const long nDelta = nLabelWidth - nLabelTextWidth; - pLabel = pLabels; - for ( i = 0; i < nLabelCount; ++i, ++pLabel ) - { - Size aNewSize = (*pLabel)->GetSizePixel(); - aNewSize.Width() += nDelta; - (*pLabel)->SetSizePixel( aNewSize ); - } - - // resize and move the edits - Window* pEdits[] = { &aSearchNameED, &aAndRB, &aOrRB, - &aExactRB, &aURLED, &aPostFixED, &aSeparatorED, &aCaseED }; - Window** pEdit = pEdits; - const sal_Int32 nCCount = SAL_N_ELEMENTS( pEdits ); - for ( i = 0; i < nCCount; ++i, ++pEdit ) - { - Point aNewPos = (*pEdit)->GetPosPixel(); - aNewPos.X() -= nDelta; - Size aNewSize = (*pEdit)->GetSizePixel(); - if ( (*pEdit) != &aSeparatorED && (*pEdit) != &aCaseED ) - aNewSize.Width() += nDelta; - (*pEdit)->SetPosSizePixel( aNewPos, aNewSize ); - } -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxSearchTabPage, NewSearchHdl_Impl, PushButton *, EMPTYARG ) -{ - SearchEntryHdl_Impl(&aSearchLB); - if(aChangePB.IsEnabled() || aAddPB.IsEnabled()) - return 0; - aSearchNameED.SetText( String() ); - aSearchLB.SetNoSelection(); - aCurrentSrchData = SvxSearchEngineData(); - aAndRB.Check( sal_True ); - SearchEntryHdl_Impl( &aSearchLB ); - SearchPartHdl_Impl( &aAndRB ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxSearchTabPage, AddSearchHdl_Impl, PushButton *, EMPTYARG ) -{ - aAddPB.Enable(sal_False); - aChangePB.Enable(sal_False); - aCurrentSrchData.sEngineName = aSearchNameED.GetText(); - aSearchConfig.SetData(aCurrentSrchData); - aSearchLB.InsertEntry( aCurrentSrchData.sEngineName ); - aSearchLB.SelectEntry( aCurrentSrchData.sEngineName ); - SearchEntryHdl_Impl( &aSearchLB ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxSearchTabPage, ChangeSearchHdl_Impl, PushButton *, EMPTYARG ) -{ - aChangePB.Enable(sal_False); - aAddPB.Enable(sal_False); - sal_uInt16 nPos = aSearchLB.GetSelectEntryPos(); - if ( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - String sEngine = aSearchLB.GetSelectEntry(); - aCurrentSrchData.sEngineName = sEngine; - aSearchConfig.SetData(aCurrentSrchData); - aSearchLB.SelectEntry(sEngine); - SearchEntryHdl_Impl(&aSearchLB); - } - else - { - SetUpdateMode(sal_False); - String sEntry = aSearchNameED.GetText(); - // im AddHdl wird sLastSelectedEntry umgesetzt - String sTemp(sLastSelectedEntry); - AddSearchHdl_Impl(0); - aSearchLB.SelectEntry(sTemp); - DeleteSearchHdl_Impl(0); - aSearchLB.SelectEntry(sEntry); - SearchEntryHdl_Impl(&aSearchLB); - SetUpdateMode(sal_True); - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxSearchTabPage, DeleteSearchHdl_Impl, PushButton *, EMPTYARG) -{ - aChangePB.Enable(sal_False); - sal_uInt16 nPos = aSearchLB.GetSelectEntryPos(); - DBG_ASSERT(nPos != LISTBOX_ENTRY_NOTFOUND, "kein Eintrag selektiert!"); - aSearchConfig.RemoveData(aSearchLB.GetSelectEntry()); - aSearchLB.RemoveEntry(nPos); - aSearchLB.SelectEntryPos(0); - SearchEntryHdl_Impl(&aSearchLB); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxSearchTabPage, SearchEntryHdl_Impl, ListBox*, pBox ) -{ - sal_uInt16 nEntryPos = pBox->GetSelectEntryPos(); - if ( nEntryPos != LISTBOX_ENTRY_NOTFOUND ) - { - String sSelection(pBox->GetSelectEntry()); - if(!ConfirmLeave(sSelection)) - return 0; - - const SvxSearchEngineData* pData = aSearchConfig.GetData(sSelection); - DBG_ASSERT(pData, "SearchEngine not available"); - if(pData) - { - aSearchNameED.SetText(sSelection); - sLastSelectedEntry = sSelection; - sal_Bool bAnd = aAndRB.IsChecked(); - sal_Bool bOr = aOrRB.IsChecked(); - - aURLED.SetText(bAnd ? pData->sAndPrefix : bOr ? pData->sOrPrefix : pData->sExactPrefix); - aSeparatorED.SetText( bAnd ? pData->sAndSeparator : bOr ? pData->sOrSeparator : pData->sExactSeparator); - aPostFixED.SetText(bAnd ? pData->sAndSuffix : bOr ? pData->sOrSuffix : pData->sExactSuffix ); - sal_Int32 nCase = bAnd ? pData->nAndCaseMatch : bOr ? pData->nOrCaseMatch : pData->nExactCaseMatch; - aCaseED.SelectEntryPos( (sal_uInt16)nCase ); - aCurrentSrchData = *pData; - } - aDeletePB.Enable(); - } - else - { - aDeletePB.Enable(sal_False); - sLastSelectedEntry.Erase(); - } - aChangePB.Enable(sal_False); - aAddPB.Enable(sal_False); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxSearchTabPage, SearchModifyHdl_Impl, SvxNoSpaceEdit*, pEdit ) -{ - if ( pEdit == &aSearchNameED ) - { - sal_Bool bTextLen = ( 0 != pEdit->GetText().Len() ); - sal_Bool bFound = sal_False; - if ( bTextLen ) - { - sal_uInt16 nEntryPos = aSearchLB.GetEntryPos( pEdit->GetText() ); - bFound = ( nEntryPos != LISTBOX_ENTRY_NOTFOUND ); - if ( bFound ) - aSearchLB.SelectEntryPos(nEntryPos); - else - aSearchLB.SetNoSelection(); - } - aChangePB.Enable( sLastSelectedEntry.Len() > 0 ); - aDeletePB.Enable(bFound); - aAddPB.Enable(bTextLen && !bFound); - } - else - { - if ( aSearchLB.GetSelectEntryCount() && sLastSelectedEntry.Len() > 0 ) - aChangePB.Enable(); - - if(aAndRB.IsChecked()) - { - aCurrentSrchData.sAndPrefix = aURLED.GetText(); - aCurrentSrchData.sAndSeparator = aSeparatorED.GetText(); - aCurrentSrchData.sAndSuffix = aPostFixED.GetText(); - aCurrentSrchData.nAndCaseMatch = aCaseED.GetSelectEntryPos(); - } - else if(aOrRB.IsChecked()) - { - aCurrentSrchData.sOrPrefix = aURLED.GetText(); - aCurrentSrchData.sOrSeparator = aSeparatorED.GetText(); - aCurrentSrchData.sOrSuffix = aPostFixED.GetText(); - aCurrentSrchData.nOrCaseMatch = aCaseED.GetSelectEntryPos(); - } - else - { - aCurrentSrchData.sExactPrefix = aURLED.GetText(); - aCurrentSrchData.sExactSeparator = aSeparatorED.GetText(); - aCurrentSrchData.sExactSuffix = aPostFixED.GetText(); - aCurrentSrchData.nExactCaseMatch = aCaseED.GetSelectEntryPos(); - } - } - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( SvxSearchTabPage, SearchPartHdl_Impl, RadioButton *, EMPTYARG ) -{ - sal_Bool bAnd = aAndRB.IsChecked(); - sal_Bool bOr = aOrRB.IsChecked(); - - aURLED.SetText(bAnd ? aCurrentSrchData.sAndPrefix : bOr ? aCurrentSrchData.sOrPrefix : aCurrentSrchData.sExactPrefix); - aSeparatorED.SetText( bAnd ? aCurrentSrchData.sAndSeparator : bOr ? aCurrentSrchData.sOrSeparator : aCurrentSrchData.sExactSeparator); - aPostFixED.SetText(bAnd ? aCurrentSrchData.sAndSuffix : bOr ? aCurrentSrchData.sOrSuffix : aCurrentSrchData.sExactSuffix ); - sal_Int32 nCase = bAnd ? aCurrentSrchData.nAndCaseMatch : bOr ? aCurrentSrchData.nOrCaseMatch : aCurrentSrchData.nExactCaseMatch; - aCaseED.SelectEntryPos( (sal_uInt16)nCase ); - return 0; -} //#98647#---------------------------------------------- void SvxScriptExecListBox::RequestHelp( const HelpEvent& rHEvt ) |