summaryrefslogtreecommitdiff
path: root/sfx2/source/dialog/srchdlg.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-12-06 13:35:26 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-12-06 14:18:10 +0000
commitd6407c8804841dbb94d6a4398e4300e9f188049f (patch)
tree54a3539183017e798accdcc87c1f8b2fec76d5f2 /sfx2/source/dialog/srchdlg.cxx
parentc2c7e4d8d99483f74a7aa357de89240eb83c99d3 (diff)
convert search dialog to .ui
Change-Id: I737da11ed6978edf824f00dfb3dfc29c2c5416ed
Diffstat (limited to 'sfx2/source/dialog/srchdlg.cxx')
-rw-r--r--sfx2/source/dialog/srchdlg.cxx83
1 files changed, 32 insertions, 51 deletions
diff --git a/sfx2/source/dialog/srchdlg.cxx b/sfx2/source/dialog/srchdlg.cxx
index 6d3c5852b6f4..3c14275d705e 100644
--- a/sfx2/source/dialog/srchdlg.cxx
+++ b/sfx2/source/dialog/srchdlg.cxx
@@ -23,7 +23,6 @@
#include <sfx2/sfxresid.hxx>
#include <sfx2/sfxuno.hxx>
-#include "srchdlg.hrc"
#include "dialog.hrc"
#include <tools/debug.hxx>
#include <unotools/viewoptions.hxx>
@@ -40,35 +39,25 @@ namespace sfx2 {
// SearchDialog
// ============================================================================
-SearchDialog::SearchDialog( Window* pWindow, const OUString& rConfigName ) :
-
- ModelessDialog( pWindow, SfxResId( RID_DLG_SEARCH ) ),
-
- m_aSearchLabel ( this, SfxResId( FT_SEARCH ) ),
- m_aSearchEdit ( this, SfxResId( ED_SEARCH ) ),
- m_aWholeWordsBox ( this, SfxResId( CB_WHOLEWORDS ) ),
- m_aMatchCaseBox ( this, SfxResId( CB_MATCHCASE ) ),
- m_aWrapAroundBox ( this, SfxResId( CB_WRAPAROUND ) ),
- m_aBackwardsBox ( this, SfxResId( CB_BACKWARDS ) ),
- m_aFindBtn ( this, SfxResId( PB_FIND ) ),
- m_aCancelBtn ( this, SfxResId( PB_CANCELFIND ) ),
- m_sToggleText ( SfxResId( STR_TOGGLE ).toString() ),
- m_sConfigName ( rConfigName ),
- m_bIsConstructed ( false )
+SearchDialog::SearchDialog(Window* pWindow, const OUString& rConfigName)
+ : ModelessDialog(pWindow, "SearchDialog", "sfx/ui/searchdialog.ui")
+ , m_sConfigName(rConfigName)
+ , m_bIsConstructed(false)
{
- FreeResource();
+ get(m_pSearchEdit, "searchterm");
+ get(m_pWholeWordsBox, "wholewords");
+ get(m_pMatchCaseBox, "matchcase");
+ get(m_pWrapAroundBox, "wrap");
+ get(m_pBackwardsBox, "backwards");
+ get(m_pFindBtn, "search");
// set handler
- m_aFindBtn.SetClickHdl( LINK( this, SearchDialog, FindHdl ) );
- m_aBackwardsBox.SetClickHdl( LINK( this, SearchDialog, ToggleHdl ) );
+ m_pFindBtn->SetClickHdl( LINK( this, SearchDialog, FindHdl ) );
// load config: old search strings and the status of the check boxes
LoadConfig();
- // we need to change the text of the WrapAround box, depends on the status of the Backwards box
- if ( m_aBackwardsBox.IsChecked() )
- ToggleHdl( &m_aBackwardsBox );
// the search edit should have the focus
- m_aSearchEdit.GrabFocus();
+ m_pSearchEdit->GrabFocus();
}
SearchDialog::~SearchDialog()
@@ -91,19 +80,19 @@ void SearchDialog::LoadConfig()
DBG_ASSERT( comphelper::string::getTokenCount(sUserData, ';') == 5, "invalid config data" );
sal_Int32 nIdx = 0;
OUString sSearchText = sUserData.getToken( 0, ';', nIdx );
- m_aWholeWordsBox.Check( sUserData.getToken( 0, ';', nIdx ).toInt32() == 1 );
- m_aMatchCaseBox.Check( sUserData.getToken( 0, ';', nIdx ).toInt32() == 1 );
- m_aWrapAroundBox.Check( sUserData.getToken( 0, ';', nIdx ).toInt32() == 1 );
- m_aBackwardsBox.Check( sUserData.getToken( 0, ';', nIdx ).toInt32() == 1 );
+ m_pWholeWordsBox->Check( sUserData.getToken( 0, ';', nIdx ).toInt32() == 1 );
+ m_pMatchCaseBox->Check( sUserData.getToken( 0, ';', nIdx ).toInt32() == 1 );
+ m_pWrapAroundBox->Check( sUserData.getToken( 0, ';', nIdx ).toInt32() == 1 );
+ m_pBackwardsBox->Check( sUserData.getToken( 0, ';', nIdx ).toInt32() == 1 );
nIdx = 0;
while ( nIdx != -1 )
- m_aSearchEdit.InsertEntry( sSearchText.getToken( 0, '\t', nIdx ) );
- m_aSearchEdit.SelectEntryPos(0);
+ m_pSearchEdit->InsertEntry( sSearchText.getToken( 0, '\t', nIdx ) );
+ m_pSearchEdit->SelectEntryPos(0);
}
}
else
- m_aWrapAroundBox.Check( sal_True );
+ m_pWrapAroundBox->Check( sal_True );
}
void SearchDialog::SaveConfig()
@@ -111,21 +100,21 @@ void SearchDialog::SaveConfig()
SvtViewOptions aViewOpt( E_DIALOG, m_sConfigName );
aViewOpt.SetWindowState(OStringToOUString(m_sWinState, RTL_TEXTENCODING_ASCII_US));
OUString sUserData;
- sal_uInt16 i = 0, nCount = std::min( m_aSearchEdit.GetEntryCount(), MAX_SAVE_COUNT );
+ sal_uInt16 i = 0, nCount = std::min( m_pSearchEdit->GetEntryCount(), MAX_SAVE_COUNT );
for ( ; i < nCount; ++i )
{
- sUserData += m_aSearchEdit.GetEntry(i);
+ sUserData += m_pSearchEdit->GetEntry(i);
sUserData += "\t";
}
sUserData = comphelper::string::stripStart(sUserData, '\t');
sUserData += ";";
- sUserData += OUString::number( m_aWholeWordsBox.IsChecked() ? 1 : 0 );
+ sUserData += OUString::number( m_pWholeWordsBox->IsChecked() ? 1 : 0 );
sUserData += ";";
- sUserData += OUString::number( m_aMatchCaseBox.IsChecked() ? 1 : 0 );
+ sUserData += OUString::number( m_pMatchCaseBox->IsChecked() ? 1 : 0 );
sUserData += ";";
- sUserData += OUString::number( m_aWrapAroundBox.IsChecked() ? 1 : 0 );
+ sUserData += OUString::number( m_pWrapAroundBox->IsChecked() ? 1 : 0 );
sUserData += ";";
- sUserData += OUString::number( m_aBackwardsBox.IsChecked() ? 1 : 0 );
+ sUserData += OUString::number( m_pBackwardsBox->IsChecked() ? 1 : 0 );
Any aUserItem = makeAny( OUString( sUserData ) );
aViewOpt.SetUserItem( "UserItem", aUserItem );
@@ -133,29 +122,21 @@ void SearchDialog::SaveConfig()
IMPL_LINK_NOARG(SearchDialog, FindHdl)
{
- OUString sSrchTxt = m_aSearchEdit.GetText();
- sal_uInt16 nPos = m_aSearchEdit.GetEntryPos( sSrchTxt );
+ OUString sSrchTxt = m_pSearchEdit->GetText();
+ sal_uInt16 nPos = m_pSearchEdit->GetEntryPos( sSrchTxt );
if ( nPos > 0 && nPos != COMBOBOX_ENTRY_NOTFOUND )
- m_aSearchEdit.RemoveEntryAt(nPos);
+ m_pSearchEdit->RemoveEntryAt(nPos);
if ( nPos > 0 )
- m_aSearchEdit.InsertEntry( sSrchTxt, 0 );
+ m_pSearchEdit->InsertEntry( sSrchTxt, 0 );
m_aFindHdl.Call( this );
return 0;
}
-IMPL_LINK_NOARG(SearchDialog, ToggleHdl)
-{
- OUString sTemp = m_aWrapAroundBox.GetText();
- m_aWrapAroundBox.SetText( m_sToggleText );
- m_sToggleText = sTemp;
- return 0;
-}
-
void SearchDialog::SetFocusOnEdit()
{
- Selection aSelection( 0, m_aSearchEdit.GetText().getLength() );
- m_aSearchEdit.SetSelection( aSelection );
- m_aSearchEdit.GrabFocus();
+ Selection aSelection( 0, m_pSearchEdit->GetText().getLength() );
+ m_pSearchEdit->SetSelection( aSelection );
+ m_pSearchEdit->GrabFocus();
}
sal_Bool SearchDialog::Close()