tdf#147611: fix indices
[LibreOffice.git] / cui / source / inc / chardlg.hxx
blobbe4db989b57d7de252567be4764083e48198d087
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 OString& 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::Widget> m_xWestFrame;
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::Label> m_xWestFontTypeFT;
78 std::unique_ptr<weld::Button> m_xWestFontFeaturesButton;
80 std::unique_ptr<weld::Widget> m_xEastFrame;
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::Label> m_xEastFontTypeFT;
90 std::unique_ptr<weld::Button> m_xEastFontFeaturesButton;
92 std::unique_ptr<weld::Widget> m_xCTLFrame;
93 std::unique_ptr<weld::Label> m_xCTLFontNameFT;
94 std::unique_ptr<weld::ComboBox> m_xCTLFontNameLB;
95 std::unique_ptr<weld::Label> m_xCTLFontStyleFT;
96 std::unique_ptr<FontStyleBox> m_xCTLFontStyleLB;
97 std::unique_ptr<weld::Label> m_xCTLFontSizeFT;
98 std::unique_ptr<FontSizeBox> m_xCTLFontSizeLB;
99 std::unique_ptr<weld::Label> m_xCTLFontLanguageFT;
100 std::unique_ptr<SvxLanguageBox> m_xCTLFontLanguageLB;
101 std::unique_ptr<weld::Label> m_xCTLFontTypeFT;
102 std::unique_ptr<weld::Button> m_xCTLFontFeaturesButton;
104 //for getting FontFeatures
105 ScopedVclPtrInstance<VirtualDevice> m_xVDev;
107 void Initialize();
108 const FontList* GetFontList() const;
109 void UpdatePreview_Impl();
110 void FillStyleBox_Impl(const weld::Widget& rBox);
111 void FillSizeBox_Impl(const weld::Widget& rBox);
112 void EnableFeatureButton(const weld::Widget& rNameBox);
114 enum LanguageGroup
116 /** Language for western text.
118 Western = 0,
120 /** Language for asian text.
122 Asian,
124 /** Language for ctl text.
129 void Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp );
130 bool FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp );
132 DECL_LINK(UpdateHdl_Impl, Timer *, void );
133 DECL_LINK(FontModifyComboBoxHdl_Impl, weld::ComboBox&, void);
134 DECL_LINK(FontFeatureButtonClicked, weld::Button&, void);
136 void FontModifyHdl_Impl(const weld::Widget&);
138 public:
139 virtual void ActivatePage( const SfxItemSet& rSet ) override;
140 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
142 public:
143 SvxCharNamePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
144 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
145 virtual ~SvxCharNamePage() override;
147 static WhichRangesContainer GetRanges() { return pNameRanges; }
149 virtual void Reset( const SfxItemSet* rSet ) override;
150 virtual bool FillItemSet( SfxItemSet* rSet ) override;
151 virtual void ChangesApplied() override;
153 void SetFontList( const SvxFontListItem& rItem );
154 void EnableRelativeMode();
155 void EnableSearchMode();
157 void DisableControls( sal_uInt16 nDisable );
158 virtual void PageCreated(const SfxAllItemSet& aSet) override;
161 // class SvxCharEffectsPage ----------------------------------------------
163 class SvxCharEffectsPage : public SvxCharBasePage
165 private:
166 static const WhichRangesContainer pEffectsRanges;
167 bool m_bOrigFontColor;
168 bool m_bNewFontColor;
169 bool m_bEnableNoneFontColor;
170 Color m_aOrigFontColor;
171 sal_uInt16 m_nHtmlMode;
173 weld::TriStateEnabled m_aOutlineState;
174 weld::TriStateEnabled m_aShadowState;
175 weld::TriStateEnabled m_aHiddenState;
176 weld::TriStateEnabled m_aIndividualWordsState;
178 std::unique_ptr<weld::Label> m_xFontColorFT;
179 std::unique_ptr<ColorListBox> m_xFontColorLB;
180 std::unique_ptr<weld::Label> m_xFontTransparencyFT;
181 std::unique_ptr<weld::MetricSpinButton> m_xFontTransparencyMtr;
182 std::unique_ptr<weld::Label> m_xEffectsFT;
183 std::unique_ptr<weld::ComboBox> m_xEffectsLB;
184 std::unique_ptr<weld::Label> m_xReliefFT;
185 std::unique_ptr<weld::ComboBox> m_xReliefLB;
186 std::unique_ptr<weld::CheckButton> m_xOutlineBtn;
187 std::unique_ptr<weld::CheckButton> m_xShadowBtn;
188 std::unique_ptr<weld::CheckButton> m_xHiddenBtn;
189 std::unique_ptr<weld::ComboBox> m_xOverlineLB;
190 std::unique_ptr<weld::Label> m_xOverlineColorFT;
191 std::unique_ptr<ColorListBox> m_xOverlineColorLB;
192 std::unique_ptr<weld::ComboBox> m_xStrikeoutLB;
193 std::unique_ptr<weld::ComboBox> m_xUnderlineLB;
194 std::unique_ptr<weld::Label> m_xUnderlineColorFT;
195 std::unique_ptr<ColorListBox> m_xUnderlineColorLB;
196 std::unique_ptr<weld::CheckButton> m_xIndividualWordsBtn;
197 std::unique_ptr<weld::Label> m_xEmphasisFT;
198 std::unique_ptr<weld::ComboBox> m_xEmphasisLB;
199 std::unique_ptr<weld::Label> m_xPositionFT;
200 std::unique_ptr<weld::ComboBox> m_xPositionLB;
201 std::unique_ptr<weld::Label> m_xA11yWarningFT;
203 void Initialize();
204 void UpdatePreview_Impl();
205 void SetCaseMap_Impl( SvxCaseMap eCaseMap );
206 void ResetColor_Impl( const SfxItemSet& rSet );
207 bool FillItemSetColor_Impl( SfxItemSet& rSet );
208 void EnableNoneFontColor();
210 void SelectHdl_Impl(const weld::ComboBox*);
211 DECL_LINK(SelectListBoxHdl_Impl, weld::ComboBox&, void);
212 DECL_LINK(OutlineBtnClickHdl, weld::Toggleable&, void);
213 DECL_LINK(ShadowBtnClickHdl, weld::Toggleable&, void);
214 DECL_LINK(HiddenBtnClickHdl, weld::Toggleable&, void);
215 DECL_LINK(CbClickHdl_Impl, weld::Toggleable&, void);
216 DECL_LINK(ColorBoxSelectHdl_Impl, ColorListBox&, void);
217 DECL_LINK(ModifyFontTransparencyHdl_Impl, weld::MetricSpinButton&, void);
219 public:
220 SvxCharEffectsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
221 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
222 virtual ~SvxCharEffectsPage() override;
224 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
226 public:
227 static WhichRangesContainer GetRanges() { return pEffectsRanges; }
229 virtual void Reset( const SfxItemSet* rSet ) override;
230 virtual bool FillItemSet( SfxItemSet* rSet ) override;
231 virtual void ChangesApplied() override;
233 void DisableControls( sal_uInt16 nDisable );
234 virtual void PageCreated(const SfxAllItemSet& aSet) override;
237 // class SvxCharPositionPage ---------------------------------------------
238 class SvxCharPositionPage : public SvxCharBasePage
240 static const WhichRangesContainer pPositionRanges;
242 private:
243 short m_nSuperEsc;
244 short m_nSubEsc;
246 sal_uInt16 m_nScaleWidthItemSetVal;
247 sal_uInt16 m_nScaleWidthInitialVal;
249 sal_uInt8 m_nSuperProp;
250 sal_uInt8 m_nSubProp;
252 std::unique_ptr<weld::RadioButton> m_xHighPosBtn;
253 std::unique_ptr<weld::RadioButton> m_xNormalPosBtn;
254 std::unique_ptr<weld::RadioButton> m_xLowPosBtn;
255 std::unique_ptr<weld::Label> m_xHighLowFT;
256 std::unique_ptr<weld::MetricSpinButton> m_xHighLowMF;
257 std::unique_ptr<weld::CheckButton> m_xHighLowRB;
258 std::unique_ptr<weld::Label> m_xFontSizeFT;
259 std::unique_ptr<weld::MetricSpinButton> m_xFontSizeMF;
261 std::unique_ptr<weld::Widget> m_xRotationContainer;
263 std::unique_ptr<weld::Label> m_xScalingFT;
264 std::unique_ptr<weld::Label> m_xScalingAndRotationFT;
265 std::unique_ptr<weld::RadioButton> m_x0degRB;
266 std::unique_ptr<weld::RadioButton> m_x90degRB;
267 std::unique_ptr<weld::RadioButton> m_x270degRB;
268 std::unique_ptr<weld::CheckButton> m_xFitToLineCB;
270 std::unique_ptr<weld::MetricSpinButton> m_xScaleWidthMF;
272 std::unique_ptr<weld::MetricSpinButton> m_xKerningMF;
273 std::unique_ptr<weld::CheckButton> m_xPairKerningBtn;
275 void Initialize();
276 void UpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
277 void SetEscapement_Impl( SvxEscapement nEsc );
279 DECL_LINK(PositionHdl_Impl, weld::Toggleable&, void);
280 DECL_LINK(RotationHdl_Impl, weld::Toggleable&, void);
281 DECL_LINK(AutoPositionHdl_Impl, weld::Toggleable&, void);
282 DECL_LINK(FitToLineHdl_Impl, weld::Toggleable&, void);
283 DECL_LINK(KerningModifyHdl_Impl, weld::MetricSpinButton&, void);
284 DECL_LINK(ValueChangedHdl_Impl, weld::MetricSpinButton&, void);
285 DECL_LINK(ScaleWidthModifyHdl_Impl, weld::MetricSpinButton&, void);
286 void FontModifyHdl_Impl();
288 public:
289 SvxCharPositionPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
290 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
291 virtual ~SvxCharPositionPage() override;
293 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
295 public:
296 static WhichRangesContainer GetRanges() { return pPositionRanges; }
298 virtual void Reset( const SfxItemSet* rSet ) override;
299 virtual bool FillItemSet( SfxItemSet* rSet ) override;
300 virtual void ChangesApplied() override;
301 virtual void FillUserData() override;
302 virtual void PageCreated(const SfxAllItemSet& aSet) override;
305 // class SvxCharTwoLinesPage ---------------------------------------------
307 class SvxCharTwoLinesPage : public SvxCharBasePage
309 private:
310 static const WhichRangesContainer pTwoLinesRanges;
311 sal_uInt16 m_nStartBracketPosition;
312 sal_uInt16 m_nEndBracketPosition;
314 std::unique_ptr<weld::CheckButton> m_xTwoLinesBtn;
315 std::unique_ptr<weld::Widget> m_xEnclosingFrame;
316 std::unique_ptr<weld::TreeView> m_xStartBracketLB;
317 std::unique_ptr<weld::TreeView> m_xEndBracketLB;
319 void UpdatePreview_Impl();
320 void Initialize();
321 void SelectCharacter(weld::TreeView* pBox);
322 void SetBracket(sal_Unicode cBracket, bool bStart);
324 DECL_LINK(TwoLinesHdl_Impl, weld::Toggleable&, void);
325 DECL_LINK(CharacterMapHdl_Impl, weld::TreeView&, void);
327 public:
328 SvxCharTwoLinesPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
329 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
330 virtual ~SvxCharTwoLinesPage() override;
332 virtual void ActivatePage( const SfxItemSet& rSet ) override;
333 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
335 static WhichRangesContainer GetRanges() { return pTwoLinesRanges; }
337 virtual void Reset( const SfxItemSet* rSet ) override;
338 virtual bool FillItemSet( SfxItemSet* rSet ) override;
339 virtual void PageCreated(const SfxAllItemSet& aSet) override;
342 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */