Avoid potential negative array index access to cached text.
[LibreOffice.git] / sfx2 / inc / srchdlg.hxx
blobe5a675e99fdd7ea1cb65bc9e37a9f9231344c18e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SFX2_INC_SRCHDLG_HXX
20 #define INCLUDED_SFX2_INC_SRCHDLG_HXX
22 #include <vcl/weld.hxx>
24 namespace sfx2 {
27 // SearchDialog
30 class SearchDialog final : public weld::GenericDialogController
32 private:
33 Link<SearchDialog&,void> m_aFindHdl;
34 Link<LinkParamNone*,void> m_aCloseHdl;
36 OUString m_sConfigName;
38 std::unique_ptr<weld::ComboBox> m_xSearchEdit;
39 std::unique_ptr<weld::CheckButton> m_xWholeWordsBox;
40 std::unique_ptr<weld::CheckButton> m_xMatchCaseBox;
41 std::unique_ptr<weld::CheckButton> m_xWrapAroundBox;
42 std::unique_ptr<weld::CheckButton> m_xBackwardsBox;
43 std::unique_ptr<weld::Button> m_xFindBtn;
45 void LoadConfig();
46 void SaveConfig();
48 DECL_LINK(FindHdl, weld::Button&, void);
50 public:
51 SearchDialog(weld::Window* pWindow, OUString aConfigName);
52 static void runAsync(const std::shared_ptr<SearchDialog>& rController);
53 virtual ~SearchDialog() override;
55 void SetFindHdl( const Link<SearchDialog&,void>& rLink ) { m_aFindHdl = rLink; }
56 void SetCloseHdl( const Link<LinkParamNone*,void>& rLink ) { m_aCloseHdl = rLink; }
58 OUString GetSearchText() const { return m_xSearchEdit->get_active_text(); }
59 void SetSearchText( const OUString& _rText ) { m_xSearchEdit->set_entry_text( _rText ); }
60 bool IsOnlyWholeWords() const { return m_xWholeWordsBox->get_active(); }
61 bool IsMarchCase() const { return m_xMatchCaseBox->get_active(); }
62 bool IsWrapAround() const { return m_xWrapAroundBox->get_active(); }
63 bool IsSearchBackwards() const { return m_xBackwardsBox->get_active(); }
65 void SetFocusOnEdit();
68 } // namespace sfx2
71 #endif // INCLUDED_SFX2_INC_SRCHDLG_HXX
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */