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 <com/sun/star/uno/Reference.h>
27 : #include <com/sun/star/uno/Sequence.h>
28 : #include <com/sun/star/lang/Locale.hpp>
29 :
30 : #include <vcl/image.hxx>
31 :
32 : #include <vector>
33 :
34 : namespace com{namespace sun{ namespace star{
35 : namespace container{
36 : class XIndexAccess;
37 : }
38 : namespace beans{
39 : struct PropertyValue;
40 : }
41 : namespace text{
42 : class XNumberingFormatter;
43 : }
44 : }}}
45 :
46 : namespace svx { namespace sidebar {
47 :
48 : /** Specialization of class <ValueSet>.
49 : This specialization allows is a one-columned ValueSet which allow
50 : items containing an image and a text or a text and a second text.
51 :
52 : Especially, used for sidebar related controls.
53 : */
54 : class SVX_DLLPUBLIC ValueSetWithTextControl : public ValueSet
55 : {
56 : public:
57 : // control type of specialized <ValueSet>:
58 : // - image + text
59 : // - text + text
60 : enum tControlType
61 : {
62 : IMAGE_TEXT,
63 : TEXT_TEXT
64 : };
65 :
66 : ValueSetWithTextControl(
67 : const tControlType eControlType,
68 : vcl::Window* pParent,
69 : const ResId& rResId);
70 :
71 : virtual ~ValueSetWithTextControl(void);
72 :
73 : // add item for control type IMAGE_TEXT
74 : // if control type does not match IMAGE_TEXT no item is added.
75 : // @param pSelectedItemImage
76 : // selection item image is optional. if not provided, it is the same as the image item
77 : // @param pItemHelpText
78 : // help text is optional. if not provided, it is the same as the item text
79 : void AddItem(
80 : const Image& rItemImage,
81 : const Image* pSelectedItemImage,
82 : const OUString& rItemText,
83 : const OUString* pItemHelpText );
84 :
85 : // replace item images for control type IMAGE_TEXT
86 : void ReplaceItemImages(
87 : const sal_uInt16 nItemId,
88 : const Image& rItemImage,
89 : const Image* pSelectedItemImage );
90 :
91 : // add item for control type TEXT_TEXT
92 : // if control type does not match TEXT_TEXT no item is added.
93 : // @param pItemHelpText
94 : // help text is optional. if not provided, it is the same as the item text
95 : void AddItem(
96 : const OUString& rItemText,
97 : const OUString& rItemText2,
98 : const OUString* pItemHelpText );
99 :
100 : virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
101 :
102 : private:
103 0 : struct ValueSetWithTextItem
104 : {
105 : Image maItemImage;
106 : Image maSelectedItemImage;
107 : OUString maItemText;
108 : OUString maItemText2;
109 : };
110 :
111 : typedef ::std::vector< ValueSetWithTextItem > tItemList;
112 :
113 : const tControlType meControlType;
114 : tItemList maItems;
115 : };
116 :
117 : class SVX_DLLPUBLIC SvxNumValueSet2 : public ValueSet
118 : {
119 : Color aLineColor;
120 : Rectangle aOrgRect;
121 : VirtualDevice* pVDev;
122 :
123 : com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter;
124 : com::sun::star::lang::Locale aLocale;
125 :
126 : com::sun::star::uno::Sequence<
127 : com::sun::star::uno::Sequence<
128 : com::sun::star::beans::PropertyValue> > aNumSettings;
129 :
130 :
131 : public:
132 : SvxNumValueSet2( vcl::Window* pParent, const ResId& rResId);
133 : virtual ~SvxNumValueSet2();
134 :
135 : virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
136 :
137 :
138 : void SetNumberingSettings(
139 : const com::sun::star::uno::Sequence<
140 : com::sun::star::uno::Sequence<
141 : com::sun::star::beans::PropertyValue> >& aNum,
142 : com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter>& xFormatter,
143 : const com::sun::star::lang::Locale& rLocale );
144 : };
145 :
146 : class SVX_DLLPUBLIC SvxNumValueSet3 : public ValueSet
147 : {
148 : public:
149 : SvxNumValueSet3( vcl::Window* pParent, const ResId& rResId);
150 : virtual ~SvxNumValueSet3();
151 :
152 : virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
153 :
154 : };
155 :
156 : } } // end of namespace svx::sidebar
157 :
158 : #endif
159 :
160 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|