merge the formfield patch from ooo-build
[ooovba.git] / svx / inc / fontlb.hxx
blob2b12b98039e91f21f3c0479df4c3fcce5acd6cdb
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 $
10 * $Revision: 1.7 $
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
34 #ifndef _SVTABBOX_HXX
35 #include <svtools/svtabbx.hxx>
36 #endif
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
46 private:
47 Font maFont; /// The font used by this item.
48 bool mbUseColor; /// true = use font color, false = default listbox color.
50 public:
51 SvLBoxFontString();
52 SvLBoxFontString(
53 SvLBoxEntry* pEntry,
54 sal_uInt16 nFlags,
55 const XubString& rString,
56 const Font& rFont,
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. */
67 void Paint(
68 const Point& rPos,
69 SvLBox& rDev,
70 sal_uInt16 nFlags,
71 SvLBoxEntry* pEntry );
75 // ============================================================================
77 /** A list box supporting formatted string entries. */
78 class SVX_DLLPUBLIC SvxFontListBox : public SvTabListBox
80 private:
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().
88 public:
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. */
93 void InsertFontEntry(
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;
106 protected:
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(
110 SvLBoxEntry* pEntry,
111 const XubString& rEntryText,
112 const Image& rCollImg,
113 const Image& rExpImg,
114 SvLBoxButtonKind eButtonKind );
117 #if ENABLE_LAYOUT
119 namespace layout
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);*/
128 public:
129 SvxFontListBox( Context*, const char* );
130 ~SvxFontListBox ();
131 sal_uInt16 InsertFontEntry (String const& entry, Font const& font, Color const* color=0);
135 #endif
138 // ============================================================================
140 #endif