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