1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SW_SOURCE_UIBASE_INC_CONDEDIT_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_CONDEDIT_HXX
22 #include <vcl/transfer.hxx>
23 #include <vcl/weld.hxx>
28 class SW_DLLPUBLIC ConditionEditDropTarget
: public DropTargetHelper
31 ConditionEdit
& m_rEdit
;
33 SAL_DLLPRIVATE
virtual sal_Int8
AcceptDrop(const AcceptDropEvent
& rEvt
) override
;
34 SAL_DLLPRIVATE
virtual sal_Int8
ExecuteDrop(const ExecuteDropEvent
& rEvt
) override
;
37 ConditionEditDropTarget(ConditionEdit
& rEdit
);
40 class SW_DLLPUBLIC ConditionEdit
42 std::unique_ptr
<weld::Entry
> m_xControl
;
43 ConditionEditDropTarget m_aDropTargetHelper
;
44 bool bBrackets
, bEnableDrop
;
47 ConditionEdit(std::unique_ptr
<weld::Entry
> xControl
);
49 OUString
get_text() const { return m_xControl
->get_text(); }
50 void set_text(const OUString
& rText
) { m_xControl
->set_text(rText
); }
51 void set_visible(bool bVisible
) { m_xControl
->set_visible(bVisible
); }
52 void set_accessible_name(const OUString
& rName
) { m_xControl
->set_accessible_name(rName
); }
53 void save_value() { m_xControl
->save_value(); }
54 bool get_value_changed_from_saved() const { return m_xControl
->get_value_changed_from_saved(); }
55 void set_sensitive(bool bSensitive
) { m_xControl
->set_sensitive(bSensitive
); }
56 void connect_changed(const Link
<weld::Entry
&, void>& rLink
)
58 m_xControl
->connect_changed(rLink
);
60 void replace_selection(const OUString
& rText
) { m_xControl
->replace_selection(rText
); }
61 void hide() { m_xControl
->hide(); }
62 weld::Entry
& get_widget() { return *m_xControl
; }
64 void ShowBrackets(bool bShow
) { bBrackets
= bShow
; }
65 bool GetBrackets() const { return bBrackets
; }
66 void SetDropEnable(bool bFlag
) { bEnableDrop
= bFlag
; }
67 bool GetDropEnable() const { return bEnableDrop
; }
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */