Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / fontlb.hxx
blobfb742cf106e86c86480af161303bb82ff4b90f7d
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>
29 /** A list box string item which stores its text and font. */
30 class SAL_WARN_UNUSED SvLBoxFontString : public SvLBoxString
32 private:
33 vcl::Font maFont; /// The font used by this item.
34 bool mbUseColor; /// true = use font color, false = default listbox color.
36 public:
37 SvLBoxFontString();
38 SvLBoxFontString(
39 const OUString& rString,
40 const vcl::Font& rFont,
41 const Color* pColor );
43 virtual ~SvLBoxFontString() override;
45 /** Creates a new empty list box item. */
46 virtual SvLBoxItem* Create() const override;
48 void InitViewData( SvTreeListBox*, SvTreeListEntry*, SvViewDataItem* = nullptr ) override;
50 /** Paints this entry to the specified position, using the own font settings. */
51 virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext,
52 const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override;
56 /** A list box supporting formatted string entries. */
57 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontListBox : public SvTabListBox
59 private:
60 vcl::Font maStdFont; /// Used for entries without specific font.
62 // The following members are used to store additional parameters for InitEntry().
63 vcl::Font maEntryFont; /// Current entry font used in InitEntry().
64 const Color* mpEntryColor; /// Current entry color used in InitEntry().
65 bool mbUseFont; /// true = Use maEntryFont/mpEntryColor in InitEntry().
67 public:
68 SvxFontListBox(vcl::Window* pParent, WinBits nStyle);
70 /** Inserts a list entry and sets the font used for this entry.
71 @param pColor The font color. NULL = use default listbox text color. */
72 void InsertFontEntry(
73 const OUString& rString, const vcl::Font& rFont, const Color* pColor = nullptr );
75 /** Selects an entry specified by its position in the list box. */
76 void SelectEntryPos( sal_uLong nPos );
77 /** Removes a selection. */
78 void SetNoSelection();
80 /** Returns the position of the entry currently selected or TREELIST_APPEND.
82 sal_uLong GetSelectEntryPos() const;
84 protected:
85 /** Initializes a new SvLBoxFontString entry.
86 @descr Uses current value of maEntryFont to set the entry font (if mbUseFont is true). */
87 virtual void InitEntry(
88 SvTreeListEntry* pEntry,
89 const OUString& rEntryText,
90 const Image& rCollImg,
91 const Image& rExpImg,
92 SvLBoxButtonKind eButtonKind) override;
95 #endif
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */