xref: /aoo4110/main/svx/inc/svx/frmdirlbox.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVX_FRMDIRLBOX_HXX
25 #define _SVX_FRMDIRLBOX_HXX
26 
27 #ifndef _LSTBOX_HXX
28 #include <vcl/lstbox.hxx>
29 #endif
30 #include <sfx2/itemconnect.hxx>
31 #include <editeng/frmdir.hxx>
32 #include "svx/svxdllapi.h"
33 
34 class SvxFrameDirectionItem;
35 
36 namespace svx {
37 
38 // ============================================================================
39 
40 /** This listbox contains entries to select horizontal text direction.
41 
42     The control works on the SvxFrameDirection enumeration (i.e. left-to-right,
43     right-to-left), used i.e. in conjunction with the SvxFrameDirectionItem.
44  */
45 class SVX_DLLPUBLIC FrameDirectionListBox : public ListBox
46 {
47 public:
48     explicit            FrameDirectionListBox( Window* pParent, WinBits nStyle = WB_BORDER );
49     explicit            FrameDirectionListBox( Window* pParent, const ResId& rResId );
50     virtual             ~FrameDirectionListBox();
51 
52     /** Inserts a string with corresponding direction enum into the listbox. */
53     void                InsertEntryValue(
54                             const String& rString,
55                             SvxFrameDirection eDirection,
56                             sal_uInt16 nPos = LISTBOX_APPEND );
57     /** Removes the entry, that represents the specified frame direction. */
58     void                RemoveEntryValue( SvxFrameDirection eDirection );
59 
60     /** Selects the specified frame direction. */
61     void                SelectEntryValue( SvxFrameDirection eDirection );
62     /** Returns the currently selected frame direction. */
63     SvxFrameDirection   GetSelectEntryValue() const;
64 
65     /** Saves the currently selected frame direction. */
SaveValue()66     inline void         SaveValue() { meSaveValue = GetSelectEntryValue(); }
67     /** Returns the frame direction saved with SaveValue(). */
GetSavedValue() const68     inline SvxFrameDirection GetSavedValue() const { return meSaveValue; }
69 
70 private:
71     SvxFrameDirection   meSaveValue;    /// Saved value for later comparison.
72 };
73 
74 typedef FrameDirectionListBox FrameDirListBox;
75 
76 // ============================================================================
77 
78 /** Wrapper for usage of a FrameDirectionListBox in item connections. */
79 class SVX_DLLPUBLIC FrameDirListBoxWrapper : public sfx::SingleControlWrapper< FrameDirListBox, SvxFrameDirection >
80 {
81 public:
82     explicit            FrameDirListBoxWrapper( FrameDirListBox& rListBox );
83 
84     virtual bool        IsControlDontKnow() const;
85     virtual void        SetControlDontKnow( bool bSet );
86 
87     virtual SvxFrameDirection GetControlValue() const;
88     virtual void        SetControlValue( SvxFrameDirection eValue );
89 };
90 
91 /** Wrapper for usage of a SvxFrameDirectionItem in item connections. */
92 typedef sfx::ValueItemWrapper< SvxFrameDirectionItem, SvxFrameDirection, sal_uInt16 > FrameDirItemWrapper;
93 
94 /** An item<->control connection for a FrameDirectionListBox. */
95 typedef sfx::ItemControlConnection< FrameDirItemWrapper, FrameDirListBoxWrapper > FrameDirListBoxConnection;
96 
97 // ============================================================================
98 
99 } // namespace svx
100 
101 #endif
102 
103