Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / fntctrl.hxx
blobed0828e8cc3b8932094d3e36646ab7825d42a632
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 .
19 #ifndef INCLUDED_SVX_FNTCTRL_HXX
20 #define INCLUDED_SVX_FNTCTRL_HXX
22 #include <memory>
23 #include <vcl/window.hxx>
24 #include <editeng/svxfont.hxx>
25 #include <svx/svxdllapi.h>
27 #include <rtl/ustring.hxx>
29 class SfxItemSet;
30 class FontPrevWin_Impl;
32 class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFontPrevWindow : public vcl::Window
34 using OutputDevice::SetFont;
35 private:
36 std::unique_ptr<FontPrevWin_Impl> pImpl;
37 bool mbResetForeground : 1;
38 bool mbResetBackground : 1;
40 SVX_DLLPRIVATE void ResetSettings(bool bForeground, bool bBackground);
41 SVX_DLLPRIVATE void ApplySettings(vcl::RenderContext& rRenderContext) override;
42 SVX_DLLPRIVATE void Init ();
43 SVX_DLLPRIVATE static void SetFontSize(const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont);
44 SVX_DLLPRIVATE static void SetFontLang(const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont);
46 public:
47 SvxFontPrevWindow(vcl::Window* pParent, WinBits nStyle);
48 virtual ~SvxFontPrevWindow() override;
49 virtual void dispose() override;
51 virtual void StateChanged( StateChangedType nStateChange ) override;
52 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
54 void Init( const SfxItemSet& rSet );
56 // for reasons of efficiency not const
57 SvxFont& GetFont();
58 const SvxFont& GetFont() const;
59 void SetFont( const SvxFont& rNormalFont, const SvxFont& rCJKFont, const SvxFont& rCTLFont );
60 SvxFont& GetCJKFont();
61 SvxFont& GetCTLFont();
62 void SetColor( const Color& rColor );
63 void ResetColor();
64 void SetBackColor( const Color& rColor );
65 void UseResourceText();
66 void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) override;
68 bool IsTwoLines() const;
69 void SetTwoLines(bool bSet);
71 void SetBrackets(sal_Unicode cStart, sal_Unicode cEnd);
73 void SetFontWidthScale( sal_uInt16 nScaleInPercent );
75 void AutoCorrectFontColor();
77 void SetPreviewText( const OUString& rString );
78 void SetFontNameAsPreviewText();
80 static void SetFont( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFont& rFont );
81 static void SetFontStyle( const SfxItemSet& rSet, sal_uInt16 nSlotPosture, sal_uInt16 nSlotWeight, SvxFont& rFont ); // posture/weight
82 void SetFontWidthScale( const SfxItemSet& rSet );
83 void SetFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
85 void SetFromItemSet( const SfxItemSet &rSet,
86 bool bPreviewBackgroundToCharacter );
88 virtual Size GetOptimalSize() const override;
91 #endif // INCLUDED_SVX_FNTCTRL_HXX
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */