1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fontlb.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SVX_FONTLB_HXX
32 #define SVX_FONTLB_HXX
35 #include <svtools/svtabbx.hxx>
37 #include <vcl/virdev.hxx>
38 #include "svx/svxdllapi.h"
39 #include <layout/layout.hxx>
41 // ============================================================================
43 /** A list box string item which stores its text and font. */
44 class SvLBoxFontString
: public SvLBoxString
47 Font maFont
; /// The font used by this item.
48 bool mbUseColor
; /// true = use font color, false = default listbox color.
55 const XubString
& rString
,
57 const Color
* pColor
= NULL
);
59 virtual ~SvLBoxFontString();
61 /** Creates a new empty list box item. */
62 virtual SvLBoxItem
* Create() const;
64 void InitViewData( SvLBox
*,SvLBoxEntry
*,SvViewDataItem
* );
66 /** Paints this entry to the specified position, using the own font settings. */
71 SvLBoxEntry
* pEntry
);
75 // ============================================================================
77 /** A list box supporting formatted string entries. */
78 class SVX_DLLPUBLIC SvxFontListBox
: public SvTabListBox
81 Font maStdFont
; /// Used for entries without specific font.
83 // The following members are used to store additional parameters for InitEntry().
84 Font maEntryFont
; /// Current entry font used in InitEntry().
85 const Color
* mpEntryColor
; /// Current entry color used in InitEntry().
86 bool mbUseFont
; /// true = Use maEntryFont/mpEntryColor in InitEntry().
89 SvxFontListBox( Window
* pParent
, const ResId
& rResId
);
91 /** Inserts a list entry and sets the font used for this entry.
92 @param pColor The font color. NULL = use default listbox text color. */
94 const String
& rString
, const Font
& rFont
, const Color
* pColor
= NULL
);
96 /** Selects/deselects an entry specified by its position in the list box. */
97 void SelectEntryPos( sal_uInt16 nPos
, bool bSelect
= true );
98 /** Removes a selection. */
99 void SetNoSelection();
101 /** Returns the position of the entry currently selected or LIST_APPEND. */
102 ULONG
GetSelectEntryPos() const;
103 /** Returns the text of the selected entry or an empty string. */
104 XubString
GetSelectEntry() const;
107 /** Initializes a new SvLBoxFontString entry.
108 @descr Uses current value of maEntryFont to set the entry font (if mbUseFont is true). */
109 virtual void InitEntry(
111 const XubString
& rEntryText
,
112 const Image
& rCollImg
,
113 const Image
& rExpImg
,
114 SvLBoxButtonKind eButtonKind
);
121 class SvxFontListBoxImpl
;
122 class SVX_DLLPUBLIC SvxFontListBox
: public ListBox
124 /*DECL_GET_IMPL( SvxFontListBox );
125 DECL_CONSTRUCTORS( SvxFontListBox, ListBox, WB_BORDER );
126 DECL_GET_WINDOW (SvxFontListBox);*/
129 SvxFontListBox( Context
*, const char* );
131 sal_uInt16
InsertFontEntry (String
const& entry
, Font
const& font
, Color
const* color
=0);
138 // ============================================================================