bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / svtools / valueset.hxx
blob5ebc98267b7269b5e16533f3acbfa0034e82135d
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 .
20 #ifndef INCLUDED_SVTOOLS_VALUESET_HXX
21 #define INCLUDED_SVTOOLS_VALUESET_HXX
23 #include <svtools/svtdllapi.h>
25 #include <vcl/ctrl.hxx>
26 #include <vcl/timer.hxx>
27 #include <vcl/customweld.hxx>
28 #include <memory>
29 #include <vector>
31 class MouseEvent;
32 class TrackingEvent;
33 class HelpEvent;
34 class KeyEvent;
35 class DataChangedEvent;
36 class ScrollBar;
37 class UserDrawEvent;
38 class VirtualDevice;
40 struct ValueSetItem;
41 struct SvtValueSetItem;
43 enum class DrawFrameStyle;
45 /*************************************************************************
47 Description
48 ============
50 class ValueSet
52 This class allows the selection of an item. In the process items are
53 drawn side by side. The selection of items can be more clear than in a
54 ListBox shape for example in case of colors or samples.
55 The amount of columns drawn by the control and whether the items
56 should be encircled can be specified. Optional a NoSelection or name
57 field could be shown. By default image and color items are supported.
58 Items could be drawn by oneself if InsertItem() is only called with
59 an ID. To achieve this the UserDraw handler needs to be overridden. The
60 description text could be specified afterwards in case of UserDraw
61 and any other items.
63 Cross references
65 class ListBox
67 --------------------------------------------------------------------------
69 WinBits
71 WB_RADIOSEL If set the selection will be drawn like an
72 ImageRadioButton. This does only make sense if the image
73 is at least 8 pixel smaller on each side than the item
74 and also WB_DOUBLEBORDER is set and as color
75 COL_WINDOWWORKSPACE is specified.
76 WB_FLATVALUESET Flat Look (if you set WB_ITEMBORDER or WB_DOUBLEBORDER,
77 then you get extra border space, but the Borders
78 aren't painted),
79 WB_ITEMBORDER Items will be bordered
80 WB_DOUBLEBORDER Items will be bordered twice. Additionally WB_ITEMBORDER
81 has to be set, as otherwise this WinBit wouldn't have any
82 effect. It is needed if there are items with a white
83 background, since otherwise the 3D effect wouldn't be
84 recognizable.
85 WB_NAMEFIELD There is a namefield, where the name of an item will be
86 shown.
87 WB_NONEFIELD There is a NoSelection field which can be selected if
88 0 is passed along with SelectItem. Respectively
89 GetSelectedItemId() returns 0 if this field or nothing
90 is selected. This field shows the text which is specified
91 by SetText() respectively no one, if no text was set. With
92 SetNoSelection() the selection can be disabled.
93 WB_VSCROLL A scrollbar will be always shown. The visible number of
94 lines have to be specified with SetLineCount() if this
95 flag is set.
96 WB_BORDER A border will be drawn around the window.
97 WB_NOPOINTERFOCUS The focus won't be gathered, if the control was pressed by
98 the mouse.
99 WB_TABSTOP It is possible to jump into the ValueSet with the tab key.
100 WB_NOTABSTOP It is not possible to jump into the ValueSet with the
101 tab key.
102 WB_NO_DIRECTSELECT Cursor travelling doesn't call select immediately. To
103 execute the selection <RETURN> has to be pressed.
104 --------------------------------------------------------------------------
106 The number of columns must be either set with SetColCount() or
107 SetItemWidth(). If the number of columns is specified by SetColCount()
108 the width of the items will be calculated by the visible range.
109 If the items should have a static width, it has to be specified
110 with SetItemWidth(). In this case the number of columns will be calculated
111 by the visible range.
113 The number of rows is given by the number of items / number of columns. The
114 number of visible rows must either specified by SetLineCount() or
115 SetItemWidth(). If the number of visible rows is specified by SetLineCount(),
116 the height of the items will be calculated from the visible height. If the
117 items should have a fixed height it has to be specified with SetItemHeight().
118 In this case the number of visible rows is then calculated from the visible
119 height. If the number of visible rows is neither specified by SetLineCount()
120 nor by SetItemHeight() all rows will be shown. The height of the items will
121 be calculated by the visible height. If the number of visible rows is
122 specified by SetLineCount() or SetItemHeight() ValueSet does scroll
123 automatically when more lines are available, as are visible. If scrolling
124 should be also possible with a ScrollBar WB_VSCROLL needs to be set.
126 The distance between the items can be increased by SetExtraSpacing(). The
127 distance, which will be shown between two items (both in x and in y), is
128 measured in pixels.
130 The exact window size for a specific item size can be calculated by
131 CalcWindowSizePixel(). To do this all relevant data (number of columns/...)
132 have to be specified and if no number of rows was set, all items need to
133 be inserted. If the window was created with WB_BORDER/Border=sal_True the
134 size has to be specified with SetOutputSizePixel(). In other cases different
135 size-methods can be used. With CalcItemSize() the inner and outer size of
136 an item could be calculated (for this the free space defined by
137 SetExtraSpacing() will not be included).
139 The background color could be specified by SetColor(), with which the image
140 or UserDraw items will be underlayed. If no color is specified the color
141 of other windows (WindowColor) will be used for the background.
143 --------------------------------------------------------------------------
145 At first all items should be inserted and only then Show() should be called
146 since the output area will be precomputed. If this is not done the first
147 Paint will appear a little bit slower. Therefore the Control, if it is loaded
148 from the resource and only supplied with items during runtime, should be
149 loaded with Hide = sal_True and then displayed with Show().
151 In case of a visible Control the creation of the new output area could be
152 activated before Paint by calling Format().
154 --------------------------------------------------------------------------
156 If Drag and Drop will be called from the ValueSet the Command-Handler has to
157 be overridden. From this StartDrag needs to be called. If this method returns
158 sal_True the drag-process could be initiated by ExecuteDrag(), otherwise no
159 processing will take place. This method makes sure that ValueSet stops its
160 processing and as appropriate selects the entry. Therefore the calling of
161 Select-Handler within this function must be expected.
163 For dropping QueryDrop() and Drop() need to be overridden and ShowDropPos()
164 and HideDropPos() should be called within these methods.
165 To show the insertion point ShowDropPos() has to be called within the
166 QueryDrop-Handler. ShowDropPos() also scrolls the ValueSet if the passed
167 position is located at the window border. Furthermore ShowDropPos() returns
168 the position, at which the item should be inserted respectively which
169 insertion point was shown. If no insertion point was determined
170 VALUESET_ITEM_NOTFOUND will be returned. If the window was left during dragging
171 or the drag process is terminated HideDropPos() should be called in any case.
173 --------------------------------------------------------------------------
175 This class is currently still in the SV-Tools. That's why the ValueSet needs
176 to be loaded as a Control out of the resource and the desired WinBits have
177 to be set (before Show) with SetStyle().
179 *************************************************************************/
181 typedef std::vector<std::unique_ptr<ValueSetItem>> ValueItemList;
182 typedef std::vector<std::unique_ptr<SvtValueSetItem>> SvtValueItemList;
184 #define WB_ITEMBORDER (WinBits(0x00010000))
185 #define WB_DOUBLEBORDER (WinBits(0x00020000))
186 #define WB_NAMEFIELD (WinBits(0x00040000))
187 #define WB_NONEFIELD (WinBits(0x00080000))
188 #define WB_FLATVALUESET (WinBits(0x02000000))
189 #define WB_NO_DIRECTSELECT (WinBits(0x04000000))
190 #define WB_MENUSTYLEVALUESET (WinBits(0x08000000))
192 #define VALUESET_APPEND (size_t(-1))
193 #define VALUESET_ITEM_NOTFOUND (size_t(-1))
196 class SVT_DLLPUBLIC ValueSet : public Control
198 private:
199 Timer maTimer;
200 ValueItemList mItemList;
201 std::unique_ptr<ValueSetItem> mpNoneItem;
202 VclPtr<ScrollBar> mxScrollBar;
203 tools::Rectangle maNoneItemRect;
204 tools::Rectangle maItemListRect;
205 long mnItemWidth;
206 long mnItemHeight;
207 long mnTextOffset;
208 long mnVisLines;
209 long mnLines;
210 long mnUserItemWidth;
211 long mnUserItemHeight;
212 sal_uInt16 mnSelItemId;
213 sal_uInt16 mnHighItemId;
214 sal_uInt16 mnCols;
215 sal_uInt16 mnCurCol;
216 sal_uInt16 mnUserCols;
217 sal_uInt16 mnUserVisLines;
218 sal_uInt16 mnFirstLine;
219 sal_uInt16 mnSpacing;
220 DrawFrameStyle mnFrameStyle;
221 Color maColor;
222 Link<ValueSet*,void> maDoubleClickHdl;
223 Link<ValueSet*,void> maSelectHdl;
224 Link<ValueSet*,void> maHighlightHdl;
226 bool mbFormat : 1;
227 bool mbHighlight : 1;
228 bool mbSelection : 1;
229 bool mbNoSelection : 1;
230 bool mbDrawSelection : 1;
231 bool mbBlackSel : 1;
232 bool mbDoubleSel : 1;
233 bool mbScroll : 1;
234 bool mbFullMode : 1;
235 bool mbEdgeBlending : 1;
236 bool mbHasVisibleItems : 1;
238 friend class ValueSetAcc;
239 friend class ValueItemAcc;
241 using Control::ImplInitSettings;
242 SVT_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
244 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
246 SVT_DLLPRIVATE void ImplInitScrollBar();
247 SVT_DLLPRIVATE void ImplDeleteItems();
248 SVT_DLLPRIVATE void ImplFormatItem(vcl::RenderContext& rRenderContext, ValueSetItem* pItem, tools::Rectangle aRect);
249 SVT_DLLPRIVATE void ImplDrawItemText(vcl::RenderContext& rRenderContext, const OUString& rStr);
250 SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext, sal_uInt16 nItemId, const bool bFocus, const bool bDrawSel);
251 SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext);
252 SVT_DLLPRIVATE void ImplHighlightItem(sal_uInt16 nItemId, bool bIsSelection = true);
253 SVT_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext);
254 using Window::ImplScroll;
255 SVT_DLLPRIVATE bool ImplScroll( const Point& rPos );
256 SVT_DLLPRIVATE size_t ImplGetItem( const Point& rPoint ) const;
257 SVT_DLLPRIVATE ValueSetItem* ImplGetItem( size_t nPos );
258 SVT_DLLPRIVATE ValueSetItem* ImplGetFirstItem();
259 SVT_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const;
260 SVT_DLLPRIVATE void ImplInsertItem( std::unique_ptr<ValueSetItem> pItem, const size_t nPos );
261 SVT_DLLPRIVATE tools::Rectangle ImplGetItemRect( size_t nPos ) const;
262 SVT_DLLPRIVATE void ImplFireAccessibleEvent( short nEventId, const css::uno::Any& rOldValue, const css::uno::Any& rNewValue );
263 SVT_DLLPRIVATE bool ImplHasAccessibleListeners();
264 SVT_DLLPRIVATE void ImplTracking( const Point& rPos, bool bRepeat );
265 SVT_DLLPRIVATE void ImplEndTracking( const Point& rPos, bool bCancel );
266 DECL_DLLPRIVATE_LINK( ImplScrollHdl, ScrollBar*, void );
267 DECL_DLLPRIVATE_LINK( ImplTimerHdl, Timer*, void );
269 ValueSet (const ValueSet &) = delete;
270 ValueSet & operator= (const ValueSet &) = delete;
272 SVT_DLLPRIVATE void Format(vcl::RenderContext& rRenderContext);
274 protected:
275 void StartDrag( const CommandEvent& rCEvt, vcl::Region& rRegion );
277 virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
279 public:
280 ValueSet( vcl::Window* pParent, WinBits nWinStyle );
281 virtual ~ValueSet() override;
282 virtual void dispose() override;
284 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
285 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
286 virtual void MouseMove( const MouseEvent& rMEvt ) override;
287 virtual void Tracking( const TrackingEvent& rMEvt ) override;
288 virtual void KeyInput( const KeyEvent& rKEvt ) override;
289 virtual void Command( const CommandEvent& rCEvt ) override;
290 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
291 virtual void GetFocus() override;
292 virtual void LoseFocus() override;
293 virtual void Resize() override;
294 virtual Size GetOptimalSize() const override;
295 virtual void RequestHelp( const HelpEvent& rHEvt ) override;
296 virtual void StateChanged( StateChangedType nStateChange ) override;
297 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
299 virtual void Select();
300 virtual void UserDraw( const UserDrawEvent& rUDEvt );
302 /// Insert @rImage item.
303 void InsertItem(sal_uInt16 nItemId, const Image& rImage);
304 /// Insert @rImage item with @rStr as either a legend or tooltip depending on @bShowLegend.
305 void InsertItem(sal_uInt16 nItemId, const Image& rImage,
306 const OUString& rStr, size_t nPos = VALUESET_APPEND, bool bShowLegend = false);
307 /// Insert an @rColor item with @rStr tooltip.
308 void InsertItem(sal_uInt16 nItemId, const Color& rColor,
309 const OUString& rStr);
310 /// Insert an User Drawn item.
311 void InsertItem(sal_uInt16 nItemId, size_t nPos = VALUESET_APPEND);
312 void RemoveItem(sal_uInt16 nItemId);
314 void Clear();
316 size_t GetItemCount() const;
317 size_t GetItemPos( sal_uInt16 nItemId ) const;
318 sal_uInt16 GetItemId( size_t nPos ) const;
319 sal_uInt16 GetItemId( const Point& rPos ) const;
320 tools::Rectangle GetItemRect( sal_uInt16 nItemId ) const;
321 void EnableFullItemMode( bool bFullMode );
323 void SetColCount( sal_uInt16 nNewCols = 1 );
324 sal_uInt16 GetColCount() const
326 return mnUserCols;
328 void SetLineCount( sal_uInt16 nNewLines = 0 );
329 sal_uInt16 GetLineCount() const
331 return mnUserVisLines;
333 void SetItemWidth( long nItemWidth );
334 void SetItemHeight( long nLineHeight );
335 Size GetLargestItemSize();
336 void RecalculateItemSizes();
338 void SelectItem( sal_uInt16 nItemId );
339 sal_uInt16 GetSelectedItemId() const
341 return mnSelItemId;
343 bool IsItemSelected( sal_uInt16 nItemId ) const
345 return !mbNoSelection && (nItemId == mnSelItemId);
347 void SetNoSelection();
348 bool IsNoSelection() const
350 return mbNoSelection;
353 void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
354 Image GetItemImage( sal_uInt16 nItemId ) const;
355 void SetItemColor( sal_uInt16 nItemId, const Color& rColor );
356 Color GetItemColor( sal_uInt16 nItemId ) const;
357 void SetItemData( sal_uInt16 nItemId, void* pData );
358 void* GetItemData( sal_uInt16 nItemId ) const;
359 void SetItemText( sal_uInt16 nItemId, const OUString& rStr );
360 OUString GetItemText( sal_uInt16 nItemId ) const;
361 void SetColor( const Color& rColor );
362 void SetColor()
364 SetColor(COL_TRANSPARENT);
366 bool IsColor() const
368 return maColor.GetTransparency() == 0;
371 void SetExtraSpacing( sal_uInt16 nNewSpacing );
373 void SetFormat();
375 void StartSelection();
376 void EndSelection();
378 Size CalcWindowSizePixel(const Size& rItemSize,
379 sal_uInt16 nCalcCols = 0,
380 sal_uInt16 nCalcLines = 0) const;
381 Size CalcItemSizePixel(const Size& rSize) const;
382 long GetScrollWidth() const;
384 void SetSelectHdl(const Link<ValueSet*,void>& rLink)
386 maSelectHdl = rLink;
388 void SetDoubleClickHdl(const Link<ValueSet*,void>& rLink)
390 maDoubleClickHdl = rLink;
393 void SetHighlightHdl(const Link<ValueSet*,void>& rLink);
395 bool GetEdgeBlending() const
397 return mbEdgeBlending;
399 void SetEdgeBlending(bool bNew);
402 class SVT_DLLPUBLIC SvtValueSet : public weld::CustomWidgetController
404 private:
406 ScopedVclPtr<VirtualDevice> maVirDev;
407 css::uno::Reference<css::accessibility::XAccessible> mxAccessible;
408 SvtValueItemList mItemList;
409 std::unique_ptr<SvtValueSetItem> mpNoneItem;
410 std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow;
411 tools::Rectangle maNoneItemRect;
412 tools::Rectangle maItemListRect;
413 long mnItemWidth;
414 long mnItemHeight;
415 long mnTextOffset;
416 long mnVisLines;
417 long mnLines;
418 long mnUserItemWidth;
419 long mnUserItemHeight;
420 sal_uInt16 mnSelItemId;
421 int mnSavedItemId;
422 sal_uInt16 mnHighItemId;
423 sal_uInt16 mnCols;
424 sal_uInt16 mnCurCol;
425 sal_uInt16 mnUserCols;
426 sal_uInt16 mnUserVisLines;
427 sal_uInt16 mnFirstLine;
428 sal_uInt16 mnSpacing;
429 DrawFrameStyle mnFrameStyle;
430 Color const maColor;
431 OUString maText;
432 WinBits mnStyle;
433 Link<SvtValueSet*,void> maDoubleClickHdl;
434 Link<SvtValueSet*,void> maSelectHdl;
436 bool mbFormat : 1;
437 bool mbHighlight : 1;
438 bool mbNoSelection : 1;
439 bool mbDrawSelection : 1;
440 bool mbBlackSel : 1;
441 bool mbDoubleSel : 1;
442 bool mbScroll : 1;
443 bool mbEdgeBlending : 1;
444 bool mbHasVisibleItems : 1;
446 friend class SvtValueSetAcc;
447 friend class SvtValueItemAcc;
449 SVT_DLLPRIVATE void ImplDeleteItems();
450 SVT_DLLPRIVATE void ImplFormatItem(vcl::RenderContext const & rRenderContext, SvtValueSetItem* pItem, tools::Rectangle aRect);
451 SVT_DLLPRIVATE void ImplDrawItemText(vcl::RenderContext& rRenderContext, const OUString& rStr);
452 SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext, sal_uInt16 nItemId, const bool bFocus, const bool bDrawSel);
453 SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext& rRenderContext);
454 SVT_DLLPRIVATE void ImplHighlightItem(sal_uInt16 nItemId, bool bIsSelection = true);
455 SVT_DLLPRIVATE void ImplDraw(vcl::RenderContext& rRenderContext);
456 SVT_DLLPRIVATE size_t ImplGetItem( const Point& rPoint ) const;
457 SVT_DLLPRIVATE SvtValueSetItem* ImplGetItem( size_t nPos );
458 SVT_DLLPRIVATE SvtValueSetItem* ImplGetFirstItem();
459 SVT_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const;
460 SVT_DLLPRIVATE void ImplInsertItem( std::unique_ptr<SvtValueSetItem> pItem, const size_t nPos );
461 SVT_DLLPRIVATE tools::Rectangle ImplGetItemRect( size_t nPos ) const;
462 SVT_DLLPRIVATE void ImplFireAccessibleEvent( short nEventId, const css::uno::Any& rOldValue, const css::uno::Any& rNewValue );
463 SVT_DLLPRIVATE bool ImplHasAccessibleListeners();
464 SVT_DLLPRIVATE void ImplTracking(const Point& rPos);
465 DECL_DLLPRIVATE_LINK(ImplScrollHdl, weld::ScrolledWindow&, void);
467 Size GetLargestItemSize();
469 SvtValueSet (const SvtValueSet &) = delete;
470 SvtValueSet & operator= (const SvtValueSet &) = delete;
472 protected:
473 virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
475 public:
476 SvtValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow);
477 virtual ~SvtValueSet() override;
479 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
481 virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
482 virtual bool MouseMove( const MouseEvent& rMEvt ) override;
483 virtual bool KeyInput( const KeyEvent& rKEvt ) override;
484 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
485 virtual void GetFocus() override;
486 virtual void LoseFocus() override;
487 virtual void Resize() override;
488 virtual void StyleUpdated() override;
489 virtual OUString RequestHelp(tools::Rectangle& rHelpRect) override;
491 void Select();
492 virtual void UserDraw( const UserDrawEvent& rUDEvt );
494 OUString const & GetText() const { return maText; }
495 void SetText(const OUString& rText) { maText = rText; }
496 void SetStyle(WinBits nStyle);
497 WinBits GetStyle() const { return mnStyle; }
499 void SetOptimalSize();
501 /// Insert @rImage item.
502 void InsertItem(sal_uInt16 nItemId, const Image& rImage);
503 /// Insert @rImage item with @rStr as a tooltip
504 void InsertItem(sal_uInt16 nItemId, const Image& rImage,
505 const OUString& rStr, size_t nPos = VALUESET_APPEND);
506 /// Insert an @rColor item with @rStr tooltip.
507 void InsertItem(sal_uInt16 nItemId, const Color& rColor,
508 const OUString& rStr);
509 /// Insert an User Drawn item.
510 void InsertItem(sal_uInt16 nItemId, size_t nPos = VALUESET_APPEND);
511 /// Insert an User Drawn item with @rStr tooltip.
512 void InsertItem(sal_uInt16 nItemId, const OUString& rStr, size_t nPos);
513 void RemoveItem(sal_uInt16 nItemId);
515 void Clear();
517 size_t GetItemCount() const;
518 size_t GetItemPos( sal_uInt16 nItemId ) const;
519 sal_uInt16 GetItemId( size_t nPos ) const;
520 sal_uInt16 GetItemId( const Point& rPos ) const;
521 tools::Rectangle GetItemRect( sal_uInt16 nItemId ) const;
523 void SetColCount( sal_uInt16 nNewCols = 1 );
524 void SetLineCount( sal_uInt16 nNewLines = 0 );
525 void SetItemWidth( long nItemWidth );
526 void SetItemHeight( long nLineHeight );
528 void SelectItem( sal_uInt16 nItemId );
529 sal_uInt16 GetSelectedItemId() const
531 return mnSelItemId;
533 size_t GetSelectItemPos() const
535 return GetItemPos( mnSelItemId );
537 bool IsItemSelected( sal_uInt16 nItemId ) const
539 return !mbNoSelection && (nItemId == mnSelItemId);
541 void SetNoSelection();
542 bool IsNoSelection() const
544 return mbNoSelection;
547 void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
548 Image GetItemImage( sal_uInt16 nItemId ) const;
549 Color GetItemColor( sal_uInt16 nItemId ) const;
550 void SetItemData( sal_uInt16 nItemId, void* pData );
551 void* GetItemData( sal_uInt16 nItemId ) const;
552 void SetItemText( sal_uInt16 nItemId, const OUString& rStr );
553 OUString GetItemText( sal_uInt16 nItemId ) const;
554 bool IsColor() const
556 return maColor.GetTransparency() == 0;
559 void SetExtraSpacing( sal_uInt16 nNewSpacing );
561 void Format(vcl::RenderContext const & rRenderContext);
562 void SetFormat();
564 Size CalcWindowSizePixel(const Size& rItemSize,
565 sal_uInt16 nCalcCols = 0,
566 sal_uInt16 nCalcLines = 0) const;
567 Size CalcItemSizePixel(const Size& rSize) const;
568 int GetScrollWidth() const;
570 void SetSelectHdl(const Link<SvtValueSet*,void>& rLink)
572 maSelectHdl = rLink;
575 void SetDoubleClickHdl(const Link<SvtValueSet*,void>& rLink)
577 maDoubleClickHdl = rLink;
580 bool GetEdgeBlending() const
582 return mbEdgeBlending;
584 void SetEdgeBlending(bool bNew);
586 void SaveValue()
588 mnSavedItemId = IsNoSelection() ? -1 : GetSelectedItemId();
591 bool IsValueChangedFromSaved() const
593 int nItemId = IsNoSelection() ? -1 : GetSelectedItemId();
594 return mnSavedItemId != nItemId;
599 #endif // INCLUDED_SVTOOLS_VALUESET_HXX
601 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */