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 : : #ifndef DIALOG_HXX
20 : : #define DIALOG_HXX
21 : :
22 : : #include <vcl/image.hxx>
23 : : #include <vcl/dialog.hxx>
24 : : #include <vcl/fixed.hxx>
25 : : #include <vcl/button.hxx>
26 : : #include <sfx2/tabdlg.hxx>
27 : : #include <vcl/combobox.hxx>
28 : : #include <svx/charmap.hxx>
29 : : #include <sfx2/basedlgs.hxx>
30 : : #include <vcl/field.hxx>
31 : : #include <vcl/menubtn.hxx>
32 : : #include <vcl/scrbar.hxx>
33 : : #include <vcl/ctrl.hxx>
34 : : #include <vcl/menu.hxx>
35 : : #include <vcl/outdev.hxx>
36 : : #include <svtools/ctrlbox.hxx>
37 : : #include <svtools/ctrltool.hxx>
38 : : #include "utility.hxx"
39 : : #include "format.hxx"
40 : : #include "symbol.hxx"
41 : :
42 : : class SubsetMap;
43 : : #define CATEGORY_NONE 0xFFFF
44 : :
45 : : /**************************************************************************/
46 : :
47 : : void SetFontStyle(const XubString &rStyleName, Font &rFont);
48 : :
49 : : /**************************************************************************/
50 : :
51 [ # # ][ # # ]: 0 : class SmPrintOptionsTabPage : public SfxTabPage
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
52 : : {
53 : : FixedLine aFixedLine1;
54 : : CheckBox aTitle;
55 : : CheckBox aText;
56 : : CheckBox aFrame;
57 : : FixedLine aFixedLine2;
58 : : RadioButton aSizeNormal;
59 : : RadioButton aSizeScaled;
60 : : RadioButton aSizeZoomed;
61 : : MetricField aZoom;
62 : : FixedLine aFixedLine3;
63 : : CheckBox aNoRightSpaces;
64 : : CheckBox aSaveOnlyUsedSymbols;
65 : :
66 : : DECL_LINK(SizeButtonClickHdl, Button *);
67 : :
68 : : virtual sal_Bool FillItemSet(SfxItemSet& rSet);
69 : : virtual void Reset(const SfxItemSet& rSet);
70 : :
71 : : public:
72 : : static SfxTabPage* Create(Window *pWindow, const SfxItemSet &rSet);
73 : :
74 : : SmPrintOptionsTabPage(Window *pParent, const SfxItemSet &rOptions);
75 : : };
76 : :
77 : : /**************************************************************************/
78 : :
79 [ # # ]: 0 : class SmShowFont : public Control
80 : : {
81 : : virtual void Paint(const Rectangle&);
82 : :
83 : : public:
84 : 0 : SmShowFont(Window *pParent, const ResId& rResId) :
85 : 0 : Control(pParent, rResId)
86 : : {
87 : 0 : }
88 : :
89 : : void SetFont(const Font& rFont);
90 : : };
91 : :
92 [ # # ][ # # ]: 0 : class SmFontDialog : public ModalDialog
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
93 : : {
94 : : FixedText aFixedText1;
95 : : ComboBox aFontBox;
96 : : CheckBox aBoldCheckBox;
97 : : CheckBox aItalicCheckBox;
98 : : OKButton aOKButton1;
99 : : HelpButton aHelpButton1;
100 : : CancelButton aCancelButton1;
101 : : SmShowFont aShowFont;
102 : : FixedText aFixedText2;
103 : :
104 : : Font Face;
105 : :
106 : : DECL_LINK(FontSelectHdl, ComboBox *);
107 : : DECL_LINK(FontModifyHdl, ComboBox *);
108 : : DECL_LINK(AttrChangeHdl, CheckBox *);
109 : : DECL_LINK(HelpButtonClickHdl, Button *);
110 : :
111 : : void InitColor_Impl();
112 : :
113 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
114 : :
115 : : public:
116 : : SmFontDialog(Window * pParent, OutputDevice *pFntListDevice, bool bHideCheckboxes, bool bFreeRes = true);
117 : :
118 : 0 : const Font& GetFont() const { return Face; }
119 : : void SetFont(const Font &rFont);
120 : : };
121 : :
122 : : /**************************************************************************/
123 : :
124 [ # # ][ # # ]: 0 : class SmFontSizeDialog : public ModalDialog
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
125 : : {
126 : : FixedText aFixedText1;
127 : : MetricField aBaseSize;
128 : : FixedText aFixedText4;
129 : : MetricField aTextSize;
130 : : FixedText aFixedText5;
131 : : MetricField aIndexSize;
132 : : FixedText aFixedText6;
133 : : MetricField aFunctionSize;
134 : : FixedText aFixedText7;
135 : : MetricField aOperatorSize;
136 : : FixedText aFixedText8;
137 : : MetricField aBorderSize;
138 : : FixedLine aFixedLine1;
139 : : OKButton aOKButton1;
140 : : HelpButton aHelpButton1;
141 : : CancelButton aCancelButton1;
142 : : PushButton aDefaultButton;
143 : :
144 : : DECL_LINK(DefaultButtonClickHdl, Button *);
145 : : DECL_LINK(HelpButtonClickHdl, Button *);
146 : :
147 : : public:
148 : : SmFontSizeDialog(Window *pParent, bool bFreeRes = true);
149 : :
150 : : void ReadFrom(const SmFormat &rFormat);
151 : : void WriteTo (SmFormat &rFormat) const;
152 : : };
153 : :
154 : : /**************************************************************************/
155 : :
156 [ # # ][ # # ]: 0 : class SmFontTypeDialog : public ModalDialog
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
157 : : {
158 : : FixedText aFixedText1;
159 : : SmFontPickListBox aVariableFont;
160 : : FixedText aFixedText2;
161 : : SmFontPickListBox aFunctionFont;
162 : : FixedText aFixedText3;
163 : : SmFontPickListBox aNumberFont;
164 : : FixedText aFixedText4;
165 : : SmFontPickListBox aTextFont;
166 : : FixedText aFixedText5;
167 : : SmFontPickListBox aSerifFont;
168 : : FixedText aFixedText6;
169 : : SmFontPickListBox aSansFont;
170 : : FixedText aFixedText7;
171 : : SmFontPickListBox aFixedFont;
172 : : FixedLine aFixedLine1;
173 : : FixedLine aFixedLine2;
174 : : OKButton aOKButton1;
175 : : HelpButton aHelpButton1;
176 : : CancelButton aCancelButton1;
177 : : MenuButton aMenuButton;
178 : : PushButton aDefaultButton;
179 : :
180 : : OutputDevice *pFontListDev;
181 : :
182 : : DECL_LINK(MenuSelectHdl, Menu *);
183 : : DECL_LINK(DefaultButtonClickHdl, Button *);
184 : : DECL_LINK(HelpButtonClickHdl, Button *);
185 : :
186 : : public:
187 : : SmFontTypeDialog(Window *pParent, OutputDevice *pFntListDevice, bool bFreeRes = true);
188 : :
189 : : void ReadFrom(const SmFormat &rFormat);
190 : : void WriteTo (SmFormat &rFormat) const;
191 : : };
192 : :
193 : : /**************************************************************************/
194 : :
195 : : #define NOCATEGORIES 10
196 : :
197 : : class SmCategoryDesc : public Resource
198 : : {
199 : : rtl::OUString Name;
200 : : rtl::OUString *Strings[4];
201 : : Bitmap *Graphics[4]; /* regular bitmaps */
202 : : sal_uInt16 Minimum[4];
203 : : sal_uInt16 Maximum[4];
204 : : sal_uInt16 Value[4];
205 : :
206 : : public:
207 : : SmCategoryDesc(const ResId &rResId, sal_uInt16 nCategoryIdx);
208 : : ~SmCategoryDesc();
209 : :
210 : 0 : const rtl::OUString& GetName() const { return Name; }
211 : 0 : const rtl::OUString* GetString(sal_uInt16 Index) const { return Strings[Index]; }
212 : 0 : sal_uInt16 GetMinimum(sal_uInt16 Index) { return Minimum[Index]; }
213 : 0 : sal_uInt16 GetMaximum(sal_uInt16 Index) { return Maximum[Index]; }
214 : 0 : sal_uInt16 GetValue(sal_uInt16 Index) const { return Value[Index]; }
215 : 0 : void SetValue(sal_uInt16 Index, sal_uInt16 nVal) { Value[Index] = nVal;}
216 : :
217 : 0 : const Bitmap * GetGraphic(sal_uInt16 Index) const
218 : : {
219 : 0 : return Graphics[Index];
220 : : }
221 : : };
222 : :
223 : :
224 : : class SmDistanceDialog : public ModalDialog
225 : : {
226 : : FixedText aFixedText1;
227 : : MetricField aMetricField1;
228 : : FixedText aFixedText2;
229 : : MetricField aMetricField2;
230 : : FixedText aFixedText3;
231 : : MetricField aMetricField3;
232 : : CheckBox aCheckBox1;
233 : : FixedText aFixedText4;
234 : : MetricField aMetricField4;
235 : : OKButton aOKButton1;
236 : : HelpButton aHelpButton1;
237 : : CancelButton aCancelButton1;
238 : : MenuButton aMenuButton;
239 : : PushButton aDefaultButton;
240 : : FixedBitmap aBitmap;
241 : : FixedLine aFixedLine;
242 : :
243 : : SmCategoryDesc *Categories[NOCATEGORIES];
244 : : sal_uInt16 nActiveCategory;
245 : : bool bScaleAllBrackets;
246 : :
247 : : DECL_LINK(GetFocusHdl, Control *);
248 : : DECL_LINK(MenuSelectHdl, Menu *);
249 : : DECL_LINK(DefaultButtonClickHdl, Button *);
250 : : DECL_LINK(HelpButtonClickHdl, Button *);
251 : : DECL_LINK(CheckBoxClickHdl, CheckBox *);
252 : :
253 : : using Window::SetHelpId;
254 : : void SetHelpId(MetricField &rField, const rtl::OString& sHelpId);
255 : : void SetCategory(sal_uInt16 Category);
256 : :
257 : : public:
258 : : SmDistanceDialog(Window *pParent, bool bFreeRes = true);
259 : : ~SmDistanceDialog();
260 : :
261 : : void ReadFrom(const SmFormat &rFormat);
262 : : void WriteTo (SmFormat &rFormat) /*const*/;
263 : :
264 : : // Window
265 : : virtual void DataChanged( const DataChangedEvent &rEvt );
266 : : };
267 : :
268 : :
269 : : /**************************************************************************/
270 : :
271 : :
272 [ # # ][ # # ]: 0 : class SmAlignDialog : public ModalDialog
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
273 : : {
274 : : RadioButton aLeft;
275 : : RadioButton aCenter;
276 : : RadioButton aRight;
277 : : FixedLine aFixedLine1;
278 : : OKButton aOKButton1;
279 : : HelpButton aHelpButton1;
280 : : CancelButton aCancelButton1;
281 : : PushButton aDefaultButton;
282 : :
283 : : DECL_LINK(DefaultButtonClickHdl, Button *);
284 : : DECL_LINK(HelpButtonClickHdl, Button *);
285 : :
286 : : public:
287 : : SmAlignDialog(Window *pParent, bool bFreeRes = true);
288 : :
289 : : void ReadFrom(const SmFormat &rFormat);
290 : : void WriteTo (SmFormat &rFormat) const;
291 : : };
292 : :
293 : : /**************************************************************************/
294 : :
295 [ # # ][ # # ]: 0 : class SmShowSymbolSet : public Control
296 : : {
297 : : SymbolPtrVec_t aSymbolSet;
298 : : ScrollBar aVScrollBar;
299 : : Size aOutputSize;
300 : : Link aSelectHdlLink;
301 : : Link aDblClickHdlLink;
302 : : sal_uInt16 nLen;
303 : : sal_uInt16 nRows, nColumns;
304 : : sal_uInt16 nSelectSymbol;
305 : :
306 : : virtual void Paint(const Rectangle&);
307 : : virtual void MouseButtonDown(const MouseEvent& rMEvt);
308 : : virtual void KeyInput(const KeyEvent& rKEvt);
309 : :
310 : : DECL_LINK( ScrollHdl, ScrollBar* );
311 : :
312 : : public:
313 : : SmShowSymbolSet(Window *pParent, const ResId& rResId);
314 : :
315 : : void SetSymbolSet(const SymbolPtrVec_t& rSymbolSet);
316 : :
317 : : void SelectSymbol(sal_uInt16 nSymbol);
318 : 0 : sal_uInt16 GetSelectSymbol() const { return nSelectSymbol; }
319 : :
320 : 0 : void SetSelectHdl(const Link& rLink) { aSelectHdlLink = rLink; }
321 : 0 : void SetDblClickHdl(const Link& rLink) { aDblClickHdlLink = rLink; }
322 : : };
323 : :
324 : : ////////////////////////////////////////////////////////////////////////////////
325 : :
326 [ # # ]: 0 : class SmShowSymbol : public Control
327 : : {
328 : : Link aDblClickHdlLink;
329 : :
330 : : virtual void Paint(const Rectangle&);
331 : : virtual void MouseButtonDown(const MouseEvent& rMEvt);
332 : :
333 : : public:
334 : 0 : SmShowSymbol(Window *pParent, const ResId& rResId) :
335 [ # # ]: 0 : Control(pParent, rResId) {}
336 : :
337 : : void SetSymbol(const SmSym *pSymbol);
338 : 0 : void SetDblClickHdl(const Link &rLink) { aDblClickHdlLink = rLink; }
339 : : };
340 : :
341 : : ////////////////////////////////////////////////////////////////////////////////
342 : :
343 : : class SmSymDefineDialog;
344 : :
345 : : class SmSymbolDialog : public ModalDialog
346 : : {
347 : : FixedText aSymbolSetText;
348 : : ListBox aSymbolSets;
349 : : SmShowSymbolSet aSymbolSetDisplay;
350 : : FixedText aSymbolName;
351 : : SmShowSymbol aSymbolDisplay;
352 : : HelpButton aHelpBtn;
353 : : PushButton aGetBtn;
354 : : PushButton aCloseBtn;
355 : : PushButton aEditBtn;
356 : :
357 : : SmViewShell &rViewSh;
358 : : SmSymbolManager &rSymbolMgr;
359 : :
360 : : rtl::OUString aSymbolSetName;
361 : : SymbolPtrVec_t aSymbolSet;
362 : :
363 : : OutputDevice *pFontListDev;
364 : :
365 : : DECL_LINK(SymbolSetChangeHdl, ListBox *);
366 : : DECL_LINK(SymbolChangeHdl, SmShowSymbolSet *);
367 : : DECL_LINK(SymbolDblClickHdl, SmShowSymbolSet *);
368 : : DECL_LINK(CloseClickHdl, Button *);
369 : : DECL_LINK(EditClickHdl, Button *);
370 : : DECL_LINK(GetClickHdl, Button *);
371 : : DECL_LINK(HelpButtonClickHdl, Button *);
372 : :
373 : : void FillSymbolSets(bool bDeleteText = true);
374 : : void SetSymbolSetManager(SmSymbolManager &rMgr);
375 : : const SmSym *GetSymbol() const;
376 : : void InitColor_Impl();
377 : :
378 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
379 : :
380 : : public:
381 : : SmSymbolDialog(Window * pParent, OutputDevice *pFntListDevice,
382 : : SmSymbolManager &rSymbolMgr, SmViewShell &rViewShell, bool bFreeRes = true);
383 : : virtual ~SmSymbolDialog();
384 : :
385 : : bool SelectSymbolSet(const XubString &rSymbolSetName);
386 : : void SelectSymbol(sal_uInt16 nSymbolPos);
387 : 0 : sal_uInt16 GetSelectedSymbol() const { return aSymbolSetDisplay.GetSelectSymbol(); }
388 : : };
389 : :
390 : : ////////////////////////////////////////////////////////////////////////////////
391 : :
392 [ # # ]: 0 : class SmShowChar : public Control
393 : : {
394 : : virtual void Paint(const Rectangle&);
395 : :
396 : : public:
397 : 0 : SmShowChar(Window *pParent, const ResId& rResId)
398 : 0 : : Control(pParent, rResId)
399 : : {
400 : 0 : }
401 : :
402 : : void SetSymbol( const SmSym *pSym );
403 : : void SetSymbol( sal_UCS4 cChar, const Font &rFont );
404 : : };
405 : :
406 : : ////////////////////////////////////////////////////////////////////////////////
407 : :
408 : : class SmSymDefineDialog : public ModalDialog
409 : : {
410 : : FixedText aOldSymbolText;
411 : : ComboBox aOldSymbols;
412 : : FixedText aOldSymbolSetText;
413 : : ComboBox aOldSymbolSets;
414 : : SvxShowCharSet aCharsetDisplay;
415 : : FixedText aSymbolText;
416 : : ComboBox aSymbols;
417 : : FixedText aSymbolSetText;
418 : : ComboBox aSymbolSets;
419 : : FixedText aFontText;
420 : : ListBox aFonts;
421 : : FixedText aFontsSubsetFT;
422 : : ListBox aFontsSubsetLB;
423 : : FixedText aStyleText;
424 : : FontStyleBox aStyles;
425 : : FixedText aOldSymbolName;
426 : : SmShowChar aOldSymbolDisplay;
427 : : FixedText aOldSymbolSetName;
428 : : FixedText aSymbolName;
429 : : SmShowChar aSymbolDisplay;
430 : : FixedText aSymbolSetName;
431 : : OKButton aOkBtn;
432 : : HelpButton aHelpBtn;
433 : : CancelButton aCancelBtn;
434 : : PushButton aAddBtn;
435 : : PushButton aChangeBtn;
436 : : PushButton aDeleteBtn;
437 : : FixedImage aRightArrow;
438 : : Image aRigthArrow_Im;
439 : :
440 : : SmSymbolManager aSymbolMgrCopy,
441 : : &rSymbolMgr;
442 : : const SmSym *pOrigSymbol;
443 : :
444 : : const SubsetMap *pSubsetMap;
445 : : FontList *pFontList;
446 : :
447 : : DECL_LINK(OldSymbolChangeHdl, ComboBox *);
448 : : DECL_LINK(OldSymbolSetChangeHdl, ComboBox *);
449 : : DECL_LINK(ModifyHdl, ComboBox *);
450 : : DECL_LINK(FontChangeHdl, ListBox *);
451 : : DECL_LINK(SubsetChangeHdl, ListBox*);
452 : : DECL_LINK(StyleChangeHdl, ComboBox *);
453 : : DECL_LINK(CharHighlightHdl, void *);
454 : : DECL_LINK(AddClickHdl, Button *);
455 : : DECL_LINK(ChangeClickHdl, Button *);
456 : : DECL_LINK(DeleteClickHdl, Button *);
457 : : DECL_LINK(HelpButtonClickHdl, Button *);
458 : :
459 : : void FillSymbols(ComboBox &rComboBox, bool bDeleteText = true);
460 : : void FillSymbolSets(ComboBox &rComboBox, bool bDeleteText = true);
461 : : void FillFonts(bool bDeleteText = true);
462 : : void FillStyles(bool bDeleteText = true);
463 : :
464 : : void SetSymbolSetManager(const SmSymbolManager &rMgr);
465 : : void SetFont(const XubString &rFontName, const XubString &rStyleName);
466 : : void SetOrigSymbol(const SmSym *pSymbol, const XubString &rSymbolSetName);
467 : : void UpdateButtons();
468 : :
469 : : bool SelectSymbolSet(ComboBox &rComboBox, const XubString &rSymbolSetName,
470 : : bool bDeleteText);
471 : : bool SelectSymbol(ComboBox &rComboBox, const XubString &rSymbolName,
472 : : bool bDeleteText);
473 : : bool SelectFont(const XubString &rFontName, bool bApplyFont);
474 : : bool SelectStyle(const XubString &rStyleName, bool bApplyFont);
475 : :
476 : : SmSym * GetSymbol(const ComboBox &rComboBox);
477 : : const SmSym * GetSymbol(const ComboBox &rComboBox) const
478 : : {
479 : : return ((SmSymDefineDialog *) this)->GetSymbol(rComboBox);
480 : : }
481 : :
482 : : void InitColor_Impl();
483 : :
484 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
485 : :
486 : : public:
487 : : SmSymDefineDialog(Window *pParent, OutputDevice *pFntListDevice, SmSymbolManager &rMgr, bool bFreeRes = true);
488 : : ~SmSymDefineDialog();
489 : :
490 : : using OutputDevice::SetFont;
491 : :
492 : : // Dialog
493 : : virtual short Execute();
494 : :
495 : 0 : bool SelectOldSymbolSet(const XubString &rSymbolSetName)
496 : : {
497 : 0 : return SelectSymbolSet(aOldSymbolSets, rSymbolSetName, false);
498 : : }
499 : :
500 : 0 : bool SelectOldSymbol(const XubString &rSymbolName)
501 : : {
502 : 0 : return SelectSymbol(aOldSymbols, rSymbolName, false);
503 : : }
504 : :
505 : 0 : bool SelectSymbolSet(const XubString &rSymbolSetName)
506 : : {
507 : 0 : return SelectSymbolSet(aSymbolSets, rSymbolSetName, false);
508 : : }
509 : :
510 : 0 : bool SelectSymbol(const XubString &rSymbolName)
511 : : {
512 : 0 : return SelectSymbol(aSymbols, rSymbolName, false);
513 : : }
514 : :
515 : 0 : bool SelectFont(const XubString &rFontName) { return SelectFont(rFontName, true); }
516 : 0 : bool SelectStyle(const XubString &rStyleName) { return SelectStyle(rStyleName, true); };
517 : : void SelectChar(xub_Unicode cChar);
518 : : };
519 : :
520 : :
521 : :
522 : : #endif
523 : :
524 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|