Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / cui / source / inc / FontFeaturesDialog.hxx
blob93ba0cb9f80de981350322047ec5ddb259b9be61
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 */
11 #pragma once
13 #include <vcl/svapp.hxx>
14 #include <vcl/weld.hxx>
15 #include <vcl/font/Feature.hxx>
16 #include <svx/fntctrl.hxx>
17 #include <memory>
19 namespace cui
21 struct FontFeatureItem
23 FontFeatureItem(weld::Widget* pParent)
24 : m_aFeatureCode(0)
25 , m_nDefault(-1)
26 , m_xBuilder(Application::CreateBuilder(pParent, "cui/ui/fontfragment.ui"))
27 , m_xContainer(m_xBuilder->weld_widget("fontentry"))
28 , m_xText(m_xBuilder->weld_label("label"))
29 , m_xCombo(m_xBuilder->weld_combo_box("combo"))
30 , m_xCheck(m_xBuilder->weld_check_button("check"))
32 m_xCheck->connect_toggled(LINK(this, FontFeatureItem, CheckBoxToggledHdl));
35 sal_uInt32 m_aFeatureCode;
36 sal_Int32 m_nDefault;
37 weld::TriStateEnabled m_aTriStateEnabled;
38 Link<weld::Toggleable&, void> m_aToggleHdl;
39 std::unique_ptr<weld::Builder> m_xBuilder;
40 std::unique_ptr<weld::Widget> m_xContainer;
41 std::unique_ptr<weld::Label> m_xText;
42 std::unique_ptr<weld::ComboBox> m_xCombo;
43 std::unique_ptr<weld::CheckButton> m_xCheck;
45 private:
46 DECL_LINK(CheckBoxToggledHdl, weld::Toggleable&, void);
49 class FontFeaturesDialog : public weld::GenericDialogController
51 private:
52 std::vector<std::unique_ptr<FontFeatureItem>> m_aFeatureItems;
53 OUString m_sFontName;
54 OUString m_sResultFontName;
56 SvxFontPrevWindow m_aPreviewWindow;
57 std::unique_ptr<weld::ScrolledWindow> m_xContentWindow;
58 std::unique_ptr<weld::Container> m_xContentBox;
59 std::unique_ptr<weld::Container> m_xContentGrid;
60 std::unique_ptr<weld::Container> m_xStylisticSetsBox;
61 std::unique_ptr<weld::Container> m_xStylisticSetsGrid;
62 std::unique_ptr<weld::Container> m_xCharacterVariantsBox;
63 std::unique_ptr<weld::Container> m_xCharacterVariantsGrid;
64 std::unique_ptr<weld::CustomWeld> m_xPreviewWindow;
66 void initialize();
67 OUString createFontNameWithFeatures();
69 // returns the max height of a row
70 int fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures);
72 DECL_LINK(ComboBoxSelectedHdl, weld::ComboBox&, void);
73 DECL_LINK(CheckBoxToggledHdl, weld::Toggleable&, void);
75 public:
76 FontFeaturesDialog(weld::Window* pParent, OUString aFontName);
77 ~FontFeaturesDialog() override;
78 virtual short run() override;
80 OUString const& getResultFontName() const { return m_sResultFontName; }
82 void updateFontPreview();
85 } // end svx namespaces
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */