Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SW_SOURCE_UI_INC_SWLBOX_HXX
20 : #define INCLUDED_SW_SOURCE_UI_INC_SWLBOX_HXX
21 :
22 : #include <vcl/lstbox.hxx>
23 : #include <vcl/combobox.hxx>
24 : #include "swdllapi.h"
25 : #include <boost/ptr_container/ptr_vector.hpp>
26 :
27 : class SwBoxEntry;
28 : class Window;
29 :
30 : typedef boost::ptr_vector<SwBoxEntry> SwEntryLst;
31 :
32 : /*--------------------------------------------------------------------
33 : Description: SwBoxEntry
34 : --------------------------------------------------------------------*/
35 0 : class SW_DLLPUBLIC SwBoxEntry
36 : {
37 : friend class SwComboBox;
38 :
39 : sal_Bool bModified : 1;
40 : sal_Bool bNew : 1;
41 :
42 : OUString aName;
43 : sal_Int32 nId;
44 :
45 : public:
46 : SwBoxEntry(const OUString& aName, sal_Int32 nId=0);
47 : SwBoxEntry(const SwBoxEntry& rOrg);
48 : SwBoxEntry();
49 :
50 0 : const OUString& GetName() const { return aName;}
51 : };
52 :
53 : /*--------------------------------------------------------------------
54 : Description: for combo boxes
55 : --------------------------------------------------------------------*/
56 :
57 : class SW_DLLPUBLIC SwComboBox : public ComboBox
58 : {
59 : SwEntryLst aEntryLst;
60 : SwEntryLst aDelEntryLst;
61 : SwBoxEntry aDefault;
62 :
63 : SAL_DLLPRIVATE void InitComboBox();
64 : SAL_DLLPRIVATE void InsertSorted(SwBoxEntry* pEntry);
65 : SAL_DLLPRIVATE void Init();
66 :
67 : public:
68 :
69 : SwComboBox(Window* pParent, WinBits nStyle);
70 : virtual ~SwComboBox();
71 :
72 : void InsertSwEntry(const SwBoxEntry&);
73 : virtual sal_Int32 InsertEntry(const OUString& rStr, sal_Int32 = 0) SAL_OVERRIDE;
74 :
75 : virtual void RemoveEntryAt(sal_Int32 nPos) SAL_OVERRIDE;
76 :
77 : sal_Int32 GetSwEntryPos(const SwBoxEntry& rEntry) const;
78 : const SwBoxEntry& GetSwEntry(sal_Int32) const;
79 :
80 : sal_Int32 GetRemovedCount() const;
81 : const SwBoxEntry& GetRemovedEntry(sal_Int32 nPos) const;
82 : };
83 :
84 : #endif // INCLUDED_SW_SOURCE_UI_INC_SWLBOX_HXX
85 :
86 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|