LibreOffice Module cui (master)  1
FontFeaturesDialog.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  */
10 
11 #pragma once
12 
13 #include <vcl/svapp.hxx>
14 #include <vcl/weld.hxx>
15 #include <vcl/font/Feature.hxx>
16 #include <svx/fntctrl.hxx>
17 #include <memory>
18 
19 namespace cui
20 {
22 {
24  : m_aFeatureCode(0)
25  , m_nDefault(0)
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"))
31  {
32  }
33 
34  sal_uInt32 m_aFeatureCode;
35  sal_uInt32 m_nDefault;
36  std::unique_ptr<weld::Builder> m_xBuilder;
37  std::unique_ptr<weld::Widget> m_xContainer;
38  std::unique_ptr<weld::Label> m_xText;
39  std::unique_ptr<weld::ComboBox> m_xCombo;
40  std::unique_ptr<weld::CheckButton> m_xCheck;
41 };
42 
44 {
45 private:
46  std::vector<FontFeatureItem> m_aFeatureItems;
47  OUString m_sFontName;
49 
51  std::unique_ptr<weld::ScrolledWindow> m_xContentWindow;
52  std::unique_ptr<weld::Container> m_xContentGrid;
53  std::unique_ptr<weld::CustomWeld> m_xPreviewWindow;
54 
55  void initialize();
56  OUString createFontNameWithFeatures();
57 
58  // returns the max height of a row
59  int fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures);
60 
61  DECL_LINK(ComboBoxSelectedHdl, weld::ComboBox&, void);
62  DECL_LINK(CheckBoxToggledHdl, weld::Toggleable&, void);
63 
64 public:
65  FontFeaturesDialog(weld::Window* pParent, OUString const& rFontName);
66  ~FontFeaturesDialog() override;
67  virtual short run() override;
68 
69  OUString const& getResultFontName() const { return m_sResultFontName; }
70 
71  void updateFontPreview();
72 };
73 
74 } // end svx namespaces
75 
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::CustomWeld > m_xPreviewWindow
virtual short run() override
OUString const & getResultFontName() const
FontFeatureItem(weld::Widget *pParent)
std::unique_ptr< weld::ScrolledWindow > m_xContentWindow
std::unique_ptr< weld::Widget > m_xContainer
std::unique_ptr< weld::Builder > m_xBuilder
int fillGrid(std::vector< vcl::font::Feature > const &rFontFeatures)
std::vector< FontFeatureItem > m_aFeatureItems
std::unique_ptr< weld::Label > m_xText
std::unique_ptr< weld::ComboBox > m_xCombo
SvxFontPrevWindow m_aPreviewWindow
FontFeaturesDialog(weld::Window *pParent, OUString const &rFontName)
std::unique_ptr< weld::Container > m_xContentGrid
std::unique_ptr< weld::CheckButton > m_xCheck
DECL_LINK(ComboBoxSelectedHdl, weld::ComboBox &, void)