Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SVX_FONTLB_HXX
30 : : #define SVX_FONTLB_HXX
31 : :
32 : : #include <svtools/svtabbx.hxx>
33 : : #include <vcl/virdev.hxx>
34 : : #include "svx/svxdllapi.h"
35 : :
36 : : // ============================================================================
37 : :
38 : : /** A list box string item which stores its text and font. */
39 : : class SvLBoxFontString : public SvLBoxString
40 : : {
41 : : private:
42 : : Font maFont; /// The font used by this item.
43 : : bool mbUseColor; /// true = use font color, false = default listbox color.
44 : :
45 : : public:
46 : : SvLBoxFontString();
47 : : SvLBoxFontString(
48 : : SvLBoxEntry* pEntry,
49 : : sal_uInt16 nFlags,
50 : : const XubString& rString,
51 : : const Font& rFont,
52 : : const Color* pColor = NULL );
53 : :
54 : : virtual ~SvLBoxFontString();
55 : :
56 : : /** Creates a new empty list box item. */
57 : : virtual SvLBoxItem* Create() const;
58 : :
59 : : void InitViewData( SvLBox*,SvLBoxEntry*,SvViewDataItem* );
60 : :
61 : : /** Paints this entry to the specified position, using the own font settings. */
62 : : void Paint(
63 : : const Point& rPos,
64 : : SvLBox& rDev,
65 : : sal_uInt16 nFlags,
66 : : SvLBoxEntry* pEntry );
67 : : };
68 : :
69 : :
70 : : // ============================================================================
71 : :
72 : : /** A list box supporting formatted string entries. */
73 [ # # ][ # # ]: 0 : class SVX_DLLPUBLIC SvxFontListBox : public SvTabListBox
[ # # ]
74 : : {
75 : : private:
76 : : Font maStdFont; /// Used for entries without specific font.
77 : :
78 : : // The following members are used to store additional parameters for InitEntry().
79 : : Font maEntryFont; /// Current entry font used in InitEntry().
80 : : const Color* mpEntryColor; /// Current entry color used in InitEntry().
81 : : bool mbUseFont; /// true = Use maEntryFont/mpEntryColor in InitEntry().
82 : :
83 : : public:
84 : : SvxFontListBox( Window* pParent, const ResId& rResId );
85 : :
86 : : /** Inserts a list entry and sets the font used for this entry.
87 : : @param pColor The font color. NULL = use default listbox text color. */
88 : : void InsertFontEntry(
89 : : const String& rString, const Font& rFont, const Color* pColor = NULL );
90 : :
91 : : /** Selects/deselects an entry specified by its position in the list box. */
92 : : void SelectEntryPos( sal_uInt16 nPos, bool bSelect = true );
93 : : /** Removes a selection. */
94 : : void SetNoSelection();
95 : :
96 : : /** Returns the position of the entry currently selected or LIST_APPEND. */
97 : : sal_uLong GetSelectEntryPos() const;
98 : : /** Returns the text of the selected entry or an empty string. */
99 : : XubString GetSelectEntry() const;
100 : :
101 : : protected:
102 : : /** Initializes a new SvLBoxFontString entry.
103 : : @descr Uses current value of maEntryFont to set the entry font (if mbUseFont is true). */
104 : : virtual void InitEntry(
105 : : SvLBoxEntry* pEntry,
106 : : const XubString& rEntryText,
107 : : const Image& rCollImg,
108 : : const Image& rExpImg,
109 : : SvLBoxButtonKind eButtonKind );
110 : : };
111 : :
112 : : // ============================================================================
113 : :
114 : : #endif
115 : :
116 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|