xref: /trunk/main/sfx2/inc/srchdlg.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SFX_SRCHDLG_HXX_
28 #define _SFX_SRCHDLG_HXX_
29 
30 #ifndef _VCL_BUTTON_HXX
31 #include <vcl/button.hxx>
32 #endif
33 #include <vcl/combobox.hxx>
34 #ifndef _VCL_EDIT_HXX
35 #include <vcl/edit.hxx>
36 #endif
37 #ifndef _VCL_FIXED_HXX
38 #include <vcl/fixed.hxx>
39 #endif
40 #include <sfx2/basedlgs.hxx>
41 
42 // ============================================================================
43 
44 namespace sfx2 {
45 
46 // ============================================================================
47 // SearchDialog
48 // ============================================================================
49 
50 class SearchDialog : public ModelessDialog
51 {
52 private:
53 	FixedText			m_aSearchLabel;
54 	ComboBox			m_aSearchEdit;
55 	CheckBox			m_aWholeWordsBox;
56 	CheckBox			m_aMatchCaseBox;
57 	CheckBox			m_aWrapAroundBox;
58 	CheckBox			m_aBackwardsBox;
59 	PushButton			m_aFindBtn;
60 	CancelButton		m_aCancelBtn;
61 
62 	Link				m_aFindHdl;
63 	Link				m_aCloseHdl;
64 
65 	String				m_sToggleText;
66 	::rtl::OUString		m_sConfigName;
67 	ByteString			m_sWinState;
68 
69 	bool				m_bIsConstructed;
70 
71 	void				LoadConfig();
72 	void				SaveConfig();
73 
74 	DECL_LINK(			FindHdl, PushButton* );
75 	DECL_LINK(			ToggleHdl, CheckBox* );
76 
77 public:
78 	SearchDialog( Window* pWindow, const ::rtl::OUString& rConfigName );
79 	~SearchDialog();
80 
81 	inline void			SetFindHdl( const Link& rLink ) { m_aFindHdl = rLink; }
82 	inline void			SetCloseHdl( const Link& rLink ) { m_aCloseHdl = rLink; }
83 
84 	inline String		GetSearchText() const { return m_aSearchEdit.GetText(); }
85 	inline void			SetSearchText( const String& _rText ) { m_aSearchEdit.SetText( _rText ); }
86 	inline bool			IsOnlyWholeWords() const { return ( m_aWholeWordsBox.IsChecked() != sal_False ); }
87 	inline bool			IsMarchCase() const { return ( m_aMatchCaseBox.IsChecked() != sal_False ); }
88 	inline bool			IsWrapAround() const { return ( m_aWrapAroundBox.IsChecked() != sal_False ); }
89 	inline bool			IsSearchBackwards() const { return ( m_aBackwardsBox.IsChecked() != sal_False ); }
90 
91 	void				SetFocusOnEdit();
92 
93 	virtual sal_Bool		Close();
94     virtual void		Move();
95     virtual void		StateChanged( StateChangedType nStateChange );
96 };
97 
98 // ============================================================================
99 
100 } // namespace sfx2
101 
102 // ============================================================================
103 
104 #endif // _SFX_SRCHDLG_HXX_
105 
106