/src/libreoffice/include/svx/frmdirlbox.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #ifndef INCLUDED_SVX_FRMDIRLBOX_HXX |
21 | | #define INCLUDED_SVX_FRMDIRLBOX_HXX |
22 | | |
23 | | #include <vcl/weld/ComboBox.hxx> |
24 | | #include <editeng/frmdir.hxx> |
25 | | #include <svx/svxdllapi.h> |
26 | | |
27 | | namespace svx |
28 | | { |
29 | | /** This listbox contains entries to select horizontal text direction. |
30 | | |
31 | | The control works on the SvxFrameDirection enumeration (i.e. left-to-right, |
32 | | right-to-left), used i.e. in conjunction with the SvxFrameDirectionItem. |
33 | | */ |
34 | | class SAL_WARN_UNUSED SVX_DLLPUBLIC FrameDirectionListBox |
35 | | { |
36 | | private: |
37 | | std::unique_ptr<weld::ComboBox> m_xControl; |
38 | | |
39 | | public: |
40 | | explicit FrameDirectionListBox(std::unique_ptr<weld::ComboBox> pControl); |
41 | | virtual ~FrameDirectionListBox(); |
42 | 0 | bool get_visible() const { return m_xControl->get_visible(); } |
43 | 0 | void save_value() { m_xControl->save_value(); } |
44 | 0 | bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); } |
45 | | SvxFrameDirection get_active_id() const |
46 | 0 | { |
47 | 0 | return static_cast<SvxFrameDirection>(m_xControl->get_active_id().toUInt32()); |
48 | 0 | } |
49 | | void set_active_id(SvxFrameDirection eDir) |
50 | 0 | { |
51 | 0 | m_xControl->set_active_id(OUString::number(static_cast<sal_uInt32>(eDir))); |
52 | 0 | } |
53 | | void remove_id(SvxFrameDirection eDir) |
54 | 0 | { |
55 | 0 | int nPos = m_xControl->find_id(OUString::number(static_cast<sal_uInt32>(eDir))); |
56 | 0 | if (nPos != -1) |
57 | 0 | m_xControl->remove(nPos); |
58 | 0 | } |
59 | 0 | void set_active(int pos) { m_xControl->set_active(pos); } |
60 | 0 | int get_active() const { return m_xControl->get_active(); } |
61 | 0 | void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } |
62 | 0 | void hide() { m_xControl->hide(); } |
63 | 0 | void set_visible(bool bVisible) { m_xControl->set_visible(bVisible); } |
64 | 0 | void show() { m_xControl->show(); } |
65 | 0 | int get_count() const { return m_xControl->get_count(); } |
66 | | /** Inserts a string with corresponding direction enum into the listbox. */ |
67 | | void append(SvxFrameDirection eDirection, const OUString& rString) |
68 | 0 | { |
69 | 0 | m_xControl->append(OUString::number(static_cast<sal_uInt32>(eDirection)), rString); |
70 | 0 | } |
71 | | void connect_changed(const Link<weld::ComboBox&, void>& rLink) |
72 | 0 | { |
73 | 0 | m_xControl->connect_changed(rLink); |
74 | 0 | } |
75 | | }; |
76 | | } |
77 | | |
78 | | #endif |
79 | | |
80 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |