Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVX_FRMDIRLBOX_HXX
30 : : #define _SVX_FRMDIRLBOX_HXX
31 : :
32 : : #include <vcl/lstbox.hxx>
33 : : #include <sfx2/itemconnect.hxx>
34 : : #include <editeng/frmdir.hxx>
35 : : #include "svx/svxdllapi.h"
36 : :
37 : : class SvxFrameDirectionItem;
38 : :
39 : : namespace svx {
40 : :
41 : : // ============================================================================
42 : :
43 : : /** This listbox contains entries to select horizontal text direction.
44 : :
45 : : The control works on the SvxFrameDirection enumeration (i.e. left-to-right,
46 : : right-to-left), used i.e. in conjunction with the SvxFrameDirectionItem.
47 : : */
48 : : class SVX_DLLPUBLIC FrameDirectionListBox : public ListBox
49 : : {
50 : : public:
51 : : explicit FrameDirectionListBox( Window* pParent, const ResId& rResId );
52 : : virtual ~FrameDirectionListBox();
53 : :
54 : : /** Inserts a string with corresponding direction enum into the listbox. */
55 : : void InsertEntryValue(
56 : : const String& rString,
57 : : SvxFrameDirection eDirection,
58 : : sal_uInt16 nPos = LISTBOX_APPEND );
59 : : /** Removes the entry, that represents the specified frame direction. */
60 : : void RemoveEntryValue( SvxFrameDirection eDirection );
61 : :
62 : : /** Selects the specified frame direction. */
63 : : void SelectEntryValue( SvxFrameDirection eDirection );
64 : : /** Returns the currently selected frame direction. */
65 : : SvxFrameDirection GetSelectEntryValue() const;
66 : :
67 : : /** Saves the currently selected frame direction. */
68 : 0 : inline void SaveValue() { meSaveValue = GetSelectEntryValue(); }
69 : : /** Returns the frame direction saved with SaveValue(). */
70 : 0 : inline SvxFrameDirection GetSavedValue() const { return meSaveValue; }
71 : :
72 : : private:
73 : : SvxFrameDirection meSaveValue; /// Saved value for later comparison.
74 : : };
75 : :
76 : : typedef FrameDirectionListBox FrameDirListBox;
77 : :
78 : : // ============================================================================
79 : :
80 : : /** Wrapper for usage of a FrameDirectionListBox in item connections. */
81 [ # # ]: 0 : class SVX_DLLPUBLIC FrameDirListBoxWrapper : public sfx::SingleControlWrapper< FrameDirListBox, SvxFrameDirection >
82 : : {
83 : : public:
84 : : explicit FrameDirListBoxWrapper( FrameDirListBox& rListBox );
85 : :
86 : : virtual bool IsControlDontKnow() const;
87 : : virtual void SetControlDontKnow( bool bSet );
88 : :
89 : : virtual SvxFrameDirection GetControlValue() const;
90 : : virtual void SetControlValue( SvxFrameDirection eValue );
91 : : };
92 : :
93 : : /** Wrapper for usage of a SvxFrameDirectionItem in item connections. */
94 : : typedef sfx::ValueItemWrapper< SvxFrameDirectionItem, SvxFrameDirection, sal_uInt16 > FrameDirItemWrapper;
95 : :
96 : : /** An item<->control connection for a FrameDirectionListBox. */
97 : : typedef sfx::ItemControlConnection< FrameDirItemWrapper, FrameDirListBoxWrapper > FrameDirListBoxConnection;
98 : :
99 : : // ============================================================================
100 : :
101 : : } // namespace svx
102 : :
103 : : #endif
104 : :
105 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|