xref: /aoo42x/main/sfx2/inc/srchdlg.hxx (revision 353d8f4d)
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 #ifndef _SFX_SRCHDLG_HXX_
24 #define _SFX_SRCHDLG_HXX_
25 
26 #ifndef _VCL_BUTTON_HXX
27 #include <vcl/button.hxx>
28 #endif
29 #include <vcl/combobox.hxx>
30 #ifndef _VCL_EDIT_HXX
31 #include <vcl/edit.hxx>
32 #endif
33 #ifndef _VCL_FIXED_HXX
34 #include <vcl/fixed.hxx>
35 #endif
36 #include <sfx2/basedlgs.hxx>
37 
38 // ============================================================================
39 
40 namespace sfx2 {
41 
42 // ============================================================================
43 // SearchDialog
44 // ============================================================================
45 
46 class SearchDialog : public ModelessDialog
47 {
48 private:
49 	FixedText			m_aSearchLabel;
50 	ComboBox			m_aSearchEdit;
51 	CheckBox			m_aWholeWordsBox;
52 	CheckBox			m_aMatchCaseBox;
53 	CheckBox			m_aWrapAroundBox;
54 	CheckBox			m_aBackwardsBox;
55 	PushButton			m_aFindBtn;
56 	CancelButton		m_aCancelBtn;
57 
58 	Link				m_aFindHdl;
59 	Link				m_aCloseHdl;
60 
61 	String				m_sToggleText;
62 	::rtl::OUString		m_sConfigName;
63 	ByteString			m_sWinState;
64 
65 	bool				m_bIsConstructed;
66 
67 	void				LoadConfig();
68 	void				SaveConfig();
69 
70 	DECL_LINK(			FindHdl, PushButton* );
71 	DECL_LINK(			ToggleHdl, CheckBox* );
72 
73 public:
74 	SearchDialog( Window* pWindow, const ::rtl::OUString& rConfigName );
75 	~SearchDialog();
76 
SetFindHdl(const Link & rLink)77 	inline void			SetFindHdl( const Link& rLink ) { m_aFindHdl = rLink; }
SetCloseHdl(const Link & rLink)78 	inline void			SetCloseHdl( const Link& rLink ) { m_aCloseHdl = rLink; }
79 
GetSearchText() const80 	inline String		GetSearchText() const { return m_aSearchEdit.GetText(); }
SetSearchText(const String & _rText)81 	inline void			SetSearchText( const String& _rText ) { m_aSearchEdit.SetText( _rText ); }
IsOnlyWholeWords() const82 	inline bool			IsOnlyWholeWords() const { return ( m_aWholeWordsBox.IsChecked() != sal_False ); }
IsMarchCase() const83 	inline bool			IsMarchCase() const { return ( m_aMatchCaseBox.IsChecked() != sal_False ); }
IsWrapAround() const84 	inline bool			IsWrapAround() const { return ( m_aWrapAroundBox.IsChecked() != sal_False ); }
IsSearchBackwards() const85 	inline bool			IsSearchBackwards() const { return ( m_aBackwardsBox.IsChecked() != sal_False ); }
86 
87 	void				SetFocusOnEdit();
88 
89 	virtual sal_Bool		Close();
90     virtual void		Move();
91     virtual void		StateChanged( StateChangedType nStateChange );
92 };
93 
94 // ============================================================================
95 
96 } // namespace sfx2
97 
98 // ============================================================================
99 
100 #endif // _SFX_SRCHDLG_HXX_
101 
102