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_UIBASE_INC_SWLBOX_HXX
20 : #define INCLUDED_SW_SOURCE_UIBASE_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 : namespace vcl { class Window; }
29 :
30 : typedef boost::ptr_vector<SwBoxEntry> SwEntryLst;
31 :
32 0 : class SW_DLLPUBLIC SwBoxEntry
33 : {
34 : friend class SwComboBox;
35 :
36 : bool bModified : 1;
37 : bool bNew : 1;
38 :
39 : OUString aName;
40 : sal_Int32 nId;
41 :
42 : public:
43 : SwBoxEntry(const OUString& aName, sal_Int32 nId=0);
44 : SwBoxEntry(const SwBoxEntry& rOrg);
45 : SwBoxEntry();
46 :
47 0 : const OUString& GetName() const { return aName;}
48 : };
49 :
50 : // for combo boxes
51 : class SW_DLLPUBLIC SwComboBox : public ComboBox
52 : {
53 : SwEntryLst aEntryLst;
54 : SwEntryLst aDelEntryLst;
55 : SwBoxEntry aDefault;
56 :
57 : SAL_DLLPRIVATE void InitComboBox();
58 : SAL_DLLPRIVATE void InsertSorted(SwBoxEntry* pEntry);
59 : SAL_DLLPRIVATE void Init();
60 :
61 : public:
62 :
63 : SwComboBox(vcl::Window* pParent, WinBits nStyle);
64 : virtual ~SwComboBox();
65 :
66 : void InsertSwEntry(const SwBoxEntry&);
67 : virtual sal_Int32 InsertEntry(const OUString& rStr, sal_Int32 = 0) SAL_OVERRIDE;
68 :
69 : virtual void RemoveEntryAt(sal_Int32 nPos) SAL_OVERRIDE;
70 :
71 : sal_Int32 GetSwEntryPos(const SwBoxEntry& rEntry) const;
72 : const SwBoxEntry& GetSwEntry(sal_Int32) const;
73 :
74 : sal_Int32 GetRemovedCount() const;
75 : const SwBoxEntry& GetRemovedEntry(sal_Int32 nPos) const;
76 : };
77 :
78 : #endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWLBOX_HXX
79 :
80 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|