LibreOffice Module starmath (master) 1
dialog.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <sal/config.h>
21#include <sal/log.hxx>
22
23#include <comphelper/string.hxx>
24#include <o3tl/temporary.hxx>
25#include <svl/eitem.hxx>
26#include <svl/intitem.hxx>
27#include <svl/stritem.hxx>
28#include <vcl/event.hxx>
29#include <vcl/svapp.hxx>
30#include <vcl/virdev.hxx>
31#include <vcl/weld.hxx>
32#include <svtools/ctrltool.hxx>
33#include <vcl/settings.hxx>
34#include <vcl/wall.hxx>
35#include <vcl/fontcharmap.hxx>
36#include <sfx2/dispatch.hxx>
37#include <svx/charmap.hxx>
38#include <svx/ucsubset.hxx>
39
40#include <dialog.hxx>
41#include <starmath.hrc>
42#include <strings.hrc>
43#include <helpids.h>
44#include <cfgitem.hxx>
45#include <smmod.hxx>
46#include <symbol.hxx>
47#include <view.hxx>
48
49#include <algorithm>
50
51namespace
52{
53
54void lclGetSettingColors(Color& rBackgroundColor, Color& rTextColor)
55{
57 if (rStyleSettings.GetHighContrastMode())
58 {
59 rBackgroundColor = rStyleSettings.GetFieldColor();
60 rTextColor = rStyleSettings.GetFieldTextColor();
61 }
62 else
63 {
64 rBackgroundColor = rStyleSettings.GetFaceColor();
65 rTextColor = rStyleSettings.GetLabelTextColor();
66 }
67}
68
69// Since it's better to set/query the FontStyle via its attributes rather
70// than via the StyleName we create a way to translate
71// Attribute <-> StyleName
72
73class SmFontStyles
74{
75 OUString aNormal;
76 OUString aBold;
77 OUString aItalic;
78 OUString aBoldItalic;
79
80public:
81 SmFontStyles();
82
83 static sal_uInt16 GetCount() { return 4; }
84 const OUString& GetStyleName(const vcl::Font& rFont) const;
85 const OUString& GetStyleName(sal_uInt16 nIdx) const;
86};
87
88} // end anonymous namespace
89
90SmFontStyles::SmFontStyles()
91 : aNormal(SmResId(RID_FONTREGULAR))
92 , aBold(SmResId(RID_FONTBOLD))
93 , aItalic(SmResId(RID_FONTITALIC))
94{
95 aBoldItalic = aBold;
96 aBoldItalic += ", ";
97 aBoldItalic += aItalic;
98}
99
100const OUString& SmFontStyles::GetStyleName(const vcl::Font& rFont) const
101{
103 bool bBold = IsBold( rFont ),
104 bItalic = IsItalic( rFont );
105
106 if (bBold && bItalic)
107 return aBoldItalic;
108 else if (bItalic)
109 return aItalic;
110 else if (bBold)
111 return aBold;
112 return aNormal;
113}
114
115const OUString& SmFontStyles::GetStyleName( sal_uInt16 nIdx ) const
116{
117 // 0 = "normal", 1 = "italic",
118 // 2 = "bold", 3 = "bold italic"
119
120 assert( nIdx < GetCount() );
121 switch (nIdx)
122 {
123 case 0 : return aNormal;
124 case 1 : return aItalic;
125 case 2 : return aBold;
126 default: /*case 3:*/ return aBoldItalic;
127 }
128}
129
130static const SmFontStyles & GetFontStyles()
131{
132 static const SmFontStyles aImpl;
133 return aImpl;
134}
135
136void SetFontStyle(std::u16string_view rStyleName, vcl::Font &rFont)
137{
138 // Find index related to StyleName. For an empty StyleName it's assumed to be
139 // 0 (neither bold nor italic).
140 sal_uInt16 nIndex = 0;
141 if (!rStyleName.empty())
142 {
143 sal_uInt16 i;
144 const SmFontStyles &rStyles = GetFontStyles();
145 for (i = 0; i < SmFontStyles::GetCount(); ++i)
146 if (rStyleName == rStyles.GetStyleName(i))
147 break;
148 assert(i < SmFontStyles::GetCount() && "style-name unknown");
149 nIndex = i;
150 }
151
152 rFont.SetItalic((nIndex & 0x1) ? ITALIC_NORMAL : ITALIC_NONE);
153 rFont.SetWeight((nIndex & 0x2) ? WEIGHT_BOLD : WEIGHT_NORMAL);
154}
155
157{
158 m_xZoom->set_sensitive(m_xSizeZoomed->get_active());
159}
160
162 : SfxTabPage(pPage, pController, "modules/smath/ui/smathsettings.ui", "SmathSettings", &rOptions)
163 , m_xTitle(m_xBuilder->weld_check_button("title"))
164 , m_xText(m_xBuilder->weld_check_button("text"))
165 , m_xFrame(m_xBuilder->weld_check_button("frame"))
166 , m_xSizeNormal(m_xBuilder->weld_radio_button("sizenormal"))
167 , m_xSizeScaled(m_xBuilder->weld_radio_button("sizescaled"))
168 , m_xSizeZoomed(m_xBuilder->weld_radio_button("sizezoomed"))
169 , m_xZoom(m_xBuilder->weld_metric_spin_button("zoom", FieldUnit::PERCENT))
170 , m_xNoRightSpaces(m_xBuilder->weld_check_button("norightspaces"))
171 , m_xSaveOnlyUsedSymbols(m_xBuilder->weld_check_button("saveonlyusedsymbols"))
172 , m_xAutoCloseBrackets(m_xBuilder->weld_check_button("autoclosebrackets"))
173 , m_xSmZoom(m_xBuilder->weld_metric_spin_button("smzoom", FieldUnit::PERCENT))
174{
175 m_xSizeNormal->connect_toggled(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl));
176 m_xSizeScaled->connect_toggled(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl));
177 m_xSizeZoomed->connect_toggled(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl));
178
179 Reset(&rOptions);
180}
181
183{
184 if (SmViewShell *pViewSh = SmGetActiveView())
185 if (SmEditWindow* pEdit = pViewSh->GetEditWindow())
186 pEdit->UpdateStatus();
187}
188
190{
191 sal_uInt16 nPrintSize;
192 if (m_xSizeNormal->get_active())
193 nPrintSize = PRINT_SIZE_NORMAL;
194 else if (m_xSizeScaled->get_active())
195 nPrintSize = PRINT_SIZE_SCALED;
196 else
197 nPrintSize = PRINT_SIZE_ZOOMED;
198
199 rSet->Put(SfxUInt16Item(SID_PRINTSIZE, nPrintSize));
200 rSet->Put(SfxUInt16Item(SID_PRINTZOOM, sal::static_int_cast<sal_uInt16>(m_xZoom->get_value(FieldUnit::PERCENT))));
201 rSet->Put(SfxBoolItem(SID_PRINTTITLE, m_xTitle->get_active()));
202 rSet->Put(SfxBoolItem(SID_PRINTTEXT, m_xText->get_active()));
203 rSet->Put(SfxBoolItem(SID_PRINTFRAME, m_xFrame->get_active()));
204 rSet->Put(SfxBoolItem(SID_NO_RIGHT_SPACES, m_xNoRightSpaces->get_active()));
205 rSet->Put(SfxBoolItem(SID_SAVE_ONLY_USED_SYMBOLS, m_xSaveOnlyUsedSymbols->get_active()));
206 rSet->Put(SfxBoolItem(SID_AUTO_CLOSE_BRACKETS, m_xAutoCloseBrackets->get_active()));
207 rSet->Put(SfxUInt16Item(SID_SMEDITWINDOWZOOM, sal::static_int_cast<sal_uInt16>(m_xSmZoom->get_value(FieldUnit::PERCENT))));
208
209 if (SmViewShell *pViewSh = SmGetActiveView())
210 if (SmEditWindow* pEdit = pViewSh->GetEditWindow())
211 pEdit->UpdateStatus();
212
213 return true;
214}
215
217{
218 SmPrintSize ePrintSize = static_cast<SmPrintSize>(rSet->Get(SID_PRINTSIZE).GetValue());
219
220 m_xSizeNormal->set_active(ePrintSize == PRINT_SIZE_NORMAL);
221 m_xSizeScaled->set_active(ePrintSize == PRINT_SIZE_SCALED);
222 m_xSizeZoomed->set_active(ePrintSize == PRINT_SIZE_ZOOMED);
223
224 m_xZoom->set_sensitive(m_xSizeZoomed->get_active());
225
226 m_xZoom->set_value(rSet->Get(SID_PRINTZOOM).GetValue(), FieldUnit::PERCENT);
227
228 m_xSmZoom->set_sensitive(true);
229 m_xSmZoom->set_value(rSet->Get(SID_SMEDITWINDOWZOOM).GetValue(), FieldUnit::PERCENT);
230
231 m_xTitle->set_active(rSet->Get(SID_PRINTTITLE).GetValue());
232 m_xNoRightSpaces->set_active(rSet->Get(SID_NO_RIGHT_SPACES).GetValue());
233 m_xSaveOnlyUsedSymbols->set_active(rSet->Get(SID_SAVE_ONLY_USED_SYMBOLS).GetValue());
234 m_xAutoCloseBrackets->set_active(rSet->Get(SID_AUTO_CLOSE_BRACKETS).GetValue());
235}
236
237std::unique_ptr<SfxTabPage> SmPrintOptionsTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
238{
239 return std::make_unique<SmPrintOptionsTabPage>(pPage, pController, rSet);
240}
241
242void SmShowFont::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
243{
244 Color aBackColor;
245 Color aTextColor;
246 lclGetSettingColors(aBackColor, aTextColor);
247
248 rRenderContext.SetBackground(Wallpaper(aBackColor));
249
250 vcl::Font aFont(maFont);
251 aFont.SetFontSize(Size(0, 24 * rRenderContext.GetDPIScaleFactor()));
252 aFont.SetAlignment(ALIGN_TOP);
253 rRenderContext.SetFont(aFont);
254 rRenderContext.SetTextColor(aTextColor);
255
256 OUString sText(rRenderContext.GetFont().GetFamilyName());
257 Size aTextSize(rRenderContext.GetTextWidth(sText), rRenderContext.GetTextHeight());
258
259 rRenderContext.DrawText(Point((rRenderContext.GetOutputSize().Width() - aTextSize.Width()) / 2,
260 (rRenderContext.GetOutputSize().Height() - aTextSize.Height()) / 2), sText);
261}
262
264{
265 CustomWidgetController::SetDrawingArea(pDrawingArea);
266 Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(111 , 31), MapMode(MapUnit::MapAppFont)));
267 pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
268}
269
271{
272 maFont = rFont;
273 Invalidate();
274}
275
276IMPL_LINK( SmFontDialog, FontSelectHdl, weld::ComboBox&, rComboBox, void )
277{
278 maFont.SetFamilyName(rComboBox.get_active_text());
279 m_aShowFont.SetFont(maFont);
280}
281
283{
284 if (m_xBoldCheckBox->get_active())
285 maFont.SetWeight(WEIGHT_BOLD);
286 else
287 maFont.SetWeight(WEIGHT_NORMAL);
288
289 if (m_xItalicCheckBox->get_active())
290 maFont.SetItalic(ITALIC_NORMAL);
291 else
292 maFont.SetItalic(ITALIC_NONE);
293
294 m_aShowFont.SetFont(maFont);
295}
296
298{
299 maFont = rFont;
300
301 m_xFontBox->set_active_text(maFont.GetFamilyName());
302 m_xBoldCheckBox->set_active(IsBold(maFont));
303 m_xItalicCheckBox->set_active(IsItalic(maFont));
305}
306
307SmFontDialog::SmFontDialog(weld::Window * pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes)
308 : GenericDialogController(pParent, "modules/smath/ui/fontdialog.ui", "FontDialog")
309 , m_xFontBox(m_xBuilder->weld_entry_tree_view("fontgrid", "font", "fonts"))
310 , m_xAttrFrame(m_xBuilder->weld_widget("attrframe"))
311 , m_xBoldCheckBox(m_xBuilder->weld_check_button("bold"))
312 , m_xItalicCheckBox(m_xBuilder->weld_check_button("italic"))
313 , m_xShowFont(new weld::CustomWeld(*m_xBuilder, "preview", m_aShowFont))
314{
315 m_xFontBox->set_height_request_by_rows(8);
316
317 {
318 weld::WaitObject aWait(pParent);
319
320 FontList aFontList( pFntListDevice );
321
322 sal_uInt16 nCount = aFontList.GetFontNameCount();
323 for (sal_uInt16 i = 0; i < nCount; ++i)
324 {
325 m_xFontBox->append_text(aFontList.GetFontName(i).GetFamilyName());
326 }
327 maFont.SetFontSize(Size(0, 24));
332 maFont.SetCharSet(RTL_TEXTENCODING_DONTKNOW);
334 }
335
336 m_xFontBox->connect_changed(LINK(this, SmFontDialog, FontSelectHdl));
337 m_xBoldCheckBox->connect_toggled(LINK(this, SmFontDialog, AttrChangeHdl));
338 m_xItalicCheckBox->connect_toggled(LINK(this, SmFontDialog, AttrChangeHdl));
339
340 if (bHideCheckboxes)
341 {
342 m_xBoldCheckBox->set_active(false);
343 m_xBoldCheckBox->set_sensitive(false);
344 m_xItalicCheckBox->set_active(false);
345 m_xItalicCheckBox->set_sensitive(false);
346 m_xAttrFrame->hide();
347 }
348}
349
351{
352}
353
354namespace {
355
356class SaveDefaultsQuery : public weld::MessageDialogController
357{
358public:
359 explicit SaveDefaultsQuery(weld::Widget* pParent)
360 : MessageDialogController(pParent, "modules/smath/ui/savedefaultsdialog.ui",
361 "SaveDefaultsDialog")
362 {
363 }
364};
365
366}
367
368IMPL_LINK_NOARG( SmFontSizeDialog, DefaultButtonClickHdl, weld::Button&, void )
369{
370 SaveDefaultsQuery aQuery(m_xDialog.get());
371 if (aQuery.run() == RET_YES)
372 {
373 SmModule *pp = SM_MOD();
374 SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
375 WriteTo( aFmt );
376 pp->GetConfig()->SetStandardFormat( aFmt );
377 }
378}
379
381 : GenericDialogController(pParent, "modules/smath/ui/fontsizedialog.ui", "FontSizeDialog")
382 , m_xBaseSize(m_xBuilder->weld_metric_spin_button("spinB_baseSize", FieldUnit::POINT))
383 , m_xTextSize(m_xBuilder->weld_metric_spin_button("spinB_text", FieldUnit::PERCENT))
384 , m_xIndexSize(m_xBuilder->weld_metric_spin_button("spinB_index", FieldUnit::PERCENT))
385 , m_xFunctionSize(m_xBuilder->weld_metric_spin_button("spinB_function", FieldUnit::PERCENT))
386 , m_xOperatorSize(m_xBuilder->weld_metric_spin_button("spinB_operator", FieldUnit::PERCENT))
387 , m_xBorderSize(m_xBuilder->weld_metric_spin_button("spinB_limit", FieldUnit::PERCENT))
388 , m_xDefaultButton(m_xBuilder->weld_button("default"))
389{
390 m_xDefaultButton->connect_clicked(LINK(this, SmFontSizeDialog, DefaultButtonClickHdl));
391}
392
394{
395}
396
398{
400 m_xBaseSize->set_value(
402 FieldUnit::NONE);
403
404 m_xTextSize->set_value( rFormat.GetRelSize(SIZ_TEXT), FieldUnit::NONE );
405 m_xIndexSize->set_value( rFormat.GetRelSize(SIZ_INDEX), FieldUnit::NONE );
406 m_xFunctionSize->set_value( rFormat.GetRelSize(SIZ_FUNCTION), FieldUnit::NONE );
407 m_xOperatorSize->set_value( rFormat.GetRelSize(SIZ_OPERATOR), FieldUnit::NONE );
408 m_xBorderSize->set_value( rFormat.GetRelSize(SIZ_LIMITS), FieldUnit::NONE );
409}
410
412{
413 rFormat.SetBaseSize( Size(0, o3tl::convert(m_xBaseSize->get_value(FieldUnit::NONE), o3tl::Length::pt, SmO3tlLengthUnit())) );
414
415 rFormat.SetRelSize(SIZ_TEXT, sal::static_int_cast<sal_uInt16>(m_xTextSize->get_value(FieldUnit::NONE)));
416 rFormat.SetRelSize(SIZ_INDEX, sal::static_int_cast<sal_uInt16>(m_xIndexSize->get_value(FieldUnit::NONE)));
417 rFormat.SetRelSize(SIZ_FUNCTION, sal::static_int_cast<sal_uInt16>(m_xFunctionSize->get_value(FieldUnit::NONE)));
418 rFormat.SetRelSize(SIZ_OPERATOR, sal::static_int_cast<sal_uInt16>(m_xOperatorSize->get_value(FieldUnit::NONE)));
419 rFormat.SetRelSize(SIZ_LIMITS, sal::static_int_cast<sal_uInt16>(m_xBorderSize->get_value(FieldUnit::NONE)));
420
421 const Size aTmp (rFormat.GetBaseSize());
422 for (sal_uInt16 i = FNT_BEGIN; i <= FNT_END; i++)
423 rFormat.SetFontSize(i, aTmp);
424
425 rFormat.RequestApplyChanges();
426}
427
428IMPL_LINK(SmFontTypeDialog, MenuSelectHdl, const OUString&, rIdent, void)
429{
430 SmFontPickListBox *pActiveListBox;
431
432 bool bHideCheckboxes = false;
433 if (rIdent == "variables")
434 pActiveListBox = m_xVariableFont.get();
435 else if (rIdent == "functions")
436 pActiveListBox = m_xFunctionFont.get();
437 else if (rIdent == "numbers")
438 pActiveListBox = m_xNumberFont.get();
439 else if (rIdent == "text")
440 pActiveListBox = m_xTextFont.get();
441 else if (rIdent == "serif")
442 {
443 pActiveListBox = m_xSerifFont.get();
444 bHideCheckboxes = true;
445 }
446 else if (rIdent == "sansserif")
447 {
448 pActiveListBox = m_xSansFont.get();
449 bHideCheckboxes = true;
450 }
451 else if (rIdent == "fixedwidth")
452 {
453 pActiveListBox = m_xFixedFont.get();
454 bHideCheckboxes = true;
455 }
456 else
457 pActiveListBox = nullptr;
458
459 if (pActiveListBox)
460 {
461 SmFontDialog aFontDialog(m_xDialog.get(), pFontListDev, bHideCheckboxes);
462
463 pActiveListBox->WriteTo(aFontDialog);
464 if (aFontDialog.run() == RET_OK)
465 pActiveListBox->ReadFrom(aFontDialog);
466 }
467}
468
469IMPL_LINK_NOARG(SmFontTypeDialog, DefaultButtonClickHdl, weld::Button&, void)
470{
471 SaveDefaultsQuery aQuery(m_xDialog.get());
472 if (aQuery.run() == RET_YES)
473 {
474 SmModule *pp = SM_MOD();
475 SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
476 WriteTo( aFmt );
477 pp->GetConfig()->SetStandardFormat( aFmt, true );
478 }
479}
480
482 : GenericDialogController(pParent, "modules/smath/ui/fonttypedialog.ui", "FontsDialog")
483 , pFontListDev(pFntListDevice)
484 , m_xVariableFont(new SmFontPickListBox(m_xBuilder->weld_combo_box("variableCB")))
485 , m_xFunctionFont(new SmFontPickListBox(m_xBuilder->weld_combo_box("functionCB")))
486 , m_xNumberFont(new SmFontPickListBox(m_xBuilder->weld_combo_box("numberCB")))
487 , m_xTextFont(new SmFontPickListBox(m_xBuilder->weld_combo_box("textCB")))
488 , m_xSerifFont(new SmFontPickListBox(m_xBuilder->weld_combo_box("serifCB")))
489 , m_xSansFont(new SmFontPickListBox(m_xBuilder->weld_combo_box("sansCB")))
490 , m_xFixedFont(new SmFontPickListBox(m_xBuilder->weld_combo_box("fixedCB")))
491 , m_xMenuButton(m_xBuilder->weld_menu_button("modify"))
492 , m_xDefaultButton(m_xBuilder->weld_button("default"))
493{
494 m_xDefaultButton->connect_clicked(LINK(this, SmFontTypeDialog, DefaultButtonClickHdl));
495 m_xMenuButton->connect_selected(LINK(this, SmFontTypeDialog, MenuSelectHdl));
496}
497
499{
500}
501
503{
504 SmModule *pp = SM_MOD();
505
513
514 m_xVariableFont->Insert( rFormat.GetFont(FNT_VARIABLE) );
515 m_xFunctionFont->Insert( rFormat.GetFont(FNT_FUNCTION) );
516 m_xNumberFont->Insert( rFormat.GetFont(FNT_NUMBER) );
517 m_xTextFont->Insert( rFormat.GetFont(FNT_TEXT) );
518 m_xSerifFont->Insert( rFormat.GetFont(FNT_SERIF) );
519 m_xSansFont->Insert( rFormat.GetFont(FNT_SANS) );
520 m_xFixedFont->Insert( rFormat.GetFont(FNT_FIXED) );
521}
522
523
525{
526 SmModule *pp = SM_MOD();
527
535
536 rFormat.SetFont( FNT_VARIABLE, m_xVariableFont->Get() );
537 rFormat.SetFont( FNT_FUNCTION, m_xFunctionFont->Get() );
538 rFormat.SetFont( FNT_NUMBER, m_xNumberFont->Get() );
539 rFormat.SetFont( FNT_TEXT, m_xTextFont->Get() );
540 rFormat.SetFont( FNT_SERIF, m_xSerifFont->Get() );
541 rFormat.SetFont( FNT_SANS, m_xSansFont->Get() );
542 rFormat.SetFont( FNT_FIXED, m_xFixedFont->Get() );
543
544 rFormat.RequestApplyChanges();
545}
546
547/**************************************************************************/
548
549namespace {
550
551struct FieldMinMax
552{
553 sal_uInt16 nMin, nMax;
554};
555
556}
557
558// Data for min and max values of the 4 metric fields
559// for each of the 10 categories
560const FieldMinMax pMinMaxData[10][4] =
561{
562 // 0
563 {{ 0, 200 }, { 0, 200 }, { 0, 100 }, { 0, 0 }},
564 // 1
565 {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
566 // 2
567 {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
568 // 3
569 {{ 0, 100 }, { 1, 100 }, { 0, 0 }, { 0, 0 }},
570 // 4
571 {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
572 // 5
573 {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 100 }},
574 // 6
575 {{ 0, 300 }, { 0, 300 }, { 0, 0 }, { 0, 0 }},
576 // 7
577 {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
578 // 8
579 {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
580 // 9
581 {{ 0, 10000 }, { 0, 10000 }, { 0, 10000 }, { 0, 10000 }}
582};
583
584SmCategoryDesc::SmCategoryDesc(weld::Builder& rBuilder, sal_uInt16 nCategoryIdx)
585{
586 ++nCategoryIdx;
587 std::unique_ptr<weld::Label> xTitle(rBuilder.weld_label(OUString::number(nCategoryIdx)+"title"));
588 if (xTitle)
589 {
590 Name = xTitle->get_label();
591 }
592 for (int i = 0; i < 4; ++i)
593 {
594 std::unique_ptr<weld::Label> xLabel(rBuilder.weld_label(OUString::number(nCategoryIdx)+"label"+OUString::number(i+1)));
595
596 if (xLabel)
597 {
598 Strings[i] = xLabel->get_label();
599 Graphics[i] = rBuilder.weld_widget(OUString::number(nCategoryIdx)+"image"+OUString::number(i+1));
600 }
601 else
602 {
603 Strings[i].clear();
604 Graphics[i].reset();
605 }
606
607 const FieldMinMax& rMinMax = pMinMaxData[ nCategoryIdx-1 ][i];
608 Value[i] = Minimum[i] = rMinMax.nMin;
609 Maximum[i] = rMinMax.nMax;
610 }
611}
612
614{
615}
616
617/**************************************************************************/
618
619IMPL_LINK( SmDistanceDialog, GetFocusHdl, weld::Widget&, rControl, void )
620{
621 if (!m_xCategories[nActiveCategory])
622 return;
623
624 sal_uInt16 i;
625
626 if (&rControl == &m_xMetricField1->get_widget())
627 i = 0;
628 else if (&rControl == &m_xMetricField2->get_widget())
629 i = 1;
630 else if (&rControl == &m_xMetricField3->get_widget())
631 i = 2;
632 else if (&rControl == &m_xMetricField4->get_widget())
633 i = 3;
634 else
635 return;
636 if (m_pCurrentImage)
637 m_pCurrentImage->hide();
638 m_pCurrentImage = m_xCategories[nActiveCategory]->GetGraphic(i);
639 m_pCurrentImage->show();
640}
641
642IMPL_LINK(SmDistanceDialog, MenuSelectHdl, const OUString&, rId, void)
643{
644 assert(rId.startsWith("menuitem"));
645 SetCategory(rId.replaceFirst("menuitem", "").toInt32() - 1);
646}
647
648IMPL_LINK_NOARG( SmDistanceDialog, DefaultButtonClickHdl, weld::Button&, void )
649{
650 SaveDefaultsQuery aQuery(m_xDialog.get());
651 if (aQuery.run() == RET_YES)
652 {
653 SmModule *pp = SM_MOD();
654 SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
655 WriteTo( aFmt );
656 pp->GetConfig()->SetStandardFormat( aFmt );
657 }
658}
659
660IMPL_LINK( SmDistanceDialog, CheckBoxClickHdl, weld::Toggleable&, rCheckBox, void )
661{
662 if (&rCheckBox == m_xCheckBox1.get())
663 {
664 bool bChecked = m_xCheckBox1->get_active();
665 m_xFixedText4->set_sensitive( bChecked );
666 m_xMetricField4->set_sensitive( bChecked );
667 }
668}
669
670void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
671{
672 assert(nCategory < NOCATEGORIES && "Sm: wrong category number in SmDistanceDialog");
673
674 // array to convert category- and metricfield-number in help ids.
675 // 0 is used in case of unused combinations.
676 assert(NOCATEGORIES == 10 && "Sm : array doesn't fit into the number of categories");
677 static constexpr OUStringLiteral EMPTY(u"");
678 static constexpr rtl::OUStringConstExpr aCatMf2Hid[10][4] =
679 {
690 };
691
692 // array to help iterate over the controls
693 std::pair<weld::Label*, weld::MetricSpinButton*> const aWin[4] =
694 {
695 { m_xFixedText1.get(), m_xMetricField1.get() },
696 { m_xFixedText2.get(), m_xMetricField2.get() },
697 { m_xFixedText3.get(), m_xMetricField3.get() },
698 { m_xFixedText4.get(), m_xMetricField4.get() }
699 };
700
701 SmCategoryDesc *pCat;
702
703 // remember the (maybe new) settings of the active SmCategoryDesc
704 // before switching to the new one
706 {
707 pCat = m_xCategories[nActiveCategory].get();
708 pCat->SetValue(0, sal::static_int_cast<sal_uInt16>(m_xMetricField1->get_value(FieldUnit::NONE)));
709 pCat->SetValue(1, sal::static_int_cast<sal_uInt16>(m_xMetricField2->get_value(FieldUnit::NONE)));
710 pCat->SetValue(2, sal::static_int_cast<sal_uInt16>(m_xMetricField3->get_value(FieldUnit::NONE)));
711 pCat->SetValue(3, sal::static_int_cast<sal_uInt16>(m_xMetricField4->get_value(FieldUnit::NONE)));
712
713 if (nActiveCategory == 5)
714 bScaleAllBrackets = m_xCheckBox1->get_active();
715
716 m_xMenuButton->set_item_active("menuitem" + OUString::number(nActiveCategory + 1), false);
717 }
718
719 // activation/deactivation of the associated controls depending on the chosen category
720 bool bActive;
721 for (sal_uInt16 i = 0; i < 4; i++)
722 {
723 weld::Label *pFT = aWin[i].first;
724 weld::MetricSpinButton *pMF = aWin[i].second;
725
726 // To determine which Controls should be active, the existence
727 // of an associated HelpID is checked
728 bActive = !aCatMf2Hid[nCategory][i].asView().empty();
729
730 pFT->set_visible(bActive);
731 pFT->set_sensitive(bActive);
732 pMF->set_visible(bActive);
733 pMF->set_sensitive(bActive);
734
735 // set measurement unit and number of decimal places
736 FieldUnit eUnit;
737 sal_uInt16 nDigits;
738 if (nCategory < 9)
739 {
740 eUnit = FieldUnit::PERCENT;
741 nDigits = 0;
742 }
743 else
744 {
745 eUnit = FieldUnit::MM_100TH;
746 nDigits = 2;
747 }
748 pMF->set_unit(eUnit); // changes the value
749 pMF->set_digits(nDigits);
750
751 if (bActive)
752 {
753 pCat = m_xCategories[nCategory].get();
754 pFT->set_label(pCat->GetString(i));
755
756 pMF->set_range(pCat->GetMinimum(i), pCat->GetMaximum(i), FieldUnit::NONE);
757 pMF->set_value(pCat->GetValue(i), FieldUnit::NONE);
758
759 pMF->set_help_id(aCatMf2Hid[nCategory][i]);
760 }
761 }
762 // activate the CheckBox and the associated MetricField if we're dealing with the brackets menu
763 bActive = nCategory == 5;
764 m_xCheckBox1->set_visible(bActive);
765 m_xCheckBox1->set_sensitive(bActive);
766 if (bActive)
767 {
768 m_xCheckBox1->set_active(bScaleAllBrackets);
769
770 bool bChecked = m_xCheckBox1->get_active();
771 m_xFixedText4->set_sensitive( bChecked );
772 m_xMetricField4->set_sensitive( bChecked );
773 }
774
775 m_xMenuButton->set_item_active("menuitem" + OUString::number(nCategory + 1), true);
776 m_xFrame->set_label(m_xCategories[nCategory]->GetName());
777
778 nActiveCategory = nCategory;
779
780 m_xMetricField1->grab_focus();
781}
782
784 : GenericDialogController(pParent, "modules/smath/ui/spacingdialog.ui", "SpacingDialog")
785 , m_xFrame(m_xBuilder->weld_frame("template"))
786 , m_xFixedText1(m_xBuilder->weld_label("label1"))
787 , m_xMetricField1(m_xBuilder->weld_metric_spin_button("spinbutton1", FieldUnit::CM))
788 , m_xFixedText2(m_xBuilder->weld_label("label2"))
789 , m_xMetricField2(m_xBuilder->weld_metric_spin_button("spinbutton2", FieldUnit::CM))
790 , m_xFixedText3(m_xBuilder->weld_label("label3"))
791 , m_xMetricField3(m_xBuilder->weld_metric_spin_button("spinbutton3", FieldUnit::CM))
792 , m_xCheckBox1(m_xBuilder->weld_check_button("checkbutton"))
793 , m_xFixedText4(m_xBuilder->weld_label("label4"))
794 , m_xMetricField4(m_xBuilder->weld_metric_spin_button("spinbutton4", FieldUnit::CM))
795 , m_xMenuButton(m_xBuilder->weld_menu_button("category"))
796 , m_xDefaultButton(m_xBuilder->weld_button("default"))
797 , m_xBitmap(m_xBuilder->weld_widget("image"))
798 , m_pCurrentImage(m_xBitmap.get())
799{
800 for (sal_uInt16 i = 0; i < NOCATEGORIES; ++i)
801 m_xCategories[i].reset( new SmCategoryDesc(*m_xBuilder, i) );
803 bScaleAllBrackets = false;
804
805 m_xMetricField1->connect_focus_in(LINK(this, SmDistanceDialog, GetFocusHdl));
806 m_xMetricField2->connect_focus_in(LINK(this, SmDistanceDialog, GetFocusHdl));
807 m_xMetricField3->connect_focus_in(LINK(this, SmDistanceDialog, GetFocusHdl));
808 m_xMetricField4->connect_focus_in(LINK(this, SmDistanceDialog, GetFocusHdl));
809 m_xCheckBox1->connect_toggled(LINK(this, SmDistanceDialog, CheckBoxClickHdl));
810 m_xMenuButton->connect_selected(LINK(this, SmDistanceDialog, MenuSelectHdl));
811 m_xDefaultButton->connect_clicked(LINK(this, SmDistanceDialog, DefaultButtonClickHdl));
812
813 //set the initial size, with max visible widgets visible, as preferred size
814 m_xDialog->set_size_request(-1, m_xDialog->get_preferred_size().Height());
815}
816
818{
819}
820
822{
823 m_xCategories[0]->SetValue(0, rFormat.GetDistance(DIS_HORIZONTAL));
824 m_xCategories[0]->SetValue(1, rFormat.GetDistance(DIS_VERTICAL));
825 m_xCategories[0]->SetValue(2, rFormat.GetDistance(DIS_ROOT));
826 m_xCategories[1]->SetValue(0, rFormat.GetDistance(DIS_SUPERSCRIPT));
827 m_xCategories[1]->SetValue(1, rFormat.GetDistance(DIS_SUBSCRIPT));
828 m_xCategories[2]->SetValue(0, rFormat.GetDistance(DIS_NUMERATOR));
829 m_xCategories[2]->SetValue(1, rFormat.GetDistance(DIS_DENOMINATOR));
830 m_xCategories[3]->SetValue(0, rFormat.GetDistance(DIS_FRACTION));
831 m_xCategories[3]->SetValue(1, rFormat.GetDistance(DIS_STROKEWIDTH));
832 m_xCategories[4]->SetValue(0, rFormat.GetDistance(DIS_UPPERLIMIT));
833 m_xCategories[4]->SetValue(1, rFormat.GetDistance(DIS_LOWERLIMIT));
834 m_xCategories[5]->SetValue(0, rFormat.GetDistance(DIS_BRACKETSIZE));
835 m_xCategories[5]->SetValue(1, rFormat.GetDistance(DIS_BRACKETSPACE));
836 m_xCategories[5]->SetValue(3, rFormat.GetDistance(DIS_NORMALBRACKETSIZE));
837 m_xCategories[6]->SetValue(0, rFormat.GetDistance(DIS_MATRIXROW));
838 m_xCategories[6]->SetValue(1, rFormat.GetDistance(DIS_MATRIXCOL));
839 m_xCategories[7]->SetValue(0, rFormat.GetDistance(DIS_ORNAMENTSIZE));
840 m_xCategories[7]->SetValue(1, rFormat.GetDistance(DIS_ORNAMENTSPACE));
841 m_xCategories[8]->SetValue(0, rFormat.GetDistance(DIS_OPERATORSIZE));
842 m_xCategories[8]->SetValue(1, rFormat.GetDistance(DIS_OPERATORSPACE));
843 m_xCategories[9]->SetValue(0, rFormat.GetDistance(DIS_LEFTSPACE));
844 m_xCategories[9]->SetValue(1, rFormat.GetDistance(DIS_RIGHTSPACE));
845 m_xCategories[9]->SetValue(2, rFormat.GetDistance(DIS_TOPSPACE));
846 m_xCategories[9]->SetValue(3, rFormat.GetDistance(DIS_BOTTOMSPACE));
847
849
850 // force update (even of category 0) by setting nActiveCategory to a
851 // non-existent category number
853 SetCategory(0);
854}
855
856
857void SmDistanceDialog::WriteTo(SmFormat &rFormat) /*const*/
858{
859 // TODO can they actually be different?
860 // if that's not the case 'const' could be used above!
862
865 rFormat.SetDistance( DIS_ROOT, m_xCategories[0]->GetValue(2) );
887
889
890 rFormat.RequestApplyChanges();
891}
892
893IMPL_LINK_NOARG( SmAlignDialog, DefaultButtonClickHdl, weld::Button&, void )
894{
895 SaveDefaultsQuery aQuery(m_xDialog.get());
896 if (aQuery.run() == RET_YES)
897 {
898 SmModule *pp = SM_MOD();
899 SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
900 WriteTo( aFmt );
901 pp->GetConfig()->SetStandardFormat( aFmt );
902 }
903}
904
906 : GenericDialogController(pParent, "modules/smath/ui/alignmentdialog.ui", "AlignmentDialog")
907 , m_xLeft(m_xBuilder->weld_radio_button("left"))
908 , m_xCenter(m_xBuilder->weld_radio_button("center"))
909 , m_xRight(m_xBuilder->weld_radio_button("right"))
910 , m_xDefaultButton(m_xBuilder->weld_button("default"))
911{
912 m_xDefaultButton->connect_clicked(LINK(this, SmAlignDialog, DefaultButtonClickHdl));
913}
914
916{
917}
918
920{
921 switch (rFormat.GetHorAlign())
922 {
923 case SmHorAlign::Left:
924 m_xLeft->set_active(true);
925 break;
927 m_xCenter->set_active(true);
928 break;
930 m_xRight->set_active(true);
931 break;
932 }
933}
934
936{
937 if (m_xLeft->get_active())
939 else if (m_xRight->get_active())
941 else
943
944 rFormat.RequestApplyChanges();
945}
946
947SmShowSymbolSet::SmShowSymbolSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow)
948 : nLen(0)
949 , nRows(0)
950 , nColumns(0)
951 , nXOffset(0)
952 , nYOffset(0)
953 , nSelectSymbol(SYMBOL_NONE)
954 , m_xScrolledWindow(std::move(pScrolledWindow))
955{
956 m_xScrolledWindow->connect_vadjustment_changed(LINK(this, SmShowSymbolSet, ScrollHdl));
957}
958
960{
961 return Point(rPoint.X() + nXOffset, rPoint.Y() + nYOffset);
962}
963
965{
966 CustomWidgetController::Resize();
967 Size aWinSize(GetOutputSizePixel());
968 if (aWinSize != m_aOldSize)
969 {
970 calccols(GetDrawingArea()->get_ref_device());
971 m_aOldSize = aWinSize;
972 }
973}
974
976{
977 Color aBackgroundColor;
978 Color aTextColor;
979 lclGetSettingColors(aBackgroundColor, aTextColor);
980
981 rRenderContext.SetBackground(Wallpaper(aBackgroundColor));
982 rRenderContext.SetTextColor(aTextColor);
983
984 rRenderContext.Push(vcl::PushFlags::MAPMODE);
985
986 // set MapUnit for which 'nLen' has been calculated
987 rRenderContext.SetMapMode(MapMode(MapUnit::MapPixel));
988
989 sal_uInt16 v = sal::static_int_cast< sal_uInt16 >(m_xScrolledWindow->vadjustment_get_value() * nColumns);
990 size_t nSymbols = aSymbolSet.size();
991
992 Color aTxtColor(rRenderContext.GetTextColor());
993 for (size_t i = v; i < nSymbols ; i++)
994 {
995 SmSym aSymbol(*aSymbolSet[i]);
996 vcl::Font aFont(aSymbol.GetFace());
997 aFont.SetAlignment(ALIGN_TOP);
998
999 // taking a FontSize which is a bit smaller (compared to nLen) in order to have a buffer
1000 // (hopefully enough for left and right, too)
1001 aFont.SetFontSize(Size(0, nLen - (nLen / 3)));
1002 rRenderContext.SetFont(aFont);
1003 // keep text color
1004 rRenderContext.SetTextColor(aTxtColor);
1005
1006 int nIV = i - v;
1007 sal_UCS4 cChar = aSymbol.GetCharacter();
1008 OUString aText(&cChar, 1);
1009 Size aSize(rRenderContext.GetTextWidth( aText ), rRenderContext.GetTextHeight());
1010
1011 Point aPoint((nIV % nColumns) * nLen + (nLen - aSize.Width()) / 2,
1012 (nIV / nColumns) * nLen + (nLen - aSize.Height()) / 2);
1013
1014 rRenderContext.DrawText(OffsetPoint(aPoint), aText);
1015 }
1016
1018 {
1019 Point aPoint(((nSelectSymbol - v) % nColumns) * nLen,
1020 ((nSelectSymbol - v) / nColumns) * nLen);
1021
1022 rRenderContext.Invert(tools::Rectangle(OffsetPoint(aPoint), Size(nLen, nLen)));
1023
1024 }
1025
1026 rRenderContext.Pop();
1027}
1028
1030{
1031 GrabFocus();
1032
1033 Size aOutputSize(nColumns * nLen, nRows * nLen);
1034 aOutputSize.AdjustWidth(nXOffset );
1035 aOutputSize.AdjustHeight(nYOffset );
1036 Point aPoint(rMEvt.GetPosPixel());
1037 aPoint.AdjustX( -nXOffset );
1038 aPoint.AdjustY( -nYOffset );
1039
1040 if (rMEvt.IsLeft() && tools::Rectangle(Point(0, 0), aOutputSize).Contains(rMEvt.GetPosPixel()))
1041 {
1042 tools::Long nPos = (aPoint.Y() / nLen) * nColumns + (aPoint.X() / nLen) +
1043 m_xScrolledWindow->vadjustment_get_value() * nColumns;
1044 SelectSymbol( sal::static_int_cast< sal_uInt16 >(nPos) );
1045
1046 aSelectHdlLink.Call(*this);
1047
1048 if (rMEvt.GetClicks() > 1)
1049 aDblClickHdlLink.Call(*this);
1050 }
1051
1052 return true;
1053}
1054
1056{
1057 sal_uInt16 n = nSelectSymbol;
1058
1059 if (n != SYMBOL_NONE)
1060 {
1061 switch (rKEvt.GetKeyCode().GetCode())
1062 {
1063 case KEY_DOWN: n = n + nColumns; break;
1064 case KEY_UP: n = n - nColumns; break;
1065 case KEY_LEFT: n -= 1; break;
1066 case KEY_RIGHT: n += 1; break;
1067 case KEY_HOME: n = 0; break;
1068 case KEY_END: n = static_cast< sal_uInt16 >(aSymbolSet.size() - 1); break;
1069 case KEY_PAGEUP: n -= nColumns * nRows; break;
1070 case KEY_PAGEDOWN: n += nColumns * nRows; break;
1071 default:
1072 return false;
1073 }
1074 }
1075 else
1076 n = 0;
1077
1078 if (n >= aSymbolSet.size())
1079 n = nSelectSymbol;
1080
1081 // adjust scrollbar
1082 if ((n < sal::static_int_cast<sal_uInt16>(m_xScrolledWindow->vadjustment_get_value() * nColumns)) ||
1083 (n >= sal::static_int_cast<sal_uInt16>((m_xScrolledWindow->vadjustment_get_value() + nRows) * nColumns)))
1084 {
1085 m_xScrolledWindow->vadjustment_set_value(n / nColumns);
1086 Invalidate();
1087 }
1088
1089 SelectSymbol(n);
1090 aSelectHdlLink.Call(*this);
1091
1092 return true;
1093}
1094
1096{
1097 // Height of 16pt in pixels (matching 'aOutputSize')
1098 nLen = rRenderContext.LogicToPixel(Size(0, 16), MapMode(MapUnit::MapPoint)).Height();
1099
1100 Size aOutputSize(GetOutputSizePixel());
1101
1102 nColumns = aOutputSize.Width() / nLen;
1103 nRows = aOutputSize.Height() / nLen;
1104 nColumns = std::max<tools::Long>(1, nColumns);
1105 nRows = std::max<tools::Long>(1, nRows);
1106
1107 nXOffset = (aOutputSize.Width() - (nColumns * nLen)) / 2;
1108 nYOffset = (aOutputSize.Height() - (nRows * nLen)) / 2;
1109
1111}
1112
1114{
1115 aSymbolSet = rSymbolSet;
1117 Invalidate();
1118}
1119
1121{
1122 const int nLastRow = (aSymbolSet.size() - 1 + nColumns) / nColumns;
1123 m_xScrolledWindow->vadjustment_configure(m_xScrolledWindow->vadjustment_get_value(), 0, nLastRow, 1, nRows - 1, nRows);
1124 Invalidate();
1125}
1126
1127void SmShowSymbolSet::SelectSymbol(sal_uInt16 nSymbol)
1128{
1129 int v = m_xScrolledWindow->vadjustment_get_value() * nColumns;
1130
1132 {
1134 ((nSelectSymbol - v) / nColumns) * nLen)));
1136 }
1137
1138 if (nSymbol < aSymbolSet.size())
1139 nSelectSymbol = nSymbol;
1140
1141 if (aSymbolSet.empty())
1143
1145 {
1147 ((nSelectSymbol - v) / nColumns) * nLen)));
1149 }
1150
1151 if (!nColumns)
1152 Invalidate();
1153}
1154
1156{
1157 Invalidate();
1158}
1159
1161{
1162}
1163
1165{
1166 Size aSize(GetOutputSizePixel());
1167 rFont.SetFontSize(Size(0, aSize.Height() - aSize.Height() / 3));
1168}
1169
1171{
1172 Color aBackgroundColor;
1173 Color aTextColor;
1174 lclGetSettingColors(aBackgroundColor, aTextColor);
1175 rRenderContext.SetBackground(Wallpaper(aBackgroundColor));
1176 rRenderContext.SetTextColor(aTextColor);
1177 rRenderContext.Erase();
1178
1179 vcl::Font aFont(GetFont());
1180 setFontSize(aFont);
1181 rRenderContext.SetFont(aFont);
1182
1183 const OUString &rText = GetText();
1184 Size aTextSize(rRenderContext.GetTextWidth(rText), rRenderContext.GetTextHeight());
1185
1186 rRenderContext.DrawText(Point((rRenderContext.GetOutputSize().Width() - aTextSize.Width()) / 2,
1187 (rRenderContext.GetOutputSize().Height() * 7 / 10)), rText);
1188}
1189
1191{
1192 if (rMEvt.GetClicks() > 1)
1193 aDblClickHdlLink.Call(*this);
1194 return true;
1195}
1196
1197void SmShowSymbol::SetSymbol(const SmSym *pSymbol)
1198{
1199 if (pSymbol)
1200 {
1201 vcl::Font aFont(pSymbol->GetFace());
1203 SetFont(aFont);
1204
1205 sal_UCS4 cChar = pSymbol->GetCharacter();
1206 OUString aText(&cChar, 1);
1207 SetText( aText );
1208 }
1209
1210 Invalidate();
1211}
1212
1214 // populate the entries of possible SymbolsSets in the dialog with
1215 // current values of the SymbolSet manager but selects none of those
1216{
1217 m_xSymbolSets->clear();
1218 m_xSymbolSets->set_active(-1);
1219
1220 std::set< OUString > aSymbolSetNames( rSymbolMgr.GetSymbolSetNames() );
1221 for (const auto& rSymbolSetName : aSymbolSetNames)
1222 m_xSymbolSets->append_text(rSymbolSetName);
1223}
1224
1225IMPL_LINK_NOARG( SmSymbolDialog, SymbolSetChangeHdl, weld::ComboBox&, void )
1226{
1227 SelectSymbolSet(m_xSymbolSets->get_active_text());
1228}
1229
1231{
1232 SelectSymbol(m_xSymbolSetDisplay->GetSelectSymbol());
1233}
1234
1236{
1237 SmSymDefineDialog aDialog(m_xDialog.get(), pFontListDev, rSymbolMgr);
1238
1239 // set current symbol and SymbolSet for the new dialog
1240 const OUString aSymSetName (m_xSymbolSets->get_active_text()),
1241 aSymName (m_xSymbolName->get_label());
1242 aDialog.SelectOldSymbolSet(aSymSetName);
1243 aDialog.SelectOldSymbol(aSymName);
1244 aDialog.SelectSymbolSet(aSymSetName);
1245 aDialog.SelectSymbol(aSymName);
1246
1247 // remember old SymbolSet
1248 OUString aOldSymbolSet (m_xSymbolSets->get_active_text());
1249
1250 sal_uInt16 nSymPos = m_xSymbolSetDisplay->GetSelectSymbol();
1251
1252 // adapt dialog to data of the SymbolSet manager, which might have changed
1253 if (aDialog.run() == RET_OK && rSymbolMgr.IsModified())
1254 {
1255 rSymbolMgr.Save();
1256 FillSymbolSets();
1257 }
1258
1259 // if the old SymbolSet doesn't exist anymore, go to the first one SymbolSet (if one exists)
1260 if (!SelectSymbolSet(aOldSymbolSet) && m_xSymbolSets->get_count() > 0)
1261 SelectSymbolSet(m_xSymbolSets->get_text(0));
1262 else
1263 {
1264 // just update display of current symbol set
1265 assert(aSymSetName == aSymSetName); //unexpected change in symbol set name
1266 aSymbolSet = rSymbolMgr.GetSymbolSet( aSymbolSetName );
1267 m_xSymbolSetDisplay->SetSymbolSet( aSymbolSet );
1268 }
1269
1270 if (nSymPos >= aSymbolSet.size())
1271 nSymPos = static_cast< sal_uInt16 >(aSymbolSet.size()) - 1;
1272 SelectSymbol( nSymPos );
1273}
1274
1275IMPL_LINK_NOARG( SmSymbolDialog, SymbolDblClickHdl2, SmShowSymbolSet&, void )
1276{
1277 SymbolDblClickHdl();
1278}
1279
1280IMPL_LINK_NOARG( SmSymbolDialog, SymbolDblClickHdl, SmShowSymbol&, void )
1281{
1282 SymbolDblClickHdl();
1283}
1284
1286{
1287 GetClickHdl(*m_xGetBtn);
1288 m_xDialog->response(RET_OK);
1289}
1290
1292{
1293 const SmSym *pSym = GetSymbol();
1294 if (pSym)
1295 {
1296 OUString aText = "%" + pSym->GetName() + " ";
1297
1298 rViewSh.GetViewFrame().GetDispatcher()->ExecuteList(
1299 SID_INSERTSPECIAL, SfxCallMode::RECORD,
1300 { new SfxStringItem(SID_INSERTSPECIAL, aText) });
1301 }
1302}
1303
1305 SmSymbolManager &rMgr, SmViewShell &rViewShell)
1306 : GenericDialogController(pParent, "modules/smath/ui/catalogdialog.ui", "CatalogDialog")
1307 , rViewSh(rViewShell)
1308 , rSymbolMgr(rMgr)
1309 , pFontListDev(pFntListDevice)
1310 , m_xSymbolSets(m_xBuilder->weld_combo_box("symbolset"))
1311 , m_xSymbolSetDisplay(new SmShowSymbolSet(m_xBuilder->weld_scrolled_window("scrolledwindow", true)))
1312 , m_xSymbolSetDisplayArea(new weld::CustomWeld(*m_xBuilder, "symbolsetdisplay", *m_xSymbolSetDisplay))
1313 , m_xSymbolName(m_xBuilder->weld_label("symbolname"))
1314 , m_xSymbolDisplay(new weld::CustomWeld(*m_xBuilder, "preview", m_aSymbolDisplay))
1315 , m_xGetBtn(m_xBuilder->weld_button("ok"))
1316 , m_xEditBtn(m_xBuilder->weld_button("edit"))
1317{
1318 m_xSymbolSets->make_sorted();
1319
1320 aSymbolSetName.clear();
1321 aSymbolSet.clear();
1323 if (m_xSymbolSets->get_count() > 0)
1324 SelectSymbolSet(m_xSymbolSets->get_text(0));
1325
1326 m_xSymbolSets->connect_changed(LINK(this, SmSymbolDialog, SymbolSetChangeHdl));
1327 m_xSymbolSetDisplay->SetSelectHdl(LINK(this, SmSymbolDialog, SymbolChangeHdl));
1328 m_xSymbolSetDisplay->SetDblClickHdl(LINK(this, SmSymbolDialog, SymbolDblClickHdl2));
1330 m_xEditBtn->connect_clicked(LINK(this, SmSymbolDialog, EditClickHdl));
1331 m_xGetBtn->connect_clicked(LINK(this, SmSymbolDialog, GetClickHdl));
1332}
1333
1335{
1336}
1337
1338bool SmSymbolDialog::SelectSymbolSet(const OUString &rSymbolSetName)
1339{
1340 bool bRet = false;
1341 sal_Int32 nPos = m_xSymbolSets->find_text(rSymbolSetName);
1342
1343 aSymbolSetName.clear();
1344 aSymbolSet.clear();
1345 if (nPos != -1)
1346 {
1347 m_xSymbolSets->set_active(nPos);
1348
1349 aSymbolSetName = rSymbolSetName;
1351
1352 // sort symbols by Unicode position (useful for displaying Greek characters alphabetically)
1353 std::sort( aSymbolSet.begin(), aSymbolSet.end(),
1354 [](const SmSym *pSym1, const SmSym *pSym2)
1355 {
1356 return pSym1->GetCharacter() < pSym2->GetCharacter();
1357 } );
1358
1359 const bool bEmptySymbolSet = aSymbolSet.empty();
1360 m_xSymbolSetDisplay->SetSymbolSet( aSymbolSet );
1361 if (!bEmptySymbolSet)
1362 SelectSymbol(0);
1363
1364 bRet = true;
1365 }
1366 else
1367 m_xSymbolSets->set_active(-1);
1368
1369 return bRet;
1370}
1371
1372void SmSymbolDialog::SelectSymbol(sal_uInt16 nSymbolNo)
1373{
1374 const SmSym *pSym = nullptr;
1375 if (!aSymbolSetName.isEmpty() && nSymbolNo < static_cast< sal_uInt16 >(aSymbolSet.size()))
1376 pSym = aSymbolSet[ nSymbolNo ];
1377
1378 m_xSymbolSetDisplay->SelectSymbol(nSymbolNo);
1380 m_xSymbolName->set_label(pSym ? pSym->GetName() : OUString());
1381}
1382
1384{
1385 sal_uInt16 nSymbolNo = m_xSymbolSetDisplay->GetSelectSymbol();
1386 bool bValid = !aSymbolSetName.isEmpty() && nSymbolNo < static_cast< sal_uInt16 >(aSymbolSet.size());
1387 return bValid ? aSymbolSet[ nSymbolNo ] : nullptr;
1388}
1389
1391{
1392 const OUString &rText = GetText();
1393 if (rText.isEmpty())
1394 return;
1395 sal_UCS4 cChar = rText.iterateCodePoints(&o3tl::temporary(sal_Int32(0)));
1396 SetSymbol(cChar, GetFont()); //force recalculation of size
1397}
1398
1400{
1401 Color aTextCol = rRenderContext.GetTextColor();
1402 Color aFillCol = rRenderContext.GetFillColor();
1403
1404 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1405 const Color aWindowTextColor(rStyleSettings.GetDialogTextColor());
1406 const Color aWindowColor(rStyleSettings.GetWindowColor());
1407 rRenderContext.SetTextColor(aWindowTextColor);
1408 rRenderContext.SetFillColor(aWindowColor);
1409
1410 Size aSize(GetOutputSizePixel());
1411 rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), aSize));
1412
1413 OUString aText(GetText());
1414 if (!aText.isEmpty())
1415 {
1416 vcl::Font aFont(m_aFont);
1417 aFont.SetAlignment(ALIGN_TOP);
1418 rRenderContext.SetFont(aFont);
1419
1420 Size aTextSize(rRenderContext.GetTextWidth(aText), rRenderContext.GetTextHeight());
1421
1422 rRenderContext.DrawText(Point((aSize.Width() - aTextSize.Width()) / 2,
1423 (aSize.Height() - aTextSize.Height()) / 2), aText);
1424 }
1425
1426 rRenderContext.SetTextColor(aTextCol);
1427 rRenderContext.SetFillColor(aFillCol);
1428}
1429
1430void SmShowChar::SetSymbol( const SmSym *pSym )
1431{
1432 if (pSym)
1433 SetSymbol( pSym->GetCharacter(), pSym->GetFace() );
1434}
1435
1436
1437void SmShowChar::SetSymbol( sal_UCS4 cChar, const vcl::Font &rFont )
1438{
1439 vcl::Font aFont( rFont );
1440 Size aSize(GetOutputSizePixel());
1441 aFont.SetFontSize(Size(0, aSize.Height() - aSize.Height() / 3));
1443 SetFont(aFont);
1444
1445 OUString aText(&cChar, 1);
1446 SetText( aText );
1447
1448 Invalidate();
1449}
1450
1451void SmSymDefineDialog::FillSymbols(weld::ComboBox& rComboBox, bool bDeleteText)
1452{
1453 assert((&rComboBox == m_xOldSymbols.get() || &rComboBox == m_xSymbols.get()) && "Sm : wrong ComboBox");
1454
1455 rComboBox.clear();
1456 if (bDeleteText)
1457 rComboBox.set_entry_text(OUString());
1458
1459 weld::ComboBox& rBox = &rComboBox == m_xOldSymbols.get() ? *m_xOldSymbolSets : *m_xSymbolSets;
1461 for (const SmSym* i : aSymSet)
1462 rComboBox.append_text(i->GetName());
1463}
1464
1465void SmSymDefineDialog::FillSymbolSets(weld::ComboBox& rComboBox, bool bDeleteText)
1466{
1467 assert((&rComboBox == m_xOldSymbolSets.get() || &rComboBox == m_xSymbolSets.get()) && "Sm : wrong ComboBox");
1468
1469 rComboBox.clear();
1470 if (bDeleteText)
1471 rComboBox.set_entry_text(OUString());
1472
1473 const std::set< OUString > aSymbolSetNames( m_aSymbolMgrCopy.GetSymbolSetNames() );
1474 for (const auto& rSymbolSetName : aSymbolSetNames)
1475 rComboBox.append_text(rSymbolSetName);
1476}
1477
1479{
1480 m_xFonts->clear();
1481 m_xFonts->set_active(-1);
1482
1483 // Include all fonts of FontList into the font list.
1484 // If there are duplicates, only include one entry of each font since the style will be
1485 // already selected using the FontStyleBox.
1486 if (m_xFontList)
1487 {
1488 sal_uInt16 nCount = m_xFontList->GetFontNameCount();
1489 for (sal_uInt16 i = 0; i < nCount; ++i)
1490 m_xFonts->append_text(m_xFontList->GetFontName(i).GetFamilyName());
1491 }
1492}
1493
1495{
1496 m_xStyles->clear();
1497// pStyles->SetText(OUString());
1498
1499 OUString aText(m_xFonts->get_active_text());
1500 if (!aText.isEmpty())
1501 {
1502 // use own StyleNames
1503 const SmFontStyles &rStyles = GetFontStyles();
1504 for (sal_uInt16 i = 0; i < SmFontStyles::GetCount(); ++i)
1505 m_xStyles->append_text(rStyles.GetStyleName(i));
1506
1507 assert(m_xStyles->get_count() > 0 && "Sm : no styles available");
1508 m_xStyles->set_active(0);
1509 }
1510}
1511
1513{
1514 assert((&rComboBox == m_xOldSymbols.get() || &rComboBox == m_xSymbols.get()) && "Sm : wrong combobox");
1516}
1517
1518IMPL_LINK(SmSymDefineDialog, OldSymbolChangeHdl, weld::ComboBox&, rComboBox, void)
1519{
1520 (void) rComboBox;
1521 assert(&rComboBox == m_xOldSymbols.get() && "Sm : wrong argument");
1522 SelectSymbol(*m_xOldSymbols, m_xOldSymbols->get_active_text(), false);
1523}
1524
1525IMPL_LINK( SmSymDefineDialog, OldSymbolSetChangeHdl, weld::ComboBox&, rComboBox, void )
1526{
1527 (void) rComboBox;
1528 assert(&rComboBox == m_xOldSymbolSets.get() && "Sm : wrong argument");
1529 SelectSymbolSet(*m_xOldSymbolSets, m_xOldSymbolSets->get_active_text(), false);
1530}
1531
1532IMPL_LINK(SmSymDefineDialog, ModifyHdl, weld::ComboBox&, rComboBox, void)
1533{
1534 // remember cursor position for later restoring of it
1535 int nStartPos, nEndPos;
1536 rComboBox.get_entry_selection_bounds(nStartPos, nEndPos);
1537
1538 if (&rComboBox == m_xSymbols.get())
1539 SelectSymbol(*m_xSymbols, m_xSymbols->get_active_text(), false);
1540 else if (&rComboBox == m_xSymbolSets.get())
1541 SelectSymbolSet(*m_xSymbolSets, m_xSymbolSets->get_active_text(), false);
1542 else if (&rComboBox == m_xOldSymbols.get())
1543 // allow only names from the list
1544 SelectSymbol(*m_xOldSymbols, m_xOldSymbols->get_active_text(), true);
1545 else if (&rComboBox == m_xOldSymbolSets.get())
1546 // allow only names from the list
1547 SelectSymbolSet(*m_xOldSymbolSets, m_xOldSymbolSets->get_active_text(), true);
1548 else if (&rComboBox == m_xStyles.get())
1549 // allow only names from the list (that's the case here anyway)
1550 SelectStyle(m_xStyles->get_active_text(), true);
1551 else
1552 SAL_WARN("starmath", "wrong combobox argument");
1553
1554 rComboBox.select_entry_region(nStartPos, nEndPos);
1555
1556 UpdateButtons();
1557}
1558
1559IMPL_LINK(SmSymDefineDialog, FontChangeHdl, weld::ComboBox&, rListBox, void)
1560{
1561 (void) rListBox;
1562 assert(&rListBox == m_xFonts.get() && "Sm : wrong argument");
1563
1564 SelectFont(m_xFonts->get_active_text());
1565}
1566
1568{
1569 int nPos = m_xFontsSubsetLB->get_active();
1570 if (nPos != -1)
1571 {
1572 const Subset* pSubset = weld::fromId<const Subset*>(m_xFontsSubsetLB->get_active_id());
1573 if (pSubset)
1574 {
1575 m_xCharsetDisplay->SelectCharacter( pSubset->GetRangeMin() );
1576 }
1577 }
1578}
1579
1580IMPL_LINK( SmSymDefineDialog, StyleChangeHdl, weld::ComboBox&, rComboBox, void )
1581{
1582 (void) rComboBox;
1583 assert(&rComboBox == m_xStyles.get() && "Sm : wrong argument");
1584
1585 SelectStyle(m_xStyles->get_active_text());
1586}
1587
1589{
1590 sal_UCS4 cChar = m_xCharsetDisplay->GetSelectCharacter();
1591
1592 if (m_xSubsetMap)
1593 {
1594 const Subset* pSubset = m_xSubsetMap->GetSubsetByUnicode(cChar);
1595 if (pSubset)
1596 m_xFontsSubsetLB->set_active_text(pSubset->GetName());
1597 else
1598 m_xFontsSubsetLB->set_active(-1);
1599 }
1600
1601 m_aSymbolDisplay.SetSymbol(cChar, m_xCharsetDisplay->GetFont());
1602
1603 UpdateButtons();
1604
1605 // display Unicode position as symbol name while iterating over characters
1606 const OUString aHex(OUString::number(cChar, 16).toAsciiUpperCase());
1607 const OUString aPattern( (aHex.getLength() > 4) ? OUString("Ux000000") : OUString("Ux0000") );
1608 OUString aUnicodePos = aPattern.subView( 0, aPattern.getLength() - aHex.getLength() ) +
1609 aHex;
1610 m_xSymbols->set_entry_text(aUnicodePos);
1611 m_xSymbolName->set_label(aUnicodePos);
1612}
1613
1614IMPL_LINK( SmSymDefineDialog, AddClickHdl, weld::Button&, rButton, void )
1615{
1616 (void) rButton;
1617 assert(&rButton == m_xAddBtn.get() && "Sm : wrong argument");
1618 assert(rButton.get_sensitive() && "Sm : requirements met ??");
1619
1620 // add symbol
1621 const SmSym aNewSymbol(m_xSymbols->get_active_text(), m_xCharsetDisplay->GetFont(),
1622 m_xCharsetDisplay->GetSelectCharacter(), m_xSymbolSets->get_active_text());
1623 //OSL_ENSURE( m_aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL, "symbol already exists" );
1624 m_aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol );
1625
1626 // update display of new symbol
1627 m_aSymbolDisplay.SetSymbol( &aNewSymbol );
1628 m_xSymbolName->set_label(aNewSymbol.GetName());
1629 m_xSymbolSetName->set_label(aNewSymbol.GetSymbolSetName());
1630
1631 // update list box entries
1632 FillSymbolSets(*m_xOldSymbolSets, false);
1633 FillSymbolSets(*m_xSymbolSets, false);
1634 FillSymbols(*m_xOldSymbols, false);
1635 FillSymbols(*m_xSymbols, false);
1636
1637 UpdateButtons();
1638}
1639
1640IMPL_LINK( SmSymDefineDialog, ChangeClickHdl, weld::Button&, rButton, void )
1641{
1642 (void) rButton;
1643 assert(&rButton == m_xChangeBtn.get() && "Sm : wrong argument");
1644 assert(m_xChangeBtn->get_sensitive() && "Sm : requirements met ??");
1645
1646 // get new Symbol to use
1649 const SmSym aNewSymbol(m_xSymbols->get_active_text(), m_xCharsetDisplay->GetFont(),
1650 m_xCharsetDisplay->GetSelectCharacter(), m_xSymbolSets->get_active_text());
1651
1652 // remove old symbol if the name was changed then add new one
1653 const bool bNameChanged = m_xOldSymbols->get_active_text() != m_xSymbols->get_active_text();
1654 if (bNameChanged)
1655 m_aSymbolMgrCopy.RemoveSymbol(m_xOldSymbols->get_active_text());
1656 m_aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol, true );
1657
1658 // clear display for original symbol if necessary
1659 if (bNameChanged)
1660 SetOrigSymbol(nullptr, OUString());
1661
1662 // update display of new symbol
1663 m_aSymbolDisplay.SetSymbol(&aNewSymbol);
1664 m_xSymbolName->set_label(aNewSymbol.GetName());
1665 m_xSymbolSetName->set_label(aNewSymbol.GetSymbolSetName());
1666
1667 // update list box entries
1668 FillSymbolSets(*m_xOldSymbolSets, false);
1669 FillSymbolSets(*m_xSymbolSets, false);
1670 FillSymbols(*m_xOldSymbols, false);
1671 FillSymbols(*m_xSymbols, false);
1672
1673 UpdateButtons();
1674}
1675
1676IMPL_LINK(SmSymDefineDialog, DeleteClickHdl, weld::Button&, rButton, void)
1677{
1678 (void) rButton;
1679 assert(&rButton == m_xDeleteBtn.get() && "Sm : wrong argument");
1680 assert(m_xDeleteBtn->get_sensitive() && "Sm : requirements met ??");
1681
1682 if (m_xOrigSymbol)
1683 {
1684 m_aSymbolMgrCopy.RemoveSymbol(m_xOrigSymbol->GetName());
1685
1686 // clear display for original symbol
1687 SetOrigSymbol(nullptr, OUString());
1688
1689 // update list box entries
1690 FillSymbolSets(*m_xOldSymbolSets, false);
1691 FillSymbolSets(*m_xSymbolSets, false);
1692 FillSymbols(*m_xOldSymbols ,false);
1693 FillSymbols(*m_xSymbols ,false);
1694 }
1695
1696 UpdateButtons();
1697}
1698
1700{
1701 bool bAdd = false,
1702 bChange = false,
1703 bDelete = false;
1704 OUString aTmpSymbolName(m_xSymbols->get_active_text()),
1705 aTmpSymbolSetName(m_xSymbolSets->get_active_text());
1706
1707 if (!aTmpSymbolName.isEmpty() && !aTmpSymbolSetName.isEmpty())
1708 {
1709 // are all settings equal?
1711 bool bEqual = m_xOrigSymbol
1712 && aTmpSymbolSetName.equalsIgnoreAsciiCase(m_xOldSymbolSetName->get_label())
1713 && aTmpSymbolName == m_xOrigSymbol->GetName()
1714 && m_xFonts->get_active_text().equalsIgnoreAsciiCase(
1715 m_xOrigSymbol->GetFace().GetFamilyName())
1716 && m_xStyles->get_active_text().equalsIgnoreAsciiCase(
1717 GetFontStyles().GetStyleName(m_xOrigSymbol->GetFace()))
1718 && m_xCharsetDisplay->GetSelectCharacter() == m_xOrigSymbol->GetCharacter();
1719
1720 // only add it if there isn't already a symbol with the same name
1721 bAdd = m_aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == nullptr;
1722
1723 // only delete it if all settings are equal
1724 bDelete = bool(m_xOrigSymbol);
1725
1726 // only change it if the old symbol exists and the new one is different
1727 bChange = m_xOrigSymbol && !bEqual;
1728 }
1729
1730 m_xAddBtn->set_sensitive(bAdd);
1731 m_xChangeBtn->set_sensitive(bChange);
1732 m_xDeleteBtn->set_sensitive(bDelete);
1733}
1734
1736 : GenericDialogController(pParent, "modules/smath/ui/symdefinedialog.ui", "EditSymbols")
1737 , m_xVirDev(VclPtr<VirtualDevice>::Create())
1738 , m_rSymbolMgr(rMgr)
1739 , m_xFontList(new FontList(pFntListDevice))
1740 , m_xOldSymbols(m_xBuilder->weld_combo_box("oldSymbols"))
1741 , m_xOldSymbolSets(m_xBuilder->weld_combo_box("oldSymbolSets"))
1742 , m_xSymbols(m_xBuilder->weld_combo_box("symbols"))
1743 , m_xSymbolSets(m_xBuilder->weld_combo_box("symbolSets"))
1744 , m_xFonts(m_xBuilder->weld_combo_box("fonts"))
1745 , m_xFontsSubsetLB(m_xBuilder->weld_combo_box("fontsSubsetLB"))
1746 , m_xStyles(m_xBuilder->weld_combo_box("styles"))
1747 , m_xOldSymbolName(m_xBuilder->weld_label("oldSymbolName"))
1748 , m_xOldSymbolSetName(m_xBuilder->weld_label("oldSymbolSetName"))
1749 , m_xSymbolName(m_xBuilder->weld_label("symbolName"))
1750 , m_xSymbolSetName(m_xBuilder->weld_label("symbolSetName"))
1751 , m_xAddBtn(m_xBuilder->weld_button("add"))
1752 , m_xChangeBtn(m_xBuilder->weld_button("modify"))
1753 , m_xDeleteBtn(m_xBuilder->weld_button("delete"))
1754 , m_xOldSymbolDisplay(new weld::CustomWeld(*m_xBuilder, "oldSymbolDisplay", m_aOldSymbolDisplay))
1755 , m_xSymbolDisplay(new weld::CustomWeld(*m_xBuilder, "symbolDisplay", m_aSymbolDisplay))
1756 , m_xCharsetDisplay(new SvxShowCharSet(m_xBuilder->weld_scrolled_window("showscroll", true), m_xVirDev))
1757 , m_xCharsetDisplayArea(new weld::CustomWeld(*m_xBuilder, "charsetDisplay", *m_xCharsetDisplay))
1758{
1759 // auto completion is troublesome since that symbols character also gets automatically selected in the
1760 // display and if the user previously selected a character to define/redefine that one this is bad
1761 m_xOldSymbols->set_entry_completion(false);
1762 m_xSymbols->set_entry_completion(false);
1763
1764 FillFonts();
1765 if (m_xFonts->get_count() > 0)
1766 SelectFont(m_xFonts->get_text(0));
1767
1769
1770 m_xOldSymbols->connect_changed(LINK(this, SmSymDefineDialog, OldSymbolChangeHdl));
1771 m_xOldSymbolSets->connect_changed(LINK(this, SmSymDefineDialog, OldSymbolSetChangeHdl));
1772 m_xSymbolSets->connect_changed(LINK(this, SmSymDefineDialog, ModifyHdl));
1773 m_xOldSymbolSets->connect_changed(LINK(this, SmSymDefineDialog, ModifyHdl));
1774 m_xSymbols->connect_changed(LINK(this, SmSymDefineDialog, ModifyHdl));
1775 m_xOldSymbols->connect_changed(LINK(this, SmSymDefineDialog, ModifyHdl));
1776 m_xStyles->connect_changed(LINK(this, SmSymDefineDialog, ModifyHdl));
1777 m_xFonts->connect_changed(LINK(this, SmSymDefineDialog, FontChangeHdl));
1778 m_xFontsSubsetLB->connect_changed(LINK(this, SmSymDefineDialog, SubsetChangeHdl));
1779 m_xStyles->connect_changed(LINK(this, SmSymDefineDialog, StyleChangeHdl));
1780 m_xAddBtn->connect_clicked(LINK(this, SmSymDefineDialog, AddClickHdl));
1781 m_xChangeBtn->connect_clicked(LINK(this, SmSymDefineDialog, ChangeClickHdl));
1782 m_xDeleteBtn->connect_clicked(LINK(this, SmSymDefineDialog, DeleteClickHdl));
1783 m_xCharsetDisplay->SetHighlightHdl( LINK( this, SmSymDefineDialog, CharHighlightHdl ) );
1784}
1785
1787{
1788}
1789
1791{
1792 short nResult = GenericDialogController::run();
1793
1794 // apply changes if dialog was closed by clicking OK
1795 if (m_aSymbolMgrCopy.IsModified() && nResult == RET_OK)
1797
1798 return nResult;
1799}
1800
1802{
1803 m_aSymbolMgrCopy = rMgr;
1804
1805 // Set the modified flag of the copy to false so that
1806 // we can check later on if anything has been changed
1808
1810 if (m_xOldSymbolSets->get_count() > 0)
1811 SelectSymbolSet(m_xOldSymbolSets->get_text(0));
1813 if (m_xSymbolSets->get_count() > 0)
1814 SelectSymbolSet(m_xSymbolSets->get_text(0));
1816 if (m_xOldSymbols->get_count() > 0)
1817 SelectSymbol(m_xOldSymbols->get_text(0));
1819 if (m_xSymbols->get_count() > 0)
1820 SelectSymbol(m_xSymbols->get_text(0));
1821
1822 UpdateButtons();
1823}
1824
1826 std::u16string_view rSymbolSetName, bool bDeleteText)
1827{
1828 assert((&rComboBox == m_xOldSymbolSets.get() || &rComboBox == m_xSymbolSets.get()) && "Sm : wrong ComboBox");
1829
1830 // trim SymbolName (no leading and trailing blanks)
1831 OUString aNormName( comphelper::string::strip(rSymbolSetName, ' ') );
1832 // and remove possible deviations within the input
1833 rComboBox.set_entry_text(aNormName);
1834
1835 bool bRet = false;
1836 int nPos = rComboBox.find_text(aNormName);
1837
1838 if (nPos != -1)
1839 {
1840 rComboBox.set_active(nPos);
1841 bRet = true;
1842 }
1843 else if (bDeleteText)
1844 rComboBox.set_entry_text(OUString());
1845
1846 bool bIsOld = &rComboBox == m_xOldSymbolSets.get();
1847
1848 // setting the SymbolSet name at the associated display
1850 rFT.set_label(rComboBox.get_active_text());
1851
1852 // set the symbol name which belongs to the SymbolSet at the associated combobox
1853 weld::ComboBox& rCB = bIsOld ? *m_xOldSymbols : *m_xSymbols;
1854 FillSymbols(rCB, false);
1855
1856 // display a valid respectively no symbol when changing the SymbolSets
1857 if (bIsOld)
1858 {
1859 OUString aTmpOldSymbolName;
1860 if (m_xOldSymbols->get_count() > 0)
1861 aTmpOldSymbolName = m_xOldSymbols->get_text(0);
1862 SelectSymbol(*m_xOldSymbols, aTmpOldSymbolName, true);
1863 }
1864
1865 UpdateButtons();
1866
1867 return bRet;
1868}
1869
1871 const OUString &rSymbolSetName)
1872{
1873 // clear old symbol
1874 m_xOrigSymbol.reset();
1875
1876 OUString aSymName,
1877 aSymSetName;
1878 if (pSymbol)
1879 {
1880 // set new symbol
1881 m_xOrigSymbol.reset(new SmSym(*pSymbol));
1882
1883 aSymName = pSymbol->GetName();
1884 aSymSetName = rSymbolSetName;
1885 m_aOldSymbolDisplay.SetSymbol( pSymbol );
1886 }
1887 else
1888 { // delete displayed symbols
1889 m_aOldSymbolDisplay.SetText(OUString());
1891 }
1892 m_xOldSymbolName->set_label(aSymName);
1893 m_xOldSymbolSetName->set_label(aSymSetName);
1894}
1895
1896
1898 const OUString &rSymbolName, bool bDeleteText)
1899{
1900 assert((&rComboBox == m_xOldSymbols.get() || &rComboBox == m_xSymbols.get()) && "Sm : wrong ComboBox");
1901
1902 // trim SymbolName (no blanks)
1903 OUString aNormName = rSymbolName.replaceAll(" ", "");
1904 // and remove possible deviations within the input
1905 rComboBox.set_entry_text(aNormName);
1906
1907 bool bRet = false;
1908 int nPos = rComboBox.find_text(aNormName);
1909
1910 bool bIsOld = &rComboBox == m_xOldSymbols.get();
1911
1912 if (nPos != -1)
1913 {
1914 rComboBox.set_active(nPos);
1915
1916 if (!bIsOld)
1917 {
1918 const SmSym *pSymbol = GetSymbol(*m_xSymbols);
1919 if (pSymbol)
1920 {
1921 // choose font and style accordingly
1922 const vcl::Font &rFont = pSymbol->GetFace();
1923 SelectFont(rFont.GetFamilyName(), false);
1924 SelectStyle(GetFontStyles().GetStyleName(rFont), false);
1925
1926 // Since setting the Font via the Style name of the SymbolFonts doesn't
1927 // work really well (e.g. it can be empty even though the font itself is
1928 // bold or italic) we're manually setting the Font with respect to the Symbol
1929 m_xCharsetDisplay->SetFont(rFont);
1931
1932 // select associated character
1933 SelectChar(pSymbol->GetCharacter());
1934
1935 // since SelectChar will also set the unicode point as text in the
1936 // symbols box, we have to set the symbol name again to get that one displayed
1937 m_xSymbols->set_entry_text(pSymbol->GetName());
1938 }
1939 }
1940
1941 bRet = true;
1942 }
1943 else if (bDeleteText)
1944 rComboBox.set_entry_text(OUString());
1945
1946 if (bIsOld)
1947 {
1948 // if there's a change of the old symbol, show only the available ones, otherwise show none
1949 const SmSym *pOldSymbol = nullptr;
1950 OUString aTmpOldSymbolSetName;
1951 if (nPos != -1)
1952 {
1953 pOldSymbol = m_aSymbolMgrCopy.GetSymbolByName(aNormName);
1954 aTmpOldSymbolSetName = m_xOldSymbolSets->get_active_text();
1955 }
1956 SetOrigSymbol(pOldSymbol, aTmpOldSymbolSetName);
1957 }
1958 else
1959 m_xSymbolName->set_label(rComboBox.get_active_text());
1960
1961 UpdateButtons();
1962
1963 return bRet;
1964}
1965
1966
1967void SmSymDefineDialog::SetFont(const OUString &rFontName, std::u16string_view rStyleName)
1968{
1969 // get Font (FontInfo) matching name and style
1970 FontMetric aFontMetric;
1971 if (m_xFontList)
1972 aFontMetric = m_xFontList->Get(rFontName, WEIGHT_NORMAL, ITALIC_NONE);
1973 SetFontStyle(rStyleName, aFontMetric);
1974
1975 m_xCharsetDisplay->SetFont(aFontMetric);
1976 m_aSymbolDisplay.SetFont(aFontMetric);
1977
1978 // update subset listbox for new font's unicode subsets
1979 FontCharMapRef xFontCharMap = m_xCharsetDisplay->GetFontCharMap();
1980 m_xSubsetMap.reset(new SubsetMap( xFontCharMap ));
1981
1982 m_xFontsSubsetLB->clear();
1983 bool bFirst = true;
1984 for (auto & subset : m_xSubsetMap->GetSubsetMap())
1985 {
1986 m_xFontsSubsetLB->append(weld::toId(&subset), subset.GetName());
1987 // subset must live at least as long as the selected font !!!
1988 if (bFirst)
1989 m_xFontsSubsetLB->set_active(0);
1990 bFirst = false;
1991 }
1992 if (bFirst)
1993 m_xFontsSubsetLB->set_active(-1);
1994 m_xFontsSubsetLB->set_sensitive(!bFirst);
1995}
1996
1997bool SmSymDefineDialog::SelectFont(const OUString &rFontName, bool bApplyFont)
1998{
1999 bool bRet = false;
2000 int nPos = m_xFonts->find_text(rFontName);
2001
2002 if (nPos != -1)
2003 {
2004 m_xFonts->set_active(nPos);
2005 if (m_xStyles->get_count() > 0)
2006 SelectStyle(m_xStyles->get_text(0));
2007 if (bApplyFont)
2008 {
2009 SetFont(m_xFonts->get_active_text(), m_xStyles->get_active_text());
2010 m_aSymbolDisplay.SetSymbol(m_xCharsetDisplay->GetSelectCharacter(), m_xCharsetDisplay->GetFont());
2011 }
2012 bRet = true;
2013 }
2014 else
2015 m_xFonts->set_active(-1);
2016 FillStyles();
2017
2018 UpdateButtons();
2019
2020 return bRet;
2021}
2022
2023
2024bool SmSymDefineDialog::SelectStyle(const OUString &rStyleName, bool bApplyFont)
2025{
2026 bool bRet = false;
2027 int nPos = m_xStyles->find_text(rStyleName);
2028
2029 // if the style is not available take the first available one (if existent)
2030 if (nPos == -1 && m_xStyles->get_count() > 0)
2031 nPos = 0;
2032
2033 if (nPos != -1)
2034 {
2035 m_xStyles->set_active(nPos);
2036 if (bApplyFont)
2037 {
2038 SetFont(m_xFonts->get_active_text(), m_xStyles->get_active_text());
2039 m_aSymbolDisplay.SetSymbol(m_xCharsetDisplay->GetSelectCharacter(), m_xCharsetDisplay->GetFont());
2040 }
2041 bRet = true;
2042 }
2043 else
2044 m_xStyles->set_entry_text(OUString());
2045
2046 UpdateButtons();
2047
2048 return bRet;
2049}
2050
2052{
2053 m_xCharsetDisplay->SelectCharacter( cChar );
2054 m_aSymbolDisplay.SetSymbol(cChar, m_xCharsetDisplay->GetFont());
2055
2056 UpdateButtons();
2057}
2058
2059/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::lang::XComponent > m_xFrame
Reference< XExecutableDialog > m_xDialog
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
size_t GetFontNameCount() const
const FontMetric & GetFontName(size_t nFont) const
const vcl::KeyCode & GetKeyCode() const
sal_uInt16 GetClicks() const
const Point & GetPosPixel() const
bool IsLeft() const
Size GetOutputSize() const
const vcl::Font & GetFont() const
float GetDPIScaleFactor() const
void SetFont(const vcl::Font &rNewFont)
void DrawRect(const tools::Rectangle &rRect)
void Invert(const tools::Rectangle &rRect, InvertFlags nFlags=InvertFlags::NONE)
void SetMapMode()
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
void SetTextColor(const Color &rColor)
void SetFillColor()
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
const Color & GetTextColor() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
tools::Long GetTextHeight() const
void SetBackground()
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
const Color & GetFillColor() const
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
tools::Long AdjustWidth(tools::Long n)
constexpr tools::Long Width() const
std::unique_ptr< weld::Button > m_xDefaultButton
Definition: dialog.hxx:230
SmAlignDialog(weld::Window *pParent)
Definition: dialog.cxx:905
std::unique_ptr< weld::RadioButton > m_xCenter
Definition: dialog.hxx:228
void WriteTo(SmFormat &rFormat) const
Definition: dialog.cxx:935
std::unique_ptr< weld::RadioButton > m_xLeft
Definition: dialog.hxx:227
std::unique_ptr< weld::RadioButton > m_xRight
Definition: dialog.hxx:229
void ReadFrom(const SmFormat &rFormat)
Definition: dialog.cxx:919
virtual ~SmAlignDialog() override
Definition: dialog.cxx:915
void SetValue(sal_uInt16 Index, sal_uInt16 nVal)
Definition: dialog.hxx:177
sal_uInt16 GetMinimum(sal_uInt16 Index)
Definition: dialog.hxx:174
std::unique_ptr< weld::Widget > Graphics[4]
Definition: dialog.hxx:163
const OUString & GetString(sal_uInt16 Index) const
Definition: dialog.hxx:173
OUString Strings[4]
Definition: dialog.hxx:162
sal_uInt16 Maximum[4]
Definition: dialog.hxx:165
OUString Name
Definition: dialog.hxx:161
sal_uInt16 GetValue(sal_uInt16 Index) const
Definition: dialog.hxx:176
SmCategoryDesc(weld::Builder &rBuilder, sal_uInt16 nCategoryIdx)
Definition: dialog.cxx:584
sal_uInt16 GetMaximum(sal_uInt16 Index)
Definition: dialog.hxx:175
sal_uInt16 Value[4]
Definition: dialog.hxx:166
sal_uInt16 Minimum[4]
Definition: dialog.hxx:164
std::unique_ptr< weld::Label > m_xFixedText3
Definition: dialog.hxx:192
std::unique_ptr< weld::MenuButton > m_xMenuButton
Definition: dialog.hxx:197
virtual ~SmDistanceDialog() override
Definition: dialog.cxx:817
std::unique_ptr< weld::MetricSpinButton > m_xMetricField1
Definition: dialog.hxx:189
std::unique_ptr< weld::CheckButton > m_xCheckBox1
Definition: dialog.hxx:194
std::unique_ptr< weld::Frame > m_xFrame
Definition: dialog.hxx:187
std::unique_ptr< weld::Label > m_xFixedText1
Definition: dialog.hxx:188
std::unique_ptr< weld::MetricSpinButton > m_xMetricField2
Definition: dialog.hxx:191
SmDistanceDialog(weld::Window *pParent)
Definition: dialog.cxx:783
std::unique_ptr< weld::MetricSpinButton > m_xMetricField4
Definition: dialog.hxx:196
std::unique_ptr< weld::Label > m_xFixedText4
Definition: dialog.hxx:195
void ReadFrom(const SmFormat &rFormat)
Definition: dialog.cxx:821
std::unique_ptr< weld::MetricSpinButton > m_xMetricField3
Definition: dialog.hxx:193
void SetCategory(sal_uInt16 Category)
Definition: dialog.cxx:670
void WriteTo(SmFormat &rFormat)
Definition: dialog.cxx:857
bool bScaleAllBrackets
Definition: dialog.hxx:205
std::unique_ptr< SmCategoryDesc > m_xCategories[NOCATEGORIES]
Definition: dialog.hxx:203
std::unique_ptr< weld::Button > m_xDefaultButton
Definition: dialog.hxx:198
std::unique_ptr< weld::Label > m_xFixedText2
Definition: dialog.hxx:190
sal_uInt16 nActiveCategory
Definition: dialog.hxx:204
SmFontDialog(weld::Window *pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes)
Definition: dialog.cxx:307
SmShowFont m_aShowFont
Definition: dialog.hxx:85
vcl::Font maFont
Definition: dialog.hxx:84
std::unique_ptr< weld::CheckButton > m_xItalicCheckBox
Definition: dialog.hxx:89
void SetFont(const vcl::Font &rFont)
Definition: dialog.cxx:297
std::unique_ptr< weld::EntryTreeView > m_xFontBox
Definition: dialog.hxx:86
std::unique_ptr< weld::Widget > m_xAttrFrame
Definition: dialog.hxx:87
std::unique_ptr< weld::CheckButton > m_xBoldCheckBox
Definition: dialog.hxx:88
virtual ~SmFontDialog() override
Definition: dialog.cxx:350
void ReadFrom(const SmFontDialog &rDialog)
Definition: utility.cxx:114
void WriteTo(SmFontDialog &rDialog) const
Definition: utility.cxx:119
SmFontSizeDialog(weld::Window *pParent)
Definition: dialog.cxx:380
virtual ~SmFontSizeDialog() override
Definition: dialog.cxx:393
void ReadFrom(const SmFormat &rFormat)
Definition: dialog.cxx:397
std::unique_ptr< weld::Button > m_xDefaultButton
Definition: dialog.hxx:116
std::unique_ptr< weld::MetricSpinButton > m_xTextSize
Definition: dialog.hxx:111
std::unique_ptr< weld::MetricSpinButton > m_xBaseSize
Definition: dialog.hxx:110
std::unique_ptr< weld::MetricSpinButton > m_xOperatorSize
Definition: dialog.hxx:114
void WriteTo(SmFormat &rFormat) const
Definition: dialog.cxx:411
std::unique_ptr< weld::MetricSpinButton > m_xBorderSize
Definition: dialog.hxx:115
std::unique_ptr< weld::MetricSpinButton > m_xIndexSize
Definition: dialog.hxx:112
std::unique_ptr< weld::MetricSpinButton > m_xFunctionSize
Definition: dialog.hxx:113
virtual ~SmFontTypeDialog() override
Definition: dialog.cxx:498
std::unique_ptr< SmFontPickListBox > m_xVariableFont
Definition: dialog.hxx:134
std::unique_ptr< SmFontPickListBox > m_xSerifFont
Definition: dialog.hxx:138
std::unique_ptr< SmFontPickListBox > m_xFixedFont
Definition: dialog.hxx:140
std::unique_ptr< SmFontPickListBox > m_xFunctionFont
Definition: dialog.hxx:135
std::unique_ptr< weld::Button > m_xDefaultButton
Definition: dialog.hxx:142
std::unique_ptr< weld::MenuButton > m_xMenuButton
Definition: dialog.hxx:141
std::unique_ptr< SmFontPickListBox > m_xTextFont
Definition: dialog.hxx:137
SmFontTypeDialog(weld::Window *pParent, OutputDevice *pFntListDevice)
Definition: dialog.cxx:481
std::unique_ptr< SmFontPickListBox > m_xSansFont
Definition: dialog.hxx:139
void ReadFrom(const SmFormat &rFormat)
Definition: dialog.cxx:502
void WriteTo(SmFormat &rFormat) const
Definition: dialog.cxx:524
std::unique_ptr< SmFontPickListBox > m_xNumberFont
Definition: dialog.hxx:136
const Size & GetBaseSize() const
Definition: format.hxx:107
const SmFace & GetFont(sal_uInt16 nIdent) const
Definition: format.hxx:110
sal_uInt16 GetRelSize(sal_uInt16 nIdent) const
Definition: format.hxx:117
void SetRelSize(sal_uInt16 nIdent, sal_uInt16 nVal)
Definition: format.hxx:118
bool IsScaleNormalBrackets() const
Definition: format.hxx:132
void SetHorAlign(SmHorAlign eAlign)
Definition: format.hxx:124
void SetScaleNormalBrackets(bool bVal)
Definition: format.hxx:133
void SetFontSize(sal_uInt16 nIdent, const Size &rSize)
Definition: format.hxx:112
void SetFont(sal_uInt16 nIdent, const SmFace &rFont, bool bDefault=false)
Definition: format.cxx:91
sal_uInt16 GetDistance(sal_uInt16 nIdent) const
Definition: format.hxx:120
void SetDistance(sal_uInt16 nIdent, sal_uInt16 nVal)
Definition: format.hxx:121
SmHorAlign GetHorAlign() const
Definition: format.hxx:123
void SetBaseSize(const Size &rSize)
Definition: format.hxx:108
void RequestApplyChanges()
Definition: format.hxx:140
const SmFormat & GetStandardFormat() const
Definition: cfgitem.cxx:1093
SmFontPickList & GetFontPickList(sal_uInt16 nIdent)
Definition: cfgitem.hxx:199
void SetStandardFormat(const SmFormat &rFormat, bool bSaveFontFormatList=false)
Definition: cfgitem.cxx:1101
SmMathConfig * GetConfig()
Definition: smmod.cxx:162
virtual ~SmPrintOptionsTabPage() override
Definition: dialog.cxx:182
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: dialog.cxx:189
SmPrintOptionsTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rOptions)
Definition: dialog.cxx:161
std::unique_ptr< weld::RadioButton > m_xSizeScaled
Definition: dialog.hxx:46
std::unique_ptr< weld::MetricSpinButton > m_xSmZoom
Definition: dialog.hxx:52
std::unique_ptr< weld::CheckButton > m_xNoRightSpaces
Definition: dialog.hxx:49
std::unique_ptr< weld::MetricSpinButton > m_xZoom
Definition: dialog.hxx:48
std::unique_ptr< weld::RadioButton > m_xSizeNormal
Definition: dialog.hxx:45
std::unique_ptr< weld::CheckButton > m_xText
Definition: dialog.hxx:43
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: dialog.cxx:237
std::unique_ptr< weld::CheckButton > m_xAutoCloseBrackets
Definition: dialog.hxx:51
std::unique_ptr< weld::CheckButton > m_xTitle
Definition: dialog.hxx:42
virtual void Reset(const SfxItemSet *rSet) override
Definition: dialog.cxx:216
std::unique_ptr< weld::CheckButton > m_xSaveOnlyUsedSymbols
Definition: dialog.hxx:50
std::unique_ptr< weld::RadioButton > m_xSizeZoomed
Definition: dialog.hxx:47
std::unique_ptr< weld::CheckButton > m_xFrame
Definition: dialog.hxx:44
const OUString & GetText() const
Definition: dialog.hxx:384
vcl::Font m_aFont
Definition: dialog.hxx:364
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &) override
Definition: dialog.cxx:1399
void SetSymbol(const SmSym *pSym)
Definition: dialog.cxx:1430
const vcl::Font & GetFont() const
Definition: dialog.hxx:386
void SetFont(const vcl::Font &rFont)
Definition: dialog.hxx:385
void SetText(const OUString &rText)
Definition: dialog.hxx:383
virtual void Resize() override
Definition: dialog.cxx:1390
void SetFont(const vcl::Font &rFont)
Definition: dialog.cxx:270
vcl::Font maFont
Definition: dialog.hxx:72
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &) override
Definition: dialog.cxx:242
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: dialog.cxx:263
void SetSymbolSet(const SymbolPtrVec_t &rSymbolSet)
Definition: dialog.cxx:1113
void calccols(const vcl::RenderContext &rRenderContext)
Definition: dialog.cxx:1095
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dialog.cxx:1029
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: dialog.cxx:1055
Point OffsetPoint(const Point &rPoint) const
Definition: dialog.cxx:959
tools::Long nYOffset
Definition: dialog.hxx:252
tools::Long nXOffset
Definition: dialog.hxx:252
void SetScrollBarRange()
Definition: dialog.cxx:1120
SymbolPtrVec_t aSymbolSet
Definition: dialog.hxx:247
sal_Int32 nColumns
Definition: dialog.hxx:251
void SelectSymbol(sal_uInt16 nSymbol)
Definition: dialog.cxx:1127
sal_Int32 nRows
Definition: dialog.hxx:251
std::unique_ptr< weld::ScrolledWindow > m_xScrolledWindow
Definition: dialog.hxx:254
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dialog.cxx:975
SmShowSymbolSet(std::unique_ptr< weld::ScrolledWindow > pScrolledWindow)
Definition: dialog.cxx:947
tools::Long nLen
Definition: dialog.hxx:250
Link< SmShowSymbolSet &, void > aSelectHdlLink
Definition: dialog.hxx:248
sal_uInt16 nSelectSymbol
Definition: dialog.hxx:253
virtual void Resize() override
Definition: dialog.cxx:964
Link< SmShowSymbolSet &, void > aDblClickHdlLink
Definition: dialog.hxx:249
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dialog.cxx:1190
void SetText(const OUString &rText)
Definition: dialog.hxx:310
Link< SmShowSymbol &, void > aDblClickHdlLink
Definition: dialog.hxx:293
void SetSymbol(const SmSym *pSymbol)
Definition: dialog.cxx:1197
void setFontSize(vcl::Font &rFont) const
Definition: dialog.cxx:1164
const OUString & GetText() const
Definition: dialog.hxx:311
const vcl::Font & GetFont() const
Definition: dialog.hxx:314
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &) override
Definition: dialog.cxx:1170
void SetFont(const vcl::Font &rFont)
Definition: dialog.hxx:313
void SetDblClickHdl(const Link< SmShowSymbol &, void > &rLink)
Definition: dialog.hxx:317
SmSym * GetSymbol(const weld::ComboBox &rComboBox)
Definition: dialog.cxx:1512
std::unique_ptr< weld::ComboBox > m_xOldSymbols
Definition: dialog.hxx:399
std::unique_ptr< SvxShowCharSet > m_xCharsetDisplay
Definition: dialog.hxx:415
std::unique_ptr< weld::Button > m_xAddBtn
Definition: dialog.hxx:410
std::unique_ptr< weld::ComboBox > m_xFontsSubsetLB
Definition: dialog.hxx:404
virtual ~SmSymDefineDialog() override
Definition: dialog.cxx:1786
bool SelectFont(const OUString &rFontName, bool bApplyFont)
Definition: dialog.cxx:1997
std::unique_ptr< weld::Label > m_xSymbolSetName
Definition: dialog.hxx:409
void SetFont(const OUString &rFontName, std::u16string_view rStyleName)
Definition: dialog.cxx:1967
std::unique_ptr< FontList > m_xFontList
Definition: dialog.hxx:398
SmSymbolManager & m_rSymbolMgr
Definition: dialog.hxx:393
void UpdateButtons()
Definition: dialog.cxx:1699
std::unique_ptr< weld::ComboBox > m_xSymbolSets
Definition: dialog.hxx:402
bool SelectStyle(const OUString &rStyleName, bool bApplyFont)
Definition: dialog.cxx:2024
bool SelectSymbolSet(weld::ComboBox &rComboBox, std::u16string_view rSymbolSetName, bool bDeleteText)
Definition: dialog.cxx:1825
bool SelectSymbol(weld::ComboBox &rComboBox, const OUString &rSymbolName, bool bDeleteText)
Definition: dialog.cxx:1897
std::unique_ptr< weld::Button > m_xDeleteBtn
Definition: dialog.hxx:412
std::unique_ptr< weld::ComboBox > m_xSymbols
Definition: dialog.hxx:401
void SelectOldSymbol(const OUString &rSymbolName)
Definition: dialog.hxx:463
std::unique_ptr< SubsetMap > m_xSubsetMap
Definition: dialog.hxx:397
std::unique_ptr< weld::Label > m_xOldSymbolSetName
Definition: dialog.hxx:407
void SetSymbolSetManager(const SmSymbolManager &rMgr)
Definition: dialog.cxx:1801
void FillSymbols(weld::ComboBox &rComboBox, bool bDeleteText=true)
Definition: dialog.cxx:1451
std::unique_ptr< weld::ComboBox > m_xOldSymbolSets
Definition: dialog.hxx:400
std::unique_ptr< weld::ComboBox > m_xFonts
Definition: dialog.hxx:403
SmShowChar m_aSymbolDisplay
Definition: dialog.hxx:395
std::unique_ptr< weld::Button > m_xChangeBtn
Definition: dialog.hxx:411
std::unique_ptr< weld::Label > m_xOldSymbolName
Definition: dialog.hxx:406
void SelectOldSymbolSet(std::u16string_view rSymbolSetName)
Definition: dialog.hxx:458
virtual short run() override
Definition: dialog.cxx:1790
SmSymDefineDialog(weld::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr)
Definition: dialog.cxx:1735
std::unique_ptr< SmSym > m_xOrigSymbol
Definition: dialog.hxx:396
void FillSymbolSets(weld::ComboBox &rComboBox, bool bDeleteText=true)
Definition: dialog.cxx:1465
std::unique_ptr< weld::Label > m_xSymbolName
Definition: dialog.hxx:408
SmShowChar m_aOldSymbolDisplay
Definition: dialog.hxx:394
void SetOrigSymbol(const SmSym *pSymbol, const OUString &rSymbolSetName)
Definition: dialog.cxx:1870
SmSymbolManager m_aSymbolMgrCopy
Definition: dialog.hxx:392
std::unique_ptr< weld::ComboBox > m_xStyles
Definition: dialog.hxx:405
void SelectChar(sal_Unicode cChar)
Definition: dialog.cxx:2051
Definition: symbol.hxx:37
const OUString & GetSymbolSetName() const
Definition: symbol.hxx:59
const OUString & GetName() const
Definition: symbol.hxx:56
sal_UCS4 GetCharacter() const
Definition: symbol.hxx:55
const vcl::Font & GetFace() const
Definition: symbol.hxx:54
SmShowSymbol m_aSymbolDisplay
Definition: dialog.hxx:330
SmSymbolDialog(weld::Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell)
Definition: dialog.cxx:1304
virtual ~SmSymbolDialog() override
Definition: dialog.cxx:1334
OUString aSymbolSetName
Definition: dialog.hxx:325
const SmSym * GetSymbol() const
Definition: dialog.cxx:1383
void SelectSymbol(sal_uInt16 nSymbolPos)
Definition: dialog.cxx:1372
std::unique_ptr< weld::Button > m_xGetBtn
Definition: dialog.hxx:337
SymbolPtrVec_t aSymbolSet
Definition: dialog.hxx:326
void FillSymbolSets()
Definition: dialog.cxx:1213
std::unique_ptr< weld::ComboBox > m_xSymbolSets
Definition: dialog.hxx:332
SmSymbolManager & rSymbolMgr
Definition: dialog.hxx:323
std::unique_ptr< weld::Button > m_xEditBtn
Definition: dialog.hxx:338
bool SelectSymbolSet(const OUString &rSymbolSetName)
Definition: dialog.cxx:1338
std::unique_ptr< SmShowSymbolSet > m_xSymbolSetDisplay
Definition: dialog.hxx:333
void SymbolDblClickHdl()
Definition: dialog.cxx:1285
std::unique_ptr< weld::Label > m_xSymbolName
Definition: dialog.hxx:335
SymbolPtrVec_t GetSymbolSet(std::u16string_view rSymbolSetName)
Definition: symbol.cxx:189
bool IsModified() const
Definition: symbol.hxx:101
SmSym * GetSymbolByName(const OUString &rSymbolName)
Definition: symbol.cxx:112
std::set< OUString > GetSymbolSetNames() const
Definition: symbol.cxx:180
void SetModified(bool bModify)
Definition: symbol.hxx:102
const Color & GetWindowColor() const
const Color & GetDialogTextColor() const
const Color & GetFieldTextColor() const
bool GetHighContrastMode() const
const Color & GetFieldColor() const
const Color & GetLabelTextColor() const
const Color & GetFaceColor() const
sal_UCS4 GetRangeMin() const
const OUString & GetName() const
void SetFontSize(const Size &)
void SetPitch(FontPitch ePitch)
void SetTransparent(bool bTransparent)
void SetItalic(FontItalic)
void SetWeight(FontWeight)
const OUString & GetFamilyName() const
void SetFamily(FontFamily)
void SetCharSet(rtl_TextEncoding)
void SetAlignment(TextAlign)
sal_uInt16 GetCode() const
virtual std::unique_ptr< Label > weld_label(const OUString &id)=0
virtual std::unique_ptr< Widget > weld_widget(const OUString &id)=0
virtual int find_text(const OUString &rStr) const=0
virtual OUString get_active_text() const=0
virtual void clear()=0
virtual void set_entry_text(const OUString &rStr)=0
virtual void set_active(int pos)=0
void append_text(const OUString &rStr)
weld::DrawingArea * GetDrawingArea() const
Size const & GetOutputSizePixel() const
virtual short run()
virtual OutputDevice & get_ref_device()=0
std::shared_ptr< weld::Dialog > m_xDialog
std::unique_ptr< weld::Builder > m_xBuilder
virtual void set_label(const OUString &rText)=0
void set_help_id(const OUString &rName)
void set_range(sal_Int64 min, sal_Int64 max, FieldUnit eValueUnit)
void set_visible(bool bShow)
void set_sensitive(bool sensitive)
void set_unit(FieldUnit eUnit)
void set_digits(unsigned int digits)
void set_value(sal_Int64 nValue, FieldUnit eValueUnit)
virtual void set_sensitive(bool sensitive)=0
virtual void set_size_request(int nWidth, int nHeight)=0
virtual void set_visible(bool visible)
int nCount
const FieldMinMax pMinMaxData[10][4]
Definition: dialog.cxx:560
static const SmFontStyles & GetFontStyles()
Definition: dialog.cxx:130
IMPL_LINK(SmFontDialog, FontSelectHdl, weld::ComboBox &, rComboBox, void)
Definition: dialog.cxx:276
void SetFontStyle(std::u16string_view rStyleName, vcl::Font &rFont)
Definition: dialog.cxx:136
IMPL_LINK_NOARG(SmPrintOptionsTabPage, SizeButtonClickHdl, weld::Toggleable &, void)
Definition: dialog.cxx:156
#define CATEGORY_NONE
Definition: dialog.hxx:32
#define NOCATEGORIES
Definition: dialog.hxx:157
virtual OUString GetName() const override
float v
float u
FieldUnit
PITCH_DONTKNOW
ITALIC_NORMAL
ITALIC_NONE
ALIGN_TOP
ALIGN_BASELINE
FAMILY_DONTKNOW
WEIGHT_BOLD
WEIGHT_NORMAL
#define FNT_SERIF
Definition: format.hxx:50
#define DIS_NUMERATOR
Definition: format.hxx:63
#define DIS_HORIZONTAL
Definition: format.hxx:58
#define DIS_BOTTOMSPACE
Definition: format.hxx:80
#define DIS_SUPERSCRIPT
Definition: format.hxx:61
#define DIS_BRACKETSIZE
Definition: format.hxx:69
#define DIS_BRACKETSPACE
Definition: format.hxx:70
#define DIS_TOPSPACE
Definition: format.hxx:79
#define FNT_FIXED
Definition: format.hxx:52
#define DIS_MATRIXCOL
Definition: format.hxx:72
#define DIS_SUBSCRIPT
Definition: format.hxx:62
#define DIS_OPERATORSIZE
Definition: format.hxx:75
#define SIZ_OPERATOR
Definition: format.hxx:40
#define SIZ_FUNCTION
Definition: format.hxx:39
#define SIZ_INDEX
Definition: format.hxx:38
#define DIS_NORMALBRACKETSIZE
Definition: format.hxx:81
#define DIS_LOWERLIMIT
Definition: format.hxx:68
#define DIS_OPERATORSPACE
Definition: format.hxx:76
#define DIS_STROKEWIDTH
Definition: format.hxx:66
#define DIS_RIGHTSPACE
Definition: format.hxx:78
#define DIS_DENOMINATOR
Definition: format.hxx:64
#define DIS_UPPERLIMIT
Definition: format.hxx:67
#define FNT_FUNCTION
Definition: format.hxx:47
#define FNT_NUMBER
Definition: format.hxx:48
#define FNT_BEGIN
Definition: format.hxx:45
#define DIS_FRACTION
Definition: format.hxx:65
#define FNT_TEXT
Definition: format.hxx:49
#define DIS_VERTICAL
Definition: format.hxx:59
#define DIS_ORNAMENTSPACE
Definition: format.hxx:74
#define FNT_END
Definition: format.hxx:54
#define SIZ_TEXT
Definition: format.hxx:37
#define DIS_LEFTSPACE
Definition: format.hxx:77
#define SIZ_LIMITS
Definition: format.hxx:41
#define DIS_MATRIXROW
Definition: format.hxx:71
#define DIS_ORNAMENTSIZE
Definition: format.hxx:73
#define FNT_SANS
Definition: format.hxx:51
#define DIS_ROOT
Definition: format.hxx:60
#define FNT_VARIABLE
Definition: format.hxx:46
constexpr OUStringLiteral HID_SMA_UPPERLIMIT_DIST
Definition: helpids.h:39
constexpr OUStringLiteral HID_SMA_BRACKET_EXCHEIGHT2
Definition: helpids.h:53
constexpr OUStringLiteral HID_SMA_LOWERLIMIT_DIST
Definition: helpids.h:40
constexpr OUStringLiteral HID_SMA_MATRIXCOL_DIST
Definition: helpids.h:44
constexpr OUStringLiteral HID_SMA_BRACKET_DIST
Definition: helpids.h:42
constexpr OUStringLiteral HID_SMA_INTERATTRIBUT_DIST
Definition: helpids.h:46
constexpr OUStringLiteral HID_SMA_LINE_DIST
Definition: helpids.h:31
constexpr OUStringLiteral HID_SMA_OPERATOR_DIST
Definition: helpids.h:48
constexpr OUStringLiteral HID_SMA_LEFTBORDER_DIST
Definition: helpids.h:49
constexpr OUStringLiteral HID_SMA_NUMERATOR_DIST
Definition: helpids.h:35
constexpr OUStringLiteral HID_SMA_BRACKET_EXCHEIGHT
Definition: helpids.h:41
constexpr OUStringLiteral HID_SMA_ROOT_DIST
Definition: helpids.h:32
constexpr OUStringLiteral HID_SMA_FRACLINE_LINEWIDTH
Definition: helpids.h:38
constexpr OUStringLiteral HID_SMA_DEFAULT_DIST
Definition: helpids.h:30
constexpr OUStringLiteral HID_SMA_FRACLINE_EXCWIDTH
Definition: helpids.h:37
constexpr OUStringLiteral HID_SMA_ATTRIBUT_DIST
Definition: helpids.h:45
constexpr OUStringLiteral HID_SMA_OPERATOR_EXCHEIGHT
Definition: helpids.h:47
constexpr OUStringLiteral HID_SMA_LOWERBORDER_DIST
Definition: helpids.h:52
constexpr OUStringLiteral HID_SMA_UPPERBORDER_DIST
Definition: helpids.h:51
constexpr OUStringLiteral HID_SMA_SUP_DIST
Definition: helpids.h:33
constexpr OUStringLiteral HID_SMA_DENOMINATOR_DIST
Definition: helpids.h:36
constexpr OUStringLiteral HID_SMA_RIGHTBORDER_DIST
Definition: helpids.h:50
constexpr OUStringLiteral HID_SMA_MATRIXROW_DIST
Definition: helpids.h:43
constexpr OUStringLiteral HID_SMA_SUB_DIST
Definition: helpids.h:34
sal_Int32 nIndex
sal_Int64 n
constexpr sal_uInt16 KEY_HOME
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_PAGEDOWN
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_PAGEUP
constexpr sal_uInt16 KEY_END
sal_uInt16 nPos
#define SAL_WARN(area, stream)
OString strip(const OString &rIn, char c)
int i
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
constexpr T & temporary(T &&x)
constexpr OUStringLiteral EMPTY
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
OUString toId(const void *pValue)
const char GetValue[]
static SfxItemSet & rSet
OUString SmResId(TranslateId aId)
Definition: smmod.cxx:42
#define SM_MOD()
Definition: smmod.hxx:98
std::vector< const SmSym * > SymbolPtrVec_t
Definition: symbol.hxx:71
#define SYMBOL_NONE
This stuff is used to work with charname.
Definition: symbol.hxx:34
sal_uInt16 sal_Unicode
SmPrintSize
Definition: types.hxx:28
@ PRINT_SIZE_NORMAL
Definition: types.hxx:29
@ PRINT_SIZE_ZOOMED
Definition: types.hxx:31
@ PRINT_SIZE_SCALED
Definition: types.hxx:30
bool IsItalic(const vcl::Font &rFont)
Definition: utility.cxx:176
bool IsBold(const vcl::Font &rFont)
Definition: utility.cxx:184
SmViewShell * SmGetActiveView()
! Since this method is based on the current focus it is somewhat ! unreliable and may return unexpect...
Definition: utility.cxx:33
o3tl::Length SmO3tlLengthUnit()
Definition: utility.hxx:125
constexpr OUStringLiteral PERCENT(u"Percent")
RET_OK
RET_YES
sal_uInt32 sal_UCS4
HFONT SelectFont(HDC hDC, HFONT hFont)