Update ooo320-m1
[ooovba.git] / sw / source / ui / inc / swlbox.hxx
blob0666dbdc3987e654eb70d81ee34fcde901a97bff
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swlbox.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SWLBOX_HXX
31 #define _SWLBOX_HXX
33 #include <svtools/svarray.hxx>
35 #ifndef _LSTBOX_HXX //autogen
36 #include <vcl/lstbox.hxx>
37 #endif
39 #ifndef _COMBOBOX_HXX //autogen
40 #include <vcl/combobox.hxx>
41 #endif
42 #include "swdllapi.h"
44 class SwBoxEntry;
45 class Window;
47 SV_DECL_PTRARR_DEL(SwEntryLst, SwBoxEntry*, 10, 10)
49 /*--------------------------------------------------------------------
50 Beschreibung: SwBoxEntry
51 --------------------------------------------------------------------*/
53 class SW_DLLPUBLIC SwBoxEntry
55 friend class SwComboBox;
57 BOOL bModified : 1;
58 BOOL bNew : 1;
60 String aName;
61 USHORT nId;
63 public:
64 SwBoxEntry(const String& aName, USHORT nId=0);
65 SwBoxEntry(const SwBoxEntry& rOrg);
66 SwBoxEntry();
68 const String& GetName() const { return aName;}
71 /*--------------------------------------------------------------------
72 Beschreibung: fuer ComboBoxen
73 --------------------------------------------------------------------*/
75 typedef USHORT SwComboBoxStyle;
76 namespace nsSwComboBoxStyle
78 const SwComboBoxStyle CBS_UPPER = 0x01;
79 const SwComboBoxStyle CBS_LOWER = 0x02;
80 const SwComboBoxStyle CBS_ALL = 0x04;
81 const SwComboBoxStyle CBS_FILENAME = 0x08;
82 #ifdef WIN
83 const SwComboBoxStyle CBS_SW_FILENAME = CBS_FILENAME | CBS_LOWER;
84 #else
85 const SwComboBoxStyle CBS_SW_FILENAME = CBS_FILENAME;
86 #endif
89 class SW_DLLPUBLIC SwComboBox : public ComboBox
91 SwEntryLst aEntryLst;
92 SwEntryLst aDelEntryLst;
93 SwBoxEntry aDefault;
94 USHORT nStyle;
96 SW_DLLPRIVATE void InitComboBox();
97 SW_DLLPRIVATE void InsertSorted(SwBoxEntry* pEntry);
99 using ComboBox::InsertEntry;
100 using ComboBox::RemoveEntry;
101 using Window::SetStyle;
103 public:
105 using ComboBox::GetEntryPos;
107 SwComboBox(Window* pParent, const ResId& rId,
108 USHORT nStyleBits = nsSwComboBoxStyle::CBS_ALL);
109 ~SwComboBox();
111 virtual void KeyInput( const KeyEvent& rKEvt );
113 void InsertEntry(const SwBoxEntry&);
114 USHORT InsertEntry( const XubString& rStr, USHORT = 0)
115 { InsertEntry( SwBoxEntry( rStr ) ); return 0; }
117 void RemoveEntry(USHORT nPos);
119 USHORT GetEntryPos(const SwBoxEntry& rEntry) const;
120 const SwBoxEntry& GetEntry(USHORT) const;
122 USHORT GetRemovedCount() const;
123 const SwBoxEntry& GetRemovedEntry(USHORT nPos) const;
125 USHORT GetStyle() const { return nStyle; }
126 void SetStyle(const USHORT nSt) { nStyle = nSt; }
128 String GetText() const;
131 #endif /* _SWLBOX_HXX */