Branch data Line data Source code
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 : :
21 : :
22 : : #define SMDLL 1
23 : : #include "tools/rcid.h"
24 : : #include <comphelper/string.hxx>
25 : : #include <svl/eitem.hxx>
26 : : #include <svl/intitem.hxx>
27 : : #include <svl/stritem.hxx>
28 : : #include <sfx2/app.hxx>
29 : : #include <vcl/msgbox.hxx>
30 : : #include <svtools/ctrltool.hxx>
31 : : #include <sfx2/printer.hxx>
32 : : #include <vcl/help.hxx>
33 : : #include <vcl/waitobj.hxx>
34 : : #include <vcl/settings.hxx>
35 : : #include <vcl/wall.hxx>
36 : : #include <sfx2/dispatch.hxx>
37 : : #include <sfx2/sfx.hrc>
38 : : #include <tools/string.hxx>
39 : : #include <osl/diagnose.h>
40 : : #include <svx/ucsubset.hxx>
41 : :
42 : :
43 : : #include "dialog.hxx"
44 : : #include "starmath.hrc"
45 : : #include "config.hxx"
46 : : #include "dialog.hrc"
47 : : #include "smmod.hxx"
48 : : #include "symbol.hxx"
49 : : #include "view.hxx"
50 : : #include "document.hxx"
51 : : #include "unomodel.hxx"
52 : :
53 : :
54 : : using ::rtl::OUString;
55 : :
56 : : // Since it's better to set/query the FontStyle via its attributes rather
57 : : // than via the StyleName we create a way to translate
58 : : // Attribute <-> StyleName
59 : :
60 [ # # ][ # # ]: 0 : class SmFontStyles
[ # # ][ # # ]
61 : : {
62 : : String aNormal;
63 : : String aBold;
64 : : String aItalic;
65 : : String aBoldItalic;
66 : : String aEmpty;
67 : :
68 : : public:
69 : : SmFontStyles();
70 : :
71 : 0 : sal_uInt16 GetCount() const { return 4; }
72 : : const String & GetStyleName( const Font &rFont ) const;
73 : : const String & GetStyleName( sal_uInt16 nIdx ) const;
74 : : };
75 : :
76 : :
77 : 0 : SmFontStyles::SmFontStyles() :
78 : 0 : aNormal ( ResId( RID_FONTREGULAR, *SM_MOD()->GetResMgr() ) ),
79 [ # # ][ # # ]: 0 : aBold ( ResId( RID_FONTBOLD, *SM_MOD()->GetResMgr() ) ),
80 [ # # ][ # # ]: 0 : aItalic ( ResId( RID_FONTITALIC, *SM_MOD()->GetResMgr() ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
81 : : {
82 : :
83 [ # # ]: 0 : aBoldItalic = aBold;
84 [ # # ]: 0 : aBoldItalic.AppendAscii( ", " );
85 [ # # ]: 0 : aBoldItalic += aItalic;
86 : 0 : }
87 : :
88 : :
89 : 0 : const String & SmFontStyles::GetStyleName( const Font &rFont ) const
90 : : {
91 : : //! compare also SmSpecialNode::Prepare
92 : 0 : bool bBold = IsBold( rFont ),
93 : 0 : bItalic = IsItalic( rFont );
94 : :
95 [ # # ][ # # ]: 0 : if (bBold && bItalic)
96 : 0 : return aBoldItalic;
97 [ # # ]: 0 : else if (bItalic)
98 : 0 : return aItalic;
99 [ # # ]: 0 : else if (bBold)
100 : 0 : return aBold;
101 : : else
102 : 0 : return aNormal;
103 : : }
104 : :
105 : :
106 : 0 : const String & SmFontStyles::GetStyleName( sal_uInt16 nIdx ) const
107 : : {
108 : : // 0 = "normal", 1 = "italic",
109 : : // 2 = "bold", 3 = "bold italic"
110 : :
111 : : #if OSL_DEBUG_LEVEL > 1
112 : : OSL_ENSURE( nIdx < GetCount(), "index out of range" );
113 : : #endif
114 [ # # # # : 0 : switch (nIdx)
# ]
115 : : {
116 : 0 : case 0 : return aNormal;
117 : 0 : case 1 : return aItalic;
118 : 0 : case 2 : return aBold;
119 : 0 : case 3 : return aBoldItalic;
120 : : }
121 : 0 : return aEmpty;
122 : : }
123 : :
124 : :
125 : 0 : const SmFontStyles & GetFontStyles()
126 : : {
127 [ # # ][ # # ]: 0 : static const SmFontStyles aImpl;
[ # # ][ # # ]
128 : 0 : return aImpl;
129 : : }
130 : :
131 : : /////////////////////////////////////////////////////////////////
132 : :
133 : 0 : void SetFontStyle(const XubString &rStyleName, Font &rFont)
134 : : {
135 : : // Find index related to StyleName. For an empty StyleName it's assumed to be
136 : : // 0 (neither bold nor italic).
137 : 0 : sal_uInt16 nIndex = 0;
138 [ # # ]: 0 : if (rStyleName.Len())
139 : : {
140 : : sal_uInt16 i;
141 : 0 : const SmFontStyles &rStyles = GetFontStyles();
142 [ # # ]: 0 : for (i = 0; i < rStyles.GetCount(); i++)
143 [ # # ]: 0 : if (rStyleName.CompareTo( rStyles.GetStyleName(i) ) == COMPARE_EQUAL)
144 : 0 : break;
145 : : #if OSL_DEBUG_LEVEL > 1
146 : : OSL_ENSURE(i < rStyles.GetCount(), "style-name unknown");
147 : : #endif
148 : 0 : nIndex = i;
149 : : }
150 : :
151 [ # # ]: 0 : rFont.SetItalic((nIndex & 0x1) ? ITALIC_NORMAL : ITALIC_NONE);
152 [ # # ]: 0 : rFont.SetWeight((nIndex & 0x2) ? WEIGHT_BOLD : WEIGHT_NORMAL);
153 : 0 : }
154 : :
155 : :
156 : : /**************************************************************************/
157 : :
158 : 0 : IMPL_LINK_INLINE_START( SmPrintOptionsTabPage, SizeButtonClickHdl, Button *, EMPTYARG/*pButton*/ )
159 : : {
160 : 0 : aZoom.Enable(aSizeZoomed.IsChecked());
161 : 0 : return 0;
162 : : }
163 : 0 : IMPL_LINK_INLINE_END( SmPrintOptionsTabPage, SizeButtonClickHdl, Button *, pButton )
164 : :
165 : :
166 : 0 : SmPrintOptionsTabPage::SmPrintOptionsTabPage(Window *pParent, const SfxItemSet &rOptions)
167 : : : SfxTabPage(pParent, SmResId(RID_PRINTOPTIONPAGE), rOptions),
168 : : aFixedLine1 (this, SmResId( FL_PRINTOPTIONS )),
169 : : aTitle (this, SmResId( CB_TITLEROW )),
170 : : aText (this, SmResId( CB_EQUATION_TEXT )),
171 : : aFrame (this, SmResId( CB_FRAME )),
172 : : aFixedLine2 (this, SmResId( FL_PRINT_FORMAT )),
173 : : aSizeNormal (this, SmResId( RB_ORIGINAL_SIZE )),
174 : : aSizeScaled (this, SmResId( RB_FIT_TO_PAGE )),
175 : : aSizeZoomed (this, SmResId( RB_ZOOM )),
176 : : aZoom (this, SmResId( MF_ZOOM )),
177 : : aFixedLine3 (this, SmResId( FL_MISC_OPTIONS )),
178 : : aNoRightSpaces (this, SmResId( CB_IGNORE_SPACING )),
179 [ # # ][ # # ]: 0 : aSaveOnlyUsedSymbols (this, SmResId( CB_SAVE_ONLY_USED_SYMBOLS ))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
180 : : {
181 [ # # ]: 0 : FreeResource();
182 : :
183 [ # # ]: 0 : aSizeNormal.SetClickHdl(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl));
184 [ # # ]: 0 : aSizeScaled.SetClickHdl(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl));
185 [ # # ]: 0 : aSizeZoomed.SetClickHdl(LINK(this, SmPrintOptionsTabPage, SizeButtonClickHdl));
186 : :
187 [ # # ]: 0 : Reset(rOptions);
188 : 0 : }
189 : :
190 : :
191 : 0 : sal_Bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet& rSet)
192 : : {
193 : : sal_uInt16 nPrintSize;
194 [ # # ]: 0 : if (aSizeNormal.IsChecked())
195 : 0 : nPrintSize = PRINT_SIZE_NORMAL;
196 [ # # ]: 0 : else if (aSizeScaled.IsChecked())
197 : 0 : nPrintSize = PRINT_SIZE_SCALED;
198 : : else
199 : 0 : nPrintSize = PRINT_SIZE_ZOOMED;
200 : :
201 [ # # ]: 0 : rSet.Put(SfxUInt16Item(GetWhich(SID_PRINTSIZE), (sal_uInt16) nPrintSize));
202 [ # # ]: 0 : rSet.Put(SfxUInt16Item(GetWhich(SID_PRINTZOOM), (sal_uInt16) aZoom.GetValue()));
203 [ # # ]: 0 : rSet.Put(SfxBoolItem(GetWhich(SID_PRINTTITLE), aTitle.IsChecked()));
204 [ # # ]: 0 : rSet.Put(SfxBoolItem(GetWhich(SID_PRINTTEXT), aText.IsChecked()));
205 [ # # ]: 0 : rSet.Put(SfxBoolItem(GetWhich(SID_PRINTFRAME), aFrame.IsChecked()));
206 [ # # ]: 0 : rSet.Put(SfxBoolItem(GetWhich(SID_NO_RIGHT_SPACES), aNoRightSpaces.IsChecked()));
207 [ # # ]: 0 : rSet.Put(SfxBoolItem(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), aSaveOnlyUsedSymbols.IsChecked()));
208 : :
209 : 0 : return true;
210 : : }
211 : :
212 : :
213 : 0 : void SmPrintOptionsTabPage::Reset(const SfxItemSet& rSet)
214 : : {
215 : 0 : SmPrintSize ePrintSize = (SmPrintSize)((const SfxUInt16Item &)rSet.Get(GetWhich(SID_PRINTSIZE))).GetValue();
216 : :
217 : 0 : aSizeNormal.Check(ePrintSize == PRINT_SIZE_NORMAL);
218 : 0 : aSizeScaled.Check(ePrintSize == PRINT_SIZE_SCALED);
219 : 0 : aSizeZoomed.Check(ePrintSize == PRINT_SIZE_ZOOMED);
220 : :
221 : 0 : aZoom.Enable(aSizeZoomed.IsChecked());
222 : :
223 : 0 : aZoom.SetValue(((const SfxUInt16Item &)rSet.Get(GetWhich(SID_PRINTZOOM))).GetValue());
224 : :
225 : 0 : aTitle.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_PRINTTITLE))).GetValue());
226 : 0 : aText.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_PRINTTEXT))).GetValue());
227 : 0 : aFrame.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_PRINTFRAME))).GetValue());
228 : 0 : aNoRightSpaces.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_NO_RIGHT_SPACES))).GetValue());
229 : 0 : aSaveOnlyUsedSymbols.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS))).GetValue());
230 : 0 : }
231 : :
232 : :
233 : 0 : SfxTabPage* SmPrintOptionsTabPage::Create(Window* pWindow, const SfxItemSet& rSet)
234 : : {
235 [ # # ]: 0 : return (new SmPrintOptionsTabPage(pWindow, rSet));
236 : : }
237 : :
238 : : /**************************************************************************/
239 : :
240 : :
241 : 0 : void SmShowFont::Paint(const Rectangle& rRect )
242 : : {
243 [ # # ]: 0 : Control::Paint( rRect );
244 : :
245 [ # # ][ # # ]: 0 : XubString Text (GetFont().GetName());
246 [ # # ][ # # ]: 0 : Size TextSize(GetTextWidth(Text), GetTextHeight());
247 : :
248 [ # # ]: 0 : DrawText(Point((GetOutputSize().Width() - TextSize.Width()) / 2,
249 [ # # ][ # # ]: 0 : (GetOutputSize().Height() - TextSize.Height()) / 2), Text);
[ # # ]
250 : 0 : }
251 : :
252 : :
253 : 0 : void SmShowFont::SetFont(const Font& rFont)
254 : : {
255 : 0 : Color aTxtColor( GetTextColor() );
256 [ # # ]: 0 : Font aFont (rFont);
257 : :
258 [ # # ]: 0 : Invalidate();
259 [ # # ]: 0 : aFont.SetSize(Size(0, 24));
260 [ # # ]: 0 : aFont.SetAlign(ALIGN_TOP);
261 [ # # ]: 0 : Control::SetFont(aFont);
262 : :
263 : : // keep old text color (new font may have different color)
264 [ # # ][ # # ]: 0 : SetTextColor( aTxtColor );
265 : 0 : }
266 : :
267 : :
268 : 0 : IMPL_LINK_INLINE_START( SmFontDialog, FontSelectHdl, ComboBox *, pComboBox )
269 : : {
270 [ # # ][ # # ]: 0 : Face.SetName(pComboBox->GetText());
271 : 0 : aShowFont.SetFont(Face);
272 : 0 : return 0;
273 : : }
274 : 0 : IMPL_LINK_INLINE_END( SmFontDialog, FontSelectHdl, ComboBox *, pComboBox )
275 : :
276 : :
277 : 0 : IMPL_LINK( SmFontDialog, FontModifyHdl, ComboBox *, pComboBox )
278 : : {
279 : : // if font is available in list then use it
280 [ # # ]: 0 : sal_uInt16 nPos = pComboBox->GetEntryPos( pComboBox->GetText() );
281 [ # # ]: 0 : if (COMBOBOX_ENTRY_NOTFOUND != nPos)
282 : : {
283 : 0 : FontSelectHdl( pComboBox );
284 : : }
285 : 0 : return 0;
286 : : }
287 : :
288 : :
289 : 0 : IMPL_LINK( SmFontDialog, AttrChangeHdl, CheckBox *, EMPTYARG /*pCheckBox*/ )
290 : : {
291 [ # # ]: 0 : if (aBoldCheckBox.IsChecked())
292 : 0 : Face.SetWeight(FontWeight(WEIGHT_BOLD));
293 : : else
294 : 0 : Face.SetWeight(FontWeight(WEIGHT_NORMAL));
295 : :
296 [ # # ]: 0 : if (aItalicCheckBox.IsChecked())
297 : 0 : Face.SetItalic(ITALIC_NORMAL);
298 : : else
299 : 0 : Face.SetItalic(ITALIC_NONE);
300 : :
301 : 0 : aShowFont.SetFont(Face);
302 : 0 : return 0;
303 : : }
304 : :
305 : :
306 : 0 : void SmFontDialog::SetFont(const Font &rFont)
307 : : {
308 : 0 : Face = rFont;
309 : :
310 : 0 : aFontBox.SetText( Face.GetName() );
311 : 0 : aBoldCheckBox.Check( IsBold( Face ) );
312 : 0 : aItalicCheckBox.Check( IsItalic( Face ) );
313 : :
314 : 0 : aShowFont.SetFont(Face);
315 : 0 : }
316 : :
317 : 0 : IMPL_LINK( SmFontDialog, HelpButtonClickHdl, Button *, EMPTYARG /*pButton*/ )
318 : : {
319 : : // start help system
320 : 0 : Help* pHelp = Application::GetHelp();
321 [ # # ]: 0 : if( pHelp )
322 : : {
323 [ # # ][ # # ]: 0 : pHelp->Start( rtl::OUString( "HID_SMA_FONTDIALOG" ), &aHelpButton1 );
[ # # ]
324 : : }
325 : 0 : return 0;
326 : : }
327 : :
328 : 0 : SmFontDialog::SmFontDialog(Window * pParent,
329 : : OutputDevice *pFntListDevice, bool bHideCheckboxes, bool bFreeRes)
330 : : : ModalDialog(pParent,SmResId(RID_FONTDIALOG)),
331 : : aFixedText1 (this, SmResId(1)),
332 : : aFontBox (this, SmResId(1)),
333 : : aBoldCheckBox (this, SmResId(1)),
334 : : aItalicCheckBox (this, SmResId(2)),
335 : : aOKButton1 (this, SmResId(1)),
336 : : aHelpButton1 (this, SmResId(1)),
337 : : aCancelButton1 (this, SmResId(1)),
338 : : aShowFont (this, SmResId(1)),
339 [ # # ][ # # ]: 0 : aFixedText2 (this, SmResId(2))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
340 : : {
341 [ # # ]: 0 : if (bFreeRes)
342 [ # # ]: 0 : FreeResource();
343 [ # # ]: 0 : aHelpButton1.SetClickHdl(LINK(this, SmFontDialog, HelpButtonClickHdl));
344 : :
345 : : {
346 [ # # ][ # # ]: 0 : WaitObject( this );
347 : :
348 [ # # ]: 0 : FontList aFontList( pFntListDevice );
349 : :
350 [ # # ]: 0 : sal_uInt16 nCount = aFontList.GetFontNameCount();
351 [ # # ]: 0 : for (sal_uInt16 i = 0; i < nCount; i++)
352 [ # # ][ # # ]: 0 : aFontBox.InsertEntry( aFontList.GetFontName(i).GetName() );
[ # # ]
353 : :
354 [ # # ]: 0 : Face.SetSize(Size(0, 24));
355 [ # # ]: 0 : Face.SetWeight(WEIGHT_NORMAL);
356 [ # # ]: 0 : Face.SetItalic(ITALIC_NONE);
357 [ # # ]: 0 : Face.SetFamily(FAMILY_DONTKNOW);
358 [ # # ]: 0 : Face.SetPitch(PITCH_DONTKNOW);
359 [ # # ]: 0 : Face.SetCharSet(RTL_TEXTENCODING_DONTKNOW);
360 [ # # ]: 0 : Face.SetTransparent(true);
361 : :
362 [ # # ]: 0 : InitColor_Impl();
363 : :
364 : : // preview like controls should have a 2D look
365 [ # # ][ # # ]: 0 : aShowFont.SetBorderStyle( WINDOW_BORDER_MONO );
366 : : }
367 : :
368 [ # # ]: 0 : aFontBox.SetSelectHdl(LINK(this, SmFontDialog, FontSelectHdl));
369 [ # # ]: 0 : aFontBox.SetModifyHdl(LINK(this, SmFontDialog, FontModifyHdl));
370 [ # # ]: 0 : aBoldCheckBox.SetClickHdl(LINK(this, SmFontDialog, AttrChangeHdl));
371 [ # # ]: 0 : aItalicCheckBox.SetClickHdl(LINK(this, SmFontDialog, AttrChangeHdl));
372 : :
373 [ # # ]: 0 : if (bHideCheckboxes)
374 : : {
375 [ # # ]: 0 : aBoldCheckBox.Check( false );
376 [ # # ]: 0 : aBoldCheckBox.Enable( false );
377 [ # # ]: 0 : aBoldCheckBox.Show( false );
378 [ # # ]: 0 : aItalicCheckBox.Check( false );
379 [ # # ]: 0 : aItalicCheckBox.Enable( false );
380 [ # # ]: 0 : aItalicCheckBox.Show( false );
381 [ # # ]: 0 : aFixedText2.Show( false );
382 : :
383 [ # # ]: 0 : Size aSize( aFontBox.GetSizePixel() );
384 [ # # ][ # # ]: 0 : long nComboBoxBottom = aFontBox.GetPosPixel().Y() + aFontBox.GetSizePixel().Height();
385 [ # # ][ # # ]: 0 : long nCheckBoxBottom = aItalicCheckBox.GetPosPixel().Y() + aItalicCheckBox.GetSizePixel().Height();
386 : 0 : aSize.Height() += nCheckBoxBottom - nComboBoxBottom;
387 [ # # ]: 0 : aFontBox.SetSizePixel( aSize );
388 : : }
389 : 0 : }
390 : :
391 : 0 : void SmFontDialog::InitColor_Impl()
392 : : {
393 : : #if OSL_DEBUG_LEVEL > 1
394 : : Color aBC( GetDisplayBackground().GetColor() );
395 : : #endif
396 : 0 : ColorData nBgCol = COL_WHITE,
397 : 0 : nTxtCol = COL_BLACK;
398 : 0 : const StyleSettings &rS = GetSettings().GetStyleSettings();
399 [ # # ]: 0 : if (rS.GetHighContrastMode())
400 : : {
401 : 0 : nBgCol = rS.GetFieldColor().GetColor();
402 : 0 : nTxtCol = rS.GetFieldTextColor().GetColor();
403 : : }
404 : :
405 : 0 : Color aTmpColor( nBgCol );
406 [ # # ]: 0 : Wallpaper aWall( aTmpColor );
407 : 0 : Color aTxtColor( nTxtCol );
408 [ # # ]: 0 : aShowFont.SetBackground( aWall );
409 [ # # ][ # # ]: 0 : aShowFont.SetTextColor( aTxtColor );
410 : 0 : }
411 : :
412 : 0 : void SmFontDialog::DataChanged( const DataChangedEvent& rDCEvt )
413 : : {
414 [ # # # # ]: 0 : if ( rDCEvt.GetType() == DATACHANGED_SETTINGS &&
[ # # ]
415 : 0 : (rDCEvt.GetFlags() & SETTINGS_STYLE) )
416 : 0 : InitColor_Impl();
417 : :
418 : 0 : ModalDialog::DataChanged( rDCEvt );
419 : 0 : }
420 : :
421 : : /**************************************************************************/
422 : :
423 : :
424 : 0 : IMPL_LINK( SmFontSizeDialog, DefaultButtonClickHdl, Button *, EMPTYARG /*pButton*/ )
425 : : {
426 [ # # ][ # # ]: 0 : QueryBox *pQueryBox = new QueryBox(this, SmResId(RID_DEFAULTSAVEQUERY));
427 : :
428 [ # # ]: 0 : if (pQueryBox->Execute() == RET_YES)
429 : : {
430 [ # # ]: 0 : SmModule *pp = SM_MOD();
431 [ # # ][ # # ]: 0 : SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
[ # # ]
432 [ # # ]: 0 : WriteTo( aFmt );
433 [ # # ][ # # ]: 0 : pp->GetConfig()->SetStandardFormat( aFmt );
[ # # ]
434 : : }
435 : :
436 [ # # ]: 0 : delete pQueryBox;
437 : 0 : return 0;
438 : : }
439 : :
440 : 0 : IMPL_LINK( SmFontSizeDialog, HelpButtonClickHdl, Button *, EMPTYARG /*pButton*/ )
441 : : {
442 : : // start help system
443 : 0 : Help* pHelp = Application::GetHelp();
444 [ # # ]: 0 : if( pHelp )
445 : : {
446 [ # # ][ # # ]: 0 : pHelp->Start( rtl::OUString( "HID_SMA_FONTSIZEDIALOG" ), &aHelpButton1 );
[ # # ]
447 : : }
448 : 0 : return 0;
449 : : }
450 : :
451 : 0 : SmFontSizeDialog::SmFontSizeDialog(Window * pParent, bool bFreeRes)
452 : : : ModalDialog(pParent, SmResId(RID_FONTSIZEDIALOG)),
453 : : aFixedText1(this, SmResId(1)),
454 : : aBaseSize(this, SmResId(1)),
455 : : aFixedText4(this, SmResId(4)),
456 : : aTextSize(this, SmResId(4)),
457 : : aFixedText5(this, SmResId(5)),
458 : : aIndexSize(this, SmResId(5)),
459 : : aFixedText6(this, SmResId(6)),
460 : : aFunctionSize(this, SmResId(6)),
461 : : aFixedText7(this, SmResId(7)),
462 : : aOperatorSize(this, SmResId(7)),
463 : : aFixedText8(this, SmResId(8)),
464 : : aBorderSize(this, SmResId(8)),
465 : : aFixedLine1(this, SmResId(1)),
466 : : aOKButton1(this, SmResId(1)),
467 : : aHelpButton1(this, SmResId(1)),
468 : : aCancelButton1(this, SmResId(1)),
469 [ # # ][ # # ]: 0 : aDefaultButton(this, SmResId(1))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
470 : : {
471 [ # # ]: 0 : if (bFreeRes)
472 [ # # ]: 0 : FreeResource();
473 : :
474 [ # # ]: 0 : aDefaultButton.SetClickHdl(LINK(this, SmFontSizeDialog, DefaultButtonClickHdl));
475 [ # # ]: 0 : aHelpButton1.SetClickHdl(LINK(this, SmFontSizeDialog, HelpButtonClickHdl));
476 : 0 : }
477 : :
478 : :
479 : 0 : void SmFontSizeDialog::ReadFrom(const SmFormat &rFormat)
480 : : {
481 : : //! aufpassen: richtig runden!
482 : : aBaseSize.SetValue( SmRoundFraction(
483 [ # # ]: 0 : Sm100th_mmToPts( rFormat.GetBaseSize().Height() ) ) );
484 : :
485 : 0 : aTextSize .SetValue( rFormat.GetRelSize(SIZ_TEXT) );
486 : 0 : aIndexSize .SetValue( rFormat.GetRelSize(SIZ_INDEX) );
487 : 0 : aFunctionSize.SetValue( rFormat.GetRelSize(SIZ_FUNCTION) );
488 : 0 : aOperatorSize.SetValue( rFormat.GetRelSize(SIZ_OPERATOR) );
489 : 0 : aBorderSize .SetValue( rFormat.GetRelSize(SIZ_LIMITS) );
490 : 0 : }
491 : :
492 : :
493 : 0 : void SmFontSizeDialog::WriteTo(SmFormat &rFormat) const
494 : : {
495 [ # # ]: 0 : rFormat.SetBaseSize( Size(0, SmPtsTo100th_mm( static_cast< long >(aBaseSize.GetValue()))) );
496 : :
497 [ # # ]: 0 : rFormat.SetRelSize(SIZ_TEXT, (sal_uInt16) aTextSize .GetValue());
498 [ # # ]: 0 : rFormat.SetRelSize(SIZ_INDEX, (sal_uInt16) aIndexSize .GetValue());
499 [ # # ]: 0 : rFormat.SetRelSize(SIZ_FUNCTION, (sal_uInt16) aFunctionSize.GetValue());
500 [ # # ]: 0 : rFormat.SetRelSize(SIZ_OPERATOR, (sal_uInt16) aOperatorSize.GetValue());
501 [ # # ]: 0 : rFormat.SetRelSize(SIZ_LIMITS, (sal_uInt16) aBorderSize .GetValue());
502 : :
503 : 0 : const Size aTmp (rFormat.GetBaseSize());
504 [ # # ]: 0 : for (sal_uInt16 i = FNT_BEGIN; i <= FNT_END; i++)
505 [ # # ]: 0 : rFormat.SetFontSize(i, aTmp);
506 : :
507 [ # # ]: 0 : rFormat.RequestApplyChanges();
508 : 0 : }
509 : :
510 : :
511 : : /**************************************************************************/
512 : :
513 : :
514 : 0 : IMPL_LINK( SmFontTypeDialog, MenuSelectHdl, Menu *, pMenu )
515 : : {
516 : : SmFontPickListBox *pActiveListBox;
517 : :
518 : 0 : bool bHideCheckboxes = false;
519 [ # # # # : 0 : switch (pMenu->GetCurItemId())
# # # # ]
520 : : {
521 : 0 : case 1: pActiveListBox = &aVariableFont; break;
522 : 0 : case 2: pActiveListBox = &aFunctionFont; break;
523 : 0 : case 3: pActiveListBox = &aNumberFont; break;
524 : 0 : case 4: pActiveListBox = &aTextFont; break;
525 : 0 : case 5: pActiveListBox = &aSerifFont; bHideCheckboxes = true; break;
526 : 0 : case 6: pActiveListBox = &aSansFont; bHideCheckboxes = true; break;
527 : 0 : case 7: pActiveListBox = &aFixedFont; bHideCheckboxes = true; break;
528 : 0 : default:pActiveListBox = NULL;
529 : : }
530 : :
531 [ # # ]: 0 : if (pActiveListBox)
532 : : {
533 [ # # ]: 0 : SmFontDialog *pFontDialog = new SmFontDialog(this, pFontListDev, bHideCheckboxes);
534 : :
535 : 0 : pActiveListBox->WriteTo(*pFontDialog);
536 [ # # ]: 0 : if (pFontDialog->Execute() == RET_OK)
537 : 0 : pActiveListBox->ReadFrom(*pFontDialog);
538 [ # # ]: 0 : delete pFontDialog;
539 : : }
540 : 0 : return 0;
541 : : }
542 : :
543 : :
544 : 0 : IMPL_LINK_INLINE_START( SmFontTypeDialog, DefaultButtonClickHdl, Button *, EMPTYARG /*pButton*/ )
545 : : {
546 [ # # ][ # # ]: 0 : QueryBox *pQueryBox = new QueryBox(this, SmResId(RID_DEFAULTSAVEQUERY));
547 [ # # ]: 0 : if (pQueryBox->Execute() == RET_YES)
548 : : {
549 [ # # ]: 0 : SmModule *pp = SM_MOD();
550 [ # # ][ # # ]: 0 : SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
[ # # ]
551 [ # # ]: 0 : WriteTo( aFmt );
552 [ # # ][ # # ]: 0 : pp->GetConfig()->SetStandardFormat( aFmt, true );
[ # # ]
553 : : }
554 : :
555 [ # # ]: 0 : delete pQueryBox;
556 : 0 : return 0;
557 : : }
558 : 0 : IMPL_LINK_INLINE_END( SmFontTypeDialog, DefaultButtonClickHdl, Button *, pButton )
559 : :
560 : 0 : IMPL_LINK( SmFontTypeDialog, HelpButtonClickHdl, Button *, EMPTYARG /*pButton*/ )
561 : : {
562 : : // start help system
563 : 0 : Help* pHelp = Application::GetHelp();
564 [ # # ]: 0 : if( pHelp )
565 : : {
566 [ # # ][ # # ]: 0 : pHelp->Start( rtl::OUString( "HID_SMA_FONTTYPEDIALOG" ), &aHelpButton1 );
[ # # ]
567 : : }
568 : 0 : return 0;
569 : : }
570 : :
571 : 0 : SmFontTypeDialog::SmFontTypeDialog(Window * pParent, OutputDevice *pFntListDevice, bool bFreeRes)
572 : : : ModalDialog(pParent, SmResId(RID_FONTTYPEDIALOG)),
573 : : aFixedText1 (this, SmResId(1)),
574 : : aVariableFont (this, SmResId(1)),
575 : : aFixedText2 (this, SmResId(2)),
576 : : aFunctionFont (this, SmResId(2)),
577 : : aFixedText3 (this, SmResId(3)),
578 : : aNumberFont (this, SmResId(3)),
579 : : aFixedText4 (this, SmResId(4)),
580 : : aTextFont (this, SmResId(4)),
581 : : aFixedText5 (this, SmResId(5)),
582 : : aSerifFont (this, SmResId(5)),
583 : : aFixedText6 (this, SmResId(6)),
584 : : aSansFont (this, SmResId(6)),
585 : : aFixedText7 (this, SmResId(7)),
586 : : aFixedFont (this, SmResId(7)),
587 : : aFixedLine1 (this, SmResId(1)),
588 : : aFixedLine2 (this, SmResId(2)),
589 : : aOKButton1 (this, SmResId(1)),
590 : : aHelpButton1 (this, SmResId(1)),
591 : : aCancelButton1 (this, SmResId(1)),
592 : : aMenuButton (this, SmResId(1)),
593 : : aDefaultButton (this, SmResId(2)),
594 [ # # ][ # # ]: 0 : pFontListDev (pFntListDevice)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
595 : : {
596 [ # # ]: 0 : if (bFreeRes)
597 [ # # ]: 0 : FreeResource();
598 : :
599 [ # # ]: 0 : aDefaultButton.SetClickHdl(LINK(this, SmFontTypeDialog, DefaultButtonClickHdl));
600 [ # # ]: 0 : aHelpButton1.SetClickHdl(LINK(this, SmFontTypeDialog, HelpButtonClickHdl));
601 : :
602 [ # # ]: 0 : aMenuButton.GetPopupMenu()->SetSelectHdl(LINK(this, SmFontTypeDialog, MenuSelectHdl));
603 : 0 : }
604 : :
605 : 0 : void SmFontTypeDialog::ReadFrom(const SmFormat &rFormat)
606 : : {
607 : 0 : SmModule *pp = SM_MOD();
608 : :
609 : 0 : aVariableFont = pp->GetConfig()->GetFontPickList(FNT_VARIABLE);
610 : 0 : aFunctionFont = pp->GetConfig()->GetFontPickList(FNT_FUNCTION);
611 : 0 : aNumberFont = pp->GetConfig()->GetFontPickList(FNT_NUMBER);
612 : 0 : aTextFont = pp->GetConfig()->GetFontPickList(FNT_TEXT);
613 : 0 : aSerifFont = pp->GetConfig()->GetFontPickList(FNT_SERIF);
614 : 0 : aSansFont = pp->GetConfig()->GetFontPickList(FNT_SANS);
615 : 0 : aFixedFont = pp->GetConfig()->GetFontPickList(FNT_FIXED);
616 : :
617 : 0 : aVariableFont.Insert( rFormat.GetFont(FNT_VARIABLE) );
618 : 0 : aFunctionFont.Insert( rFormat.GetFont(FNT_FUNCTION) );
619 : 0 : aNumberFont .Insert( rFormat.GetFont(FNT_NUMBER) );
620 : 0 : aTextFont .Insert( rFormat.GetFont(FNT_TEXT) );
621 : 0 : aSerifFont .Insert( rFormat.GetFont(FNT_SERIF) );
622 : 0 : aSansFont .Insert( rFormat.GetFont(FNT_SANS) );
623 : 0 : aFixedFont .Insert( rFormat.GetFont(FNT_FIXED) );
624 : 0 : }
625 : :
626 : :
627 : 0 : void SmFontTypeDialog::WriteTo(SmFormat &rFormat) const
628 : : {
629 : 0 : SmModule *pp = SM_MOD();
630 : :
631 : 0 : pp->GetConfig()->GetFontPickList(FNT_VARIABLE) = aVariableFont;
632 : 0 : pp->GetConfig()->GetFontPickList(FNT_FUNCTION) = aFunctionFont;
633 : 0 : pp->GetConfig()->GetFontPickList(FNT_NUMBER) = aNumberFont;
634 : 0 : pp->GetConfig()->GetFontPickList(FNT_TEXT) = aTextFont;
635 : 0 : pp->GetConfig()->GetFontPickList(FNT_SERIF) = aSerifFont;
636 : 0 : pp->GetConfig()->GetFontPickList(FNT_SANS) = aSansFont;
637 : 0 : pp->GetConfig()->GetFontPickList(FNT_FIXED) = aFixedFont;
638 : :
639 [ # # ][ # # ]: 0 : rFormat.SetFont( FNT_VARIABLE, aVariableFont.Get(0) );
[ # # ]
640 [ # # ][ # # ]: 0 : rFormat.SetFont( FNT_FUNCTION, aFunctionFont.Get(0) );
[ # # ]
641 [ # # ][ # # ]: 0 : rFormat.SetFont( FNT_NUMBER, aNumberFont .Get(0) );
[ # # ]
642 [ # # ][ # # ]: 0 : rFormat.SetFont( FNT_TEXT, aTextFont .Get(0) );
[ # # ]
643 [ # # ][ # # ]: 0 : rFormat.SetFont( FNT_SERIF, aSerifFont .Get(0) );
[ # # ]
644 [ # # ][ # # ]: 0 : rFormat.SetFont( FNT_SANS, aSansFont .Get(0) );
[ # # ]
645 [ # # ][ # # ]: 0 : rFormat.SetFont( FNT_FIXED, aFixedFont .Get(0) );
[ # # ]
646 : :
647 : 0 : rFormat.RequestApplyChanges();
648 : 0 : }
649 : :
650 : : /**************************************************************************/
651 : :
652 : : struct FieldMinMax
653 : : {
654 : : sal_uInt16 nMin, nMax;
655 : : };
656 : :
657 : : // Data for min and max values of the 4 metric fields
658 : : // for each of the 10 categories
659 : : static const FieldMinMax pMinMaxData[10][4] =
660 : : {
661 : : // 0
662 : : {{ 0, 200 }, { 0, 200 }, { 0, 100 }, { 0, 0 }},
663 : : // 1
664 : : {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
665 : : // 2
666 : : {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
667 : : // 3
668 : : {{ 0, 100 }, { 1, 100 }, { 0, 0 }, { 0, 0 }},
669 : : // 4
670 : : {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
671 : : // 5
672 : : {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 100 }},
673 : : // 6
674 : : {{ 0, 300 }, { 0, 300 }, { 0, 0 }, { 0, 0 }},
675 : : // 7
676 : : {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
677 : : // 8
678 : : {{ 0, 100 }, { 0, 100 }, { 0, 0 }, { 0, 0 }},
679 : : // 9
680 : : {{ 0, 10000 }, { 0, 10000 }, { 0, 10000 }, { 0, 10000 }}
681 : : };
682 : :
683 : 0 : SmCategoryDesc::SmCategoryDesc(const ResId& rResId, sal_uInt16 nCategoryIdx) :
684 : 0 : Resource(rResId)
685 : : {
686 [ # # ][ # # ]: 0 : if (IsAvailableRes(ResId(1,*rResId.GetResMgr()).SetRT(RSC_STRING)))
687 : : {
688 [ # # ]: 0 : Name = ResId(1,*rResId.GetResMgr()).toString();
689 : :
690 : : int i;
691 [ # # ]: 0 : for (i = 0; i < 4; i++)
692 : : {
693 : 0 : int nI2 = i + 2;
694 : :
695 [ # # ][ # # ]: 0 : if (IsAvailableRes(ResId(nI2,*rResId.GetResMgr()).SetRT(RSC_STRING)))
696 : : {
697 [ # # ][ # # ]: 0 : Strings [i] = new rtl::OUString(ResId(nI2,*rResId.GetResMgr()).toString());
698 [ # # ][ # # ]: 0 : Graphics [i] = new Bitmap(ResId(10*nI2,*rResId.GetResMgr()));
699 : : }
700 : : else
701 : : {
702 : 0 : Strings [i] = 0;
703 : 0 : Graphics [i] = 0;
704 : : }
705 : : }
706 : :
707 [ # # ]: 0 : for (i = 0; i < 4; i++)
708 : : {
709 : 0 : const FieldMinMax &rMinMax = pMinMaxData[ nCategoryIdx ][i];
710 : 0 : Value[i] = Minimum[i] = rMinMax.nMin;
711 : 0 : Maximum[i] = rMinMax.nMax;
712 : : }
713 : : }
714 : :
715 [ # # ]: 0 : FreeResource();
716 : 0 : }
717 : :
718 : :
719 : 0 : SmCategoryDesc::~SmCategoryDesc()
720 : : {
721 [ # # ]: 0 : for (int i = 0; i < 4; i++)
722 : : {
723 [ # # ]: 0 : delete Strings [i];
724 [ # # ][ # # ]: 0 : delete Graphics [i];
725 : : }
726 : 0 : }
727 : :
728 : : /**************************************************************************/
729 : :
730 : 0 : IMPL_LINK( SmDistanceDialog, GetFocusHdl, Control *, pControl )
731 : : {
732 [ # # ]: 0 : if (Categories[nActiveCategory])
733 : : {
734 : : sal_uInt16 i;
735 : :
736 [ # # ]: 0 : if (pControl == &aMetricField1)
737 : 0 : i = 0;
738 [ # # ]: 0 : else if (pControl == &aMetricField2)
739 : 0 : i = 1;
740 [ # # ]: 0 : else if (pControl == &aMetricField3)
741 : 0 : i = 2;
742 [ # # ]: 0 : else if (pControl == &aMetricField4)
743 : 0 : i = 3;
744 : : else
745 : 0 : return 0;
746 : 0 : aBitmap.SetBitmap(*(Categories[nActiveCategory]->GetGraphic(i)));
747 : : }
748 : 0 : return 0;
749 : : }
750 : :
751 : 0 : IMPL_LINK( SmDistanceDialog, MenuSelectHdl, Menu *, pMenu )
752 : : {
753 : 0 : SetCategory(pMenu->GetCurItemId() - 1);
754 : 0 : return 0;
755 : : }
756 : :
757 : :
758 : 0 : IMPL_LINK( SmDistanceDialog, DefaultButtonClickHdl, Button *, EMPTYARG /*pButton*/ )
759 : : {
760 [ # # ][ # # ]: 0 : QueryBox *pQueryBox = new QueryBox(this, SmResId(RID_DEFAULTSAVEQUERY));
761 : :
762 [ # # ]: 0 : if (pQueryBox->Execute() == RET_YES)
763 : : {
764 [ # # ]: 0 : SmModule *pp = SM_MOD();
765 [ # # ][ # # ]: 0 : SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
[ # # ]
766 [ # # ]: 0 : WriteTo( aFmt );
767 [ # # ][ # # ]: 0 : pp->GetConfig()->SetStandardFormat( aFmt );
[ # # ]
768 : : }
769 [ # # ]: 0 : delete pQueryBox;
770 : 0 : return 0;
771 : : }
772 : :
773 : 0 : IMPL_LINK( SmDistanceDialog, HelpButtonClickHdl, Button *, EMPTYARG /*pButton*/ )
774 : : {
775 : : // start help system
776 : 0 : Help* pHelp = Application::GetHelp();
777 [ # # ]: 0 : if( pHelp )
778 : : {
779 [ # # ][ # # ]: 0 : pHelp->Start( rtl::OUString( "HID_SMA_DISTANCEDIALOG" ), &aHelpButton1 );
[ # # ]
780 : : }
781 : 0 : return 0;
782 : : }
783 : :
784 : :
785 : 0 : IMPL_LINK( SmDistanceDialog, CheckBoxClickHdl, CheckBox *, pCheckBox )
786 : : {
787 [ # # ]: 0 : if (pCheckBox == &aCheckBox1)
788 : : {
789 : 0 : aCheckBox1.Toggle();
790 : :
791 : 0 : bool bChecked = aCheckBox1.IsChecked();
792 : 0 : aFixedText4 .Enable( bChecked );
793 : 0 : aMetricField4.Enable( bChecked );
794 : : }
795 : 0 : return 0;
796 : : }
797 : :
798 : :
799 : 0 : void SmDistanceDialog::SetHelpId(MetricField &rField, const rtl::OString& sHelpId)
800 : : {
801 : : // HelpIDs which are explicitly set in this way have to be defined in the
802 : : // util directory in the file "hidother.src" with the help of "hidspecial"!
803 : :
804 [ # # ]: 0 : const XubString aEmptyText;
805 : : #if OSL_DEBUG_LEVEL > 1
806 : : OSL_ENSURE(aEmptyText.Len() == 0, "Sm: Ooops...");
807 : : #endif
808 : :
809 [ # # ]: 0 : rField.SetHelpId(sHelpId);
810 [ # # ]: 0 : rField.SetHelpText(aEmptyText);
811 : :
812 : : // since MetricField inherits from SpinField which has a sub Edit field
813 : : // (which is actually the one we modify) we have to set the help-id
814 : : // for it too.
815 : 0 : Edit *pSubEdit = rField.GetSubEdit();
816 [ # # ]: 0 : if (pSubEdit)
817 : : {
818 [ # # ]: 0 : pSubEdit->SetHelpId(sHelpId);
819 [ # # ]: 0 : pSubEdit->SetHelpText(aEmptyText);
820 [ # # ]: 0 : }
821 : 0 : }
822 : :
823 : :
824 : 0 : void SmDistanceDialog::SetCategory(sal_uInt16 nCategory)
825 : : {
826 : : #if OSL_DEBUG_LEVEL > 1
827 : : OSL_ENSURE(/*0 <= nCategory &&*/ nCategory < NOCATEGORIES,
828 : : "Sm: wrong category number in SmDistanceDialog");
829 : : #endif
830 : :
831 : : // array to convert category- and metricfield-number in help ids.
832 : : // 0 is used in case of unused combinations.
833 : : #if OSL_DEBUG_LEVEL > 1
834 : : OSL_ENSURE(NOCATEGORIES == 10, "Sm : array doesn't fit into the number of categories");
835 : : #endif
836 : : static const char * aCatMf2Hid[10][4] =
837 : : {
838 : : { HID_SMA_DEFAULT_DIST, HID_SMA_LINE_DIST, HID_SMA_ROOT_DIST, 0 },
839 : : { HID_SMA_SUP_DIST, HID_SMA_SUB_DIST , 0, 0 },
840 : : { HID_SMA_NUMERATOR_DIST, HID_SMA_DENOMINATOR_DIST, 0, 0 },
841 : : { HID_SMA_FRACLINE_EXCWIDTH, HID_SMA_FRACLINE_LINEWIDTH, 0, 0 },
842 : : { HID_SMA_UPPERLIMIT_DIST, HID_SMA_LOWERLIMIT_DIST, 0, 0 },
843 : : { HID_SMA_BRACKET_EXCHEIGHT, HID_SMA_BRACKET_DIST, 0, HID_SMA_BRACKET_EXCHEIGHT2 },
844 : : { HID_SMA_MATRIXROW_DIST, HID_SMA_MATRIXCOL_DIST, 0, 0 },
845 : : { HID_SMA_ATTRIBUT_DIST, HID_SMA_INTERATTRIBUT_DIST, 0, 0 },
846 : : { HID_SMA_OPERATOR_EXCHEIGHT, HID_SMA_OPERATOR_DIST, 0, 0 },
847 : : { HID_SMA_LEFTBORDER_DIST, HID_SMA_RIGHTBORDER_DIST, HID_SMA_UPPERBORDER_DIST, HID_SMA_LOWERBORDER_DIST }
848 : : };
849 : :
850 : : // array to help iterate over the controls
851 : : Window * const aWin[4][2] =
852 : : {
853 : : { &aFixedText1, &aMetricField1 },
854 : : { &aFixedText2, &aMetricField2 },
855 : : { &aFixedText3, &aMetricField3 },
856 : : { &aFixedText4, &aMetricField4 }
857 : 0 : };
858 : :
859 : : SmCategoryDesc *pCat;
860 : :
861 : : // remember the (maybe new) settings of the active SmCategoryDesc
862 : : // before switching to the new one
863 [ # # ]: 0 : if (nActiveCategory != CATEGORY_NONE)
864 : : {
865 : 0 : pCat = Categories[nActiveCategory];
866 [ # # ]: 0 : pCat->SetValue(0, (sal_uInt16) aMetricField1.GetValue());
867 [ # # ]: 0 : pCat->SetValue(1, (sal_uInt16) aMetricField2.GetValue());
868 [ # # ]: 0 : pCat->SetValue(2, (sal_uInt16) aMetricField3.GetValue());
869 [ # # ]: 0 : pCat->SetValue(3, (sal_uInt16) aMetricField4.GetValue());
870 : :
871 [ # # ]: 0 : if (nActiveCategory == 5)
872 [ # # ]: 0 : bScaleAllBrackets = aCheckBox1.IsChecked();
873 : :
874 [ # # ]: 0 : aMenuButton.GetPopupMenu()->CheckItem(nActiveCategory + 1, false);
875 : : }
876 : :
877 : : // activation/deactivation of the associated controls depending on the chosen category
878 : : bool bActive;
879 [ # # ]: 0 : for (sal_uInt16 i = 0; i < 4; i++)
880 : : {
881 : 0 : FixedText *pFT = (FixedText * const) aWin[i][0];
882 : 0 : MetricField *pMF = (MetricField * const) aWin[i][1];
883 : :
884 : : // To determine which Controls should be active, the existence
885 : : // of an associated HelpID is checked
886 : 0 : bActive = aCatMf2Hid[nCategory][i] != 0;
887 : :
888 [ # # ]: 0 : pFT->Show(bActive);
889 [ # # ]: 0 : pFT->Enable(bActive);
890 [ # # ]: 0 : pMF->Show(bActive);
891 [ # # ]: 0 : pMF->Enable(bActive);
892 : :
893 : : // set measurement unit and number of decimal places
894 : : FieldUnit eUnit;
895 : : sal_uInt16 nDigits;
896 [ # # ]: 0 : if (nCategory < 9)
897 : : {
898 : 0 : eUnit = FUNIT_CUSTOM;
899 : 0 : nDigits = 0;
900 [ # # ][ # # ]: 0 : pMF->SetCustomUnitText(rtl::OUString('%'));
[ # # ]
901 : : }
902 : : else
903 : : {
904 : 0 : eUnit = FUNIT_100TH_MM;
905 : 0 : nDigits = 2;
906 : : }
907 [ # # ]: 0 : pMF->SetUnit(eUnit); // changes the value
908 [ # # ]: 0 : pMF->SetDecimalDigits(nDigits);
909 : :
910 [ # # ]: 0 : if (bActive)
911 : : {
912 : 0 : pCat = Categories[nCategory];
913 [ # # ][ # # ]: 0 : pFT->SetText(*pCat->GetString(i));
[ # # ]
914 : :
915 [ # # ]: 0 : pMF->SetMin(pCat->GetMinimum(i));
916 [ # # ]: 0 : pMF->SetMax(pCat->GetMaximum(i));
917 [ # # ]: 0 : pMF->SetValue(pCat->GetValue(i));
918 : :
919 [ # # ]: 0 : SetHelpId(*pMF, aCatMf2Hid[nCategory][i]);
920 : : }
921 : : }
922 : : // activate the CheckBox and the associated MetricField if we're dealing with the brackets menu
923 : 0 : bActive = nCategory == 5;
924 [ # # ]: 0 : aCheckBox1.Show(bActive);
925 [ # # ]: 0 : aCheckBox1.Enable(bActive);
926 [ # # ]: 0 : if (bActive)
927 : : {
928 [ # # ]: 0 : aCheckBox1.Check( bScaleAllBrackets );
929 : :
930 [ # # ]: 0 : bool bChecked = aCheckBox1.IsChecked();
931 [ # # ]: 0 : aFixedText4 .Enable( bChecked );
932 [ # # ]: 0 : aMetricField4.Enable( bChecked );
933 : : }
934 : :
935 [ # # ]: 0 : aMenuButton.GetPopupMenu()->CheckItem(nCategory + 1, true);
936 [ # # ][ # # ]: 0 : aFixedLine.SetText(Categories[nCategory]->GetName());
[ # # ]
937 : :
938 : 0 : nActiveCategory = nCategory;
939 : :
940 [ # # ]: 0 : aMetricField1.GrabFocus();
941 [ # # ]: 0 : Invalidate();
942 [ # # ]: 0 : Update();
943 : 0 : }
944 : :
945 : :
946 : 0 : SmDistanceDialog::SmDistanceDialog(Window *pParent, bool bFreeRes)
947 : : : ModalDialog(pParent, SmResId(RID_DISTANCEDIALOG)),
948 : : aFixedText1 (this, SmResId(1)),
949 : : aMetricField1 (this, SmResId(1)),
950 : : aFixedText2 (this, SmResId(2)),
951 : : aMetricField2 (this, SmResId(2)),
952 : : aFixedText3 (this, SmResId(3)),
953 : : aMetricField3 (this, SmResId(3)),
954 : : aCheckBox1 (this, SmResId(1)),
955 : : aFixedText4 (this, SmResId(4)),
956 : : aMetricField4 (this, SmResId(4)),
957 : : aOKButton1 (this, SmResId(1)),
958 : : aHelpButton1 (this, SmResId(1)),
959 : : aCancelButton1 (this, SmResId(1)),
960 : : aMenuButton (this, SmResId(1)),
961 : : aDefaultButton (this, SmResId(1)),
962 : : aBitmap (this, SmResId(1)),
963 [ # # ][ # # ]: 0 : aFixedLine (this, SmResId(1))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
964 : : {
965 [ # # ]: 0 : for (sal_uInt16 i = 0; i < NOCATEGORIES; i++)
966 [ # # ][ # # ]: 0 : Categories[i] = new SmCategoryDesc(SmResId(i + 1), i);
[ # # ]
967 : 0 : nActiveCategory = CATEGORY_NONE;
968 : 0 : bScaleAllBrackets = false;
969 : :
970 [ # # ]: 0 : if (bFreeRes)
971 [ # # ]: 0 : FreeResource();
972 : :
973 : : // preview like controls should have a 2D look
974 [ # # ]: 0 : aBitmap.SetBorderStyle( WINDOW_BORDER_MONO );
975 : :
976 [ # # ]: 0 : aMetricField1.SetGetFocusHdl(LINK(this, SmDistanceDialog, GetFocusHdl));
977 [ # # ]: 0 : aMetricField2.SetGetFocusHdl(LINK(this, SmDistanceDialog, GetFocusHdl));
978 [ # # ]: 0 : aMetricField3.SetGetFocusHdl(LINK(this, SmDistanceDialog, GetFocusHdl));
979 [ # # ]: 0 : aMetricField4.SetGetFocusHdl(LINK(this, SmDistanceDialog, GetFocusHdl));
980 [ # # ]: 0 : aCheckBox1.SetClickHdl(LINK(this, SmDistanceDialog, CheckBoxClickHdl));
981 : :
982 [ # # ]: 0 : aMenuButton.GetPopupMenu()->SetSelectHdl(LINK(this, SmDistanceDialog, MenuSelectHdl));
983 : :
984 [ # # ]: 0 : aDefaultButton.SetClickHdl(LINK(this, SmDistanceDialog, DefaultButtonClickHdl));
985 [ # # ]: 0 : aHelpButton1.SetClickHdl(LINK(this, SmDistanceDialog, HelpButtonClickHdl));
986 : 0 : }
987 : :
988 : :
989 [ # # ][ # # ]: 0 : SmDistanceDialog::~SmDistanceDialog()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
990 : : {
991 [ # # ]: 0 : for (int i = 0; i < NOCATEGORIES; i++)
992 [ # # ][ # # ]: 0 : DELETEZ(Categories[i]);
993 [ # # ]: 0 : }
994 : :
995 : 0 : void SmDistanceDialog::DataChanged( const DataChangedEvent &rEvt )
996 : : {
997 : 0 : ModalDialog::DataChanged( rEvt );
998 : 0 : }
999 : :
1000 : 0 : void SmDistanceDialog::ReadFrom(const SmFormat &rFormat)
1001 : : {
1002 : 0 : Categories[0]->SetValue(0, rFormat.GetDistance(DIS_HORIZONTAL));
1003 : 0 : Categories[0]->SetValue(1, rFormat.GetDistance(DIS_VERTICAL));
1004 : 0 : Categories[0]->SetValue(2, rFormat.GetDistance(DIS_ROOT));
1005 : 0 : Categories[1]->SetValue(0, rFormat.GetDistance(DIS_SUPERSCRIPT));
1006 : 0 : Categories[1]->SetValue(1, rFormat.GetDistance(DIS_SUBSCRIPT));
1007 : 0 : Categories[2]->SetValue(0, rFormat.GetDistance(DIS_NUMERATOR));
1008 : 0 : Categories[2]->SetValue(1, rFormat.GetDistance(DIS_DENOMINATOR));
1009 : 0 : Categories[3]->SetValue(0, rFormat.GetDistance(DIS_FRACTION));
1010 : 0 : Categories[3]->SetValue(1, rFormat.GetDistance(DIS_STROKEWIDTH));
1011 : 0 : Categories[4]->SetValue(0, rFormat.GetDistance(DIS_UPPERLIMIT));
1012 : 0 : Categories[4]->SetValue(1, rFormat.GetDistance(DIS_LOWERLIMIT));
1013 : 0 : Categories[5]->SetValue(0, rFormat.GetDistance(DIS_BRACKETSIZE));
1014 : 0 : Categories[5]->SetValue(1, rFormat.GetDistance(DIS_BRACKETSPACE));
1015 : 0 : Categories[5]->SetValue(3, rFormat.GetDistance(DIS_NORMALBRACKETSIZE));
1016 : 0 : Categories[6]->SetValue(0, rFormat.GetDistance(DIS_MATRIXROW));
1017 : 0 : Categories[6]->SetValue(1, rFormat.GetDistance(DIS_MATRIXCOL));
1018 : 0 : Categories[7]->SetValue(0, rFormat.GetDistance(DIS_ORNAMENTSIZE));
1019 : 0 : Categories[7]->SetValue(1, rFormat.GetDistance(DIS_ORNAMENTSPACE));
1020 : 0 : Categories[8]->SetValue(0, rFormat.GetDistance(DIS_OPERATORSIZE));
1021 : 0 : Categories[8]->SetValue(1, rFormat.GetDistance(DIS_OPERATORSPACE));
1022 : 0 : Categories[9]->SetValue(0, rFormat.GetDistance(DIS_LEFTSPACE));
1023 : 0 : Categories[9]->SetValue(1, rFormat.GetDistance(DIS_RIGHTSPACE));
1024 : 0 : Categories[9]->SetValue(2, rFormat.GetDistance(DIS_TOPSPACE));
1025 : 0 : Categories[9]->SetValue(3, rFormat.GetDistance(DIS_BOTTOMSPACE));
1026 : :
1027 : 0 : bScaleAllBrackets = rFormat.IsScaleNormalBrackets();
1028 : :
1029 : : // force update (even of category 0) by setting nActiveCategory to a
1030 : : // non-existent category number
1031 : 0 : nActiveCategory = CATEGORY_NONE;
1032 : 0 : SetCategory(0);
1033 : 0 : }
1034 : :
1035 : :
1036 : 0 : void SmDistanceDialog::WriteTo(SmFormat &rFormat) /*const*/
1037 : : {
1038 : : // TODO can they actually be different?
1039 : : // if that's not the case 'const' could be used above!
1040 : 0 : SetCategory(nActiveCategory);
1041 : :
1042 : 0 : rFormat.SetDistance( DIS_HORIZONTAL, Categories[0]->GetValue(0) );
1043 : 0 : rFormat.SetDistance( DIS_VERTICAL, Categories[0]->GetValue(1) );
1044 : 0 : rFormat.SetDistance( DIS_ROOT, Categories[0]->GetValue(2) );
1045 : 0 : rFormat.SetDistance( DIS_SUPERSCRIPT, Categories[1]->GetValue(0) );
1046 : 0 : rFormat.SetDistance( DIS_SUBSCRIPT, Categories[1]->GetValue(1) );
1047 : 0 : rFormat.SetDistance( DIS_NUMERATOR, Categories[2]->GetValue(0) );
1048 : 0 : rFormat.SetDistance( DIS_DENOMINATOR, Categories[2]->GetValue(1) );
1049 : 0 : rFormat.SetDistance( DIS_FRACTION, Categories[3]->GetValue(0) );
1050 : 0 : rFormat.SetDistance( DIS_STROKEWIDTH, Categories[3]->GetValue(1) );
1051 : 0 : rFormat.SetDistance( DIS_UPPERLIMIT, Categories[4]->GetValue(0) );
1052 : 0 : rFormat.SetDistance( DIS_LOWERLIMIT, Categories[4]->GetValue(1) );
1053 : 0 : rFormat.SetDistance( DIS_BRACKETSIZE, Categories[5]->GetValue(0) );
1054 : 0 : rFormat.SetDistance( DIS_BRACKETSPACE, Categories[5]->GetValue(1) );
1055 : 0 : rFormat.SetDistance( DIS_MATRIXROW, Categories[6]->GetValue(0) );
1056 : 0 : rFormat.SetDistance( DIS_MATRIXCOL, Categories[6]->GetValue(1) );
1057 : 0 : rFormat.SetDistance( DIS_ORNAMENTSIZE, Categories[7]->GetValue(0) );
1058 : 0 : rFormat.SetDistance( DIS_ORNAMENTSPACE, Categories[7]->GetValue(1) );
1059 : 0 : rFormat.SetDistance( DIS_OPERATORSIZE, Categories[8]->GetValue(0) );
1060 : 0 : rFormat.SetDistance( DIS_OPERATORSPACE, Categories[8]->GetValue(1) );
1061 : 0 : rFormat.SetDistance( DIS_LEFTSPACE, Categories[9]->GetValue(0) );
1062 : 0 : rFormat.SetDistance( DIS_RIGHTSPACE, Categories[9]->GetValue(1) );
1063 : 0 : rFormat.SetDistance( DIS_TOPSPACE, Categories[9]->GetValue(2) );
1064 : 0 : rFormat.SetDistance( DIS_BOTTOMSPACE, Categories[9]->GetValue(3) );
1065 : 0 : rFormat.SetDistance( DIS_NORMALBRACKETSIZE, Categories[5]->GetValue(3) );
1066 : :
1067 : 0 : rFormat.SetScaleNormalBrackets( bScaleAllBrackets );
1068 : :
1069 : 0 : rFormat.RequestApplyChanges();
1070 : 0 : }
1071 : :
1072 : :
1073 : : /**************************************************************************/
1074 : :
1075 : :
1076 : 0 : IMPL_LINK( SmAlignDialog, DefaultButtonClickHdl, Button *, EMPTYARG /*pButton*/ )
1077 : : {
1078 [ # # ][ # # ]: 0 : QueryBox *pQueryBox = new QueryBox(this, SmResId(RID_DEFAULTSAVEQUERY));
1079 : :
1080 [ # # ]: 0 : if (pQueryBox->Execute() == RET_YES)
1081 : : {
1082 [ # # ]: 0 : SmModule *pp = SM_MOD();
1083 [ # # ][ # # ]: 0 : SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
[ # # ]
1084 [ # # ]: 0 : WriteTo( aFmt );
1085 [ # # ][ # # ]: 0 : pp->GetConfig()->SetStandardFormat( aFmt );
[ # # ]
1086 : : }
1087 : :
1088 [ # # ]: 0 : delete pQueryBox;
1089 : 0 : return 0;
1090 : : }
1091 : :
1092 : :
1093 : 0 : IMPL_LINK( SmAlignDialog, HelpButtonClickHdl, Button *, EMPTYARG /*pButton*/ )
1094 : : {
1095 : : // start help system
1096 : 0 : Help* pHelp = Application::GetHelp();
1097 [ # # ]: 0 : if( pHelp )
1098 : : {
1099 [ # # ][ # # ]: 0 : pHelp->Start( rtl::OUString( "HID_SMA_ALIGNDIALOG" ), &aHelpButton1 );
[ # # ]
1100 : : }
1101 : 0 : return 0;
1102 : : }
1103 : :
1104 : 0 : SmAlignDialog::SmAlignDialog(Window * pParent, bool bFreeRes)
1105 : : : ModalDialog(pParent, SmResId(RID_ALIGNDIALOG)),
1106 : : aLeft (this, SmResId(1)),
1107 : : aCenter (this, SmResId(2)),
1108 : : aRight (this, SmResId(3)),
1109 : : aFixedLine1 (this, SmResId(1)),
1110 : : aOKButton1 (this, SmResId(1)),
1111 : : aHelpButton1 (this, SmResId(1)),
1112 : : aCancelButton1 (this, SmResId(1)),
1113 [ # # ][ # # ]: 0 : aDefaultButton (this, SmResId(1))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1114 : : {
1115 [ # # ]: 0 : if (bFreeRes)
1116 [ # # ]: 0 : FreeResource();
1117 : :
1118 [ # # ]: 0 : aDefaultButton.SetClickHdl(LINK(this, SmAlignDialog, DefaultButtonClickHdl));
1119 [ # # ]: 0 : aHelpButton1.SetClickHdl(LINK(this, SmAlignDialog, HelpButtonClickHdl));
1120 : 0 : }
1121 : :
1122 : :
1123 : 0 : void SmAlignDialog::ReadFrom(const SmFormat &rFormat)
1124 : : {
1125 [ # # # # ]: 0 : switch (rFormat.GetHorAlign())
1126 : : {
1127 : : case AlignLeft:
1128 : 0 : aLeft .Check(true);
1129 : 0 : aCenter.Check(false);
1130 : 0 : aRight .Check(false);
1131 : 0 : break;
1132 : :
1133 : : case AlignCenter:
1134 : 0 : aLeft .Check(false);
1135 : 0 : aCenter.Check(true);
1136 : 0 : aRight .Check(false);
1137 : 0 : break;
1138 : :
1139 : : case AlignRight:
1140 : 0 : aLeft .Check(false);
1141 : 0 : aCenter.Check(false);
1142 : 0 : aRight .Check(true);
1143 : 0 : break;
1144 : : }
1145 : 0 : }
1146 : :
1147 : :
1148 : 0 : void SmAlignDialog::WriteTo(SmFormat &rFormat) const
1149 : : {
1150 [ # # ]: 0 : if (aLeft.IsChecked())
1151 : 0 : rFormat.SetHorAlign(AlignLeft);
1152 [ # # ]: 0 : else if (aRight.IsChecked())
1153 : 0 : rFormat.SetHorAlign(AlignRight);
1154 : : else
1155 : 0 : rFormat.SetHorAlign(AlignCenter);
1156 : :
1157 : 0 : rFormat.RequestApplyChanges();
1158 : 0 : }
1159 : :
1160 : :
1161 : : /**************************************************************************/
1162 : :
1163 : :
1164 : 0 : void SmShowSymbolSet::Paint(const Rectangle&)
1165 : : {
1166 [ # # ]: 0 : Push(PUSH_MAPMODE);
1167 : :
1168 : : // set MapUnit for which 'nLen' has been calculated
1169 [ # # ][ # # ]: 0 : SetMapMode(MapMode(MAP_PIXEL));
[ # # ]
1170 : :
1171 : 0 : sal_uInt16 v = sal::static_int_cast< sal_uInt16 >((aVScrollBar.GetThumbPos() * nColumns));
1172 : 0 : size_t nSymbols = aSymbolSet.size();
1173 : :
1174 : 0 : Color aTxtColor( GetTextColor() );
1175 [ # # ]: 0 : for (sal_uInt16 i = v; i < nSymbols ; i++)
1176 : : {
1177 [ # # ]: 0 : SmSym aSymbol (*aSymbolSet[i]);
1178 [ # # ]: 0 : Font aFont (aSymbol.GetFace());
1179 [ # # ]: 0 : aFont.SetAlign(ALIGN_TOP);
1180 : :
1181 : : // taking a FontSize which is a bit smaller (compared to nLen) in order to have a buffer
1182 : : // (hopefully enough for left and right, too)
1183 [ # # ]: 0 : aFont.SetSize(Size(0, nLen - (nLen / 3)));
1184 [ # # ]: 0 : SetFont(aFont);
1185 : : // keep text color
1186 [ # # ]: 0 : SetTextColor( aTxtColor );
1187 : :
1188 : 0 : int nIV = i - v;
1189 : 0 : sal_UCS4 cChar = aSymbol.GetCharacter();
1190 [ # # ][ # # ]: 0 : String aText( OUString( &cChar, 1 ) );
1191 [ # # ][ # # ]: 0 : Size aSize( GetTextWidth( aText ), GetTextHeight());
1192 : :
1193 : 0 : DrawText(Point((nIV % nColumns) * nLen + (nLen - aSize.Width()) / 2,
1194 : 0 : (nIV / nColumns) * nLen + (nLen - aSize.Height()) / 2),
1195 [ # # ]: 0 : aText);
1196 [ # # ][ # # ]: 0 : }
[ # # ]
1197 : :
1198 [ # # ]: 0 : if (nSelectSymbol != SYMBOL_NONE)
1199 : : {
1200 : : Invert(Rectangle(Point(((nSelectSymbol - v) % nColumns) * nLen,
1201 : : ((nSelectSymbol - v) / nColumns) * nLen),
1202 [ # # ][ # # ]: 0 : Size(nLen, nLen)));
1203 : : }
1204 : :
1205 [ # # ]: 0 : Pop();
1206 : 0 : }
1207 : :
1208 : :
1209 : 0 : void SmShowSymbolSet::MouseButtonDown(const MouseEvent& rMEvt)
1210 : : {
1211 : 0 : GrabFocus();
1212 : :
1213 [ # # ][ # # ]: 0 : if (rMEvt.IsLeft() && Rectangle(Point(0, 0), aOutputSize).IsInside(rMEvt.GetPosPixel()))
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
[ # # ]
1214 : : {
1215 : 0 : long nPos = (rMEvt.GetPosPixel().Y() / nLen) * nColumns + (rMEvt.GetPosPixel().X() / nLen) +
1216 : 0 : aVScrollBar.GetThumbPos() * nColumns;
1217 : 0 : SelectSymbol( sal::static_int_cast< sal_uInt16 >(nPos) );
1218 : :
1219 : 0 : aSelectHdlLink.Call(this);
1220 : :
1221 [ # # ]: 0 : if (rMEvt.GetClicks() > 1) aDblClickHdlLink.Call(this);
1222 : : }
1223 : 0 : else Control::MouseButtonDown (rMEvt);
1224 : 0 : }
1225 : :
1226 : :
1227 : 0 : void SmShowSymbolSet::KeyInput(const KeyEvent& rKEvt)
1228 : : {
1229 : 0 : sal_uInt16 n = nSelectSymbol;
1230 : :
1231 [ # # ]: 0 : if (n != SYMBOL_NONE)
1232 : : {
1233 [ # # # # : 0 : switch (rKEvt.GetKeyCode().GetCode())
# # # #
# ]
1234 : : {
1235 : 0 : case KEY_DOWN: n = n + nColumns; break;
1236 : 0 : case KEY_UP: n = n - nColumns; break;
1237 : 0 : case KEY_LEFT: n -= 1; break;
1238 : 0 : case KEY_RIGHT: n += 1; break;
1239 : 0 : case KEY_HOME: n = 0; break;
1240 : 0 : case KEY_END: n = static_cast< sal_uInt16 >(aSymbolSet.size() - 1); break;
1241 : 0 : case KEY_PAGEUP: n -= nColumns * nRows; break;
1242 : 0 : case KEY_PAGEDOWN: n += nColumns * nRows; break;
1243 : :
1244 : : default:
1245 : 0 : Control::KeyInput(rKEvt);
1246 : 0 : return;
1247 : : }
1248 : : }
1249 : : else
1250 : 0 : n = 0;
1251 : :
1252 [ # # ]: 0 : if (n >= aSymbolSet.size())
1253 : 0 : n = nSelectSymbol;
1254 : :
1255 : : // adjust scrollbar
1256 [ # # # # ]: 0 : if ((n < (sal_uInt16) (aVScrollBar.GetThumbPos() * nColumns)) ||
[ # # ]
1257 : 0 : (n >= (sal_uInt16) ((aVScrollBar.GetThumbPos() + nRows) * nColumns)))
1258 : : {
1259 : 0 : aVScrollBar.SetThumbPos(n / nColumns);
1260 : 0 : Invalidate();
1261 : 0 : Update();
1262 : : }
1263 : :
1264 : 0 : SelectSymbol(n);
1265 : 0 : aSelectHdlLink.Call(this);
1266 : : }
1267 : :
1268 : :
1269 : 0 : SmShowSymbolSet::SmShowSymbolSet(Window *pParent, const ResId& rResId) :
1270 : : Control(pParent, rResId),
1271 [ # # ][ # # ]: 0 : aVScrollBar(this, WinBits(WB_VSCROLL))
[ # # ][ # # ]
1272 : : {
1273 : 0 : nSelectSymbol = SYMBOL_NONE;
1274 : :
1275 : 0 : aOutputSize = GetOutputSizePixel();
1276 [ # # ]: 0 : long nScrollBarWidth = aVScrollBar.GetSizePixel().Width(),
1277 : 0 : nUseableWidth = aOutputSize.Width() - nScrollBarWidth;
1278 : :
1279 : : // Height of 16pt in pixels (matching 'aOutputSize')
1280 [ # # ][ # # ]: 0 : nLen = (sal_uInt16) LogicToPixel(Size(0, 16), MapMode(MAP_POINT)).Height();
[ # # ]
1281 : :
1282 : 0 : nColumns = sal::static_int_cast< sal_uInt16 >(nUseableWidth / nLen);
1283 [ # # ][ # # ]: 0 : if (nColumns > 2 && nColumns % 2 != 0)
1284 : 0 : nColumns--;
1285 : 0 : nRows = sal::static_int_cast< sal_uInt16 >(aOutputSize.Height() / nLen);
1286 : : #if OSL_DEBUG_LEVEL > 1
1287 : : OSL_ENSURE(nColumns > 0, "Sm : no columns");
1288 : : OSL_ENSURE(nRows > 0, "Sm : no rows");
1289 : : #endif
1290 : :
1291 : : // make it fit exactly
1292 : 0 : aOutputSize.Width() = nColumns * nLen;
1293 : 0 : aOutputSize.Height() = nRows * nLen;
1294 : :
1295 : 0 : aVScrollBar.SetPosSizePixel(Point(aOutputSize.Width() + 1, -1),
1296 [ # # ]: 0 : Size(nScrollBarWidth, aOutputSize.Height() + 2));
1297 [ # # ]: 0 : aVScrollBar.Enable(false);
1298 [ # # ]: 0 : aVScrollBar.Show();
1299 [ # # ]: 0 : aVScrollBar.SetScrollHdl(LINK(this, SmShowSymbolSet, ScrollHdl));
1300 : :
1301 : 0 : Size WindowSize (aOutputSize);
1302 : 0 : WindowSize.Width() += nScrollBarWidth;
1303 [ # # ]: 0 : SetOutputSizePixel(WindowSize);
1304 : :
1305 : 0 : }
1306 : :
1307 : :
1308 : 0 : void SmShowSymbolSet::SetSymbolSet(const SymbolPtrVec_t& rSymbolSet)
1309 : : {
1310 : 0 : aSymbolSet = rSymbolSet;
1311 : :
1312 [ # # ]: 0 : if (static_cast< sal_uInt16 >(aSymbolSet.size()) > (nColumns * nRows))
1313 : : {
1314 [ # # ]: 0 : aVScrollBar.SetRange(Range(0, ((aSymbolSet.size() + (nColumns - 1)) / nColumns) - nRows));
1315 : 0 : aVScrollBar.Enable(true);
1316 : : }
1317 : : else
1318 : : {
1319 [ # # ]: 0 : aVScrollBar.SetRange(Range(0,0));
1320 : 0 : aVScrollBar.Enable (false);
1321 : : }
1322 : :
1323 : 0 : Invalidate();
1324 : 0 : }
1325 : :
1326 : :
1327 : 0 : void SmShowSymbolSet::SelectSymbol(sal_uInt16 nSymbol)
1328 : : {
1329 : 0 : int v = (int) (aVScrollBar.GetThumbPos() * nColumns);
1330 : :
1331 [ # # ]: 0 : if (nSelectSymbol != SYMBOL_NONE)
1332 : : Invalidate(Rectangle(Point(((nSelectSymbol - v) % nColumns) * nLen,
1333 : : ((nSelectSymbol - v) / nColumns) * nLen),
1334 [ # # ][ # # ]: 0 : Size(nLen, nLen)));
1335 : :
1336 [ # # ]: 0 : if (nSymbol < aSymbolSet.size())
1337 : 0 : nSelectSymbol = nSymbol;
1338 : :
1339 [ # # ]: 0 : if (aSymbolSet.empty())
1340 : 0 : nSelectSymbol = SYMBOL_NONE;
1341 : :
1342 [ # # ]: 0 : if (nSelectSymbol != SYMBOL_NONE)
1343 : : Invalidate(Rectangle(Point(((nSelectSymbol - v) % nColumns) * nLen,
1344 : : ((nSelectSymbol - v) / nColumns) * nLen),
1345 [ # # ][ # # ]: 0 : Size(nLen, nLen)));
1346 : :
1347 : 0 : Update();
1348 : 0 : }
1349 : :
1350 : :
1351 : 0 : IMPL_LINK( SmShowSymbolSet, ScrollHdl, ScrollBar*, EMPTYARG /*pScrollBar*/)
1352 : : {
1353 : 0 : Invalidate();
1354 : 0 : return 0;
1355 : : }
1356 : :
1357 : : ////////////////////////////////////////////////////////////////////////////////
1358 : :
1359 : 0 : void SmShowSymbol::Paint(const Rectangle &rRect)
1360 : : {
1361 [ # # ]: 0 : Control::Paint( rRect );
1362 : :
1363 [ # # ]: 0 : const XubString &rText = GetText();
1364 [ # # ][ # # ]: 0 : Size aTextSize(GetTextWidth(rText), GetTextHeight());
1365 : :
1366 [ # # ]: 0 : DrawText(Point((GetOutputSize().Width() - aTextSize.Width()) / 2,
1367 [ # # ][ # # ]: 0 : (GetOutputSize().Height() * 7/10)), rText);
[ # # ]
1368 : 0 : }
1369 : :
1370 : :
1371 : 0 : void SmShowSymbol::MouseButtonDown(const MouseEvent& rMEvt)
1372 : : {
1373 [ # # ]: 0 : if (rMEvt.GetClicks() > 1)
1374 : 0 : aDblClickHdlLink.Call(this);
1375 : : else
1376 : 0 : Control::MouseButtonDown (rMEvt);
1377 : 0 : }
1378 : :
1379 : :
1380 : 0 : void SmShowSymbol::SetSymbol(const SmSym *pSymbol)
1381 : : {
1382 [ # # ]: 0 : if (pSymbol)
1383 : : {
1384 [ # # ]: 0 : Font aFont (pSymbol->GetFace());
1385 [ # # ][ # # ]: 0 : aFont.SetSize(Size(0, GetOutputSize().Height() - GetOutputSize().Height() / 3));
[ # # ]
1386 [ # # ]: 0 : aFont.SetAlign(ALIGN_BASELINE);
1387 [ # # ]: 0 : SetFont(aFont);
1388 : :
1389 : 0 : sal_UCS4 cChar = pSymbol->GetCharacter();
1390 [ # # ][ # # ]: 0 : String aText( OUString( &cChar, 1 ) );
1391 [ # # ][ # # ]: 0 : SetText( aText );
[ # # ]
1392 : : }
1393 : :
1394 : : // 'Invalidate' fills the background with the background color.
1395 : : // If a NULL pointer has been passed that's already enough to clear the display
1396 : 0 : Invalidate();
1397 : 0 : }
1398 : :
1399 : :
1400 : : ////////////////////////////////////////////////////////////////////////////////
1401 : :
1402 : 0 : void SmSymbolDialog::FillSymbolSets(bool bDeleteText)
1403 : : // populate the entries of possible SymbolsSets in the dialog with
1404 : : // current values of the SymbolSet manager but selects none of those
1405 : : {
1406 [ # # ]: 0 : aSymbolSets.Clear();
1407 [ # # ]: 0 : if (bDeleteText)
1408 [ # # ]: 0 : aSymbolSets.SetNoSelection();
1409 : :
1410 [ # # ]: 0 : std::set< String > aSybolSetNames( rSymbolMgr.GetSymbolSetNames() );
1411 : 0 : std::set< String >::const_iterator aIt( aSybolSetNames.begin() );
1412 [ # # ][ # # ]: 0 : for ( ; aIt != aSybolSetNames.end(); ++aIt)
[ # # ]
1413 [ # # ][ # # ]: 0 : aSymbolSets.InsertEntry( *aIt );
1414 : 0 : }
1415 : :
1416 : :
1417 : 0 : IMPL_LINK( SmSymbolDialog, SymbolSetChangeHdl, ListBox *, EMPTYARG pListBox )
1418 : : {
1419 : : (void) pListBox;
1420 : : #if OSL_DEBUG_LEVEL > 1
1421 : : OSL_ENSURE(pListBox == &aSymbolSets, "Sm : wrong argument");
1422 : : #endif
1423 : :
1424 [ # # ]: 0 : SelectSymbolSet(aSymbolSets.GetSelectEntry());
1425 : 0 : return 0;
1426 : : }
1427 : :
1428 : :
1429 : 0 : IMPL_LINK( SmSymbolDialog, SymbolChangeHdl, SmShowSymbolSet *, EMPTYARG pShowSymbolSet )
1430 : : {
1431 : : (void) pShowSymbolSet;
1432 : : #if OSL_DEBUG_LEVEL > 1
1433 : : OSL_ENSURE(pShowSymbolSet == &aSymbolSetDisplay, "Sm : wrong argument");
1434 : : #endif
1435 : :
1436 : 0 : SelectSymbol(aSymbolSetDisplay.GetSelectSymbol());
1437 : 0 : return 0;
1438 : : }
1439 : :
1440 : 0 : IMPL_LINK( SmSymbolDialog, EditClickHdl, Button *, EMPTYARG pButton )
1441 : : {
1442 : : (void) pButton;
1443 : : #if OSL_DEBUG_LEVEL > 1
1444 : : OSL_ENSURE(pButton == &aEditBtn, "Sm : wrong argument");
1445 : : #endif
1446 : :
1447 [ # # ][ # # ]: 0 : SmSymDefineDialog *pDialog = new SmSymDefineDialog(this, pFontListDev, rSymbolMgr);
1448 : :
1449 : : // set current symbol and SymbolSet for the new dialog
1450 [ # # ]: 0 : const XubString aSymSetName (aSymbolSets.GetSelectEntry()),
1451 [ # # ]: 0 : aSymName (aSymbolName.GetText());
1452 [ # # ]: 0 : pDialog->SelectOldSymbolSet(aSymSetName);
1453 [ # # ]: 0 : pDialog->SelectOldSymbol(aSymName);
1454 [ # # ]: 0 : pDialog->SelectSymbolSet(aSymSetName);
1455 [ # # ]: 0 : pDialog->SelectSymbol(aSymName);
1456 : :
1457 : : // remember old SymbolSet
1458 [ # # ]: 0 : XubString aOldSymbolSet (aSymbolSets.GetSelectEntry());
1459 : :
1460 : 0 : sal_uInt16 nSymPos = GetSelectedSymbol();
1461 : :
1462 : : // adapt dialog to data of the SymbolSet manager, which might have changed
1463 [ # # ][ # # ]: 0 : if (pDialog->Execute() == RET_OK && rSymbolMgr.IsModified())
[ # # ][ # # ]
1464 : : {
1465 [ # # ]: 0 : rSymbolMgr.Save();
1466 [ # # ]: 0 : FillSymbolSets();
1467 : : }
1468 : :
1469 : : // if the old SymbolSet doesn't exist anymore, go to the first one SymbolSet (if one exists)
1470 [ # # ][ # # ]: 0 : if (!SelectSymbolSet(aOldSymbolSet) && aSymbolSets.GetEntryCount() > 0)
[ # # ][ # # ]
[ # # ]
1471 [ # # ][ # # ]: 0 : SelectSymbolSet(aSymbolSets.GetEntry(0));
[ # # ]
1472 : : else
1473 : : {
1474 : : // just update display of current symbol set
1475 : : OSL_ENSURE( aSymSetName == aSymSetName, "unexpected change in symbol set name" );
1476 [ # # ][ # # ]: 0 : aSymbolSet = rSymbolMgr.GetSymbolSet( aSymbolSetName );
[ # # ][ # # ]
1477 [ # # ]: 0 : aSymbolSetDisplay.SetSymbolSet( aSymbolSet );
1478 : : }
1479 : :
1480 [ # # ]: 0 : if (nSymPos >= aSymbolSet.size())
1481 : 0 : nSymPos = static_cast< sal_uInt16 >(aSymbolSet.size()) - 1;
1482 [ # # ]: 0 : SelectSymbol( nSymPos );
1483 : :
1484 [ # # ][ # # ]: 0 : delete pDialog;
1485 [ # # ][ # # ]: 0 : return 0;
[ # # ]
1486 : : }
1487 : :
1488 : :
1489 : 0 : IMPL_LINK( SmSymbolDialog, SymbolDblClickHdl, SmShowSymbolSet *, EMPTYARG pShowSymbolSet )
1490 : : {
1491 : : (void) pShowSymbolSet;
1492 : : #if OSL_DEBUG_LEVEL > 1
1493 : : OSL_ENSURE(pShowSymbolSet == &aSymbolSetDisplay, "Sm : wrong argument");
1494 : : #endif
1495 : :
1496 : 0 : GetClickHdl(&aGetBtn);
1497 : 0 : EndDialog(RET_OK);
1498 : 0 : return 0;
1499 : : }
1500 : :
1501 : :
1502 : 0 : IMPL_LINK( SmSymbolDialog, GetClickHdl, Button *, EMPTYARG pButton )
1503 : : {
1504 : : (void) pButton;
1505 : : #if OSL_DEBUG_LEVEL > 1
1506 : : OSL_ENSURE(pButton == &aGetBtn, "Sm : wrong button");
1507 : : #endif
1508 : :
1509 : 0 : const SmSym *pSym = GetSymbol();
1510 [ # # ]: 0 : if (pSym)
1511 : : {
1512 [ # # ]: 0 : String aText = rtl::OUString('%');
1513 [ # # ]: 0 : aText += pSym->GetName();
1514 [ # # ]: 0 : aText += (sal_Unicode)' ';
1515 : :
1516 : : rViewSh.GetViewFrame()->GetDispatcher()->Execute(
1517 : : SID_INSERTSYMBOL, SFX_CALLMODE_STANDARD,
1518 [ # # ][ # # ]: 0 : new SfxStringItem(SID_INSERTSYMBOL, aText), 0L);
[ # # ][ # # ]
1519 : : }
1520 : :
1521 : 0 : return 0;
1522 : : }
1523 : :
1524 : :
1525 : 0 : IMPL_LINK_INLINE_START( SmSymbolDialog, CloseClickHdl, Button *, EMPTYARG pButton )
1526 : : {
1527 : : (void) pButton;
1528 : : #if OSL_DEBUG_LEVEL > 1
1529 : : OSL_ENSURE(pButton == &aCloseBtn, "Sm : wrong button");
1530 : : #endif
1531 : :
1532 : 0 : EndDialog(true);
1533 : 0 : return 0;
1534 : : }
1535 : 0 : IMPL_LINK_INLINE_END( SmSymbolDialog, CloseClickHdl, Button *, pButton )
1536 : :
1537 : 0 : IMPL_LINK( SmSymbolDialog, HelpButtonClickHdl, Button *, EMPTYARG /*pButton*/ )
1538 : : {
1539 : : // start help system
1540 : 0 : Help* pHelp = Application::GetHelp();
1541 [ # # ]: 0 : if( pHelp )
1542 : : {
1543 [ # # ][ # # ]: 0 : pHelp->Start( rtl::OUString( "HID_SMA_SYMBOLDIALOG" ), &aHelpBtn );
[ # # ]
1544 : : }
1545 : 0 : return 0;
1546 : : }
1547 : :
1548 : 0 : SmSymbolDialog::SmSymbolDialog(Window *pParent, OutputDevice *pFntListDevice,
1549 : : SmSymbolManager &rMgr, SmViewShell &rViewShell, bool bFreeRes) :
1550 : : ModalDialog (pParent, SmResId(RID_SYMBOLDIALOG)),
1551 : : aSymbolSetText (this, SmResId(1)),
1552 : : aSymbolSets (this, SmResId(1)),
1553 : : aSymbolSetDisplay (this, SmResId(1)),
1554 : : aSymbolName (this, SmResId(2)),
1555 : : aSymbolDisplay (this, SmResId(2)),
1556 : : aHelpBtn (this, SmResId(1)),
1557 : : aGetBtn (this, SmResId(2)),
1558 : : aCloseBtn (this, SmResId(3)),
1559 : : aEditBtn (this, SmResId(1)),
1560 : : rViewSh (rViewShell),
1561 : : rSymbolMgr (rMgr),
1562 [ # # ][ # # ]: 0 : pFontListDev (pFntListDevice)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1563 : : {
1564 [ # # ]: 0 : if (bFreeRes)
1565 [ # # ]: 0 : FreeResource();
1566 : :
1567 [ # # ]: 0 : aHelpBtn.SetClickHdl(LINK(this, SmSymbolDialog, HelpButtonClickHdl));
1568 : 0 : aSymbolSetName = rtl::OUString();
1569 : 0 : aSymbolSet.clear();
1570 [ # # ]: 0 : FillSymbolSets();
1571 [ # # ][ # # ]: 0 : if (aSymbolSets.GetEntryCount() > 0)
1572 [ # # ][ # # ]: 0 : SelectSymbolSet(aSymbolSets.GetEntry(0));
[ # # ]
1573 : :
1574 [ # # ]: 0 : InitColor_Impl();
1575 : :
1576 : : // preview like controls should have a 2D look
1577 [ # # ]: 0 : aSymbolDisplay.SetBorderStyle( WINDOW_BORDER_MONO );
1578 : :
1579 [ # # ]: 0 : aSymbolSets .SetSelectHdl (LINK(this, SmSymbolDialog, SymbolSetChangeHdl));
1580 [ # # ]: 0 : aSymbolSetDisplay.SetSelectHdl (LINK(this, SmSymbolDialog, SymbolChangeHdl));
1581 [ # # ]: 0 : aSymbolSetDisplay.SetDblClickHdl(LINK(this, SmSymbolDialog, SymbolDblClickHdl));
1582 [ # # ]: 0 : aSymbolDisplay .SetDblClickHdl(LINK(this, SmSymbolDialog, SymbolDblClickHdl));
1583 [ # # ]: 0 : aCloseBtn .SetClickHdl (LINK(this, SmSymbolDialog, CloseClickHdl));
1584 [ # # ]: 0 : aEditBtn .SetClickHdl (LINK(this, SmSymbolDialog, EditClickHdl));
1585 [ # # ]: 0 : aGetBtn .SetClickHdl (LINK(this, SmSymbolDialog, GetClickHdl));
1586 : 0 : }
1587 : :
1588 : :
1589 [ # # ][ # # ]: 0 : SmSymbolDialog::~SmSymbolDialog()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1590 : : {
1591 [ # # ]: 0 : }
1592 : :
1593 : :
1594 : 0 : void SmSymbolDialog::InitColor_Impl()
1595 : : {
1596 : : #if OSL_DEBUG_LEVEL > 1
1597 : : Color aBC( GetDisplayBackground().GetColor() );
1598 : : #endif
1599 : 0 : ColorData nBgCol = COL_WHITE,
1600 : 0 : nTxtCol = COL_BLACK;
1601 : 0 : const StyleSettings &rS = GetSettings().GetStyleSettings();
1602 [ # # ]: 0 : if (rS.GetHighContrastMode())
1603 : : {
1604 : 0 : nBgCol = rS.GetFieldColor().GetColor();
1605 : 0 : nTxtCol = rS.GetFieldTextColor().GetColor();
1606 : : }
1607 : :
1608 : 0 : Color aTmpColor( nBgCol );
1609 [ # # ]: 0 : Wallpaper aWall( aTmpColor );
1610 : 0 : Color aTxtColor( nTxtCol );
1611 [ # # ]: 0 : aSymbolDisplay .SetBackground( aWall );
1612 [ # # ]: 0 : aSymbolDisplay .SetTextColor( aTxtColor );
1613 [ # # ]: 0 : aSymbolSetDisplay.SetBackground( aWall );
1614 [ # # ][ # # ]: 0 : aSymbolSetDisplay.SetTextColor( aTxtColor );
1615 : 0 : }
1616 : :
1617 : :
1618 : 0 : void SmSymbolDialog::DataChanged( const DataChangedEvent& rDCEvt )
1619 : : {
1620 [ # # # # ]: 0 : if ( rDCEvt.GetType() == DATACHANGED_SETTINGS &&
[ # # ]
1621 : 0 : (rDCEvt.GetFlags() & SETTINGS_STYLE) )
1622 : 0 : InitColor_Impl();
1623 : :
1624 : 0 : ModalDialog::DataChanged( rDCEvt );
1625 : 0 : }
1626 : :
1627 : :
1628 : 0 : bool SmSymbolDialog::SelectSymbolSet(const XubString &rSymbolSetName)
1629 : : {
1630 : 0 : bool bRet = false;
1631 : 0 : sal_uInt16 nPos = aSymbolSets.GetEntryPos(rSymbolSetName);
1632 : :
1633 : 0 : aSymbolSetName = rtl::OUString();
1634 : 0 : aSymbolSet.clear();
1635 [ # # ]: 0 : if (nPos != LISTBOX_ENTRY_NOTFOUND)
1636 : : {
1637 : 0 : aSymbolSets.SelectEntryPos(nPos);
1638 : :
1639 : 0 : aSymbolSetName = rSymbolSetName;
1640 [ # # ][ # # ]: 0 : aSymbolSet = rSymbolMgr.GetSymbolSet( aSymbolSetName );
1641 : :
1642 : : // sort symbols by Unicode position (useful for displaying Greek characters alphabetically)
1643 [ # # ]: 0 : std::sort( aSymbolSet.begin(), aSymbolSet.end(), lt_SmSymPtr() );
1644 : :
1645 : 0 : aSymbolSetDisplay.SetSymbolSet( aSymbolSet );
1646 [ # # ]: 0 : if (aSymbolSet.size() > 0)
1647 : 0 : SelectSymbol(0);
1648 : :
1649 : 0 : bRet = true;
1650 : : }
1651 : : else
1652 : 0 : aSymbolSets.SetNoSelection();
1653 : :
1654 : 0 : return bRet;
1655 : : }
1656 : :
1657 : :
1658 : 0 : void SmSymbolDialog::SelectSymbol(sal_uInt16 nSymbolNo)
1659 : : {
1660 : 0 : const SmSym *pSym = NULL;
1661 [ # # ][ # # ]: 0 : if (!aSymbolSetName.isEmpty() && nSymbolNo < static_cast< sal_uInt16 >(aSymbolSet.size()))
[ # # ]
1662 : 0 : pSym = aSymbolSet[ nSymbolNo ];
1663 : :
1664 : 0 : aSymbolSetDisplay.SelectSymbol(nSymbolNo);
1665 : 0 : aSymbolDisplay.SetSymbol(pSym);
1666 [ # # ][ # # ]: 0 : aSymbolName.SetText(pSym ? pSym->GetName() : XubString());
1667 : 0 : }
1668 : :
1669 : :
1670 : 0 : const SmSym * SmSymbolDialog::GetSymbol() const
1671 : : {
1672 : 0 : sal_uInt16 nSymbolNo = aSymbolSetDisplay.GetSelectSymbol();
1673 [ # # ][ # # ]: 0 : bool bValid = !aSymbolSetName.isEmpty() && nSymbolNo < static_cast< sal_uInt16 >(aSymbolSet.size());
1674 [ # # ]: 0 : return bValid ? aSymbolSet[ nSymbolNo ] : NULL;
1675 : : }
1676 : :
1677 : :
1678 : : ////////////////////////////////////////////////////////////////////////////////
1679 : :
1680 : :
1681 : 0 : void SmShowChar::Paint(const Rectangle &rRect)
1682 : : {
1683 [ # # ]: 0 : Control::Paint( rRect );
1684 : :
1685 [ # # ][ # # ]: 0 : OUString aText( GetText() );
[ # # ]
1686 [ # # ]: 0 : if (!aText.isEmpty())
1687 : : {
1688 : : #if OSL_DEBUG_LEVEL > 1
1689 : : sal_Int32 nPos = 0;
1690 : : sal_UCS4 cChar = aText.iterateCodePoints( &nPos );
1691 : : (void) cChar;
1692 : : #endif
1693 [ # # ][ # # ]: 0 : Size aTextSize(GetTextWidth(aText), GetTextHeight());
[ # # ][ # # ]
1694 : :
1695 [ # # ]: 0 : DrawText(Point((GetOutputSize().Width() - aTextSize.Width()) / 2,
1696 [ # # ][ # # ]: 0 : (GetOutputSize().Height() * 7/10)), aText);
[ # # ][ # # ]
1697 : 0 : }
1698 : 0 : }
1699 : :
1700 : :
1701 : 0 : void SmShowChar::SetSymbol( const SmSym *pSym )
1702 : : {
1703 [ # # ]: 0 : if (pSym)
1704 : 0 : SetSymbol( pSym->GetCharacter(), pSym->GetFace() );
1705 : 0 : }
1706 : :
1707 : :
1708 : 0 : void SmShowChar::SetSymbol( sal_UCS4 cChar, const Font &rFont )
1709 : : {
1710 [ # # ]: 0 : Font aFont( rFont );
1711 [ # # ][ # # ]: 0 : aFont.SetSize( Size(0, GetOutputSize().Height() - GetOutputSize().Height() / 3) );
[ # # ]
1712 [ # # ]: 0 : aFont.SetAlign(ALIGN_BASELINE);
1713 [ # # ]: 0 : SetFont(aFont);
1714 [ # # ]: 0 : aFont.SetTransparent(true);
1715 : :
1716 [ # # ][ # # ]: 0 : String aText( OUString( &cChar, 1) );
1717 [ # # ]: 0 : SetText( aText );
1718 : :
1719 [ # # ][ # # ]: 0 : Invalidate();
[ # # ]
1720 : 0 : }
1721 : :
1722 : :
1723 : : ////////////////////////////////////////////////////////////////////////////////
1724 : :
1725 : 0 : void SmSymDefineDialog::FillSymbols(ComboBox &rComboBox, bool bDeleteText)
1726 : : {
1727 : : #if OSL_DEBUG_LEVEL > 1
1728 : : OSL_ENSURE(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols,
1729 : : "Sm : wrong ComboBox");
1730 : : #endif
1731 : :
1732 [ # # ]: 0 : rComboBox.Clear();
1733 [ # # ]: 0 : if (bDeleteText)
1734 [ # # ][ # # ]: 0 : rComboBox.SetText(rtl::OUString());
[ # # ]
1735 : :
1736 [ # # ]: 0 : ComboBox &rBox = &rComboBox == &aOldSymbols ? aOldSymbolSets : aSymbolSets;
1737 [ # # ][ # # ]: 0 : SymbolPtrVec_t aSymSet( aSymbolMgrCopy.GetSymbolSet( rBox.GetText() ) );
[ # # ]
1738 [ # # ]: 0 : for (size_t i = 0; i < aSymSet.size(); ++i)
1739 [ # # ]: 0 : rComboBox.InsertEntry( aSymSet[i]->GetName() );
1740 : 0 : }
1741 : :
1742 : :
1743 : 0 : void SmSymDefineDialog::FillSymbolSets(ComboBox &rComboBox, bool bDeleteText)
1744 : : {
1745 : : #if OSL_DEBUG_LEVEL > 1
1746 : : OSL_ENSURE(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets,
1747 : : "Sm : falsche ComboBox");
1748 : : #endif
1749 : :
1750 [ # # ]: 0 : rComboBox.Clear();
1751 [ # # ]: 0 : if (bDeleteText)
1752 [ # # ][ # # ]: 0 : rComboBox.SetText(rtl::OUString());
[ # # ]
1753 : :
1754 [ # # ]: 0 : const std::set< String > aSymbolSetNames( aSymbolMgrCopy.GetSymbolSetNames() );
1755 : 0 : std::set< String >::const_iterator aIt( aSymbolSetNames.begin() );
1756 [ # # ][ # # ]: 0 : for ( ; aIt != aSymbolSetNames.end(); ++aIt)
[ # # ]
1757 [ # # ][ # # ]: 0 : rComboBox.InsertEntry( *aIt );
1758 : 0 : }
1759 : :
1760 : :
1761 : 0 : void SmSymDefineDialog::FillFonts(bool bDelete)
1762 : : {
1763 : 0 : aFonts.Clear();
1764 [ # # ]: 0 : if (bDelete)
1765 : 0 : aFonts.SetNoSelection();
1766 : :
1767 : : // Include all fonts of FontList into the font list.
1768 : : // If there are duplicates, only include one entry of each font since the style will be
1769 : : // already selected using the FontStyleBox.
1770 [ # # ]: 0 : if (pFontList)
1771 : : {
1772 : 0 : sal_uInt16 nCount = pFontList->GetFontNameCount();
1773 [ # # ]: 0 : for (sal_uInt16 i = 0; i < nCount; i++)
1774 : 0 : aFonts.InsertEntry( pFontList->GetFontName(i).GetName() );
1775 : : }
1776 : 0 : }
1777 : :
1778 : :
1779 : 0 : void SmSymDefineDialog::FillStyles(bool bDeleteText)
1780 : : {
1781 [ # # ]: 0 : aStyles.Clear();
1782 [ # # ]: 0 : if (bDeleteText)
1783 [ # # ][ # # ]: 0 : aStyles.SetText(rtl::OUString());
[ # # ]
1784 : :
1785 [ # # ]: 0 : XubString aText (aFonts.GetSelectEntry());
1786 [ # # ]: 0 : if (aText.Len() != 0)
1787 : : {
1788 : : // use own StyleNames
1789 [ # # ]: 0 : const SmFontStyles &rStyles = GetFontStyles();
1790 [ # # ]: 0 : for (sal_uInt16 i = 0; i < rStyles.GetCount(); i++)
1791 [ # # ]: 0 : aStyles.InsertEntry( rStyles.GetStyleName(i) );
1792 : :
1793 : : #if OSL_DEBUG_LEVEL > 1
1794 : : OSL_ENSURE(aStyles.GetEntryCount() > 0, "Sm : no styles available");
1795 : : #endif
1796 [ # # ][ # # ]: 0 : aStyles.SetText( aStyles.GetEntry(0) );
[ # # ]
1797 [ # # ]: 0 : }
1798 : 0 : }
1799 : :
1800 : :
1801 : 0 : SmSym * SmSymDefineDialog::GetSymbol(const ComboBox &rComboBox)
1802 : : {
1803 : : #if OSL_DEBUG_LEVEL > 1
1804 : : OSL_ENSURE(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols,
1805 : : "Sm : wrong combobox");
1806 : : #endif
1807 [ # # ]: 0 : return aSymbolMgrCopy.GetSymbolByName(rComboBox.GetText());
1808 : : }
1809 : :
1810 : :
1811 : 0 : IMPL_LINK( SmSymDefineDialog, OldSymbolChangeHdl, ComboBox *, EMPTYARG pComboBox )
1812 : : {
1813 : : (void) pComboBox;
1814 : : #if OSL_DEBUG_LEVEL > 1
1815 : : OSL_ENSURE(pComboBox == &aOldSymbols, "Sm : wrong argument");
1816 : : #endif
1817 [ # # ]: 0 : SelectSymbol(aOldSymbols, aOldSymbols.GetText(), false);
1818 : 0 : return 0;
1819 : : }
1820 : :
1821 : :
1822 : 0 : IMPL_LINK( SmSymDefineDialog, OldSymbolSetChangeHdl, ComboBox *, EMPTYARG pComboBox )
1823 : : {
1824 : : (void) pComboBox;
1825 : : #if OSL_DEBUG_LEVEL > 1
1826 : : OSL_ENSURE(pComboBox == &aOldSymbolSets, "Sm : wrong argument");
1827 : : #endif
1828 [ # # ]: 0 : SelectSymbolSet(aOldSymbolSets, aOldSymbolSets.GetText(), false);
1829 : 0 : return 0;
1830 : : }
1831 : :
1832 : :
1833 : 0 : IMPL_LINK( SmSymDefineDialog, ModifyHdl, ComboBox *, pComboBox )
1834 : : {
1835 : : // remember cursor position for later restoring of it
1836 [ # # ]: 0 : Selection aSelection (pComboBox->GetSelection());
1837 : :
1838 [ # # ]: 0 : if (pComboBox == &aSymbols)
1839 [ # # ][ # # ]: 0 : SelectSymbol(aSymbols, aSymbols.GetText(), false);
[ # # ]
1840 [ # # ]: 0 : else if (pComboBox == &aSymbolSets)
1841 [ # # ][ # # ]: 0 : SelectSymbolSet(aSymbolSets, aSymbolSets.GetText(), false);
[ # # ]
1842 [ # # ]: 0 : else if (pComboBox == &aOldSymbols)
1843 : : // allow only names from the list
1844 [ # # ][ # # ]: 0 : SelectSymbol(aOldSymbols, aOldSymbols.GetText(), true);
[ # # ]
1845 [ # # ]: 0 : else if (pComboBox == &aOldSymbolSets)
1846 : : // allow only names from the list
1847 [ # # ][ # # ]: 0 : SelectSymbolSet(aOldSymbolSets, aOldSymbolSets.GetText(), true);
[ # # ]
1848 [ # # ]: 0 : else if (pComboBox == &aStyles)
1849 : : // allow only names from the list (that's the case here anyway)
1850 [ # # ][ # # ]: 0 : SelectStyle(aStyles.GetText(), true);
[ # # ]
1851 : : else
1852 : : {
1853 : : #if OSL_DEBUG_LEVEL > 1
1854 : : OSL_FAIL("Sm : wrong combobox argument");
1855 : : #endif
1856 : : }
1857 : :
1858 [ # # ]: 0 : pComboBox->SetSelection(aSelection);
1859 : :
1860 [ # # ]: 0 : UpdateButtons();
1861 : :
1862 : 0 : return 0;
1863 : : }
1864 : :
1865 : :
1866 : 0 : IMPL_LINK( SmSymDefineDialog, FontChangeHdl, ListBox *, EMPTYARG pListBox )
1867 : : {
1868 : : (void) pListBox;
1869 : : #if OSL_DEBUG_LEVEL > 1
1870 : : OSL_ENSURE(pListBox == &aFonts, "Sm : wrong argument");
1871 : : #endif
1872 : :
1873 [ # # ]: 0 : SelectFont(aFonts.GetSelectEntry());
1874 : 0 : return 0;
1875 : : }
1876 : :
1877 : :
1878 : 0 : IMPL_LINK( SmSymDefineDialog, SubsetChangeHdl, ListBox *, EMPTYARG pListBox )
1879 : : {
1880 : : (void) pListBox;
1881 : 0 : sal_uInt16 nPos = aFontsSubsetLB.GetSelectEntryPos();
1882 [ # # ]: 0 : if (LISTBOX_ENTRY_NOTFOUND != nPos)
1883 : : {
1884 : 0 : const Subset* pSubset = reinterpret_cast<const Subset*> (aFontsSubsetLB.GetEntryData( nPos ));
1885 [ # # ]: 0 : if (pSubset)
1886 : : {
1887 : 0 : aCharsetDisplay.SelectCharacter( pSubset->GetRangeMin() );
1888 : : }
1889 : : }
1890 : 0 : return 0;
1891 : : }
1892 : :
1893 : :
1894 : 0 : IMPL_LINK( SmSymDefineDialog, StyleChangeHdl, ComboBox *, EMPTYARG pComboBox )
1895 : : {
1896 : : (void) pComboBox;
1897 : : #if OSL_DEBUG_LEVEL > 1
1898 : : OSL_ENSURE(pComboBox == &aStyles, "Sm : falsches Argument");
1899 : : #endif
1900 : :
1901 [ # # ]: 0 : SelectStyle(aStyles.GetText());
1902 : 0 : return 0;
1903 : : }
1904 : :
1905 : :
1906 : 0 : IMPL_LINK_NOARG(SmSymDefineDialog, CharHighlightHdl)
1907 : : {
1908 [ # # ]: 0 : sal_UCS4 cChar = aCharsetDisplay.GetSelectCharacter();
1909 : :
1910 : : #if OSL_DEBUG_LEVEL > 1
1911 : : OSL_ENSURE( pSubsetMap, "SubsetMap missing" );
1912 : : #endif
1913 [ # # ]: 0 : if (pSubsetMap)
1914 : : {
1915 [ # # ]: 0 : const Subset* pSubset = pSubsetMap->GetSubsetByUnicode( cChar );
1916 [ # # ]: 0 : if (pSubset)
1917 [ # # ][ # # ]: 0 : aFontsSubsetLB.SelectEntry( pSubset->GetName() );
[ # # ]
1918 : : else
1919 [ # # ]: 0 : aFontsSubsetLB.SetNoSelection();
1920 : : }
1921 : :
1922 [ # # ]: 0 : aSymbolDisplay.SetSymbol( cChar, aCharsetDisplay.GetFont() );
1923 : :
1924 [ # # ]: 0 : UpdateButtons();
1925 : :
1926 : : // display Unicode position as symbol name while iterating over characters
1927 [ # # ]: 0 : const String aHex(rtl::OUString::valueOf(static_cast<sal_Int64>(cChar), 16 ).toAsciiUpperCase());
1928 [ # # ][ # # ]: 0 : const String aPattern( OUString::createFromAscii( aHex.Len() > 4 ? "Ux000000" : "Ux0000" ) );
1929 [ # # ]: 0 : String aUnicodePos( aPattern.Copy( 0, aPattern.Len() - aHex.Len() ) );
1930 [ # # ]: 0 : aUnicodePos += aHex;
1931 [ # # ]: 0 : aSymbols.SetText( aUnicodePos );
1932 [ # # ]: 0 : aSymbolName.SetText( aUnicodePos );
1933 : :
1934 [ # # ][ # # ]: 0 : return 0;
[ # # ]
1935 : : }
1936 : :
1937 : :
1938 : 0 : IMPL_LINK( SmSymDefineDialog, AddClickHdl, Button *, EMPTYARG pButton )
1939 : : {
1940 : : (void) pButton;
1941 : : #if OSL_DEBUG_LEVEL > 1
1942 : : OSL_ENSURE(pButton == &aAddBtn, "Sm : wrong argument");
1943 : : OSL_ENSURE(aAddBtn.IsEnabled(), "Sm : requirements met ??");
1944 : : #endif
1945 : :
1946 : : // add symbol
1947 : 0 : const SmSym aNewSymbol( aSymbols.GetText(), aCharsetDisplay.GetFont(),
1948 [ # # ]: 0 : aCharsetDisplay.GetSelectCharacter(), aSymbolSets.GetText() );
[ # # # # ]
[ # # ][ # # ]
[ # # ]
1949 : : //OSL_ENSURE( aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL, "symbol already exists" );
1950 [ # # ]: 0 : aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol );
1951 : :
1952 : : // update display of new symbol
1953 [ # # ]: 0 : aSymbolDisplay.SetSymbol( &aNewSymbol );
1954 [ # # ]: 0 : aSymbolName.SetText( aNewSymbol.GetName() );
1955 [ # # ]: 0 : aSymbolSetName.SetText( aNewSymbol.GetSymbolSetName() );
1956 : :
1957 : : // update list box entries
1958 [ # # ]: 0 : FillSymbolSets(aOldSymbolSets, false);
1959 [ # # ]: 0 : FillSymbolSets(aSymbolSets, false);
1960 [ # # ]: 0 : FillSymbols(aOldSymbols ,false);
1961 [ # # ]: 0 : FillSymbols(aSymbols ,false);
1962 : :
1963 [ # # ]: 0 : UpdateButtons();
1964 : :
1965 [ # # ]: 0 : return 0;
1966 : : }
1967 : :
1968 : :
1969 : 0 : IMPL_LINK( SmSymDefineDialog, ChangeClickHdl, Button *, EMPTYARG pButton )
1970 : : {
1971 : : (void) pButton;
1972 : : #if OSL_DEBUG_LEVEL > 1
1973 : : OSL_ENSURE(pButton == &aChangeBtn, "Sm : wrong argument");
1974 : : OSL_ENSURE(aChangeBtn.IsEnabled(), "Sm : requirements met ??");
1975 : : #endif
1976 : :
1977 : : // get new Sybol to use
1978 : : //! get font from symbol-disp lay since charset-display does not keep
1979 : : //! the bold attribut.
1980 : 0 : const SmSym aNewSymbol( aSymbols.GetText(), aCharsetDisplay.GetFont(),
1981 [ # # ]: 0 : aCharsetDisplay.GetSelectCharacter(), aSymbolSets.GetText() );
[ # # # # ]
[ # # ][ # # ]
[ # # ]
1982 : :
1983 : : // remove old symbol if the name was changed then add new one
1984 [ # # ][ # # ]: 0 : const bool bNameChanged = aOldSymbols.GetText() != aSymbols.GetText();
[ # # ][ # # ]
[ # # ]
1985 [ # # ]: 0 : if (bNameChanged)
1986 [ # # ][ # # ]: 0 : aSymbolMgrCopy.RemoveSymbol( aOldSymbols.GetText() );
[ # # ]
1987 [ # # ]: 0 : aSymbolMgrCopy.AddOrReplaceSymbol( aNewSymbol, true );
1988 : :
1989 : : // clear display for original symbol if necessary
1990 [ # # ]: 0 : if (bNameChanged)
1991 [ # # ][ # # ]: 0 : SetOrigSymbol(NULL, rtl::OUString());
[ # # ]
1992 : :
1993 : : // update display of new symbol
1994 [ # # ]: 0 : aSymbolDisplay.SetSymbol( &aNewSymbol );
1995 [ # # ]: 0 : aSymbolName.SetText( aNewSymbol.GetName() );
1996 [ # # ]: 0 : aSymbolSetName.SetText( aNewSymbol.GetSymbolSetName() );
1997 : :
1998 : : // update list box entries
1999 [ # # ]: 0 : FillSymbolSets(aOldSymbolSets, false);
2000 [ # # ]: 0 : FillSymbolSets(aSymbolSets, false);
2001 [ # # ]: 0 : FillSymbols(aOldSymbols ,false);
2002 [ # # ]: 0 : FillSymbols(aSymbols ,false);
2003 : :
2004 [ # # ]: 0 : UpdateButtons();
2005 : :
2006 [ # # ]: 0 : return 0;
2007 : : }
2008 : :
2009 : :
2010 : 0 : IMPL_LINK( SmSymDefineDialog, DeleteClickHdl, Button *, EMPTYARG pButton )
2011 : : {
2012 : : (void) pButton;
2013 : : #if OSL_DEBUG_LEVEL > 1
2014 : : OSL_ENSURE(pButton == &aDeleteBtn, "Sm : wrong argument");
2015 : : OSL_ENSURE(aDeleteBtn.IsEnabled(), "Sm : requirements met ??");
2016 : : #endif
2017 : :
2018 [ # # ]: 0 : if (pOrigSymbol)
2019 : : {
2020 : 0 : aSymbolMgrCopy.RemoveSymbol( pOrigSymbol->GetName() );
2021 : :
2022 : : // clear display for original symbol
2023 [ # # ][ # # ]: 0 : SetOrigSymbol(NULL, rtl::OUString());
[ # # ]
2024 : :
2025 : : // update list box entries
2026 : 0 : FillSymbolSets(aOldSymbolSets, false);
2027 : 0 : FillSymbolSets(aSymbolSets, false);
2028 : 0 : FillSymbols(aOldSymbols ,false);
2029 : 0 : FillSymbols(aSymbols ,false);
2030 : : }
2031 : :
2032 : 0 : UpdateButtons();
2033 : :
2034 : 0 : return 0;
2035 : : }
2036 : :
2037 : :
2038 : 0 : void SmSymDefineDialog::UpdateButtons()
2039 : : {
2040 : 0 : bool bAdd = false,
2041 : 0 : bChange = false,
2042 : 0 : bDelete = false;
2043 [ # # ]: 0 : XubString aTmpSymbolName (aSymbols.GetText()),
2044 [ # # ]: 0 : aTmpSymbolSetName (aSymbolSets.GetText());
2045 : :
2046 [ # # ][ # # ]: 0 : if (aTmpSymbolName.Len() > 0 && aTmpSymbolSetName.Len() > 0)
[ # # ]
2047 : : {
2048 : : // are all settings equal?
2049 : : //! (Font-, Style- und SymbolSet name comparison is not case sensitive)
2050 : : bool bEqual = pOrigSymbol
2051 [ # # ][ # # ]: 0 : && aTmpSymbolSetName.EqualsIgnoreCaseAscii(aOldSymbolSetName.GetText())
[ # # ][ # # ]
[ # # ]
2052 [ # # ]: 0 : && aTmpSymbolName.Equals(pOrigSymbol->GetName())
2053 : : && aFonts.GetSelectEntry().EqualsIgnoreCaseAscii(
2054 [ # # ][ # # ]: 0 : pOrigSymbol->GetFace().GetName())
[ # # ][ # # ]
[ # # ][ # # ]
2055 : : && aStyles.GetText().EqualsIgnoreCaseAscii(
2056 [ # # ][ # # ]: 0 : GetFontStyles().GetStyleName(pOrigSymbol->GetFace()))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2057 [ # # ][ # # ]: 0 : && aCharsetDisplay.GetSelectCharacter() == pOrigSymbol->GetCharacter();
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
2058 : :
2059 : : // only add it if there isn't already a symbol with the same name
2060 [ # # ]: 0 : bAdd = aSymbolMgrCopy.GetSymbolByName(aTmpSymbolName) == NULL;
2061 : :
2062 : : // only delete it if all settings are equal
2063 : 0 : bDelete = pOrigSymbol != NULL;
2064 : :
2065 : : // only change it if the old symbol exists and the new one is different
2066 [ # # ][ # # ]: 0 : bChange = pOrigSymbol && !bEqual;
2067 : : }
2068 : :
2069 [ # # ]: 0 : aAddBtn .Enable(bAdd);
2070 [ # # ]: 0 : aChangeBtn.Enable(bChange);
2071 [ # # ][ # # ]: 0 : aDeleteBtn.Enable(bDelete);
[ # # ]
2072 : 0 : }
2073 : :
2074 : 0 : IMPL_LINK( SmSymDefineDialog, HelpButtonClickHdl, Button *, EMPTYARG /*pButton*/ )
2075 : : {
2076 : : // start help system
2077 : 0 : Help* pHelp = Application::GetHelp();
2078 [ # # ]: 0 : if( pHelp )
2079 : : {
2080 [ # # ][ # # ]: 0 : pHelp->Start( rtl::OUString( "HID_SMA_SYMDEFINEDIALOG" ), &aHelpBtn );
[ # # ]
2081 : : }
2082 : 0 : return 0;
2083 : : }
2084 : :
2085 : 0 : SmSymDefineDialog::SmSymDefineDialog(Window * pParent,
2086 : : OutputDevice *pFntListDevice, SmSymbolManager &rMgr, bool bFreeRes) :
2087 : : ModalDialog (pParent, SmResId(RID_SYMDEFINEDIALOG)),
2088 : : aOldSymbolText (this, SmResId(1)),
2089 : : aOldSymbols (this, SmResId(1)),
2090 : : aOldSymbolSetText (this, SmResId(2)),
2091 : : aOldSymbolSets (this, SmResId(2)),
2092 : : aCharsetDisplay (this, SmResId(1)),
2093 : : aSymbolText (this, SmResId(9)),
2094 : : aSymbols (this, SmResId(4)),
2095 : : aSymbolSetText (this, SmResId(10)),
2096 : : aSymbolSets (this, SmResId(5)),
2097 : : aFontText (this, SmResId(3)),
2098 : : aFonts (this, SmResId(1)),
2099 : : aFontsSubsetFT (this, SmResId( FT_FONTS_SUBSET )),
2100 : : aFontsSubsetLB (this, SmResId( LB_FONTS_SUBSET )),
2101 : : aStyleText (this, SmResId(4)),
2102 : : aStyles (this, SmResId(3)),
2103 : : aOldSymbolName (this, SmResId(7)),
2104 : : aOldSymbolDisplay (this, SmResId(3)),
2105 : : aOldSymbolSetName (this, SmResId(8)),
2106 : : aSymbolName (this, SmResId(5)),
2107 : : aSymbolDisplay (this, SmResId(2)),
2108 : : aSymbolSetName (this, SmResId(6)),
2109 : : aOkBtn (this, SmResId(1)),
2110 : : aHelpBtn (this, SmResId(1)),
2111 : : aCancelBtn (this, SmResId(1)),
2112 : : aAddBtn (this, SmResId(1)),
2113 : : aChangeBtn (this, SmResId(2)),
2114 : : aDeleteBtn (this, SmResId(3)),
2115 : : aRightArrow (this, SmResId(1)),
2116 : : aRigthArrow_Im (SmResId(1)),
2117 : : rSymbolMgr (rMgr),
2118 : : pSubsetMap (NULL),
2119 [ # # ][ # # ]: 0 : pFontList (NULL)
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2120 : : {
2121 [ # # ]: 0 : if (bFreeRes)
2122 [ # # ]: 0 : FreeResource();
2123 : :
2124 [ # # ]: 0 : aHelpBtn.SetClickHdl(LINK(this, SmSymDefineDialog, HelpButtonClickHdl));
2125 : :
2126 [ # # ][ # # ]: 0 : pFontList = new FontList( pFntListDevice );
2127 : :
2128 : 0 : pOrigSymbol = 0;
2129 : :
2130 : : // auto completion is troublesome since that symbols character also gets automatically selected in the
2131 : : // display and if the user previously selected a character to define/redefine that one this is bad
2132 [ # # ]: 0 : aOldSymbols.EnableAutocomplete( false, true );
2133 [ # # ]: 0 : aSymbols .EnableAutocomplete( false, true );
2134 : :
2135 [ # # ]: 0 : FillFonts();
2136 [ # # ][ # # ]: 0 : if (aFonts.GetEntryCount() > 0)
2137 [ # # ][ # # ]: 0 : SelectFont(aFonts.GetEntry(0));
[ # # ]
2138 : :
2139 [ # # ]: 0 : InitColor_Impl();
2140 : :
2141 [ # # ]: 0 : SetSymbolSetManager(rSymbolMgr);
2142 : :
2143 [ # # ]: 0 : aOldSymbols .SetSelectHdl(LINK(this, SmSymDefineDialog, OldSymbolChangeHdl));
2144 [ # # ]: 0 : aOldSymbolSets .SetSelectHdl(LINK(this, SmSymDefineDialog, OldSymbolSetChangeHdl));
2145 [ # # ]: 0 : aSymbolSets .SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
2146 [ # # ]: 0 : aOldSymbolSets .SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
2147 [ # # ]: 0 : aSymbols .SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
2148 [ # # ]: 0 : aOldSymbols .SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
2149 [ # # ]: 0 : aStyles .SetModifyHdl(LINK(this, SmSymDefineDialog, ModifyHdl));
2150 [ # # ]: 0 : aFonts .SetSelectHdl(LINK(this, SmSymDefineDialog, FontChangeHdl));
2151 [ # # ]: 0 : aFontsSubsetLB .SetSelectHdl(LINK(this, SmSymDefineDialog, SubsetChangeHdl));
2152 [ # # ]: 0 : aStyles .SetSelectHdl(LINK(this, SmSymDefineDialog, StyleChangeHdl));
2153 [ # # ]: 0 : aAddBtn .SetClickHdl (LINK(this, SmSymDefineDialog, AddClickHdl));
2154 [ # # ]: 0 : aChangeBtn .SetClickHdl (LINK(this, SmSymDefineDialog, ChangeClickHdl));
2155 [ # # ]: 0 : aDeleteBtn .SetClickHdl (LINK(this, SmSymDefineDialog, DeleteClickHdl));
2156 [ # # ]: 0 : aCharsetDisplay.SetHighlightHdl( LINK( this, SmSymDefineDialog, CharHighlightHdl ) );
2157 : :
2158 : : // preview like controls should have a 2D look
2159 [ # # ]: 0 : aOldSymbolDisplay.SetBorderStyle( WINDOW_BORDER_MONO );
2160 [ # # ]: 0 : aSymbolDisplay .SetBorderStyle( WINDOW_BORDER_MONO );
2161 : 0 : }
2162 : :
2163 : :
2164 [ # # ][ # # ]: 0 : SmSymDefineDialog::~SmSymDefineDialog()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
2165 : : {
2166 [ # # ][ # # ]: 0 : delete pSubsetMap;
2167 [ # # ][ # # ]: 0 : delete pOrigSymbol;
2168 [ # # ]: 0 : }
2169 : :
2170 : 0 : void SmSymDefineDialog::InitColor_Impl()
2171 : : {
2172 : : #if OSL_DEBUG_LEVEL > 1
2173 : : Color aBC( GetDisplayBackground().GetColor() );
2174 : : #endif
2175 : 0 : ColorData nBgCol = COL_WHITE,
2176 : 0 : nTxtCol = COL_BLACK;
2177 : 0 : bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
2178 [ # # ]: 0 : if (bHighContrast)
2179 : : {
2180 : 0 : const StyleSettings &rS = GetSettings().GetStyleSettings();
2181 : 0 : nBgCol = rS.GetFieldColor().GetColor();
2182 : 0 : nTxtCol = rS.GetFieldTextColor().GetColor();
2183 : : }
2184 : :
2185 : 0 : Color aTmpColor( nBgCol );
2186 [ # # ]: 0 : Wallpaper aWall( aTmpColor );
2187 : 0 : Color aTxtColor( nTxtCol );
2188 [ # # ]: 0 : aCharsetDisplay .SetBackground( aWall );
2189 [ # # ]: 0 : aCharsetDisplay .SetTextColor( aTxtColor );
2190 [ # # ]: 0 : aOldSymbolDisplay.SetBackground( aWall );
2191 [ # # ]: 0 : aOldSymbolDisplay.SetTextColor( aTxtColor );
2192 [ # # ]: 0 : aSymbolDisplay .SetBackground( aWall );
2193 [ # # ]: 0 : aSymbolDisplay .SetTextColor( aTxtColor );
2194 : :
2195 : 0 : const Image &rArrowRight = aRigthArrow_Im;
2196 [ # # ][ # # ]: 0 : aRightArrow.SetImage( rArrowRight );
2197 : 0 : }
2198 : :
2199 : :
2200 : 0 : void SmSymDefineDialog::DataChanged( const DataChangedEvent& rDCEvt )
2201 : : {
2202 [ # # # # ]: 0 : if ( rDCEvt.GetType() == DATACHANGED_SETTINGS &&
[ # # ]
2203 : 0 : (rDCEvt.GetFlags() & SETTINGS_STYLE) )
2204 : 0 : InitColor_Impl();
2205 : :
2206 : 0 : ModalDialog::DataChanged( rDCEvt );
2207 : 0 : }
2208 : :
2209 : :
2210 : 0 : short SmSymDefineDialog::Execute()
2211 : : {
2212 : 0 : short nResult = ModalDialog::Execute();
2213 : :
2214 : : // apply changes if dialog was closed by clicking OK
2215 [ # # ][ # # ]: 0 : if (aSymbolMgrCopy.IsModified() && nResult == RET_OK)
[ # # ]
2216 : 0 : rSymbolMgr = aSymbolMgrCopy;
2217 : :
2218 : 0 : return nResult;
2219 : : }
2220 : :
2221 : :
2222 : 0 : void SmSymDefineDialog::SetSymbolSetManager(const SmSymbolManager &rMgr)
2223 : : {
2224 : 0 : aSymbolMgrCopy = rMgr;
2225 : :
2226 : : // Set the modified flag of the copy to false so that
2227 : : // we can check later on if anything has been changed
2228 : 0 : aSymbolMgrCopy.SetModified(false);
2229 : :
2230 : 0 : FillSymbolSets(aOldSymbolSets);
2231 [ # # ]: 0 : if (aOldSymbolSets.GetEntryCount() > 0)
2232 [ # # ]: 0 : SelectSymbolSet(aOldSymbolSets.GetEntry(0));
2233 : 0 : FillSymbolSets(aSymbolSets);
2234 [ # # ]: 0 : if (aSymbolSets.GetEntryCount() > 0)
2235 [ # # ]: 0 : SelectSymbolSet(aSymbolSets.GetEntry(0));
2236 : 0 : FillSymbols(aOldSymbols);
2237 [ # # ]: 0 : if (aOldSymbols.GetEntryCount() > 0)
2238 [ # # ]: 0 : SelectSymbol(aOldSymbols.GetEntry(0));
2239 : 0 : FillSymbols(aSymbols);
2240 [ # # ]: 0 : if (aSymbols.GetEntryCount() > 0)
2241 [ # # ]: 0 : SelectSymbol(aSymbols.GetEntry(0));
2242 : :
2243 : 0 : UpdateButtons();
2244 : 0 : }
2245 : :
2246 : :
2247 : 0 : bool SmSymDefineDialog::SelectSymbolSet(ComboBox &rComboBox,
2248 : : const XubString &rSymbolSetName, bool bDeleteText)
2249 : : {
2250 : : #if OSL_DEBUG_LEVEL > 1
2251 : : OSL_ENSURE(&rComboBox == &aOldSymbolSets || &rComboBox == &aSymbolSets,
2252 : : "Sm : wrong ComboBox");
2253 : : #endif
2254 : :
2255 : : // trim SymbolName (no leading and trailing blanks)
2256 [ # # ]: 0 : XubString aNormName (rSymbolSetName);
2257 [ # # ][ # # ]: 0 : aNormName = comphelper::string::stripStart(aNormName, ' ');
[ # # ]
2258 [ # # ][ # # ]: 0 : aNormName = comphelper::string::stripEnd(aNormName, ' ');
[ # # ]
2259 : : // and remove possible deviations within the input
2260 [ # # ]: 0 : rComboBox.SetText(aNormName);
2261 : :
2262 : 0 : bool bRet = false;
2263 [ # # ]: 0 : sal_uInt16 nPos = rComboBox.GetEntryPos(aNormName);
2264 : :
2265 [ # # ]: 0 : if (nPos != COMBOBOX_ENTRY_NOTFOUND)
2266 : : {
2267 [ # # ][ # # ]: 0 : rComboBox.SetText(rComboBox.GetEntry(nPos));
[ # # ]
2268 : 0 : bRet = true;
2269 : : }
2270 [ # # ]: 0 : else if (bDeleteText)
2271 [ # # ][ # # ]: 0 : rComboBox.SetText(rtl::OUString());
[ # # ]
2272 : :
2273 : 0 : bool bIsOld = &rComboBox == &aOldSymbolSets;
2274 : :
2275 : : // setting the SymbolSet name at the associated display
2276 [ # # ]: 0 : FixedText &rFT = bIsOld ? aOldSymbolSetName : aSymbolSetName;
2277 [ # # ][ # # ]: 0 : rFT.SetText(rComboBox.GetText());
[ # # ]
2278 : :
2279 : : // set the symbol name which belongs to the SymbolSet at the associated combobox
2280 [ # # ]: 0 : ComboBox &rCB = bIsOld ? aOldSymbols : aSymbols;
2281 [ # # ]: 0 : FillSymbols(rCB, false);
2282 : :
2283 : : // display a valid respectively no symbol when changing the SymbolSets
2284 [ # # ]: 0 : if (bIsOld)
2285 : : {
2286 [ # # ]: 0 : XubString aTmpOldSymbolName;
2287 [ # # ][ # # ]: 0 : if (aOldSymbols.GetEntryCount() > 0)
2288 [ # # ][ # # ]: 0 : aTmpOldSymbolName = aOldSymbols.GetEntry(0);
[ # # ]
2289 [ # # ][ # # ]: 0 : SelectSymbol(aOldSymbols, aTmpOldSymbolName, true);
2290 : : }
2291 : :
2292 [ # # ]: 0 : UpdateButtons();
2293 : :
2294 [ # # ]: 0 : return bRet;
2295 : : }
2296 : :
2297 : :
2298 : 0 : void SmSymDefineDialog::SetOrigSymbol(const SmSym *pSymbol,
2299 : : const XubString &rSymbolSetName)
2300 : : {
2301 : : // clear old symbol
2302 [ # # ][ # # ]: 0 : delete pOrigSymbol;
2303 : 0 : pOrigSymbol = 0;
2304 : :
2305 [ # # ]: 0 : XubString aSymName,
2306 [ # # ]: 0 : aSymSetName;
2307 [ # # ]: 0 : if (pSymbol)
2308 : : {
2309 : : // set new symbol
2310 [ # # ][ # # ]: 0 : pOrigSymbol = new SmSym( *pSymbol );
2311 : :
2312 [ # # ]: 0 : aSymName = pSymbol->GetName();
2313 [ # # ]: 0 : aSymSetName = rSymbolSetName;
2314 [ # # ]: 0 : aOldSymbolDisplay.SetSymbol( pSymbol );
2315 : : }
2316 : : else
2317 : : { // delete displayed symbols
2318 [ # # ][ # # ]: 0 : aOldSymbolDisplay.SetText(rtl::OUString());
[ # # ]
2319 [ # # ]: 0 : aOldSymbolDisplay.Invalidate();
2320 : : }
2321 [ # # ]: 0 : aOldSymbolName .SetText(aSymName);
2322 [ # # ][ # # ]: 0 : aOldSymbolSetName.SetText(aSymSetName);
[ # # ]
2323 : 0 : }
2324 : :
2325 : :
2326 : 0 : bool SmSymDefineDialog::SelectSymbol(ComboBox &rComboBox,
2327 : : const XubString &rSymbolName, bool bDeleteText)
2328 : : {
2329 : : #if OSL_DEBUG_LEVEL > 1
2330 : : OSL_ENSURE(&rComboBox == &aOldSymbols || &rComboBox == &aSymbols,
2331 : : "Sm : wrong ComboBox");
2332 : : #endif
2333 : :
2334 : : // trim SymbolName (no blanks)
2335 [ # # ][ # # ]: 0 : XubString aNormName(comphelper::string::remove(rSymbolName, ' '));
2336 : : // and remove possible deviations within the input
2337 [ # # ]: 0 : rComboBox.SetText(aNormName);
2338 : :
2339 : 0 : bool bRet = false;
2340 [ # # ]: 0 : sal_uInt16 nPos = rComboBox.GetEntryPos(aNormName);
2341 : :
2342 : 0 : bool bIsOld = &rComboBox == &aOldSymbols;
2343 : :
2344 [ # # ]: 0 : if (nPos != COMBOBOX_ENTRY_NOTFOUND)
2345 : : {
2346 [ # # ][ # # ]: 0 : rComboBox.SetText(rComboBox.GetEntry(nPos));
[ # # ]
2347 : :
2348 [ # # ]: 0 : if (!bIsOld)
2349 : : {
2350 [ # # ]: 0 : const SmSym *pSymbol = GetSymbol(aSymbols);
2351 [ # # ]: 0 : if (pSymbol)
2352 : : {
2353 : : // choose font and style accordingly
2354 : 0 : const Font &rFont = pSymbol->GetFace();
2355 [ # # ][ # # ]: 0 : SelectFont(rFont.GetName(), false);
2356 [ # # ][ # # ]: 0 : SelectStyle(GetFontStyles().GetStyleName(rFont), false);
[ # # ]
2357 : :
2358 : : // Since setting the Font via the Style name of the SymbolFonts doesn't
2359 : : // work really well (e.g. it can be empty even though the font itself is
2360 : : // bold or italic) we're manually setting the Font with respect to the Symbol
2361 [ # # ]: 0 : aCharsetDisplay.SetFont(rFont);
2362 [ # # ]: 0 : aSymbolDisplay.SetFont(rFont);
2363 : :
2364 : : // select associated character
2365 [ # # ]: 0 : SelectChar(pSymbol->GetCharacter());
2366 : :
2367 : : // since SelectChar will also set the unicode point as text in the
2368 : : // symbols box, we have to set the symbol name again to get that one displayed
2369 [ # # ]: 0 : aSymbols.SetText( pSymbol->GetName() );
2370 : : }
2371 : : }
2372 : :
2373 : 0 : bRet = true;
2374 : : }
2375 [ # # ]: 0 : else if (bDeleteText)
2376 [ # # ][ # # ]: 0 : rComboBox.SetText(rtl::OUString());
[ # # ]
2377 : :
2378 [ # # ]: 0 : if (bIsOld)
2379 : : {
2380 : : // if there's a change of the old symbol, show only the available ones, otherwise show none
2381 : 0 : const SmSym *pOldSymbol = NULL;
2382 [ # # ]: 0 : XubString aTmpOldSymbolSetName;
2383 [ # # ]: 0 : if (nPos != COMBOBOX_ENTRY_NOTFOUND)
2384 : : {
2385 [ # # ]: 0 : pOldSymbol = aSymbolMgrCopy.GetSymbolByName(aNormName);
2386 [ # # ][ # # ]: 0 : aTmpOldSymbolSetName = aOldSymbolSets.GetText();
[ # # ]
2387 : : }
2388 [ # # ][ # # ]: 0 : SetOrigSymbol(pOldSymbol, aTmpOldSymbolSetName);
2389 : : }
2390 : : else
2391 [ # # ][ # # ]: 0 : aSymbolName.SetText(rComboBox.GetText());
[ # # ]
2392 : :
2393 [ # # ]: 0 : UpdateButtons();
2394 : :
2395 [ # # ]: 0 : return bRet;
2396 : : }
2397 : :
2398 : :
2399 : 0 : void SmSymDefineDialog::SetFont(const XubString &rFontName, const XubString &rStyleName)
2400 : : {
2401 : : // get Font (FontInfo) matching name and style
2402 [ # # ]: 0 : FontInfo aFI;
2403 [ # # ]: 0 : if (pFontList)
2404 [ # # ][ # # ]: 0 : aFI = pFontList->Get(rFontName, WEIGHT_NORMAL, ITALIC_NONE);
[ # # ]
2405 [ # # ]: 0 : SetFontStyle(rStyleName, aFI);
2406 : :
2407 [ # # ]: 0 : aCharsetDisplay.SetFont(aFI);
2408 [ # # ]: 0 : aSymbolDisplay.SetFont(aFI);
2409 : :
2410 : : // update subset listbox for new font's unicode subsets
2411 [ # # ]: 0 : FontCharMap aFontCharMap;
2412 [ # # ]: 0 : aCharsetDisplay.GetFontCharMap( aFontCharMap );
2413 [ # # ]: 0 : if (pSubsetMap)
2414 [ # # ][ # # ]: 0 : delete pSubsetMap;
2415 [ # # ][ # # ]: 0 : pSubsetMap = new SubsetMap( &aFontCharMap );
2416 : :
2417 [ # # ]: 0 : aFontsSubsetLB.Clear();
2418 : 0 : bool bFirst = true;
2419 : : const Subset* pSubset;
2420 [ # # ][ # # ]: 0 : while( NULL != (pSubset = pSubsetMap->GetNextSubset( bFirst )) )
2421 : : {
2422 [ # # ][ # # ]: 0 : sal_uInt16 nPos = aFontsSubsetLB.InsertEntry( pSubset->GetName());
[ # # ]
2423 [ # # ]: 0 : aFontsSubsetLB.SetEntryData( nPos, (void *) pSubset );
2424 : : // subset must live at least as long as the selected font !!!
2425 [ # # ]: 0 : if( bFirst )
2426 [ # # ]: 0 : aFontsSubsetLB.SelectEntryPos( nPos );
2427 : 0 : bFirst = false;
2428 : : }
2429 [ # # ]: 0 : if( bFirst )
2430 [ # # ]: 0 : aFontsSubsetLB.SetNoSelection();
2431 [ # # ][ # # ]: 0 : aFontsSubsetLB.Enable( !bFirst );
[ # # ]
2432 : 0 : }
2433 : :
2434 : :
2435 : 0 : bool SmSymDefineDialog::SelectFont(const XubString &rFontName, bool bApplyFont)
2436 : : {
2437 : 0 : bool bRet = false;
2438 : 0 : sal_uInt16 nPos = aFonts.GetEntryPos(rFontName);
2439 : :
2440 [ # # ]: 0 : if (nPos != LISTBOX_ENTRY_NOTFOUND)
2441 : : {
2442 : 0 : aFonts.SelectEntryPos(nPos);
2443 [ # # ]: 0 : if (aStyles.GetEntryCount() > 0)
2444 [ # # ]: 0 : SelectStyle(aStyles.GetEntry(0));
2445 [ # # ]: 0 : if (bApplyFont)
2446 : : {
2447 [ # # ][ # # ]: 0 : SetFont(aFonts.GetSelectEntry(), aStyles.GetText());
[ # # ]
2448 : 0 : bRet = true;
2449 : 0 : aSymbolDisplay.SetSymbol( aCharsetDisplay.GetSelectCharacter(), aCharsetDisplay.GetFont() );
2450 : : }
2451 : 0 : bRet = sal_True;
2452 : : }
2453 : : else
2454 : 0 : aFonts.SetNoSelection();
2455 : 0 : FillStyles();
2456 : :
2457 : 0 : UpdateButtons();
2458 : :
2459 : 0 : return bRet;
2460 : : }
2461 : :
2462 : :
2463 : 0 : bool SmSymDefineDialog::SelectStyle(const XubString &rStyleName, bool bApplyFont)
2464 : : {
2465 : 0 : bool bRet = false;
2466 : 0 : sal_uInt16 nPos = aStyles.GetEntryPos(rStyleName);
2467 : :
2468 : : // if the style is not available take the first available one (if existent)
2469 [ # # ][ # # ]: 0 : if (nPos == COMBOBOX_ENTRY_NOTFOUND && aStyles.GetEntryCount() > 0)
[ # # ]
2470 : 0 : nPos = 0;
2471 : :
2472 [ # # ]: 0 : if (nPos != COMBOBOX_ENTRY_NOTFOUND)
2473 : : {
2474 [ # # ]: 0 : aStyles.SetText(aStyles.GetEntry(nPos));
2475 [ # # ]: 0 : if (bApplyFont)
2476 : : {
2477 [ # # ][ # # ]: 0 : SetFont(aFonts.GetSelectEntry(), aStyles.GetText());
[ # # ]
2478 : 0 : bRet = true;
2479 : 0 : aSymbolDisplay.SetSymbol( aCharsetDisplay.GetSelectCharacter(), aCharsetDisplay.GetFont() );
2480 : : }
2481 : 0 : bRet = sal_True;
2482 : : }
2483 : : else
2484 [ # # ][ # # ]: 0 : aStyles.SetText(rtl::OUString());
[ # # ]
2485 : :
2486 : 0 : UpdateButtons();
2487 : :
2488 : 0 : return bRet;
2489 : : }
2490 : :
2491 : :
2492 : 0 : void SmSymDefineDialog::SelectChar(xub_Unicode cChar)
2493 : : {
2494 : 0 : aCharsetDisplay.SelectCharacter( cChar );
2495 : 0 : aSymbolDisplay.SetSymbol( cChar, aCharsetDisplay.GetFont() );
2496 : :
2497 : 0 : UpdateButtons();
2498 [ + - ][ + - ]: 30 : }
2499 : :
2500 : :
2501 : : /**************************************************************************/
2502 : :
2503 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|