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_SVX_SIDEBAR_VALUESETWITHTEXTCONTROL_HXX
20 : #define INCLUDED_SVX_SIDEBAR_VALUESETWITHTEXTCONTROL_HXX
21 :
22 : #include <svx/svxdllapi.h>
23 :
24 : #include <svtools/valueset.hxx>
25 : #include <limits.h>
26 : #include <vcl/image.hxx>
27 :
28 : #include <vector>
29 :
30 : namespace svx { namespace sidebar {
31 :
32 : /** Specialization of class <ValueSet>.
33 : This specialization allows is a one-columned ValueSet which allow
34 : items containing an image and a text or a text and a second text.
35 :
36 : Especially, used for sidebar related controls.
37 : */
38 0 : class SVX_DLLPUBLIC ValueSetWithTextControl : public ValueSet
39 : {
40 : public:
41 : // control type of specialized <ValueSet>:
42 : // - image + text
43 : // - text + text
44 : enum tControlType
45 : {
46 : IMAGE_TEXT,
47 : TEXT_TEXT
48 : };
49 :
50 : ValueSetWithTextControl(
51 : const tControlType eControlType,
52 : vcl::Window* pParent,
53 : const ResId& rResId);
54 :
55 : // add item for control type IMAGE_TEXT
56 : // if control type does not match IMAGE_TEXT no item is added.
57 : // @param pSelectedItemImage
58 : // selection item image is optional. if not provided, it is the same as the image item
59 : // @param pItemHelpText
60 : // help text is optional. if not provided, it is the same as the item text
61 : void AddItem(
62 : const Image& rItemImage,
63 : const Image* pSelectedItemImage,
64 : const OUString& rItemText,
65 : const OUString* pItemHelpText );
66 :
67 : // replace item images for control type IMAGE_TEXT
68 : void ReplaceItemImages(
69 : const sal_uInt16 nItemId,
70 : const Image& rItemImage,
71 : const Image* pSelectedItemImage );
72 :
73 : // add item for control type TEXT_TEXT
74 : // if control type does not match TEXT_TEXT no item is added.
75 : // @param pItemHelpText
76 : // help text is optional. if not provided, it is the same as the item text
77 : void AddItem(
78 : const OUString& rItemText,
79 : const OUString& rItemText2,
80 : const OUString* pItemHelpText );
81 :
82 : virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
83 :
84 : private:
85 0 : struct ValueSetWithTextItem
86 : {
87 : Image maItemImage;
88 : Image maSelectedItemImage;
89 : OUString maItemText;
90 : OUString maItemText2;
91 : };
92 :
93 : typedef ::std::vector< ValueSetWithTextItem > tItemList;
94 :
95 : const tControlType meControlType;
96 : tItemList maItems;
97 : };
98 :
99 : } } // end of namespace svx::sidebar
100 :
101 : #endif
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|