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