Branch libreoffice-5-0-4
[LibreOffice.git] / include / svx / frmdirlbox.hxx
blob76b3b242113e90dc79d06c78eba0cf8816980a1c
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 .
20 #ifndef INCLUDED_SVX_FRMDIRLBOX_HXX
21 #define INCLUDED_SVX_FRMDIRLBOX_HXX
23 #include <vcl/lstbox.hxx>
24 #include <sfx2/itemconnect.hxx>
25 #include <editeng/frmdir.hxx>
26 #include <svx/svxdllapi.h>
28 class SvxFrameDirectionItem;
30 namespace svx {
34 /** This listbox contains entries to select horizontal text direction.
36 The control works on the SvxFrameDirection enumeration (i.e. left-to-right,
37 right-to-left), used i.e. in conjunction with the SvxFrameDirectionItem.
39 class SVX_DLLPUBLIC SAL_WARN_UNUSED FrameDirectionListBox : public ListBox
41 public:
42 explicit FrameDirectionListBox( vcl::Window* pParent, WinBits nBits );
44 /** Inserts a string with corresponding direction enum into the listbox. */
45 void InsertEntryValue(
46 const OUString& rString,
47 SvxFrameDirection eDirection,
48 sal_Int32 nPos = LISTBOX_APPEND );
49 /** Removes the entry, that represents the specified frame direction. */
50 void RemoveEntryValue( SvxFrameDirection eDirection );
52 /** Selects the specified frame direction. */
53 void SelectEntryValue( SvxFrameDirection eDirection );
54 /** Returns the currently selected frame direction. */
55 SvxFrameDirection GetSelectEntryValue() const;
57 /** Saves the currently selected frame direction. */
58 inline void SaveValue() { meSaveValue = GetSelectEntryValue(); }
59 /** Returns the frame direction saved with SaveValue(). */
60 inline SvxFrameDirection GetSavedValue() const { return meSaveValue; }
62 private:
63 SvxFrameDirection meSaveValue; /// Saved value for later comparison.
66 typedef FrameDirectionListBox FrameDirListBox;
70 /** Wrapper for usage of a FrameDirectionListBox in item connections. */
71 class SVX_DLLPUBLIC SAL_WARN_UNUSED FrameDirListBoxWrapper : public sfx::SingleControlWrapper< FrameDirListBox, SvxFrameDirection >
73 public:
74 explicit FrameDirListBoxWrapper( FrameDirListBox& rListBox );
76 virtual bool IsControlDontKnow() const SAL_OVERRIDE;
77 virtual void SetControlDontKnow( bool bSet ) SAL_OVERRIDE;
79 virtual SvxFrameDirection GetControlValue() const SAL_OVERRIDE;
80 virtual void SetControlValue( SvxFrameDirection eValue ) SAL_OVERRIDE;
83 /** Wrapper for usage of a SvxFrameDirectionItem in item connections. */
84 typedef sfx::ValueItemWrapper< SvxFrameDirectionItem, SvxFrameDirection, sal_uInt16 > FrameDirItemWrapper;
86 /** An item<->control connection for a FrameDirectionListBox. */
87 typedef sfx::ItemControlConnection< FrameDirItemWrapper, FrameDirListBoxWrapper > FrameDirListBoxConnection;
93 #endif
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */