bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / ui / inc / swlbox.hxx
blob26b8e917a63074844073f4fe7b73d08f8a612032
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _SWLBOX_HXX
20 #define _SWLBOX_HXX
22 #include <vcl/lstbox.hxx>
23 #include <vcl/combobox.hxx>
24 #include "swdllapi.h"
25 #include <boost/ptr_container/ptr_vector.hpp>
27 class SwBoxEntry;
28 class Window;
30 typedef boost::ptr_vector<SwBoxEntry> SwEntryLst;
32 /*--------------------------------------------------------------------
33 Description: SwBoxEntry
34 --------------------------------------------------------------------*/
35 class SW_DLLPUBLIC SwBoxEntry
37 friend class SwComboBox;
39 sal_Bool bModified : 1;
40 sal_Bool bNew : 1;
42 String aName;
43 sal_uInt16 nId;
45 public:
46 SwBoxEntry(const String& aName, sal_uInt16 nId=0);
47 SwBoxEntry(const SwBoxEntry& rOrg);
48 SwBoxEntry();
50 const String& GetName() const { return aName;}
53 /*--------------------------------------------------------------------
54 Description: for combo boxes
55 --------------------------------------------------------------------*/
56 typedef sal_uInt16 SwComboBoxStyle;
58 namespace nsSwComboBoxStyle
60 const SwComboBoxStyle CBS_UPPER = 0x01;
61 const SwComboBoxStyle CBS_LOWER = 0x02;
62 const SwComboBoxStyle CBS_ALL = 0x04;
63 const SwComboBoxStyle CBS_FILENAME = 0x08;
64 const SwComboBoxStyle CBS_SW_FILENAME = CBS_FILENAME;
67 class SW_DLLPUBLIC SwComboBox : public ComboBox
69 SwEntryLst aEntryLst;
70 SwEntryLst aDelEntryLst;
71 SwBoxEntry aDefault;
72 sal_uInt16 nStyle;
74 SW_DLLPRIVATE void InitComboBox();
75 SW_DLLPRIVATE void InsertSorted(SwBoxEntry* pEntry);
76 SW_DLLPRIVATE void Init();
78 using ComboBox::InsertEntry;
79 using ComboBox::RemoveEntry;
80 using Window::SetStyle;
82 public:
84 using ComboBox::GetEntryPos;
86 SwComboBox(Window* pParent,
87 sal_uInt16 nStyleBits = nsSwComboBoxStyle::CBS_ALL);
88 SwComboBox(Window* pParent, const ResId& rId,
89 sal_uInt16 nStyleBits = nsSwComboBoxStyle::CBS_ALL);
90 ~SwComboBox();
92 virtual void KeyInput( const KeyEvent& rKEvt );
94 void InsertEntry(const SwBoxEntry&);
95 sal_uInt16 InsertEntry( const XubString& rStr, sal_uInt16 = 0)
96 { InsertEntry( SwBoxEntry( rStr ) ); return 0; }
98 void RemoveEntry(sal_uInt16 nPos);
100 sal_uInt16 GetEntryPos(const SwBoxEntry& rEntry) const;
101 const SwBoxEntry& GetEntry(sal_uInt16) const;
103 sal_uInt16 GetRemovedCount() const;
104 const SwBoxEntry& GetRemovedEntry(sal_uInt16 nPos) const;
106 sal_uInt16 GetStyle() const { return nStyle; }
107 void SetStyle(const sal_uInt16 nSt) { nStyle = nSt; }
109 OUString GetText() const;
112 #endif /* _SWLBOX_HXX */
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */