dialog.hxx 17.2 KB
Newer Older
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 * 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 .
 */
19 20
#ifndef INCLUDED_STARMATH_INC_DIALOG_HXX
#define INCLUDED_STARMATH_INC_DIALOG_HXX
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
21 22

#include <sfx2/tabdlg.hxx>
23
#include <vcl/outdev.hxx>
24
#include <vcl/customweld.hxx>
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
25
#include "symbol.hxx"
26
#include <memory>
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
27

28
class SubsetMap;
29 30 31 32
class SmFormat;
class FontList;
class SvxShowCharSet;

Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
33 34 35 36
#define CATEGORY_NONE   0xFFFF

/**************************************************************************/

Noel Grandin's avatar
Noel Grandin committed
37
void SetFontStyle(const OUString &rStyleName, vcl::Font &rFont);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
38 39 40 41 42

/**************************************************************************/

class SmPrintOptionsTabPage : public SfxTabPage
{
43 44 45 46 47 48 49 50 51 52 53 54
    std::unique_ptr<weld::CheckButton>      m_xTitle;
    std::unique_ptr<weld::CheckButton>      m_xText;
    std::unique_ptr<weld::CheckButton>      m_xFrame;
    std::unique_ptr<weld::RadioButton>      m_xSizeNormal;
    std::unique_ptr<weld::RadioButton>      m_xSizeScaled;
    std::unique_ptr<weld::RadioButton>      m_xSizeZoomed;
    std::unique_ptr<weld::MetricSpinButton> m_xZoom;
    std::unique_ptr<weld::CheckButton>      m_xNoRightSpaces;
    std::unique_ptr<weld::CheckButton>      m_xSaveOnlyUsedSymbols;
    std::unique_ptr<weld::CheckButton>      m_xAutoCloseBrackets;

    DECL_LINK(SizeButtonClickHdl, weld::ToggleButton&, void);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
55

56 57
    virtual bool    FillItemSet(SfxItemSet* rSet) override;
    virtual void    Reset(const SfxItemSet* rSet) override;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
58 59

public:
60
    static VclPtr<SfxTabPage> Create(TabPageParent pWindow, const SfxItemSet &rSet);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
61

62
    SmPrintOptionsTabPage(TabPageParent pPage, const SfxItemSet &rOptions);
63
    virtual ~SmPrintOptionsTabPage() override;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
64 65 66 67
};

/**************************************************************************/

Caolán McNamara's avatar
Caolán McNamara committed
68
class SmShowFont : public weld::CustomWidgetController
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
69
{
70
    virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
71

72 73
    vcl::Font maFont;

Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
74
public:
Caolán McNamara's avatar
Caolán McNamara committed
75
    SmShowFont()
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
76 77
    {
    }
Caolán McNamara's avatar
Caolán McNamara committed
78
    virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
Noel Grandin's avatar
Noel Grandin committed
79
    void SetFont(const vcl::Font& rFont);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
80 81
};

Caolán McNamara's avatar
Caolán McNamara committed
82
class SmFontDialog : public weld::GenericDialogController
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
83
{
84
    vcl::Font maFont;
Caolán McNamara's avatar
Caolán McNamara committed
85 86 87 88 89 90
    SmShowFont m_aShowFont;
    std::unique_ptr<weld::EntryTreeView> m_xFontBox;
    std::unique_ptr<weld::Widget> m_xAttrFrame;
    std::unique_ptr<weld::CheckButton> m_xBoldCheckBox;
    std::unique_ptr<weld::CheckButton> m_xItalicCheckBox;
    std::unique_ptr<weld::CustomWeld> m_xShowFont;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
91

Caolán McNamara's avatar
Caolán McNamara committed
92 93
    DECL_LINK(FontSelectHdl, weld::ComboBox&, void);
    DECL_LINK(AttrChangeHdl, weld::ToggleButton&, void);
94

Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
95
public:
Caolán McNamara's avatar
Caolán McNamara committed
96
    SmFontDialog(weld::Window* pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes);
97
    virtual ~SmFontDialog() override;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
98

99 100 101 102 103
    const vcl::Font& GetFont() const
    {
        return maFont;
    }
    void SetFont(const vcl::Font &rFont);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
104 105 106 107
};

/**************************************************************************/

Caolán McNamara's avatar
Caolán McNamara committed
108
class SmFontSizeDialog : public weld::GenericDialogController
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
109
{
Caolán McNamara's avatar
Caolán McNamara committed
110 111 112 113 114 115 116
    std::unique_ptr<weld::MetricSpinButton> m_xBaseSize;
    std::unique_ptr<weld::MetricSpinButton> m_xTextSize;
    std::unique_ptr<weld::MetricSpinButton> m_xIndexSize;
    std::unique_ptr<weld::MetricSpinButton> m_xFunctionSize;
    std::unique_ptr<weld::MetricSpinButton> m_xOperatorSize;
    std::unique_ptr<weld::MetricSpinButton> m_xBorderSize;
    std::unique_ptr<weld::Button> m_xDefaultButton;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
117

Caolán McNamara's avatar
Caolán McNamara committed
118
    DECL_LINK(DefaultButtonClickHdl, weld::Button&, void);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
119 120

public:
Caolán McNamara's avatar
Caolán McNamara committed
121
    SmFontSizeDialog(weld::Window *pParent);
122
    virtual ~SmFontSizeDialog() override;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
123 124 125 126 127 128 129

    void ReadFrom(const SmFormat &rFormat);
    void WriteTo (SmFormat &rFormat) const;
};

/**************************************************************************/

Caolán McNamara's avatar
Caolán McNamara committed
130
class SmFontTypeDialog : public weld::GenericDialogController
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
131
{
132
    VclPtr<OutputDevice> pFontListDev;
133

Caolán McNamara's avatar
Caolán McNamara committed
134 135 136 137 138 139 140 141 142 143 144 145
    std::unique_ptr<SmFontPickListBox> m_xVariableFont;
    std::unique_ptr<SmFontPickListBox> m_xFunctionFont;
    std::unique_ptr<SmFontPickListBox> m_xNumberFont;
    std::unique_ptr<SmFontPickListBox> m_xTextFont;
    std::unique_ptr<SmFontPickListBox> m_xSerifFont;
    std::unique_ptr<SmFontPickListBox> m_xSansFont;
    std::unique_ptr<SmFontPickListBox> m_xFixedFont;
    std::unique_ptr<weld::MenuButton> m_xMenuButton;
    std::unique_ptr<weld::Button> m_xDefaultButton;

    DECL_LINK(MenuSelectHdl, const OString&, void);
    DECL_LINK(DefaultButtonClickHdl, weld::Button&, void);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
146 147

public:
Caolán McNamara's avatar
Caolán McNamara committed
148
    SmFontTypeDialog(weld::Window* pParent, OutputDevice *pFntListDevice);
149
    virtual ~SmFontTypeDialog() override;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
150 151 152 153 154 155 156 157 158

    void ReadFrom(const SmFormat &rFormat);
    void WriteTo (SmFormat &rFormat) const;
};

/**************************************************************************/

#define NOCATEGORIES    10

159
class SmCategoryDesc
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
160
{
161
    OUString Name;
162
    OUString Strings[4];
Caolán McNamara's avatar
Caolán McNamara committed
163
    std::unique_ptr<weld::Widget> Graphics[4];    /* regular bitmaps */
164 165 166
    sal_uInt16 Minimum[4];
    sal_uInt16 Maximum[4];
    sal_uInt16 Value[4];
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
167 168

public:
Caolán McNamara's avatar
Caolán McNamara committed
169
    SmCategoryDesc(weld::Builder& rBuilder, sal_uInt16 nCategoryIdx);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
170 171
    ~SmCategoryDesc();

172
    const OUString& GetName() const                 { return Name; }
173
    const OUString& GetString(sal_uInt16 Index) const   { return Strings[Index];  }
174 175 176 177
    sal_uInt16          GetMinimum(sal_uInt16 Index)        { return Minimum[Index]; }
    sal_uInt16          GetMaximum(sal_uInt16 Index)        { return Maximum[Index]; }
    sal_uInt16          GetValue(sal_uInt16 Index) const    { return Value[Index]; }
    void            SetValue(sal_uInt16 Index, sal_uInt16 nVal) { Value[Index] = nVal;}
178

Caolán McNamara's avatar
Caolán McNamara committed
179
    weld::Widget* GetGraphic(sal_uInt16 Index) const
180
    {
181
        return Graphics[Index].get();
182
    }
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
183 184
};

Caolán McNamara's avatar
Caolán McNamara committed
185
class SmDistanceDialog : public weld::GenericDialogController
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
186
{
Caolán McNamara's avatar
Caolán McNamara committed
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
    std::unique_ptr<weld::Frame> m_xFrame;
    std::unique_ptr<weld::Label> m_xFixedText1;
    std::unique_ptr<weld::MetricSpinButton>    m_xMetricField1;
    std::unique_ptr<weld::Label> m_xFixedText2;
    std::unique_ptr<weld::MetricSpinButton>    m_xMetricField2;
    std::unique_ptr<weld::Label> m_xFixedText3;
    std::unique_ptr<weld::MetricSpinButton>    m_xMetricField3;
    std::unique_ptr<weld::CheckButton> m_xCheckBox1;
    std::unique_ptr<weld::Label> m_xFixedText4;
    std::unique_ptr<weld::MetricSpinButton> m_xMetricField4;
    std::unique_ptr<weld::MenuButton> m_xMenuButton;
    std::unique_ptr<weld::Button> m_xDefaultButton;
    std::unique_ptr<weld::Widget> m_xBitmap;

    weld::Widget* m_pCurrentImage;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
202

203
    std::unique_ptr<SmCategoryDesc> m_xCategories[NOCATEGORIES];
204
    sal_uInt16          nActiveCategory;
205
    bool            bScaleAllBrackets;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
206

Caolán McNamara's avatar
Caolán McNamara committed
207 208 209 210
    DECL_LINK(GetFocusHdl, weld::Widget&, void);
    DECL_LINK(MenuSelectHdl, const OString&, void);
    DECL_LINK(DefaultButtonClickHdl, weld::Button&, void);
    DECL_LINK(CheckBoxClickHdl, weld::ToggleButton&, void);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
211

212
    void    SetCategory(sal_uInt16 Category);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
213 214

public:
Caolán McNamara's avatar
Caolán McNamara committed
215
    SmDistanceDialog(weld::Window *pParent);
216
    virtual ~SmDistanceDialog() override;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
217 218

    void ReadFrom(const SmFormat &rFormat);
219
    void WriteTo (SmFormat &rFormat);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
220 221 222 223 224
};

/**************************************************************************/


Caolán McNamara's avatar
Caolán McNamara committed
225
class SmAlignDialog : public weld::GenericDialogController
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
226
{
Caolán McNamara's avatar
Caolán McNamara committed
227 228 229 230
    std::unique_ptr<weld::RadioButton> m_xLeft;
    std::unique_ptr<weld::RadioButton> m_xCenter;
    std::unique_ptr<weld::RadioButton> m_xRight;
    std::unique_ptr<weld::Button> m_xDefaultButton;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
231

Caolán McNamara's avatar
Caolán McNamara committed
232
    DECL_LINK(DefaultButtonClickHdl, weld::Button&, void);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
233 234

public:
Caolán McNamara's avatar
Caolán McNamara committed
235
    SmAlignDialog(weld::Window *pParent);
236
    virtual ~SmAlignDialog() override;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
237 238 239 240 241 242 243

    void ReadFrom(const SmFormat &rFormat);
    void WriteTo (SmFormat &rFormat) const;
};

/**************************************************************************/

244
class SmShowSymbolSet : public weld::CustomWidgetController
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
245
{
Caolán McNamara's avatar
Caolán McNamara committed
246
    Size m_aOldSize;
247
    SymbolPtrVec_t aSymbolSet;
Caolán McNamara's avatar
Caolán McNamara committed
248 249
    Link<SmShowSymbolSet&,void> aSelectHdlLink;
    Link<SmShowSymbolSet&,void> aDblClickHdlLink;
250 251 252
    long        nLen;
    long        nRows, nColumns;
    long        nXOffset, nYOffset;
253
    sal_uInt16  nSelectSymbol;
Caolán McNamara's avatar
Caolán McNamara committed
254
    std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
255 256 257

    void SetScrollBarRange();
    Point OffsetPoint(const Point &rPoint) const;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
258

259
    virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
Caolán McNamara's avatar
Caolán McNamara committed
260
    virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
261
    virtual bool KeyInput(const KeyEvent& rKEvt) override;
262
    virtual void Resize() override;
263

Caolán McNamara's avatar
Caolán McNamara committed
264
    DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
265 266

public:
267
    SmShowSymbolSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow);
268 269 270

    virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
    {
271
        CustomWidgetController::SetDrawingArea(pDrawingArea);
272 273 274 275 276
        m_aOldSize = Size(pDrawingArea->get_approximate_digit_width() * 27,
                          pDrawingArea->get_text_height() * 9);
        pDrawingArea->set_size_request(m_aOldSize.Width(), m_aOldSize.Height());
        SetOutputSizePixel(m_aOldSize);
        calccols(pDrawingArea->get_ref_device());
277 278
    }

279
    void calccols(const vcl::RenderContext& rRenderContext);
280 281
    void    SelectSymbol(sal_uInt16 nSymbol);
    sal_uInt16  GetSelectSymbol() const { return nSelectSymbol; }
282
    void SetSymbolSet(const SymbolPtrVec_t& rSymbolSet);
Caolán McNamara's avatar
Caolán McNamara committed
283 284
    void SetSelectHdl(const Link<SmShowSymbolSet&,void>& rLink) { aSelectHdlLink = rLink; }
    void SetDblClickHdl(const Link<SmShowSymbolSet&,void>& rLink) { aDblClickHdlLink = rLink; }
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
285 286
};

287
class SmShowSymbol : public weld::CustomWidgetController
288
{
Caolán McNamara's avatar
Caolán McNamara committed
289 290 291
private:
    vcl::Font m_aFont;
    OUString m_aText;
292

Noel Grandin's avatar
Noel Grandin committed
293
    Link<SmShowSymbol&,void> aDblClickHdlLink;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
294

295
    virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
Caolán McNamara's avatar
Caolán McNamara committed
296
    virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
297

Noel Grandin's avatar
Noel Grandin committed
298
    void setFontSize(vcl::Font &rFont) const;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
299 300

public:
301 302 303 304
    SmShowSymbol();

    virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
    {
305
        CustomWidgetController::SetDrawingArea(pDrawingArea);
306 307 308
        pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 27,
                                       pDrawingArea->get_text_height() * 9);
    }
Caolán McNamara's avatar
Caolán McNamara committed
309 310 311 312 313 314

    void SetText(const OUString& rText) { m_aText = rText; }
    const OUString& GetText() const { return m_aText; }

    void SetFont(const vcl::Font& rFont) { m_aFont = rFont; }
    const vcl::Font& GetFont() const { return m_aFont; }
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
315 316

    void    SetSymbol(const SmSym *pSymbol);
Noel Grandin's avatar
Noel Grandin committed
317
    void    SetDblClickHdl(const Link<SmShowSymbol&,void> &rLink) { aDblClickHdlLink = rLink; }
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
318 319
};

Caolán McNamara's avatar
Caolán McNamara committed
320
class SmSymbolDialog : public weld::GenericDialogController
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
321
{
322
    SmViewShell        &rViewSh;
323 324
    SmSymbolManager    &rSymbolMgr;

325
    OUString       aSymbolSetName;
326
    SymbolPtrVec_t      aSymbolSet;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
327

328
    VclPtr<OutputDevice> pFontListDev;
329

330 331
    SmShowSymbol m_aSymbolDisplay;

332
    std::unique_ptr<weld::ComboBox> m_xSymbolSets;
Caolán McNamara's avatar
Caolán McNamara committed
333
    std::unique_ptr<SmShowSymbolSet> m_xSymbolSetDisplay;
334
    std::unique_ptr<weld::CustomWeld> m_xSymbolSetDisplayArea;
Caolán McNamara's avatar
Caolán McNamara committed
335
    std::unique_ptr<weld::Label> m_xSymbolName;
336
    std::unique_ptr<weld::CustomWeld> m_xSymbolDisplay;
Caolán McNamara's avatar
Caolán McNamara committed
337 338 339
    std::unique_ptr<weld::Button> m_xGetBtn;
    std::unique_ptr<weld::Button> m_xEditBtn;

340
    DECL_LINK(SymbolSetChangeHdl, weld::ComboBox&, void);
Caolán McNamara's avatar
Caolán McNamara committed
341
    DECL_LINK(SymbolChangeHdl, SmShowSymbolSet&, void);
342
    DECL_LINK(SymbolDblClickHdl, SmShowSymbol&, void);
Caolán McNamara's avatar
Caolán McNamara committed
343 344 345
    DECL_LINK(SymbolDblClickHdl2, SmShowSymbolSet&, void);
    DECL_LINK(EditClickHdl, weld::Button&, void);
    DECL_LINK(GetClickHdl, weld::Button&, void);
Noel Grandin's avatar
Noel Grandin committed
346
    void SymbolDblClickHdl();
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
347

348
    void            FillSymbolSets();
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
349
    const SmSym    *GetSymbol() const;
350

Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
351
public:
Caolán McNamara's avatar
Caolán McNamara committed
352
    SmSymbolDialog(weld::Window* pParent, OutputDevice *pFntListDevice,
353
            SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell);
354
    virtual ~SmSymbolDialog() override;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
355

Caolán McNamara's avatar
Caolán McNamara committed
356
    bool    SelectSymbolSet(const OUString &rSymbolSetName);
357
    void    SelectSymbol(sal_uInt16 nSymbolPos);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
358 359
};

360
class SmShowChar : public weld::CustomWidgetController
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
361
{
362 363 364 365
private:
    OUString m_aText;
    vcl::Font m_aFont;

366 367
    virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
    virtual void Resize() override;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
368 369

public:
370
    SmShowChar()
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
371
    {
372 373 374 375
    }

    virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
    {
376
        CustomWidgetController::SetDrawingArea(pDrawingArea);
377 378
        pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 7,
                                       pDrawingArea->get_text_height() * 3);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
379 380
    }

381 382 383 384 385 386 387
    void SetSymbol(const SmSym *pSym);
    void SetSymbol(sal_UCS4 cChar, const vcl::Font &rFont);
    void SetText(const OUString& rText) { m_aText = rText; }
    const OUString& GetText() const { return m_aText; }
    void SetFont(const vcl::Font& rFont) { m_aFont = rFont; }
    const vcl::Font& GetFont() const { return m_aFont; }
};
388

389
class SmSymDefineDialog : public weld::GenericDialogController
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
390
{
391 392 393
    VclPtr<VirtualDevice> m_xVirDev;
    SmSymbolManager m_aSymbolMgrCopy;
    SmSymbolManager& m_rSymbolMgr;
394 395
    SmShowChar m_aOldSymbolDisplay;
    SmShowChar m_aSymbolDisplay;
396 397 398
    std::unique_ptr<SmSym> m_xOrigSymbol;
    std::unique_ptr<SubsetMap> m_xSubsetMap;
    std::unique_ptr<FontList> m_xFontList;
399 400 401 402 403 404 405
    std::unique_ptr<weld::ComboBox> m_xOldSymbols;
    std::unique_ptr<weld::ComboBox> m_xOldSymbolSets;
    std::unique_ptr<weld::ComboBox> m_xSymbols;
    std::unique_ptr<weld::ComboBox> m_xSymbolSets;
    std::unique_ptr<weld::ComboBox> m_xFonts;
    std::unique_ptr<weld::ComboBox> m_xFontsSubsetLB;
    std::unique_ptr<weld::ComboBox> m_xStyles;
406 407 408 409 410 411 412
    std::unique_ptr<weld::Label> m_xOldSymbolName;
    std::unique_ptr<weld::Label> m_xOldSymbolSetName;
    std::unique_ptr<weld::Label> m_xSymbolName;
    std::unique_ptr<weld::Label> m_xSymbolSetName;
    std::unique_ptr<weld::Button> m_xAddBtn;
    std::unique_ptr<weld::Button> m_xChangeBtn;
    std::unique_ptr<weld::Button> m_xDeleteBtn;
413 414
    std::unique_ptr<weld::CustomWeld> m_xOldSymbolDisplay;
    std::unique_ptr<weld::CustomWeld> m_xSymbolDisplay;
415
    std::unique_ptr<SvxShowCharSet>  m_xCharsetDisplay;
416
    std::unique_ptr<weld::CustomWeld>  m_xCharsetDisplayArea;
417

418 419 420 421 422 423
    DECL_LINK(OldSymbolChangeHdl, weld::ComboBox&, void);
    DECL_LINK(OldSymbolSetChangeHdl, weld::ComboBox&, void);
    DECL_LINK(ModifyHdl, weld::ComboBox&, void);
    DECL_LINK(FontChangeHdl, weld::ComboBox&, void);
    DECL_LINK(SubsetChangeHdl, weld::ComboBox&, void);
    DECL_LINK(StyleChangeHdl, weld::ComboBox&, void);
424
    DECL_LINK(CharHighlightHdl, SvxShowCharSet*, void);
425 426 427
    DECL_LINK(AddClickHdl, weld::Button&, void);
    DECL_LINK(ChangeClickHdl, weld::Button&, void);
    DECL_LINK(DeleteClickHdl, weld::Button&, void);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
428

429 430
    void    FillSymbols(weld::ComboBox& rComboBox, bool bDeleteText = true);
    void    FillSymbolSets(weld::ComboBox& rComboBox, bool bDeleteText = true);
431 432
    void    FillFonts();
    void    FillStyles();
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
433

434
    void    SetSymbolSetManager(const SmSymbolManager &rMgr);
Caolán McNamara's avatar
Caolán McNamara committed
435 436
    void    SetFont(const OUString &rFontName, const OUString &rStyleName);
    void    SetOrigSymbol(const SmSym *pSymbol, const OUString &rSymbolSetName);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
437 438
    void    UpdateButtons();

439
    bool    SelectSymbolSet(weld::ComboBox &rComboBox, const OUString &rSymbolSetName,
440
                            bool bDeleteText);
441
    bool    SelectSymbol(weld::ComboBox& rComboBox, const OUString &rSymbolName,
442
                            bool bDeleteText);
Caolán McNamara's avatar
Caolán McNamara committed
443 444
    bool    SelectFont(const OUString &rFontName, bool bApplyFont);
    bool    SelectStyle(const OUString &rStyleName, bool bApplyFont);
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
445

446 447
    SmSym* GetSymbol(const weld::ComboBox& rComboBox);
    const SmSym* GetSymbol(const weld::ComboBox& rComboBox) const
448
    {
449
        return const_cast<SmSymDefineDialog *>(this)->GetSymbol(rComboBox);
450
    }
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
451 452

public:
453
    SmSymDefineDialog(weld::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr);
454
    virtual ~SmSymDefineDialog() override;
455

456
    virtual short run() override;
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
457

458
    void SelectOldSymbolSet(const OUString &rSymbolSetName)
459
    {
460
        SelectSymbolSet(*m_xOldSymbolSets, rSymbolSetName, false);
461
    }
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
462

463
    void SelectOldSymbol(const OUString &rSymbolName)
464
    {
465
        SelectSymbol(*m_xOldSymbols, rSymbolName, false);
466
    }
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
467

Caolán McNamara's avatar
Caolán McNamara committed
468
    bool SelectSymbolSet(const OUString &rSymbolSetName)
469
    {
470
        return SelectSymbolSet(*m_xSymbolSets, rSymbolSetName, false);
471
    }
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
472

Caolán McNamara's avatar
Caolán McNamara committed
473
    bool SelectSymbol(const OUString &rSymbolName)
474
    {
475
        return SelectSymbol(*m_xSymbols, rSymbolName, false);
476
    }
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
477

Caolán McNamara's avatar
Caolán McNamara committed
478 479
    bool        SelectFont(const OUString &rFontName)   { return SelectFont(rFontName, true); }
    bool        SelectStyle(const OUString &rStyleName) { return SelectStyle(rStyleName, true); };
480
    void        SelectChar(sal_Unicode cChar);
481
};
Jens-Heiner Rechtien's avatar
Jens-Heiner Rechtien committed
482 483 484 485


#endif

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