tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / cui / source / inc / chardlg.hxx
blob03567a7f5ba47b18a303496eb6200d3800bcacf0
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 #pragma once
21 #include <svtools/ctrlbox.hxx>
22 #include <sfx2/tabdlg.hxx>
23 #include <svx/fntctrl.hxx>
24 #include <svx/colorbox.hxx>
25 #include <svx/langbox.hxx>
26 #include <vcl/weld.hxx>
27 #include <memory>
29 // forward ---------------------------------------------------------------
31 class SvxFontListItem;
32 class FontList;
34 class SvxCharBasePage : public SfxTabPage
36 protected:
37 SvxFontPrevWindow m_aPreviewWin;
38 std::unique_ptr<weld::CustomWeld> m_xPreviewWin;
40 bool m_bPreviewBackgroundToCharacter;
42 SvxCharBasePage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet& rAttrSet);
44 void SetPrevFontWidthScale( const SfxItemSet& rSet );
45 void SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
47 inline SvxFont& GetPreviewFont();
48 inline SvxFont& GetPreviewCJKFont();
49 inline SvxFont& GetPreviewCTLFont();
51 public:
52 virtual ~SvxCharBasePage() override;
54 virtual void ActivatePage( const SfxItemSet& rSet ) override;
57 // class SvxCharNamePage -------------------------------------------------
59 struct SvxCharNamePage_Impl;
61 class SvxCharNamePage : public SvxCharBasePage
63 private:
64 static const WhichRangesContainer pNameRanges;
66 std::unique_ptr<SvxCharNamePage_Impl> m_pImpl;
68 std::unique_ptr<weld::Notebook> m_xWestern;
69 std::unique_ptr<weld::Label> m_xWestFontNameFT;
70 std::unique_ptr<weld::ComboBox> m_xWestFontNameLB;
71 std::unique_ptr<weld::Label> m_xWestFontStyleFT;
72 std::unique_ptr<FontStyleBox> m_xWestFontStyleLB;
73 std::unique_ptr<weld::Label> m_xWestFontSizeFT;
74 std::unique_ptr<FontSizeBox> m_xWestFontSizeLB;
75 std::unique_ptr<weld::Label> m_xWestFontLanguageFT;
76 std::unique_ptr<SvxLanguageBox> m_xWestFontLanguageLB;
77 std::unique_ptr<weld::Button> m_xWestFontFeaturesButton;
78 std::unique_ptr<weld::Label> m_xWestFontTypeFT;
80 std::unique_ptr<weld::Notebook> m_xCJK_CTL;
81 std::unique_ptr<weld::Label> m_xEastFontNameFT;
82 std::unique_ptr<weld::ComboBox> m_xEastFontNameLB;
83 std::unique_ptr<weld::Label> m_xEastFontStyleFT;
84 std::unique_ptr<FontStyleBox> m_xEastFontStyleLB;
85 std::unique_ptr<weld::Label> m_xEastFontSizeFT;
86 std::unique_ptr<FontSizeBox> m_xEastFontSizeLB;
87 std::unique_ptr<weld::Label> m_xEastFontLanguageFT;
88 std::unique_ptr<SvxLanguageBox> m_xEastFontLanguageLB;
89 std::unique_ptr<weld::Button> m_xEastFontFeaturesButton;
90 std::unique_ptr<weld::Label> m_xEastFontTypeFT;
92 std::unique_ptr<weld::Label> m_xCTLFontNameFT;
93 std::unique_ptr<weld::ComboBox> m_xCTLFontNameLB;
94 std::unique_ptr<weld::Label> m_xCTLFontStyleFT;
95 std::unique_ptr<FontStyleBox> m_xCTLFontStyleLB;
96 std::unique_ptr<weld::Label> m_xCTLFontSizeFT;
97 std::unique_ptr<FontSizeBox> m_xCTLFontSizeLB;
98 std::unique_ptr<weld::Label> m_xCTLFontLanguageFT;
99 std::unique_ptr<SvxLanguageBox> m_xCTLFontLanguageLB;
100 std::unique_ptr<weld::Button> m_xCTLFontFeaturesButton;
101 std::unique_ptr<weld::Label> m_xCTLFontTypeFT;
103 //for getting FontFeatures
104 ScopedVclPtrInstance<VirtualDevice> m_xVDev;
106 void Initialize();
107 const FontList* GetFontList() const;
108 void UpdatePreview_Impl();
109 void FillStyleBox_Impl(const weld::Widget& rBox);
110 void FillSizeBox_Impl(const weld::Widget& rBox);
111 void EnableFeatureButton(const weld::Widget& rNameBox);
113 enum LanguageGroup
115 /** Language for western text.
117 Western = 0,
119 /** Language for asian text.
121 Asian,
123 /** Language for ctl text.
128 void Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp );
129 bool FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp );
131 DECL_LINK(UpdateHdl_Impl, Timer *, void );
132 DECL_LINK(FontModifyComboBoxHdl_Impl, weld::ComboBox&, void);
133 DECL_LINK(FontFeatureButtonClicked, weld::Button&, void);
135 void FontModifyHdl_Impl(const weld::Widget&);
137 public:
138 virtual void ActivatePage( const SfxItemSet& rSet ) override;
139 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
141 public:
142 SvxCharNamePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
143 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
144 virtual ~SvxCharNamePage() override;
146 static const WhichRangesContainer & GetRanges() { return pNameRanges; }
148 virtual void Reset( const SfxItemSet* rSet ) override;
149 virtual bool FillItemSet( SfxItemSet* rSet ) override;
150 virtual void ChangesApplied() override;
152 void SetFontList( const SvxFontListItem& rItem );
153 void EnableRelativeMode();
154 void EnableSearchMode();
156 void DisableControls( sal_uInt16 nDisable );
157 virtual void PageCreated(const SfxAllItemSet& aSet) override;
160 // class SvxCharEffectsPage ----------------------------------------------
162 class SvxCharEffectsPage : public SvxCharBasePage
164 private:
165 static const WhichRangesContainer pEffectsRanges;
166 bool m_bOrigFontColor;
167 bool m_bNewFontColor;
168 bool m_bEnableNoneFontColor;
169 Color m_aOrigFontColor;
171 weld::TriStateEnabled m_aOutlineState;
172 weld::TriStateEnabled m_aShadowState;
173 weld::TriStateEnabled m_aHiddenState;
174 weld::TriStateEnabled m_aIndividualWordsState;
176 std::unique_ptr<weld::Label> m_xFontColorFT;
177 std::unique_ptr<ColorListBox> m_xFontColorLB;
178 std::unique_ptr<weld::Label> m_xFontTransparencyFT;
179 std::unique_ptr<weld::MetricSpinButton> m_xFontTransparencyMtr;
180 std::unique_ptr<weld::Label> m_xEffectsFT;
181 std::unique_ptr<weld::ComboBox> m_xEffectsLB;
182 std::unique_ptr<weld::Label> m_xReliefFT;
183 std::unique_ptr<weld::ComboBox> m_xReliefLB;
184 std::unique_ptr<weld::CheckButton> m_xOutlineBtn;
185 std::unique_ptr<weld::CheckButton> m_xShadowBtn;
186 std::unique_ptr<weld::CheckButton> m_xHiddenBtn;
187 std::unique_ptr<weld::ComboBox> m_xOverlineLB;
188 std::unique_ptr<weld::Label> m_xOverlineColorFT;
189 std::unique_ptr<ColorListBox> m_xOverlineColorLB;
190 std::unique_ptr<weld::ComboBox> m_xStrikeoutLB;
191 std::unique_ptr<weld::ComboBox> m_xUnderlineLB;
192 std::unique_ptr<weld::Label> m_xUnderlineColorFT;
193 std::unique_ptr<ColorListBox> m_xUnderlineColorLB;
194 std::unique_ptr<weld::CheckButton> m_xIndividualWordsBtn;
195 std::unique_ptr<weld::Label> m_xEmphasisFT;
196 std::unique_ptr<weld::ComboBox> m_xEmphasisLB;
197 std::unique_ptr<weld::Label> m_xPositionFT;
198 std::unique_ptr<weld::ComboBox> m_xPositionLB;
199 std::unique_ptr<weld::Label> m_xA11yWarningFT;
201 void Initialize();
202 void UpdatePreview_Impl();
203 void SetCaseMap_Impl( SvxCaseMap eCaseMap );
204 void ResetColor_Impl( const SfxItemSet& rSet );
205 bool FillItemSetColor_Impl( SfxItemSet& rSet );
206 void EnableNoneFontColor();
208 void SelectHdl_Impl(const weld::ComboBox*);
209 DECL_LINK(SelectListBoxHdl_Impl, weld::ComboBox&, void);
210 DECL_LINK(OutlineBtnClickHdl, weld::Toggleable&, void);
211 DECL_LINK(ShadowBtnClickHdl, weld::Toggleable&, void);
212 DECL_LINK(HiddenBtnClickHdl, weld::Toggleable&, void);
213 DECL_LINK(CbClickHdl_Impl, weld::Toggleable&, void);
214 DECL_LINK(ColorBoxSelectHdl_Impl, ColorListBox&, void);
215 DECL_LINK(ModifyFontTransparencyHdl_Impl, weld::MetricSpinButton&, void);
217 public:
218 SvxCharEffectsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
219 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
220 virtual ~SvxCharEffectsPage() override;
222 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
224 public:
225 static const WhichRangesContainer & GetRanges() { return pEffectsRanges; }
227 virtual void Reset( const SfxItemSet* rSet ) override;
228 virtual bool FillItemSet( SfxItemSet* rSet ) override;
229 virtual void ChangesApplied() override;
231 void DisableControls( sal_uInt16 nDisable );
232 virtual void PageCreated(const SfxAllItemSet& aSet) override;
235 // class SvxCharPositionPage ---------------------------------------------
236 class SvxCharPositionPage : public SvxCharBasePage
238 static const WhichRangesContainer pPositionRanges;
240 private:
241 short m_nSuperEsc;
242 short m_nSubEsc;
244 sal_uInt16 m_nScaleWidthItemSetVal;
245 sal_uInt16 m_nScaleWidthInitialVal;
247 sal_uInt8 m_nSuperProp;
248 sal_uInt8 m_nSubProp;
250 std::unique_ptr<weld::RadioButton> m_xHighPosBtn;
251 std::unique_ptr<weld::RadioButton> m_xNormalPosBtn;
252 std::unique_ptr<weld::RadioButton> m_xLowPosBtn;
253 std::unique_ptr<weld::Label> m_xHighLowFT;
254 std::unique_ptr<weld::MetricSpinButton> m_xHighLowMF;
255 std::unique_ptr<weld::CheckButton> m_xHighLowRB;
256 std::unique_ptr<weld::Label> m_xFontSizeFT;
257 std::unique_ptr<weld::MetricSpinButton> m_xFontSizeMF;
259 std::unique_ptr<weld::Widget> m_xRotationContainer;
261 std::unique_ptr<weld::Label> m_xScalingFT;
262 std::unique_ptr<weld::Label> m_xScalingAndRotationFT;
263 std::unique_ptr<weld::RadioButton> m_x0degRB;
264 std::unique_ptr<weld::RadioButton> m_x90degRB;
265 std::unique_ptr<weld::RadioButton> m_x270degRB;
266 std::unique_ptr<weld::CheckButton> m_xFitToLineCB;
268 std::unique_ptr<weld::MetricSpinButton> m_xScaleWidthMF;
270 std::unique_ptr<weld::MetricSpinButton> m_xKerningMF;
271 std::unique_ptr<weld::CheckButton> m_xPairKerningBtn;
272 std::unique_ptr<weld::CheckButton> m_xNoHyphenationBtn;
274 void Initialize();
275 void UpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
276 void SetEscapement_Impl( SvxEscapement nEsc );
278 DECL_LINK(PositionHdl_Impl, weld::Toggleable&, void);
279 DECL_LINK(RotationHdl_Impl, weld::Toggleable&, void);
280 DECL_LINK(AutoPositionHdl_Impl, weld::Toggleable&, void);
281 DECL_LINK(FitToLineHdl_Impl, weld::Toggleable&, void);
282 DECL_LINK(KerningModifyHdl_Impl, weld::MetricSpinButton&, void);
283 DECL_LINK(ValueChangedHdl_Impl, weld::MetricSpinButton&, void);
284 DECL_LINK(ScaleWidthModifyHdl_Impl, weld::MetricSpinButton&, void);
285 void FontModifyHdl_Impl();
287 public:
288 SvxCharPositionPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
289 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
290 virtual ~SvxCharPositionPage() override;
292 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
294 public:
295 static const WhichRangesContainer & GetRanges() { return pPositionRanges; }
297 virtual void Reset( const SfxItemSet* rSet ) override;
298 virtual bool FillItemSet( SfxItemSet* rSet ) override;
299 virtual void ChangesApplied() override;
300 virtual void FillUserData() override;
301 virtual void PageCreated(const SfxAllItemSet& aSet) override;
304 // class SvxCharTwoLinesPage ---------------------------------------------
306 class SvxCharTwoLinesPage : public SvxCharBasePage
308 private:
309 static const WhichRangesContainer pTwoLinesRanges;
310 sal_uInt16 m_nStartBracketPosition;
311 sal_uInt16 m_nEndBracketPosition;
313 std::unique_ptr<weld::CheckButton> m_xTwoLinesBtn;
314 std::unique_ptr<weld::Widget> m_xEnclosingFrame;
315 std::unique_ptr<weld::TreeView> m_xStartBracketLB;
316 std::unique_ptr<weld::TreeView> m_xEndBracketLB;
318 void UpdatePreview_Impl();
319 void Initialize();
320 void SelectCharacter(weld::TreeView* pBox);
321 void SetBracket(sal_Unicode cBracket, bool bStart);
323 DECL_LINK(TwoLinesHdl_Impl, weld::Toggleable&, void);
324 DECL_LINK(CharacterMapHdl_Impl, weld::TreeView&, void);
326 public:
327 SvxCharTwoLinesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
328 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
329 virtual ~SvxCharTwoLinesPage() override;
331 virtual void ActivatePage( const SfxItemSet& rSet ) override;
332 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
334 static const WhichRangesContainer & GetRanges() { return pTwoLinesRanges; }
336 virtual void Reset( const SfxItemSet* rSet ) override;
337 virtual bool FillItemSet( SfxItemSet* rSet ) override;
338 virtual void PageCreated(const SfxAllItemSet& aSet) override;
341 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */