summaryrefslogtreecommitdiff
path: root/cui/source/inc/chardlg.hxx
blob: 965924b5c3fb336adfeb73438312c58e2bad9207 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#ifndef INCLUDED_CUI_SOURCE_INC_CHARDLG_HXX
#define INCLUDED_CUI_SOURCE_INC_CHARDLG_HXX

#include <svtools/ctrlbox.hxx>
#include <sfx2/tabdlg.hxx>
#include <svx/fntctrl.hxx>
#include <svx/checklbx.hxx>
#include <svx/colorbox.hxx>
#include <svx/langbox.hxx>
#include <vcl/weld.hxx>
#include <memory>

// forward ---------------------------------------------------------------

class SvxFontListItem;
class FontList;

class SvxCharBasePage : public SfxTabPage
{
protected:
    FontPrevWindow   m_aPreviewWin;
    std::unique_ptr<weld::CustomWeld> m_xPreviewWin;

    bool                m_bPreviewBackgroundToCharacter;

    SvxCharBasePage(TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet& rAttrSet);

    void SetPrevFontWidthScale( const SfxItemSet& rSet );
    void SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );

    inline SvxFont&     GetPreviewFont();
    inline SvxFont&     GetPreviewCJKFont();
    inline SvxFont&     GetPreviewCTLFont();

public:
    virtual ~SvxCharBasePage() override;

    using SfxTabPage::ActivatePage;
    using SfxTabPage::DeactivatePage;

    virtual void        ActivatePage( const SfxItemSet& rSet ) override;

};

// class SvxCharNamePage -------------------------------------------------

struct SvxCharNamePage_Impl;

class SvxCharNamePage : public SvxCharBasePage
{
    friend class VclPtr<SvxCharNamePage>;

private:
    static const sal_uInt16 pNameRanges[];

    std::unique_ptr<SvxCharNamePage_Impl>   m_pImpl;

    std::unique_ptr<weld::Widget> m_xWestFrame;
    std::unique_ptr<weld::Label> m_xWestFontNameFT;
    std::unique_ptr<weld::ComboBox> m_xWestFontNameLB;
    std::unique_ptr<weld::Label> m_xWestFontStyleFT;
    std::unique_ptr<SvtFontStyleBox> m_xWestFontStyleLB;
    std::unique_ptr<weld::Label> m_xWestFontSizeFT;
    std::unique_ptr<SvtFontSizeBox> m_xWestFontSizeLB;
    std::unique_ptr<weld::Label> m_xWestFontLanguageFT;
    std::unique_ptr<LanguageBox> m_xWestFontLanguageLB;
    std::unique_ptr<weld::Label> m_xWestFontTypeFT;
    std::unique_ptr<weld::Button> m_xWestFontFeaturesButton;

    std::unique_ptr<weld::Widget> m_xEastFrame;
    std::unique_ptr<weld::Label> m_xEastFontNameFT;
    std::unique_ptr<weld::ComboBox> m_xEastFontNameLB;
    std::unique_ptr<weld::Label> m_xEastFontStyleFT;
    std::unique_ptr<SvtFontStyleBox> m_xEastFontStyleLB;
    std::unique_ptr<weld::Label> m_xEastFontSizeFT;
    std::unique_ptr<SvtFontSizeBox> m_xEastFontSizeLB;
    std::unique_ptr<weld::Label> m_xEastFontLanguageFT;
    std::unique_ptr<LanguageBox> m_xEastFontLanguageLB;
    std::unique_ptr<weld::Label> m_xEastFontTypeFT;
    std::unique_ptr<weld::Button> m_xEastFontFeaturesButton;

    std::unique_ptr<weld::Widget> m_xCTLFrame;
    std::unique_ptr<weld::Label> m_xCTLFontNameFT;
    std::unique_ptr<weld::ComboBox> m_xCTLFontNameLB;
    std::unique_ptr<weld::Label> m_xCTLFontStyleFT;
    std::unique_ptr<SvtFontStyleBox> m_xCTLFontStyleLB;
    std::unique_ptr<weld::Label> m_xCTLFontSizeFT;
    std::unique_ptr<SvtFontSizeBox> m_xCTLFontSizeLB;
    std::unique_ptr<weld::Label> m_xCTLFontLanguageFT;
    std::unique_ptr<LanguageBox> m_xCTLFontLanguageLB;
    std::unique_ptr<weld::Label> m_xCTLFontTypeFT;
    std::unique_ptr<weld::Button> m_xCTLFontFeaturesButton;

    SvxCharNamePage(TabPageParent pParent, const SfxItemSet& rSet);

    void                Initialize();
    const FontList*     GetFontList() const;
    void                UpdatePreview_Impl();
    void                FillStyleBox_Impl(const weld::Widget& rBox);
    void                FillSizeBox_Impl(const weld::Widget& rBox);

    enum LanguageGroup
    {
        /** Language for western text.
         */
        Western = 0,

        /** Language for asian text.
         */
        Asian,

        /** Language for ctl text.
         */
        Ctl
    };

    void                Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp );
    bool                FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp );

    DECL_LINK(UpdateHdl_Impl, Timer *, void );
    DECL_LINK(FontModifyEditHdl_Impl, weld::Entry&, void);
    DECL_LINK(FontModifyComboBoxHdl_Impl, weld::ComboBox&, void);
    DECL_LINK(FontFeatureButtonClicked, weld::Button&, void);

    void FontModifyHdl_Impl(const weld::Widget&);

public:
    using SfxTabPage::ActivatePage;
    using SfxTabPage::DeactivatePage;

    virtual void        ActivatePage( const SfxItemSet& rSet ) override;
    virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;

public:
                        virtual ~SvxCharNamePage() override;
    virtual void        dispose() override;

    static VclPtr<SfxTabPage>  Create( TabPageParent pParent, const SfxItemSet* rSet );
    static const sal_uInt16* GetRanges() { return pNameRanges; }

    virtual void        Reset( const SfxItemSet* rSet ) override;
    virtual bool        FillItemSet( SfxItemSet* rSet ) override;
    virtual void        ChangesApplied() override;

    void                SetFontList( const SvxFontListItem& rItem );
    void                EnableRelativeMode();
    void                EnableSearchMode();

    void                DisableControls( sal_uInt16 nDisable );
    virtual void        PageCreated(const SfxAllItemSet& aSet) override;
};

// class SvxCharEffectsPage ----------------------------------------------

class SvxCharEffectsPage : public SvxCharBasePage
{
    friend class VclPtr<SvxCharEffectsPage>;

private:
    static const sal_uInt16 pEffectsRanges[];
    bool                       m_bOrigFontColor;
    bool                       m_bNewFontColor;
    bool                       m_bEnableNoneFontColor;
    Color                      m_aOrigFontColor;
    sal_uInt16                 m_nHtmlMode;
    bool                       m_bUnderlineColorDisabled;

    std::unique_ptr<weld::Label> m_xFontColorFT;
    std::unique_ptr<ColorListBox> m_xFontColorLB;
    std::unique_ptr<weld::Label> m_xEffectsFT;
    std::unique_ptr<weld::ComboBox> m_xEffectsLB;
    std::unique_ptr<weld::Label> m_xReliefFT;
    std::unique_ptr<weld::ComboBox> m_xReliefLB;
    std::unique_ptr<weld::CheckButton> m_xOutlineBtn;
    std::unique_ptr<weld::CheckButton> m_xShadowBtn;
    std::unique_ptr<weld::CheckButton> m_xBlinkingBtn;
    std::unique_ptr<weld::CheckButton> m_xHiddenBtn;
    std::unique_ptr<weld::ComboBox> m_xOverlineLB;
    std::unique_ptr<weld::Label> m_xOverlineColorFT;
    std::unique_ptr<ColorListBox> m_xOverlineColorLB;
    std::unique_ptr<weld::ComboBox> m_xStrikeoutLB;
    std::unique_ptr<weld::ComboBox> m_xUnderlineLB;
    std::unique_ptr<weld::Label> m_xUnderlineColorFT;
    std::unique_ptr<ColorListBox> m_xUnderlineColorLB;
    std::unique_ptr<weld::CheckButton> m_xIndividualWordsBtn;
    std::unique_ptr<weld::Label> m_xEmphasisFT;
    std::unique_ptr<weld::ComboBox> m_xEmphasisLB;
    std::unique_ptr<weld::Label> m_xPositionFT;
    std::unique_ptr<weld::ComboBox> m_xPositionLB;
    std::unique_ptr<weld::Label> m_xA11yWarningFT;

    SvxCharEffectsPage(TabPageParent pParent, const SfxItemSet& rSet);

    void                Initialize();
    void                UpdatePreview_Impl();
    void                SetCaseMap_Impl( SvxCaseMap eCaseMap );
    void                ResetColor_Impl( const SfxItemSet& rSet );
    bool                FillItemSetColor_Impl( SfxItemSet& rSet );
    Color               GetPreviewFontColor(const Color& rColor) const;
    void                EnableNoneFontColor();

    void SelectHdl_Impl(const weld::ComboBox*);
    DECL_LINK(SelectListBoxHdl_Impl, weld::ComboBox&, void);
    DECL_LINK(CbClickHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(TristClickHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(UpdatePreview_Impl, weld::ComboBox&, void);
    DECL_LINK(ColorBoxSelectHdl_Impl, ColorListBox&, void);

public:
    virtual ~SvxCharEffectsPage() override;
    virtual void dispose() override;

    using SfxTabPage::DeactivatePage;
    virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;

public:
    static VclPtr<SfxTabPage>  Create( TabPageParent pParent, const SfxItemSet* rSet );
    static const sal_uInt16* GetRanges() { return pEffectsRanges; }

    virtual void        Reset( const SfxItemSet* rSet ) override;
    virtual bool        FillItemSet( SfxItemSet* rSet ) override;
    virtual void        ChangesApplied() override;

    void                DisableControls( sal_uInt16 nDisable );
    virtual void        PageCreated(const SfxAllItemSet& aSet) override;
};

// class SvxCharPositionPage ---------------------------------------------


class SvxCharPositionPage : public SvxCharBasePage
{
    friend class VclPtr<SvxCharPositionPage>;
    static const sal_uInt16 pPositionRanges[];

private:
    short               m_nSuperEsc;
    short               m_nSubEsc;

    sal_uInt16              m_nScaleWidthItemSetVal;
    sal_uInt16              m_nScaleWidthInitialVal;

    sal_uInt8                m_nSuperProp;
    sal_uInt8                m_nSubProp;

    std::unique_ptr<weld::RadioButton> m_xHighPosBtn;
    std::unique_ptr<weld::RadioButton> m_xNormalPosBtn;
    std::unique_ptr<weld::RadioButton> m_xLowPosBtn;
    std::unique_ptr<weld::Label> m_xHighLowFT;
    std::unique_ptr<weld::MetricSpinButton> m_xHighLowMF;
    std::unique_ptr<weld::CheckButton> m_xHighLowRB;
    std::unique_ptr<weld::Label> m_xFontSizeFT;
    std::unique_ptr<weld::MetricSpinButton> m_xFontSizeMF;

    std::unique_ptr<weld::Widget> m_xRotationContainer;

    std::unique_ptr<weld::Label> m_xScalingFT;
    std::unique_ptr<weld::Label> m_xScalingAndRotationFT;
    std::unique_ptr<weld::RadioButton> m_x0degRB;
    std::unique_ptr<weld::RadioButton> m_x90degRB;
    std::unique_ptr<weld::RadioButton> m_x270degRB;
    std::unique_ptr<weld::CheckButton> m_xFitToLineCB;

    std::unique_ptr<weld::MetricSpinButton> m_xScaleWidthMF;

    std::unique_ptr<weld::MetricSpinButton> m_xKerningMF;
    std::unique_ptr<weld::CheckButton> m_xPairKerningBtn;

                        SvxCharPositionPage(TabPageParent pParent, const SfxItemSet& rSet);

    void                Initialize();
    void                UpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
    void                SetEscapement_Impl( SvxEscapement nEsc );

    DECL_LINK(PositionHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(RotationHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(AutoPositionHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(FitToLineHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(KerningSelectHdl_Impl, weld::ComboBox&, void);
    DECL_LINK(KerningModifyHdl_Impl, weld::MetricSpinButton&, void);
    DECL_LINK(ValueChangedHdl_Impl, weld::MetricSpinButton&, void);
    DECL_LINK(ScaleWidthModifyHdl_Impl, weld::MetricSpinButton&, void);
    void FontModifyHdl_Impl();

public:
    virtual ~SvxCharPositionPage() override;

    using SfxTabPage::DeactivatePage;

    virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;

public:
    static VclPtr<SfxTabPage>  Create( TabPageParent pParent, const SfxItemSet* rSet );
    static const sal_uInt16*      GetRanges() { return pPositionRanges; }

    virtual void        Reset( const SfxItemSet* rSet ) override;
    virtual bool        FillItemSet( SfxItemSet* rSet ) override;
    virtual void        ChangesApplied() override;
    virtual void        FillUserData() override;
    virtual void        PageCreated(const SfxAllItemSet& aSet) override;
};

// class SvxCharTwoLinesPage ---------------------------------------------

class SvxCharTwoLinesPage : public SvxCharBasePage
{
    friend class VclPtr<SvxCharTwoLinesPage>;
private:
    static const sal_uInt16 pTwoLinesRanges[];
    sal_uInt16              m_nStartBracketPosition;
    sal_uInt16              m_nEndBracketPosition;

    std::unique_ptr<weld::CheckButton>  m_xTwoLinesBtn;
    std::unique_ptr<weld::Widget> m_xEnclosingFrame;
    std::unique_ptr<weld::TreeView> m_xStartBracketLB;
    std::unique_ptr<weld::TreeView> m_xEndBracketLB;

    SvxCharTwoLinesPage(TabPageParent pParent, const SfxItemSet& rSet);

    void                UpdatePreview_Impl();
    void                Initialize();
    void                SelectCharacter(weld::TreeView* pBox);
    void                SetBracket(sal_Unicode cBracket, bool bStart);

    DECL_LINK(TwoLinesHdl_Impl, weld::ToggleButton&, void);
    DECL_LINK(CharacterMapHdl_Impl, weld::TreeView&, void);

public:
    virtual ~SvxCharTwoLinesPage() override;

    using SfxTabPage::ActivatePage;
    using SfxTabPage::DeactivatePage;

    virtual void        ActivatePage( const SfxItemSet& rSet ) override;
    virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;

    static VclPtr<SfxTabPage>  Create( TabPageParent pParent, const SfxItemSet* rSet );
    static const sal_uInt16*  GetRanges() { return pTwoLinesRanges; }

    virtual void        Reset( const SfxItemSet* rSet ) override;
    virtual bool        FillItemSet( SfxItemSet* rSet ) override;
    virtual void        PageCreated(const SfxAllItemSet& aSet) override;
};

#endif // INCLUDED_CUI_SOURCE_INC_CHARDLG_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */