bump product version to 4.2.0.1
[LibreOffice.git] / include / svx / fontlb.hxx
blob185d1c172072a9ac65ac9426f5d0a00f4f5102ec
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_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>
28 // ============================================================================
30 /** A list box string item which stores its text and font. */
31 class SvLBoxFontString : public SvLBoxString
33 private:
34 Font maFont; /// The font used by this item.
35 bool mbUseColor; /// true = use font color, false = default listbox color.
37 public:
38 SvLBoxFontString();
39 SvLBoxFontString(
40 SvTreeListEntry* pEntry,
41 sal_uInt16 nFlags,
42 const OUString& rString,
43 const Font& rFont,
44 const Color* pColor = NULL );
46 virtual ~SvLBoxFontString();
48 /** Creates a new empty list box item. */
49 virtual SvLBoxItem* Create() const;
51 void InitViewData( SvTreeListBox*,SvTreeListEntry*,SvViewDataItem* );
53 /** Paints this entry to the specified position, using the own font settings. */
54 virtual void Paint(
55 const Point& rPos, SvTreeListBox& rOutDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry);
59 // ============================================================================
61 /** A list box supporting formatted string entries. */
62 class SVX_DLLPUBLIC SvxFontListBox : public SvTabListBox
64 private:
65 Font maStdFont; /// Used for entries without specific font.
67 // The following members are used to store additional parameters for InitEntry().
68 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().
72 public:
73 SvxFontListBox(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. */
77 void InsertFontEntry(
78 const OUString& rString, const Font& rFont, const Color* pColor = NULL );
80 /** Selects/deselects an entry specified by its position in the list box. */
81 void SelectEntryPos( sal_uInt16 nPos, bool bSelect = true );
82 /** Removes a selection. */
83 void SetNoSelection();
85 /** Returns the position of the entry currently selected or LIST_APPEND. */
86 sal_uLong GetSelectEntryPos() const;
87 /** Returns the text of the selected entry or an empty string. */
88 OUString GetSelectEntry() const;
90 protected:
91 /** Initializes a new SvLBoxFontString entry.
92 @descr Uses current value of maEntryFont to set the entry font (if mbUseFont is true). */
93 virtual void InitEntry(
94 SvTreeListEntry* pEntry,
95 const OUString& rEntryText,
96 const Image& rCollImg,
97 const Image& rExpImg,
98 SvLBoxButtonKind eButtonKind);
101 // ============================================================================
103 #endif
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */