1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SVX_FONTLB_HXX
21 #define INCLUDED_SVX_FONTLB_HXX
23 #include <svtools/svtabbx.hxx>
24 #include <svtools/svlbitm.hxx>
25 #include <vcl/virdev.hxx>
26 #include <svx/svxdllapi.h>
30 /** A list box string item which stores its text and font. */
31 class SAL_WARN_UNUSED SvLBoxFontString
: public SvLBoxString
34 vcl::Font maFont
; /// The font used by this item.
35 bool mbUseColor
; /// true = use font color, false = default listbox color.
40 SvTreeListEntry
* pEntry
,
42 const OUString
& rString
,
43 const vcl::Font
& rFont
,
44 const Color
* pColor
= NULL
);
46 virtual ~SvLBoxFontString();
48 /** Creates a new empty list box item. */
49 virtual SvLBoxItem
* Create() const SAL_OVERRIDE
;
51 void InitViewData( SvTreeListBox
*,SvTreeListEntry
*,SvViewDataItem
* ) SAL_OVERRIDE
;
53 /** Paints this entry to the specified position, using the own font settings. */
54 virtual void Paint(const Point
& rPos
, SvTreeListBox
& rOutDev
, vcl::RenderContext
& rRenderContext
,
55 const SvViewDataEntry
* pView
, const SvTreeListEntry
* pEntry
) SAL_OVERRIDE
;
61 /** A list box supporting formatted string entries. */
62 class SVX_DLLPUBLIC SAL_WARN_UNUSED SvxFontListBox
: public SvTabListBox
65 vcl::Font maStdFont
; /// Used for entries without specific font.
67 // The following members are used to store additional parameters for InitEntry().
68 vcl::Font maEntryFont
; /// Current entry font used in InitEntry().
69 const Color
* mpEntryColor
; /// Current entry color used in InitEntry().
70 bool mbUseFont
; /// true = Use maEntryFont/mpEntryColor in InitEntry().
73 SvxFontListBox(vcl::Window
* pParent
, WinBits nStyle
= WB_BORDER
);
75 /** Inserts a list entry and sets the font used for this entry.
76 @param pColor The font color. NULL = use default listbox text color. */
78 const OUString
& rString
, const vcl::Font
& rFont
, const Color
* pColor
= NULL
);
80 /** Selects/deselects an entry specified by its position in the list box. */
81 void SelectEntryPos( sal_uLong nPos
, bool bSelect
= true );
82 /** Removes a selection. */
83 void SetNoSelection();
85 /** Returns the position of the entry currently selected or TREELIST_APPEND.
87 sal_uLong
GetSelectEntryPos() const;
90 /** Initializes a new SvLBoxFontString entry.
91 @descr Uses current value of maEntryFont to set the entry font (if mbUseFont is true). */
92 virtual void InitEntry(
93 SvTreeListEntry
* pEntry
,
94 const OUString
& rEntryText
,
95 const Image
& rCollImg
,
97 SvLBoxButtonKind eButtonKind
) SAL_OVERRIDE
;
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */