1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_CUI_SOURCE_INC_CHARDLG_HXX
20 #define INCLUDED_CUI_SOURCE_INC_CHARDLG_HXX
22 #include <svtools/ctrlbox.hxx>
23 #include <sfx2/tabdlg.hxx>
24 #include <svx/fntctrl.hxx>
25 #include <svx/colorbox.hxx>
26 #include <svx/langbox.hxx>
27 #include <vcl/weld.hxx>
30 // forward ---------------------------------------------------------------
32 class SvxFontListItem
;
35 class SvxCharBasePage
: public SfxTabPage
38 SvxFontPrevWindow m_aPreviewWin
;
39 std::unique_ptr
<weld::CustomWeld
> m_xPreviewWin
;
41 bool m_bPreviewBackgroundToCharacter
;
43 SvxCharBasePage(weld::Container
* pPage
, weld::DialogController
* pController
, const OUString
& rUIXMLDescription
, const OString
& rID
, const SfxItemSet
& rAttrSet
);
45 void SetPrevFontWidthScale( const SfxItemSet
& rSet
);
46 void SetPrevFontEscapement( sal_uInt8 nProp
, sal_uInt8 nEscProp
, short nEsc
);
48 inline SvxFont
& GetPreviewFont();
49 inline SvxFont
& GetPreviewCJKFont();
50 inline SvxFont
& GetPreviewCTLFont();
53 virtual ~SvxCharBasePage() override
;
55 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
58 // class SvxCharNamePage -------------------------------------------------
60 struct SvxCharNamePage_Impl
;
62 class SvxCharNamePage
: public SvxCharBasePage
65 static const sal_uInt16 pNameRanges
[];
67 std::unique_ptr
<SvxCharNamePage_Impl
> m_pImpl
;
69 std::unique_ptr
<weld::Widget
> m_xWestFrame
;
70 std::unique_ptr
<weld::Label
> m_xWestFontNameFT
;
71 std::unique_ptr
<weld::ComboBox
> m_xWestFontNameLB
;
72 std::unique_ptr
<weld::Label
> m_xWestFontStyleFT
;
73 std::unique_ptr
<SvtFontStyleBox
> m_xWestFontStyleLB
;
74 std::unique_ptr
<weld::Label
> m_xWestFontSizeFT
;
75 std::unique_ptr
<SvtFontSizeBox
> m_xWestFontSizeLB
;
76 std::unique_ptr
<weld::Label
> m_xWestFontLanguageFT
;
77 std::unique_ptr
<SvxLanguageBox
> m_xWestFontLanguageLB
;
78 std::unique_ptr
<weld::Label
> m_xWestFontTypeFT
;
79 std::unique_ptr
<weld::Button
> m_xWestFontFeaturesButton
;
81 std::unique_ptr
<weld::Widget
> m_xEastFrame
;
82 std::unique_ptr
<weld::Label
> m_xEastFontNameFT
;
83 std::unique_ptr
<weld::ComboBox
> m_xEastFontNameLB
;
84 std::unique_ptr
<weld::Label
> m_xEastFontStyleFT
;
85 std::unique_ptr
<SvtFontStyleBox
> m_xEastFontStyleLB
;
86 std::unique_ptr
<weld::Label
> m_xEastFontSizeFT
;
87 std::unique_ptr
<SvtFontSizeBox
> m_xEastFontSizeLB
;
88 std::unique_ptr
<weld::Label
> m_xEastFontLanguageFT
;
89 std::unique_ptr
<SvxLanguageBox
> m_xEastFontLanguageLB
;
90 std::unique_ptr
<weld::Label
> m_xEastFontTypeFT
;
91 std::unique_ptr
<weld::Button
> m_xEastFontFeaturesButton
;
93 std::unique_ptr
<weld::Widget
> m_xCTLFrame
;
94 std::unique_ptr
<weld::Label
> m_xCTLFontNameFT
;
95 std::unique_ptr
<weld::ComboBox
> m_xCTLFontNameLB
;
96 std::unique_ptr
<weld::Label
> m_xCTLFontStyleFT
;
97 std::unique_ptr
<SvtFontStyleBox
> m_xCTLFontStyleLB
;
98 std::unique_ptr
<weld::Label
> m_xCTLFontSizeFT
;
99 std::unique_ptr
<SvtFontSizeBox
> m_xCTLFontSizeLB
;
100 std::unique_ptr
<weld::Label
> m_xCTLFontLanguageFT
;
101 std::unique_ptr
<SvxLanguageBox
> m_xCTLFontLanguageLB
;
102 std::unique_ptr
<weld::Label
> m_xCTLFontTypeFT
;
103 std::unique_ptr
<weld::Button
> m_xCTLFontFeaturesButton
;
106 const FontList
* GetFontList() const;
107 void UpdatePreview_Impl();
108 void FillStyleBox_Impl(const weld::Widget
& rBox
);
109 void FillSizeBox_Impl(const weld::Widget
& rBox
);
113 /** Language for western text.
117 /** Language for asian text.
121 /** Language for ctl text.
126 void Reset_Impl( const SfxItemSet
& rSet
, LanguageGroup eLangGrp
);
127 bool FillItemSet_Impl( SfxItemSet
& rSet
, LanguageGroup eLangGrp
);
129 DECL_LINK(UpdateHdl_Impl
, Timer
*, void );
130 DECL_LINK(FontModifyEditHdl_Impl
, weld::Entry
&, void);
131 DECL_LINK(FontModifyComboBoxHdl_Impl
, weld::ComboBox
&, void);
132 DECL_LINK(FontFeatureButtonClicked
, weld::Button
&, void);
134 void FontModifyHdl_Impl(const weld::Widget
&);
137 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
138 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
141 SvxCharNamePage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
142 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
143 virtual ~SvxCharNamePage() override
;
145 static const sal_uInt16
* GetRanges() { return pNameRanges
; }
147 virtual void Reset( const SfxItemSet
* rSet
) override
;
148 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
149 virtual void ChangesApplied() override
;
151 void SetFontList( const SvxFontListItem
& rItem
);
152 void EnableRelativeMode();
153 void EnableSearchMode();
155 void DisableControls( sal_uInt16 nDisable
);
156 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
159 // class SvxCharEffectsPage ----------------------------------------------
161 class SvxCharEffectsPage
: public SvxCharBasePage
164 static const sal_uInt16 pEffectsRanges
[];
165 bool m_bOrigFontColor
;
166 bool m_bNewFontColor
;
167 bool m_bEnableNoneFontColor
;
168 Color m_aOrigFontColor
;
169 sal_uInt16 m_nHtmlMode
;
170 bool m_bUnderlineColorDisabled
;
172 std::unique_ptr
<weld::Label
> m_xFontColorFT
;
173 std::unique_ptr
<ColorListBox
> m_xFontColorLB
;
174 std::unique_ptr
<weld::Label
> m_xEffectsFT
;
175 std::unique_ptr
<weld::ComboBox
> m_xEffectsLB
;
176 std::unique_ptr
<weld::Label
> m_xReliefFT
;
177 std::unique_ptr
<weld::ComboBox
> m_xReliefLB
;
178 std::unique_ptr
<weld::CheckButton
> m_xOutlineBtn
;
179 std::unique_ptr
<weld::CheckButton
> m_xShadowBtn
;
180 std::unique_ptr
<weld::CheckButton
> m_xBlinkingBtn
;
181 std::unique_ptr
<weld::CheckButton
> m_xHiddenBtn
;
182 std::unique_ptr
<weld::ComboBox
> m_xOverlineLB
;
183 std::unique_ptr
<weld::Label
> m_xOverlineColorFT
;
184 std::unique_ptr
<ColorListBox
> m_xOverlineColorLB
;
185 std::unique_ptr
<weld::ComboBox
> m_xStrikeoutLB
;
186 std::unique_ptr
<weld::ComboBox
> m_xUnderlineLB
;
187 std::unique_ptr
<weld::Label
> m_xUnderlineColorFT
;
188 std::unique_ptr
<ColorListBox
> m_xUnderlineColorLB
;
189 std::unique_ptr
<weld::CheckButton
> m_xIndividualWordsBtn
;
190 std::unique_ptr
<weld::Label
> m_xEmphasisFT
;
191 std::unique_ptr
<weld::ComboBox
> m_xEmphasisLB
;
192 std::unique_ptr
<weld::Label
> m_xPositionFT
;
193 std::unique_ptr
<weld::ComboBox
> m_xPositionLB
;
194 std::unique_ptr
<weld::Label
> m_xA11yWarningFT
;
197 void UpdatePreview_Impl();
198 void SetCaseMap_Impl( SvxCaseMap eCaseMap
);
199 void ResetColor_Impl( const SfxItemSet
& rSet
);
200 bool FillItemSetColor_Impl( SfxItemSet
& rSet
);
201 Color
GetPreviewFontColor(const Color
& rColor
) const;
202 void EnableNoneFontColor();
204 void SelectHdl_Impl(const weld::ComboBox
*);
205 DECL_LINK(SelectListBoxHdl_Impl
, weld::ComboBox
&, void);
206 DECL_LINK(CbClickHdl_Impl
, weld::ToggleButton
&, void);
207 DECL_LINK(TristClickHdl_Impl
, weld::ToggleButton
&, void);
208 DECL_LINK(UpdatePreview_Impl
, weld::ComboBox
&, void);
209 DECL_LINK(ColorBoxSelectHdl_Impl
, ColorListBox
&, void);
212 SvxCharEffectsPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
213 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
214 virtual ~SvxCharEffectsPage() override
;
216 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
219 static const sal_uInt16
* GetRanges() { return pEffectsRanges
; }
221 virtual void Reset( const SfxItemSet
* rSet
) override
;
222 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
223 virtual void ChangesApplied() override
;
225 void DisableControls( sal_uInt16 nDisable
);
226 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
229 // class SvxCharPositionPage ---------------------------------------------
230 class SvxCharPositionPage
: public SvxCharBasePage
232 static const sal_uInt16 pPositionRanges
[];
238 sal_uInt16 m_nScaleWidthItemSetVal
;
239 sal_uInt16 m_nScaleWidthInitialVal
;
241 sal_uInt8 m_nSuperProp
;
242 sal_uInt8 m_nSubProp
;
244 std::unique_ptr
<weld::RadioButton
> m_xHighPosBtn
;
245 std::unique_ptr
<weld::RadioButton
> m_xNormalPosBtn
;
246 std::unique_ptr
<weld::RadioButton
> m_xLowPosBtn
;
247 std::unique_ptr
<weld::Label
> m_xHighLowFT
;
248 std::unique_ptr
<weld::MetricSpinButton
> m_xHighLowMF
;
249 std::unique_ptr
<weld::CheckButton
> m_xHighLowRB
;
250 std::unique_ptr
<weld::Label
> m_xFontSizeFT
;
251 std::unique_ptr
<weld::MetricSpinButton
> m_xFontSizeMF
;
253 std::unique_ptr
<weld::Widget
> m_xRotationContainer
;
255 std::unique_ptr
<weld::Label
> m_xScalingFT
;
256 std::unique_ptr
<weld::Label
> m_xScalingAndRotationFT
;
257 std::unique_ptr
<weld::RadioButton
> m_x0degRB
;
258 std::unique_ptr
<weld::RadioButton
> m_x90degRB
;
259 std::unique_ptr
<weld::RadioButton
> m_x270degRB
;
260 std::unique_ptr
<weld::CheckButton
> m_xFitToLineCB
;
262 std::unique_ptr
<weld::MetricSpinButton
> m_xScaleWidthMF
;
264 std::unique_ptr
<weld::MetricSpinButton
> m_xKerningMF
;
265 std::unique_ptr
<weld::CheckButton
> m_xPairKerningBtn
;
268 void UpdatePreview_Impl( sal_uInt8 nProp
, sal_uInt8 nEscProp
, short nEsc
);
269 void SetEscapement_Impl( SvxEscapement nEsc
);
271 DECL_LINK(PositionHdl_Impl
, weld::ToggleButton
&, void);
272 DECL_LINK(RotationHdl_Impl
, weld::ToggleButton
&, void);
273 DECL_LINK(AutoPositionHdl_Impl
, weld::ToggleButton
&, void);
274 DECL_LINK(FitToLineHdl_Impl
, weld::ToggleButton
&, void);
275 DECL_LINK(KerningSelectHdl_Impl
, weld::ComboBox
&, void);
276 DECL_LINK(KerningModifyHdl_Impl
, weld::MetricSpinButton
&, void);
277 DECL_LINK(ValueChangedHdl_Impl
, weld::MetricSpinButton
&, void);
278 DECL_LINK(ScaleWidthModifyHdl_Impl
, weld::MetricSpinButton
&, void);
279 void FontModifyHdl_Impl();
282 SvxCharPositionPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
283 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
284 virtual ~SvxCharPositionPage() override
;
286 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
289 static const sal_uInt16
* GetRanges() { return pPositionRanges
; }
291 virtual void Reset( const SfxItemSet
* rSet
) override
;
292 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
293 virtual void ChangesApplied() override
;
294 virtual void FillUserData() override
;
295 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
298 // class SvxCharTwoLinesPage ---------------------------------------------
300 class SvxCharTwoLinesPage
: public SvxCharBasePage
303 static const sal_uInt16 pTwoLinesRanges
[];
304 sal_uInt16 m_nStartBracketPosition
;
305 sal_uInt16 m_nEndBracketPosition
;
307 std::unique_ptr
<weld::CheckButton
> m_xTwoLinesBtn
;
308 std::unique_ptr
<weld::Widget
> m_xEnclosingFrame
;
309 std::unique_ptr
<weld::TreeView
> m_xStartBracketLB
;
310 std::unique_ptr
<weld::TreeView
> m_xEndBracketLB
;
312 void UpdatePreview_Impl();
314 void SelectCharacter(weld::TreeView
* pBox
);
315 void SetBracket(sal_Unicode cBracket
, bool bStart
);
317 DECL_LINK(TwoLinesHdl_Impl
, weld::ToggleButton
&, void);
318 DECL_LINK(CharacterMapHdl_Impl
, weld::TreeView
&, void);
321 SvxCharTwoLinesPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rSet
);
322 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
323 virtual ~SvxCharTwoLinesPage() override
;
325 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
326 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
328 static const sal_uInt16
* GetRanges() { return pTwoLinesRanges
; }
330 virtual void Reset( const SfxItemSet
* rSet
) override
;
331 virtual bool FillItemSet( SfxItemSet
* rSet
) override
;
332 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
335 #endif // INCLUDED_CUI_SOURCE_INC_CHARDLG_HXX
337 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */