Line data Source code
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 _SVX_FRMDIRLBOX_HXX
21 : #define _SVX_FRMDIRLBOX_HXX
22 :
23 : #include <vcl/lstbox.hxx>
24 : #include <sfx2/itemconnect.hxx>
25 : #include <editeng/frmdir.hxx>
26 : #include "svx/svxdllapi.h"
27 :
28 : class SvxFrameDirectionItem;
29 :
30 : namespace svx {
31 :
32 : // ============================================================================
33 :
34 : /** This listbox contains entries to select horizontal text direction.
35 :
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.
38 : */
39 : class SVX_DLLPUBLIC FrameDirectionListBox : public ListBox
40 : {
41 : public:
42 : explicit FrameDirectionListBox( Window* pParent, const ResId& rResId );
43 : explicit FrameDirectionListBox( Window* pParent, WinBits nBits );
44 : virtual ~FrameDirectionListBox();
45 :
46 : /** Inserts a string with corresponding direction enum into the listbox. */
47 : void InsertEntryValue(
48 : const String& rString,
49 : SvxFrameDirection eDirection,
50 : sal_uInt16 nPos = LISTBOX_APPEND );
51 : /** Removes the entry, that represents the specified frame direction. */
52 : void RemoveEntryValue( SvxFrameDirection eDirection );
53 :
54 : /** Selects the specified frame direction. */
55 : void SelectEntryValue( SvxFrameDirection eDirection );
56 : /** Returns the currently selected frame direction. */
57 : SvxFrameDirection GetSelectEntryValue() const;
58 :
59 : /** Saves the currently selected frame direction. */
60 0 : inline void SaveValue() { meSaveValue = GetSelectEntryValue(); }
61 : /** Returns the frame direction saved with SaveValue(). */
62 0 : inline SvxFrameDirection GetSavedValue() const { return meSaveValue; }
63 :
64 : private:
65 : SvxFrameDirection meSaveValue; /// Saved value for later comparison.
66 : };
67 :
68 : typedef FrameDirectionListBox FrameDirListBox;
69 :
70 : // ============================================================================
71 :
72 : /** Wrapper for usage of a FrameDirectionListBox in item connections. */
73 0 : class SVX_DLLPUBLIC FrameDirListBoxWrapper : public sfx::SingleControlWrapper< FrameDirListBox, SvxFrameDirection >
74 : {
75 : public:
76 : explicit FrameDirListBoxWrapper( FrameDirListBox& rListBox );
77 :
78 : virtual bool IsControlDontKnow() const;
79 : virtual void SetControlDontKnow( bool bSet );
80 :
81 : virtual SvxFrameDirection GetControlValue() const;
82 : virtual void SetControlValue( SvxFrameDirection eValue );
83 : };
84 :
85 : /** Wrapper for usage of a SvxFrameDirectionItem in item connections. */
86 : typedef sfx::ValueItemWrapper< SvxFrameDirectionItem, SvxFrameDirection, sal_uInt16 > FrameDirItemWrapper;
87 :
88 : /** An item<->control connection for a FrameDirectionListBox. */
89 : typedef sfx::ItemControlConnection< FrameDirItemWrapper, FrameDirListBoxWrapper > FrameDirListBoxConnection;
90 :
91 : // ============================================================================
92 :
93 : } // namespace svx
94 :
95 : #endif
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|