11d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 31d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 41d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 51d2dbeb0SAndrew Rist * distributed with this work for additional information 61d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 71d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 81d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 91d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 101d2dbeb0SAndrew Rist * 111d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 121d2dbeb0SAndrew Rist * 131d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 141d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 151d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 161d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 171d2dbeb0SAndrew Rist * specific language governing permissions and limitations 181d2dbeb0SAndrew Rist * under the License. 191d2dbeb0SAndrew Rist * 201d2dbeb0SAndrew Rist *************************************************************/ 211d2dbeb0SAndrew Rist 221d2dbeb0SAndrew Rist 23cdf0e10cSrcweir #ifndef _SWLBOX_HXX 24cdf0e10cSrcweir #define _SWLBOX_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <svl/svarray.hxx> 27cdf0e10cSrcweir 28cdf0e10cSrcweir #ifndef _LSTBOX_HXX //autogen 29cdf0e10cSrcweir #include <vcl/lstbox.hxx> 30cdf0e10cSrcweir #endif 31cdf0e10cSrcweir 32cdf0e10cSrcweir #ifndef _COMBOBOX_HXX //autogen 33cdf0e10cSrcweir #include <vcl/combobox.hxx> 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir #include "swdllapi.h" 36cdf0e10cSrcweir 37cdf0e10cSrcweir class SwBoxEntry; 38cdf0e10cSrcweir class Window; 39cdf0e10cSrcweir 40cdf0e10cSrcweir SV_DECL_PTRARR_DEL(SwEntryLst, SwBoxEntry*, 10, 10) 41cdf0e10cSrcweir 42cdf0e10cSrcweir /*-------------------------------------------------------------------- 43cdf0e10cSrcweir Beschreibung: SwBoxEntry 44cdf0e10cSrcweir --------------------------------------------------------------------*/ 45cdf0e10cSrcweir 46cdf0e10cSrcweir class SW_DLLPUBLIC SwBoxEntry 47cdf0e10cSrcweir { 48cdf0e10cSrcweir friend class SwComboBox; 49cdf0e10cSrcweir 50cdf0e10cSrcweir sal_Bool bModified : 1; 51cdf0e10cSrcweir sal_Bool bNew : 1; 52cdf0e10cSrcweir 53cdf0e10cSrcweir String aName; 54cdf0e10cSrcweir sal_uInt16 nId; 55cdf0e10cSrcweir 56cdf0e10cSrcweir public: 57cdf0e10cSrcweir SwBoxEntry(const String& aName, sal_uInt16 nId=0); 58cdf0e10cSrcweir SwBoxEntry(const SwBoxEntry& rOrg); 59cdf0e10cSrcweir SwBoxEntry(); 60cdf0e10cSrcweir GetName() const61cdf0e10cSrcweir const String& GetName() const { return aName;} 62cdf0e10cSrcweir }; 63cdf0e10cSrcweir 64cdf0e10cSrcweir /*-------------------------------------------------------------------- 65cdf0e10cSrcweir Beschreibung: fuer ComboBoxen 66cdf0e10cSrcweir --------------------------------------------------------------------*/ 67cdf0e10cSrcweir 68cdf0e10cSrcweir typedef sal_uInt16 SwComboBoxStyle; 69cdf0e10cSrcweir namespace nsSwComboBoxStyle 70cdf0e10cSrcweir { 71cdf0e10cSrcweir const SwComboBoxStyle CBS_UPPER = 0x01; 72cdf0e10cSrcweir const SwComboBoxStyle CBS_LOWER = 0x02; 73cdf0e10cSrcweir const SwComboBoxStyle CBS_ALL = 0x04; 74cdf0e10cSrcweir const SwComboBoxStyle CBS_FILENAME = 0x08; 75cdf0e10cSrcweir const SwComboBoxStyle CBS_SW_FILENAME = CBS_FILENAME; 76cdf0e10cSrcweir } 77cdf0e10cSrcweir 78cdf0e10cSrcweir class SW_DLLPUBLIC SwComboBox : public ComboBox 79cdf0e10cSrcweir { 80cdf0e10cSrcweir SwEntryLst aEntryLst; 81cdf0e10cSrcweir SwEntryLst aDelEntryLst; 82cdf0e10cSrcweir SwBoxEntry aDefault; 83cdf0e10cSrcweir sal_uInt16 nStyle; 84cdf0e10cSrcweir 85cdf0e10cSrcweir SW_DLLPRIVATE void InitComboBox(); 86cdf0e10cSrcweir SW_DLLPRIVATE void InsertSorted(SwBoxEntry* pEntry); 87cdf0e10cSrcweir 88cdf0e10cSrcweir using ComboBox::InsertEntry; 89cdf0e10cSrcweir using ComboBox::RemoveEntry; 90cdf0e10cSrcweir using Window::SetStyle; 91cdf0e10cSrcweir 92cdf0e10cSrcweir public: 93cdf0e10cSrcweir 94cdf0e10cSrcweir using ComboBox::GetEntryPos; 95cdf0e10cSrcweir 96cdf0e10cSrcweir SwComboBox(Window* pParent, const ResId& rId, 97cdf0e10cSrcweir sal_uInt16 nStyleBits = nsSwComboBoxStyle::CBS_ALL); 98cdf0e10cSrcweir ~SwComboBox(); 99cdf0e10cSrcweir 100cdf0e10cSrcweir virtual void KeyInput( const KeyEvent& rKEvt ); 101cdf0e10cSrcweir 102cdf0e10cSrcweir void InsertEntry(const SwBoxEntry&); InsertEntry(const XubString & rStr,sal_uInt16=0)103cdf0e10cSrcweir sal_uInt16 InsertEntry( const XubString& rStr, sal_uInt16 = 0) 104cdf0e10cSrcweir { InsertEntry( SwBoxEntry( rStr ) ); return 0; } 105cdf0e10cSrcweir 106cdf0e10cSrcweir void RemoveEntry(sal_uInt16 nPos); 107cdf0e10cSrcweir 108cdf0e10cSrcweir sal_uInt16 GetEntryPos(const SwBoxEntry& rEntry) const; 109cdf0e10cSrcweir const SwBoxEntry& GetEntry(sal_uInt16) const; 110cdf0e10cSrcweir 111cdf0e10cSrcweir sal_uInt16 GetRemovedCount() const; 112cdf0e10cSrcweir const SwBoxEntry& GetRemovedEntry(sal_uInt16 nPos) const; 113cdf0e10cSrcweir GetStyle() const114cdf0e10cSrcweir sal_uInt16 GetStyle() const { return nStyle; } SetStyle(const sal_uInt16 nSt)115cdf0e10cSrcweir void SetStyle(const sal_uInt16 nSt) { nStyle = nSt; } 116cdf0e10cSrcweir 117cdf0e10cSrcweir String GetText() const; 118*ca62e2c2SSteve Yin void SetText( const XubString& rStr ); SetText(const XubString & rStr,const Selection & rNewSelection)119*ca62e2c2SSteve Yin void SetText( const XubString& rStr, const Selection& rNewSelection ) { ComboBox::SetText( rStr, rNewSelection ); }; 120cdf0e10cSrcweir }; 121cdf0e10cSrcweir 122cdf0e10cSrcweir #endif /* _SWLBOX_HXX */ 123